@league-of-foundry-developers/foundry-vtt-types 13.340.0 → 13.340.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/package.json +40 -18
- package/src/configuration/configuration.d.mts +24 -23
- package/src/configuration/documents.d.mts +295 -0
- package/src/configuration/globals.d.mts +8 -2
- package/src/configuration/index.d.mts +1 -0
- package/src/foundry/client/apps/app.d.mts +121 -119
- package/src/foundry/client/apps/av/av-config.d.mts +13 -8
- package/src/foundry/client/apps/av/cameras.d.mts +11 -11
- package/src/foundry/client/apps/dice/dice-config.d.mts +22 -8
- package/src/foundry/client/apps/form.d.mts +112 -94
- package/src/foundry/client/apps/forms/actor.d.mts +22 -12
- package/src/foundry/client/apps/forms/adventure-exporter.d.mts +13 -8
- package/src/foundry/client/apps/forms/adventure-importer.d.mts +15 -7
- package/src/foundry/client/apps/forms/base-sheet.d.mts +14 -7
- package/src/foundry/client/apps/forms/card-config.d.mts +17 -9
- package/src/foundry/client/apps/forms/cards-config.d.mts +13 -14
- package/src/foundry/client/apps/forms/combat-config.d.mts +7 -7
- package/src/foundry/client/apps/forms/combatant-config.d.mts +4 -4
- package/src/foundry/client/apps/forms/default-sheets-config.d.mts +1 -1
- package/src/foundry/client/apps/forms/effect-config.d.mts +6 -6
- package/src/foundry/client/apps/forms/folder-config.d.mts +5 -5
- package/src/foundry/client/apps/forms/fonts.d.mts +42 -35
- package/src/foundry/client/apps/forms/grid-config.d.mts +11 -11
- package/src/foundry/client/apps/forms/image-popout.d.mts +28 -22
- package/src/foundry/client/apps/forms/item.d.mts +6 -6
- package/src/foundry/client/apps/forms/journal-page-sheet.d.mts +17 -15
- package/src/foundry/client/apps/forms/journal-sheet.d.mts +46 -37
- package/src/foundry/client/apps/forms/macro-config.d.mts +6 -6
- package/src/foundry/client/apps/forms/measure-template.d.mts +8 -8
- package/src/foundry/client/apps/forms/ownership.d.mts +5 -5
- package/src/foundry/client/apps/forms/playlist-config.d.mts +7 -9
- package/src/foundry/client/apps/forms/playlist-sound-config.d.mts +6 -6
- package/src/foundry/client/apps/forms/roll-table-config.d.mts +9 -10
- package/src/foundry/client/apps/forms/scene-config.d.mts +39 -39
- package/src/foundry/client/apps/forms/sheet-config.d.mts +8 -8
- package/src/foundry/client/apps/forms/user-config.d.mts +11 -11
- package/src/foundry/client/apps/hud/chatbubble.d.mts +14 -9
- package/src/foundry/client/apps/hud/container.d.mts +3 -3
- package/src/foundry/client/apps/hud/controls.d.mts +124 -84
- package/src/foundry/client/apps/hud/hotbar.d.mts +12 -12
- package/src/foundry/client/apps/hud/hud.d.mts +4 -4
- package/src/foundry/client/apps/hud/menu.d.mts +6 -6
- package/src/foundry/client/apps/hud/navigation.d.mts +11 -11
- package/src/foundry/client/apps/hud/pause.d.mts +7 -7
- package/src/foundry/client/apps/hud/players.d.mts +11 -11
- package/src/foundry/client/apps/i18n.d.mts +31 -27
- package/src/foundry/client/apps/placeables/drawing-config.d.mts +41 -33
- package/src/foundry/client/apps/placeables/drawing-hud.d.mts +4 -4
- package/src/foundry/client/apps/placeables/index.d.mts +0 -2
- package/src/foundry/client/apps/placeables/note-config.d.mts +27 -17
- package/src/foundry/client/apps/placeables/tile-config.d.mts +23 -10
- package/src/foundry/client/apps/placeables/tile-hud.d.mts +8 -8
- package/src/foundry/client/apps/placeables/token-config.d.mts +84 -63
- package/src/foundry/client/apps/placeables/token-hud.d.mts +10 -10
- package/src/foundry/client/apps/placeables/wall-config.d.mts +19 -16
- package/src/foundry/client/apps/sidebar/apps/chat-popout.d.mts +5 -5
- package/src/foundry/client/apps/sidebar/apps/client-settings.d.mts +2 -2
- package/src/foundry/client/apps/sidebar/apps/compendium.d.mts +13 -10
- package/src/foundry/client/apps/sidebar/apps/invitation-links.d.mts +3 -3
- package/src/foundry/client/apps/sidebar/apps/keybindings-config.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/apps/module-management.d.mts +6 -6
- package/src/foundry/client/apps/sidebar/apps/permission-config.d.mts +6 -6
- package/src/foundry/client/apps/sidebar/apps/support-details.d.mts +33 -28
- package/src/foundry/client/apps/sidebar/apps/tours-management.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/apps/world-config.d.mts +12 -9
- package/src/foundry/client/apps/sidebar/directory-tab-mixin.d.mts +40 -32
- package/src/foundry/client/apps/sidebar/document-directory.d.mts +44 -37
- package/src/foundry/client/apps/sidebar/package-configuration.d.mts +3 -3
- package/src/foundry/client/apps/sidebar/sidebar-tab.d.mts +3 -3
- package/src/foundry/client/apps/sidebar/sidebar.d.mts +7 -7
- package/src/foundry/client/apps/sidebar/tabs/actors-directory.d.mts +4 -4
- package/src/foundry/client/apps/sidebar/tabs/cards-directory.d.mts +4 -4
- package/src/foundry/client/apps/sidebar/tabs/chat-log.d.mts +34 -29
- package/src/foundry/client/apps/sidebar/tabs/combat-tracker.d.mts +15 -15
- package/src/foundry/client/apps/sidebar/tabs/compendium-directory.d.mts +21 -12
- package/src/foundry/client/apps/sidebar/tabs/items-directory.d.mts +4 -4
- package/src/foundry/client/apps/sidebar/tabs/journal-directory.d.mts +4 -4
- package/src/foundry/client/apps/sidebar/tabs/macros-directory.d.mts +8 -8
- package/src/foundry/client/apps/sidebar/tabs/playlists-directory.d.mts +21 -21
- package/src/foundry/client/apps/sidebar/tabs/roll-table-directory.d.mts +4 -4
- package/src/foundry/client/apps/sidebar/tabs/scenes-directory.d.mts +6 -6
- package/src/foundry/client/apps/sidebar/tabs/settings.d.mts +12 -12
- package/src/foundry/client/apps/templates.d.mts +2 -2
- package/src/foundry/client/av/clients/simplepeer.d.mts +4 -4
- package/src/foundry/client/av/settings.d.mts +16 -13
- package/src/foundry/client/config.d.mts +1982 -1823
- package/src/foundry/client/core/document-index.d.mts +12 -4
- package/src/foundry/client/core/hooks.d.mts +0 -2
- package/src/foundry/client/core/image.d.mts +13 -11
- package/src/foundry/client/core/issues.d.mts +11 -6
- package/src/foundry/client/core/keybindings.d.mts +3 -3
- package/src/foundry/client/core/nue.d.mts +1 -1
- package/src/foundry/client/core/packages.d.mts +393 -63
- package/src/foundry/client/core/settings.d.mts +34 -12
- package/src/foundry/client/core/socket.d.mts +2 -2
- package/src/foundry/client/core/sorting.d.mts +6 -6
- package/src/foundry/client/core/time.d.mts +6 -3
- package/src/foundry/client/core/tooltip.d.mts +1 -1
- package/src/foundry/client/core/tour.d.mts +58 -49
- package/src/foundry/client/core/tours.d.mts +1 -1
- package/src/foundry/client/core/utils.d.mts +3 -3
- package/src/foundry/client/core/workers.d.mts +24 -17
- package/src/foundry/client/data/abstract/canvas-document.d.mts +9 -15
- package/src/foundry/client/data/abstract/client-document.d.mts +133 -172
- package/src/foundry/client/data/abstract/directory-collection-mixin.d.mts +14 -36
- package/src/foundry/client/data/abstract/document-collection.d.mts +89 -65
- package/src/foundry/client/data/abstract/world-collection.d.mts +47 -53
- package/src/foundry/client/data/collections/actors.d.mts +24 -31
- package/src/foundry/client/data/collections/cards.d.mts +10 -6
- package/src/foundry/client/data/collections/combats.d.mts +12 -8
- package/src/foundry/client/data/collections/compendium-collection.d.mts +79 -66
- package/src/foundry/client/data/collections/compendium-folders.d.mts +6 -6
- package/src/foundry/client/data/collections/compendium-packs.d.mts +4 -4
- package/src/foundry/client/data/collections/fog.d.mts +10 -6
- package/src/foundry/client/data/collections/folder.d.mts +15 -10
- package/src/foundry/client/data/collections/items.d.mts +11 -7
- package/src/foundry/client/data/collections/journal.d.mts +16 -10
- package/src/foundry/client/data/collections/macros.d.mts +15 -22
- package/src/foundry/client/data/collections/messages.d.mts +14 -10
- package/src/foundry/client/data/collections/playlists.d.mts +12 -9
- package/src/foundry/client/data/collections/scenes.d.mts +19 -31
- package/src/foundry/client/data/collections/settings.d.mts +10 -6
- package/src/foundry/client/data/collections/tables.d.mts +11 -7
- package/src/foundry/client/data/collections/users.d.mts +14 -11
- package/src/foundry/client/data/documents/active-effect.d.mts +652 -88
- package/src/foundry/client/data/documents/actor-delta.d.mts +672 -28
- package/src/foundry/client/data/documents/actor.d.mts +722 -60
- package/src/foundry/client/data/documents/adventure.d.mts +482 -49
- package/src/foundry/client/data/documents/ambient-light.d.mts +426 -21
- package/src/foundry/client/data/documents/ambient-sound.d.mts +474 -15
- package/src/foundry/client/data/documents/card.d.mts +570 -39
- package/src/foundry/client/data/documents/cards.d.mts +742 -78
- package/src/foundry/client/data/documents/chat-message.d.mts +578 -45
- package/src/foundry/client/data/documents/combat.d.mts +701 -71
- package/src/foundry/client/data/documents/combatant.d.mts +510 -28
- package/src/foundry/client/data/documents/drawing.d.mts +543 -16
- package/src/foundry/client/data/documents/fog-exploration.d.mts +413 -27
- package/src/foundry/client/data/documents/folder.d.mts +461 -40
- package/src/foundry/client/data/documents/item.d.mts +679 -25
- package/src/foundry/client/data/documents/journal-entry-page.d.mts +587 -21
- package/src/foundry/client/data/documents/journal-entry.d.mts +621 -20
- package/src/foundry/client/data/documents/macro.d.mts +530 -25
- package/src/foundry/client/data/documents/measured-template.d.mts +480 -16
- package/src/foundry/client/data/documents/note.d.mts +495 -18
- package/src/foundry/client/data/documents/playlist-sound.d.mts +429 -27
- package/src/foundry/client/data/documents/playlist.d.mts +666 -75
- package/src/foundry/client/data/documents/region-behavior.d.mts +468 -38
- package/src/foundry/client/data/documents/region.d.mts +661 -35
- package/src/foundry/client/data/documents/scene.d.mts +986 -149
- package/src/foundry/client/data/documents/setting.d.mts +397 -15
- package/src/foundry/client/data/documents/table-result.d.mts +479 -17
- package/src/foundry/client/data/documents/table.d.mts +663 -80
- package/src/foundry/client/data/documents/tile.d.mts +502 -16
- package/src/foundry/client/data/documents/token.d.mts +1114 -90
- package/src/foundry/client/data/documents/user.d.mts +495 -27
- package/src/foundry/client/data/documents/wall.d.mts +550 -15
- package/src/foundry/client/game.d.mts +58 -92
- package/src/foundry/client/head.d.mts +5 -6
- package/src/foundry/client/hooks.d.mts +237 -221
- package/src/foundry/client/pixi/board.d.mts +95 -89
- package/src/foundry/client/pixi/core/containers/base-canvas-group.d.mts +6 -5
- package/src/foundry/client/pixi/core/containers/cached-container.d.mts +5 -5
- package/src/foundry/client/pixi/core/containers/full-canvas-container.d.mts +2 -2
- package/src/foundry/client/pixi/core/containers/point-source-mesh.d.mts +3 -3
- package/src/foundry/client/pixi/core/containers/quad-mesh.d.mts +3 -3
- package/src/foundry/client/pixi/core/containers/quadtree.d.mts +23 -21
- package/src/foundry/client/pixi/core/containers/sprite-mesh.d.mts +5 -5
- package/src/foundry/client/pixi/core/containers/unbound-container.d.mts +5 -5
- package/src/foundry/client/pixi/core/interaction/canvas-animation.d.mts +57 -51
- package/src/foundry/client/pixi/core/interaction/control-icon.d.mts +3 -3
- package/src/foundry/client/pixi/core/interaction/mouse-handler.d.mts +7 -7
- package/src/foundry/client/pixi/core/interaction/ping.d.mts +19 -11
- package/src/foundry/client/pixi/core/interaction/pings/chevron.d.mts +7 -2
- package/src/foundry/client/pixi/core/interaction/pings/pulse.d.mts +29 -23
- package/src/foundry/client/pixi/core/interaction/render-flags.d.mts +83 -38
- package/src/foundry/client/pixi/core/interaction/resize-handle.d.mts +3 -3
- package/src/foundry/client/pixi/core/interaction/targets.d.mts +9 -9
- package/src/foundry/client/pixi/core/loader.d.mts +8 -8
- package/src/foundry/client/pixi/core/shapes/limited-angle-polygon.d.mts +9 -4
- package/src/foundry/client/pixi/core/shapes/polygon-mesher.d.mts +3 -3
- package/src/foundry/client/pixi/core/shapes/precise-text.d.mts +3 -3
- package/src/foundry/client/pixi/core/shapes/ray.d.mts +23 -17
- package/src/foundry/client/pixi/core/shapes/source-polygon.d.mts +19 -14
- package/src/foundry/client/pixi/extensions/circle.d.mts +1 -1
- package/src/foundry/client/pixi/extensions/observable-transform.d.mts +3 -3
- package/src/foundry/client/pixi/groups/effects.d.mts +4 -4
- package/src/foundry/client/pixi/groups/environment.d.mts +5 -5
- package/src/foundry/client/pixi/groups/hidden.d.mts +3 -3
- package/src/foundry/client/pixi/groups/interface.d.mts +6 -6
- package/src/foundry/client/pixi/groups/overlay.d.mts +3 -3
- package/src/foundry/client/pixi/groups/primary.d.mts +11 -11
- package/src/foundry/client/pixi/groups/rendered.d.mts +3 -3
- package/src/foundry/client/pixi/layers/base/canvas-layer.d.mts +3 -3
- package/src/foundry/client/pixi/layers/base/interaction-layer.d.mts +13 -13
- package/src/foundry/client/pixi/layers/base/placeables-layer.d.mts +279 -233
- package/src/foundry/client/pixi/layers/controls/cursor.d.mts +17 -8
- package/src/foundry/client/pixi/layers/controls/door.d.mts +26 -14
- package/src/foundry/client/pixi/layers/controls/layer.d.mts +89 -79
- package/src/foundry/client/pixi/layers/controls/ruler.d.mts +121 -96
- package/src/foundry/client/pixi/layers/effects/background-effects.d.mts +4 -5
- package/src/foundry/client/pixi/layers/effects/coloration-effects.d.mts +6 -4
- package/src/foundry/client/pixi/layers/effects/darkness-effects.d.mts +7 -4
- package/src/foundry/client/pixi/layers/effects/illumination-effects.d.mts +19 -16
- package/src/foundry/client/pixi/layers/effects/visibility.d.mts +101 -84
- package/src/foundry/client/pixi/layers/effects/weather/particles/effect.d.mts +13 -4
- package/src/foundry/client/pixi/layers/effects/weather/particles/leaves.d.mts +31 -2
- package/src/foundry/client/pixi/layers/effects/weather-effects.d.mts +134 -59
- package/src/foundry/client/pixi/layers/grid/highlight.d.mts +13 -3
- package/src/foundry/client/pixi/layers/grid/layer.d.mts +89 -87
- package/src/foundry/client/pixi/layers/grid/mesh.d.mts +36 -15
- package/src/foundry/client/pixi/layers/masks/depth.d.mts +3 -3
- package/src/foundry/client/pixi/layers/masks/occlusion.d.mts +4 -4
- package/src/foundry/client/pixi/layers/masks/vision.d.mts +6 -6
- package/src/foundry/client/pixi/layers/placeables/drawings.d.mts +15 -11
- package/src/foundry/client/pixi/layers/placeables/lighting.d.mts +11 -10
- package/src/foundry/client/pixi/layers/placeables/notes.d.mts +47 -28
- package/src/foundry/client/pixi/layers/placeables/regions.d.mts +25 -12
- package/src/foundry/client/pixi/layers/placeables/sounds.d.mts +81 -63
- package/src/foundry/client/pixi/layers/placeables/templates.d.mts +10 -11
- package/src/foundry/client/pixi/layers/placeables/tiles.d.mts +28 -17
- package/src/foundry/client/pixi/layers/placeables/tokens.d.mts +67 -46
- package/src/foundry/client/pixi/layers/placeables/walls.d.mts +50 -51
- package/src/foundry/client/pixi/perception/clockwise-sweep.d.mts +22 -16
- package/src/foundry/client/pixi/perception/detection-mode.d.mts +123 -51
- package/src/foundry/client/pixi/perception/fog.d.mts +34 -19
- package/src/foundry/client/pixi/perception/perception-manager.d.mts +137 -137
- package/src/foundry/client/pixi/perception/vision-mode.d.mts +92 -67
- package/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.mts +3 -3
- package/src/foundry/client/pixi/placeable.d.mts +241 -146
- package/src/foundry/client/pixi/placeables/drawing.d.mts +260 -134
- package/src/foundry/client/pixi/placeables/light.d.mts +204 -66
- package/src/foundry/client/pixi/placeables/note.d.mts +150 -55
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.d.mts +7 -6
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.d.mts +3 -3
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.d.mts +2 -2
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.d.mts +4 -4
- package/src/foundry/client/pixi/placeables/region.d.mts +219 -110
- package/src/foundry/client/pixi/placeables/sound.d.mts +211 -68
- package/src/foundry/client/pixi/placeables/template.d.mts +186 -100
- package/src/foundry/client/pixi/placeables/tile.d.mts +211 -142
- package/src/foundry/client/pixi/placeables/token.d.mts +911 -568
- package/src/foundry/client/pixi/placeables/wall.d.mts +253 -130
- package/src/foundry/client/pixi/webgl/extensions/batch-renderer.d.mts +27 -5
- package/src/foundry/client/pixi/webgl/extensions/batch-shader-generator.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/helpers/framebuffer-snapshot.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/helpers/smooth-noise.d.mts +13 -5
- package/src/foundry/client/pixi/webgl/helpers/texture-extractor.d.mts +6 -6
- package/src/foundry/client/pixi/webgl/shaders/base-shader-mixin.d.mts +2 -2
- package/src/foundry/client/pixi/webgl/shaders/base-shader.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/filters/base-filter.d.mts +4 -4
- package/src/foundry/client/pixi/webgl/shaders/filters/base-mask-filter.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/filters/blur.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/filters/effects-masking.d.mts +6 -3
- package/src/foundry/client/pixi/webgl/shaders/filters/environment.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/filters/glow-overlay.d.mts +4 -4
- package/src/foundry/client/pixi/webgl/shaders/filters/invisibility.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/filters/outline-overlay.d.mts +4 -4
- package/src/foundry/client/pixi/webgl/shaders/filters/transition.d.mts +6 -6
- package/src/foundry/client/pixi/webgl/shaders/filters/visibility.d.mts +8 -5
- package/src/foundry/client/pixi/webgl/shaders/filters/vision-mask-filter.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/filters/void.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/filters/weather-occlusion-masks.d.mts +4 -4
- package/src/foundry/client/pixi/webgl/shaders/fragment-channel-mixin.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/shaders/grid/grid.d.mts +4 -4
- package/src/foundry/client/pixi/webgl/shaders/lighting/background-lighting.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/base-lighting.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/coloration-lighting.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/darkness-lighting.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/bewitching-wave.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/black-hole.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/chroma.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/emanation.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/energy-field.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fairy-light.d.mts +6 -6
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/flame.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fog.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/force-grid.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/ghost-light.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/hexa-dome.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/light-dome.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/magical-gloom.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/pulse.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/radial-rainbow.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/revolving-light.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/roiling-mass.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/siren-light.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/smoke-patch.d.mts +6 -5
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/star-light.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/sunburst.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/swirling-rainbow.d.mts +4 -3
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/torch.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/vortex.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/wave.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/lighting/illumination-lighting.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/region/adjust-darkness-level.d.mts +7 -7
- package/src/foundry/client/pixi/webgl/shaders/region/base.d.mts +4 -4
- package/src/foundry/client/pixi/webgl/shaders/region/highlight.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/samplers/base-sampler.d.mts +4 -4
- package/src/foundry/client/pixi/webgl/shaders/samplers/baseline-illumination.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/samplers/color-adjustment.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/samplers/depth.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/samplers/fog-of-war.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/samplers/occlusion.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/samplers/primary.d.mts +4 -4
- package/src/foundry/client/pixi/webgl/shaders/samplers/token-ring.d.mts +4 -6
- package/src/foundry/client/pixi/webgl/shaders/vision/background-vision.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/vision/base-vision.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/vision/coloration-vision.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/vision/effects/amplification.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/vision/effects/wave.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/vision/illumination-vision.d.mts +3 -3
- package/src/foundry/client/pixi/webgl/shaders/weather/base-weather.d.mts +14 -15
- package/src/foundry/client/pixi/webgl/shaders/weather/effect.d.mts +20 -27
- package/src/foundry/client/pixi/webgl/shaders/weather/fog.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/weather/rain.d.mts +5 -5
- package/src/foundry/client/pixi/webgl/shaders/weather/snow.d.mts +5 -5
- package/src/foundry/client/pixi/workers/texture-worker.d.mts +5 -5
- package/src/foundry/client/tours/setup-tour.d.mts +15 -10
- package/src/foundry/client/ui/dialog.d.mts +3 -3
- package/src/foundry/client/ui/dragdrop.d.mts +33 -27
- package/src/foundry/client/ui/editor.d.mts +29 -21
- package/src/foundry/client/ui/filepicker.d.mts +42 -37
- package/src/foundry/client/ui/filter.d.mts +60 -48
- package/src/foundry/client/ui/forms.d.mts +22 -22
- package/src/foundry/client/ui/prosemirror.d.mts +15 -7
- package/src/foundry/client/ui/secrets.d.mts +43 -28
- package/src/foundry/client/ui/tabs.d.mts +40 -33
- package/src/foundry/client-esm/_module.d.mts +5 -5
- package/src/foundry/client-esm/_types.d.mts +2 -1
- package/src/foundry/client-esm/applications/api/application.d.mts +93 -31
- package/src/foundry/client-esm/applications/api/dialog.d.mts +23 -23
- package/src/foundry/client-esm/applications/api/document-sheet.d.mts +85 -32
- package/src/foundry/client-esm/applications/api/handlebars-application.d.mts +1 -1
- package/src/foundry/client-esm/applications/apps/av/camera-popout.d.mts +1 -1
- package/src/foundry/client-esm/applications/apps/av/cameras.d.mts +2 -2
- package/src/foundry/client-esm/applications/apps/compendium-art-config.d.mts +4 -5
- package/src/foundry/client-esm/applications/apps/file-picker.d.mts +2 -2
- package/src/foundry/client-esm/applications/apps/grid-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/apps/image-popout.d.mts +1 -1
- package/src/foundry/client-esm/applications/apps/permission-config.d.mts +1 -1
- package/src/foundry/client-esm/applications/dice/roll-resolver.d.mts +4 -4
- package/src/foundry/client-esm/applications/elements/file-picker.d.mts +1 -1
- package/src/foundry/client-esm/applications/elements/prosemirror-editor.d.mts +1 -1
- package/src/foundry/client-esm/applications/hud/drawing-hud.d.mts +1 -1
- package/src/foundry/client-esm/applications/hud/tile-hud.d.mts +1 -1
- package/src/foundry/client-esm/applications/hud/token-hud.d.mts +1 -1
- package/src/foundry/client-esm/applications/sheets/active-effect-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/actor-sheet.d.mts +2 -2
- package/src/foundry/client-esm/applications/sheets/adventure-exporter.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/adventure-importer.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/ambient-light-config.d.mts +5 -5
- package/src/foundry/client-esm/applications/sheets/ambient-sound-config.d.mts +4 -4
- package/src/foundry/client-esm/applications/sheets/card-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/cards-config.d.mts +2 -2
- package/src/foundry/client-esm/applications/sheets/combatant-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/drawing-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/folder-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/item-sheet.d.mts +2 -2
- package/src/foundry/client-esm/applications/sheets/journal/journal-entry-category-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/journal/journal-entry-page-sheet.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/journal/journal-entry-sheet.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/macro-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/note-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/playlist-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/playlist-sound-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/region-behavior-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/region-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/roll-table-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/roll-table-sheet.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/scene-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/table-result-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/template-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/tile-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/token/mixin.d.mts +1 -0
- package/src/foundry/client-esm/applications/sheets/token/token-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sheets/user-config.d.mts +4 -4
- package/src/foundry/client-esm/applications/sheets/wall-config.d.mts +3 -3
- package/src/foundry/client-esm/applications/sidebar/apps/chat-popout.d.mts +1 -1
- package/src/foundry/client-esm/applications/sidebar/sidebar-tab.d.mts +2 -2
- package/src/foundry/client-esm/applications/sidebar/tabs/actor-directory.d.mts +1 -1
- package/src/foundry/client-esm/applications/sidebar/tabs/cards-directory.d.mts +1 -1
- package/src/foundry/client-esm/applications/sidebar/tabs/combat-tracker.d.mts +242 -1
- package/src/foundry/client-esm/applications/sidebar/tabs/item-directory.d.mts +1 -1
- package/src/foundry/client-esm/applications/sidebar/tabs/journal-directory.d.mts +1 -1
- package/src/foundry/client-esm/applications/sidebar/tabs/macro-directory.d.mts +1 -1
- package/src/foundry/client-esm/applications/sidebar/tabs/playlist-directory.d.mts +1 -1
- package/src/foundry/client-esm/applications/sidebar/tabs/roll-table-directory.d.mts +1 -1
- package/src/foundry/client-esm/applications/sidebar/tabs/scene-directory.d.mts +1 -1
- package/src/foundry/client-esm/applications/ui/region-legend.d.mts +2 -2
- package/src/foundry/client-esm/applications/ux/context-menu.d.mts +56 -36
- package/src/foundry/client-esm/audio/_types.d.mts +2 -0
- package/src/foundry/client-esm/audio/biquad.d.mts +76 -26
- package/src/foundry/client-esm/audio/cache.d.mts +31 -20
- package/src/foundry/client-esm/audio/convolver.d.mts +47 -25
- package/src/foundry/client-esm/audio/helper.d.mts +124 -80
- package/src/foundry/client-esm/audio/sound.d.mts +202 -97
- package/src/foundry/client-esm/audio/timeout.d.mts +28 -12
- package/src/foundry/client-esm/canvas/edges/collision.d.mts +12 -4
- package/src/foundry/client-esm/canvas/edges/edge.d.mts +13 -8
- package/src/foundry/client-esm/canvas/edges/edges.d.mts +3 -2
- package/src/foundry/client-esm/canvas/edges/vertex.d.mts +12 -10
- package/src/foundry/client-esm/canvas/regions/geometry.d.mts +14 -7
- package/src/foundry/client-esm/canvas/regions/mesh.d.mts +25 -14
- package/src/foundry/client-esm/canvas/regions/polygon-tree.d.mts +50 -19
- package/src/foundry/client-esm/canvas/regions/shape.d.mts +45 -34
- package/src/foundry/client-esm/canvas/scene-manager.d.mts +7 -6
- package/src/foundry/client-esm/canvas/smaa/blend.d.mts +14 -3
- package/src/foundry/client-esm/canvas/smaa/edges.d.mts +25 -3
- package/src/foundry/client-esm/canvas/smaa/smaa.d.mts +119 -20
- package/src/foundry/client-esm/canvas/smaa/weights.d.mts +26 -3
- package/src/foundry/client-esm/canvas/sources/base-effect-source.d.mts +69 -39
- package/src/foundry/client-esm/canvas/sources/base-light-source.d.mts +66 -40
- package/src/foundry/client-esm/canvas/sources/global-light-source.d.mts +78 -19
- package/src/foundry/client-esm/canvas/sources/point-darkness-source.d.mts +37 -20
- package/src/foundry/client-esm/canvas/sources/point-effect-source.d.mts +39 -20
- package/src/foundry/client-esm/canvas/sources/point-light-source.d.mts +41 -12
- package/src/foundry/client-esm/canvas/sources/point-movement-source.d.mts +15 -4
- package/src/foundry/client-esm/canvas/sources/point-sound-source.d.mts +29 -14
- package/src/foundry/client-esm/canvas/sources/point-vision-source.d.mts +84 -39
- package/src/foundry/client-esm/canvas/sources/rendered-effect-source.d.mts +115 -41
- package/src/foundry/client-esm/canvas/tokens/ring-config.d.mts +83 -21
- package/src/foundry/client-esm/canvas/tokens/ring-data.d.mts +66 -93
- package/src/foundry/client-esm/canvas/tokens/ring.d.mts +146 -51
- package/src/foundry/client-esm/client.d.mts +16 -16
- package/src/foundry/client-esm/data/_module.d.mts +1 -1
- package/src/foundry/client-esm/data/calendar.d.mts +26 -39
- package/src/foundry/client-esm/data/client-backend.d.mts +6 -6
- package/src/foundry/client-esm/data/region-behaviors/adjust-darkness-level.d.mts +1 -1
- package/src/foundry/client-esm/data/region-behaviors/base.d.mts +5 -5
- package/src/foundry/client-esm/data/region-behaviors/display-scrolling-text.d.mts +2 -2
- package/src/foundry/client-esm/data/terrain-data.d.mts +1 -1
- package/src/foundry/client-esm/dice/parser.d.mts +5 -27
- package/src/foundry/client-esm/dice/roll.d.mts +63 -80
- package/src/foundry/client-esm/dice/terms/coin.d.mts +4 -8
- package/src/foundry/client-esm/dice/terms/dice.d.mts +85 -64
- package/src/foundry/client-esm/dice/terms/die.d.mts +7 -7
- package/src/foundry/client-esm/dice/terms/fate.d.mts +5 -5
- package/src/foundry/client-esm/dice/terms/function.d.mts +13 -16
- package/src/foundry/client-esm/dice/terms/numeric.d.mts +2 -4
- package/src/foundry/client-esm/dice/terms/operator.d.mts +1 -1
- package/src/foundry/client-esm/dice/terms/parenthetical.d.mts +8 -9
- package/src/foundry/client-esm/dice/terms/pool.d.mts +13 -28
- package/src/foundry/client-esm/dice/terms/string.d.mts +3 -3
- package/src/foundry/client-esm/dice/terms/term.d.mts +10 -5
- package/src/foundry/client-esm/dice/twister.d.mts +3 -3
- package/src/foundry/client-esm/documents/_module.d.mts +1 -1
- package/src/foundry/client-esm/helpers/_types.d.mts +12 -46
- package/src/foundry/client-esm/helpers/compendium-art.d.mts +57 -4
- package/src/foundry/client-esm/packages/_module.d.mts +1 -1
- package/src/foundry/client-esm/packages/_types.d.mts +2 -0
- package/src/foundry/client-esm/utils/_module.d.mts +1 -1
- package/src/foundry/client-esm/utils/_types.d.mts +2 -1
- package/src/foundry/common/_types.d.mts +1 -1
- package/src/foundry/common/abstract/_module.d.mts +1 -0
- package/src/foundry/common/abstract/_types.d.mts +60 -54
- package/src/foundry/common/abstract/backend.d.mts +28 -16
- package/src/foundry/common/abstract/data.d.mts +133 -116
- package/src/foundry/common/abstract/document.d.mts +1233 -440
- package/src/foundry/common/abstract/embedded-collection.d.mts +2 -2
- package/src/foundry/common/abstract/singleton-collection.d.mts +1 -1
- package/src/foundry/common/abstract/type-data.d.mts +35 -43
- package/src/foundry/common/config.d.mts +3 -3
- package/src/foundry/common/constants.d.mts +27 -26
- package/src/foundry/common/data/_types.d.mts +2 -0
- package/src/foundry/common/data/data.d.mts +189 -87
- package/src/foundry/common/data/fields.d.mts +579 -258
- package/src/foundry/common/data/validation-failure.d.mts +9 -4
- package/src/foundry/common/documents/_types.d.mts +16 -9
- package/src/foundry/common/documents/active-effect.d.mts +280 -180
- package/src/foundry/common/documents/actor-delta.d.mts +317 -70
- package/src/foundry/common/documents/actor.d.mts +304 -103
- package/src/foundry/common/documents/adventure.d.mts +254 -140
- package/src/foundry/common/documents/ambient-light.d.mts +267 -76
- package/src/foundry/common/documents/ambient-sound.d.mts +267 -110
- package/src/foundry/common/documents/card.d.mts +267 -176
- package/src/foundry/common/documents/cards.d.mts +299 -128
- package/src/foundry/common/documents/chat-message.d.mts +276 -160
- package/src/foundry/common/documents/combat.d.mts +300 -91
- package/src/foundry/common/documents/combatant.d.mts +283 -88
- package/src/foundry/common/documents/drawing.d.mts +286 -207
- package/src/foundry/common/documents/fog-exploration.d.mts +258 -72
- package/src/foundry/common/documents/folder.d.mts +248 -85
- package/src/foundry/common/documents/item.d.mts +305 -101
- package/src/foundry/common/documents/journal-entry-page.d.mts +279 -190
- package/src/foundry/common/documents/journal-entry.d.mts +294 -70
- package/src/foundry/common/documents/macro.d.mts +254 -134
- package/src/foundry/common/documents/measured-template.d.mts +293 -137
- package/src/foundry/common/documents/note.d.mts +274 -151
- package/src/foundry/common/documents/playlist-sound.d.mts +260 -96
- package/src/foundry/common/documents/playlist.d.mts +279 -122
- package/src/foundry/common/documents/region-behavior.d.mts +305 -64
- package/src/foundry/common/documents/region.d.mts +309 -90
- package/src/foundry/common/documents/roll-table.d.mts +286 -104
- package/src/foundry/common/documents/scene.d.mts +276 -344
- package/src/foundry/common/documents/setting.d.mts +229 -55
- package/src/foundry/common/documents/table-result.d.mts +267 -96
- package/src/foundry/common/documents/tile.d.mts +301 -172
- package/src/foundry/common/documents/token.d.mts +350 -452
- package/src/foundry/common/documents/user.d.mts +256 -146
- package/src/foundry/common/documents/wall.d.mts +272 -157
- package/src/foundry/common/grid/_types.d.mts +2 -0
- package/src/foundry/common/grid/base.d.mts +58 -37
- package/src/foundry/common/grid/hexagonal.d.mts +19 -19
- package/src/foundry/common/grid/square.d.mts +1 -1
- package/src/foundry/common/packages/_module.d.mts +5 -5
- package/src/foundry/common/packages/_types.d.mts +2 -0
- package/src/foundry/common/packages/base-module.d.mts +6 -24
- package/src/foundry/common/packages/base-package.d.mts +18 -16
- package/src/foundry/common/packages/base-system.d.mts +6 -78
- package/src/foundry/common/packages/base-world.d.mts +7 -60
- package/src/foundry/common/packages/sub-types.d.mts +1 -1
- package/src/foundry/common/primitives/array.d.mts +3 -3
- package/src/foundry/common/primitives/math.d.mts +7 -1
- package/src/foundry/common/primitives/number.d.mts +1 -1
- package/src/foundry/common/primitives/set.d.mts +17 -14
- package/src/foundry/common/prosemirror/_types.d.mts +2 -0
- package/src/foundry/common/prosemirror/dropdown.d.mts +1 -1
- package/src/foundry/common/prosemirror/highlight-matches-plugin.d.mts +1 -1
- package/src/foundry/common/prosemirror/menu.d.mts +3 -3
- package/src/foundry/common/prosemirror/plugin.d.mts +1 -1
- package/src/foundry/common/prosemirror/schema/index.d.mts +0 -1
- package/src/foundry/common/prosemirror/util.d.mts +1 -1
- package/src/foundry/common/utils/bitmask.d.mts +4 -1
- package/src/foundry/common/utils/collection.d.mts +59 -24
- package/src/foundry/common/utils/event-emitter.d.mts +46 -19
- package/src/foundry/common/utils/helpers.d.mts +13 -13
- package/src/foundry/common/utils/http.d.mts +2 -2
- package/src/foundry/common/utils/string-tree.d.mts +45 -39
- package/src/foundry/common/utils/word-tree.d.mts +10 -23
- package/src/tsconfig.json +1 -5
- package/src/types/augments/pixi.d.mts +28 -28
- package/src/types/config.d.mts +12 -12
- package/src/types/documentConfiguration.d.mts +282 -597
- package/src/types/lib.d.mts +4 -4
- package/src/types/workers/image-compressor.d.mts +1 -1
- package/src/utils/index.d.mts +255 -60
- package/tsconfig.json +29 -0
- package/tsconfig.main.json +8 -0
- package/tsconfig.miscellaneous.json +16 -0
- package/src/foundry/client/apps/placeables/light-config.d.mts +0 -100
- package/src/foundry/client/apps/placeables/sound-config.d.mts +0 -44
- package/src/foundry/common/documents/module.d.mts +0 -35
@@ -1,69 +1,957 @@
|
|
1
|
-
import type { DeepPartial, InexactPartial } from "fvtt-types/utils";
|
2
|
-
import type
|
3
|
-
import type
|
4
|
-
import type
|
1
|
+
import type { AnyObject, DeepPartial, InexactPartial, InterfaceToObject, Merge } from "fvtt-types/utils";
|
2
|
+
import type { documents } from "#client-esm/client.d.mts";
|
3
|
+
import type Document from "#common/abstract/document.d.mts";
|
4
|
+
import type { DataSchema } from "#common/data/fields.d.mts";
|
5
|
+
import type { ActorDeltaField } from "#common/documents/token.d.mts";
|
6
|
+
import type BaseToken from "#common/documents/token.d.mts";
|
7
|
+
import type { LightData, TextureData } from "#common/data/data.mjs";
|
8
|
+
|
9
|
+
import fields = foundry.data.fields;
|
5
10
|
|
6
11
|
declare global {
|
7
12
|
namespace TokenDocument {
|
8
|
-
|
13
|
+
/**
|
14
|
+
* The document's name.
|
15
|
+
*/
|
16
|
+
type Name = "Token";
|
17
|
+
|
18
|
+
/**
|
19
|
+
* The arguments to construct the document.
|
20
|
+
*/
|
21
|
+
type ConstructorArgs = Document.ConstructorParameters<CreateData, Parent>;
|
22
|
+
|
23
|
+
/**
|
24
|
+
* The documents embedded within `TokenDocument`.
|
25
|
+
*/
|
26
|
+
type Hierarchy = Readonly<Document.HierarchyOf<Schema>>;
|
27
|
+
|
28
|
+
/**
|
29
|
+
* The implementation of the `TokenDocument` document instance configured through `CONFIG.Token.documentClass` in Foundry and
|
30
|
+
* {@link DocumentClassConfig | `DocumentClassConfig`} or {@link ConfiguredTokenDocument | `fvtt-types/configuration/ConfiguredTokenDocument`} in fvtt-types.
|
31
|
+
*/
|
32
|
+
type Implementation = Document.ImplementationFor<Name>;
|
33
|
+
|
34
|
+
/**
|
35
|
+
* The implementation of the `TokenDocument` document configured through `CONFIG.Token.documentClass` in Foundry and
|
36
|
+
* {@link DocumentClassConfig | `DocumentClassConfig`} in fvtt-types.
|
37
|
+
*/
|
38
|
+
type ImplementationClass = Document.ImplementationClassFor<Name>;
|
39
|
+
|
40
|
+
/**
|
41
|
+
* A document's metadata is special information about the document ranging anywhere from its name,
|
42
|
+
* whether it's indexed, or to the permissions a user has over it.
|
43
|
+
*/
|
44
|
+
interface Metadata
|
45
|
+
extends Merge<
|
46
|
+
Document.Metadata.Default,
|
47
|
+
Readonly<{
|
48
|
+
name: "Token";
|
49
|
+
collection: "tokens";
|
50
|
+
label: string;
|
51
|
+
labelPlural: string;
|
52
|
+
isEmbedded: true;
|
53
|
+
embedded: TokenDocument.Metadata.Embedded;
|
54
|
+
permissions: TokenDocument.Metadata.Permissions;
|
55
|
+
schemaVersion: string;
|
56
|
+
}>
|
57
|
+
> {}
|
58
|
+
|
59
|
+
namespace Metadata {
|
60
|
+
/**
|
61
|
+
* The embedded metadata
|
62
|
+
*/
|
63
|
+
interface Embedded {
|
64
|
+
ActorDelta: "delta";
|
65
|
+
}
|
66
|
+
|
67
|
+
/**
|
68
|
+
* The permissions for whether a certain user can create, update, or delete this document.
|
69
|
+
*/
|
70
|
+
interface Permissions {
|
71
|
+
create: "TOKEN_CREATE";
|
72
|
+
update(
|
73
|
+
user: User.Internal.Implementation,
|
74
|
+
doc: TokenDocument.Implementation,
|
75
|
+
data: BaseToken.UpdateData,
|
76
|
+
): boolean;
|
77
|
+
delete: "TOKEN_DELETE";
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
* A document's parent is something that can contain it.
|
83
|
+
* For example an `Item` can be contained by an `Actor` which makes `Actor` one of its possible parents.
|
84
|
+
*/
|
85
|
+
type Parent = Scene.Implementation | null;
|
86
|
+
|
87
|
+
/**
|
88
|
+
* A document's direct descendants are documents that are contained directly within its schema.
|
89
|
+
* This is a union of all such instances, or never if the document doesn't have any descendants.
|
90
|
+
*/
|
91
|
+
type DirectDescendant = ActorDelta.Stored;
|
92
|
+
|
93
|
+
/**
|
94
|
+
* A document's direct descendants are documents that are contained directly within its schema.
|
95
|
+
* This is a union of all such classes, or never if the document doesn't have any descendants.
|
96
|
+
*/
|
97
|
+
type DirectDescendantClass = ActorDelta.ImplementationClass;
|
98
|
+
|
99
|
+
/**
|
100
|
+
* A document's descendants are any documents that are contained within, either within its schema
|
101
|
+
* or its descendant's schemas.
|
102
|
+
* This is a union of all such instances, or never if the document doesn't have any descendants.
|
103
|
+
*/
|
104
|
+
type Descendant = DirectDescendant | ActorDelta.Descendant;
|
105
|
+
|
106
|
+
/**
|
107
|
+
* A document's descendants are any child documents, grandchild documents, etc.
|
108
|
+
* This is a union of all classes, or never if the document doesn't have any descendants.
|
109
|
+
*/
|
110
|
+
type DescendantClass = DirectDescendantClass | ActorDelta.DescendantClass;
|
9
111
|
|
10
|
-
|
11
|
-
|
112
|
+
/**
|
113
|
+
* Types of `CompendiumCollection` this document might be contained in.
|
114
|
+
* Note that `this.pack` will always return a string; this is the type for `game.packs.get(this.pack)`
|
115
|
+
*/
|
116
|
+
type Pack = CompendiumCollection.ForDocument<"Token">;
|
117
|
+
|
118
|
+
/**
|
119
|
+
* An embedded document is a document contained in another.
|
120
|
+
* For example an `Item` can be contained by an `Actor` which means `Item` can be embedded in `Actor`.
|
121
|
+
*
|
122
|
+
* If this is `never` it is because there are no embeddable documents (or there's a bug!).
|
123
|
+
*/
|
124
|
+
type Embedded = Document.ImplementationFor<Embedded.Name>;
|
125
|
+
|
126
|
+
namespace Embedded {
|
127
|
+
/**
|
128
|
+
* An embedded document is a document contained in another.
|
129
|
+
* For example an `Item` can be contained by an `Actor` which means `Item` can be embedded in `Actor`.
|
130
|
+
*
|
131
|
+
* If this is `never` it is because there are no embeddable documents (or there's a bug!).
|
132
|
+
*/
|
133
|
+
type Name = keyof Metadata.Embedded;
|
134
|
+
|
135
|
+
/**
|
136
|
+
* Gets the collection name for an embedded document.
|
137
|
+
*/
|
138
|
+
type CollectionNameOf<CollectionName extends Embedded.CollectionName> = Document.Embedded.CollectionNameFor<
|
139
|
+
Metadata.Embedded,
|
140
|
+
CollectionName
|
141
|
+
>;
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Gets the collection document for an embedded document.
|
145
|
+
*/
|
146
|
+
// TODO(LukeAbby): There's a circularity. Should be `Document.Embedded.CollectionDocumentFor<Metadata.Embedded, CollectionName>`
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
148
|
+
type DocumentFor<CollectionName extends Embedded.CollectionName> = Document.Any;
|
149
|
+
|
150
|
+
/**
|
151
|
+
* Gets the collection for an embedded document.
|
152
|
+
*/
|
153
|
+
type CollectionFor<CollectionName extends Embedded.CollectionName> = Document.Embedded.CollectionFor<
|
154
|
+
// TODO(LukeAbby): This should be `TokenDocument.Implementation` but this causes a circularity.
|
155
|
+
Document.Any,
|
156
|
+
Metadata.Embedded,
|
157
|
+
CollectionName
|
158
|
+
>;
|
159
|
+
|
160
|
+
/**
|
161
|
+
* A valid name to refer to a collection embedded in this document. For example an `Actor`
|
162
|
+
* has the key `"items"` which contains `Item` instance which would make both `"Item" | "Items"`
|
163
|
+
* valid keys (amongst others).
|
164
|
+
*/
|
165
|
+
type CollectionName = Document.Embedded.CollectionName<Metadata.Embedded>;
|
166
|
+
}
|
167
|
+
|
168
|
+
/**
|
169
|
+
* The name of the world or embedded collection this document can find itself in.
|
170
|
+
* For example an `Item` is always going to be inside a collection with a key of `items`.
|
171
|
+
* This is a fixed string per document type and is primarily useful for {@link ClientDocumentMixin | `Descendant Document Events`}.
|
172
|
+
*/
|
173
|
+
type ParentCollectionName = Metadata["collection"];
|
174
|
+
|
175
|
+
/**
|
176
|
+
* The world collection that contains this document type. Will be `never` if none exists.
|
177
|
+
*/
|
178
|
+
type CollectionClass = never;
|
179
|
+
|
180
|
+
/**
|
181
|
+
* The world collection that contains this document type. Will be `never` if none exists.
|
182
|
+
*/
|
183
|
+
type Collection = never;
|
184
|
+
|
185
|
+
/**
|
186
|
+
* An instance of `TokenDocument` that comes from the database but failed validation meaining that
|
187
|
+
* its `system` and `_source` could theoretically be anything.
|
188
|
+
*/
|
189
|
+
interface Invalid extends Document.Invalid<TokenDocument.Implementation> {}
|
190
|
+
|
191
|
+
/**
|
192
|
+
* An instance of `TokenDocument` that comes from the database.
|
193
|
+
*/
|
194
|
+
interface Stored extends Document.Stored<TokenDocument.Implementation> {}
|
12
195
|
|
13
|
-
|
14
|
-
|
196
|
+
/**
|
197
|
+
* The data put in {@link TokenDocument._source | `TokenDocument#_source`}. This data is what was
|
198
|
+
* persisted to the database and therefore it must be valid JSON.
|
199
|
+
*
|
200
|
+
* For example a {@link fields.SetField | `SetField`} is persisted to the database as an array
|
201
|
+
* but initialized as a {@link Set | `Set`}.
|
202
|
+
*/
|
203
|
+
interface Source extends fields.SchemaField.SourceData<Schema> {}
|
204
|
+
|
205
|
+
/**
|
206
|
+
* @deprecated {@link TokenDocument.Source | `TokenDocument.Source`}
|
207
|
+
*/
|
208
|
+
type PersistedData = Source;
|
15
209
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
210
|
+
/**
|
211
|
+
* The data necessary to create a document. Used in places like {@link TokenDocument.create | `TokenDocument.create`}
|
212
|
+
* and {@link TokenDocument | `new TokenDocument(...)`}.
|
213
|
+
*
|
214
|
+
* For example a {@link fields.SetField | `SetField`} can accept any {@link Iterable | `Iterable`}
|
215
|
+
* with the right values. This means you can pass a `Set` instance, an array of values,
|
216
|
+
* a generator, or any other iterable.
|
217
|
+
*/
|
218
|
+
interface CreateData extends fields.SchemaField.CreateData<Schema> {}
|
219
|
+
|
220
|
+
/**
|
221
|
+
* The data after a {@link foundry.abstract.Document | `Document`} has been initialized, for example
|
222
|
+
* {@link TokenDocument.name | `TokenDocument#name`}.
|
223
|
+
*
|
224
|
+
* This is data transformed from {@link TokenDocument.Source | `TokenDocument.Source`} and turned into more
|
225
|
+
* convenient runtime data structures. For example a {@link fields.SetField | `SetField`} is
|
226
|
+
* persisted to the database as an array of values but at runtime it is a `Set` instance.
|
227
|
+
*/
|
228
|
+
interface InitializedData extends fields.SchemaField.InitializedData<Schema> {}
|
229
|
+
|
230
|
+
/**
|
231
|
+
* The data used to update a document, for example {@link TokenDocument.update | `TokenDocument#update`}.
|
232
|
+
* It is a distinct type from {@link TokenDocument.CreateData | `DeepPartial<TokenDocument.CreateData>`} because
|
233
|
+
* it has different rules for `null` and `undefined`.
|
234
|
+
*/
|
235
|
+
interface UpdateData extends fields.SchemaField.UpdateData<Schema> {}
|
236
|
+
|
237
|
+
/**
|
238
|
+
* Schema definition shared by {@link foundry.data.PrototypeToken | `PrototypeToken`}.
|
239
|
+
* Foundry technically implements this through deletion, but it's easier for us to do by extension as there are field
|
240
|
+
* option overrides (e.g `textSearch` on `name`) that cause type issues otherwise.
|
241
|
+
*/
|
242
|
+
interface SharedProtoSchema extends DataSchema {
|
243
|
+
// `name` omitted here because, while it is not in the list of omitted fields for `PrototypeToken`, it's `textSearch: true` in the base schema, but overridden to `false` in `PrototypeToken`
|
244
|
+
|
245
|
+
/**
|
246
|
+
* The display mode of the Token nameplate, from CONST.TOKEN_DISPLAY_MODES
|
247
|
+
* @defaultValue `CONST.TOKEN_DISPLAY_MODES.NONE` (`0`)
|
248
|
+
*/
|
249
|
+
displayName: fields.NumberField<
|
21
250
|
{
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
teleport: boolean;
|
27
|
-
forced: boolean;
|
251
|
+
required: true;
|
252
|
+
initial: typeof CONST.TOKEN_DISPLAY_MODES.NONE;
|
253
|
+
choices: CONST.TOKEN_DISPLAY_MODES[];
|
254
|
+
validationError: "must be a value in CONST.TOKEN_DISPLAY_MODES";
|
28
255
|
},
|
29
|
-
|
30
|
-
|
31
|
-
|
256
|
+
// FIXME: Without these overrides, the branded type from `choices` is not respected, and the field types as `number`
|
257
|
+
CONST.TOKEN_DISPLAY_MODES | null | undefined,
|
258
|
+
CONST.TOKEN_DISPLAY_MODES,
|
259
|
+
CONST.TOKEN_DISPLAY_MODES
|
260
|
+
>;
|
261
|
+
|
262
|
+
/**
|
263
|
+
* Does this Token uniquely represent a singular Actor, or is it one of many?
|
264
|
+
* @defaultValue `false`
|
265
|
+
*/
|
266
|
+
actorLink: fields.BooleanField;
|
267
|
+
|
268
|
+
appendNumber: fields.BooleanField;
|
269
|
+
|
270
|
+
prependAdjective: fields.BooleanField;
|
271
|
+
|
272
|
+
/**
|
273
|
+
* The width of the Token in grid units
|
274
|
+
* @defaultValue `1`
|
275
|
+
*/
|
276
|
+
width: fields.NumberField<{ nullable: false; positive: true; initial: 1; step: 0.5; label: "Width" }>;
|
277
|
+
|
278
|
+
/**
|
279
|
+
* The height of the Token in grid units
|
280
|
+
* @defaultValue `1`
|
281
|
+
*/
|
282
|
+
height: fields.NumberField<{ nullable: false; positive: true; initial: 1; step: 0.5; label: "Height" }>;
|
283
|
+
|
284
|
+
/**
|
285
|
+
* The token's texture on the canvas.
|
286
|
+
*/
|
287
|
+
texture: TextureData<{
|
288
|
+
initial: {
|
289
|
+
src: () => typeof BaseToken.DEFAULT_ICON;
|
290
|
+
anchorX: 0.5;
|
291
|
+
anchorY: 0.5;
|
292
|
+
fit: "contain";
|
293
|
+
alphaThreshold: 0.75;
|
294
|
+
};
|
295
|
+
wildcard: true;
|
296
|
+
}>;
|
297
|
+
|
298
|
+
/**
|
299
|
+
* @defaultValue `CONST.TOKEN_HEXAGONAL_SHAPES.ELLIPSE_1` (`0`)
|
300
|
+
*/
|
301
|
+
hexagonalShape: fields.NumberField<
|
302
|
+
{
|
303
|
+
initial: typeof CONST.TOKEN_HEXAGONAL_SHAPES.ELLIPSE_1;
|
304
|
+
choices: CONST.TOKEN_HEXAGONAL_SHAPES[];
|
305
|
+
},
|
306
|
+
// FIXME: Without these overrides, the branded type from `choices` is not respected, and the field types as `number`
|
307
|
+
CONST.TOKEN_HEXAGONAL_SHAPES | null | undefined,
|
308
|
+
CONST.TOKEN_HEXAGONAL_SHAPES,
|
309
|
+
CONST.TOKEN_HEXAGONAL_SHAPES
|
310
|
+
>;
|
311
|
+
|
312
|
+
/**
|
313
|
+
* Prevent the Token image from visually rotating?
|
314
|
+
* @defaultValue `false`
|
315
|
+
*/
|
316
|
+
lockRotation: fields.BooleanField;
|
317
|
+
|
318
|
+
/**
|
319
|
+
* The rotation of the Token in degrees, from 0 to 360. A value of 0 represents a southward-facing Token.
|
320
|
+
* @defaultValue `0`
|
321
|
+
*/
|
322
|
+
rotation: fields.AngleField;
|
323
|
+
|
324
|
+
/**
|
325
|
+
* The opacity of the token image
|
326
|
+
* @defaultValue `1`
|
327
|
+
*/
|
328
|
+
alpha: fields.AlphaField;
|
329
|
+
|
330
|
+
/**
|
331
|
+
* A displayed Token disposition from CONST.TOKEN_DISPOSITIONS
|
332
|
+
* @defaultValue `CONST.TOKEN_DISPOSITIONS.HOSTILE` (`-1`)
|
333
|
+
*/
|
334
|
+
disposition: fields.NumberField<
|
335
|
+
{
|
336
|
+
required: true;
|
337
|
+
choices: CONST.TOKEN_DISPOSITIONS[];
|
338
|
+
initial: typeof CONST.TOKEN_DISPOSITIONS.HOSTILE;
|
339
|
+
validationError: "must be a value in CONST.TOKEN_DISPOSITIONS";
|
340
|
+
},
|
341
|
+
// FIXME: Without these overrides, the branded type from `choices` is not respected, and the field types as `number`
|
342
|
+
CONST.TOKEN_DISPOSITIONS | null | undefined,
|
343
|
+
CONST.TOKEN_DISPOSITIONS,
|
344
|
+
CONST.TOKEN_DISPOSITIONS
|
345
|
+
>;
|
346
|
+
|
347
|
+
/**
|
348
|
+
* The display mode of Token resource bars, from CONST.TOKEN_DISPLAY_MODES
|
349
|
+
* @defaultValue `CONST.TOKEN_DISPLAY_MODES.NONE` (`0`)
|
350
|
+
*/
|
351
|
+
displayBars: fields.NumberField<
|
352
|
+
{
|
353
|
+
required: true;
|
354
|
+
choices: CONST.TOKEN_DISPLAY_MODES[];
|
355
|
+
initial: typeof CONST.TOKEN_DISPLAY_MODES.NONE;
|
356
|
+
validationError: "must be a value in CONST.TOKEN_DISPLAY_MODES";
|
357
|
+
},
|
358
|
+
// FIXME: Without these overrides, the branded type from `choices` is not respected, and the field types as `number`
|
359
|
+
CONST.TOKEN_DISPLAY_MODES | null | undefined,
|
360
|
+
CONST.TOKEN_DISPLAY_MODES,
|
361
|
+
CONST.TOKEN_DISPLAY_MODES
|
362
|
+
>;
|
363
|
+
|
364
|
+
/**
|
365
|
+
* The configuration of the Token's primary resource bar
|
366
|
+
* @defaultValue see property
|
367
|
+
*/
|
368
|
+
bar1: fields.SchemaField<{
|
369
|
+
/**
|
370
|
+
* The attribute path within the Token's Actor data which should be displayed
|
371
|
+
* @defaultValue `game?.system.primaryTokenAttribute || null`
|
372
|
+
*/
|
373
|
+
attribute: fields.StringField<{
|
374
|
+
required: true;
|
375
|
+
nullable: true;
|
376
|
+
blank: false;
|
377
|
+
initial: () => string | null;
|
378
|
+
}>;
|
379
|
+
}>;
|
380
|
+
|
381
|
+
/**
|
382
|
+
* The configuration of the Token's secondary resource bar
|
383
|
+
* @defaultValue see property
|
384
|
+
*/
|
385
|
+
bar2: fields.SchemaField<{
|
386
|
+
/**
|
387
|
+
* The attribute path within the Token's Actor data which should be displayed
|
388
|
+
* @defaultValue `game?.system.secondaryTokenAttribute || null`
|
389
|
+
*/
|
390
|
+
attribute: fields.StringField<{
|
391
|
+
required: true;
|
392
|
+
nullable: true;
|
393
|
+
blank: false;
|
394
|
+
initial: () => string | null;
|
395
|
+
}>;
|
396
|
+
}>;
|
397
|
+
|
398
|
+
/**
|
399
|
+
* Configuration of the light source that this Token emits
|
400
|
+
* @defaultValue see {@link LightData | `LightData`}
|
401
|
+
*/
|
402
|
+
light: fields.EmbeddedDataField<typeof LightData>;
|
403
|
+
|
404
|
+
/**
|
405
|
+
* Configuration of sight and vision properties for the Token
|
406
|
+
* @defaultValue see properties
|
407
|
+
* @privateRemarks Foundry has this split out into its own `@typedef TokenSightData`, but it's never
|
408
|
+
* referenced outside `@typedef TokenData`, so no need for a separate interface
|
409
|
+
*/
|
410
|
+
sight: fields.SchemaField<{
|
411
|
+
/**
|
412
|
+
* Should vision computation and rendering be active for this Token?
|
413
|
+
* @defaultValue `true`, when the token's sight range is greater than 0
|
414
|
+
*/
|
415
|
+
enabled: fields.BooleanField<{ initial: (data: unknown) => boolean }>;
|
416
|
+
|
417
|
+
/**
|
418
|
+
* How far in distance units the Token can see without the aid of a light source
|
419
|
+
* @defaultValue `0`
|
420
|
+
*/
|
421
|
+
range: fields.NumberField<{ required: true; nullable: true; min: 0; step: 0.01; initial: 0 }>;
|
422
|
+
|
423
|
+
/**
|
424
|
+
* An angle at which the Token can see relative to their direction of facing
|
425
|
+
* @defaultValue `360`
|
426
|
+
*/
|
427
|
+
angle: fields.AngleField<{ initial: 360; normalize: false }>;
|
428
|
+
|
429
|
+
/**
|
430
|
+
* The vision mode which is used to render the appearance of the visible area
|
431
|
+
* @defaultValue `"basic"`
|
432
|
+
*/
|
433
|
+
visionMode: fields.StringField<{
|
434
|
+
required: true;
|
435
|
+
blank: false;
|
436
|
+
initial: "basic";
|
437
|
+
label: "TOKEN.VisionMode";
|
438
|
+
hint: "TOKEN.VisionModeHint";
|
439
|
+
}>;
|
440
|
+
|
441
|
+
/**
|
442
|
+
* A special color which applies a hue to the visible area
|
443
|
+
* @defaultValue `null`
|
444
|
+
*/
|
445
|
+
color: fields.ColorField<{ label: "TOKEN.VisionColor" }>;
|
446
|
+
|
447
|
+
/**
|
448
|
+
* A degree of attenuation which gradually fades the edges of the visible area
|
449
|
+
* @defaultValue `0.1`
|
450
|
+
*/
|
451
|
+
attenuation: fields.AlphaField<{
|
452
|
+
initial: 0.1;
|
453
|
+
label: "TOKEN.VisionAttenuation";
|
454
|
+
hint: "TOKEN.VisionAttenuationHint";
|
455
|
+
}>;
|
456
|
+
|
457
|
+
/**
|
458
|
+
* An advanced customization for the perceived brightness of the visible area
|
459
|
+
* @defaultValue `0`
|
460
|
+
*/
|
461
|
+
brightness: fields.NumberField<{
|
462
|
+
required: true;
|
463
|
+
nullable: false;
|
464
|
+
initial: 0;
|
465
|
+
min: -1;
|
466
|
+
max: 1;
|
467
|
+
label: "TOKEN.VisionBrightness";
|
468
|
+
hint: "TOKEN.VisionBrightnessHint";
|
469
|
+
}>;
|
470
|
+
|
471
|
+
/**
|
472
|
+
* An advanced customization of color saturation within the visible area
|
473
|
+
* @defaultValue `0`
|
474
|
+
*/
|
475
|
+
saturation: fields.NumberField<{
|
476
|
+
required: true;
|
477
|
+
nullable: false;
|
478
|
+
initial: 0;
|
479
|
+
min: -1;
|
480
|
+
max: 1;
|
481
|
+
label: "TOKEN.VisionSaturation";
|
482
|
+
hint: "TOKEN.VisionSaturationHint";
|
483
|
+
}>;
|
484
|
+
|
485
|
+
/**
|
486
|
+
* An advanced customization for contrast within the visible area
|
487
|
+
* @defaultValue `0`
|
488
|
+
*/
|
489
|
+
contrast: fields.NumberField<{
|
490
|
+
required: true;
|
491
|
+
nullable: false;
|
492
|
+
initial: 0;
|
493
|
+
min: -1;
|
494
|
+
max: 1;
|
495
|
+
label: "TOKEN.VisionContrast";
|
496
|
+
hint: "TOKEN.VisionContrastHint";
|
497
|
+
}>;
|
498
|
+
}>;
|
499
|
+
|
500
|
+
/**
|
501
|
+
* An array of detection modes which are available to this Token
|
502
|
+
* @defaultValue `[]`
|
503
|
+
* @remarks The validation function is a `BaseToken.#validateDetectionModes` reference, which throws if there's a duplicate mode ID
|
504
|
+
*/
|
505
|
+
detectionModes: fields.ArrayField<
|
506
|
+
fields.SchemaField<{
|
507
|
+
/**
|
508
|
+
* The id of the detection mode, a key from CONFIG.Canvas.detectionModes
|
509
|
+
* @defaultValue `""`
|
510
|
+
*/
|
511
|
+
id: fields.StringField;
|
512
|
+
|
513
|
+
/**
|
514
|
+
* Whether or not this detection mode is presently enabled
|
515
|
+
* @defaultValue `true`
|
516
|
+
*/
|
517
|
+
enabled: fields.BooleanField<{ initial: true }>;
|
518
|
+
|
519
|
+
/**
|
520
|
+
* The maximum range in distance units at which this mode can detect targets
|
521
|
+
* @defaultValue `null`
|
522
|
+
*/
|
523
|
+
range: fields.NumberField<{ required: true; min: 0; step: 0.01 }>;
|
524
|
+
}>,
|
525
|
+
{
|
526
|
+
validate: () => void;
|
527
|
+
}
|
528
|
+
>;
|
529
|
+
|
530
|
+
/**
|
531
|
+
* @defaultValue see properties
|
532
|
+
*/
|
533
|
+
occludable: fields.SchemaField<{
|
534
|
+
/**
|
535
|
+
* @defaultValue `0`
|
536
|
+
*/
|
537
|
+
radius: fields.NumberField<{ nullable: false; min: 0; step: 0.01; initial: 0 }>;
|
538
|
+
}>;
|
539
|
+
|
540
|
+
/**
|
541
|
+
* @defaultValue see properties
|
542
|
+
*/
|
543
|
+
ring: fields.SchemaField<{
|
544
|
+
/**
|
545
|
+
* @defaultValue `false`
|
546
|
+
*/
|
547
|
+
enabled: fields.BooleanField;
|
548
|
+
|
549
|
+
/**
|
550
|
+
* @defaultValue see properties
|
551
|
+
*/
|
552
|
+
colors: fields.SchemaField<{
|
553
|
+
/**
|
554
|
+
* @defaultValue `null`
|
555
|
+
*/
|
556
|
+
ring: fields.ColorField;
|
557
|
+
|
558
|
+
/**
|
559
|
+
* @defaultValue `null`
|
560
|
+
*/
|
561
|
+
background: fields.ColorField;
|
562
|
+
}>;
|
563
|
+
|
564
|
+
/**
|
565
|
+
* @defaultValue `1`
|
566
|
+
*/
|
567
|
+
effects: fields.NumberField<{ initial: 1; min: 0; max: 0x7fffff; integer: true }>;
|
568
|
+
|
569
|
+
/**
|
570
|
+
* @defaultValue see properties
|
571
|
+
*/
|
572
|
+
subject: fields.SchemaField<{
|
573
|
+
/**
|
574
|
+
* @defaultValue `1`
|
575
|
+
*/
|
576
|
+
scale: fields.NumberField<{ initial: 1; min: 0.5 }>;
|
577
|
+
|
578
|
+
/**
|
579
|
+
* @defaultValue `null`
|
580
|
+
*/
|
581
|
+
texture: fields.FilePathField<{ categories: ["IMAGE"] }>;
|
582
|
+
}>;
|
583
|
+
}>;
|
584
|
+
|
585
|
+
/**
|
586
|
+
* @remarks Foundry marked `@internal`
|
587
|
+
*/
|
588
|
+
_regions: fields.ArrayField<fields.ForeignDocumentField<typeof documents.BaseRegion, { idOnly: true }>>;
|
589
|
+
|
590
|
+
/**
|
591
|
+
* An object of optional key/value flags
|
592
|
+
* @defaultValue `{}`
|
593
|
+
*/
|
594
|
+
flags: fields.ObjectField.FlagsField<Name, InterfaceToObject<CoreFlags>>;
|
595
|
+
}
|
596
|
+
|
597
|
+
/**
|
598
|
+
* The schema for {@link TokenDocument | `TokenDocument`}. This is the source of truth for how an TokenDocument document
|
599
|
+
* must be structured.
|
600
|
+
*
|
601
|
+
* Foundry uses this schema to validate the structure of the {@link TokenDocument | `TokenDocument`}. For example
|
602
|
+
* a {@link fields.StringField | `StringField`} will enforce that the value is a string. More
|
603
|
+
* complex fields like {@link fields.SetField | `SetField`} goes through various conversions
|
604
|
+
* starting as an array in the database, initialized as a set, and allows updates with any
|
605
|
+
* iterable.
|
606
|
+
*/
|
607
|
+
interface Schema extends SharedProtoSchema {
|
608
|
+
/**
|
609
|
+
* The Token _id which uniquely identifies it within its parent Scene
|
610
|
+
* @defaultValue `null`
|
611
|
+
*/
|
612
|
+
_id: fields.DocumentIdField;
|
613
|
+
|
614
|
+
/**
|
615
|
+
* The name used to describe the Token
|
616
|
+
* @defaultValue `""`
|
617
|
+
*/
|
618
|
+
name: fields.StringField<{ required: true; blank: true; textSearch: true }>;
|
619
|
+
|
620
|
+
/**
|
621
|
+
* The _id of an Actor document which this Token represents
|
622
|
+
* @defaultValue `null`
|
623
|
+
*/
|
624
|
+
actorId: fields.ForeignDocumentField<typeof documents.BaseActor, { idOnly: true }>;
|
625
|
+
|
626
|
+
/**
|
627
|
+
* The ActorDelta embedded document which stores the differences between this
|
628
|
+
* token and the base actor it represents.
|
629
|
+
*/
|
630
|
+
delta: ActorDeltaField<typeof documents.BaseActor>;
|
631
|
+
|
632
|
+
/**
|
633
|
+
* The x-coordinate of the top-left corner of the Token
|
634
|
+
* @defaultValue `0`
|
635
|
+
*/
|
636
|
+
x: fields.NumberField<{ required: true; integer: true; nullable: false; initial: 0; label: "XCoord" }>;
|
637
|
+
|
638
|
+
/**
|
639
|
+
* The y-coordinate of the top-left corner of the Token
|
640
|
+
* @defaultValue `0`
|
641
|
+
*/
|
642
|
+
y: fields.NumberField<{ required: true; integer: true; nullable: false; initial: 0; label: "YCoord" }>;
|
643
|
+
|
644
|
+
/**
|
645
|
+
* The vertical elevation of the Token, in distance units
|
646
|
+
* @defaultValue `0`
|
647
|
+
*/
|
648
|
+
elevation: fields.NumberField<{ required: true; nullable: false; initial: 0 }>;
|
32
649
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
650
|
+
/**
|
651
|
+
* Is the Token currently locked? A locked token cannot be moved or rotated via
|
652
|
+
* standard keyboard or mouse interaction.
|
653
|
+
* @defaultValue `false`
|
654
|
+
*/
|
655
|
+
locked: fields.BooleanField;
|
656
|
+
|
657
|
+
/**
|
658
|
+
* The z-index of this token relative to other siblings
|
659
|
+
* @defaultValue `0`
|
660
|
+
*/
|
661
|
+
sort: fields.NumberField<{ required: true; integer: true; nullable: false; initial: 0 }>;
|
662
|
+
|
663
|
+
/**
|
664
|
+
* Is the Token currently hidden from player view?
|
665
|
+
* @defaultValue `false`
|
666
|
+
*/
|
667
|
+
hidden: fields.BooleanField;
|
668
|
+
}
|
669
|
+
|
670
|
+
namespace Database {
|
671
|
+
/** Options passed along in Get operations for TokenDocuments */
|
672
|
+
interface Get extends foundry.abstract.types.DatabaseGetOperation<TokenDocument.Parent> {}
|
673
|
+
|
674
|
+
/** Options passed along in Create operations for TokenDocuments */
|
675
|
+
interface Create<Temporary extends boolean | undefined = boolean | undefined>
|
676
|
+
extends foundry.abstract.types.DatabaseCreateOperation<
|
677
|
+
TokenDocument.CreateData,
|
678
|
+
TokenDocument.Parent,
|
679
|
+
Temporary
|
680
|
+
> {}
|
681
|
+
|
682
|
+
/** Options passed along in Delete operations for TokenDocuments */
|
683
|
+
interface Delete extends foundry.abstract.types.DatabaseDeleteOperation<TokenDocument.Parent> {}
|
684
|
+
|
685
|
+
/** Options passed along in Update operations for TokenDocuments */
|
686
|
+
interface Update
|
687
|
+
extends foundry.abstract.types.DatabaseUpdateOperation<TokenDocument.UpdateData, TokenDocument.Parent> {
|
688
|
+
previousActorId?: string | null;
|
689
|
+
animate?: boolean;
|
690
|
+
_priorRegions?: Record<string, string[]>;
|
691
|
+
_priorPosition?: Record<string, { x: number; y: number; elevation: number }>;
|
692
|
+
teleport?: boolean;
|
693
|
+
forced?: boolean;
|
694
|
+
// TODO: Type this accurately when going over the Token placeable
|
695
|
+
animation: AnyObject;
|
696
|
+
}
|
697
|
+
|
698
|
+
/** Operation for {@link TokenDocument.createDocuments | `TokenDocument.createDocuments`} */
|
699
|
+
interface CreateDocumentsOperation<Temporary extends boolean | undefined>
|
700
|
+
extends Document.Database.CreateOperation<TokenDocument.Database.Create<Temporary>> {}
|
701
|
+
|
702
|
+
/** Operation for {@link TokenDocument.updateDocuments | `TokenDocument.updateDocuments`} */
|
703
|
+
interface UpdateDocumentsOperation
|
704
|
+
extends Document.Database.UpdateDocumentsOperation<TokenDocument.Database.Update> {}
|
705
|
+
|
706
|
+
/** Operation for {@link TokenDocument.deleteDocuments | `TokenDocument.deleteDocuments`} */
|
707
|
+
interface DeleteDocumentsOperation
|
708
|
+
extends Document.Database.DeleteDocumentsOperation<TokenDocument.Database.Delete> {}
|
709
|
+
|
710
|
+
/** Operation for {@link TokenDocument.create | `TokenDocument.create`} */
|
711
|
+
interface CreateOperation<Temporary extends boolean | undefined>
|
712
|
+
extends Document.Database.CreateOperation<TokenDocument.Database.Create<Temporary>> {}
|
713
|
+
|
714
|
+
/** Operation for {@link TokenDocument.update | `TokenDocument#update`} */
|
715
|
+
interface UpdateOperation extends Document.Database.UpdateOperation<Update> {}
|
716
|
+
|
717
|
+
interface DeleteOperation extends Document.Database.DeleteOperation<Delete> {}
|
718
|
+
|
719
|
+
/** Options for {@link TokenDocument.get | `TokenDocument.get`} */
|
720
|
+
interface GetOptions extends Document.Database.GetOptions {}
|
721
|
+
|
722
|
+
/** Options for {@link TokenDocument._preCreate | `TokenDocument#_preCreate`} */
|
723
|
+
interface PreCreateOptions extends Document.Database.PreCreateOptions<Create> {}
|
724
|
+
|
725
|
+
/** Options for {@link TokenDocument._onCreate | `TokenDocument#_onCreate`} */
|
726
|
+
interface OnCreateOptions extends Document.Database.CreateOptions<Create> {}
|
727
|
+
|
728
|
+
/** Operation for {@link TokenDocument._preCreateOperation | `TokenDocument._preCreateOperation`} */
|
729
|
+
interface PreCreateOperation extends Document.Database.PreCreateOperationStatic<TokenDocument.Database.Create> {}
|
730
|
+
|
731
|
+
/** Operation for {@link TokenDocument._onCreateOperation | `TokenDocument#_onCreateOperation`} */
|
732
|
+
interface OnCreateOperation extends TokenDocument.Database.Create {}
|
733
|
+
|
734
|
+
/** Options for {@link TokenDocument._preUpdate | `TokenDocument#_preUpdate`} */
|
735
|
+
interface PreUpdateOptions extends Document.Database.PreUpdateOptions<Update> {}
|
736
|
+
|
737
|
+
/** Options for {@link TokenDocument._onUpdate | `TokenDocument#_onUpdate`} */
|
738
|
+
interface OnUpdateOptions extends Document.Database.UpdateOptions<Update> {}
|
739
|
+
|
740
|
+
/** Operation for {@link TokenDocument._preUpdateOperation | `TokenDocument._preUpdateOperation`} */
|
741
|
+
interface PreUpdateOperation extends TokenDocument.Database.Update {}
|
742
|
+
|
743
|
+
/** Operation for {@link TokenDocument._onUpdateOperation | `TokenDocument._preUpdateOperation`} */
|
744
|
+
interface OnUpdateOperation extends TokenDocument.Database.Update {}
|
745
|
+
|
746
|
+
/** Options for {@link TokenDocument._preDelete | `TokenDocument#_preDelete`} */
|
747
|
+
interface PreDeleteOptions extends Document.Database.PreDeleteOperationInstance<Delete> {}
|
748
|
+
|
749
|
+
/** Options for {@link TokenDocument._onDelete | `TokenDocument#_onDelete`} */
|
750
|
+
interface OnDeleteOptions extends Document.Database.DeleteOptions<Delete> {}
|
751
|
+
|
752
|
+
/** Options for {@link TokenDocument._preDeleteOperation | `TokenDocument#_preDeleteOperation`} */
|
753
|
+
interface PreDeleteOperation extends TokenDocument.Database.Delete {}
|
754
|
+
|
755
|
+
/** Options for {@link TokenDocument._onDeleteOperation | `TokenDocument#_onDeleteOperation`} */
|
756
|
+
interface OnDeleteOperation extends TokenDocument.Database.Delete {}
|
757
|
+
|
758
|
+
/** Context for {@link TokenDocument._onDeleteOperation | `TokenDocument._onDeleteOperation`} */
|
759
|
+
interface OnDeleteDocumentsContext extends Document.ModificationContext<TokenDocument.Parent> {}
|
760
|
+
|
761
|
+
/** Context for {@link TokenDocument._onCreateDocuments | `TokenDocument._onCreateDocuments`} */
|
762
|
+
interface OnCreateDocumentsContext extends Document.ModificationContext<TokenDocument.Parent> {}
|
763
|
+
|
764
|
+
/** Context for {@link TokenDocument._onUpdateDocuments | `TokenDocument._onUpdateDocuments`} */
|
765
|
+
interface OnUpdateDocumentsContext extends Document.ModificationContext<TokenDocument.Parent> {}
|
766
|
+
|
767
|
+
/**
|
768
|
+
* Options for {@link TokenDocument._preCreateDescendantDocuments | `TokenDocument#_preCreateDescendantDocuments`}
|
769
|
+
* and {@link TokenDocument._onCreateDescendantDocuments | `TokenDocument#_onCreateDescendantDocuments`}
|
770
|
+
*/
|
771
|
+
interface CreateOptions extends Document.Database.CreateOptions<TokenDocument.Database.Create> {}
|
772
|
+
|
773
|
+
/**
|
774
|
+
* Options for {@link TokenDocument._preUpdateDescendantDocuments | `TokenDocument#_preUpdateDescendantDocuments`}
|
775
|
+
* and {@link TokenDocument._onUpdateDescendantDocuments | `TokenDocument#_onUpdateDescendantDocuments`}
|
776
|
+
*/
|
777
|
+
interface UpdateOptions extends Document.Database.UpdateOptions<TokenDocument.Database.Update> {}
|
778
|
+
|
779
|
+
/**
|
780
|
+
* Options for {@link TokenDocument._preDeleteDescendantDocuments | `TokenDocument#_preDeleteDescendantDocuments`}
|
781
|
+
* and {@link TokenDocument._onDeleteDescendantDocuments | `TokenDocument#_onDeleteDescendantDocuments`}
|
782
|
+
*/
|
783
|
+
interface DeleteOptions extends Document.Database.DeleteOptions<TokenDocument.Database.Delete> {}
|
784
|
+
}
|
785
|
+
|
786
|
+
/**
|
787
|
+
* The flags that are available for this document in the form `{ [scope: string]: { [key: string]: unknown } }`.
|
788
|
+
*/
|
789
|
+
interface Flags extends Document.ConfiguredFlagsForName<Name> {}
|
790
|
+
|
791
|
+
namespace Flags {
|
792
|
+
/**
|
793
|
+
* The valid scopes for the flags on this document e.g. `"core"` or `"dnd5e"`.
|
794
|
+
*/
|
795
|
+
type Scope = Document.FlagKeyOf<Flags>;
|
796
|
+
|
797
|
+
/**
|
798
|
+
* The valid keys for a certain scope for example if the scope is "core" then a valid key may be `"sheetLock"` or `"viewMode"`.
|
799
|
+
*/
|
800
|
+
type Key<Scope extends Flags.Scope> = Document.FlagKeyOf<Document.FlagGetKey<Flags, Scope>>;
|
801
|
+
|
802
|
+
/**
|
803
|
+
* Gets the type of a particular flag given a `Scope` and a `Key`.
|
804
|
+
*/
|
805
|
+
type Get<Scope extends Flags.Scope, Key extends Flags.Key<Scope>> = Document.GetFlag<Name, Scope, Key>;
|
806
|
+
}
|
807
|
+
|
808
|
+
interface CoreFlags {
|
809
|
+
core?: {
|
810
|
+
/** @remarks If provided, will be used for any light animations emanating from this token */
|
811
|
+
animationSeed?: number;
|
812
|
+
|
813
|
+
/** @remarks If true, and texture.src is a video, it will jump to a random timestamp every time the token is drawn */
|
814
|
+
randomizeVideo?: boolean;
|
815
|
+
};
|
816
|
+
}
|
817
|
+
|
818
|
+
type PreCreateDescendantDocumentsArgs =
|
819
|
+
| Document.PreCreateDescendantDocumentsArgs<
|
820
|
+
TokenDocument.Stored,
|
821
|
+
TokenDocument.DirectDescendant,
|
822
|
+
TokenDocument.Metadata.Embedded
|
823
|
+
>
|
824
|
+
| ActorDelta.PreCreateDescendantDocumentsArgs;
|
825
|
+
|
826
|
+
type OnCreateDescendantDocumentsArgs =
|
827
|
+
| Document.OnCreateDescendantDocumentsArgs<
|
828
|
+
TokenDocument.Stored,
|
829
|
+
TokenDocument.DirectDescendant,
|
830
|
+
TokenDocument.Metadata.Embedded
|
831
|
+
>
|
832
|
+
| ActorDelta.OnCreateDescendantDocumentsArgs;
|
833
|
+
|
834
|
+
type PreUpdateDescendantDocumentsArgs =
|
835
|
+
| Document.PreUpdateDescendantDocumentsArgs<
|
836
|
+
TokenDocument.Stored,
|
837
|
+
TokenDocument.DirectDescendant,
|
838
|
+
TokenDocument.Metadata.Embedded
|
839
|
+
>
|
840
|
+
| ActorDelta.PreUpdateDescendantDocumentsArgs;
|
841
|
+
|
842
|
+
type OnUpdateDescendantDocumentsArgs =
|
843
|
+
| Document.OnUpdateDescendantDocumentsArgs<
|
844
|
+
TokenDocument.Stored,
|
845
|
+
TokenDocument.DirectDescendant,
|
846
|
+
TokenDocument.Metadata.Embedded
|
847
|
+
>
|
848
|
+
| ActorDelta.OnUpdateDescendantDocumentsArgs;
|
849
|
+
|
850
|
+
type PreDeleteDescendantDocumentsArgs =
|
851
|
+
| Document.PreDeleteDescendantDocumentsArgs<
|
852
|
+
TokenDocument.Stored,
|
853
|
+
TokenDocument.DirectDescendant,
|
854
|
+
TokenDocument.Metadata.Embedded
|
855
|
+
>
|
856
|
+
| ActorDelta.PreDeleteDescendantDocumentsArgs;
|
857
|
+
|
858
|
+
type OnDeleteDescendantDocumentsArgs =
|
859
|
+
| Document.OnDeleteDescendantDocumentsArgs<
|
860
|
+
TokenDocument.Stored,
|
861
|
+
TokenDocument.DirectDescendant,
|
862
|
+
TokenDocument.Metadata.Embedded
|
863
|
+
>
|
864
|
+
| ActorDelta.OnDeleteDescendantDocumentsArgs;
|
865
|
+
|
866
|
+
/**
|
867
|
+
* @deprecated {@link TokenDocument.Database | `TokenDocument.DatabaseOperation`}
|
868
|
+
*/
|
869
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
870
|
+
interface DatabaseOperations extends Document.Database.Operations<TokenDocument.Implementation> {}
|
871
|
+
|
872
|
+
/**
|
873
|
+
* @deprecated {@link TokenDocument.CreateData | `TokenDocument.CreateData`}
|
874
|
+
*/
|
875
|
+
interface ConstructorData extends TokenDocument.CreateData {}
|
876
|
+
|
877
|
+
/**
|
878
|
+
* @deprecated {@link TokenDocument.implementation | `TokenDocument.ImplementationClass`}
|
879
|
+
*/
|
880
|
+
type ConfiguredClass = ImplementationClass;
|
881
|
+
|
882
|
+
/**
|
883
|
+
* @deprecated {@link TokenDocument.Implementation | `TokenDocument.Implementation`}
|
884
|
+
*/
|
885
|
+
type ConfiguredInstance = Implementation;
|
886
|
+
|
887
|
+
// The getBarAttribute monkeypatch is simply inside the data model definition at `src\foundry\common\data\data.d.mts`
|
888
|
+
|
889
|
+
interface TrackedAttributesDescription {
|
890
|
+
/** A list of property path arrays to attributes with both a value and a max property. */
|
891
|
+
bar: string[][];
|
892
|
+
/** A list of property path arrays to attributes that have only a value property. */
|
893
|
+
value: string[][];
|
894
|
+
}
|
895
|
+
|
896
|
+
interface CreateCombatantOptions {
|
897
|
+
/**
|
898
|
+
* A specific Combat instance which should be modified. If undefined,
|
899
|
+
* the current active combat will be modified if one exists. Otherwise, a new
|
900
|
+
* Combat encounter will be created if the requesting user is a Gamemaster.
|
901
|
+
*/
|
902
|
+
combat?: Combat.Implementation | undefined;
|
903
|
+
}
|
904
|
+
|
905
|
+
interface ToggleCombatantOptions extends InexactPartial<TokenDocument.CreateCombatantOptions> {
|
906
|
+
/**
|
907
|
+
* Require this token to be an active Combatant or to be removed.
|
908
|
+
* Otherwise, the current combat state of the Token is toggled.
|
909
|
+
*/
|
910
|
+
active: boolean;
|
911
|
+
}
|
912
|
+
|
913
|
+
type GetBarAttributeReturn = SingleAttributeBar | ObjectAttributeBar | null;
|
914
|
+
|
915
|
+
type GetEmbeddedCollectionName = Embedded.CollectionName | "Actor" | "Item" | "ActiveEffect";
|
916
|
+
|
917
|
+
// TODO(LukeAbby): Simplified for now to prevent circularities. The correct implementation would
|
918
|
+
// be this:
|
919
|
+
// | (Name extends "Actor" ? globalThis.Collection<Actor.Implementation> : never)
|
920
|
+
// | (Name extends "Item" ? globalThis.Collection<Item.Implementation> : never)
|
921
|
+
// | (Name extends "ActiveEffect" ? globalThis.Collection<ActiveEffect.Implementation> : never)
|
922
|
+
// | (Name extends Embedded.CollectionName ? Embedded.CollectionFor<Name> : never);
|
923
|
+
type GetEmbeddedCollectionResult<_Name extends GetEmbeddedCollectionName> = Collection.Any;
|
38
924
|
}
|
39
925
|
|
40
926
|
/**
|
41
927
|
* The client-side Token document which extends the common BaseToken model.
|
42
928
|
*
|
43
|
-
* @see {@link Scene} The Scene document type which contains Token embedded documents
|
44
|
-
* @see {@link TokenConfig} The Token configuration application
|
929
|
+
* @see {@link Scene | `Scene`} The Scene document type which contains Token embedded documents
|
930
|
+
* @see {@link TokenConfig | `TokenConfig`} The Token configuration application
|
45
931
|
*/
|
46
932
|
class TokenDocument extends CanvasDocumentMixin(foundry.documents.BaseToken) {
|
47
|
-
|
48
|
-
|
49
|
-
|
933
|
+
/**
|
934
|
+
* @param data - Initial data from which to construct the `TokenDocument`
|
935
|
+
* @param context - Construction context options
|
936
|
+
*/
|
937
|
+
constructor(...args: TokenDocument.ConstructorArgs);
|
50
938
|
|
51
939
|
/**
|
52
940
|
* A singleton collection which holds a reference to the synthetic token actor by its base actor's ID.
|
53
941
|
*/
|
54
|
-
actors(): Collection<Actor.
|
942
|
+
actors(): Collection<Actor.Implementation>;
|
55
943
|
|
56
944
|
/**
|
57
945
|
* A lazily evaluated reference to the Actor this Token modifies.
|
58
946
|
* If actorLink is true, then the document is the primary Actor document.
|
59
947
|
* Otherwise the Actor document is a synthetic (ephemeral) document constructed using the Token's ActorDelta.
|
60
948
|
*/
|
61
|
-
get actor(): Actor.
|
949
|
+
get actor(): Actor.Implementation | null;
|
62
950
|
|
63
951
|
/**
|
64
952
|
* A reference to the base, World-level Actor this token represents.
|
65
953
|
*/
|
66
|
-
get baseActor(): Actor | undefined;
|
954
|
+
get baseActor(): Actor.Implementation | undefined;
|
67
955
|
|
68
956
|
/**
|
69
957
|
* An indicator for whether or not the current User has full control over this Token document.
|
@@ -84,7 +972,7 @@ declare global {
|
|
84
972
|
/**
|
85
973
|
* Return a reference to a Combatant that represents this Token, if one is present in the current encounter.
|
86
974
|
*/
|
87
|
-
get combatant(): Combatant.
|
975
|
+
get combatant(): Combatant.Implementation | null;
|
88
976
|
|
89
977
|
/**
|
90
978
|
* An indicator for whether or not this Token is currently involved in the active combat encounter.
|
@@ -94,7 +982,7 @@ declare global {
|
|
94
982
|
/**
|
95
983
|
* The Regions this Token is currently in.
|
96
984
|
*/
|
97
|
-
regions: Set<RegionDocument.
|
985
|
+
regions: Set<RegionDocument.Implementation> | null;
|
98
986
|
|
99
987
|
// TODO: Same as `DataModel._initialize`
|
100
988
|
protected override _initialize(options?: any): void;
|
@@ -129,7 +1017,7 @@ declare global {
|
|
129
1017
|
*/
|
130
1018
|
alternative: string;
|
131
1019
|
}>,
|
132
|
-
):
|
1020
|
+
): TokenDocument.GetBarAttributeReturn;
|
133
1021
|
|
134
1022
|
/**
|
135
1023
|
* Test whether a Token has a specific status effect.
|
@@ -145,18 +1033,7 @@ declare global {
|
|
145
1033
|
* Default: `{}`
|
146
1034
|
* @returns Is this Token now an active Combatant?
|
147
1035
|
*/
|
148
|
-
toggleCombatant({
|
149
|
-
active,
|
150
|
-
...options
|
151
|
-
}?: InexactPartial<
|
152
|
-
CreateCombatantOptions & {
|
153
|
-
/**
|
154
|
-
* Require this token to be an active Combatant or to be removed.
|
155
|
-
* Otherwise, the current combat state of the Token is toggled.
|
156
|
-
*/
|
157
|
-
active: boolean;
|
158
|
-
}
|
159
|
-
>): Promise<boolean>;
|
1036
|
+
toggleCombatant({ active, ...options }?: TokenDocument.ToggleCombatantOptions): Promise<boolean>;
|
160
1037
|
|
161
1038
|
/**
|
162
1039
|
* Create or remove Combatants for an array of provided Token objects.
|
@@ -165,7 +1042,10 @@ declare global {
|
|
165
1042
|
* Default: `{}`
|
166
1043
|
* @returns An array of created Combatant documents
|
167
1044
|
*/
|
168
|
-
static createCombatants(
|
1045
|
+
static createCombatants(
|
1046
|
+
tokens: TokenDocument.Implementation[],
|
1047
|
+
options?: TokenDocument.CreateCombatantOptions,
|
1048
|
+
): Promise<Combatant.Implementation[]>;
|
169
1049
|
|
170
1050
|
/**
|
171
1051
|
* Remove Combatants for the array of provided Tokens.
|
@@ -174,7 +1054,10 @@ declare global {
|
|
174
1054
|
* Default: `{}`
|
175
1055
|
* @returns An array of deleted Combatant documents
|
176
1056
|
*/
|
177
|
-
static deleteCombatants(
|
1057
|
+
static deleteCombatants(
|
1058
|
+
tokens: TokenDocument.Implementation[],
|
1059
|
+
options?: TokenDocument.CreateCombatantOptions,
|
1060
|
+
): Promise<Combatant.Implementation[]>;
|
178
1061
|
|
179
1062
|
/**
|
180
1063
|
* Convenience method to change a token vision mode.
|
@@ -187,16 +1070,129 @@ declare global {
|
|
187
1070
|
defaults?: boolean,
|
188
1071
|
): Promise<ReturnType<this["update"]>>;
|
189
1072
|
|
190
|
-
|
191
|
-
|
192
|
-
|
1073
|
+
/**
|
1074
|
+
* @remarks Foundry specifically overrides this method such that unlinked `TokenDocument` instances
|
1075
|
+
* handles 3 extra cases:
|
1076
|
+
* - Passing `"Actor"` returns `this.actors`.
|
1077
|
+
* - Passing `"Item"` returns `this.actor.items`.
|
1078
|
+
* - Passing `"ActiveEffect"` returns `this.actor.effects`.
|
1079
|
+
*/
|
1080
|
+
override getEmbeddedCollection<EmbeddedName extends TokenDocument.GetEmbeddedCollectionName>(
|
1081
|
+
embeddedName: EmbeddedName,
|
1082
|
+
): TokenDocument.GetEmbeddedCollectionResult<EmbeddedName>;
|
193
1083
|
|
194
1084
|
/**
|
195
1085
|
* @privateRemarks _onCreate, _preUpdate, _onUpdate, _onDelete, preCreateOperation, _preUpdateOperation, _onCreateOperation,
|
196
|
-
* _onUpdateOperation, _onDeleteOperation
|
197
|
-
|
198
|
-
|
1086
|
+
* _onUpdateOperation, _onDeleteOperation are all overridden but with no signature changes from their definition in BaseToken.
|
1087
|
+
*/
|
1088
|
+
|
1089
|
+
/**
|
1090
|
+
* @remarks To make it possible for narrowing one parameter to jointly narrow other parameters
|
1091
|
+
* this method must be overriden like so:
|
1092
|
+
* ```typescript
|
1093
|
+
* class SwadeActorDelta extends ActorDelta {
|
1094
|
+
* protected override _preCreateDescendantDocuments(...args: ActorDelta.PreCreateDescendantDocumentsArgs) {
|
1095
|
+
* super._preCreateDescendantDocuments(...args);
|
1096
|
+
*
|
1097
|
+
* const [parent, collection, data, options, userId] = args;
|
1098
|
+
* if (collection === "items") {
|
1099
|
+
* options; // Will be narrowed.
|
1100
|
+
* }
|
1101
|
+
* }
|
1102
|
+
* }
|
1103
|
+
* ```
|
1104
|
+
*/
|
1105
|
+
protected override _preCreateDescendantDocuments(...args: ActorDelta.PreCreateDescendantDocumentsArgs): void;
|
1106
|
+
|
1107
|
+
/**
|
1108
|
+
* @remarks To make it possible for narrowing one parameter to jointly narrow other parameters
|
1109
|
+
* this method must be overriden like so:
|
1110
|
+
* ```typescript
|
1111
|
+
* class GurpsActorDelta extends ActorDelta {
|
1112
|
+
* protected override _onCreateDescendantDocuments(...args: ActorDelta.OnCreateDescendantDocumentsArgs) {
|
1113
|
+
* super._onCreateDescendantDocuments(...args);
|
1114
|
+
*
|
1115
|
+
* const [parent, collection, documents, data, options, userId] = args;
|
1116
|
+
* if (collection === "items") {
|
1117
|
+
* options; // Will be narrowed.
|
1118
|
+
* }
|
1119
|
+
* }
|
1120
|
+
* }
|
1121
|
+
* ```
|
199
1122
|
*/
|
1123
|
+
protected override _onCreateDescendantDocuments(...args: ActorDelta.OnCreateDescendantDocumentsArgs): void;
|
1124
|
+
|
1125
|
+
/**
|
1126
|
+
* @remarks To make it possible for narrowing one parameter to jointly narrow other parameters
|
1127
|
+
* this method must be overriden like so:
|
1128
|
+
* ```typescript
|
1129
|
+
* class LancerActorDelta extends ActorDelta {
|
1130
|
+
* protected override _preUpdateDescendantDocuments(...args: ActorDelta.OnUpdateDescendantDocuments) {
|
1131
|
+
* super._preUpdateDescendantDocuments(...args);
|
1132
|
+
*
|
1133
|
+
* const [parent, collection, changes, options, userId] = args;
|
1134
|
+
* if (collection === "tokens") {
|
1135
|
+
* options; // Will be narrowed.
|
1136
|
+
* }
|
1137
|
+
* }
|
1138
|
+
* }
|
1139
|
+
* ```
|
1140
|
+
*/
|
1141
|
+
protected override _preUpdateDescendantDocuments(...args: ActorDelta.PreUpdateDescendantDocumentsArgs): void;
|
1142
|
+
|
1143
|
+
/**
|
1144
|
+
* @remarks To make it possible for narrowing one parameter to jointly narrow other parameters
|
1145
|
+
* this method must be overriden like so:
|
1146
|
+
* ```typescript
|
1147
|
+
* class Ptr2eTokenDocument extends TokenDocument {
|
1148
|
+
* protected override _onUpdateDescendantDocuments(...args: TokenDocument.OnUpdateDescendantDocumentsArgs) {
|
1149
|
+
* super._onUpdateDescendantDocuments(...args);
|
1150
|
+
*
|
1151
|
+
* const [parent, collection, documents, changes, options, userId] = args;
|
1152
|
+
* if (collection === "items") {
|
1153
|
+
* options; // Will be narrowed.
|
1154
|
+
* }
|
1155
|
+
* }
|
1156
|
+
* }
|
1157
|
+
* ```
|
1158
|
+
*/
|
1159
|
+
protected override _onUpdateDescendantDocuments(...args: TokenDocument.OnUpdateDescendantDocumentsArgs): void;
|
1160
|
+
|
1161
|
+
/**
|
1162
|
+
* @remarks To make it possible for narrowing one parameter to jointly narrow other parameters
|
1163
|
+
* this method must be overriden like so:
|
1164
|
+
* ```typescript
|
1165
|
+
* class KultTokenDocument extends TokenDocument {
|
1166
|
+
* protected override _preDeleteDescendantDocuments(...args: TokenDocument.PreDeleteDescendantDocumentsArgs) {
|
1167
|
+
* super._preDeleteDescendantDocuments(...args);
|
1168
|
+
*
|
1169
|
+
* const [parent, collection, ids, options, userId] = args;
|
1170
|
+
* if (collection === "items") {
|
1171
|
+
* options; // Will be narrowed.
|
1172
|
+
* }
|
1173
|
+
* }
|
1174
|
+
* }
|
1175
|
+
* ```
|
1176
|
+
*/
|
1177
|
+
protected override _preDeleteDescendantDocuments(...args: TokenDocument.PreDeleteDescendantDocumentsArgs): void;
|
1178
|
+
|
1179
|
+
/**
|
1180
|
+
* @remarks To make it possible for narrowing one parameter to jointly narrow other parameters
|
1181
|
+
* this method must be overriden like so:
|
1182
|
+
* ```typescript
|
1183
|
+
* class BladesTokenDocument extends TokenDocument {
|
1184
|
+
* protected override _onDeleteDescendantDocuments(...args: TokenDocument.OnUpdateDescendantDocuments) {
|
1185
|
+
* super._onDeleteDescendantDocuments(...args);
|
1186
|
+
*
|
1187
|
+
* const [parent, collection, documents, ids, options, userId] = args;
|
1188
|
+
* if (collection === "tokens") {
|
1189
|
+
* options; // Will be narrowed.
|
1190
|
+
* }
|
1191
|
+
* }
|
1192
|
+
* }
|
1193
|
+
* ```
|
1194
|
+
*/
|
1195
|
+
protected override _onDeleteDescendantDocuments(...args: TokenDocument.OnDeleteDescendantDocumentsArgs): void;
|
200
1196
|
|
201
1197
|
/**
|
202
1198
|
* Is to Token document updated such that the Regions the Token is contained in may change?
|
@@ -204,17 +1200,14 @@ declare global {
|
|
204
1200
|
* @param changes - The changes.
|
205
1201
|
* @returns Could this Token update change Region containment?
|
206
1202
|
*/
|
207
|
-
|
208
|
-
protected _couldRegionsChange(
|
209
|
-
changes: SchemaField.InnerAssignmentType<foundry.documents.BaseToken.Schema>,
|
210
|
-
): boolean;
|
1203
|
+
protected _couldRegionsChange(changes: Token.UpdateData): boolean;
|
211
1204
|
|
212
1205
|
/**
|
213
1206
|
* When the base Actor for a TokenDocument changes, we may need to update its Actor instance
|
214
1207
|
*/
|
215
1208
|
protected _onUpdateBaseActor(
|
216
|
-
update?: DeepPartial<Actor.
|
217
|
-
options?:
|
1209
|
+
update?: DeepPartial<Actor.Implementation["_source"]>,
|
1210
|
+
options?: Actor.Database.OnUpdateOperation,
|
218
1211
|
): void;
|
219
1212
|
|
220
1213
|
/**
|
@@ -223,11 +1216,12 @@ declare global {
|
|
223
1216
|
* @param options - The options provided to the update.
|
224
1217
|
*/
|
225
1218
|
protected _onRelatedUpdate(
|
226
|
-
update?: DeepPartial<Actor.
|
227
|
-
/**
|
1219
|
+
update?: DeepPartial<Actor.Implementation["_source"]>,
|
1220
|
+
/**
|
1221
|
+
* @privateRemarks foundry calls this field operation
|
228
1222
|
* but it's being passed options (and then ignores them)
|
229
1223
|
*/
|
230
|
-
operation?:
|
1224
|
+
operation?: Actor.Database.OnUpdateOperation,
|
231
1225
|
): void;
|
232
1226
|
|
233
1227
|
/**
|
@@ -236,15 +1230,18 @@ declare global {
|
|
236
1230
|
*/
|
237
1231
|
// TODO: There's some very complex handling for non-datamodel Actor system implementations if we want
|
238
1232
|
static getTrackedAttributes(
|
239
|
-
data?: Actor.
|
1233
|
+
data?: Actor.Implementation["system"],
|
240
1234
|
_path?: string[],
|
241
|
-
): TrackedAttributesDescription;
|
1235
|
+
): TokenDocument.TrackedAttributesDescription;
|
242
1236
|
|
243
1237
|
/**
|
244
1238
|
* Retrieve an Array of attribute choices from a plain object.
|
245
1239
|
* @param schema - The schema to explore for attributes.
|
246
1240
|
*/
|
247
|
-
protected static _getTrackedAttributesFromObject(
|
1241
|
+
protected static _getTrackedAttributesFromObject(
|
1242
|
+
data: object,
|
1243
|
+
_path?: string[],
|
1244
|
+
): TokenDocument.TrackedAttributesDescription;
|
248
1245
|
|
249
1246
|
/**
|
250
1247
|
* Retrieve an Array of attribute choices from a SchemaField.
|
@@ -253,20 +1250,22 @@ declare global {
|
|
253
1250
|
protected static _getTrackedAttributesFromSchema(
|
254
1251
|
schema: foundry.data.fields.SchemaField.Any,
|
255
1252
|
_path?: string[],
|
256
|
-
): TrackedAttributesDescription;
|
1253
|
+
): TokenDocument.TrackedAttributesDescription;
|
257
1254
|
|
258
1255
|
/**
|
259
1256
|
* Retrieve any configured attributes for a given Actor type.
|
260
1257
|
* @param type - The Actor type.
|
261
1258
|
*/
|
262
|
-
static _getConfiguredTrackedAttributes(type: string): TrackedAttributesDescription | void;
|
1259
|
+
static _getConfiguredTrackedAttributes(type: string): TokenDocument.TrackedAttributesDescription | void;
|
263
1260
|
|
264
1261
|
/**
|
265
1262
|
* Inspect the Actor data model and identify the set of attributes which could be used for a Token Bar
|
266
1263
|
* @param attributes - The tracked attributes which can be chosen from
|
267
1264
|
* @returns A nested object of attribute choices to display
|
268
1265
|
*/
|
269
|
-
static getTrackedAttributeChoices(
|
1266
|
+
static getTrackedAttributeChoices(
|
1267
|
+
attributes?: TokenDocument.TrackedAttributesDescription,
|
1268
|
+
): Record<string, string[]>;
|
270
1269
|
|
271
1270
|
/**
|
272
1271
|
* @deprecated since v11
|
@@ -274,7 +1273,7 @@ declare global {
|
|
274
1273
|
* `TokenDocument#actor getter to retrieve the Actor instance that the TokenDocument represents, or use`
|
275
1274
|
* `TokenDocument#delta#apply to generate a new synthetic Actor instance."`
|
276
1275
|
*/
|
277
|
-
getActor(): Actor.
|
1276
|
+
getActor(): Actor.Implementation;
|
278
1277
|
|
279
1278
|
/**
|
280
1279
|
* @deprecated since v11
|
@@ -299,25 +1298,50 @@ declare global {
|
|
299
1298
|
effectData: CONFIG.StatusEffect,
|
300
1299
|
options?: InexactPartial<ToggleActiveEffectOptions>,
|
301
1300
|
): Promise<boolean>;
|
302
|
-
}
|
303
1301
|
|
304
|
-
|
1302
|
+
/*
|
1303
|
+
* After this point these are not really overridden methods.
|
1304
|
+
* They are here because Foundry's documents are complex and have lots of edge cases.
|
1305
|
+
* There are DRY ways of representing this but this ends up being harder to understand
|
1306
|
+
* for end users extending these functions, especially for static methods. There are also a
|
1307
|
+
* number of methods that don't make sense to call directly on `Document` like `createDocuments`,
|
1308
|
+
* as there is no data that can safely construct every possible document. Finally keeping definitions
|
1309
|
+
* separate like this helps against circularities.
|
1310
|
+
*/
|
305
1311
|
|
306
|
-
|
307
|
-
/** A list of property path arrays to attributes with both a value and a max property. */
|
308
|
-
bar: string[][];
|
309
|
-
/** A list of property path arrays to attributes that have only a value property. */
|
310
|
-
value: string[][];
|
311
|
-
}
|
1312
|
+
// ClientDocument overrides
|
312
1313
|
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
1314
|
+
static override defaultName(
|
1315
|
+
context: Document.DefaultNameContext<"base", NonNullable<TokenDocument.Parent>>,
|
1316
|
+
): string;
|
1317
|
+
|
1318
|
+
static override createDialog(
|
1319
|
+
data: Document.CreateDialogData<TokenDocument.CreateData>,
|
1320
|
+
context: Document.CreateDialogContext<string, NonNullable<TokenDocument.Parent>>,
|
1321
|
+
): Promise<TokenDocument.Stored | null | undefined>;
|
1322
|
+
|
1323
|
+
static override fromDropData(
|
1324
|
+
data: Document.DropData<TokenDocument.Implementation>,
|
1325
|
+
options?: Document.FromDropDataOptions,
|
1326
|
+
): Promise<TokenDocument.Implementation | undefined>;
|
1327
|
+
|
1328
|
+
static override fromImport(
|
1329
|
+
source: TokenDocument.Source,
|
1330
|
+
context?: Document.FromImportContext<TokenDocument.Parent>,
|
1331
|
+
): Promise<TokenDocument.Implementation>;
|
1332
|
+
|
1333
|
+
// TODO: The deprecated Embedded Document Operations
|
320
1334
|
}
|
1335
|
+
|
1336
|
+
/**
|
1337
|
+
* @deprecated {@link TokenDocument.TrackedAttributesDescription | `TokenDocument.TrackedAttributesDescription`}
|
1338
|
+
*/
|
1339
|
+
type TrackedAttributesDescription = TokenDocument.TrackedAttributesDescription;
|
1340
|
+
|
1341
|
+
/**
|
1342
|
+
* @deprecated {@link TokenDocument.CreateCombatantOptions | `TokenDocument.CreateCombatantOptions`}
|
1343
|
+
*/
|
1344
|
+
type CreateCombatantOptions = TokenDocument.CreateCombatantOptions;
|
321
1345
|
}
|
322
1346
|
|
323
1347
|
interface SingleAttributeBar {
|