@league-of-foundry-developers/foundry-vtt-types 13.340.0 → 13.340.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (543) hide show
  1. package/README.md +6 -3
  2. package/package.json +40 -18
  3. package/src/configuration/configuration.d.mts +24 -23
  4. package/src/configuration/documents.d.mts +295 -0
  5. package/src/configuration/globals.d.mts +8 -2
  6. package/src/configuration/index.d.mts +1 -0
  7. package/src/foundry/client/apps/app.d.mts +121 -119
  8. package/src/foundry/client/apps/av/av-config.d.mts +13 -8
  9. package/src/foundry/client/apps/av/cameras.d.mts +11 -11
  10. package/src/foundry/client/apps/dice/dice-config.d.mts +22 -8
  11. package/src/foundry/client/apps/form.d.mts +112 -94
  12. package/src/foundry/client/apps/forms/actor.d.mts +22 -12
  13. package/src/foundry/client/apps/forms/adventure-exporter.d.mts +13 -8
  14. package/src/foundry/client/apps/forms/adventure-importer.d.mts +15 -7
  15. package/src/foundry/client/apps/forms/base-sheet.d.mts +14 -7
  16. package/src/foundry/client/apps/forms/card-config.d.mts +17 -9
  17. package/src/foundry/client/apps/forms/cards-config.d.mts +13 -14
  18. package/src/foundry/client/apps/forms/combat-config.d.mts +7 -7
  19. package/src/foundry/client/apps/forms/combatant-config.d.mts +4 -4
  20. package/src/foundry/client/apps/forms/default-sheets-config.d.mts +1 -1
  21. package/src/foundry/client/apps/forms/effect-config.d.mts +6 -6
  22. package/src/foundry/client/apps/forms/folder-config.d.mts +5 -5
  23. package/src/foundry/client/apps/forms/fonts.d.mts +42 -35
  24. package/src/foundry/client/apps/forms/grid-config.d.mts +11 -11
  25. package/src/foundry/client/apps/forms/image-popout.d.mts +28 -22
  26. package/src/foundry/client/apps/forms/item.d.mts +6 -6
  27. package/src/foundry/client/apps/forms/journal-page-sheet.d.mts +17 -15
  28. package/src/foundry/client/apps/forms/journal-sheet.d.mts +46 -37
  29. package/src/foundry/client/apps/forms/macro-config.d.mts +6 -6
  30. package/src/foundry/client/apps/forms/measure-template.d.mts +8 -8
  31. package/src/foundry/client/apps/forms/ownership.d.mts +5 -5
  32. package/src/foundry/client/apps/forms/playlist-config.d.mts +7 -9
  33. package/src/foundry/client/apps/forms/playlist-sound-config.d.mts +6 -6
  34. package/src/foundry/client/apps/forms/roll-table-config.d.mts +9 -10
  35. package/src/foundry/client/apps/forms/scene-config.d.mts +39 -39
  36. package/src/foundry/client/apps/forms/sheet-config.d.mts +8 -8
  37. package/src/foundry/client/apps/forms/user-config.d.mts +11 -11
  38. package/src/foundry/client/apps/hud/chatbubble.d.mts +14 -9
  39. package/src/foundry/client/apps/hud/container.d.mts +3 -3
  40. package/src/foundry/client/apps/hud/controls.d.mts +124 -84
  41. package/src/foundry/client/apps/hud/hotbar.d.mts +12 -12
  42. package/src/foundry/client/apps/hud/hud.d.mts +4 -4
  43. package/src/foundry/client/apps/hud/menu.d.mts +6 -6
  44. package/src/foundry/client/apps/hud/navigation.d.mts +11 -11
  45. package/src/foundry/client/apps/hud/pause.d.mts +7 -7
  46. package/src/foundry/client/apps/hud/players.d.mts +11 -11
  47. package/src/foundry/client/apps/i18n.d.mts +31 -27
  48. package/src/foundry/client/apps/placeables/drawing-config.d.mts +41 -33
  49. package/src/foundry/client/apps/placeables/drawing-hud.d.mts +4 -4
  50. package/src/foundry/client/apps/placeables/index.d.mts +0 -2
  51. package/src/foundry/client/apps/placeables/note-config.d.mts +27 -17
  52. package/src/foundry/client/apps/placeables/tile-config.d.mts +23 -10
  53. package/src/foundry/client/apps/placeables/tile-hud.d.mts +8 -8
  54. package/src/foundry/client/apps/placeables/token-config.d.mts +84 -63
  55. package/src/foundry/client/apps/placeables/token-hud.d.mts +10 -10
  56. package/src/foundry/client/apps/placeables/wall-config.d.mts +19 -16
  57. package/src/foundry/client/apps/sidebar/apps/chat-popout.d.mts +5 -5
  58. package/src/foundry/client/apps/sidebar/apps/client-settings.d.mts +2 -2
  59. package/src/foundry/client/apps/sidebar/apps/compendium.d.mts +13 -10
  60. package/src/foundry/client/apps/sidebar/apps/invitation-links.d.mts +3 -3
  61. package/src/foundry/client/apps/sidebar/apps/keybindings-config.d.mts +1 -1
  62. package/src/foundry/client/apps/sidebar/apps/module-management.d.mts +6 -6
  63. package/src/foundry/client/apps/sidebar/apps/permission-config.d.mts +6 -6
  64. package/src/foundry/client/apps/sidebar/apps/support-details.d.mts +33 -28
  65. package/src/foundry/client/apps/sidebar/apps/tours-management.d.mts +1 -1
  66. package/src/foundry/client/apps/sidebar/apps/world-config.d.mts +12 -9
  67. package/src/foundry/client/apps/sidebar/directory-tab-mixin.d.mts +40 -32
  68. package/src/foundry/client/apps/sidebar/document-directory.d.mts +44 -37
  69. package/src/foundry/client/apps/sidebar/package-configuration.d.mts +3 -3
  70. package/src/foundry/client/apps/sidebar/sidebar-tab.d.mts +3 -3
  71. package/src/foundry/client/apps/sidebar/sidebar.d.mts +7 -7
  72. package/src/foundry/client/apps/sidebar/tabs/actors-directory.d.mts +4 -4
  73. package/src/foundry/client/apps/sidebar/tabs/cards-directory.d.mts +4 -4
  74. package/src/foundry/client/apps/sidebar/tabs/chat-log.d.mts +34 -29
  75. package/src/foundry/client/apps/sidebar/tabs/combat-tracker.d.mts +15 -15
  76. package/src/foundry/client/apps/sidebar/tabs/compendium-directory.d.mts +21 -12
  77. package/src/foundry/client/apps/sidebar/tabs/items-directory.d.mts +4 -4
  78. package/src/foundry/client/apps/sidebar/tabs/journal-directory.d.mts +4 -4
  79. package/src/foundry/client/apps/sidebar/tabs/macros-directory.d.mts +8 -8
  80. package/src/foundry/client/apps/sidebar/tabs/playlists-directory.d.mts +21 -21
  81. package/src/foundry/client/apps/sidebar/tabs/roll-table-directory.d.mts +4 -4
  82. package/src/foundry/client/apps/sidebar/tabs/scenes-directory.d.mts +6 -6
  83. package/src/foundry/client/apps/sidebar/tabs/settings.d.mts +12 -12
  84. package/src/foundry/client/apps/templates.d.mts +2 -2
  85. package/src/foundry/client/av/clients/simplepeer.d.mts +4 -4
  86. package/src/foundry/client/av/settings.d.mts +16 -13
  87. package/src/foundry/client/config.d.mts +1982 -1823
  88. package/src/foundry/client/core/document-index.d.mts +12 -4
  89. package/src/foundry/client/core/hooks.d.mts +0 -2
  90. package/src/foundry/client/core/image.d.mts +13 -11
  91. package/src/foundry/client/core/issues.d.mts +11 -6
  92. package/src/foundry/client/core/keybindings.d.mts +3 -3
  93. package/src/foundry/client/core/nue.d.mts +1 -1
  94. package/src/foundry/client/core/packages.d.mts +393 -63
  95. package/src/foundry/client/core/settings.d.mts +34 -12
  96. package/src/foundry/client/core/socket.d.mts +2 -2
  97. package/src/foundry/client/core/sorting.d.mts +6 -6
  98. package/src/foundry/client/core/time.d.mts +6 -3
  99. package/src/foundry/client/core/tooltip.d.mts +1 -1
  100. package/src/foundry/client/core/tour.d.mts +58 -49
  101. package/src/foundry/client/core/tours.d.mts +1 -1
  102. package/src/foundry/client/core/utils.d.mts +3 -3
  103. package/src/foundry/client/core/workers.d.mts +24 -17
  104. package/src/foundry/client/data/abstract/canvas-document.d.mts +9 -15
  105. package/src/foundry/client/data/abstract/client-document.d.mts +133 -172
  106. package/src/foundry/client/data/abstract/directory-collection-mixin.d.mts +14 -36
  107. package/src/foundry/client/data/abstract/document-collection.d.mts +89 -65
  108. package/src/foundry/client/data/abstract/world-collection.d.mts +47 -53
  109. package/src/foundry/client/data/collections/actors.d.mts +24 -31
  110. package/src/foundry/client/data/collections/cards.d.mts +10 -6
  111. package/src/foundry/client/data/collections/combats.d.mts +12 -8
  112. package/src/foundry/client/data/collections/compendium-collection.d.mts +79 -66
  113. package/src/foundry/client/data/collections/compendium-folders.d.mts +6 -6
  114. package/src/foundry/client/data/collections/compendium-packs.d.mts +4 -4
  115. package/src/foundry/client/data/collections/fog.d.mts +10 -6
  116. package/src/foundry/client/data/collections/folder.d.mts +15 -10
  117. package/src/foundry/client/data/collections/items.d.mts +11 -7
  118. package/src/foundry/client/data/collections/journal.d.mts +16 -10
  119. package/src/foundry/client/data/collections/macros.d.mts +15 -22
  120. package/src/foundry/client/data/collections/messages.d.mts +14 -10
  121. package/src/foundry/client/data/collections/playlists.d.mts +12 -9
  122. package/src/foundry/client/data/collections/scenes.d.mts +19 -31
  123. package/src/foundry/client/data/collections/settings.d.mts +10 -6
  124. package/src/foundry/client/data/collections/tables.d.mts +11 -7
  125. package/src/foundry/client/data/collections/users.d.mts +14 -11
  126. package/src/foundry/client/data/documents/active-effect.d.mts +652 -88
  127. package/src/foundry/client/data/documents/actor-delta.d.mts +672 -28
  128. package/src/foundry/client/data/documents/actor.d.mts +722 -60
  129. package/src/foundry/client/data/documents/adventure.d.mts +482 -49
  130. package/src/foundry/client/data/documents/ambient-light.d.mts +426 -21
  131. package/src/foundry/client/data/documents/ambient-sound.d.mts +474 -15
  132. package/src/foundry/client/data/documents/card.d.mts +570 -39
  133. package/src/foundry/client/data/documents/cards.d.mts +742 -78
  134. package/src/foundry/client/data/documents/chat-message.d.mts +578 -45
  135. package/src/foundry/client/data/documents/combat.d.mts +701 -71
  136. package/src/foundry/client/data/documents/combatant.d.mts +510 -28
  137. package/src/foundry/client/data/documents/drawing.d.mts +543 -16
  138. package/src/foundry/client/data/documents/fog-exploration.d.mts +413 -27
  139. package/src/foundry/client/data/documents/folder.d.mts +461 -40
  140. package/src/foundry/client/data/documents/item.d.mts +679 -25
  141. package/src/foundry/client/data/documents/journal-entry-page.d.mts +587 -21
  142. package/src/foundry/client/data/documents/journal-entry.d.mts +621 -20
  143. package/src/foundry/client/data/documents/macro.d.mts +530 -25
  144. package/src/foundry/client/data/documents/measured-template.d.mts +480 -16
  145. package/src/foundry/client/data/documents/note.d.mts +495 -18
  146. package/src/foundry/client/data/documents/playlist-sound.d.mts +429 -27
  147. package/src/foundry/client/data/documents/playlist.d.mts +666 -75
  148. package/src/foundry/client/data/documents/region-behavior.d.mts +468 -38
  149. package/src/foundry/client/data/documents/region.d.mts +661 -35
  150. package/src/foundry/client/data/documents/scene.d.mts +986 -149
  151. package/src/foundry/client/data/documents/setting.d.mts +397 -15
  152. package/src/foundry/client/data/documents/table-result.d.mts +479 -17
  153. package/src/foundry/client/data/documents/table.d.mts +663 -80
  154. package/src/foundry/client/data/documents/tile.d.mts +502 -16
  155. package/src/foundry/client/data/documents/token.d.mts +1114 -90
  156. package/src/foundry/client/data/documents/user.d.mts +495 -27
  157. package/src/foundry/client/data/documents/wall.d.mts +550 -15
  158. package/src/foundry/client/game.d.mts +58 -92
  159. package/src/foundry/client/head.d.mts +5 -6
  160. package/src/foundry/client/hooks.d.mts +237 -221
  161. package/src/foundry/client/pixi/board.d.mts +95 -89
  162. package/src/foundry/client/pixi/core/containers/base-canvas-group.d.mts +6 -5
  163. package/src/foundry/client/pixi/core/containers/cached-container.d.mts +5 -5
  164. package/src/foundry/client/pixi/core/containers/full-canvas-container.d.mts +2 -2
  165. package/src/foundry/client/pixi/core/containers/point-source-mesh.d.mts +3 -3
  166. package/src/foundry/client/pixi/core/containers/quad-mesh.d.mts +3 -3
  167. package/src/foundry/client/pixi/core/containers/quadtree.d.mts +23 -21
  168. package/src/foundry/client/pixi/core/containers/sprite-mesh.d.mts +5 -5
  169. package/src/foundry/client/pixi/core/containers/unbound-container.d.mts +5 -5
  170. package/src/foundry/client/pixi/core/interaction/canvas-animation.d.mts +57 -51
  171. package/src/foundry/client/pixi/core/interaction/control-icon.d.mts +3 -3
  172. package/src/foundry/client/pixi/core/interaction/mouse-handler.d.mts +7 -7
  173. package/src/foundry/client/pixi/core/interaction/ping.d.mts +19 -11
  174. package/src/foundry/client/pixi/core/interaction/pings/chevron.d.mts +7 -2
  175. package/src/foundry/client/pixi/core/interaction/pings/pulse.d.mts +29 -23
  176. package/src/foundry/client/pixi/core/interaction/render-flags.d.mts +83 -38
  177. package/src/foundry/client/pixi/core/interaction/resize-handle.d.mts +3 -3
  178. package/src/foundry/client/pixi/core/interaction/targets.d.mts +9 -9
  179. package/src/foundry/client/pixi/core/loader.d.mts +8 -8
  180. package/src/foundry/client/pixi/core/shapes/limited-angle-polygon.d.mts +9 -4
  181. package/src/foundry/client/pixi/core/shapes/polygon-mesher.d.mts +3 -3
  182. package/src/foundry/client/pixi/core/shapes/precise-text.d.mts +3 -3
  183. package/src/foundry/client/pixi/core/shapes/ray.d.mts +23 -17
  184. package/src/foundry/client/pixi/core/shapes/source-polygon.d.mts +19 -14
  185. package/src/foundry/client/pixi/extensions/circle.d.mts +1 -1
  186. package/src/foundry/client/pixi/extensions/observable-transform.d.mts +3 -3
  187. package/src/foundry/client/pixi/groups/effects.d.mts +4 -4
  188. package/src/foundry/client/pixi/groups/environment.d.mts +5 -5
  189. package/src/foundry/client/pixi/groups/hidden.d.mts +3 -3
  190. package/src/foundry/client/pixi/groups/interface.d.mts +6 -6
  191. package/src/foundry/client/pixi/groups/overlay.d.mts +3 -3
  192. package/src/foundry/client/pixi/groups/primary.d.mts +11 -11
  193. package/src/foundry/client/pixi/groups/rendered.d.mts +3 -3
  194. package/src/foundry/client/pixi/layers/base/canvas-layer.d.mts +3 -3
  195. package/src/foundry/client/pixi/layers/base/interaction-layer.d.mts +13 -13
  196. package/src/foundry/client/pixi/layers/base/placeables-layer.d.mts +279 -233
  197. package/src/foundry/client/pixi/layers/controls/cursor.d.mts +17 -8
  198. package/src/foundry/client/pixi/layers/controls/door.d.mts +26 -14
  199. package/src/foundry/client/pixi/layers/controls/layer.d.mts +89 -79
  200. package/src/foundry/client/pixi/layers/controls/ruler.d.mts +121 -96
  201. package/src/foundry/client/pixi/layers/effects/background-effects.d.mts +4 -5
  202. package/src/foundry/client/pixi/layers/effects/coloration-effects.d.mts +6 -4
  203. package/src/foundry/client/pixi/layers/effects/darkness-effects.d.mts +7 -4
  204. package/src/foundry/client/pixi/layers/effects/illumination-effects.d.mts +19 -16
  205. package/src/foundry/client/pixi/layers/effects/visibility.d.mts +101 -84
  206. package/src/foundry/client/pixi/layers/effects/weather/particles/effect.d.mts +13 -4
  207. package/src/foundry/client/pixi/layers/effects/weather/particles/leaves.d.mts +31 -2
  208. package/src/foundry/client/pixi/layers/effects/weather-effects.d.mts +134 -59
  209. package/src/foundry/client/pixi/layers/grid/highlight.d.mts +13 -3
  210. package/src/foundry/client/pixi/layers/grid/layer.d.mts +89 -87
  211. package/src/foundry/client/pixi/layers/grid/mesh.d.mts +36 -15
  212. package/src/foundry/client/pixi/layers/masks/depth.d.mts +3 -3
  213. package/src/foundry/client/pixi/layers/masks/occlusion.d.mts +4 -4
  214. package/src/foundry/client/pixi/layers/masks/vision.d.mts +6 -6
  215. package/src/foundry/client/pixi/layers/placeables/drawings.d.mts +15 -11
  216. package/src/foundry/client/pixi/layers/placeables/lighting.d.mts +11 -10
  217. package/src/foundry/client/pixi/layers/placeables/notes.d.mts +47 -28
  218. package/src/foundry/client/pixi/layers/placeables/regions.d.mts +25 -12
  219. package/src/foundry/client/pixi/layers/placeables/sounds.d.mts +81 -63
  220. package/src/foundry/client/pixi/layers/placeables/templates.d.mts +10 -11
  221. package/src/foundry/client/pixi/layers/placeables/tiles.d.mts +28 -17
  222. package/src/foundry/client/pixi/layers/placeables/tokens.d.mts +67 -46
  223. package/src/foundry/client/pixi/layers/placeables/walls.d.mts +50 -51
  224. package/src/foundry/client/pixi/perception/clockwise-sweep.d.mts +22 -16
  225. package/src/foundry/client/pixi/perception/detection-mode.d.mts +123 -51
  226. package/src/foundry/client/pixi/perception/fog.d.mts +34 -19
  227. package/src/foundry/client/pixi/perception/perception-manager.d.mts +137 -137
  228. package/src/foundry/client/pixi/perception/vision-mode.d.mts +92 -67
  229. package/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.mts +3 -3
  230. package/src/foundry/client/pixi/placeable.d.mts +241 -146
  231. package/src/foundry/client/pixi/placeables/drawing.d.mts +260 -134
  232. package/src/foundry/client/pixi/placeables/light.d.mts +204 -66
  233. package/src/foundry/client/pixi/placeables/note.d.mts +150 -55
  234. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.d.mts +7 -6
  235. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.d.mts +3 -3
  236. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.d.mts +2 -2
  237. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.d.mts +4 -4
  238. package/src/foundry/client/pixi/placeables/region.d.mts +219 -110
  239. package/src/foundry/client/pixi/placeables/sound.d.mts +211 -68
  240. package/src/foundry/client/pixi/placeables/template.d.mts +186 -100
  241. package/src/foundry/client/pixi/placeables/tile.d.mts +211 -142
  242. package/src/foundry/client/pixi/placeables/token.d.mts +911 -568
  243. package/src/foundry/client/pixi/placeables/wall.d.mts +253 -130
  244. package/src/foundry/client/pixi/webgl/extensions/batch-renderer.d.mts +27 -5
  245. package/src/foundry/client/pixi/webgl/extensions/batch-shader-generator.d.mts +3 -3
  246. package/src/foundry/client/pixi/webgl/helpers/framebuffer-snapshot.d.mts +3 -3
  247. package/src/foundry/client/pixi/webgl/helpers/smooth-noise.d.mts +13 -5
  248. package/src/foundry/client/pixi/webgl/helpers/texture-extractor.d.mts +6 -6
  249. package/src/foundry/client/pixi/webgl/shaders/base-shader-mixin.d.mts +2 -2
  250. package/src/foundry/client/pixi/webgl/shaders/base-shader.d.mts +5 -5
  251. package/src/foundry/client/pixi/webgl/shaders/filters/base-filter.d.mts +4 -4
  252. package/src/foundry/client/pixi/webgl/shaders/filters/base-mask-filter.d.mts +3 -3
  253. package/src/foundry/client/pixi/webgl/shaders/filters/blur.d.mts +5 -5
  254. package/src/foundry/client/pixi/webgl/shaders/filters/effects-masking.d.mts +6 -3
  255. package/src/foundry/client/pixi/webgl/shaders/filters/environment.d.mts +3 -3
  256. package/src/foundry/client/pixi/webgl/shaders/filters/glow-overlay.d.mts +4 -4
  257. package/src/foundry/client/pixi/webgl/shaders/filters/invisibility.d.mts +3 -3
  258. package/src/foundry/client/pixi/webgl/shaders/filters/outline-overlay.d.mts +4 -4
  259. package/src/foundry/client/pixi/webgl/shaders/filters/transition.d.mts +6 -6
  260. package/src/foundry/client/pixi/webgl/shaders/filters/visibility.d.mts +8 -5
  261. package/src/foundry/client/pixi/webgl/shaders/filters/vision-mask-filter.d.mts +3 -3
  262. package/src/foundry/client/pixi/webgl/shaders/filters/void.d.mts +3 -3
  263. package/src/foundry/client/pixi/webgl/shaders/filters/weather-occlusion-masks.d.mts +4 -4
  264. package/src/foundry/client/pixi/webgl/shaders/fragment-channel-mixin.d.mts +1 -1
  265. package/src/foundry/client/pixi/webgl/shaders/grid/grid.d.mts +4 -4
  266. package/src/foundry/client/pixi/webgl/shaders/lighting/background-lighting.d.mts +3 -3
  267. package/src/foundry/client/pixi/webgl/shaders/lighting/base-lighting.d.mts +3 -3
  268. package/src/foundry/client/pixi/webgl/shaders/lighting/coloration-lighting.d.mts +3 -3
  269. package/src/foundry/client/pixi/webgl/shaders/lighting/darkness-lighting.d.mts +3 -3
  270. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/bewitching-wave.d.mts +5 -5
  271. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/black-hole.d.mts +3 -3
  272. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/chroma.d.mts +3 -3
  273. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/emanation.d.mts +3 -3
  274. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/energy-field.d.mts +3 -3
  275. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fairy-light.d.mts +6 -6
  276. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/flame.d.mts +5 -5
  277. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fog.d.mts +3 -3
  278. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/force-grid.d.mts +3 -3
  279. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/ghost-light.d.mts +5 -5
  280. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/hexa-dome.d.mts +3 -3
  281. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/light-dome.d.mts +3 -3
  282. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/magical-gloom.d.mts +3 -3
  283. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/pulse.d.mts +5 -5
  284. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/radial-rainbow.d.mts +3 -3
  285. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/revolving-light.d.mts +3 -3
  286. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/roiling-mass.d.mts +3 -3
  287. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/siren-light.d.mts +5 -5
  288. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/smoke-patch.d.mts +6 -5
  289. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/star-light.d.mts +3 -3
  290. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/sunburst.d.mts +5 -5
  291. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/swirling-rainbow.d.mts +4 -3
  292. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/torch.d.mts +5 -5
  293. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/vortex.d.mts +5 -5
  294. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/wave.d.mts +5 -5
  295. package/src/foundry/client/pixi/webgl/shaders/lighting/illumination-lighting.d.mts +3 -3
  296. package/src/foundry/client/pixi/webgl/shaders/region/adjust-darkness-level.d.mts +7 -7
  297. package/src/foundry/client/pixi/webgl/shaders/region/base.d.mts +4 -4
  298. package/src/foundry/client/pixi/webgl/shaders/region/highlight.d.mts +3 -3
  299. package/src/foundry/client/pixi/webgl/shaders/samplers/base-sampler.d.mts +4 -4
  300. package/src/foundry/client/pixi/webgl/shaders/samplers/baseline-illumination.d.mts +3 -3
  301. package/src/foundry/client/pixi/webgl/shaders/samplers/color-adjustment.d.mts +5 -5
  302. package/src/foundry/client/pixi/webgl/shaders/samplers/depth.d.mts +3 -3
  303. package/src/foundry/client/pixi/webgl/shaders/samplers/fog-of-war.d.mts +3 -3
  304. package/src/foundry/client/pixi/webgl/shaders/samplers/occlusion.d.mts +3 -3
  305. package/src/foundry/client/pixi/webgl/shaders/samplers/primary.d.mts +4 -4
  306. package/src/foundry/client/pixi/webgl/shaders/samplers/token-ring.d.mts +4 -6
  307. package/src/foundry/client/pixi/webgl/shaders/vision/background-vision.d.mts +3 -3
  308. package/src/foundry/client/pixi/webgl/shaders/vision/base-vision.d.mts +3 -3
  309. package/src/foundry/client/pixi/webgl/shaders/vision/coloration-vision.d.mts +3 -3
  310. package/src/foundry/client/pixi/webgl/shaders/vision/effects/amplification.d.mts +3 -3
  311. package/src/foundry/client/pixi/webgl/shaders/vision/effects/wave.d.mts +5 -5
  312. package/src/foundry/client/pixi/webgl/shaders/vision/illumination-vision.d.mts +3 -3
  313. package/src/foundry/client/pixi/webgl/shaders/weather/base-weather.d.mts +14 -15
  314. package/src/foundry/client/pixi/webgl/shaders/weather/effect.d.mts +20 -27
  315. package/src/foundry/client/pixi/webgl/shaders/weather/fog.d.mts +5 -5
  316. package/src/foundry/client/pixi/webgl/shaders/weather/rain.d.mts +5 -5
  317. package/src/foundry/client/pixi/webgl/shaders/weather/snow.d.mts +5 -5
  318. package/src/foundry/client/pixi/workers/texture-worker.d.mts +5 -5
  319. package/src/foundry/client/tours/setup-tour.d.mts +15 -10
  320. package/src/foundry/client/ui/dialog.d.mts +3 -3
  321. package/src/foundry/client/ui/dragdrop.d.mts +33 -27
  322. package/src/foundry/client/ui/editor.d.mts +29 -21
  323. package/src/foundry/client/ui/filepicker.d.mts +42 -37
  324. package/src/foundry/client/ui/filter.d.mts +60 -48
  325. package/src/foundry/client/ui/forms.d.mts +22 -22
  326. package/src/foundry/client/ui/prosemirror.d.mts +15 -7
  327. package/src/foundry/client/ui/secrets.d.mts +43 -28
  328. package/src/foundry/client/ui/tabs.d.mts +40 -33
  329. package/src/foundry/client-esm/_module.d.mts +5 -5
  330. package/src/foundry/client-esm/_types.d.mts +2 -1
  331. package/src/foundry/client-esm/applications/api/application.d.mts +93 -31
  332. package/src/foundry/client-esm/applications/api/dialog.d.mts +23 -23
  333. package/src/foundry/client-esm/applications/api/document-sheet.d.mts +85 -32
  334. package/src/foundry/client-esm/applications/api/handlebars-application.d.mts +1 -1
  335. package/src/foundry/client-esm/applications/apps/av/camera-popout.d.mts +1 -1
  336. package/src/foundry/client-esm/applications/apps/av/cameras.d.mts +2 -2
  337. package/src/foundry/client-esm/applications/apps/compendium-art-config.d.mts +4 -5
  338. package/src/foundry/client-esm/applications/apps/file-picker.d.mts +2 -2
  339. package/src/foundry/client-esm/applications/apps/grid-config.d.mts +3 -3
  340. package/src/foundry/client-esm/applications/apps/image-popout.d.mts +1 -1
  341. package/src/foundry/client-esm/applications/apps/permission-config.d.mts +1 -1
  342. package/src/foundry/client-esm/applications/dice/roll-resolver.d.mts +4 -4
  343. package/src/foundry/client-esm/applications/elements/file-picker.d.mts +1 -1
  344. package/src/foundry/client-esm/applications/elements/prosemirror-editor.d.mts +1 -1
  345. package/src/foundry/client-esm/applications/hud/drawing-hud.d.mts +1 -1
  346. package/src/foundry/client-esm/applications/hud/tile-hud.d.mts +1 -1
  347. package/src/foundry/client-esm/applications/hud/token-hud.d.mts +1 -1
  348. package/src/foundry/client-esm/applications/sheets/active-effect-config.d.mts +3 -3
  349. package/src/foundry/client-esm/applications/sheets/actor-sheet.d.mts +2 -2
  350. package/src/foundry/client-esm/applications/sheets/adventure-exporter.d.mts +3 -3
  351. package/src/foundry/client-esm/applications/sheets/adventure-importer.d.mts +3 -3
  352. package/src/foundry/client-esm/applications/sheets/ambient-light-config.d.mts +5 -5
  353. package/src/foundry/client-esm/applications/sheets/ambient-sound-config.d.mts +4 -4
  354. package/src/foundry/client-esm/applications/sheets/card-config.d.mts +3 -3
  355. package/src/foundry/client-esm/applications/sheets/cards-config.d.mts +2 -2
  356. package/src/foundry/client-esm/applications/sheets/combatant-config.d.mts +3 -3
  357. package/src/foundry/client-esm/applications/sheets/drawing-config.d.mts +3 -3
  358. package/src/foundry/client-esm/applications/sheets/folder-config.d.mts +3 -3
  359. package/src/foundry/client-esm/applications/sheets/item-sheet.d.mts +2 -2
  360. package/src/foundry/client-esm/applications/sheets/journal/journal-entry-category-config.d.mts +3 -3
  361. package/src/foundry/client-esm/applications/sheets/journal/journal-entry-page-sheet.d.mts +3 -3
  362. package/src/foundry/client-esm/applications/sheets/journal/journal-entry-sheet.d.mts +3 -3
  363. package/src/foundry/client-esm/applications/sheets/macro-config.d.mts +3 -3
  364. package/src/foundry/client-esm/applications/sheets/note-config.d.mts +3 -3
  365. package/src/foundry/client-esm/applications/sheets/playlist-config.d.mts +3 -3
  366. package/src/foundry/client-esm/applications/sheets/playlist-sound-config.d.mts +3 -3
  367. package/src/foundry/client-esm/applications/sheets/region-behavior-config.d.mts +3 -3
  368. package/src/foundry/client-esm/applications/sheets/region-config.d.mts +3 -3
  369. package/src/foundry/client-esm/applications/sheets/roll-table-config.d.mts +3 -3
  370. package/src/foundry/client-esm/applications/sheets/roll-table-sheet.d.mts +3 -3
  371. package/src/foundry/client-esm/applications/sheets/scene-config.d.mts +3 -3
  372. package/src/foundry/client-esm/applications/sheets/table-result-config.d.mts +3 -3
  373. package/src/foundry/client-esm/applications/sheets/template-config.d.mts +3 -3
  374. package/src/foundry/client-esm/applications/sheets/tile-config.d.mts +3 -3
  375. package/src/foundry/client-esm/applications/sheets/token/mixin.d.mts +1 -0
  376. package/src/foundry/client-esm/applications/sheets/token/token-config.d.mts +3 -3
  377. package/src/foundry/client-esm/applications/sheets/user-config.d.mts +4 -4
  378. package/src/foundry/client-esm/applications/sheets/wall-config.d.mts +3 -3
  379. package/src/foundry/client-esm/applications/sidebar/apps/chat-popout.d.mts +1 -1
  380. package/src/foundry/client-esm/applications/sidebar/sidebar-tab.d.mts +2 -2
  381. package/src/foundry/client-esm/applications/sidebar/tabs/actor-directory.d.mts +1 -1
  382. package/src/foundry/client-esm/applications/sidebar/tabs/cards-directory.d.mts +1 -1
  383. package/src/foundry/client-esm/applications/sidebar/tabs/combat-tracker.d.mts +242 -1
  384. package/src/foundry/client-esm/applications/sidebar/tabs/item-directory.d.mts +1 -1
  385. package/src/foundry/client-esm/applications/sidebar/tabs/journal-directory.d.mts +1 -1
  386. package/src/foundry/client-esm/applications/sidebar/tabs/macro-directory.d.mts +1 -1
  387. package/src/foundry/client-esm/applications/sidebar/tabs/playlist-directory.d.mts +1 -1
  388. package/src/foundry/client-esm/applications/sidebar/tabs/roll-table-directory.d.mts +1 -1
  389. package/src/foundry/client-esm/applications/sidebar/tabs/scene-directory.d.mts +1 -1
  390. package/src/foundry/client-esm/applications/ui/region-legend.d.mts +2 -2
  391. package/src/foundry/client-esm/applications/ux/context-menu.d.mts +56 -36
  392. package/src/foundry/client-esm/audio/_types.d.mts +2 -0
  393. package/src/foundry/client-esm/audio/biquad.d.mts +76 -26
  394. package/src/foundry/client-esm/audio/cache.d.mts +31 -20
  395. package/src/foundry/client-esm/audio/convolver.d.mts +47 -25
  396. package/src/foundry/client-esm/audio/helper.d.mts +124 -80
  397. package/src/foundry/client-esm/audio/sound.d.mts +202 -97
  398. package/src/foundry/client-esm/audio/timeout.d.mts +28 -12
  399. package/src/foundry/client-esm/canvas/edges/collision.d.mts +12 -4
  400. package/src/foundry/client-esm/canvas/edges/edge.d.mts +13 -8
  401. package/src/foundry/client-esm/canvas/edges/edges.d.mts +3 -2
  402. package/src/foundry/client-esm/canvas/edges/vertex.d.mts +12 -10
  403. package/src/foundry/client-esm/canvas/regions/geometry.d.mts +14 -7
  404. package/src/foundry/client-esm/canvas/regions/mesh.d.mts +25 -14
  405. package/src/foundry/client-esm/canvas/regions/polygon-tree.d.mts +50 -19
  406. package/src/foundry/client-esm/canvas/regions/shape.d.mts +45 -34
  407. package/src/foundry/client-esm/canvas/scene-manager.d.mts +7 -6
  408. package/src/foundry/client-esm/canvas/smaa/blend.d.mts +14 -3
  409. package/src/foundry/client-esm/canvas/smaa/edges.d.mts +25 -3
  410. package/src/foundry/client-esm/canvas/smaa/smaa.d.mts +119 -20
  411. package/src/foundry/client-esm/canvas/smaa/weights.d.mts +26 -3
  412. package/src/foundry/client-esm/canvas/sources/base-effect-source.d.mts +69 -39
  413. package/src/foundry/client-esm/canvas/sources/base-light-source.d.mts +66 -40
  414. package/src/foundry/client-esm/canvas/sources/global-light-source.d.mts +78 -19
  415. package/src/foundry/client-esm/canvas/sources/point-darkness-source.d.mts +37 -20
  416. package/src/foundry/client-esm/canvas/sources/point-effect-source.d.mts +39 -20
  417. package/src/foundry/client-esm/canvas/sources/point-light-source.d.mts +41 -12
  418. package/src/foundry/client-esm/canvas/sources/point-movement-source.d.mts +15 -4
  419. package/src/foundry/client-esm/canvas/sources/point-sound-source.d.mts +29 -14
  420. package/src/foundry/client-esm/canvas/sources/point-vision-source.d.mts +84 -39
  421. package/src/foundry/client-esm/canvas/sources/rendered-effect-source.d.mts +115 -41
  422. package/src/foundry/client-esm/canvas/tokens/ring-config.d.mts +83 -21
  423. package/src/foundry/client-esm/canvas/tokens/ring-data.d.mts +66 -93
  424. package/src/foundry/client-esm/canvas/tokens/ring.d.mts +146 -51
  425. package/src/foundry/client-esm/client.d.mts +16 -16
  426. package/src/foundry/client-esm/data/_module.d.mts +1 -1
  427. package/src/foundry/client-esm/data/calendar.d.mts +26 -39
  428. package/src/foundry/client-esm/data/client-backend.d.mts +6 -6
  429. package/src/foundry/client-esm/data/region-behaviors/adjust-darkness-level.d.mts +1 -1
  430. package/src/foundry/client-esm/data/region-behaviors/base.d.mts +5 -5
  431. package/src/foundry/client-esm/data/region-behaviors/display-scrolling-text.d.mts +2 -2
  432. package/src/foundry/client-esm/data/terrain-data.d.mts +1 -1
  433. package/src/foundry/client-esm/dice/parser.d.mts +5 -27
  434. package/src/foundry/client-esm/dice/roll.d.mts +63 -80
  435. package/src/foundry/client-esm/dice/terms/coin.d.mts +4 -8
  436. package/src/foundry/client-esm/dice/terms/dice.d.mts +85 -64
  437. package/src/foundry/client-esm/dice/terms/die.d.mts +7 -7
  438. package/src/foundry/client-esm/dice/terms/fate.d.mts +5 -5
  439. package/src/foundry/client-esm/dice/terms/function.d.mts +13 -16
  440. package/src/foundry/client-esm/dice/terms/numeric.d.mts +2 -4
  441. package/src/foundry/client-esm/dice/terms/operator.d.mts +1 -1
  442. package/src/foundry/client-esm/dice/terms/parenthetical.d.mts +8 -9
  443. package/src/foundry/client-esm/dice/terms/pool.d.mts +13 -28
  444. package/src/foundry/client-esm/dice/terms/string.d.mts +3 -3
  445. package/src/foundry/client-esm/dice/terms/term.d.mts +10 -5
  446. package/src/foundry/client-esm/dice/twister.d.mts +3 -3
  447. package/src/foundry/client-esm/documents/_module.d.mts +1 -1
  448. package/src/foundry/client-esm/helpers/_types.d.mts +12 -46
  449. package/src/foundry/client-esm/helpers/compendium-art.d.mts +57 -4
  450. package/src/foundry/client-esm/packages/_module.d.mts +1 -1
  451. package/src/foundry/client-esm/packages/_types.d.mts +2 -0
  452. package/src/foundry/client-esm/utils/_module.d.mts +1 -1
  453. package/src/foundry/client-esm/utils/_types.d.mts +2 -1
  454. package/src/foundry/common/_types.d.mts +1 -1
  455. package/src/foundry/common/abstract/_module.d.mts +1 -0
  456. package/src/foundry/common/abstract/_types.d.mts +60 -54
  457. package/src/foundry/common/abstract/backend.d.mts +28 -16
  458. package/src/foundry/common/abstract/data.d.mts +133 -116
  459. package/src/foundry/common/abstract/document.d.mts +1233 -440
  460. package/src/foundry/common/abstract/embedded-collection.d.mts +2 -2
  461. package/src/foundry/common/abstract/singleton-collection.d.mts +1 -1
  462. package/src/foundry/common/abstract/type-data.d.mts +35 -43
  463. package/src/foundry/common/config.d.mts +3 -3
  464. package/src/foundry/common/constants.d.mts +27 -26
  465. package/src/foundry/common/data/_types.d.mts +2 -0
  466. package/src/foundry/common/data/data.d.mts +189 -87
  467. package/src/foundry/common/data/fields.d.mts +579 -258
  468. package/src/foundry/common/data/validation-failure.d.mts +9 -4
  469. package/src/foundry/common/documents/_types.d.mts +16 -9
  470. package/src/foundry/common/documents/active-effect.d.mts +280 -180
  471. package/src/foundry/common/documents/actor-delta.d.mts +317 -70
  472. package/src/foundry/common/documents/actor.d.mts +304 -103
  473. package/src/foundry/common/documents/adventure.d.mts +254 -140
  474. package/src/foundry/common/documents/ambient-light.d.mts +267 -76
  475. package/src/foundry/common/documents/ambient-sound.d.mts +267 -110
  476. package/src/foundry/common/documents/card.d.mts +267 -176
  477. package/src/foundry/common/documents/cards.d.mts +299 -128
  478. package/src/foundry/common/documents/chat-message.d.mts +276 -160
  479. package/src/foundry/common/documents/combat.d.mts +300 -91
  480. package/src/foundry/common/documents/combatant.d.mts +283 -88
  481. package/src/foundry/common/documents/drawing.d.mts +286 -207
  482. package/src/foundry/common/documents/fog-exploration.d.mts +258 -72
  483. package/src/foundry/common/documents/folder.d.mts +248 -85
  484. package/src/foundry/common/documents/item.d.mts +305 -101
  485. package/src/foundry/common/documents/journal-entry-page.d.mts +279 -190
  486. package/src/foundry/common/documents/journal-entry.d.mts +294 -70
  487. package/src/foundry/common/documents/macro.d.mts +254 -134
  488. package/src/foundry/common/documents/measured-template.d.mts +293 -137
  489. package/src/foundry/common/documents/note.d.mts +274 -151
  490. package/src/foundry/common/documents/playlist-sound.d.mts +260 -96
  491. package/src/foundry/common/documents/playlist.d.mts +279 -122
  492. package/src/foundry/common/documents/region-behavior.d.mts +305 -64
  493. package/src/foundry/common/documents/region.d.mts +309 -90
  494. package/src/foundry/common/documents/roll-table.d.mts +286 -104
  495. package/src/foundry/common/documents/scene.d.mts +276 -344
  496. package/src/foundry/common/documents/setting.d.mts +229 -55
  497. package/src/foundry/common/documents/table-result.d.mts +267 -96
  498. package/src/foundry/common/documents/tile.d.mts +301 -172
  499. package/src/foundry/common/documents/token.d.mts +350 -452
  500. package/src/foundry/common/documents/user.d.mts +256 -146
  501. package/src/foundry/common/documents/wall.d.mts +272 -157
  502. package/src/foundry/common/grid/_types.d.mts +2 -0
  503. package/src/foundry/common/grid/base.d.mts +58 -37
  504. package/src/foundry/common/grid/hexagonal.d.mts +19 -19
  505. package/src/foundry/common/grid/square.d.mts +1 -1
  506. package/src/foundry/common/packages/_module.d.mts +5 -5
  507. package/src/foundry/common/packages/_types.d.mts +2 -0
  508. package/src/foundry/common/packages/base-module.d.mts +6 -24
  509. package/src/foundry/common/packages/base-package.d.mts +18 -16
  510. package/src/foundry/common/packages/base-system.d.mts +6 -78
  511. package/src/foundry/common/packages/base-world.d.mts +7 -60
  512. package/src/foundry/common/packages/sub-types.d.mts +1 -1
  513. package/src/foundry/common/primitives/array.d.mts +3 -3
  514. package/src/foundry/common/primitives/math.d.mts +7 -1
  515. package/src/foundry/common/primitives/number.d.mts +1 -1
  516. package/src/foundry/common/primitives/set.d.mts +17 -14
  517. package/src/foundry/common/prosemirror/_types.d.mts +2 -0
  518. package/src/foundry/common/prosemirror/dropdown.d.mts +1 -1
  519. package/src/foundry/common/prosemirror/highlight-matches-plugin.d.mts +1 -1
  520. package/src/foundry/common/prosemirror/menu.d.mts +3 -3
  521. package/src/foundry/common/prosemirror/plugin.d.mts +1 -1
  522. package/src/foundry/common/prosemirror/schema/index.d.mts +0 -1
  523. package/src/foundry/common/prosemirror/util.d.mts +1 -1
  524. package/src/foundry/common/utils/bitmask.d.mts +4 -1
  525. package/src/foundry/common/utils/collection.d.mts +59 -24
  526. package/src/foundry/common/utils/event-emitter.d.mts +46 -19
  527. package/src/foundry/common/utils/helpers.d.mts +13 -13
  528. package/src/foundry/common/utils/http.d.mts +2 -2
  529. package/src/foundry/common/utils/string-tree.d.mts +45 -39
  530. package/src/foundry/common/utils/word-tree.d.mts +10 -23
  531. package/src/tsconfig.json +1 -5
  532. package/src/types/augments/pixi.d.mts +28 -28
  533. package/src/types/config.d.mts +12 -12
  534. package/src/types/documentConfiguration.d.mts +282 -597
  535. package/src/types/lib.d.mts +4 -4
  536. package/src/types/workers/image-compressor.d.mts +1 -1
  537. package/src/utils/index.d.mts +255 -60
  538. package/tsconfig.json +29 -0
  539. package/tsconfig.main.json +8 -0
  540. package/tsconfig.miscellaneous.json +16 -0
  541. package/src/foundry/client/apps/placeables/light-config.d.mts +0 -100
  542. package/src/foundry/client/apps/placeables/sound-config.d.mts +0 -44
  543. package/src/foundry/common/documents/module.d.mts +0 -35
@@ -1,422 +1,139 @@
1
- import type { NullishProps, RequiredProps, FixedInstanceType } from "fvtt-types/utils";
2
- import type BaseToken from "../../../common/documents/token.d.mts";
1
+ import type {
2
+ Coalesce,
3
+ DeepPartial,
4
+ FixedInstanceType,
5
+ HandleEmptyObject,
6
+ InexactPartial,
7
+ IntentionalPartial,
8
+ NullishProps,
9
+ RequiredProps,
10
+ } from "fvtt-types/utils";
3
11
  import type { ConfiguredObjectClassOrDefault } from "../../config.d.mts";
12
+ import BaseToken = foundry.documents.BaseToken;
13
+ import sources = foundry.canvas.sources;
4
14
 
5
15
  declare global {
6
- namespace Token {
7
- type ConfiguredClass = ConfiguredObjectClassOrDefault<typeof Token>;
8
- type ConfiguredInstance = FixedInstanceType<ConfiguredClass>;
9
-
10
- type Schema = BaseToken.Schema;
11
- type Parent = BaseToken.Parent;
12
-
13
- type Metadata = BaseToken.Metadata;
14
-
15
- type SchemaField = BaseToken.SchemaField;
16
- type ConstructorData = BaseToken.ConstructorData;
17
- type UpdateData = BaseToken.UpdateData;
18
- type Properties = BaseToken.Properties;
19
- type Source = BaseToken.Source;
20
-
21
- interface RenderFlags extends PlaceableObject.RenderFlags {
22
- redrawEffects: boolean;
23
-
24
- refreshSize: boolean;
25
-
26
- refreshPosition: boolean;
27
-
28
- refreshElevation: boolean;
29
-
30
- refreshVisibility: boolean;
31
-
32
- refreshEffects: boolean;
33
-
34
- refreshMesh: boolean;
35
-
36
- refreshShader: boolean;
37
-
38
- refreshBars: boolean;
39
-
40
- refreshNameplate: boolean;
41
-
42
- refreshBorder: boolean;
43
-
44
- refreshTarget: boolean;
45
- }
46
-
47
- interface ReticuleOptions {
48
- /**
49
- * The amount of margin between the targeting arrows and the token's bounding box, expressed as a fraction of an arrow's size.
50
- * @defaultValue `0`
51
- */
52
- margin?: number;
53
-
54
- /**
55
- * The alpha value of the arrows.
56
- * @defaultValue `1`
57
- */
58
- alpha?: number;
59
-
60
- /**
61
- * The size of the arrows as a proportion of grid size.
62
- * @defaultValue `0.15`
63
- */
64
- size?: number;
65
-
66
- /**
67
- * The color of the arrows.
68
- * @defaultValue `0xFF6400`
69
- */
70
- color?: number;
71
-
72
- /** The arrows' border style configuration. */
73
- border?: {
74
- /**
75
- * The border color.
76
- * @defaultValue `0`
77
- */
78
- color?: number;
79
-
80
- /**
81
- * The border width.
82
- * @defaultValue `2`
83
- */
84
- width?: number;
85
- };
86
- }
87
-
88
- type SourceType = "move" | "sight" | "light" | "sound";
89
-
90
- interface Bar {
91
- attribute: string;
92
- }
93
-
94
- interface Velocity {
95
- dx: number;
96
- sx: number;
97
- dy: number;
98
- sy: number;
99
- }
100
-
101
- /** The UI frame container which depicts Token metadata and status, displayed in the ControlsLayer. */
102
- // TODO: Fix globalThis.ObjectHUD #2962
103
- interface ObjectHUD {
104
- /** Token health bars */
105
- bars?: PIXI.Container;
106
-
107
- /** Token nameplate */
108
- nameplate?: PreciseText;
109
-
110
- /** Token elevation tooltip */
111
- tooltip?: PreciseText;
112
-
113
- /** Token status effects */
114
- effects?: PIXI.Container;
115
-
116
- /** Token target marker */
117
- target?: PIXI.Graphics;
118
- }
119
-
120
- type InitializedObjectHUD = RequiredProps<ObjectHUD, "bars" | "nameplate" | "tooltip" | "effects" | "target">;
121
-
122
- interface UpdateLightSourceOptions {
123
- /**
124
- * Defer updating perception to manually update it later.
125
- * @defaultValue `false`
126
- */
127
- defer?: boolean | undefined;
128
-
129
- /**
130
- * Indicate that this light source has been deleted.
131
- * @defaultValue `false`
132
- */
133
- deleted?: boolean | undefined;
134
- }
135
-
136
- interface UpdateVisionSourceOptions {
137
- /**
138
- * Defer updating perception to manually update it later.
139
- * @defaultValue `false`
140
- */
141
- defer?: boolean | undefined;
142
-
143
- /**
144
- * Indicate that this vision source has been deleted.
145
- * @defaultValue `false`
146
- */
147
- deleted?: boolean | undefined;
148
- }
149
-
150
- type UpdateSourceOptions = UpdateLightSourceOptions & UpdateVisionSourceOptions;
151
-
152
- interface PlayOptions {
153
- /**
154
- * Should the video loop?
155
- * @defaultValue `true`
156
- */
157
- loop?: boolean | undefined;
158
-
159
- /**
160
- * A specific timestamp between 0 and the video duration to begin playback
161
- * @defaultValue `0`
162
- */
163
- offset?: number | undefined;
164
-
165
- /**
166
- * Desired volume level of the video's audio channel (if any)
167
- * @defaultValue `0`
168
- */
169
- volume?: number | undefined;
170
- }
171
-
172
- interface DrawOverlayOptions {
173
- src?: string | undefined;
174
- tint?: number | undefined;
175
- }
176
-
177
- interface PositionOptions {
178
- /**
179
- * Animate the movement path
180
- * @defaultValue `true`
181
- */
182
- animate?: boolean;
183
-
184
- /**
185
- * Automatically re-center the view if token movement goes off-screen
186
- * @defaultValue `true`
187
- */
188
- recenter?: boolean | undefined;
189
- }
190
-
191
- interface EffectToggleOptions {
192
- /**
193
- * Force a certain active state for the effect
194
- * @defaultValue `false`
195
- */
196
- active?: boolean | undefined;
197
-
198
- /**
199
- * Whether to set the effect as the overlay effect?
200
- * @defaultValue `false`
201
- */
202
- overlay?: boolean | undefined;
203
- }
204
-
205
- interface SetTargetContext {
206
- /**
207
- * Assign the token as a target for a specific User
208
- * @defaultValue `null`
209
- */
210
- user?: User.ConfiguredInstance | null | undefined;
211
-
212
- /**
213
- * Release other active targets for the same player?
214
- * @defaultValue `true`
215
- */
216
- releaseOthers?: boolean | undefined;
217
-
218
- /**
219
- * Is this target being set as part of a group selection workflow?
220
- * @defaultValue `Is this target being set as part of a group selection workflow?`
221
- */
222
- groupSelection?: boolean | undefined;
223
- }
224
-
225
- interface ControlOptions extends PlaceableObject.ControlOptions {
226
- /** @defaultValue `false` */
227
- pan?: boolean;
228
- }
229
-
230
- interface AnimationContext {
231
- /** The name of the animation */
232
- name: string | symbol;
233
-
234
- /** The final animation state */
235
- to: NullishProps<Token.AnimationData>;
236
-
237
- /** The duration of the animation */
238
- duration: number;
239
-
240
- /** The current time of the animation */
241
- time: number;
242
-
243
- /** Asynchronous functions that are executed before the animation starts */
244
- preAnimate: ((context: Token.AnimationContext) => Promise<void>)[];
16
+ /**
17
+ * A Token is an implementation of PlaceableObject which represents an Actor within a viewed Scene on the game canvas.
18
+ * @see {@link TokenDocument | `TokenDocument`}
19
+ * @see {@link TokenLayer | `TokenLayer`}
20
+ */
21
+ class Token extends PlaceableObject<TokenDocument.Implementation> {
22
+ static override embeddedName: "Token";
245
23
 
246
- /** Synchronous functions that are executed after the animation ended */
247
- postAnimate: ((context: Token.AnimationContext) => void)[];
24
+ static override RENDER_FLAGS: Token.RENDER_FLAGS;
248
25
 
249
- /** Synchronous functions that are executed each frame after `ontick` and before {@link Token#_onAnimationUpdate} */
250
- onAnimate: ((context: Token.AnimationContext) => void)[];
26
+ // Note: This isn't a "real" override but `renderFlags` is set corresponding to the
27
+ // `RENDER_FLAGS` and so it has to be adjusted here.
28
+ renderFlags: RenderFlags<Token.RENDER_FLAGS>;
251
29
 
252
- /**
253
- * The promise of the animation, which resolves to true if the animation
254
- * completed, to false if it was terminated, and rejects if an error occurred.
255
- * Undefined in the first frame (at time 0) of the animation.
256
- */
257
- promise?: Promise<boolean> | undefined;
258
- }
30
+ // fake override; super has to type as if this could be a ControlIcon, but Tokens don't use one
31
+ override controlIcon: null;
259
32
 
260
33
  /**
261
- * The texture data for a token animation.
34
+ * The shape of this token.
35
+ * @defaultValue `undefined`
36
+ * @remarks Only `undefined` prior to {@link Token._refreshShape | `Token#_refreshShape`} being called. *
37
+ * @privateRemarks Foundry types this as possibly being `PIXI.Circle` but {@link Token.getShape | `Token#getShape`} only returns `Rectangle` or `Polygon` in v12
262
38
  */
263
- interface TextureData {
264
- /** The texture file path. */
265
- src: string;
266
-
267
- /** The texture anchor X. */
268
- anchorX: number;
269
-
270
- /** The texture anchor Y. */
271
- anchorY: number;
272
-
273
- /** The texture scale X. */
274
- scaleX: number;
275
-
276
- /** The texture scale Y. */
277
- scaleY: number;
278
-
279
- /** The texture tint. */
280
- tint: Color;
281
- }
39
+ shape: PIXI.Rectangle | PIXI.Polygon | undefined;
282
40
 
283
41
  /**
284
- * The ring subject data.
42
+ * Defines the filter to use for detection.
43
+ * @defaultValue `null`
44
+ * @remarks Only set to other-than-`null` externally, in {@link CanvasVisibility.testVisibility | `CanvasVisibility#testVisibility`}
45
+ *
46
+ * Set `null` unconditionally when {@link Token.isVisible | `Token#isVisible`} is accessed
285
47
  */
286
- interface RingSubjectData {
287
- /** The ring subject texture. */
288
- texture: string;
48
+ detectionFilter: PIXI.Filter | null;
289
49
 
290
- /** The ring subject scale. */
291
- scale: number;
292
- }
50
+ /**
51
+ * A Graphics instance which renders the border frame for this Token inside the GridLayer.
52
+ * @defaultValue `undefined`
53
+ * @remarks Only `undefined` prior to first draw
54
+ * */
55
+ border: PIXI.Graphics | undefined;
293
56
 
294
57
  /**
295
- * The ring data.
58
+ * The attribute bars of this Token.
59
+ * @defaultValue `undefined`
60
+ * @remarks Only `undefined` prior to first draw
296
61
  */
297
- interface RingData {
298
- /** The ring subject data. */
299
- subject: RingSubjectData;
300
- }
62
+ bars: Token.Bars | undefined;
301
63
 
302
64
  /**
303
- * Token animation data.
65
+ * The tooltip text of this Token, which contains its elevation.
66
+ * @defaultValue `undefined`
67
+ * @remarks Only `undefined` prior to first draw
304
68
  */
305
- interface AnimationData {
306
- /** The x position in pixels. */
307
- x: number;
308
-
309
- /** The y position in pixels. */
310
- y: number;
311
-
312
- /** The width in grid spaces. */
313
- width: number;
314
-
315
- /** The height in grid spaces. */
316
- height: number;
317
-
318
- /** The alpha value. */
319
- alpha: number;
320
-
321
- /** The rotation in degrees. */
322
- rotation: number;
323
-
324
- /** The texture data. */
325
- texture: TextureData;
326
-
327
- /** The ring data. */
328
- ring: RingData;
329
-
330
- /** The elevation in grid units */
331
- elevation?: number | undefined;
332
- }
333
- }
334
-
335
- /**
336
- * A Token is an implementation of PlaceableObject which represents an Actor within a viewed Scene on the game canvas.
337
- * @see TokenDocument
338
- * @see TokenLayer
339
- */
340
- class Token extends PlaceableObject<TokenDocument.ConfiguredInstance> {
341
- static override embeddedName: "Token";
342
-
343
- static override RENDER_FLAGS: {
344
- /** @defaultValue `{ propagate: ["refresh"] }` */
345
- redraw: RenderFlag<Token.RenderFlags>;
69
+ tooltip: PreciseText | undefined;
346
70
 
347
- /** @defaultValue `{}` */
348
- redrawEffects: RenderFlag<Token.RenderFlags>;
349
-
350
- /** @defaultValue `{ propagate: ["refreshState", "refreshSize", "refreshPosition", "refreshElevation", "refreshBars", "refreshNameplate", "refreshBorder", "refreshShader"], alias: true }` */
351
- refresh: RenderFlag<Token.RenderFlags>;
352
-
353
- /** @defaultValue `{ propagate: ["refreshVisibility", "refreshBorder"] }` */
354
- refreshState: RenderFlag<Token.RenderFlags>;
355
-
356
- /** @defaultValue `{ propagate: ["refreshMesh", "refreshBorder", "refreshBars", "refreshPosition", "refreshTarget", "refreshEffects"] }` */
357
- refreshSize: RenderFlag<Token.RenderFlags>;
358
-
359
- /** @defaultValue `{ propagate: ["refreshMesh", "refreshVisibility"] }` */
360
- refreshPosition: RenderFlag<Token.RenderFlags>;
361
-
362
- /** @defaultValue `{ propagate: ["refreshMesh"] }` */
363
- refreshElevation: RenderFlag<Token.RenderFlags>;
364
-
365
- /** @defaultValue `{}` */
366
- refreshVisibility: RenderFlag<Token.RenderFlags>;
367
-
368
- /** @defaultValue `{}` */
369
- refreshEffects: RenderFlag<Token.RenderFlags>;
370
-
371
- /** @defaultValue `{}` */
372
- refreshMesh: RenderFlag<Token.RenderFlags>;
373
-
374
- /** @defaultValue `{}` */
375
- refreshShader: RenderFlag<Token.RenderFlags>;
376
-
377
- /** @defaultValue `{}` */
378
- refreshBars: RenderFlag<Token.RenderFlags>;
379
-
380
- /** @defaultValue `{}` */
381
- refreshNameplate: RenderFlag<Token.RenderFlags>;
71
+ /**
72
+ * The target marker, which indicates that this Token is targeted by this User or others.
73
+ * @defaultValue `undefined`
74
+ * @remarks Only `undefined` prior to first draw
75
+ */
76
+ target: PIXI.Graphics | undefined;
382
77
 
383
- /** @defaultValue `{}` */
384
- refreshBorder: RenderFlag<Token.RenderFlags>;
78
+ /**
79
+ * The nameplate of this Token, which displays its name.
80
+ * @defaultValue `undefined`
81
+ * @remarks Only `undefined` prior to first draw
82
+ */
83
+ nameplate: PreciseText | undefined;
385
84
 
386
- /** @defaultValue `{}` */
387
- refreshTarget: RenderFlag<Token.RenderFlags>;
388
- };
85
+ /**
86
+ * Track the set of User documents which are currently targeting this Token
87
+ */
88
+ targeted: Set<User.Stored>;
389
89
 
390
90
  /**
391
- * Defines the filter to use for detection.
91
+ * A reference to the SpriteMesh which displays this Token in the PrimaryCanvasGroup.
92
+ * @defaultValue `undefined`
93
+ * @remarks Only `undefined` prior to first draw
392
94
  */
393
- detectionFilter?: PIXI.Filter | null;
95
+ mesh: PrimarySpriteMesh | undefined;
394
96
 
395
97
  /**
396
- * A Graphics instance which renders the border frame for this Token inside the GridLayer.
98
+ * Renders the mesh of this Token with ERASE blending in the Token.
397
99
  * @defaultValue `undefined`
398
- * */
399
- border?: PIXI.Graphics;
100
+ * @remarks Only `undefined` prior to first draw
101
+ * @privateRemarks Foundry types as `PIXI.DisplayObject`, but its only ever set to `PIXI.Container` in v12
102
+ */
103
+ voidMesh: PIXI.Container | undefined;
400
104
 
401
105
  /**
402
- * Track the set of User documents which are currently targeting this Token
106
+ * Renders the mesh of with the detection filter.
107
+ * @defaultValue `undefined`
108
+ * @remarks Only `undefined` prior to first draw
109
+ * @privateRemarks Foundry types as `PIXI.DisplayObject`, but its only ever set to `PIXI.Container` in v12
403
110
  */
404
- targeted: Set<User>;
111
+ detectionFilterMesh: PIXI.Container | undefined;
405
112
 
406
113
  /**
407
- * A reference to the SpriteMesh which displays this Token in the PrimaryCanvasGroup.
114
+ * The texture of this Token, which is used by its mesh.
115
+ * @defaultValue `undefined`
116
+ * @remarks `undefined` prior to first draw or after {@link Token._destroy | `Token#_destroy`} is called
408
117
  */
409
- mesh: PrimarySpriteMesh;
118
+ texture: PIXI.Texture | undefined;
410
119
 
411
120
  /**
412
121
  * A reference to the VisionSource object which defines this vision source area of effect
122
+ * @defaultValue `undefined`
123
+ * @remarks `undefined` prior to first draw or after {@link Token._destroy | `Token#_destroy`} is called, or
124
+ * {@link Token.initializeVisionSource | `Token#initializeVisionSource`} is called with `{deleted: true}`
413
125
  */
414
- vision: foundry.canvas.sources.PointVisionSource.Any;
126
+ vision: sources.PointVisionSource.ConfiguredInstance | undefined;
415
127
 
416
128
  /**
417
129
  * A reference to the LightSource object which defines this light source area of effect
130
+ * @defaultValue `undefined`
131
+ * @remarks `undefined` prior to first draw or after {@link Token._destroy | `Token#_destroy`} is called, or
132
+ * {@link Token.initializeLightSource | `Token#initializeLightSource`} is called with `{deleted: true}`
133
+ *
134
+ * Whether this is a LightSource or a DarknessSource depends on `this.document.light.negative`
418
135
  */
419
- light: foundry.canvas.sources.PointLightSource;
136
+ light: sources.PointLightSource.ConfiguredInstance | sources.PointDarknessSource.ConfiguredInstance | undefined;
420
137
 
421
138
  /**
422
139
  * The current animations of this Token.
@@ -424,39 +141,32 @@ declare global {
424
141
  get animationContexts(): Map<string, Token.AnimationContext>;
425
142
 
426
143
  /**
427
- * A reference to an animation that is currently in progress for this Token, if any
428
- * @internal
144
+ * A TokenRing instance which is used if this Token applies a dynamic ring.
145
+ * This property is null if the Token does not use a dynamic ring.
146
+ * @defaultValue `undefined`
147
+ * @remarks Only `undefined` prior to first draw. Set `null` if `token.document.ring.enabled` is `false`.
429
148
  */
430
- protected _animation: Promise<number> | null;
149
+ get ring(): foundry.canvas.tokens.TokenRing.ConfiguredInstance | null | undefined;
431
150
 
432
151
  /**
433
- * A convenient reference to the Actor object associated with the Token embedded document.
152
+ * A convenience boolean to test whether the Token is using a dynamic ring.
434
153
  */
435
- get actor(): this["document"]["actor"];
154
+ get hasDynamicRing(): boolean;
436
155
 
437
156
  /**
438
- * A convenient reference for whether the current User has full control over the Token document.
157
+ * A convenient reference to the Actor object associated with the Token embedded document.
439
158
  */
440
- get owner(): boolean;
441
-
442
- get isOwner(): boolean;
159
+ get actor(): TokenDocument.Implementation["actor"];
443
160
 
444
161
  /**
445
162
  * A boolean flag for whether the current game User has observer permission for the Token
446
163
  */
447
164
  get observer(): boolean;
448
165
 
449
- /**
450
- * Is the HUD display active for this token?
451
- */
452
- get hasActiveHUD(): boolean;
453
-
454
166
  /**
455
167
  * Convenience access to the token's nameplate string
456
- * @remarks
457
- * This is actually a getter that returns data.name
458
168
  */
459
- readonly name: string;
169
+ get name(): string;
460
170
 
461
171
  override get bounds(): PIXI.Rectangle;
462
172
 
@@ -473,17 +183,21 @@ declare global {
473
183
  /**
474
184
  * The Token's current central position
475
185
  */
476
- get center(): Canvas.Point;
186
+ get center(): PIXI.Point;
477
187
 
478
188
  /**
479
189
  * The Token's central position, adjusted in each direction by one or zero pixels to offset it relative to walls.
480
190
  */
481
- getMovementAdjustedPoint(point: Canvas.Point, offset?: { offsetX: number; offsetY: number }): Canvas.Point;
191
+ // offsets: not null (destructured)
192
+ getMovementAdjustedPoint(point: Canvas.Point, offsets?: Token.GetMovementAdjustedPointOffsets): Canvas.Point;
482
193
 
483
194
  /**
484
195
  * The HTML source element for the primary Tile texture
196
+ * @privateRemarks Foundry types this as `HTMLImageElement | HTMLVideoElement`, but this just
197
+ * returns `this.texture?.baseTexture.resource.source`, which could be any of `PIXI.ImageSource`,
198
+ * and returns `ImageBitmap`, not `HTMLImageElement`, for static images.
485
199
  */
486
- get sourceElement(): HTMLImageElement | HTMLVideoElement | undefined;
200
+ get sourceElement(): PIXI.ImageSource | undefined;
487
201
 
488
202
  override get sourceId(): string;
489
203
 
@@ -500,7 +214,7 @@ declare global {
500
214
  /**
501
215
  * Return a reference to a Combatant that represents this Token, if one is present in the current encounter.
502
216
  */
503
- get combatant(): Combatant.ConfiguredInstance | null;
217
+ get combatant(): Combatant.Stored;
504
218
 
505
219
  /**
506
220
  * An indicator for whether the Token is currently targeted by the active game User
@@ -510,7 +224,7 @@ declare global {
510
224
  /**
511
225
  * Return a reference to the detection modes array.
512
226
  */
513
- get detectionModes(): Array<DetectionMode>;
227
+ get detectionModes(): TokenDocument.Implementation["detectionModes"];
514
228
 
515
229
  /**
516
230
  * Determine whether the Token is visible to the calling user's perspective.
@@ -519,12 +233,16 @@ declare global {
519
233
  * Controlled tokens are always visible.
520
234
  * All Tokens are visible to a GM user if no Token is controlled.
521
235
  *
522
- * @see {@link CanvasVisibility#testVisibility}
236
+ * @see {@link CanvasVisibility.testVisibility | `CanvasVisibility#testVisibility`}
523
237
  */
524
238
  get isVisible(): boolean;
525
239
 
526
240
  /**
527
241
  * The animation name used for Token movement
242
+ * @defaultValue
243
+ * ```js
244
+ * `${this.objectId}.animate`
245
+ * ```
528
246
  */
529
247
  get animationName(): string;
530
248
 
@@ -534,7 +252,19 @@ declare global {
534
252
  get hasSight(): boolean;
535
253
 
536
254
  /**
537
- * Test whether the Token emits light (or darkness) at any radius
255
+ * Does this Token actively emit light given its properties and the current darkness level of the Scene?
256
+ */
257
+ protected _isLightSource(): boolean;
258
+
259
+ /**
260
+ * Does this Ambient Light actively emit darkness given
261
+ * its properties and the current darkness level of the Scene?
262
+ */
263
+ get emitsDarkness(): boolean;
264
+
265
+ /**
266
+ * Does this Ambient Light actively emit light given
267
+ * its properties and the current darkness level of the Scene?
538
268
  */
539
269
  get emitsLight(): boolean;
540
270
 
@@ -553,6 +283,16 @@ declare global {
553
283
  */
554
284
  get brightRadius(): number;
555
285
 
286
+ /**
287
+ * The maximum radius in pixels of the light field
288
+ */
289
+ get radius(): number;
290
+
291
+ /**
292
+ * The range of this token's light perception in pixels.
293
+ */
294
+ get lightPerceptionRange(): number;
295
+
556
296
  /**
557
297
  * Translate the token's vision range in units into a radius in pixels.
558
298
  */
@@ -563,37 +303,44 @@ declare global {
563
303
  */
564
304
  get optimalSightRange(): number;
565
305
 
566
- // TODO(LukeAbby): This override appears to fail because it creates a circular dependency that tsc can't resolve for some reason. Bug report?
567
- // `Token` is a `PlaceableObject` if it properly extends `PlaceableObject` however `clone` is a proper override of `PlaceableObject.clone` only if its return value extends `PlaceableObject`.
568
- // This creates a loop of checking `Token` against `PlaceableObject`.
569
- // override clone(): Token;
570
-
571
306
  /**
572
- * Update the light and vision source objects associated with this Token
307
+ * Update the light and vision source objects associated with this Token.
573
308
  * @param options - Options which configure how perception sources are updated
574
309
  */
575
- updateSource(options?: Token.UpdateSourceOptions): void;
310
+ // options: not null (destructured)
311
+ initializeSources(options?: Token.InitializeSourcesOptions): void;
576
312
 
577
313
  /**
578
314
  * Update an emitted light source associated with this Token.
579
- * @param options - (default `{}`)
580
315
  */
581
- updateLightSource(options?: Token.UpdateLightSourceOptions): void;
316
+ // options: not null (destructured)
317
+ initializeLightSource(options?: Token.InitializeSourcesOptions): void;
582
318
 
583
319
  /**
584
- * Update an Token vision source associated for this token.
585
- * @param options - Options which affect how the vision source is updated
586
- * (default: `{}`)
320
+ * Get the light source data.
587
321
  */
588
- updateVisionSource(options?: Token.UpdateVisionSourceOptions): void;
322
+ protected _getLightSourceData(): Token.LightSourceData;
589
323
 
590
324
  /**
591
- * Test whether this Token is a viable vision source for the current User
592
- * @internal
325
+ * Update the VisionSource instance associated with this Token.
593
326
  */
594
- protected _isVisionSource(): boolean;
327
+ // options: not null (destructured)
328
+ initializeVisionSource(options?: Token.InitializeSourcesOptions): void;
329
+
330
+ /**
331
+ * Returns a record of blinding state.
332
+ */
333
+ protected _getVisionBlindedStates(): Token.BlindedStates;
595
334
 
596
- override render(renderer: PIXI.Renderer): void;
335
+ /**
336
+ * Get the vision source data.
337
+ */
338
+ protected _getVisionSourceData(): Token.VisionSourceData;
339
+
340
+ /**
341
+ * Test whether this Token is a viable vision source for the current User.
342
+ */
343
+ protected _isVisionSource(): boolean;
597
344
 
598
345
  /**
599
346
  * Render the bound mesh detection filter.
@@ -603,17 +350,58 @@ declare global {
603
350
 
604
351
  override clear(): void;
605
352
 
606
- protected override _destroy(options?: PIXI.IDestroyOptions | boolean): void;
353
+ protected override _destroy(options: PIXI.IDestroyOptions | boolean | undefined): void;
607
354
 
608
- protected override _draw(options?: Record<string, unknown>): Promise<void>;
355
+ protected override _draw(options: HandleEmptyObject<Token.DrawOptions> | undefined): Promise<void>;
609
356
 
610
357
  protected override _applyRenderFlags(flags: Token.RenderFlags): void;
611
358
 
359
+ /**
360
+ * Refresh the token ring visuals if necessary.
361
+ */
362
+ protected _refreshRingVisuals(): void;
363
+
612
364
  /**
613
365
  * Refresh the visibility.
614
366
  */
615
367
  protected _refreshVisibility(): void;
616
368
 
369
+ /**
370
+ * Refresh aspects of the user interaction state.
371
+ * For example the border, nameplate, or bars may be shown on Hover or on Control.
372
+ */
373
+ protected _refreshState(): void;
374
+
375
+ /**
376
+ * Refresh the size.
377
+ */
378
+ protected _refreshSize(): void;
379
+
380
+ /**
381
+ * Refresh the shape.
382
+ */
383
+ protected _refreshShape(): void;
384
+
385
+ /**
386
+ * Refresh the rotation.
387
+ */
388
+ protected _refreshRotation(): void;
389
+
390
+ /**
391
+ * Refresh the position.
392
+ */
393
+ protected _refreshPosition(): void;
394
+
395
+ /**
396
+ * Refresh the elevation
397
+ */
398
+ protected _refreshElevation(): void;
399
+
400
+ /**
401
+ * Refresh the tooltip.
402
+ */
403
+ protected _refreshTooltip(): void;
404
+
617
405
  /**
618
406
  * Refresh the text content, position, and visibility of the Token nameplate.
619
407
  */
@@ -630,34 +418,32 @@ declare global {
630
418
  protected _refreshShader(): void;
631
419
 
632
420
  /**
633
- * Draw the Token border, taking into consideration the grid type and border color
634
- * @internal
421
+ * Refresh the border.
635
422
  */
636
423
  protected _refreshBorder(): void;
637
424
 
638
425
  /**
639
426
  * Get the hex color that should be used to render the Token border
640
427
  * @returns The hex color used to depict the border color
641
- * @internal
428
+ * @throws If this Token's Document somehow has an invalid `disposition`
429
+ * @remarks Border colors set via `CONFIG.Canvas.dispositionColors`
642
430
  */
643
- protected _getBorderColor(options?: {
644
- /**
645
- * Return a border color for this hover state, otherwise use the token's current state.
646
- */
647
- hover?: boolean;
648
- }): number | null;
431
+ protected _getBorderColor(): number;
649
432
 
650
433
  /**
651
434
  * Refresh the target indicators for the Token.
652
435
  * Draw both target arrows for the primary User and indicator pips for other Users targeting the same Token.
653
436
  * @param reticule - Additional parameters to configure how the targeting reticule is drawn.
437
+ * @remarks Forwards `reticule` to {@link Token._drawTarget | `Token#_drawTarget`}
654
438
  */
439
+ // reticule: not null (destructured in _drawTarget)
655
440
  protected _refreshTarget(reticule?: Token.ReticuleOptions): void;
656
441
 
657
442
  /**
658
443
  * Draw the targeting arrows around this token.
659
444
  * @param reticule - Additional parameters to configure how the targeting reticule is drawn.
660
445
  */
446
+ // reticule: not null (destructured)
661
447
  protected _drawTarget(reticule?: Token.ReticuleOptions): void;
662
448
 
663
449
  /**
@@ -671,8 +457,15 @@ declare global {
671
457
  * @param number - The Bar number
672
458
  * @param bar - The Bar container
673
459
  * @param data - Resource data for this bar
460
+ * @remarks Called in {@link Token.drawBars | `Token#drawBars`} only after checking `data` for truthiness.
461
+ *
462
+ * Unconditionally returns `true`
674
463
  */
675
- protected _drawBar(number: number, bar: PIXI.Graphics, data: ReturnType<TokenDocument["getBarAttribute"]>): void;
464
+ protected _drawBar(
465
+ number: number,
466
+ bar: PIXI.Graphics,
467
+ data: NonNullable<TokenDocument.GetBarAttributeReturn>,
468
+ ): boolean;
676
469
 
677
470
  /**
678
471
  * Return the text which should be displayed in a token's tooltip field
@@ -687,23 +480,27 @@ declare global {
687
480
  /**
688
481
  * Draw the active effects and overlay effect icons which are present upon the Token
689
482
  */
690
- drawEffects(): Promise<void>;
483
+ drawEffects(): Promise<this>;
691
484
 
692
485
  /**
693
- * Draw a status effect icon
486
+ * Draw the effect icons for ActiveEffect documents which apply to the Token's Actor.
487
+ * Called by {@link Token.drawEffects | `Token#drawEffects`}.
694
488
  */
695
- protected _drawEffect(src: string, tint: number | null): Promise<PIXI.Sprite | undefined>;
489
+ protected _drawEffects(): Promise<void>;
696
490
 
697
491
  /**
698
- * Draw the effect icons for ActiveEffect documents which apply to the Token's Actor.
699
- * Called by {@link Token#drawEffects}.
492
+ * Draw a status effect icon
493
+ * @param src - Path to a texture
494
+ * @param tint - A tint to apply to the returned sprite (default: `0xFFFFFF`)
495
+ * @remarks Returns early if `src` is falsey, but otherwise calls {@link loadTexture | `loadTexture`} with `{ fallback: "icons/svg/hazard.svg" }` and returns that
700
496
  */
701
- protected _drawEffects(): Promise<void>;
497
+ protected _drawEffect(src: string, tint?: number | null): Promise<PIXI.Sprite | undefined>;
702
498
 
703
499
  /**
704
500
  * Draw the overlay effect icon
501
+ * @remarks Forwards both arguments to {@link Token._drawEffect | `Token#_drawEffect`}, and returns its output.
705
502
  */
706
- protected _drawOverlay(src: string, tint: number | null): Promise<PIXI.Sprite>;
503
+ protected _drawOverlay(src: string, tint?: number | null): Promise<PIXI.Sprite | undefined>;
707
504
 
708
505
  /**
709
506
  * Refresh the display of status effects, adjusting their position for the token width and height.
@@ -715,128 +512,167 @@ declare global {
715
512
  * @param mode - The mode from CONST.TOKEN_DISPLAY_MODES
716
513
  * @returns Is the attribute viewable?
717
514
  */
718
- protected _canViewMode(mode: foundry.CONST.TOKEN_DISPLAY_MODES): boolean;
515
+ protected _canViewMode(mode: CONST.TOKEN_DISPLAY_MODES): boolean;
719
516
 
720
517
  /**
721
- * Animate changes to the appearance of the Token.
722
- * Animations are performed over differences between the TokenDocument and the current Token and TokenMesh appearance.
723
- * @param updateData - A record of the differential data which changed, for reference only
724
- * @param options - Options which configure the animation behavior
725
- * @returns A promise which resolves once the animation is complete
518
+ * Override ring colors for this particular Token instance.
519
+ * @remarks The return gets `mergeObject`ed over {@link TokenDocument.ring | `TokenDocument#ring#colors`}
520
+ * in {@link foundry.canvas.tokens.TokenRing.configureVisuals | `TokenRing#configureVisuals`} and
521
+ * {@link foundry.canvas.tokens.TokenRing.flashColor | `TokenRing#flashColor`}. Foundry's implementation returns `{}`
726
522
  */
727
- animate(
728
- updateData: unknown,
729
- options: {
730
- /** An optional function called each animation frame */
731
- ontick: (dt: number, data: CanvasAnimationData) => number;
523
+ getRingColors(): Token.RingColors;
732
524
 
733
- /**
734
- * A desired token movement speed in grid spaces per second
735
- * @defaultValue `6`
736
- */
737
- movementSpeed: number;
525
+ /**
526
+ * Apply additional ring effects for this particular Token instance.
527
+ * Effects are returned as an array of integers in {@link foundry.canvas.tokens.TokenRing.effects}.
528
+ * @remarks Additional effects to add over and above those in `CONFIG.Token.ring.effects`. Foundry's implementation returns `[]`
529
+ */
530
+ getRingEffects(): foundry.canvas.tokens.TokenRing.EFFECTS[];
738
531
 
739
- /**
740
- * The animation starting attributes if different from those cached.
741
- *
742
- * @deprecated since v12, will be removed in v14
743
- */
744
- a0: unknown;
745
- },
746
- ): Promise<void>;
532
+ /**
533
+ * Get the animation data for the current state of the document.
534
+ * @returns The target animation data object
535
+ */
536
+ protected _getAnimationData(): Token.AnimationData;
747
537
 
748
538
  /**
749
- * Terminate animation of this particular Token.
539
+ * Animate from the old to the new state of this Token.
540
+ * @param to - The animation data to animate to
541
+ * @param options - The options that configure the animation behavior. Passed to {@link Token._getAnimationDuration | `Token#_getAnimationDuration`}.
750
542
  */
751
- stopAnimation(): void;
543
+ // options: not null (destructured)
544
+ animate(to: Token.PartialAnimationData, options?: Token.AnimateOptions): Promise<void>;
752
545
 
753
546
  /**
754
- * Check for collision when attempting a move to a new position
755
- * @param destination - The central destination point of the attempted movement
756
- * @param options - Additional options forwarded to WallsLayer#checkCollision
757
- * @returns The result of the WallsLayer#checkCollision test
547
+ * Get the duration of the animation.
548
+ * @param from - The animation data to animate from
549
+ * @param to - The animation data to animate to
550
+ * @param options - The options that configure the animation behavior
551
+ * @returns The duration of the animation in milliseconds
758
552
  */
759
- checkCollision(
760
- destination: Canvas.Point,
761
- options: {
762
- origin: Canvas.Point;
553
+ // options: not null (destructured)
554
+ protected _getAnimationDuration(
555
+ from: Token.AnimationDataForDuration,
556
+ to: Token.PartialAnimationData,
557
+ options?: Token.GetAnimationDurationOptions,
558
+ ): number;
763
559
 
764
- /** @defaultValue `"move"` */
765
- type: Exclude<Token.SourceType, "Sound">;
560
+ /**
561
+ * Called each animation frame.
562
+ * @param changed - The animation data that changed
563
+ * @param context - The animation context
564
+ */
565
+ protected _onAnimationUpdate(changed: Token.PartialAnimationData, context: Token.AnimationContext): void;
766
566
 
767
- /** @defaultValue `"any"` */
768
- mode: PointSourcePolygon.CollisionModes;
769
- },
770
- ): boolean;
771
567
  /**
772
- * Get the center-point coordinate for a given grid position
773
- * @param x - The grid x-coordinate that represents the top-left of the Token
774
- * @param y - The grid y-coordinate that represents the top-left of the Token
775
- * @returns The coordinate pair which represents the Token's center at position (x, y)
568
+ * Terminate animation of this particular Token.
776
569
  */
777
- getCenter(
778
- x: number,
779
- y: number,
780
- ): {
781
- x: number;
782
- y: number;
783
- };
570
+ // options: not null (destructured)
571
+ stopAnimation(options?: Token.StopAnimationOptions): void;
784
572
 
785
573
  /**
786
- * Set the token's position by comparing its center position vs the nearest grid vertex
787
- * Return a Promise that resolves to the Token once the animation for the movement has been completed
788
- * @param x - The x-coordinate of the token center
789
- * @param y - The y-coordinate of the token center
790
- * @param options - Additional options which configure the token movement
791
- * (defaultValue: `{}`)
792
- * @returns The Token after animation has completed
574
+ * Prepare the animation data changes: performs special handling required for animating rotation.
575
+ * @param from - The animation data to animate from
576
+ * @param changes - The animation data changes
577
+ * @param context - The animation context
578
+ * @param options - The options that configure the animation behavior
579
+ * @returns The animation attributes
793
580
  */
794
- setPosition(x: number, y: number, options?: Token.PositionOptions): Promise<this>;
581
+ // options: not null (property access)
582
+ protected _prepareAnimation(
583
+ from: Token.AnimationDataForRotation,
584
+ changes: Token.PartialAnimationData,
585
+ context: Token.AnimationContext,
586
+ options?: Token.PrepareAnimationOptions,
587
+ ): CanvasAnimation.Attribute[];
795
588
 
796
589
  /**
797
- * Update the Token velocity auto-regressively, shifting increasing weight towards more recent movement
798
- * Employ a magic constant chosen to minimize (effectively zero) the likelihood of trigonometric edge cases
799
- * @param ray - The proposed movement ray
800
- * @returns An updated velocity with directional memory
801
- * @internal
590
+ * Check for collision when attempting a move to a new position
591
+ * @param destination - The central destination point of the attempted movement
592
+ * @param options - Additional options forwarded to {@link WallsLayer.checkCollision | `WallsLayer#checkCollision`}
593
+ * @returns The result of the `WallsLayer#checkCollision` test
802
594
  */
803
- protected _updateVelocity(ray: Ray): Token.Velocity;
595
+ // options: not null (destructured)
596
+ checkCollision<Mode extends PointSourcePolygon.CollisionModes | undefined = undefined>(
597
+ destination: Canvas.Point,
598
+ options?: Token.CheckCollisionOptions<Mode>,
599
+ ): PointSourcePolygon.TestCollision<Coalesce<Mode, "any">>;
804
600
 
805
601
  /**
806
- * Set this Token as an active target for the current game User
807
- * @param targeted - Is the Token now targeted?
808
- * (default: `true`)
809
- * @param context - Additional context options
810
- * (default `{}`)
602
+ * Get the width and height of the Token in pixels.
603
+ * @returns The size in pixels
811
604
  */
812
- setTarget(targeted?: boolean, context?: Token.SetTargetContext): void;
605
+ getSize(): Token.Size;
813
606
 
814
607
  /**
815
- * Add or remove the currently controlled Tokens from the active combat encounter
816
- * @param combat - A specific combat encounter to which this Token should be added
817
- * @returns The Token which initiated the toggle
608
+ * Get the shape of this Token.
609
+ * @privateRemarks Foundry types this as possibly returning a `PIXI.Circle`, but it never does in practice in v12.
610
+ * Not reported as this has changed in v13.
818
611
  */
819
- toggleCombat(combat?: Combat.ConfiguredInstance): Promise<this>;
612
+ getShape(): PIXI.Rectangle | PIXI.Polygon;
613
+
614
+ /**
615
+ * Get the center point for a given position or the current position.
616
+ * @param position - The position to be used instead of the current position (default: `this.document`)
617
+ * @returns The center point
618
+ */
619
+ getCenterPoint(position?: Canvas.Point | null): Canvas.Point;
620
+
621
+ override getSnappedPosition(position?: Canvas.Point | null): Canvas.Point;
820
622
 
821
623
  /**
822
- * Toggle an active effect by its texture path.
823
- * Copy the existing Array in order to ensure the update method detects the data as changed.
624
+ * Test whether the Token is inside the Region.
625
+ * This function determines the state of {@link TokenDocument.regions | `TokenDocument#regions`} and {@link RegionDocument.tokens | `RegionDocument#tokens`}.
824
626
  *
825
- * @param effect - The texture file-path of the effect icon to toggle on the Token.
826
- * @param options - Additional optional arguments which configure how the effect is handled.
827
- * (defaultValue: `{}`)
828
- * @returns Was the texture applied (true) or removed (false)
627
+ * Implementations of this function are restricted in the following ways:
628
+ * - If the bounds (given by {@link Token.getSize | `Token#getSize`}) of the Token do not intersect the Region, then the Token is not
629
+ * contained within the Region.
630
+ * - If the Token is inside the Region a particular elevation, then the Token is inside the Region at any elevation
631
+ * within the elevation range of the Region.
632
+ *
633
+ * If this function is overridden, then {@link Token.segmentizeRegionMovement | `Token#segmentizeRegionMovement`} must be overridden too.
634
+ * @param region - The region.
635
+ * @param position - The (x, y) and/or elevation to use instead of the current values.
636
+ * @returns Is the Token inside the Region?
637
+ * @remarks `position` can be `{x, y}`, `{elevation}`, both, or neither. If either part is omitted, uses the document's value(s)
829
638
  */
830
- toggleEffect(
831
- effect: string | Parameters<TokenDocument["toggleActiveEffect"]>[0],
832
- options?: Token.EffectToggleOptions,
833
- ): Promise<boolean>;
639
+ testInsideRegion(region: Region.Implementation, position?: Token.TestablePosition | null): boolean;
640
+
641
+ /**
642
+ * Split the Token movement through the waypoints into its segments.
643
+ *
644
+ * Implementations of this function are restricted in the following ways:
645
+ * - The segments must go through the waypoints.
646
+ * - The *from* position matches the *to* position of the succeeding segment.
647
+ * - The Token must be contained (w.r.t. {@link Token.testInsideRegion | `Token#testInsideRegion`}) within the Region
648
+ * at the *from* and *to* of MOVE segments.
649
+ * - The Token must be contained (w.r.t. {@link Token.testInsideRegion | `Token#testInsideRegion`}) within the Region
650
+ * at the *to* position of ENTER segments.
651
+ * - The Token must be contained (w.r.t. {@link Token.testInsideRegion | `Token#testInsideRegion`}) within the Region
652
+ * at the *from* position of EXIT segments.
653
+ * - The Token must not be contained (w.r.t. {@link Token.testInsideRegion | `Token#testInsideRegion`}) within the Region
654
+ * at the *from* position of ENTER segments.
655
+ * - The Token must not be contained (w.r.t. {@link Token.testInsideRegion | `Token#testInsideRegion`}) within the Region
656
+ * at the *to* position of EXIT segments.
657
+ * @param region - The region.
658
+ * @param waypoints - The waypoints of movement.
659
+ * @param options - Additional options
660
+ * @returns The movement split into its segments.
661
+ */
662
+ // options: not null (destructured)
663
+ segmentizeRegionMovement(
664
+ region: Region.Implementation,
665
+ waypoints: Region.MovementWaypoint[],
666
+ options?: Region.SegmentizeMovementOptions,
667
+ ): Region.MovementSegment[];
834
668
 
835
669
  /**
836
- * Toggle the visibility state of any Tokens in the currently selected set
837
- * @returns A Promise which resolves to the updated Token documents
670
+ * Set this Token as an active target for the current game User
671
+ * @param targeted - Is the Token now targeted? (default: `true`)
672
+ * @param context - Additional context options
838
673
  */
839
- toggleVisibility(): Promise<TokenDocument.ConfiguredInstance[]>;
674
+ // targeted: not null (!== check with a boolean), context: not null (destructured)
675
+ setTarget(targeted?: boolean, context?: Token.TargetContext): void;
840
676
 
841
677
  /**
842
678
  * The external radius of the token in pixels.
@@ -852,99 +688,606 @@ declare global {
852
688
  */
853
689
  getLightRadius(units: number): number;
854
690
 
855
- protected override _getShiftedPosition(dx: number, dy: number): { x: number; y: number };
691
+ protected override _getShiftedPosition(dx: number, dy: number): Canvas.Point;
692
+
693
+ // options: not null (destructured)
694
+ protected override _updateRotation(options?: PlaceableObject.UpdateRotationOptions): number;
695
+
696
+ // _onCreate, _onUpdate, and _onDelete are overridden but with no signature changes.
697
+ // For type simplicity they are left off. These methods historically have been the source of a large amount of computation from tsc.
856
698
 
857
699
  /**
858
- * @privateRemarks _onDelete and _onUpdate are overridden but with no signature changes.
859
- * For type simplicity they are left off. These methods historically have been the source of a large amount of computation from tsc.
700
+ * Handle changes to Token behavior when a significant status effect is applied
701
+ * @param statusId - The status effect ID being applied, from `CONFIG.specialStatusEffects`
702
+ * @param active - Is the special status effect now active?
703
+ * @remarks Foundry marked `@internal`
860
704
  */
705
+ protected _onApplyStatusEffect(statusId: string, active: boolean): void;
861
706
 
862
707
  /**
863
- * Handle changes to Token behavior when a significant status effect is applied
864
- * @param statusId - The status effect ID being applied, from CONFIG.specialStatusEffects
708
+ * Add/Modify a filter effect on this token.
709
+ * @param statusId - The status effect ID being applied, from `CONFIG.specialStatusEffects`
865
710
  * @param active - Is the special status effect now active?
866
- * @internal
711
+ * @remarks Foundry marked `@internal`
712
+ */
713
+ protected _configureFilterEffect(statusId: string, active: boolean): void;
714
+
715
+ /**
716
+ * Update the filter effects depending on special status effects
717
+ * TODO: replace this method by something more convenient.
718
+ * @remarks Foundry marked `@internal`. The TODO is theirs.
867
719
  */
868
- _onApplyStatusEffect(statusId: string, active: boolean): void;
720
+ protected _updateSpecialStatusFilterEffects(): void;
869
721
 
870
- protected override _onControl(options?: Token.ControlOptions): void;
722
+ /**
723
+ * Remove all filter effects on this placeable.
724
+ * @remarks Foundry marked `@internal`
725
+ */
726
+ protected _removeAllFilterEffects(): void;
727
+
728
+ protected override _onControl(options: Token.ControlOptions): void;
871
729
 
872
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
873
- protected override _onRelease(
874
- options: PlaceableObject.ReleaseOptions,
875
- ): Promise<TokenDocument.ConfiguredInstance> | undefined;
730
+ protected override _onRelease(options: HandleEmptyObject<Token.ReleaseOptions>): void;
876
731
 
877
- protected override _canControl(user?: User.ConfiguredInstance, event?: PIXI.FederatedEvent): boolean;
732
+ protected override _overlapsSelection(rectangle: PIXI.Rectangle): boolean;
878
733
 
879
- protected override _canHUD(user: User.ConfiguredInstance, event?: PIXI.FederatedEvent): boolean;
734
+ protected override _canControl(user: User.Implementation, event: PIXI.FederatedEvent): boolean;
880
735
 
881
- protected override _canConfigure(user?: User.ConfiguredInstance, event?: PIXI.FederatedEvent): true;
736
+ protected override _canHUD(user: User.Implementation, event: PIXI.FederatedEvent): boolean;
882
737
 
883
- protected override _canHover(user?: User.ConfiguredInstance, event?: PIXI.FederatedEvent): true;
738
+ protected override _canConfigure(user: User.Implementation, event: PIXI.FederatedEvent): true;
884
739
 
885
- protected override _canView(user?: User.ConfiguredInstance, event?: PIXI.FederatedEvent): boolean;
740
+ protected override _canHover(user: User.Implementation, event: PIXI.FederatedEvent): true;
886
741
 
887
- protected override _canDrag(user: User.ConfiguredInstance, event: PIXI.FederatedEvent): boolean;
742
+ protected override _canView(user: User.Implementation, event: PIXI.FederatedEvent): boolean;
888
743
 
889
- protected override _onHoverIn(event: PIXI.FederatedEvent, options?: { hoverOutOthers?: boolean }): void;
744
+ protected override _canDrag(user: User.Implementation, event: PIXI.FederatedEvent): boolean;
890
745
 
891
- protected override _onHoverOut(event: PIXI.FederatedEvent): false | void;
746
+ // options: not null (destructured)
747
+ protected override _onHoverIn(event: PIXI.FederatedEvent, options?: PlaceableObject.HoverInOptions): void;
748
+
749
+ protected override _onHoverOut(event: PIXI.FederatedEvent): void;
892
750
 
893
751
  protected override _onClickLeft(event: PIXI.FederatedEvent): void;
894
752
 
753
+ protected override _propagateLeftClick(event: PIXI.FederatedEvent): boolean;
754
+
895
755
  protected override _onClickLeft2(event?: PIXI.FederatedEvent): void;
896
756
 
897
757
  protected override _onClickRight2(event: PIXI.FederatedEvent): void;
898
758
 
899
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
900
- protected override _onDragLeftDrop(event: PIXI.FederatedEvent): Promise<unknown>;
759
+ protected override _onDragLeftStart(event: PIXI.FederatedEvent): void;
760
+
761
+ protected override _prepareDragLeftDropUpdates(event: PIXI.FederatedEvent): Token.DragLeftDropUpdate[];
901
762
 
902
763
  protected override _onDragLeftMove(event: PIXI.FederatedEvent): void;
903
764
 
904
765
  protected override _onDragEnd(): void;
905
766
 
906
767
  /**
907
- * @remarks Not used
768
+ * @deprecated since v11, will be removed in v13
769
+ * @remarks "`Token#updatePosition` has been deprecated without replacement as it is no longer required."
908
770
  */
909
- controlIcon: null;
771
+ updatePosition(): void;
910
772
 
911
773
  /**
912
- * @deprecated since v10, will be removed in v12
913
- * @remarks `"Token#hasLimitedVisionAngle has been renamed to Token#hasLimitedSourceAngle"`
774
+ * @deprecated since v11, will be removed in v13
775
+ * @remarks "`Token#refreshHUD` is deprecated in favor of {@link RenderFlags.set | `token.renderFlags.set()`}"
914
776
  */
915
- get hasLimitedVisionAngle(): boolean;
777
+ // options: not null (destructured)
778
+ refreshHUD(options?: Token.RefreshHUDOptions): void;
916
779
 
917
780
  /**
918
- * @deprecated since v10, will be removed in v12
919
- * @remarks `"Token#getSightOrigin has been deprecated in favor of Token#getMovementAdjustedPoint"`
781
+ * Update the light and vision source objects associated with this Token
782
+ * @param options - Options which configure how perception sources are updated
783
+ * @deprecated since v12, until v14
784
+ * @remarks "`Token#updateSource` has been deprecated in favor of {@link Token.initializeSources | `Token#initializeSources`}"
920
785
  */
921
- getSightOrigin(): {
922
- x: number;
923
- y: number;
924
- };
786
+ // options: not null (destructured)
787
+ updateSource(options?: Token.InitializeSourcesOptions): void;
925
788
 
926
789
  /**
927
- * @deprecated since v10, will be removed in v12
928
- * @remarks `"Token#icon has been renamed to Token#mesh."`
790
+ * Get the center-point coordinate for a given grid position
791
+ * @param x - The grid x-coordinate that represents the top-left of the Token
792
+ * @param y - The grid y-coordinate that represents the top-left of the Token
793
+ * @returns The coordinate pair which represents the Token's center at position (x, y)
794
+ * @deprecated since v12, until v14
795
+ * @remarks "`Token#getCenter(x, y)` has been deprecated in favor of {@link Token.getCenterPoint | `Token#getCenterPoint(Point)`}."
929
796
  */
930
- get icon(): this["mesh"];
797
+ getCenter(x: number, y: number): Canvas.Point;
931
798
 
932
799
  /**
933
- * @deprecated since v11, will be removed in v13
934
- * @remarks `"Token#updatePosition has been deprecated without replacement as it is no longer required."`
800
+ * A convenient reference for whether the current User has full control over the Token document.
801
+ * @deprecated since v12, until v14
802
+ * @remarks "`Token#owner` has been deprecated. Use {@link Token.isOwner | `Token#isOwner`} instead."
935
803
  */
936
- updatePosition(): void;
804
+ get owner(): boolean;
937
805
 
938
806
  /**
939
- * @deprecated since v11, will be removed in v13
940
- * @remarks "Token#refreshHUD is deprecated in favor of token.renderFlags.set()"
807
+ * @deprecated since v12, until v14
808
+ * @remarks "`Token#toggleCombat` is deprecated in favor of {@link TokenDocument.toggleCombatant | `TokenDocument#toggleCombatant`},
809
+ * {@link TokenDocument.createCombatants | `TokenDocument.implementation.createCombatants`}, and
810
+ * {@link TokenDocument.deleteCombatants | `TokenDocument.implementation.deleteCombatants`}"
811
+ *
812
+ * The `combat` parameter is unused. Creates Combatants for every Token controlled, plus the Token this was called on if it wasn't already controlled
941
813
  */
942
- refreshHUD(options?: Token.ObjectHUD): void;
814
+ toggleCombat(combat?: Combat.Implementation): Promise<Combatant.Stored[]>;
815
+
816
+ /**
817
+ * @deprecated since v12, until v14
818
+ * @remarks "`Token#toggleEffect` is deprecated in favor of {@link Actor.toggleStatusEffect | `Actor#toggleStatusEffect`}"
819
+ */
820
+ // options: not null (destructured)
821
+ toggleEffect(
822
+ effect: CONFIG.StatusEffect,
823
+ options?: Actor.ToggleStatusEffectOptions,
824
+ ): Promise<ActiveEffect.Stored | boolean | undefined>;
825
+
826
+ /**
827
+ * @deprecated since v12, until v14
828
+ * @remarks "`Token#toggleVisibility` is deprecated without replacement in favor of updating the {@link TokenDocument.hidden | `hidden` field of the `TokenDocument`} directly."
829
+ */
830
+ toggleVisibility(): Promise<TokenDocument.Stored[]>;
831
+
832
+ /**
833
+ * @deprecated since v12 Stable 4, until v14
834
+ * @remarks "`Token#_recoverFromPreview` is deprecated without replacement in favor of recovering from preview directly into {@link TokenConfig._resetPreview | `TokenConfig#_resetPreview`}."
835
+ */
836
+ protected _recoverFromPreview(): void;
943
837
  }
944
838
 
945
839
  /**
946
840
  * A "secret" global to help debug attributes of the currently controlled Token.
947
841
  * This is only for debugging, and may be removed in the future, so it's not safe to use.
948
842
  */
949
- let _token: Token.ConfiguredInstance | null;
843
+ let _token: Token.Implementation | null;
844
+
845
+ namespace Token {
846
+ /**
847
+ * The implementation of the `Token` placeable configured through `CONFIG.Token.objectClass`
848
+ * in Foundry and {@link PlaceableObjectClassConfig | `PlaceableObjectClassConfig`} in fvtt-types.
849
+ *
850
+ * Not to be confused with {@link TokenDocument.Implementation | `TokenDocument.Implementation`}
851
+ * which refers to the implementation for the Token document.
852
+ */
853
+ type Implementation = FixedInstanceType<ImplementationClass>;
854
+
855
+ /**
856
+ * The implementation of the `Token` placeable configured through `CONFIG.Token.objectClass`
857
+ * in Foundry and {@link PlaceableObjectClassConfig | `PlaceableObjectClassConfig`} in fvtt-types.
858
+ *
859
+ * Not to be confused with {@link TokenDocument.ImplementationClass | `TokenDocument.ImplementationClass`}
860
+ * which refers to the implementation for the Token document.
861
+ */
862
+ // eslint-disable-next-line no-restricted-syntax
863
+ type ImplementationClass = ConfiguredObjectClassOrDefault<typeof Token>;
864
+
865
+ /**
866
+ * @deprecated {@link ImplementationClass | `ImplementationClass`}
867
+ */
868
+ type ObjectClass = ImplementationClass;
869
+
870
+ /**
871
+ * @deprecated {@link Implementation | `Implementation`}
872
+ */
873
+ type Object = Implementation;
874
+
875
+ /**
876
+ * @deprecated {@link Drawing.ImplementationClass | `Drawing.ImplementationClass`}
877
+ */
878
+ type ConfiguredClass = ImplementationClass;
879
+
880
+ /**
881
+ * @deprecated {@link Drawing.Implementation | `Drawing.Implementation`}
882
+ */
883
+ type ConfiguredInstance = Implementation;
884
+
885
+ type Schema = BaseToken.Schema;
886
+ type Parent = BaseToken.Parent;
887
+
888
+ type Metadata = BaseToken.Metadata;
889
+
890
+ export import SchemaField = BaseToken.SchemaField;
891
+ export import ConstructorData = BaseToken.ConstructorData;
892
+ export import UpdateData = BaseToken.UpdateData;
893
+ export import Properties = BaseToken.Properties;
894
+ export import Source = BaseToken.Source;
895
+
896
+ interface RENDER_FLAGS {
897
+ /** @defaultValue `{ propagate: ["refresh"] }` */
898
+ redraw: RenderFlag<this, "redraw">;
899
+
900
+ /** @defaultValue `{}` */
901
+ redrawEffects: RenderFlag<this, "redrawEffects">;
902
+
903
+ /** @defaultValue `{ propagate: ["refreshState", "refreshTransform", "refreshMesh", "refreshNameplate", "refreshElevation", "refreshRingVisuals"], alias: true }` */
904
+ refresh: RenderFlag<this, "refresh">;
905
+
906
+ /** @defaultValue `{ propagate: ["refreshVisibility", "refreshTarget"] }` */
907
+ refreshState: RenderFlag<this, "refreshState">;
908
+
909
+ /** @defaultValue `{}` */
910
+ refreshVisibility: RenderFlag<this, "refreshVisibility">;
911
+
912
+ /** @defaultValue `{ propagate: ["refreshPosition", "refreshRotation", "refreshSize"], alias: true }` */
913
+ refreshTransform: RenderFlag<this, "refreshTransform">;
914
+
915
+ /** @defaultValue `{}` */
916
+ refreshPosition: RenderFlag<this, "refreshPosition">;
917
+
918
+ /** @defaultValue `{}` */
919
+ refreshRotation: RenderFlag<this, "refreshRotation">;
920
+
921
+ /** @defaultValue `{ propagate: ["refreshPosition", "refreshShape", "refreshBars", "refreshEffects", "refreshNameplate", "refreshTarget", "refreshTooltip"] }` */
922
+ refreshSize: RenderFlag<this, "refreshSize">;
923
+
924
+ /** @defaultValue `{ propagate: ["refreshTooltip"] }` */
925
+ refreshElevation: RenderFlag<this, "refreshElevation">;
926
+
927
+ /** @defaultValue `{}` */
928
+ refreshMesh: RenderFlag<this, "refreshMesh">;
929
+
930
+ /** @defaultValue `{}` */
931
+ refreshShader: RenderFlag<this, "refreshShader">;
932
+
933
+ /** @defaultValue `{ propagate: ["refreshVisibility", "refreshPosition", "refreshBorder", "refreshEffects"] }` */
934
+ refreshShape: RenderFlag<this, "refreshShape">;
935
+
936
+ /** @defaultValue `{}` */
937
+ refreshBorder: RenderFlag<this, "refreshBorder">;
938
+
939
+ /** @defaultValue `{}` */
940
+ refreshBars: RenderFlag<this, "refreshBars">;
941
+
942
+ /** @defaultValue `{}` */
943
+ refreshEffects: RenderFlag<this, "refreshEffects">;
944
+
945
+ /** @defaultValue `{}` */
946
+ refreshNameplate: RenderFlag<this, "refreshNameplate">;
947
+
948
+ /** @defaultValue `{}` */
949
+ refreshTarget: RenderFlag<this, "refreshTarget">;
950
+
951
+ /** @defaultValue `{}` */
952
+ refreshTooltip: RenderFlag<this, "refreshTooltip">;
953
+
954
+ /** @defaultValue `{}` */
955
+ refreshRingVisuals: RenderFlag<this, "refreshRingVisuals">;
956
+ }
957
+
958
+ interface RenderFlags extends RenderFlagsMixin.ToBooleanFlags<RENDER_FLAGS> {}
959
+
960
+ interface Bars extends PIXI.Container {
961
+ bar1: PIXI.Graphics;
962
+ bar2: PIXI.Graphics;
963
+ }
964
+
965
+ /** @internal */
966
+ type _GetMovementAdjustedPointOffsets = NullishProps<{
967
+ /** @defaultValue `this.#priorMovement.ox` */
968
+ offsetX: number;
969
+
970
+ /** @defaultValue `this.#priorMovement.oy` */
971
+ offsetY: number;
972
+ }>;
973
+
974
+ interface GetMovementAdjustedPointOffsets extends _GetMovementAdjustedPointOffsets {}
975
+
976
+ interface DrawOptions extends PlaceableObject.DrawOptions {}
977
+
978
+ interface RefreshOptions extends PlaceableObject.RefreshOptions {}
979
+
980
+ /** @internal */
981
+ type _ControlOptions = NullishProps<{
982
+ /** @defaultValue `false` */
983
+ pan: boolean;
984
+ }>;
985
+
986
+ interface ControlOptions extends _ControlOptions, PlaceableObject.ControlOptions {}
987
+
988
+ interface ReleaseOptions extends PlaceableObject.ReleaseOptions {}
989
+
990
+ /**
991
+ * @remarks {@link Token._getLightSourceData | `Token#_getLightSourceData`} calls `mergeObject` on the return of
992
+ * {@link foundry.data.LightData.toObject | `LightData#toObject(false)`} and the enumerated properties below and
993
+ * returns the result. This gets passed to {@link foundry.canvas.sources.PointLightSource.initialize | `Token#light#initialize()`},
994
+ * so this is a `RequiredProps<IntentionalPartial<>>` rather than a `Pick<>`
995
+ */
996
+ type LightSourceData = foundry.data.fields.SchemaField.InitializedData<foundry.data.LightData.Schema> &
997
+ RequiredProps<
998
+ IntentionalPartial<foundry.canvas.sources.PointLightSource.SourceData>,
999
+ "x" | "y" | "elevation" | "rotation" | "dim" | "bright" | "externalRadius" | "seed" | "preview" | "disabled"
1000
+ >;
1001
+
1002
+ /**
1003
+ * @remarks The return of {@link Token._getVisionSourceData | `Token#_getVisionSourceData`}, which gets passed
1004
+ * to {@link foundry.canvas.sources.PointVisionSource.initialize | `Token#vision#initialize()`}, so this is a
1005
+ * `RequiredProps<IntentionalPartial<>>` rather than a `Pick<>`
1006
+ */
1007
+ type VisionSourceData = RequiredProps<
1008
+ IntentionalPartial<foundry.canvas.sources.PointVisionSource.SourceData>,
1009
+ | "x"
1010
+ | "y"
1011
+ | "elevation"
1012
+ | "rotation"
1013
+ | "lightRadius"
1014
+ | "externalRadius"
1015
+ | "angle"
1016
+ | "contrast"
1017
+ | "saturation"
1018
+ | "brightness"
1019
+ | "attenuation"
1020
+ | "visionMode"
1021
+ | "color"
1022
+ | "preview"
1023
+ | "disabled"
1024
+ >;
1025
+
1026
+ // TODO: (LukeAbby) possible candidate for `-=` key handling
1027
+ interface BlindedStates extends Record<string, boolean> {
1028
+ blind: boolean;
1029
+ burrow: boolean;
1030
+ }
1031
+
1032
+ /** @internal */
1033
+ type _ReticuleOptions = NullishProps<{
1034
+ /**
1035
+ * The amount of margin between the targeting arrows and the token's bounding box, expressed as a fraction of an arrow's size.
1036
+ * @defaultValue `0`
1037
+ * @remarks This gets assigned to with `*=` before use, so `null` casting to the default of `0` is fine
1038
+ */
1039
+ margin: number;
1040
+
1041
+ /**
1042
+ * The color of the arrows.
1043
+ * @defaultValue `this._getBorderColor()` {@link Token._getBorderColor | `Token#_getBorderColor`}
1044
+ */
1045
+ color: number;
1046
+ }> &
1047
+ InexactPartial<{
1048
+ /**
1049
+ * The alpha value of the arrows.
1050
+ * @defaultValue `1`
1051
+ * @remarks Can't be `null` as it only has a parameter default
1052
+ */
1053
+ alpha: number;
1054
+
1055
+ /**
1056
+ * The size of the arrows as a proportion of grid size.
1057
+ * @defaultValue `0.15`
1058
+ * @remarks Can't be `null` as it only has a parameter default
1059
+ */
1060
+ size: number;
1061
+
1062
+ /**
1063
+ * The arrows' border style configuration.
1064
+ * @defaultValue see properties
1065
+ * @remarks Can't be `null` as it's destructured in signature
1066
+ */
1067
+ border: InexactPartial<{
1068
+ /**
1069
+ * The border color.
1070
+ * @defaultValue `0`
1071
+ * @remarks Can't be `null` as it only has a parameter default
1072
+ */
1073
+ color: number;
1074
+
1075
+ /**
1076
+ * The border width.
1077
+ * @defaultValue `2`
1078
+ * @remarks Can't be `null` as it only has a parameter default
1079
+ */
1080
+ width: number;
1081
+ }>;
1082
+ }>;
1083
+ interface ReticuleOptions extends _ReticuleOptions {}
1084
+
1085
+ /**
1086
+ * The return type of {@link Token.getRingColors | `Token#getRingColors`}. Core's implementation returns `{}`.
1087
+ * Values returned by subclasses should not be nullish, as they are `mergeObject`'d into the default color values
1088
+ * from {@link TokenRing.ConfiguredClass | `TokenRing.ConfiguredClass`}
1089
+ */
1090
+ interface RingColors {
1091
+ ring?: Color;
1092
+ background?: Color;
1093
+ }
1094
+
1095
+ /** @internal */
1096
+ type _AnimationData = Pick<TokenDocument.Implementation, "x" | "y" | "width" | "height" | "rotation" | "alpha"> & {
1097
+ /** The texture data. */
1098
+ texture: Pick<
1099
+ TokenDocument.Implementation["texture"],
1100
+ "src" | "anchorX" | "anchorY" | "scaleX" | "scaleY" | "tint"
1101
+ >;
1102
+ } & {
1103
+ /** The ring data. */
1104
+ ring: {
1105
+ /** The ring subject data */
1106
+ subject: Pick<TokenDocument.Implementation["ring"]["subject"], "texture" | "scale">;
1107
+ };
1108
+ };
1109
+
1110
+ /**
1111
+ * Token animation data.
1112
+ * @privateRemarks Implementing this interface like this does lose the specific (simplified, really)
1113
+ * property descriptions of the `TokenAnimationData` typedef, but it gains the ones from the document
1114
+ * schema, and since the values returned by {@link Token._getAnimationData | `Token#_getAnimationData`}
1115
+ * are pulled directly from the document, this is also the most accurate typing.
1116
+ */
1117
+ interface AnimationData extends _AnimationData {}
1118
+
1119
+ type PartialAnimationData = DeepPartial<AnimationData>;
1120
+
1121
+ interface AnimationDataForDuration extends RequiredProps<PartialAnimationData, "x" | "y" | "rotation"> {}
1122
+
1123
+ interface AnimationDataForRotation extends RequiredProps<PartialAnimationData, "rotation"> {}
1124
+
1125
+ /** @internal */
1126
+ type _GetAnimationDurationOptions = InexactPartial<{
1127
+ /**
1128
+ * A desired token movement speed in grid spaces per second
1129
+ * @defaultValue `6`
1130
+ * @remarks Can't be `null` as it only has a parameter default
1131
+ */
1132
+ movementSpeed: number;
1133
+ }>;
1134
+
1135
+ interface GetAnimationDurationOptions extends _GetAnimationDurationOptions {}
1136
+
1137
+ /** @internal */
1138
+ type _PrepareAnimationOptions = NullishProps<{
1139
+ /**
1140
+ * The desired texture transition type
1141
+ * @defaultValue `TextureTransitionFilter.TYPES.FADE` (`"fade"`)
1142
+ */
1143
+ transition: TextureTransitionFilter.TYPES;
1144
+ }>;
1145
+
1146
+ interface PrepareAnimationOptions extends _PrepareAnimationOptions {}
1147
+
1148
+ /** @internal */
1149
+ type _AnimateOptions = Pick<CanvasAnimation.AnimateOptions, "duration" | "easing" | "name" | "ontick">;
1150
+
1151
+ interface AnimateOptions extends _AnimateOptions, GetAnimationDurationOptions, PrepareAnimationOptions {}
1152
+
1153
+ /** @internal */
1154
+ type _StopAnimationOptions = NullishProps<{
1155
+ /**
1156
+ * Reset the TokenDocument?
1157
+ * @defaultValue `false`
1158
+ */
1159
+ reset: boolean;
1160
+ }>;
1161
+
1162
+ interface StopAnimationOptions extends _StopAnimationOptions {}
1163
+
1164
+ /** @internal */
1165
+ type _CheckCollisionOptions<Mode extends PointSourcePolygon.CollisionModes | undefined = undefined> =
1166
+ InexactPartial<{
1167
+ /**
1168
+ * The collision mode to test: "any", "all", or "closest"
1169
+ * @defaultValue `"any"`
1170
+ * @remarks Can't be `null` as it only has a parameter default
1171
+ */
1172
+ mode: Mode;
1173
+
1174
+ /**
1175
+ * The collision type
1176
+ * @defaultValue `"move"`
1177
+ * @remarks Can't be `null` as it only has a parameter default
1178
+ *
1179
+ * `"sound"` is a valid source type but explicitly throws if passed, so omitted here
1180
+ */
1181
+ type: "move" | "sight" | "light";
1182
+ }> &
1183
+ NullishProps<{
1184
+ /**
1185
+ * The origin to be used instead of the current origin
1186
+ */
1187
+ origin: Canvas.Point;
1188
+ }>;
1189
+
1190
+ interface CheckCollisionOptions<Mode extends PointSourcePolygon.CollisionModes | undefined = undefined>
1191
+ extends _CheckCollisionOptions<Mode> {}
1192
+
1193
+ /** Return type of {@link Token.getSize | `Token#getSize`} */
1194
+ interface Size {
1195
+ width: number;
1196
+ height: number;
1197
+ }
1198
+
1199
+ /**
1200
+ * @privateRemarks Foundry types this as `Point | (Point & {elevation: number}) | {elevation: number}`,
1201
+ * but this is misleading, as if an object is passed for the 2nd param of {@link Token.testInsideRegion | `Token#testInsideRegion`}
1202
+ * then it must contain `{x, y}` data, only if the value is nullish does the document's data get used.
1203
+ * Passing just `{elevation: number}` would result in `{x: undefined, y: undefined}`, causing
1204
+ * `PIXI.Rectangle#contains()` to always return false.
1205
+ *
1206
+ * Not reported, as `testInsideRegion` is deprecated and thus untyped in v13.
1207
+ */
1208
+ type TestablePosition = Canvas.Point & { elevation?: number };
1209
+
1210
+ type _InitializeSourcesOptions = NullishProps<{
1211
+ /**
1212
+ * Indicate that this source has been deleted.
1213
+ * @defaultValue `false`
1214
+ */
1215
+ deleted: boolean;
1216
+ }>;
1217
+
1218
+ interface InitializeSourcesOptions extends _InitializeSourcesOptions {}
1219
+
1220
+ /** @internal */
1221
+ type _TargetContext = NullishProps<{
1222
+ /**
1223
+ * Assign the token as a target for a specific User
1224
+ * @defaultValue `game.user`
1225
+ * @remarks `null` is the parameter default, but it's `||=`d with `game.user`
1226
+ */
1227
+ user: User.Implementation;
1228
+
1229
+ /**
1230
+ * Release other active targets for the same player?
1231
+ * @defaultValue `true`
1232
+ */
1233
+ releaseOthers: boolean;
1234
+
1235
+ /**
1236
+ * Is this target being set as part of a group selection workflow?
1237
+ * @defaultValue `false`
1238
+ */
1239
+ groupSelection: boolean;
1240
+ }>;
1241
+
1242
+ interface TargetContext extends _TargetContext {}
1243
+
1244
+ interface AnimationContext {
1245
+ /** The name of the animation */
1246
+ name: PropertyKey;
1247
+
1248
+ /**
1249
+ * The final animation state
1250
+ * @remarks This gets `mergeObject`ed with the return of {@link Token._getAnimationData | `Token#_getAnimationData`}
1251
+ */
1252
+ to: PartialAnimationData;
1253
+
1254
+ /** The duration of the animation */
1255
+ duration: number;
1256
+
1257
+ /** The current time of the animation */
1258
+ time: number;
1259
+
1260
+ /** Asynchronous functions that are executed before the animation starts */
1261
+ preAnimate: ((context: Token.AnimationContext) => Promise<void>)[];
1262
+
1263
+ /** Synchronous functions that are executed after the animation ended */
1264
+ postAnimate: ((context: Token.AnimationContext) => void)[];
1265
+
1266
+ /** Synchronous functions that are executed each frame after `ontick` and before {@link Token._onAnimationUpdate | `Token#_onAnimationUpdate`} */
1267
+ onAnimate: ((context: Token.AnimationContext) => void)[];
1268
+
1269
+ /**
1270
+ * The promise of the animation, which resolves to true if the animation
1271
+ * completed, to false if it was terminated, and rejects if an error occurred.
1272
+ * Undefined in the first frame (at time 0) of the animation.
1273
+ */
1274
+ promise?: Promise<boolean> | undefined;
1275
+ }
1276
+
1277
+ interface DragLeftDropUpdate {
1278
+ _id: string;
1279
+ x: number;
1280
+ y: number;
1281
+ }
1282
+
1283
+ /** @internal */
1284
+ type _RefreshHUDOptions = NullishProps<{
1285
+ bars: boolean;
1286
+ border: boolean;
1287
+ elevation: boolean;
1288
+ nameplate: boolean;
1289
+ effects: boolean;
1290
+ }>;
1291
+ interface RefreshHUDOptions extends _RefreshHUDOptions {}
1292
+ }
950
1293
  }