@league-of-foundry-developers/foundry-vtt-types 12.331.3-beta → 12.331.5

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 (559) hide show
  1. package/README.md +17 -18
  2. package/package.json +91 -32
  3. package/src/configuration/configuration.d.mts +316 -0
  4. package/src/configuration/documents.d.mts +295 -0
  5. package/src/configuration/globals.d.mts +357 -0
  6. package/src/configuration/index.d.mts +5 -0
  7. package/src/foundry/client/apps/app.d.mts +129 -122
  8. package/src/foundry/client/apps/av/av-config.d.mts +12 -7
  9. package/src/foundry/client/apps/av/cameras.d.mts +12 -7
  10. package/src/foundry/client/apps/dice/dice-config.d.mts +59 -0
  11. package/src/foundry/client/apps/dice/index.d.mts +1 -0
  12. package/src/foundry/client/apps/form.d.mts +114 -86
  13. package/src/foundry/client/apps/forms/actor.d.mts +21 -11
  14. package/src/foundry/client/apps/forms/adventure-exporter.d.mts +12 -7
  15. package/src/foundry/client/apps/forms/adventure-importer.d.mts +14 -6
  16. package/src/foundry/client/apps/forms/base-sheet.d.mts +16 -8
  17. package/src/foundry/client/apps/forms/card-config.d.mts +16 -8
  18. package/src/foundry/client/apps/forms/cards-config.d.mts +15 -14
  19. package/src/foundry/client/apps/forms/combat-config.d.mts +7 -7
  20. package/src/foundry/client/apps/forms/combatant-config.d.mts +3 -3
  21. package/src/foundry/client/apps/forms/default-sheets-config.d.mts +1 -1
  22. package/src/foundry/client/apps/forms/effect-config.d.mts +7 -7
  23. package/src/foundry/client/apps/forms/folder-config.d.mts +10 -5
  24. package/src/foundry/client/apps/forms/fonts.d.mts +42 -35
  25. package/src/foundry/client/apps/forms/grid-config.d.mts +12 -13
  26. package/src/foundry/client/apps/forms/image-popout.d.mts +29 -23
  27. package/src/foundry/client/apps/forms/item.d.mts +9 -9
  28. package/src/foundry/client/apps/forms/journal-page-sheet.d.mts +16 -14
  29. package/src/foundry/client/apps/forms/journal-sheet.d.mts +48 -38
  30. package/src/foundry/client/apps/forms/macro-config.d.mts +7 -7
  31. package/src/foundry/client/apps/forms/measure-template.d.mts +10 -12
  32. package/src/foundry/client/apps/forms/ownership.d.mts +5 -5
  33. package/src/foundry/client/apps/forms/playlist-config.d.mts +8 -10
  34. package/src/foundry/client/apps/forms/playlist-sound-config.d.mts +7 -7
  35. package/src/foundry/client/apps/forms/roll-table-config.d.mts +11 -10
  36. package/src/foundry/client/apps/forms/scene-config.d.mts +40 -41
  37. package/src/foundry/client/apps/forms/sheet-config.d.mts +9 -21
  38. package/src/foundry/client/apps/forms/user-config.d.mts +13 -12
  39. package/src/foundry/client/apps/hud/chatbubble.d.mts +18 -6
  40. package/src/foundry/client/apps/hud/container.d.mts +4 -4
  41. package/src/foundry/client/apps/hud/controls.d.mts +126 -81
  42. package/src/foundry/client/apps/hud/hotbar.d.mts +17 -12
  43. package/src/foundry/client/apps/hud/hud.d.mts +5 -5
  44. package/src/foundry/client/apps/hud/menu.d.mts +10 -3
  45. package/src/foundry/client/apps/hud/navigation.d.mts +14 -9
  46. package/src/foundry/client/apps/hud/pause.d.mts +9 -4
  47. package/src/foundry/client/apps/hud/players.d.mts +14 -9
  48. package/src/foundry/client/apps/i18n.d.mts +31 -27
  49. package/src/foundry/client/apps/index.d.mts +1 -0
  50. package/src/foundry/client/apps/placeables/drawing-config.d.mts +41 -33
  51. package/src/foundry/client/apps/placeables/drawing-hud.d.mts +5 -5
  52. package/src/foundry/client/apps/placeables/index.d.mts +0 -2
  53. package/src/foundry/client/apps/placeables/note-config.d.mts +28 -18
  54. package/src/foundry/client/apps/placeables/tile-config.d.mts +23 -10
  55. package/src/foundry/client/apps/placeables/tile-hud.d.mts +10 -5
  56. package/src/foundry/client/apps/placeables/token-config.d.mts +91 -58
  57. package/src/foundry/client/apps/placeables/token-hud.d.mts +12 -7
  58. package/src/foundry/client/apps/placeables/wall-config.d.mts +21 -17
  59. package/src/foundry/client/apps/sidebar/apps/chat-popout.d.mts +5 -5
  60. package/src/foundry/client/apps/sidebar/apps/client-settings.d.mts +3 -3
  61. package/src/foundry/client/apps/sidebar/apps/compendium.d.mts +15 -13
  62. package/src/foundry/client/apps/sidebar/apps/invitation-links.d.mts +3 -3
  63. package/src/foundry/client/apps/sidebar/apps/keybindings-config.d.mts +3 -2
  64. package/src/foundry/client/apps/sidebar/apps/module-management.d.mts +6 -6
  65. package/src/foundry/client/apps/sidebar/apps/permission-config.d.mts +6 -6
  66. package/src/foundry/client/apps/sidebar/apps/support-details.d.mts +34 -29
  67. package/src/foundry/client/apps/sidebar/apps/tours-management.d.mts +2 -2
  68. package/src/foundry/client/apps/sidebar/apps/world-config.d.mts +13 -10
  69. package/src/foundry/client/apps/sidebar/directory-tab-mixin.d.mts +50 -35
  70. package/src/foundry/client/apps/sidebar/document-directory.d.mts +52 -38
  71. package/src/foundry/client/apps/sidebar/package-configuration.d.mts +4 -4
  72. package/src/foundry/client/apps/sidebar/sidebar-tab.d.mts +3 -3
  73. package/src/foundry/client/apps/sidebar/sidebar.d.mts +9 -4
  74. package/src/foundry/client/apps/sidebar/tabs/actors-directory.d.mts +11 -2
  75. package/src/foundry/client/apps/sidebar/tabs/cards-directory.d.mts +11 -2
  76. package/src/foundry/client/apps/sidebar/tabs/chat-log.d.mts +39 -27
  77. package/src/foundry/client/apps/sidebar/tabs/combat-tracker.d.mts +21 -12
  78. package/src/foundry/client/apps/sidebar/tabs/compendium-directory.d.mts +30 -15
  79. package/src/foundry/client/apps/sidebar/tabs/items-directory.d.mts +11 -2
  80. package/src/foundry/client/apps/sidebar/tabs/journal-directory.d.mts +11 -2
  81. package/src/foundry/client/apps/sidebar/tabs/macros-directory.d.mts +14 -5
  82. package/src/foundry/client/apps/sidebar/tabs/playlists-directory.d.mts +30 -22
  83. package/src/foundry/client/apps/sidebar/tabs/roll-table-directory.d.mts +11 -2
  84. package/src/foundry/client/apps/sidebar/tabs/scenes-directory.d.mts +14 -5
  85. package/src/foundry/client/apps/sidebar/tabs/settings.d.mts +23 -5
  86. package/src/foundry/client/apps/templates.d.mts +1 -1
  87. package/src/foundry/client/av/client.d.mts +1 -1
  88. package/src/foundry/client/av/clients/simplepeer.d.mts +11 -1
  89. package/src/foundry/client/av/master.d.mts +2 -2
  90. package/src/foundry/client/av/settings.d.mts +17 -15
  91. package/src/foundry/client/config.d.mts +444 -312
  92. package/src/foundry/client/core/document-index.d.mts +11 -3
  93. package/src/foundry/client/core/hooks.d.mts +2 -4
  94. package/src/foundry/client/core/image.d.mts +14 -13
  95. package/src/foundry/client/core/issues.d.mts +9 -4
  96. package/src/foundry/client/core/keybindings.d.mts +5 -5
  97. package/src/foundry/client/core/nue.d.mts +1 -1
  98. package/src/foundry/client/core/packages.d.mts +400 -62
  99. package/src/foundry/client/core/settings.d.mts +62 -38
  100. package/src/foundry/client/core/socket.d.mts +2 -2
  101. package/src/foundry/client/core/sorting.d.mts +6 -6
  102. package/src/foundry/client/core/time.d.mts +6 -3
  103. package/src/foundry/client/core/tooltip.d.mts +2 -2
  104. package/src/foundry/client/core/tour.d.mts +59 -50
  105. package/src/foundry/client/core/tours.d.mts +1 -1
  106. package/src/foundry/client/core/utils.d.mts +33 -10
  107. package/src/foundry/client/core/video.d.mts +1 -1
  108. package/src/foundry/client/core/workers.d.mts +24 -17
  109. package/src/foundry/client/data/abstract/canvas-document.d.mts +22 -28
  110. package/src/foundry/client/data/abstract/client-document.d.mts +238 -206
  111. package/src/foundry/client/data/abstract/directory-collection-mixin.d.mts +24 -40
  112. package/src/foundry/client/data/abstract/document-collection.d.mts +96 -68
  113. package/src/foundry/client/data/abstract/world-collection.d.mts +53 -54
  114. package/src/foundry/client/data/collections/actors.d.mts +30 -28
  115. package/src/foundry/client/data/collections/cards.d.mts +16 -3
  116. package/src/foundry/client/data/collections/combats.d.mts +18 -5
  117. package/src/foundry/client/data/collections/compendium-collection.d.mts +84 -101
  118. package/src/foundry/client/data/collections/compendium-folders.d.mts +6 -6
  119. package/src/foundry/client/data/collections/compendium-packs.d.mts +5 -5
  120. package/src/foundry/client/data/collections/fog.d.mts +16 -3
  121. package/src/foundry/client/data/collections/folder.d.mts +20 -6
  122. package/src/foundry/client/data/collections/items.d.mts +17 -4
  123. package/src/foundry/client/data/collections/journal.d.mts +22 -7
  124. package/src/foundry/client/data/collections/macros.d.mts +21 -19
  125. package/src/foundry/client/data/collections/messages.d.mts +19 -6
  126. package/src/foundry/client/data/collections/playlists.d.mts +17 -5
  127. package/src/foundry/client/data/collections/scenes.d.mts +24 -27
  128. package/src/foundry/client/data/collections/settings.d.mts +16 -3
  129. package/src/foundry/client/data/collections/tables.d.mts +18 -5
  130. package/src/foundry/client/data/collections/users.d.mts +22 -10
  131. package/src/foundry/client/data/documents/active-effect.d.mts +780 -112
  132. package/src/foundry/client/data/documents/actor-delta.d.mts +705 -31
  133. package/src/foundry/client/data/documents/actor.d.mts +806 -98
  134. package/src/foundry/client/data/documents/adventure.d.mts +522 -59
  135. package/src/foundry/client/data/documents/ambient-light.d.mts +427 -20
  136. package/src/foundry/client/data/documents/ambient-sound.d.mts +478 -14
  137. package/src/foundry/client/data/documents/card.d.mts +598 -44
  138. package/src/foundry/client/data/documents/cards.d.mts +862 -169
  139. package/src/foundry/client/data/documents/chat-message.d.mts +668 -77
  140. package/src/foundry/client/data/documents/combat.d.mts +757 -107
  141. package/src/foundry/client/data/documents/combatant.d.mts +545 -32
  142. package/src/foundry/client/data/documents/drawing.d.mts +545 -14
  143. package/src/foundry/client/data/documents/fog-exploration.d.mts +465 -30
  144. package/src/foundry/client/data/documents/folder.d.mts +567 -51
  145. package/src/foundry/client/data/documents/index.d.mts +2 -0
  146. package/src/foundry/client/data/documents/item.d.mts +691 -24
  147. package/src/foundry/client/data/documents/journal-entry-page.d.mts +654 -55
  148. package/src/foundry/client/data/documents/journal-entry.d.mts +631 -35
  149. package/src/foundry/client/data/documents/macro.d.mts +560 -31
  150. package/src/foundry/client/data/documents/measured-template.d.mts +484 -15
  151. package/src/foundry/client/data/documents/note.d.mts +498 -15
  152. package/src/foundry/client/data/documents/playlist-sound.d.mts +443 -45
  153. package/src/foundry/client/data/documents/playlist.d.mts +710 -99
  154. package/src/foundry/client/data/documents/region-behavior.d.mts +516 -0
  155. package/src/foundry/client/data/documents/region.d.mts +789 -0
  156. package/src/foundry/client/data/documents/scene.d.mts +1216 -159
  157. package/src/foundry/client/data/documents/setting.d.mts +406 -23
  158. package/src/foundry/client/data/documents/table-result.d.mts +488 -14
  159. package/src/foundry/client/data/documents/table.d.mts +667 -78
  160. package/src/foundry/client/data/documents/tile.d.mts +505 -14
  161. package/src/foundry/client/data/documents/token.d.mts +1191 -143
  162. package/src/foundry/client/data/documents/user.d.mts +613 -57
  163. package/src/foundry/client/data/documents/wall.d.mts +555 -14
  164. package/src/foundry/client/game.d.mts +60 -92
  165. package/src/foundry/client/head.d.mts +9 -9
  166. package/src/foundry/client/hooks.d.mts +259 -248
  167. package/src/foundry/client/pixi/board.d.mts +107 -94
  168. package/src/foundry/client/pixi/core/containers/base-canvas-group.d.mts +97 -25
  169. package/src/foundry/client/pixi/core/containers/cached-container.d.mts +37 -19
  170. package/src/foundry/client/pixi/core/containers/full-canvas-container.d.mts +7 -10
  171. package/src/foundry/client/pixi/core/containers/point-source-mesh.d.mts +25 -15
  172. package/src/foundry/client/pixi/core/containers/quad-mesh.d.mts +16 -6
  173. package/src/foundry/client/pixi/core/containers/quadtree.d.mts +113 -54
  174. package/src/foundry/client/pixi/core/containers/sprite-mesh.d.mts +69 -26
  175. package/src/foundry/client/pixi/core/containers/unbound-container.d.mts +20 -2
  176. package/src/foundry/client/pixi/core/interaction/canvas-animation.d.mts +164 -99
  177. package/src/foundry/client/pixi/core/interaction/control-icon.d.mts +61 -22
  178. package/src/foundry/client/pixi/core/interaction/mouse-handler.d.mts +120 -53
  179. package/src/foundry/client/pixi/core/interaction/ping.d.mts +62 -31
  180. package/src/foundry/client/pixi/core/interaction/pings/chevron.d.mts +23 -10
  181. package/src/foundry/client/pixi/core/interaction/pings/pulse.d.mts +91 -34
  182. package/src/foundry/client/pixi/core/interaction/render-flags.d.mts +69 -30
  183. package/src/foundry/client/pixi/core/interaction/resize-handle.d.mts +35 -5
  184. package/src/foundry/client/pixi/core/interaction/targets.d.mts +21 -18
  185. package/src/foundry/client/pixi/core/loader.d.mts +86 -76
  186. package/src/foundry/client/pixi/core/shapes/limited-angle-polygon.d.mts +42 -17
  187. package/src/foundry/client/pixi/core/shapes/polygon-mesher.d.mts +92 -64
  188. package/src/foundry/client/pixi/core/shapes/precise-text.d.mts +28 -10
  189. package/src/foundry/client/pixi/core/shapes/ray.d.mts +47 -23
  190. package/src/foundry/client/pixi/core/shapes/source-polygon.d.mts +170 -75
  191. package/src/foundry/client/pixi/extensions/circle.d.mts +128 -125
  192. package/src/foundry/client/pixi/extensions/graphics.d.mts +3 -1
  193. package/src/foundry/client/pixi/extensions/observable-transform.d.mts +5 -4
  194. package/src/foundry/client/pixi/extensions/polygon.d.mts +154 -134
  195. package/src/foundry/client/pixi/extensions/rectangle.d.mts +242 -259
  196. package/src/foundry/client/pixi/groups/effects.d.mts +75 -24
  197. package/src/foundry/client/pixi/groups/environment.d.mts +68 -19
  198. package/src/foundry/client/pixi/groups/hidden.d.mts +27 -11
  199. package/src/foundry/client/pixi/groups/interface.d.mts +62 -38
  200. package/src/foundry/client/pixi/groups/overlay.d.mts +19 -7
  201. package/src/foundry/client/pixi/groups/primary.d.mts +66 -44
  202. package/src/foundry/client/pixi/groups/rendered.d.mts +19 -7
  203. package/src/foundry/client/pixi/layers/base/canvas-layer.d.mts +11 -15
  204. package/src/foundry/client/pixi/layers/base/interaction-layer.d.mts +29 -28
  205. package/src/foundry/client/pixi/layers/base/placeables-layer.d.mts +306 -272
  206. package/src/foundry/client/pixi/layers/controls/cursor.d.mts +18 -9
  207. package/src/foundry/client/pixi/layers/controls/door.d.mts +32 -11
  208. package/src/foundry/client/pixi/layers/controls/layer.d.mts +89 -77
  209. package/src/foundry/client/pixi/layers/controls/ruler.d.mts +121 -96
  210. package/src/foundry/client/pixi/layers/effects/background-effects.d.mts +9 -12
  211. package/src/foundry/client/pixi/layers/effects/coloration-effects.d.mts +9 -10
  212. package/src/foundry/client/pixi/layers/effects/darkness-effects.d.mts +8 -8
  213. package/src/foundry/client/pixi/layers/effects/illumination-effects.d.mts +22 -22
  214. package/src/foundry/client/pixi/layers/effects/visibility.d.mts +106 -86
  215. package/src/foundry/client/pixi/layers/effects/weather/particles/effect.d.mts +14 -5
  216. package/src/foundry/client/pixi/layers/effects/weather/particles/leaves.d.mts +31 -2
  217. package/src/foundry/client/pixi/layers/effects/weather-effects.d.mts +137 -65
  218. package/src/foundry/client/pixi/layers/grid/highlight.d.mts +14 -4
  219. package/src/foundry/client/pixi/layers/grid/layer.d.mts +92 -92
  220. package/src/foundry/client/pixi/layers/grid/mesh.d.mts +37 -16
  221. package/src/foundry/client/pixi/layers/masks/depth.d.mts +12 -7
  222. package/src/foundry/client/pixi/layers/masks/occlusion.d.mts +19 -12
  223. package/src/foundry/client/pixi/layers/masks/vision.d.mts +104 -18
  224. package/src/foundry/client/pixi/layers/placeables/drawings.d.mts +16 -15
  225. package/src/foundry/client/pixi/layers/placeables/index.d.mts +1 -0
  226. package/src/foundry/client/pixi/layers/placeables/lighting.d.mts +12 -14
  227. package/src/foundry/client/pixi/layers/placeables/notes.d.mts +49 -32
  228. package/src/foundry/client/pixi/layers/placeables/regions.d.mts +113 -0
  229. package/src/foundry/client/pixi/layers/placeables/sounds.d.mts +81 -67
  230. package/src/foundry/client/pixi/layers/placeables/templates.d.mts +11 -15
  231. package/src/foundry/client/pixi/layers/placeables/tiles.d.mts +30 -21
  232. package/src/foundry/client/pixi/layers/placeables/tokens.d.mts +66 -52
  233. package/src/foundry/client/pixi/layers/placeables/walls.d.mts +54 -57
  234. package/src/foundry/client/pixi/perception/clockwise-sweep.d.mts +62 -27
  235. package/src/foundry/client/pixi/perception/detection-mode.d.mts +121 -47
  236. package/src/foundry/client/pixi/perception/fog.d.mts +38 -15
  237. package/src/foundry/client/pixi/perception/perception-manager.d.mts +136 -136
  238. package/src/foundry/client/pixi/perception/vision-mode.d.mts +91 -64
  239. package/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.mts +44 -16
  240. package/src/foundry/client/pixi/placeable.d.mts +239 -137
  241. package/src/foundry/client/pixi/placeables/drawing.d.mts +255 -133
  242. package/src/foundry/client/pixi/placeables/index.d.mts +1 -0
  243. package/src/foundry/client/pixi/placeables/light.d.mts +193 -64
  244. package/src/foundry/client/pixi/placeables/note.d.mts +145 -54
  245. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.d.mts +30 -8
  246. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.d.mts +41 -11
  247. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.d.mts +59 -18
  248. package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.d.mts +120 -37
  249. package/src/foundry/client/pixi/placeables/region.d.mts +280 -0
  250. package/src/foundry/client/pixi/placeables/sound.d.mts +205 -66
  251. package/src/foundry/client/pixi/placeables/template.d.mts +181 -100
  252. package/src/foundry/client/pixi/placeables/tile.d.mts +206 -140
  253. package/src/foundry/client/pixi/placeables/token.d.mts +916 -449
  254. package/src/foundry/client/pixi/placeables/wall.d.mts +249 -129
  255. package/src/foundry/client/pixi/webgl/extensions/batch-renderer.d.mts +72 -33
  256. package/src/foundry/client/pixi/webgl/extensions/batch-shader-generator.d.mts +10 -9
  257. package/src/foundry/client/pixi/webgl/helpers/{framebugger-snapshot.d.mts → framebuffer-snapshot.d.mts} +10 -9
  258. package/src/foundry/client/pixi/webgl/helpers/index.d.mts +1 -1
  259. package/src/foundry/client/pixi/webgl/helpers/smooth-noise.d.mts +38 -23
  260. package/src/foundry/client/pixi/webgl/helpers/texture-extractor.d.mts +82 -53
  261. package/src/foundry/client/pixi/webgl/shaders/base-shader-mixin.d.mts +12 -12
  262. package/src/foundry/client/pixi/webgl/shaders/base-shader.d.mts +45 -28
  263. package/src/foundry/client/pixi/webgl/shaders/filters/base-filter.d.mts +12 -11
  264. package/src/foundry/client/pixi/webgl/shaders/filters/base-mask-filter.d.mts +12 -10
  265. package/src/foundry/client/pixi/webgl/shaders/filters/blur.d.mts +22 -20
  266. package/src/foundry/client/pixi/webgl/shaders/filters/effects-masking.d.mts +36 -32
  267. package/src/foundry/client/pixi/webgl/shaders/filters/environment.d.mts +10 -9
  268. package/src/foundry/client/pixi/webgl/shaders/filters/glow-overlay.d.mts +12 -11
  269. package/src/foundry/client/pixi/webgl/shaders/filters/invisibility.d.mts +10 -9
  270. package/src/foundry/client/pixi/webgl/shaders/filters/outline-overlay.d.mts +12 -11
  271. package/src/foundry/client/pixi/webgl/shaders/filters/transition.d.mts +67 -60
  272. package/src/foundry/client/pixi/webgl/shaders/filters/visibility.d.mts +24 -17
  273. package/src/foundry/client/pixi/webgl/shaders/filters/vision-mask-filter.d.mts +13 -10
  274. package/src/foundry/client/pixi/webgl/shaders/filters/void.d.mts +10 -9
  275. package/src/foundry/client/pixi/webgl/shaders/filters/weather-occlusion-masks.d.mts +11 -10
  276. package/src/foundry/client/pixi/webgl/shaders/fragment-channel-mixin.d.mts +20 -14
  277. package/src/foundry/client/pixi/webgl/shaders/grid/grid.d.mts +12 -11
  278. package/src/foundry/client/pixi/webgl/shaders/lighting/background-lighting.d.mts +10 -9
  279. package/src/foundry/client/pixi/webgl/shaders/lighting/base-lighting.d.mts +33 -33
  280. package/src/foundry/client/pixi/webgl/shaders/lighting/coloration-lighting.d.mts +10 -9
  281. package/src/foundry/client/pixi/webgl/shaders/lighting/darkness-lighting.d.mts +10 -9
  282. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/bewitching-wave.d.mts +19 -17
  283. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/black-hole.d.mts +10 -9
  284. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/chroma.d.mts +10 -9
  285. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/emanation.d.mts +10 -9
  286. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/energy-field.d.mts +10 -9
  287. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fairy-light.d.mts +19 -17
  288. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/flame.d.mts +19 -17
  289. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fog.d.mts +10 -9
  290. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/force-grid.d.mts +10 -8
  291. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/ghost-light.d.mts +19 -17
  292. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/hexa-dome.d.mts +10 -9
  293. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/light-dome.d.mts +10 -9
  294. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/magical-gloom.d.mts +10 -9
  295. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/pulse.d.mts +19 -17
  296. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/radial-rainbow.d.mts +10 -9
  297. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/revolving-light.d.mts +10 -9
  298. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/roiling-mass.d.mts +10 -9
  299. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/siren-light.d.mts +19 -17
  300. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/smoke-patch.d.mts +20 -17
  301. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/star-light.d.mts +10 -9
  302. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/sunburst.d.mts +19 -17
  303. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/swirling-rainbow.d.mts +10 -9
  304. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/torch.d.mts +19 -17
  305. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/vortex.d.mts +19 -17
  306. package/src/foundry/client/pixi/webgl/shaders/lighting/effects/wave.d.mts +19 -17
  307. package/src/foundry/client/pixi/webgl/shaders/lighting/illumination-lighting.d.mts +10 -9
  308. package/src/foundry/client/pixi/webgl/shaders/region/adjust-darkness-level.d.mts +71 -29
  309. package/src/foundry/client/pixi/webgl/shaders/region/base.d.mts +54 -10
  310. package/src/foundry/client/pixi/webgl/shaders/region/highlight.d.mts +69 -9
  311. package/src/foundry/client/pixi/webgl/shaders/samplers/base-sampler.d.mts +24 -25
  312. package/src/foundry/client/pixi/webgl/shaders/samplers/baseline-illumination.d.mts +10 -9
  313. package/src/foundry/client/pixi/webgl/shaders/samplers/color-adjustment.d.mts +38 -29
  314. package/src/foundry/client/pixi/webgl/shaders/samplers/depth.d.mts +21 -17
  315. package/src/foundry/client/pixi/webgl/shaders/samplers/fog-of-war.d.mts +10 -9
  316. package/src/foundry/client/pixi/webgl/shaders/samplers/occlusion.d.mts +20 -18
  317. package/src/foundry/client/pixi/webgl/shaders/samplers/primary.d.mts +11 -2
  318. package/src/foundry/client/pixi/webgl/shaders/samplers/token-ring.d.mts +28 -2
  319. package/src/foundry/client/pixi/webgl/shaders/vision/background-vision.d.mts +10 -9
  320. package/src/foundry/client/pixi/webgl/shaders/vision/base-vision.d.mts +11 -9
  321. package/src/foundry/client/pixi/webgl/shaders/vision/coloration-vision.d.mts +10 -9
  322. package/src/foundry/client/pixi/webgl/shaders/vision/effects/amplification.d.mts +10 -9
  323. package/src/foundry/client/pixi/webgl/shaders/vision/effects/wave.d.mts +19 -17
  324. package/src/foundry/client/pixi/webgl/shaders/vision/illumination-vision.d.mts +10 -9
  325. package/src/foundry/client/pixi/webgl/shaders/weather/base-weather.d.mts +40 -36
  326. package/src/foundry/client/pixi/webgl/shaders/weather/effect.d.mts +27 -33
  327. package/src/foundry/client/pixi/webgl/shaders/weather/fog.d.mts +17 -16
  328. package/src/foundry/client/pixi/webgl/shaders/weather/rain.d.mts +19 -18
  329. package/src/foundry/client/pixi/webgl/shaders/weather/snow.d.mts +15 -14
  330. package/src/foundry/client/pixi/workers/texture-worker.d.mts +33 -53
  331. package/src/foundry/client/tours/setup-tour.d.mts +15 -10
  332. package/src/foundry/client/ui/context.d.mts +48 -40
  333. package/src/foundry/client/ui/dialog.d.mts +137 -126
  334. package/src/foundry/client/ui/drag.d.mts +1 -1
  335. package/src/foundry/client/ui/dragdrop.d.mts +34 -28
  336. package/src/foundry/client/ui/editor.d.mts +29 -21
  337. package/src/foundry/client/ui/filepicker.d.mts +43 -38
  338. package/src/foundry/client/ui/filter.d.mts +62 -50
  339. package/src/foundry/client/ui/forms.d.mts +22 -22
  340. package/src/foundry/client/ui/notifications.d.mts +10 -3
  341. package/src/foundry/client/ui/prosemirror.d.mts +15 -7
  342. package/src/foundry/client/ui/secrets.d.mts +42 -27
  343. package/src/foundry/client/ui/tabs.d.mts +40 -33
  344. package/src/foundry/client-esm/applications/_module.d.mts +3 -3
  345. package/src/foundry/client-esm/applications/_types.d.mts +0 -2
  346. package/src/foundry/client-esm/applications/api/_module.d.mts +2 -2
  347. package/src/foundry/client-esm/applications/api/application.d.mts +28 -19
  348. package/src/foundry/client-esm/applications/api/dialog.d.mts +20 -22
  349. package/src/foundry/client-esm/applications/api/document-sheet.d.mts +26 -12
  350. package/src/foundry/client-esm/applications/api/handlebars-application.d.mts +142 -126
  351. package/src/foundry/client-esm/applications/apps/_module.d.mts +2 -2
  352. package/src/foundry/client-esm/applications/apps/compendium-art-config.d.mts +10 -10
  353. package/src/foundry/client-esm/applications/apps/permission-config.d.mts +3 -3
  354. package/src/foundry/client-esm/applications/dice/_module.d.mts +2 -2
  355. package/src/foundry/client-esm/applications/dice/roll-resolver.d.mts +14 -2
  356. package/src/foundry/client-esm/applications/elements/_module.d.mts +2 -2
  357. package/src/foundry/client-esm/applications/elements/document-tags.d.mts +2 -0
  358. package/src/foundry/client-esm/applications/elements/file-picker.d.mts +1 -1
  359. package/src/foundry/client-esm/applications/elements/multi-select.d.mts +15 -5
  360. package/src/foundry/client-esm/applications/elements/string-tags.d.mts +1 -1
  361. package/src/foundry/client-esm/applications/forms/fields.d.mts +1 -1
  362. package/src/foundry/client-esm/applications/sheets/_module.d.mts +2 -2
  363. package/src/foundry/client-esm/applications/sheets/actor-sheet.d.mts +3 -3
  364. package/src/foundry/client-esm/applications/sheets/ambient-light-config.d.mts +10 -8
  365. package/src/foundry/client-esm/applications/sheets/ambient-sound-config.d.mts +9 -7
  366. package/src/foundry/client-esm/applications/sheets/item-sheet.d.mts +3 -3
  367. package/src/foundry/client-esm/applications/sheets/region-behavior-config.d.mts +30 -5
  368. package/src/foundry/client-esm/applications/sheets/region-config.d.mts +36 -5
  369. package/src/foundry/client-esm/applications/sheets/user-config.d.mts +8 -7
  370. package/src/foundry/client-esm/applications/ui/_module.d.mts +2 -2
  371. package/src/foundry/client-esm/applications/ui/region-legend.d.mts +45 -3
  372. package/src/foundry/client-esm/audio/_module.d.mts +2 -3
  373. package/src/foundry/client-esm/audio/_types.d.mts +2 -0
  374. package/src/foundry/client-esm/audio/biquad.d.mts +76 -26
  375. package/src/foundry/client-esm/audio/cache.d.mts +31 -20
  376. package/src/foundry/client-esm/audio/convolver.d.mts +47 -25
  377. package/src/foundry/client-esm/audio/helper.d.mts +124 -80
  378. package/src/foundry/client-esm/audio/sound.d.mts +230 -126
  379. package/src/foundry/client-esm/audio/timeout.d.mts +28 -12
  380. package/src/foundry/client-esm/canvas/_module.d.mts +2 -2
  381. package/src/foundry/client-esm/canvas/edges/_module.d.mts +2 -2
  382. package/src/foundry/client-esm/canvas/edges/collision.d.mts +69 -18
  383. package/src/foundry/client-esm/canvas/edges/edge.d.mts +110 -41
  384. package/src/foundry/client-esm/canvas/edges/edges.d.mts +10 -0
  385. package/src/foundry/client-esm/canvas/edges/vertex.d.mts +56 -26
  386. package/src/foundry/client-esm/canvas/regions/_module.d.mts +6 -11
  387. package/src/foundry/client-esm/canvas/regions/geometry.d.mts +38 -0
  388. package/src/foundry/client-esm/canvas/regions/mesh.d.mts +72 -0
  389. package/src/foundry/client-esm/canvas/regions/polygon-tree.d.mts +130 -0
  390. package/src/foundry/client-esm/canvas/regions/shape.d.mts +129 -0
  391. package/src/foundry/client-esm/canvas/scene-manager.d.mts +13 -3
  392. package/src/foundry/client-esm/canvas/smaa/blend.d.mts +14 -3
  393. package/src/foundry/client-esm/canvas/smaa/edges.d.mts +25 -3
  394. package/src/foundry/client-esm/canvas/smaa/smaa.d.mts +121 -23
  395. package/src/foundry/client-esm/canvas/smaa/weights.d.mts +26 -3
  396. package/src/foundry/client-esm/canvas/sources/_module.d.mts +2 -2
  397. package/src/foundry/client-esm/canvas/sources/base-effect-source.d.mts +84 -40
  398. package/src/foundry/client-esm/canvas/sources/base-light-source.d.mts +103 -39
  399. package/src/foundry/client-esm/canvas/sources/global-light-source.d.mts +89 -15
  400. package/src/foundry/client-esm/canvas/sources/point-darkness-source.d.mts +71 -27
  401. package/src/foundry/client-esm/canvas/sources/point-effect-source.d.mts +49 -20
  402. package/src/foundry/client-esm/canvas/sources/point-light-source.d.mts +57 -16
  403. package/src/foundry/client-esm/canvas/sources/point-movement-source.d.mts +31 -4
  404. package/src/foundry/client-esm/canvas/sources/point-sound-source.d.mts +45 -12
  405. package/src/foundry/client-esm/canvas/sources/point-vision-source.d.mts +98 -52
  406. package/src/foundry/client-esm/canvas/sources/rendered-effect-source.d.mts +180 -69
  407. package/src/foundry/client-esm/canvas/tokens/_module.d.mts +2 -3
  408. package/src/foundry/client-esm/canvas/tokens/ring-config.d.mts +175 -2
  409. package/src/foundry/client-esm/canvas/tokens/ring-data.d.mts +142 -2
  410. package/src/foundry/client-esm/canvas/tokens/ring.d.mts +284 -2
  411. package/src/foundry/client-esm/client.d.mts +47 -54
  412. package/src/foundry/client-esm/data/_module.d.mts +2 -2
  413. package/src/foundry/client-esm/data/client-backend.d.mts +22 -23
  414. package/src/foundry/client-esm/data/region-behaviors/_module.d.mts +11 -14
  415. package/src/foundry/client-esm/data/region-behaviors/adjust-darkness-level.d.mts +56 -0
  416. package/src/foundry/client-esm/data/region-behaviors/base.d.mts +59 -0
  417. package/src/foundry/client-esm/data/region-behaviors/display-scrolling-text.d.mts +64 -0
  418. package/src/foundry/client-esm/data/region-behaviors/execute-macro.d.mts +27 -0
  419. package/src/foundry/client-esm/data/region-behaviors/execute-script.d.mts +23 -0
  420. package/src/foundry/client-esm/data/region-behaviors/pause-game.d.mts +23 -0
  421. package/src/foundry/client-esm/data/region-behaviors/suppress-weather.d.mts +17 -0
  422. package/src/foundry/client-esm/data/region-behaviors/teleport-token.d.mts +32 -0
  423. package/src/foundry/client-esm/data/region-behaviors/toggle-behavior.d.mts +31 -0
  424. package/src/foundry/client-esm/dice/_module.d.mts +2 -3
  425. package/src/foundry/client-esm/dice/parser.d.mts +11 -25
  426. package/src/foundry/client-esm/dice/roll.d.mts +112 -89
  427. package/src/foundry/client-esm/dice/terms/_module.d.mts +2 -3
  428. package/src/foundry/client-esm/dice/terms/coin.d.mts +8 -5
  429. package/src/foundry/client-esm/dice/terms/dice.d.mts +93 -63
  430. package/src/foundry/client-esm/dice/terms/die.d.mts +11 -4
  431. package/src/foundry/client-esm/dice/terms/fate.d.mts +9 -2
  432. package/src/foundry/client-esm/dice/terms/function.d.mts +18 -18
  433. package/src/foundry/client-esm/dice/terms/numeric.d.mts +3 -5
  434. package/src/foundry/client-esm/dice/terms/operator.d.mts +2 -2
  435. package/src/foundry/client-esm/dice/terms/parenthetical.d.mts +9 -10
  436. package/src/foundry/client-esm/dice/terms/pool.d.mts +25 -31
  437. package/src/foundry/client-esm/dice/terms/string.d.mts +4 -4
  438. package/src/foundry/client-esm/dice/terms/term.d.mts +18 -4
  439. package/src/foundry/client-esm/dice/twister.d.mts +3 -3
  440. package/src/foundry/client-esm/helpers/_module.d.mts +2 -2
  441. package/src/foundry/client-esm/helpers/_types.d.mts +12 -46
  442. package/src/foundry/client-esm/helpers/compendium-art.d.mts +56 -4
  443. package/src/foundry/common/abstract/_types.d.mts +60 -54
  444. package/src/foundry/common/abstract/backend.d.mts +51 -45
  445. package/src/foundry/common/abstract/data.d.mts +265 -236
  446. package/src/foundry/common/abstract/document.d.mts +1449 -464
  447. package/src/foundry/common/abstract/embedded-collection-delta.d.mts +1 -1
  448. package/src/foundry/common/abstract/embedded-collection.d.mts +37 -7
  449. package/src/foundry/common/abstract/module.d.mts +3 -2
  450. package/src/foundry/common/abstract/singleton-collection.d.mts +1 -1
  451. package/src/foundry/common/abstract/socket.d.mts +1 -1
  452. package/src/foundry/common/abstract/type-data.d.mts +61 -55
  453. package/src/foundry/common/config.d.mts +11 -3
  454. package/src/foundry/common/constants.d.mts +261 -231
  455. package/src/foundry/common/data/data.d.mts +238 -102
  456. package/src/foundry/common/data/fields.d.mts +1334 -874
  457. package/src/foundry/common/data/module.d.mts +2 -2
  458. package/src/foundry/common/data/validation-failure.d.mts +12 -9
  459. package/src/foundry/common/documents/_module.d.mts +4 -2
  460. package/src/foundry/common/documents/_types.d.mts +22 -56
  461. package/src/foundry/common/documents/active-effect.d.mts +358 -194
  462. package/src/foundry/common/documents/actor-delta.d.mts +403 -73
  463. package/src/foundry/common/documents/actor.d.mts +359 -117
  464. package/src/foundry/common/documents/adventure.d.mts +312 -142
  465. package/src/foundry/common/documents/ambient-light.d.mts +296 -75
  466. package/src/foundry/common/documents/ambient-sound.d.mts +296 -109
  467. package/src/foundry/common/documents/card.d.mts +321 -187
  468. package/src/foundry/common/documents/cards.d.mts +353 -125
  469. package/src/foundry/common/documents/chat-message.d.mts +338 -167
  470. package/src/foundry/common/documents/combat.d.mts +358 -94
  471. package/src/foundry/common/documents/combatant.d.mts +323 -92
  472. package/src/foundry/common/documents/drawing.d.mts +327 -206
  473. package/src/foundry/common/documents/fog-exploration.d.mts +303 -69
  474. package/src/foundry/common/documents/folder.d.mts +307 -82
  475. package/src/foundry/common/documents/item.d.mts +377 -100
  476. package/src/foundry/common/documents/journal-entry-page.d.mts +327 -187
  477. package/src/foundry/common/documents/journal-entry.d.mts +345 -68
  478. package/src/foundry/common/documents/macro.d.mts +325 -139
  479. package/src/foundry/common/documents/measured-template.d.mts +328 -138
  480. package/src/foundry/common/documents/note.d.mts +312 -151
  481. package/src/foundry/common/documents/playlist-sound.d.mts +309 -102
  482. package/src/foundry/common/documents/playlist.d.mts +341 -131
  483. package/src/foundry/common/documents/region-behavior.d.mts +360 -0
  484. package/src/foundry/common/documents/region.d.mts +355 -0
  485. package/src/foundry/common/documents/roll-table.d.mts +320 -102
  486. package/src/foundry/common/documents/scene.d.mts +437 -350
  487. package/src/foundry/common/documents/setting.d.mts +285 -54
  488. package/src/foundry/common/documents/table-result.d.mts +326 -103
  489. package/src/foundry/common/documents/tile.d.mts +337 -172
  490. package/src/foundry/common/documents/token.d.mts +396 -447
  491. package/src/foundry/common/documents/user.d.mts +296 -173
  492. package/src/foundry/common/documents/wall.d.mts +303 -156
  493. package/src/foundry/common/grid/_module.d.mts +3 -3
  494. package/src/foundry/common/grid/base.d.mts +66 -49
  495. package/src/foundry/common/grid/gridless.d.mts +2 -2
  496. package/src/foundry/common/grid/hexagonal.d.mts +35 -28
  497. package/src/foundry/common/grid/square.d.mts +3 -3
  498. package/src/foundry/common/packages/base-module.d.mts +6 -24
  499. package/src/foundry/common/packages/base-package.d.mts +56 -31
  500. package/src/foundry/common/packages/base-system.d.mts +45 -63
  501. package/src/foundry/common/packages/base-world.d.mts +15 -61
  502. package/src/foundry/common/packages/module.d.mts +7 -7
  503. package/src/foundry/common/packages/sub-types.d.mts +4 -6
  504. package/src/foundry/common/primitives/array.d.mts +4 -4
  505. package/src/foundry/common/primitives/math.d.mts +7 -1
  506. package/src/foundry/common/primitives/number.d.mts +2 -2
  507. package/src/foundry/common/primitives/set.d.mts +17 -14
  508. package/src/foundry/common/primitives/string.d.mts +1 -1
  509. package/src/foundry/common/prosemirror/_module.d.mts +15 -15
  510. package/src/foundry/common/prosemirror/dirty-plugin.d.mts +1 -1
  511. package/src/foundry/common/prosemirror/dom-parser.d.mts +2 -1
  512. package/src/foundry/common/prosemirror/dropdown.d.mts +1 -1
  513. package/src/foundry/common/prosemirror/highlight-matches-plugin.d.mts +2 -2
  514. package/src/foundry/common/prosemirror/image-plugin.d.mts +1 -1
  515. package/src/foundry/common/prosemirror/menu.d.mts +3 -3
  516. package/src/foundry/common/prosemirror/paste-transformer.d.mts +1 -1
  517. package/src/foundry/common/prosemirror/plugin.d.mts +2 -2
  518. package/src/foundry/common/prosemirror/schema/index.d.mts +0 -1
  519. package/src/foundry/common/prosemirror/schema/lists.d.mts +2 -0
  520. package/src/foundry/common/prosemirror/util.d.mts +1 -1
  521. package/src/foundry/common/types.d.mts +3 -3
  522. package/src/foundry/common/utils/bitmask.d.mts +23 -11
  523. package/src/foundry/common/utils/collection.d.mts +61 -38
  524. package/src/foundry/common/utils/color.d.mts +20 -2
  525. package/src/foundry/common/utils/event-emitter.d.mts +32 -17
  526. package/src/foundry/common/utils/helpers.d.mts +36 -26
  527. package/src/foundry/common/utils/http.d.mts +2 -2
  528. package/src/foundry/common/utils/module.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/foundry/index.d.mts +0 -1
  532. package/src/foundry/{clipper → public/scripts/clipper}/clipper.d.mts +58 -16
  533. package/src/foundry/public/scripts/index.d.mts +1 -0
  534. package/src/foundry/public/scripts/workers/image-compressor.d.mts +23 -0
  535. package/src/foundry/public/scripts/workers/index.d.mts +1 -0
  536. package/{index-lenient.d.mts → src/index-lenient.d.mts} +2 -0
  537. package/src/index.d.mts +6 -0
  538. package/src/tsconfig.json +15 -0
  539. package/src/types/augments/particles.d.mts +29 -0
  540. package/src/types/augments/pixi.d.mts +1024 -21
  541. package/src/types/augments/smooth.d.mts +31 -0
  542. package/src/types/augments/tinyMCE.d.mts +1 -1
  543. package/src/types/config.d.mts +18 -313
  544. package/src/types/documentConfiguration.d.mts +286 -542
  545. package/src/types/index.d.mts +1 -1
  546. package/src/types/lib.d.mts +12 -0
  547. package/src/types/workers/image-compressor.d.mts +176 -0
  548. package/src/utils/index.d.mts +1279 -0
  549. package/tsconfig.json +29 -0
  550. package/tsconfig.main.json +8 -0
  551. package/tsconfig.miscellaneous.json +16 -0
  552. package/index.d.mts +0 -5
  553. package/src/foundry/client/apps/placeables/light-config.d.mts +0 -100
  554. package/src/foundry/client/apps/placeables/sound-config.d.mts +0 -43
  555. package/src/foundry/common/documents/module.d.mts +0 -35
  556. package/src/foundry/common/primitives/regex.d.mts +0 -12
  557. package/src/types/helperTypes.d.mts +0 -583
  558. package/src/types/utils.d.mts +0 -539
  559. /package/src/foundry/{clipper → public/scripts/clipper}/index.d.mts +0 -0
@@ -1,41 +1,1059 @@
1
- import type { InexactPartial } from "../../../../types/utils.d.mts";
1
+ import type { AnyObject, InexactPartial, Merge } from "#utils";
2
+ import type { documents } from "../../../client-esm/client.d.mts";
2
3
  import type Document from "../../../common/abstract/document.d.mts";
3
- import type { DocumentDatabaseOperations } from "../../../common/abstract/document.d.mts";
4
- import type BaseScene from "../../../common/documents/scene.d.mts";
4
+ import type { DataSchema } from "../../../common/data/fields.d.mts";
5
+ import type { fields, TextureData } from "../../../common/data/module.d.mts";
6
+ import LightData = foundry.data.LightData;
5
7
 
6
8
  declare global {
7
9
  namespace Scene {
8
- type Metadata = Document.MetadataFor<Scene>;
9
-
10
- type ConfiguredClass = Document.ConfiguredClassForName<"Scene">;
11
- type ConfiguredInstance = Document.ConfiguredInstanceForName<"Scene">;
12
-
13
- /* eslint-disable @typescript-eslint/no-empty-object-type */
14
- export interface DatabaseOperations
15
- extends DocumentDatabaseOperations<
16
- Scene,
17
- {},
18
- { thumb: (string | null)[]; autoReposition: boolean; animateDarkness: number },
19
- {}
10
+ /**
11
+ * The document's name.
12
+ */
13
+ type Name = "Scene";
14
+
15
+ /**
16
+ * The arguments to construct the document.
17
+ */
18
+ type ConstructorArgs = Document.ConstructorParameters<CreateData, Parent>;
19
+
20
+ /**
21
+ * The documents embedded within `Scene`.
22
+ */
23
+ type Hierarchy = Readonly<Document.HierarchyOf<Schema>>;
24
+
25
+ /**
26
+ * The implementation of the `Scene` document instance configured through `CONFIG.Scene.documentClass` in Foundry and
27
+ * {@link DocumentClassConfig | `DocumentClassConfig`} or {@link ConfiguredScene | `fvtt-types/configuration/ConfiguredScene`} in fvtt-types.
28
+ */
29
+ type Implementation = Document.ImplementationFor<"Scene">;
30
+
31
+ /**
32
+ * The implementation of the `Scene` document configured through `CONFIG.Scene.documentClass` in Foundry and
33
+ * {@link DocumentClassConfig | `DocumentClassConfig`} in fvtt-types.
34
+ */
35
+ type ImplementationClass = Document.ImplementationClassFor<"Scene">;
36
+
37
+ /**
38
+ * A document's metadata is special information about the document ranging anywhere from its name,
39
+ * whether it's indexed, or to the permissions a user has over it.
40
+ */
41
+ interface Metadata
42
+ extends Merge<
43
+ Document.Metadata.Default,
44
+ Readonly<{
45
+ name: "Scene";
46
+ collection: "scenes";
47
+ indexed: true;
48
+ compendiumIndexFields: ["_id", "name", "thumb", "sort", "folder"];
49
+ embedded: Metadata.Embedded;
50
+ label: string;
51
+ labelPlural: string;
52
+ preserveOnImport: ["_id", "sort", "ownership", "active"];
53
+ schemaVersion: string;
54
+ }>
20
55
  > {}
21
- /* eslint-enable @typescript-eslint/no-empty-object-type */
22
56
 
23
- // Helpful aliases
24
- type ConstructorData = BaseScene.ConstructorData;
25
- type UpdateData = BaseScene.UpdateData;
26
- type Schema = BaseScene.Schema;
27
- type Source = BaseScene.Source;
57
+ namespace Metadata {
58
+ /**
59
+ * The embedded metadata
60
+ */
61
+ interface Embedded {
62
+ AmbientLight: "lights";
63
+ AmbientSound: "sounds";
64
+ Drawing: "drawings";
65
+ MeasuredTemplate: "templates";
66
+ Note: "notes";
67
+ Region: "regions";
68
+ Tile: "tiles";
69
+ Token: "tokens";
70
+ Wall: "walls";
71
+ }
72
+ }
73
+
74
+ /**
75
+ * A document's parent is something that can contain it.
76
+ * For example an `Item` can be contained by an `Actor` which makes `Actor` one of its possible parents.
77
+ */
78
+ type Parent = null;
79
+
80
+ /**
81
+ * A document's direct descendants are documents that are contained directly within its schema.
82
+ * This is a union of all such instances, or never if the document doesn't have any descendants.
83
+ */
84
+ type DirectDescendant =
85
+ | AmbientLightDocument.Implementation
86
+ | AmbientSoundDocument.Implementation
87
+ | DrawingDocument.Implementation
88
+ | MeasuredTemplateDocument.Implementation
89
+ | NoteDocument.Implementation
90
+ | RegionDocument.Implementation
91
+ | TileDocument.Implementation
92
+ | TokenDocument.Implementation
93
+ | WallDocument.Implementation;
94
+
95
+ /**
96
+ * A document's direct descendants are documents that are contained directly within its schema.
97
+ * This is a union of all such classes, or never if the document doesn't have any descendants.
98
+ */
99
+ type DirectDescendantClass =
100
+ | AmbientLightDocument.ImplementationClass
101
+ | AmbientSoundDocument.ImplementationClass
102
+ | DrawingDocument.ImplementationClass
103
+ | MeasuredTemplateDocument.ImplementationClass
104
+ | NoteDocument.ImplementationClass
105
+ | RegionDocument.ImplementationClass
106
+ | TileDocument.ImplementationClass
107
+ | TokenDocument.ImplementationClass
108
+ | WallDocument.ImplementationClass;
109
+
110
+ /**
111
+ * A document's descendants are any documents that are contained within, either within its schema
112
+ * or its descendant's schemas.
113
+ * This is a union of all such instances, or never if the document doesn't have any descendants.
114
+ */
115
+ type Descendant = DirectDescendant | RegionDocument.Descendant | TokenDocument.Descendant;
116
+
117
+ /**
118
+ * A document's descendants are any child documents, grandchild documents, etc.
119
+ * This is a union of all classes, or never if the document doesn't have any descendants.
120
+ */
121
+ type DescendantClass = DirectDescendantClass | RegionDocument.DescendantClass | TokenDocument.DescendantClass;
122
+
123
+ /**
124
+ * Types of `CompendiumCollection` this document might be contained in.
125
+ * Note that `this.pack` will always return a string; this is the type for `game.packs.get(this.pack)`
126
+ */
127
+ type Pack = CompendiumCollection.ForDocument<"Scene">;
128
+
129
+ /**
130
+ * An embedded document is a document contained in another.
131
+ * For example an `Item` can be contained by an `Actor` which means `Item` can be embedded in `Actor`.
132
+ *
133
+ * If this is `never` it is because there are no embeddable documents (or there's a bug!).
134
+ */
135
+ type Embedded = Document.ImplementationFor<Embedded.Name>;
136
+
137
+ namespace Embedded {
138
+ /**
139
+ * An embedded document is a document contained in another.
140
+ * For example an `Item` can be contained by an `Actor` which means `Item` can be embedded in `Actor`.
141
+ *
142
+ * If this is `never` it is because there are no embeddable documents (or there's a bug!).
143
+ */
144
+ type Name = keyof Metadata.Embedded;
145
+
146
+ /**
147
+ * Gets the collection name for an embedded document.
148
+ */
149
+ type CollectionNameOf<CollectionName extends Embedded.CollectionName> = Document.Embedded.CollectionNameFor<
150
+ Metadata.Embedded,
151
+ CollectionName
152
+ >;
153
+
154
+ /**
155
+ * Gets the collection document for an embedded document.
156
+ */
157
+ // TODO(LukeAbby): There's a circularity. Should be `Document.Embedded.CollectionDocumentFor<Metadata.Embedded, CollectionName>`
158
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
159
+ type DocumentFor<CollectionName extends Embedded.CollectionName> = Document.Any;
160
+
161
+ /**
162
+ * Gets the collection for an embedded document.
163
+ */
164
+ type CollectionFor<CollectionName extends Embedded.CollectionName> = Document.Embedded.CollectionFor<
165
+ // TODO(LukeAbby): This should be `TokenDocument.Implementation` but this causes a circularity.
166
+ Document.Any,
167
+ Metadata.Embedded,
168
+ CollectionName
169
+ >;
170
+
171
+ /**
172
+ * A valid name to refer to a collection embedded in this document. For example an `Actor`
173
+ * has the key `"items"` which contains `Item` instance which would make both `"Item" | "Items"`
174
+ * valid keys (amongst others).
175
+ */
176
+ type CollectionName = Document.Embedded.CollectionName<Metadata.Embedded>;
177
+ }
178
+
179
+ /**
180
+ * The name of the world or embedded collection this document can find itself in.
181
+ * For example an `Item` is always going to be inside a collection with a key of `items`.
182
+ * This is a fixed string per document type and is primarily useful for {@link ClientDocumentMixin | `Descendant Document Events`}.
183
+ */
184
+ type ParentCollectionName = Metadata["collection"];
185
+
186
+ /**
187
+ * The world collection that contains `Scene`s. Will be `never` if none exists.
188
+ */
189
+ type CollectionClass = Scenes.ConfiguredClass;
190
+
191
+ /**
192
+ * The world collection that contains `Scene`s. Will be `never` if none exists.
193
+ */
194
+ type Collection = Scenes.Configured;
195
+
196
+ /**
197
+ * An instance of `Scene` that comes from the database but failed validation meaning that
198
+ * its `system` and `_source` could theoretically be anything.
199
+ */
200
+ interface Invalid extends Document.Invalid<Scene.Implementation> {}
201
+
202
+ /**
203
+ * An instance of `Scene` that comes from the database.
204
+ */
205
+ interface Stored extends Document.Stored<Scene.Implementation> {}
206
+
207
+ /**
208
+ * The data put in {@link Scene._source | `Scene#_source`}. This data is what was
209
+ * persisted to the database and therefore it must be valid JSON.
210
+ *
211
+ * For example a {@link fields.SetField | `SetField`} is persisted to the database as an array
212
+ * but initialized as a {@link Set | `Set`}.
213
+ */
214
+ interface Source extends fields.SchemaField.SourceData<Schema> {}
215
+
216
+ /**
217
+ * @deprecated {@link Scene.Source | `Scene.Source`}
218
+ */
219
+ type PersistedData = Source;
220
+
221
+ /**
222
+ * The data necessary to create a document. Used in places like {@link Scene.create | `Scene.create`}
223
+ * and {@link Scene | `new Scene(...)`}.
224
+ *
225
+ * For example a {@link fields.SetField | `SetField`} can accept any {@link Iterable | `Iterable`}
226
+ * with the right values. This means you can pass a `Set` instance, an array of values,
227
+ * a generator, or any other iterable.
228
+ */
229
+ interface CreateData extends fields.SchemaField.CreateData<Schema> {}
230
+
231
+ /**
232
+ * The data after a {@link foundry.abstract.Document | `Document`} has been initialized, for example
233
+ * {@link Scene.name | `Scene#name`}.
234
+ *
235
+ * This is data transformed from {@link Scene.Source | `Scene.Source`} and turned into more
236
+ * convenient runtime data structures. For example a {@link fields.SetField | `SetField`} is
237
+ * persisted to the database as an array of values but at runtime it is a `Set` instance.
238
+ */
239
+ interface InitializedData extends fields.SchemaField.InitializedData<Schema> {}
240
+
241
+ /**
242
+ * The data used to update a document, for example {@link Scene.update | `Scene#update`}.
243
+ * It is a distinct type from {@link Scene.CreateData | `DeepPartial<Scene.CreateData>`} because
244
+ * it has different rules for `null` and `undefined`.
245
+ */
246
+ interface UpdateData extends fields.SchemaField.UpdateData<Schema> {}
247
+
248
+ interface EnvironmentDataSchemaDefaults {
249
+ hue: number;
250
+ intensity: number;
251
+ luminosity: number;
252
+ saturation: number;
253
+ shadows: number;
254
+ }
255
+
256
+ interface EnvironmentDataSchema<Defaults extends EnvironmentDataSchemaDefaults> extends DataSchema {
257
+ /**
258
+ * The normalized hue angle.
259
+ * @defaultValue `0` for `environment.base`, `257/360` for `environment.dark`
260
+ */
261
+ hue: fields.HueField<{
262
+ required: true;
263
+ initial: Defaults["hue"];
264
+ label: "SCENES.ENVIRONMENT.Hue";
265
+ hint: "SCENES.ENVIRONMENT.HueHint";
266
+ }>;
267
+
268
+ /**
269
+ * The intensity of the tinting (0 = no tinting).
270
+ * @defaultValue `0`
271
+ */
272
+ intensity: fields.AlphaField<{
273
+ required: true;
274
+ nullable: false;
275
+ initial: Defaults["intensity"];
276
+ label: "SCENES.ENVIRONMENT.Intensity";
277
+ hint: "SCENES.ENVIRONMENT.IntensityHint";
278
+ }>;
279
+
280
+ /**
281
+ * The luminosity.
282
+ * @defaultValue `0` in `environment.base`, `0.25` in `environment.dark`
283
+ */
284
+ luminosity: fields.NumberField<{
285
+ required: true;
286
+ nullable: false;
287
+ initial: Defaults["luminosity"];
288
+ min: -1;
289
+ max: 1;
290
+ label: "SCENES.ENVIRONMENT.Luminosity";
291
+ hint: "SCENES.ENVIRONMENT.LuminosityHint";
292
+ }>;
293
+
294
+ /**
295
+ * The saturation.
296
+ * @defaultValue `0`
297
+ */
298
+ saturation: fields.NumberField<{
299
+ required: true;
300
+ nullable: false;
301
+ initial: Defaults["saturation"];
302
+ min: -1;
303
+ max: 1;
304
+ label: "SCENES.ENVIRONMENT.Saturation";
305
+ hint: "SCENES.ENVIRONMENT.SaturationHint";
306
+ }>;
307
+
308
+ /**
309
+ * The strength of the shadows.
310
+ * @defaultValue `0`
311
+ */
312
+ shadows: fields.NumberField<{
313
+ required: true;
314
+ nullable: false;
315
+ initial: Defaults["shadows"];
316
+ min: 0;
317
+ max: 1;
318
+ label: "SCENES.ENVIRONMENT.Shadows";
319
+ hint: "SCENES.ENVIRONMENT.ShadowsHint";
320
+ }>;
321
+ }
322
+
323
+ /**
324
+ * The schema for {@link Scene | `Scene`}. This is the source of truth for how an Scene document
325
+ * must be structured.
326
+ *
327
+ * Foundry uses this schema to validate the structure of the {@link Scene | `Scene`}. For example
328
+ * a {@link fields.StringField | `StringField`} will enforce that the value is a string. More
329
+ * complex fields like {@link fields.SetField | `SetField`} goes through various conversions
330
+ * starting as an array in the database, initialized as a set, and allows updates with any
331
+ * iterable.
332
+ */
333
+ interface Schema extends DataSchema {
334
+ /**
335
+ * The _id which uniquely identifies this Scene document
336
+ * @defaultValue `null`
337
+ */
338
+ _id: fields.DocumentIdField;
339
+
340
+ /**
341
+ * The name of this scene
342
+ */
343
+ // FIXME: This field is `required` with no `initial`, so actually required for construction; Currently an AssignmentType override is required to enforce this
344
+ name: fields.StringField<{ required: true; blank: false; textSearch: true }, string>;
345
+
346
+ /**
347
+ * Is this scene currently active? Only one scene may be active at a given time
348
+ * @defaultValue `false`
349
+ */
350
+ active: fields.BooleanField;
351
+
352
+ /**
353
+ * Is this scene displayed in the top navigation bar?
354
+ * @defaultValue `true`
355
+ */
356
+ navigation: fields.BooleanField<{ initial: true }>;
357
+
358
+ /**
359
+ * The sorting order of this Scene in the navigation bar relative to siblings
360
+ * @defaultValue `0`
361
+ */
362
+ navOrder: fields.NumberField<{ required: true; nullable: false; integer: true; initial: 0 }>;
363
+
364
+ /**
365
+ * A string which overrides Scene name for display in the navigation bar
366
+ * @defaultValue `""`
367
+ */
368
+ navName: fields.HTMLField<{ textSearch: true }>;
369
+
370
+ /**
371
+ * An image or video file that provides the background texture for the scene.
372
+ * @defaultValue see {@linkcode TextureData}
373
+ */
374
+ background: TextureData;
375
+
376
+ /**
377
+ * An image or video file path providing foreground media for the scene
378
+ * @defaultValue `null`
379
+ */
380
+ foreground: fields.FilePathField<{ categories: ["IMAGE", "VIDEO"] }>;
381
+
382
+ /**
383
+ * The elevation of the foreground layer where overhead tiles reside
384
+ * @defaultValue `null`
385
+ * @remarks If falsey, {@link Scene.prepareBaseData | `Scene#prepareBaseData`} initializes this to `this.grid.distance * 4`, with the comment:
386
+ *
387
+ * "A temporary assumption until a more robust long-term solution when we implement Scene Levels."
388
+ */
389
+ foregroundElevation: fields.NumberField<{ required: false; positive: true; integer: true }>;
390
+
391
+ /**
392
+ * A thumbnail image which depicts the scene at lower resolution
393
+ * @defaultValue `null`
394
+ */
395
+ thumb: fields.FilePathField<{ categories: ["IMAGE"] }>;
396
+
397
+ /**
398
+ * The width of the scene canvas, normally the width of the background media
399
+ * @defaultValue `4000`
400
+ */
401
+ width: fields.NumberField<{ integer: true; positive: true; initial: 4000 }>;
402
+
403
+ /**
404
+ * The height of the scene canvas, normally the height of the background media
405
+ * @defaultValue `3000`
406
+ */
407
+ height: fields.NumberField<{ integer: true; positive: true; initial: 3000 }>;
408
+
409
+ /**
410
+ * The proportion of canvas padding applied around the outside of the scene
411
+ * dimensions to provide additional buffer space
412
+ * @defaultValue `0.25`
413
+ */
414
+ padding: fields.NumberField<{ required: true; nullable: false; min: 0; max: 0.5; step: 0.05; initial: 0.25 }>;
415
+
416
+ /**
417
+ * The initial view coordinates for the scene
418
+ */
419
+ initial: fields.SchemaField<{
420
+ /** @defaultValue `null` */
421
+ x: fields.NumberField<{ integer: true; nullable: true }>;
422
+
423
+ /** @defaultValue `null` */
424
+ y: fields.NumberField<{ integer: true; nullable: true }>;
425
+
426
+ /** @defaultValue `0.5` */
427
+ scale: fields.NumberField<{ nullable: true; min: 0.25; max: 3; initial: 0.5 }>;
428
+ }>;
429
+
430
+ /**
431
+ * The color of the canvas displayed behind the scene background
432
+ * @defaultValue `"#999999"`
433
+ */
434
+ backgroundColor: fields.ColorField<{ nullable: false; initial: "#999999" }>;
435
+
436
+ /**
437
+ * Grid configuration for the scene
438
+ * @defaultValue see properties
439
+ * @remarks Initialized in {@link Scene.prepareBaseData | `Scene#prepareBaseData`} to `Scene.#getGrid(this)`, which returns {@linkcode BaseGrid} or a subclass
440
+ */
441
+ grid: fields.SchemaField<{
442
+ /**
443
+ * The type of grid, a number from CONST.GRID_TYPES.
444
+ * @defaultValue `game.system.grid.type`
445
+ */
446
+ type: fields.NumberField<
447
+ {
448
+ required: true;
449
+ choices: CONST.GRID_TYPES[];
450
+ initial: () => CONST.GRID_TYPES;
451
+ validationError: "must be a value in CONST.GRID_TYPES";
452
+ },
453
+ // FIXME: overrides required to enforce branded type
454
+ CONST.GRID_TYPES | null | undefined,
455
+ CONST.GRID_TYPES,
456
+ CONST.GRID_TYPES
457
+ >;
458
+
459
+ /**
460
+ * The grid size which represents the width (or height) of a single grid space.
461
+ * @defaultValue `100`
462
+ */
463
+ size: fields.NumberField<{
464
+ required: true;
465
+ nullable: false;
466
+ integer: true;
467
+ min: typeof CONST.GRID_MIN_SIZE;
468
+ initial: 100;
469
+ validationError: `must be an integer number of pixels, ${typeof CONST.GRID_MIN_SIZE} or greater`;
470
+ }>;
471
+
472
+ /**
473
+ * @remarks The style of grid line used. This field has no special validation, but provided values
474
+ * should match keys of {@linkcode CONFIG.Canvas.gridStyles}
475
+ * @defaultValue `"solidLines"`
476
+ */
477
+ style: fields.StringField<{ required: true; blank: false; initial: "solidLines" }>;
478
+
479
+ /**
480
+ * @remarks The width of drawn grid lines
481
+ * @defaultValue `1`
482
+ */
483
+ thickness: fields.NumberField<{ required: true; nullable: false; positive: true; integer: true; initial: 1 }>;
484
+
485
+ /**
486
+ * A string representing the color used to render the grid lines.
487
+ * @defaultValue `"#000000"`
488
+ */
489
+ color: fields.ColorField<{ required: true; nullable: false; initial: "#000000" }>;
490
+
491
+ /**
492
+ * A number between 0 and 1 for the opacity of the grid lines.
493
+ * @defaultValue `0.2`
494
+ */
495
+ alpha: fields.AlphaField<{ initial: 0.2 }>;
496
+
497
+ /**
498
+ * The number of distance units which are represented by a single grid space.
499
+ * @defaultValue `game.system.grid.distance`
500
+ */
501
+ distance: fields.NumberField<{ required: true; nullable: false; positive: true; initial: () => number }>;
502
+
503
+ /**
504
+ * A label for the units of measure which are used for grid distance.
505
+ * @defaultValue `game.system.grid.units`
506
+ */
507
+ units: fields.StringField<{ required: true; initial: () => string }>;
508
+ }>;
509
+
510
+ /**
511
+ * Do Tokens require vision in order to see the Scene environment?
512
+ * @defaultValue `true`
513
+ */
514
+ tokenVision: fields.BooleanField<{ initial: true }>;
515
+
516
+ /**
517
+ * @remarks Fog data for this scene
518
+ */
519
+ fog: fields.SchemaField<{
520
+ /**
521
+ * Should fog exploration progress be tracked for this Scene?
522
+ * @defaultValue `true`
523
+ */
524
+ exploration: fields.BooleanField<{ initial: true }>;
525
+
526
+ /**
527
+ * The timestamp at which fog of war was last reset for this Scene.
528
+ * @defaultValue `undefined`
529
+ */
530
+ reset: fields.NumberField<{ required: false; initial: undefined }>;
531
+
532
+ /**
533
+ * A special overlay image or video texture which is used for fog of war
534
+ * @defaultValue `null`
535
+ */
536
+ overlay: fields.FilePathField<{ categories: ["IMAGE", "VIDEO"] }>;
537
+
538
+ colors: fields.SchemaField<{
539
+ /**
540
+ * A color tint applied to explored regions of fog of war
541
+ * @defaultValue `null`
542
+ */
543
+ explored: fields.ColorField<{ label: "SCENES.FogExploredColor" }>;
544
+
545
+ /**
546
+ * A color tint applied to unexplored regions of fog of war
547
+ * @defaultValue `null`
548
+ */
549
+ unexplored: fields.ColorField<{ label: "SCENES.FogUnexploredColor" }>;
550
+ }>;
551
+ }>;
552
+
553
+ /**
554
+ * The environment data applied to the Scene.
555
+ */
556
+ environment: fields.SchemaField<{
557
+ /**
558
+ * The environment darkness level.
559
+ * @defaultValue `0`
560
+ */
561
+ darknessLevel: fields.AlphaField<{ initial: 0 }>;
562
+
563
+ /**
564
+ * The darkness level lock state.
565
+ * @defaultValue `false`
566
+ */
567
+ darknessLock: fields.BooleanField<{ initial: false }>;
568
+
569
+ /**
570
+ * The global light data configuration.
571
+ */
572
+ globalLight: fields.SchemaField<{
573
+ /**
574
+ * Is the global light enabled?
575
+ * @defaultValue `false`
576
+ */
577
+ enabled: fields.BooleanField<{ required: true; initial: false }>;
578
+
579
+ /**
580
+ * @see {@linkcode foundry.data.LightData.Schema.alpha}
581
+ * @privateRemarks The field is defined in Foundry by pulling from the {@linkcode foundry.data.LightData} schema
582
+ */
583
+ alpha: LightData.Schema["alpha"];
584
+
585
+ /**
586
+ * Is the global light in bright mode?
587
+ * @defaultValue `false`
588
+ * @remarks This is `boolean` here instead {@linkcode foundry.data.LightData} schema's `number`, because the global light has infinite range
589
+ */
590
+ bright: fields.BooleanField<{ required: true; initial: false }>;
591
+
592
+ /**
593
+ * @see {@linkcode foundry.data.LightData.Schema.color}
594
+ * @privateRemarks The field is defined in Foundry by pulling from the {@linkcode foundry.data.LightData} schema
595
+ */
596
+ color: LightData.Schema["color"];
597
+
598
+ /**
599
+ * @see {@linkcode foundry.data.LightData.Schema.coloration}
600
+ * @privateRemarks The field is defined in Foundry by pulling from the {@linkcode foundry.data.LightData} schema
601
+ */
602
+ coloration: LightData.Schema["coloration"];
603
+
604
+ /**
605
+ * The luminosity applied in the shader
606
+ * @defaultValue `0`
607
+ * @remarks Doesn't pull from the {@linkcode foundry.data.LightData} schema, unlike its siblings, as it has a different `initial`
608
+ */
609
+ luminosity: fields.NumberField<{ required: true; nullable: false; initial: 0; min: 0; max: 1 }>;
610
+
611
+ /**
612
+ * @see {@linkcode foundry.data.LightData.Schema.saturation}
613
+ * @privateRemarks The field is defined in Foundry by pulling from the {@linkcode foundry.data.LightData} schema
614
+ */
615
+ saturation: LightData.Schema["saturation"];
616
+
617
+ /**
618
+ * @see {@linkcode foundry.data.LightData.Schema.contrast}
619
+ * @privateRemarks The field is defined in Foundry by pulling from the {@linkcode foundry.data.LightData} schema
620
+ */
621
+ contrast: LightData.Schema["contrast"];
622
+
623
+ /**
624
+ * @see {@linkcode foundry.data.LightData.Schema.shadows}
625
+ * @privateRemarks The field is defined in Foundry by pulling from the {@linkcode foundry.data.LightData} schema
626
+ */
627
+ shadows: LightData.Schema["shadows"];
628
+
629
+ /**
630
+ * @see {@linkcode foundry.data.LightData.Schema.darkness}
631
+ * @privateRemarks The field is defined in Foundry by pulling from the {@linkcode foundry.data.LightData} schema
632
+ */
633
+ darkness: LightData.Schema["darkness"];
634
+ }>;
635
+
636
+ /**
637
+ * If cycling between Night and Day is activated.
638
+ * @defaultValue `true`
639
+ */
640
+ cycle: fields.BooleanField<{ initial: true }>;
641
+
642
+ /**
643
+ * The base (darkness level 0) ambience lighting data.
644
+ */
645
+ base: fields.SchemaField<
646
+ EnvironmentDataSchema<{ hue: 0; intensity: 0; luminosity: 0; saturation: 0; shadows: 0 }>
647
+ >;
648
+
649
+ /**
650
+ * The dark (darkness level 1) ambience lighting data.
651
+ * @privateRemarks The `hue` default is actually `257/360` but you can't do division in types. This precision should be more than sufficient.
652
+ */
653
+ dark: fields.SchemaField<
654
+ EnvironmentDataSchema<{ hue: 0.71388889; intensity: 0; luminosity: -0.25; saturation: 0; shadows: 0 }>
655
+ >;
656
+ }>;
657
+
658
+ /**
659
+ * A collection of embedded Drawing objects.
660
+ * @defaultValue `[]`
661
+ */
662
+ drawings: fields.EmbeddedCollectionField<typeof documents.BaseDrawing, Scene.Implementation>;
663
+
664
+ /**
665
+ * A collection of embedded Tile objects.
666
+ * @defaultValue `[]`
667
+ */
668
+ tokens: fields.EmbeddedCollectionField<typeof documents.BaseToken, Scene.Implementation>;
669
+
670
+ /**
671
+ * A collection of embedded Token objects.
672
+ * @defaultValue `[]`
673
+ */
674
+ lights: fields.EmbeddedCollectionField<typeof documents.BaseAmbientLight, Scene.Implementation>;
675
+
676
+ /**
677
+ * A collection of embedded AmbientLight objects.
678
+ * @defaultValue `[]`
679
+ */
680
+ notes: fields.EmbeddedCollectionField<typeof documents.BaseNote, Scene.Implementation>;
681
+
682
+ /**
683
+ * A collection of embedded Note objects.
684
+ * @defaultValue `[]`
685
+ */
686
+ sounds: fields.EmbeddedCollectionField<typeof documents.BaseAmbientSound, Scene.Implementation>;
687
+
688
+ /**
689
+ * A collection of embedded Region documents.
690
+ * @defaultValue `[]`
691
+ */
692
+ regions: fields.EmbeddedCollectionField<typeof documents.BaseRegion, Scene.Implementation>;
693
+
694
+ /**
695
+ * A collection of embedded AmbientSound objects.
696
+ * @defaultValue `[]`
697
+ */
698
+ templates: fields.EmbeddedCollectionField<typeof documents.BaseMeasuredTemplate, Scene.Implementation>;
699
+
700
+ /**
701
+ * A collection of embedded MeasuredTemplate objects.
702
+ * @defaultValue `[]`
703
+ */
704
+ tiles: fields.EmbeddedCollectionField<typeof documents.BaseTile, Scene.Implementation>;
705
+
706
+ /**
707
+ * A collection of embedded Wall objects
708
+ * @defaultValue `[]`
709
+ */
710
+ walls: fields.EmbeddedCollectionField<typeof documents.BaseWall, Scene.Implementation>;
711
+
712
+ /**
713
+ * A linked Playlist document which should begin automatically playing when this Scene becomes active.
714
+ * @defaultValue `null`
715
+ */
716
+ playlist: fields.ForeignDocumentField<typeof documents.BasePlaylist>;
717
+
718
+ /**
719
+ * A linked PlaylistSound document from the selected playlist that will
720
+ * begin automatically playing when this Scene becomes active
721
+ * @defaultValue `null`
722
+ * @remarks This is `idOnly` because {@link fields.ForeignDocumentField | `ForeignDocumentField`} doesn't know how to get embedded documents;
723
+ * {@link Scene.prepareBaseData | `Scene#prepareBaseData`} attempts to `get()` this ID from the provided `playlist`, if any, making this
724
+ * `PlaylistSound.Implementation | undefined | null` at runtime
725
+ */
726
+ playlistSound: fields.ForeignDocumentField<typeof documents.BasePlaylistSound, { idOnly: true }>;
727
+
728
+ /**
729
+ * A JournalEntry document which provides narrative details about this Scene
730
+ * @defaultValue `null`
731
+ */
732
+ journal: fields.ForeignDocumentField<typeof documents.BaseJournalEntry>;
733
+
734
+ /**
735
+ * A document ID for a JournalEntryPage which provides narrative details about this Scene
736
+ * @defaultValue `null`
737
+ */
738
+ journalEntryPage: fields.ForeignDocumentField<typeof documents.BaseJournalEntryPage, { idOnly: true }>;
739
+
740
+ /**
741
+ * A named weather effect which should be rendered in this Scene.
742
+ * @defaultValue `""`
743
+ */
744
+ weather: fields.StringField<{ required: true }>;
745
+
746
+ /**
747
+ * The _id of a Folder which contains this Actor
748
+ * @defaultValue `null`
749
+ */
750
+ folder: fields.ForeignDocumentField<typeof documents.BaseFolder>;
751
+
752
+ /**
753
+ * The numeric sort value which orders this Actor relative to its siblings
754
+ * @defaultValue `0`
755
+ */
756
+ sort: fields.IntegerSortField;
757
+
758
+ /**
759
+ * An object which configures ownership of this Scene
760
+ * @defaultValue see {@link fields.DocumentOwnershipField | `fields.DocumentOwnershipField`}
761
+ */
762
+ ownership: fields.DocumentOwnershipField;
763
+
764
+ /**
765
+ * An object of optional key/value flags
766
+ * @defaultValue `{}`
767
+ */
768
+ flags: fields.ObjectField.FlagsField<Name>;
769
+
770
+ /**
771
+ * An object of creation and access information
772
+ * @defaultValue see {@link fields.DocumentStatsField | `fields.DocumentStatsField`}
773
+ */
774
+ _stats: fields.DocumentStatsField;
775
+ }
776
+
777
+ namespace Database {
778
+ /** Options passed along in Get operations for Scenes */
779
+ interface Get extends foundry.abstract.types.DatabaseGetOperation<Scene.Parent> {}
780
+
781
+ /** Options passed along in Create operations for Scenes */
782
+ interface Create<Temporary extends boolean | undefined = boolean | undefined>
783
+ extends foundry.abstract.types.DatabaseCreateOperation<Scene.CreateData, Scene.Parent, Temporary> {}
784
+
785
+ /** Options passed along in Delete operations for Scenes */
786
+ interface Delete extends foundry.abstract.types.DatabaseDeleteOperation<Scene.Parent> {}
787
+
788
+ /** Options passed along in Update operations for Scenes */
789
+ interface Update extends foundry.abstract.types.DatabaseUpdateOperation<Scene.UpdateData, Scene.Parent> {
790
+ thumb?: (string | null)[];
791
+ autoReposition?: boolean;
792
+ animateDarkness?: number;
793
+ }
794
+
795
+ /** Operation for {@link Scene.createDocuments | `Scene.createDocuments`} */
796
+ interface CreateDocumentsOperation<Temporary extends boolean | undefined>
797
+ extends Document.Database.CreateOperation<Scene.Database.Create<Temporary>> {}
798
+
799
+ /** Operation for {@link Scene.updateDocuments | `Scene.updateDocuments`} */
800
+ interface UpdateDocumentsOperation extends Document.Database.UpdateDocumentsOperation<Scene.Database.Update> {}
801
+
802
+ /** Operation for {@link Scene.deleteDocuments | `Scene.deleteDocuments`} */
803
+ interface DeleteDocumentsOperation extends Document.Database.DeleteDocumentsOperation<Scene.Database.Delete> {}
804
+
805
+ /** Operation for {@link Scene.create | `Scene.create`} */
806
+ interface CreateOperation<Temporary extends boolean | undefined>
807
+ extends Document.Database.CreateOperation<Scene.Database.Create<Temporary>> {}
808
+
809
+ /** Operation for {@link Scene.update | `Scene#update`} */
810
+ interface UpdateOperation extends Document.Database.UpdateOperation<Update> {}
811
+
812
+ interface DeleteOperation extends Document.Database.DeleteOperation<Delete> {}
813
+
814
+ /** Options for {@link Scene.get | `Scene.get`} */
815
+ interface GetOptions extends Document.Database.GetOptions {}
816
+
817
+ /** Options for {@link Scene._preCreate | `Scene#_preCreate`} */
818
+ interface PreCreateOptions extends Document.Database.PreCreateOptions<Create> {}
819
+
820
+ /** Options for {@link Scene._onCreate | `Scene#_onCreate`} */
821
+ interface OnCreateOptions extends Document.Database.CreateOptions<Create> {}
822
+
823
+ /** Operation for {@link Scene._preCreateOperation | `Scene._preCreateOperation`} */
824
+ interface PreCreateOperation extends Document.Database.PreCreateOperationStatic<Scene.Database.Create> {}
825
+
826
+ /** Operation for {@link Scene._onCreateOperation | `Scene#_onCreateOperation`} */
827
+ interface OnCreateOperation extends Scene.Database.Create {}
828
+
829
+ /** Options for {@link Scene._preUpdate | `Scene#_preUpdate`} */
830
+ interface PreUpdateOptions extends Document.Database.PreUpdateOptions<Update> {}
831
+
832
+ /** Options for {@link Scene._onUpdate | `Scene#_onUpdate`} */
833
+ interface OnUpdateOptions extends Document.Database.UpdateOptions<Update> {}
834
+
835
+ /** Operation for {@link Scene._preUpdateOperation | `Scene._preUpdateOperation`} */
836
+ interface PreUpdateOperation extends Scene.Database.Update {}
837
+
838
+ /** Operation for {@link Scene._onUpdateOperation | `Scene._preUpdateOperation`} */
839
+ interface OnUpdateOperation extends Scene.Database.Update {}
840
+
841
+ /** Options for {@link Scene._preDelete | `Scene#_preDelete`} */
842
+ interface PreDeleteOptions extends Document.Database.PreDeleteOperationInstance<Delete> {}
843
+
844
+ /** Options for {@link Scene._onDelete | `Scene#_onDelete`} */
845
+ interface OnDeleteOptions extends Document.Database.DeleteOptions<Delete> {}
846
+
847
+ /** Options for {@link Scene._preDeleteOperation | `Scene#_preDeleteOperation`} */
848
+ interface PreDeleteOperation extends Scene.Database.Delete {}
849
+
850
+ /** Options for {@link Scene._onDeleteOperation | `Scene#_onDeleteOperation`} */
851
+ interface OnDeleteOperation extends Scene.Database.Delete {}
852
+
853
+ /** Context for {@link Scene._onDeleteOperation | `Scene._onDeleteOperation`} */
854
+ interface OnDeleteDocumentsContext extends Document.ModificationContext<Scene.Parent> {}
855
+
856
+ /** Context for {@link Scene._onCreateDocuments | `Scene._onCreateDocuments`} */
857
+ interface OnCreateDocumentsContext extends Document.ModificationContext<Scene.Parent> {}
858
+
859
+ /** Context for {@link Scene._onUpdateDocuments | `Scene._onUpdateDocuments`} */
860
+ interface OnUpdateDocumentsContext extends Document.ModificationContext<Scene.Parent> {}
861
+
862
+ /**
863
+ * Options for {@link Scene._preCreateDescendantDocuments | `Scene#_preCreateDescendantDocuments`}
864
+ * and {@link Scene._onCreateDescendantDocuments | `Scene#_onCreateDescendantDocuments`}
865
+ */
866
+ interface CreateOptions extends Document.Database.CreateOptions<Scene.Database.Create> {}
867
+
868
+ /**
869
+ * Options for {@link Scene._preUpdateDescendantDocuments | `Scene#_preUpdateDescendantDocuments`}
870
+ * and {@link Scene._onUpdateDescendantDocuments | `Scene#_onUpdateDescendantDocuments`}
871
+ */
872
+ interface UpdateOptions extends Document.Database.UpdateOptions<Scene.Database.Update> {}
873
+
874
+ /**
875
+ * Options for {@link Scene._preDeleteDescendantDocuments | `Scene#_preDeleteDescendantDocuments`}
876
+ * and {@link Scene._onDeleteDescendantDocuments | `Scene#_onDeleteDescendantDocuments`}
877
+ */
878
+ interface DeleteOptions extends Document.Database.DeleteOptions<Scene.Database.Delete> {}
879
+ }
880
+
881
+ /**
882
+ * The flags that are available for this document in the form `{ [scope: string]: { [key: string]: unknown } }`.
883
+ */
884
+ interface Flags extends Document.ConfiguredFlagsForName<Name> {}
885
+
886
+ namespace Flags {
887
+ /**
888
+ * The valid scopes for the flags on this document e.g. `"core"` or `"dnd5e"`.
889
+ */
890
+ type Scope = Document.FlagKeyOf<Flags>;
891
+
892
+ /**
893
+ * The valid keys for a certain scope for example if the scope is "core" then a valid key may be `"sheetLock"` or `"viewMode"`.
894
+ */
895
+ type Key<Scope extends Flags.Scope> = Document.FlagKeyOf<Document.FlagGetKey<Flags, Scope>>;
896
+
897
+ /**
898
+ * Gets the type of a particular flag given a `Scope` and a `Key`.
899
+ */
900
+ type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.GetFlag<Name, Scope, Key>;
901
+ }
902
+
903
+ type PreCreateDescendantDocumentsArgs =
904
+ | Document.PreCreateDescendantDocumentsArgs<Scene.Stored, Scene.DirectDescendant, Scene.Metadata.Embedded>
905
+ | TokenDocument.PreCreateDescendantDocumentsArgs
906
+ | RegionDocument.PreCreateDescendantDocumentsArgs;
907
+
908
+ type OnCreateDescendantDocumentsArgs =
909
+ | Document.OnCreateDescendantDocumentsArgs<Scene.Stored, Scene.DirectDescendant, Scene.Metadata.Embedded>
910
+ | TokenDocument.OnCreateDescendantDocumentsArgs
911
+ | RegionDocument.OnCreateDescendantDocumentsArgs;
912
+
913
+ type PreUpdateDescendantDocumentsArgs =
914
+ | Document.PreUpdateDescendantDocumentsArgs<Scene.Stored, Scene.DirectDescendant, Scene.Metadata.Embedded>
915
+ | TokenDocument.PreUpdateDescendantDocumentsArgs
916
+ | RegionDocument.PreUpdateDescendantDocumentsArgs;
917
+
918
+ type OnUpdateDescendantDocumentsArgs =
919
+ | Document.OnUpdateDescendantDocumentsArgs<Scene.Stored, Scene.DirectDescendant, Scene.Metadata.Embedded>
920
+ | TokenDocument.OnUpdateDescendantDocumentsArgs
921
+ | RegionDocument.OnUpdateDescendantDocumentsArgs;
922
+
923
+ type PreDeleteDescendantDocumentsArgs =
924
+ | Document.PreDeleteDescendantDocumentsArgs<Scene.Stored, Scene.DirectDescendant, Scene.Metadata.Embedded>
925
+ | TokenDocument.PreDeleteDescendantDocumentsArgs
926
+ | RegionDocument.PreDeleteDescendantDocumentsArgs;
927
+
928
+ type OnDeleteDescendantDocumentsArgs =
929
+ | Document.OnDeleteDescendantDocumentsArgs<Scene.Stored, Scene.DirectDescendant, Scene.Metadata.Embedded>
930
+ | TokenDocument.OnDeleteDescendantDocumentsArgs
931
+ | RegionDocument.OnDeleteDescendantDocumentsArgs;
932
+
933
+ interface Dimensions {
934
+ /** The width of the canvas. */
935
+ width: number;
936
+
937
+ /** The height of the canvas. */
938
+ height: number;
939
+
940
+ /** The grid size. */
941
+ size: number;
942
+
943
+ /** The canvas rectangle. */
944
+ rect: Canvas.Rectangle;
945
+
946
+ /** The X coordinate of the scene rectangle within the larger canvas. */
947
+ sceneX: number;
948
+
949
+ /** The Y coordinate of the scene rectangle within the larger canvas. */
950
+ sceneY: number;
951
+
952
+ /** The width of the scene. */
953
+ sceneWidth: number;
954
+
955
+ /** The height of the scene. */
956
+ sceneHeight: number;
957
+
958
+ /** The scene rectangle. */
959
+ sceneRect: Canvas.Rectangle;
960
+
961
+ /** The number of distance units in a single grid space. */
962
+ distance: number;
963
+
964
+ /** The factor to convert distance units to pixels */
965
+ distancePixels: number;
966
+
967
+ /** The units of distance */
968
+ units: string;
969
+
970
+ /** The aspect ratio of the scene rectangle. */
971
+ ratio: number;
972
+
973
+ /** The length of the longest line that can be drawn on the canvas. */
974
+ maxR: number;
975
+
976
+ /** The number of grid rows on the canvas */
977
+ rows: number;
978
+
979
+ /** The number of grid columns on the canvas */
980
+ columns: number;
981
+ }
982
+
983
+ interface _ThumbnailCreationData extends ImageHelper.TextureToImageOptions {
984
+ /**
985
+ * A background image to use for thumbnail creation, otherwise the current scene
986
+ * background is used.
987
+ *
988
+ * @remarks This cannot be `null` because Foundry writes `const newImage = img !== undefined;`.
989
+ */
990
+ img: string;
991
+
992
+ /**
993
+ * The desired thumbnail width. Default is 300px
994
+ * @defaultValue `300`
995
+ */
996
+ width: number | null;
997
+
998
+ /**
999
+ * The desired thumbnail height. Default is 100px;
1000
+ * @defaultValue `100`
1001
+ */
1002
+ height: number | null;
1003
+
1004
+ /**
1005
+ * Which image format should be used? image/png, image/jpeg, or image/webp
1006
+ * @defaultValue `"image/webp"`
1007
+ *
1008
+ * @remarks Foundry writes `image/jpg` but this functions the same as `image/png `.
1009
+ * The correct MIME type is `image/jpeg`.
1010
+ */
1011
+ format: ImageHelper.Format | null;
1012
+
1013
+ /**
1014
+ * What compression quality should be used for jpeg or webp, between 0 and 1
1015
+ * @defaultValue `0.8`
1016
+ */
1017
+ quality: number | null;
1018
+ }
1019
+
1020
+ interface ThumbnailCreationData extends InexactPartial<_ThumbnailCreationData> {}
1021
+
1022
+ /**
1023
+ * @deprecated {@link Scene.Database | `Scene.DatabaseOperation`}
1024
+ */
1025
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
1026
+ interface DatabaseOperations extends Document.Database.Operations<Scene.Implementation> {}
1027
+
1028
+ /**
1029
+ * @deprecated {@link Scene.CreateData | `Scene.CreateData`}
1030
+ */
1031
+ interface ConstructorData extends Scene.CreateData {}
1032
+
1033
+ /**
1034
+ * @deprecated {@link Scene.implementation | `Scene.ImplementationClass`}
1035
+ */
1036
+ type ConfiguredClass = ImplementationClass;
1037
+
1038
+ /**
1039
+ * @deprecated {@link Scene.Implementation | `Scene.Implementation`}
1040
+ */
1041
+ type ConfiguredInstance = Implementation;
28
1042
  }
29
1043
 
30
1044
  /**
31
1045
  * The client-side Scene document which extends the common BaseScene model.
32
1046
  *
33
- * @see {@link Scenes} The world-level collection of Scene documents
34
- * @see {@link SceneConfig} The Scene configuration application
1047
+ * @see {@link Scenes | `Scenes`} The world-level collection of Scene documents
1048
+ * @see {@link SceneConfig | `SceneConfig`} The Scene configuration application
35
1049
  *
36
1050
  */
37
1051
  class Scene extends ClientDocumentMixin(foundry.documents.BaseScene) {
38
- static override metadata: Scene.Metadata;
1052
+ /**
1053
+ * @param data - Initial data from which to construct the `Scene`
1054
+ * @param context - Construction context options
1055
+ */
1056
+ constructor(...args: Scene.ConstructorArgs);
39
1057
 
40
1058
  /**
41
1059
  * Track the viewed position of each scene (while in memory only, not persisted)
@@ -47,24 +1065,29 @@ declare global {
47
1065
 
48
1066
  /**
49
1067
  * Track whether the scene is the active view
1068
+ * @defaultValue `this.active`
50
1069
  */
51
- protected _view: this["active"];
1070
+ protected _view: boolean;
52
1071
 
53
1072
  /**
54
1073
  * The grid instance
1074
+ * @remarks Foundry initializes this to `this.grid` in the class body, which before data prep is the data from the `grid` SchemaField.
1075
+ *
1076
+ * This gets set to {@linkcode BaseGrid} or a subclass in {@link Scene.prepareBaseData | `Scene#prepareBaseData`}
55
1077
  */
56
- grid: foundry.grid.BaseGrid;
1078
+ grid: foundry.grid.BaseGrid | foundry.documents.BaseScene["grid"];
57
1079
 
58
1080
  /**
59
1081
  * Determine the canvas dimensions this Scene would occupy, if rendered
60
1082
  * @defaultValue `{}`
1083
+ * @remarks Technically `undefined` prior to the first time {@link Scene.prepareBaseData | `Scene#prepareBaseData`} is called
61
1084
  */
62
- dimensions: ReturnType<this["getDimensions"]>;
1085
+ dimensions: Scene.Dimensions;
63
1086
 
64
1087
  /**
65
1088
  * Provide a thumbnail image path used to represent this document.
66
1089
  */
67
- get thumbnail(): this["thumb"];
1090
+ get thumbnail(): string | null;
68
1091
 
69
1092
  /**
70
1093
  * A convenience accessor for whether the Scene is currently viewed
@@ -79,34 +1102,35 @@ declare global {
79
1102
 
80
1103
  /**
81
1104
  * Set this scene as the current view
1105
+ * @remarks If `canvas.loading`, returns a `ui.notifications.warn`, thence the `| number` in the return type
82
1106
  */
83
- view(): Promise<this | undefined>;
1107
+ view(): Promise<this | number>;
84
1108
 
85
1109
  /**
86
1110
  * @param createData - (default: `{}`)
87
1111
  * @param options - (default: `{}`)
88
1112
  */
89
- override clone<Save extends boolean = false>(
90
- createData?: foundry.documents.BaseScene.ConstructorData,
91
- context?: InexactPartial<
92
- {
93
- /**
94
- * Save the clone to the World database?
95
- * @defaultValue `false`
96
- */
97
- save: Save;
98
-
99
- /**
100
- * Keep the same ID of the original document
101
- * @defaultValue `false`
102
- */
103
- keepId: boolean;
104
- } & Document.ConstructionContext<this["parent"]>
105
- >,
1113
+ // data: not null (property access), context: not null (destructured)
1114
+ override clone<Save extends boolean | null | undefined = false>(
1115
+ data?: Scene.CreateData,
1116
+ context?: Document.CloneContext<Save>,
106
1117
  ): Save extends true ? Promise<this> : this;
107
1118
 
108
1119
  override reset(): void;
109
1120
 
1121
+ /**
1122
+ * @remarks If `source` is falsey, and the grid is hexagonal with the `legacyHex` flag set,
1123
+ * does some conversion on `object.grid.size` (leaving it numeric, no type change) before returning
1124
+ */
1125
+ override toObject(source?: boolean | null): fields.SchemaField.SourceData<Scene.Schema>;
1126
+
1127
+ /**
1128
+ * @remarks
1129
+ * - Transforms `this.grid` from source data to a {@linkcode BaseGrid} (or subclass) instance
1130
+ * - Sets `this.dimensions` to `this.getDimensions()`
1131
+ * - If a `playlist` is set, attempts to initialize `this.playlistSound` to a Document reference (it's an `idOnly` field in the schema)
1132
+ * - Sets `this.foregroundElevation` to `this.grid.distance * 4` if its otherwise falsey
1133
+ */
110
1134
  override prepareBaseData(): void;
111
1135
 
112
1136
  /**
@@ -114,150 +1138,183 @@ declare global {
114
1138
  * Apply padding to enlarge the playable space and round to the nearest 2x grid size to ensure symmetry.
115
1139
  * The rounding accomplishes that the padding buffer around the map always contains whole grid spaces.
116
1140
  */
117
- getDimensions(): SceneDimensions;
1141
+ getDimensions(): Scene.Dimensions;
118
1142
 
119
- override _onClickDocumentLink(event: MouseEvent): unknown;
1143
+ /** @remarks If the scene has a `journal`, forwards to that journal's `#_onClickDocumentLink` */
1144
+ override _onClickDocumentLink(event: MouseEvent): ClientDocument.OnClickDocumentLinkReturn;
120
1145
 
121
- /**
122
- * @privateRemarks _onCreate, _preUpdate, _onUpdate, _preDelete, and _onDelete are all overridden but with no signature changes.
123
- * For type simplicity they are left off. These methods historically have been the source of a large amount of computation from tsc.
124
- */
1146
+ // _preCreate, _preCreateOperation, _onCreate, and _preUpdate, _onUpdate, _preDelete, and _onDelete are all overridden but with no signature changes.
1147
+ // For type simplicity they are left off. These methods historically have been the source of a large amount of computation from tsc.
125
1148
 
126
1149
  /**
127
1150
  * Handle repositioning of placed objects when the Scene dimensions change
1151
+ * @private
128
1152
  */
129
- protected _repositionObject(
130
- sceneUpdateData: foundry.documents.BaseScene.ConstructorData,
131
- ): foundry.documents.BaseScene.ConstructorData;
1153
+ protected _repositionObject(sceneUpdateData: Scene.UpdateData): Scene.UpdateData;
132
1154
 
133
1155
  /**
134
1156
  * Handle Scene activation workflow if the active state is changed to true
135
1157
  * @param active - Is the scene now active?
136
1158
  */
137
- protected _onActivate(active: boolean): ReturnType<this["view"]> | ReturnType<Canvas["draw"]>;
1159
+ protected _onActivate(active: boolean): Promise<this | Canvas>;
1160
+
1161
+ /**
1162
+ * @remarks To make it possible for narrowing one parameter to jointly narrow other parameters
1163
+ * this method must be overridden like so:
1164
+ * ```typescript
1165
+ * class SwadeScene extends Scene {
1166
+ * protected override _preCreateDescendantDocuments(...args: Scene.PreCreateDescendantDocumentsArgs) {
1167
+ * super._preCreateDescendantDocuments(...args);
1168
+ *
1169
+ * const [parent, collection, data, options, userId] = args;
1170
+ * if (collection === "tokens") {
1171
+ * options; // Will be narrowed.
1172
+ * }
1173
+ * }
1174
+ * }
1175
+ * ```
1176
+ */
1177
+ protected override _preCreateDescendantDocuments(...args: Scene.PreCreateDescendantDocumentsArgs): void;
138
1178
 
139
1179
  /**
140
- * @privateRemarks _preCreateDescendantDocuments, _preUpdateDescendantDocuments, _preDeleteDescendantDocuments, and_onUpdateDescendantDocuments are all overridden but with no signature changes.
141
- * For type simplicity they are left off. These methods historically have been the source of a large amount of computation from tsc.
1180
+ * @remarks To make it possible for narrowing one parameter to jointly narrow other parameters
1181
+ * this method must be overridden like so:
1182
+ * ```typescript
1183
+ * class LancerScene extends Scene {
1184
+ * protected override _preUpdateDescendantDocuments(...args: Scene.OnUpdateDescendantDocuments) {
1185
+ * super._preUpdateDescendantDocuments(...args);
1186
+ *
1187
+ * const [parent, collection, changes, options, userId] = args;
1188
+ * if (collection === "tokens") {
1189
+ * options; // Will be narrowed.
1190
+ * }
1191
+ * }
1192
+ * }
1193
+ * ```
142
1194
  */
1195
+ protected override _preUpdateDescendantDocuments(...args: Scene.PreUpdateDescendantDocumentsArgs): void;
143
1196
 
144
- override toCompendium<
145
- FlagsOpt extends boolean = false,
146
- SourceOpt extends boolean = true,
147
- SortOpt extends boolean = true,
148
- FolderOpt extends boolean = false,
149
- OwnershipOpt extends boolean = false,
150
- StateOpt extends boolean = true,
151
- IdOpt extends boolean = false,
152
- >(
1197
+ /**
1198
+ * @remarks To make it possible for narrowing one parameter to jointly narrow other parameters
1199
+ * this method must be overridden like so:
1200
+ * ```typescript
1201
+ * class Ptr2eScene extends Scene {
1202
+ * protected override _onUpdateDescendantDocuments(...args: Scene.OnUpdateDescendantDocumentsArgs) {
1203
+ * super._onUpdateDescendantDocuments(...args);
1204
+ *
1205
+ * const [parent, collection, documents, changes, options, userId] = args;
1206
+ * if (collection === "tokens") {
1207
+ * options; // Will be narrowed.
1208
+ * }
1209
+ * }
1210
+ * }
1211
+ * ```
1212
+ */
1213
+ protected override _onUpdateDescendantDocuments(...args: Scene.OnUpdateDescendantDocumentsArgs): void;
1214
+
1215
+ /**
1216
+ * @remarks To make it possible for narrowing one parameter to jointly narrow other parameters
1217
+ * this method must be overridden like so:
1218
+ * ```typescript
1219
+ * class KultScene extends Scene {
1220
+ * protected override _preDeleteDescendantDocuments(...args: Scene.PreDeleteDescendantDocumentsArgs) {
1221
+ * super._preDeleteDescendantDocuments(...args);
1222
+ *
1223
+ * const [parent, collection, ids, options, userId] = args;
1224
+ * if (collection === "tokens") {
1225
+ * options; // Will be narrowed.
1226
+ * }
1227
+ * }
1228
+ * }
1229
+ * ```
1230
+ */
1231
+ protected override _preDeleteDescendantDocuments(...args: Scene.PreDeleteDescendantDocumentsArgs): void;
1232
+
1233
+ // options: not null (parameter default only, destructured in super)
1234
+ override toCompendium<Options extends ClientDocument.ToCompendiumOptions | undefined = undefined>(
153
1235
  pack?: CompendiumCollection<CompendiumCollection.Metadata> | null,
154
- options?: InexactPartial<
155
- ClientDocument.CompendiumExportOptions<FlagsOpt, SourceOpt, SortOpt, FolderOpt, OwnershipOpt, StateOpt, IdOpt>
156
- >,
157
- ): Omit<
158
- this["_source"],
159
- | (IdOpt extends false ? "_id" : never)
160
- | ClientDocument.OmitProperty<SortOpt, "sort" | "navigation" | "navOrder">
161
- | ClientDocument.OmitProperty<FolderOpt, "folder">
162
- | ClientDocument.OmitProperty<FlagsOpt, "flags">
163
- | ClientDocument.OmitProperty<OwnershipOpt, "ownership">
164
- | ClientDocument.OmitProperty<StateOpt, "active" | "fogReset" | "playing">
165
- >;
1236
+ options?: Options,
1237
+ ): ClientDocument.ToCompendiumReturnType<foundry.documents.BaseScene, Options>;
166
1238
 
167
1239
  /**
168
1240
  * Create a 300px by 100px thumbnail image for this scene background
169
1241
  * @param data - (default: `{}`)
170
1242
  * @returns The created thumbnail data.
171
1243
  */
172
- createThumbnail(data?: ThumbnailCreationData): ReturnType<typeof ImageHelper.createThumbnail>;
173
- }
174
-
175
- interface SceneDimensions {
176
- /** The width of the canvas. */
177
- width: number;
178
-
179
- /** The height of the canvas. */
180
- height: number;
181
-
182
- /** The grid size. */
183
- size: number;
1244
+ // data: not null (destructured)
1245
+ createThumbnail(data?: Scene.ThumbnailCreationData): Promise<ImageHelper.ThumbnailReturn>;
184
1246
 
185
- /** The canvas rectangle. */
186
- rect: Canvas.Rectangle;
187
-
188
- /** The X coordinate of the scene rectangle within the larger canvas. */
189
- sceneX: number;
190
-
191
- /** The Y coordinate of the scene rectangle within the larger canvas. */
192
- sceneY: number;
193
-
194
- /** The width of the scene. */
195
- sceneWidth: number;
196
-
197
- /** The height of the scene. */
198
- sceneHeight: number;
1247
+ /*
1248
+ * After this point these are not really overridden methods.
1249
+ * They are here because Foundry's documents are complex and have lots of edge cases.
1250
+ * There are DRY ways of representing this but this ends up being harder to understand
1251
+ * for end users extending these functions, especially for static methods. There are also a
1252
+ * number of methods that don't make sense to call directly on `Document` like `createDocuments`,
1253
+ * as there is no data that can safely construct every possible document. Finally keeping definitions
1254
+ * separate like this helps against circularities.
1255
+ */
199
1256
 
200
- /** The scene rectangle. */
201
- sceneRect: Canvas.Rectangle;
1257
+ // ClientDocument overrides
202
1258
 
203
- /** The number of distance units in a single grid space. */
204
- distance: number;
1259
+ // Other Descendant Document operations are actually overridden above
205
1260
 
206
- /** The factor to convert distance units to pixels */
207
- distancePixels: number;
1261
+ /**
1262
+ * @remarks To make it possible for narrowing one parameter to jointly narrow other parameters
1263
+ * this method must be overridden like so:
1264
+ * ```typescript
1265
+ * class GurpsScene extends Scene {
1266
+ * protected override _onCreateDescendantDocuments(...args: Scene.OnCreateDescendantDocumentsArgs) {
1267
+ * super._onCreateDescendantDocuments(...args);
1268
+ *
1269
+ * const [parent, collection, documents, data, options, userId] = args;
1270
+ * if (collection === "tokens") {
1271
+ * options; // Will be narrowed.
1272
+ * }
1273
+ * }
1274
+ * }
1275
+ * ```
1276
+ */
1277
+ protected override _onCreateDescendantDocuments(...args: Scene.OnCreateDescendantDocumentsArgs): void;
208
1278
 
209
- /** The units of distance */
210
- units: string;
1279
+ /**
1280
+ * @remarks To make it possible for narrowing one parameter to jointly narrow other parameters
1281
+ * this method must be overridden like so:
1282
+ * ```typescript
1283
+ * class BladesScene extends Scene {
1284
+ * protected override _onDeleteDescendantDocuments(...args: Scene.OnUpdateDescendantDocuments) {
1285
+ * super._onDeleteDescendantDocuments(...args);
1286
+ *
1287
+ * const [parent, collection, documents, ids, options, userId] = args;
1288
+ * if (collection === "tokens") {
1289
+ * options; // Will be narrowed.
1290
+ * }
1291
+ * }
1292
+ * }
1293
+ * ```
1294
+ */
1295
+ protected override _onDeleteDescendantDocuments(...args: Scene.OnDeleteDescendantDocumentsArgs): void;
211
1296
 
212
- /** The aspect ratio of the scene rectangle. */
213
- ratio: number;
1297
+ // context: not null (destructured)
1298
+ static override defaultName(context?: Document.DefaultNameContext<"Scene", Scene.Parent>): string;
214
1299
 
215
- /** The length of the longest line that can be drawn on the canvas. */
216
- maxR: number;
1300
+ // data: not null (parameter default only), context: not null (destructured)
1301
+ static override createDialog(
1302
+ data?: Document.CreateDialogData<Scene.CreateData>,
1303
+ context?: Document.CreateDialogContext<"Scene", Scene.Parent>,
1304
+ ): Promise<Scene.Stored | null | undefined>;
217
1305
 
218
- /** The number of grid rows on the canvas */
219
- rows: number;
1306
+ // options: not null (parameter default only)
1307
+ static override fromDropData(
1308
+ data: Document.DropData<Scene.Implementation>,
1309
+ options?: AnyObject,
1310
+ ): Promise<Scene.Implementation | undefined>;
220
1311
 
221
- /** The number of grid columns on the canvas */
222
- columns: number;
1312
+ static override fromImport(
1313
+ source: Scene.Source,
1314
+ context?: Document.FromImportContext<Scene.Parent> | null,
1315
+ ): Promise<Scene.Implementation>;
223
1316
  }
224
- }
225
-
226
- interface _ThumbnailCreationData extends ImageHelper.TextureToImageOptions {
227
- /**
228
- * A background image to use for thumbnail creation, otherwise the current scene
229
- * background is used.
230
- *
231
- * @remarks This cannot be `null` because Foundry writes `const newImage = img !== undefined;`.
232
- */
233
- img: string;
234
-
235
- /**
236
- * The desired thumbnail width. Default is 300px
237
- * @defaultValue `300`
238
- */
239
- width: number | null;
240
-
241
- /**
242
- * The desired thumbnail height. Default is 100px;
243
- * @defaultValue `100`
244
- */
245
- height: number | null;
246
1317
 
247
- /**
248
- * Which image format should be used? image/png, image/jpeg, or image/webp
249
- * @defaultValue `"image/webp"`
250
- *
251
- * @remarks Foundry writes `image/jpg` but this functions the same as `image/png `.
252
- * The correct MIME type is `image/jpeg`.
253
- */
254
- format: ImageHelper.Format | null;
255
-
256
- /**
257
- * What compression quality should be used for jpeg or webp, between 0 and 1
258
- * @defaultValue `0.8`
259
- */
260
- quality: number | null;
1318
+ /** @deprecated {@link Scene.Dimensions | `Scene.Dimensions`} */
1319
+ type SceneDimensions = Scene.Dimensions;
261
1320
  }
262
-
263
- interface ThumbnailCreationData extends InexactPartial<_ThumbnailCreationData> {}