@league-of-foundry-developers/foundry-vtt-types 12.331.4-beta → 12.331.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +18 -1
- package/src/configuration/configuration.d.mts +1 -1
- package/src/foundry/client/apps/app.d.mts +1 -1
- package/src/foundry/client/apps/av/av-config.d.mts +1 -1
- package/src/foundry/client/apps/av/cameras.d.mts +1 -1
- package/src/foundry/client/apps/dice/dice-config.d.mts +1 -1
- package/src/foundry/client/apps/form.d.mts +1 -1
- package/src/foundry/client/apps/forms/actor.d.mts +1 -1
- package/src/foundry/client/apps/forms/adventure-exporter.d.mts +1 -1
- package/src/foundry/client/apps/forms/adventure-importer.d.mts +1 -1
- package/src/foundry/client/apps/forms/base-sheet.d.mts +1 -1
- package/src/foundry/client/apps/forms/card-config.d.mts +1 -1
- package/src/foundry/client/apps/forms/cards-config.d.mts +1 -1
- package/src/foundry/client/apps/forms/combat-config.d.mts +1 -1
- package/src/foundry/client/apps/forms/effect-config.d.mts +1 -1
- package/src/foundry/client/apps/forms/folder-config.d.mts +7 -2
- package/src/foundry/client/apps/forms/fonts.d.mts +1 -1
- package/src/foundry/client/apps/forms/grid-config.d.mts +1 -1
- package/src/foundry/client/apps/forms/image-popout.d.mts +1 -1
- package/src/foundry/client/apps/forms/item.d.mts +1 -1
- package/src/foundry/client/apps/forms/journal-page-sheet.d.mts +1 -1
- package/src/foundry/client/apps/forms/journal-sheet.d.mts +1 -1
- package/src/foundry/client/apps/forms/macro-config.d.mts +1 -1
- package/src/foundry/client/apps/forms/measure-template.d.mts +1 -1
- package/src/foundry/client/apps/forms/ownership.d.mts +1 -1
- package/src/foundry/client/apps/forms/playlist-config.d.mts +1 -1
- package/src/foundry/client/apps/forms/playlist-sound-config.d.mts +1 -1
- package/src/foundry/client/apps/forms/roll-table-config.d.mts +1 -1
- package/src/foundry/client/apps/forms/scene-config.d.mts +1 -1
- package/src/foundry/client/apps/forms/sheet-config.d.mts +1 -1
- package/src/foundry/client/apps/forms/user-config.d.mts +1 -1
- package/src/foundry/client/apps/hud/chatbubble.d.mts +1 -1
- package/src/foundry/client/apps/hud/container.d.mts +1 -1
- package/src/foundry/client/apps/hud/controls.d.mts +1 -1
- package/src/foundry/client/apps/hud/hotbar.d.mts +1 -1
- package/src/foundry/client/apps/hud/hud.d.mts +1 -1
- package/src/foundry/client/apps/hud/menu.d.mts +1 -1
- package/src/foundry/client/apps/hud/navigation.d.mts +1 -1
- package/src/foundry/client/apps/hud/pause.d.mts +1 -1
- package/src/foundry/client/apps/hud/players.d.mts +1 -1
- package/src/foundry/client/apps/placeables/drawing-config.d.mts +1 -1
- package/src/foundry/client/apps/placeables/drawing-hud.d.mts +1 -1
- package/src/foundry/client/apps/placeables/note-config.d.mts +1 -1
- package/src/foundry/client/apps/placeables/tile-config.d.mts +1 -1
- package/src/foundry/client/apps/placeables/tile-hud.d.mts +1 -1
- package/src/foundry/client/apps/placeables/token-config.d.mts +1 -1
- package/src/foundry/client/apps/placeables/token-hud.d.mts +1 -1
- package/src/foundry/client/apps/placeables/wall-config.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/apps/keybindings-config.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/apps/module-management.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/apps/support-details.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/apps/tours-management.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/apps/world-config.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/directory-tab-mixin.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/package-configuration.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/sidebar.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/tabs/actors-directory.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/tabs/cards-directory.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/tabs/chat-log.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/tabs/combat-tracker.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/tabs/compendium-directory.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/tabs/items-directory.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/tabs/journal-directory.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/tabs/macros-directory.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/tabs/playlists-directory.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/tabs/roll-table-directory.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/tabs/scenes-directory.d.mts +1 -1
- package/src/foundry/client/apps/sidebar/tabs/settings.d.mts +1 -1
- package/src/foundry/client/av/client.d.mts +1 -1
- package/src/foundry/client/av/clients/simplepeer.d.mts +1 -1
- package/src/foundry/client/av/master.d.mts +1 -1
- package/src/foundry/client/av/settings.d.mts +1 -1
- package/src/foundry/client/config.d.mts +1 -1
- package/src/foundry/client/core/hooks.d.mts +1 -1
- package/src/foundry/client/core/image.d.mts +1 -1
- package/src/foundry/client/core/keybindings.d.mts +1 -1
- package/src/foundry/client/core/packages.d.mts +4 -2
- package/src/foundry/client/core/settings.d.mts +1 -1
- package/src/foundry/client/core/socket.d.mts +1 -1
- package/src/foundry/client/core/tooltip.d.mts +1 -1
- package/src/foundry/client/core/tour.d.mts +1 -1
- package/src/foundry/client/core/utils.d.mts +1 -1
- package/src/foundry/client/core/workers.d.mts +1 -1
- package/src/foundry/client/data/abstract/canvas-document.d.mts +9 -20
- package/src/foundry/client/data/abstract/client-document.d.mts +133 -71
- package/src/foundry/client/data/abstract/directory-collection-mixin.d.mts +2 -2
- package/src/foundry/client/data/abstract/document-collection.d.mts +1 -1
- package/src/foundry/client/data/abstract/world-collection.d.mts +8 -1
- package/src/foundry/client/data/collections/actors.d.mts +1 -1
- package/src/foundry/client/data/collections/cards.d.mts +1 -1
- package/src/foundry/client/data/collections/combats.d.mts +1 -1
- package/src/foundry/client/data/collections/compendium-collection.d.mts +5 -4
- package/src/foundry/client/data/collections/fog.d.mts +1 -1
- package/src/foundry/client/data/collections/folder.d.mts +1 -1
- package/src/foundry/client/data/collections/items.d.mts +1 -1
- package/src/foundry/client/data/collections/journal.d.mts +1 -1
- package/src/foundry/client/data/collections/macros.d.mts +1 -1
- package/src/foundry/client/data/collections/messages.d.mts +1 -1
- package/src/foundry/client/data/collections/playlists.d.mts +1 -1
- package/src/foundry/client/data/collections/scenes.d.mts +1 -1
- package/src/foundry/client/data/collections/settings.d.mts +1 -1
- package/src/foundry/client/data/collections/tables.d.mts +1 -1
- package/src/foundry/client/data/collections/users.d.mts +4 -4
- package/src/foundry/client/data/documents/active-effect.d.mts +124 -48
- package/src/foundry/client/data/documents/actor-delta.d.mts +53 -22
- package/src/foundry/client/data/documents/actor.d.mts +147 -93
- package/src/foundry/client/data/documents/adventure.d.mts +74 -45
- package/src/foundry/client/data/documents/ambient-light.d.mts +13 -10
- package/src/foundry/client/data/documents/ambient-sound.d.mts +12 -7
- package/src/foundry/client/data/documents/card.d.mts +57 -34
- package/src/foundry/client/data/documents/cards.d.mts +171 -135
- package/src/foundry/client/data/documents/chat-message.d.mts +131 -72
- package/src/foundry/client/data/documents/combat.d.mts +80 -60
- package/src/foundry/client/data/documents/combatant.d.mts +53 -20
- package/src/foundry/client/data/documents/drawing.d.mts +12 -7
- package/src/foundry/client/data/documents/fog-exploration.d.mts +57 -17
- package/src/foundry/client/data/documents/folder.d.mts +114 -31
- package/src/foundry/client/data/documents/item.d.mts +31 -21
- package/src/foundry/client/data/documents/journal-entry-page.d.mts +90 -57
- package/src/foundry/client/data/documents/journal-entry.d.mts +29 -34
- package/src/foundry/client/data/documents/macro.d.mts +60 -34
- package/src/foundry/client/data/documents/measured-template.d.mts +13 -8
- package/src/foundry/client/data/documents/note.d.mts +14 -7
- package/src/foundry/client/data/documents/playlist-sound.d.mts +29 -33
- package/src/foundry/client/data/documents/playlist.d.mts +74 -54
- package/src/foundry/client/data/documents/region-behavior.d.mts +16 -7
- package/src/foundry/client/data/documents/region.d.mts +53 -48
- package/src/foundry/client/data/documents/scene.d.mts +310 -89
- package/src/foundry/client/data/documents/setting.d.mts +24 -23
- package/src/foundry/client/data/documents/table-result.d.mts +20 -8
- package/src/foundry/client/data/documents/table.d.mts +19 -13
- package/src/foundry/client/data/documents/tile.d.mts +13 -7
- package/src/foundry/client/data/documents/token.d.mts +148 -117
- package/src/foundry/client/data/documents/user.d.mts +141 -53
- package/src/foundry/client/data/documents/wall.d.mts +17 -10
- package/src/foundry/client/game.d.mts +1 -1
- package/src/foundry/client/head.d.mts +1 -1
- package/src/foundry/client/hooks.d.mts +9 -18
- package/src/foundry/client/pixi/board.d.mts +3 -2
- package/src/foundry/client/pixi/core/containers/base-canvas-group.d.mts +1 -1
- package/src/foundry/client/pixi/core/containers/cached-container.d.mts +1 -1
- package/src/foundry/client/pixi/core/containers/full-canvas-container.d.mts +1 -1
- package/src/foundry/client/pixi/core/containers/point-source-mesh.d.mts +1 -1
- package/src/foundry/client/pixi/core/containers/quad-mesh.d.mts +1 -1
- package/src/foundry/client/pixi/core/containers/quadtree.d.mts +1 -1
- package/src/foundry/client/pixi/core/containers/sprite-mesh.d.mts +1 -1
- package/src/foundry/client/pixi/core/containers/unbound-container.d.mts +1 -1
- package/src/foundry/client/pixi/core/interaction/canvas-animation.d.mts +1 -1
- package/src/foundry/client/pixi/core/interaction/control-icon.d.mts +1 -1
- package/src/foundry/client/pixi/core/interaction/mouse-handler.d.mts +1 -1
- package/src/foundry/client/pixi/core/interaction/ping.d.mts +1 -1
- package/src/foundry/client/pixi/core/interaction/pings/pulse.d.mts +1 -1
- package/src/foundry/client/pixi/core/interaction/render-flags.d.mts +1 -8
- package/src/foundry/client/pixi/core/interaction/resize-handle.d.mts +1 -1
- package/src/foundry/client/pixi/core/interaction/targets.d.mts +1 -1
- package/src/foundry/client/pixi/core/loader.d.mts +1 -1
- package/src/foundry/client/pixi/core/shapes/limited-angle-polygon.d.mts +1 -1
- package/src/foundry/client/pixi/core/shapes/polygon-mesher.d.mts +1 -1
- package/src/foundry/client/pixi/core/shapes/precise-text.d.mts +1 -1
- package/src/foundry/client/pixi/core/shapes/ray.d.mts +1 -1
- package/src/foundry/client/pixi/core/shapes/source-polygon.d.mts +1 -1
- package/src/foundry/client/pixi/extensions/circle.d.mts +1 -1
- package/src/foundry/client/pixi/extensions/observable-transform.d.mts +1 -1
- package/src/foundry/client/pixi/extensions/polygon.d.mts +1 -1
- package/src/foundry/client/pixi/extensions/rectangle.d.mts +1 -1
- package/src/foundry/client/pixi/groups/effects.d.mts +1 -1
- package/src/foundry/client/pixi/groups/environment.d.mts +1 -1
- package/src/foundry/client/pixi/groups/hidden.d.mts +1 -1
- package/src/foundry/client/pixi/groups/interface.d.mts +1 -1
- package/src/foundry/client/pixi/groups/overlay.d.mts +1 -1
- package/src/foundry/client/pixi/groups/primary.d.mts +1 -1
- package/src/foundry/client/pixi/groups/rendered.d.mts +1 -1
- package/src/foundry/client/pixi/layers/base/canvas-layer.d.mts +1 -1
- package/src/foundry/client/pixi/layers/base/interaction-layer.d.mts +1 -1
- package/src/foundry/client/pixi/layers/base/placeables-layer.d.mts +1 -1
- package/src/foundry/client/pixi/layers/controls/cursor.d.mts +1 -1
- package/src/foundry/client/pixi/layers/controls/door.d.mts +1 -1
- package/src/foundry/client/pixi/layers/controls/layer.d.mts +1 -1
- package/src/foundry/client/pixi/layers/controls/ruler.d.mts +1 -1
- package/src/foundry/client/pixi/layers/effects/background-effects.d.mts +1 -1
- package/src/foundry/client/pixi/layers/effects/coloration-effects.d.mts +1 -1
- package/src/foundry/client/pixi/layers/effects/darkness-effects.d.mts +1 -1
- package/src/foundry/client/pixi/layers/effects/illumination-effects.d.mts +1 -1
- package/src/foundry/client/pixi/layers/effects/visibility.d.mts +1 -1
- package/src/foundry/client/pixi/layers/effects/weather/particles/effect.d.mts +1 -1
- package/src/foundry/client/pixi/layers/effects/weather/particles/leaves.d.mts +1 -1
- package/src/foundry/client/pixi/layers/effects/weather-effects.d.mts +1 -1
- package/src/foundry/client/pixi/layers/grid/highlight.d.mts +1 -1
- package/src/foundry/client/pixi/layers/grid/layer.d.mts +1 -1
- package/src/foundry/client/pixi/layers/grid/mesh.d.mts +1 -1
- package/src/foundry/client/pixi/layers/masks/depth.d.mts +1 -1
- package/src/foundry/client/pixi/layers/masks/occlusion.d.mts +1 -1
- package/src/foundry/client/pixi/layers/masks/vision.d.mts +1 -1
- package/src/foundry/client/pixi/layers/placeables/drawings.d.mts +1 -1
- package/src/foundry/client/pixi/layers/placeables/lighting.d.mts +1 -1
- package/src/foundry/client/pixi/layers/placeables/notes.d.mts +1 -1
- package/src/foundry/client/pixi/layers/placeables/regions.d.mts +1 -1
- package/src/foundry/client/pixi/layers/placeables/sounds.d.mts +1 -1
- package/src/foundry/client/pixi/layers/placeables/templates.d.mts +1 -1
- package/src/foundry/client/pixi/layers/placeables/tiles.d.mts +1 -1
- package/src/foundry/client/pixi/layers/placeables/tokens.d.mts +1 -1
- package/src/foundry/client/pixi/layers/placeables/walls.d.mts +1 -1
- package/src/foundry/client/pixi/perception/clockwise-sweep.d.mts +1 -1
- package/src/foundry/client/pixi/perception/detection-mode.d.mts +1 -1
- package/src/foundry/client/pixi/perception/fog.d.mts +1 -1
- package/src/foundry/client/pixi/perception/perception-manager.d.mts +1 -1
- package/src/foundry/client/pixi/perception/vision-mode.d.mts +1 -1
- package/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.mts +1 -1
- package/src/foundry/client/pixi/placeable.d.mts +2 -1
- package/src/foundry/client/pixi/placeables/drawing.d.mts +1 -1
- package/src/foundry/client/pixi/placeables/light.d.mts +1 -7
- package/src/foundry/client/pixi/placeables/note.d.mts +1 -1
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.d.mts +1 -1
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.d.mts +1 -1
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.d.mts +1 -1
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.d.mts +1 -1
- package/src/foundry/client/pixi/placeables/region.d.mts +1 -1
- package/src/foundry/client/pixi/placeables/sound.d.mts +1 -1
- package/src/foundry/client/pixi/placeables/template.d.mts +1 -1
- package/src/foundry/client/pixi/placeables/tile.d.mts +1 -1
- package/src/foundry/client/pixi/placeables/token.d.mts +1 -1
- package/src/foundry/client/pixi/placeables/wall.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/extensions/batch-renderer.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/extensions/batch-shader-generator.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/helpers/framebuffer-snapshot.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/helpers/smooth-noise.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/helpers/texture-extractor.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/shaders/base-shader-mixin.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/shaders/base-shader.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/shaders/filters/base-filter.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/shaders/filters/effects-masking.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/shaders/filters/glow-overlay.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/shaders/filters/outline-overlay.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/shaders/filters/transition.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/shaders/filters/visibility.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/shaders/filters/vision-mask-filter.d.mts +1 -1
- 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 +1 -1
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fairy-light.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/shaders/samplers/base-sampler.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/shaders/samplers/token-ring.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/shaders/weather/base-weather.d.mts +1 -1
- package/src/foundry/client/pixi/webgl/shaders/weather/effect.d.mts +1 -1
- package/src/foundry/client/pixi/workers/texture-worker.d.mts +1 -1
- package/src/foundry/client/ui/context.d.mts +1 -1
- package/src/foundry/client/ui/dialog.d.mts +1 -1
- package/src/foundry/client/ui/dragdrop.d.mts +1 -1
- package/src/foundry/client/ui/editor.d.mts +1 -1
- package/src/foundry/client/ui/filepicker.d.mts +1 -1
- package/src/foundry/client/ui/filter.d.mts +1 -1
- package/src/foundry/client-esm/applications/api/application.d.mts +1 -9
- package/src/foundry/client-esm/applications/api/dialog.d.mts +1 -1
- package/src/foundry/client-esm/applications/api/document-sheet.d.mts +1 -1
- package/src/foundry/client-esm/applications/api/handlebars-application.d.mts +1 -1
- package/src/foundry/client-esm/applications/apps/compendium-art-config.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 +1 -1
- package/src/foundry/client-esm/applications/forms/fields.d.mts +1 -1
- package/src/foundry/client-esm/applications/sheets/actor-sheet.d.mts +1 -1
- package/src/foundry/client-esm/applications/sheets/ambient-light-config.d.mts +1 -1
- package/src/foundry/client-esm/applications/sheets/ambient-sound-config.d.mts +1 -1
- package/src/foundry/client-esm/applications/sheets/item-sheet.d.mts +1 -1
- package/src/foundry/client-esm/applications/sheets/region-behavior-config.d.mts +1 -1
- package/src/foundry/client-esm/applications/sheets/region-config.d.mts +1 -1
- package/src/foundry/client-esm/applications/sheets/user-config.d.mts +1 -1
- package/src/foundry/client-esm/applications/ui/region-legend.d.mts +1 -1
- package/src/foundry/client-esm/audio/biquad.d.mts +1 -1
- package/src/foundry/client-esm/audio/convolver.d.mts +1 -1
- package/src/foundry/client-esm/audio/helper.d.mts +1 -1
- package/src/foundry/client-esm/audio/sound.d.mts +2 -2
- package/src/foundry/client-esm/canvas/edges/collision.d.mts +1 -1
- package/src/foundry/client-esm/canvas/edges/edge.d.mts +1 -1
- package/src/foundry/client-esm/canvas/edges/vertex.d.mts +1 -1
- package/src/foundry/client-esm/canvas/scene-manager.d.mts +1 -1
- package/src/foundry/client-esm/canvas/smaa/smaa.d.mts +1 -1
- package/src/foundry/client-esm/canvas/sources/base-effect-source.d.mts +1 -1
- package/src/foundry/client-esm/canvas/sources/base-light-source.d.mts +1 -1
- package/src/foundry/client-esm/canvas/sources/global-light-source.d.mts +1 -1
- package/src/foundry/client-esm/canvas/sources/point-darkness-source.d.mts +1 -1
- package/src/foundry/client-esm/canvas/sources/point-effect-source.d.mts +1 -1
- package/src/foundry/client-esm/canvas/sources/point-light-source.d.mts +1 -1
- package/src/foundry/client-esm/canvas/sources/point-sound-source.d.mts +1 -1
- package/src/foundry/client-esm/canvas/sources/point-vision-source.d.mts +1 -1
- package/src/foundry/client-esm/canvas/sources/rendered-effect-source.d.mts +1 -1
- package/src/foundry/client-esm/canvas/tokens/ring-data.d.mts +3 -2
- package/src/foundry/client-esm/canvas/tokens/ring.d.mts +1 -1
- package/src/foundry/client-esm/data/client-backend.d.mts +1 -1
- package/src/foundry/client-esm/data/region-behaviors/adjust-darkness-level.d.mts +4 -5
- package/src/foundry/client-esm/data/region-behaviors/base.d.mts +1 -1
- package/src/foundry/client-esm/data/region-behaviors/display-scrolling-text.d.mts +1 -1
- package/src/foundry/client-esm/data/region-behaviors/toggle-behavior.d.mts +4 -4
- package/src/foundry/client-esm/dice/roll.d.mts +5 -8
- package/src/foundry/client-esm/dice/terms/coin.d.mts +1 -1
- package/src/foundry/client-esm/dice/terms/dice.d.mts +1 -1
- package/src/foundry/client-esm/dice/terms/die.d.mts +1 -1
- package/src/foundry/client-esm/dice/terms/fate.d.mts +1 -1
- package/src/foundry/client-esm/dice/terms/function.d.mts +1 -1
- package/src/foundry/client-esm/dice/terms/numeric.d.mts +1 -1
- package/src/foundry/client-esm/dice/terms/operator.d.mts +1 -1
- package/src/foundry/client-esm/dice/terms/parenthetical.d.mts +1 -1
- package/src/foundry/client-esm/dice/terms/pool.d.mts +1 -1
- package/src/foundry/client-esm/dice/terms/string.d.mts +1 -1
- package/src/foundry/client-esm/dice/terms/term.d.mts +1 -1
- package/src/foundry/common/abstract/backend.d.mts +1 -1
- package/src/foundry/common/abstract/data.d.mts +197 -146
- package/src/foundry/common/abstract/document.d.mts +198 -81
- package/src/foundry/common/abstract/embedded-collection-delta.d.mts +1 -1
- package/src/foundry/common/abstract/embedded-collection.d.mts +1 -1
- package/src/foundry/common/abstract/socket.d.mts +1 -1
- package/src/foundry/common/abstract/type-data.d.mts +4 -1
- package/src/foundry/common/config.d.mts +7 -1
- package/src/foundry/common/constants.d.mts +1 -1
- package/src/foundry/common/data/data.d.mts +42 -12
- package/src/foundry/common/data/fields.d.mts +656 -252
- package/src/foundry/common/documents/_types.d.mts +0 -6
- package/src/foundry/common/documents/active-effect.d.mts +116 -53
- package/src/foundry/common/documents/actor-delta.d.mts +139 -58
- package/src/foundry/common/documents/actor.d.mts +105 -51
- package/src/foundry/common/documents/adventure.d.mts +84 -39
- package/src/foundry/common/documents/ambient-light.d.mts +66 -38
- package/src/foundry/common/documents/ambient-sound.d.mts +66 -38
- package/src/foundry/common/documents/card.d.mts +100 -59
- package/src/foundry/common/documents/cards.d.mts +97 -42
- package/src/foundry/common/documents/chat-message.d.mts +105 -52
- package/src/foundry/common/documents/combat.d.mts +101 -48
- package/src/foundry/common/documents/combatant.d.mts +94 -50
- package/src/foundry/common/documents/drawing.d.mts +87 -46
- package/src/foundry/common/documents/fog-exploration.d.mts +87 -41
- package/src/foundry/common/documents/folder.d.mts +100 -46
- package/src/foundry/common/documents/item.d.mts +116 -45
- package/src/foundry/common/documents/journal-entry-page.d.mts +90 -40
- package/src/foundry/common/documents/journal-entry.d.mts +90 -39
- package/src/foundry/common/documents/macro.d.mts +116 -52
- package/src/foundry/common/documents/measured-template.d.mts +80 -44
- package/src/foundry/common/documents/note.d.mts +75 -39
- package/src/foundry/common/documents/playlist-sound.d.mts +88 -47
- package/src/foundry/common/documents/playlist.d.mts +101 -50
- package/src/foundry/common/documents/region-behavior.d.mts +71 -40
- package/src/foundry/common/documents/region.d.mts +68 -40
- package/src/foundry/common/documents/roll-table.d.mts +43 -9
- package/src/foundry/common/documents/scene.d.mts +190 -43
- package/src/foundry/common/documents/setting.d.mts +98 -42
- package/src/foundry/common/documents/table-result.d.mts +98 -48
- package/src/foundry/common/documents/tile.d.mts +77 -43
- package/src/foundry/common/documents/token.d.mts +95 -52
- package/src/foundry/common/documents/user.d.mts +100 -89
- package/src/foundry/common/documents/wall.d.mts +47 -17
- package/src/foundry/common/grid/base.d.mts +1 -1
- package/src/foundry/common/grid/gridless.d.mts +1 -1
- package/src/foundry/common/grid/hexagonal.d.mts +1 -1
- package/src/foundry/common/grid/square.d.mts +1 -1
- package/src/foundry/common/packages/base-package.d.mts +37 -14
- package/src/foundry/common/packages/base-system.d.mts +39 -0
- package/src/foundry/common/packages/base-world.d.mts +8 -1
- package/src/foundry/common/packages/sub-types.d.mts +3 -5
- package/src/foundry/common/primitives/array.d.mts +1 -1
- package/src/foundry/common/primitives/string.d.mts +1 -1
- package/src/foundry/common/prosemirror/dirty-plugin.d.mts +1 -1
- package/src/foundry/common/prosemirror/dom-parser.d.mts +1 -1
- package/src/foundry/common/prosemirror/highlight-matches-plugin.d.mts +1 -1
- package/src/foundry/common/prosemirror/image-plugin.d.mts +1 -1
- package/src/foundry/common/prosemirror/paste-transformer.d.mts +1 -1
- package/src/foundry/common/prosemirror/plugin.d.mts +1 -1
- package/src/foundry/common/types.d.mts +1 -1
- package/src/foundry/common/utils/bitmask.d.mts +1 -1
- package/src/foundry/common/utils/collection.d.mts +1 -1
- package/src/foundry/common/utils/event-emitter.d.mts +1 -1
- package/src/foundry/common/utils/helpers.d.mts +1 -1
- package/src/foundry/public/scripts/clipper/clipper.d.mts +1 -1
- package/src/types/augments/particles.d.mts +1 -1
- package/src/types/augments/pixi.d.mts +1 -1
- package/src/types/augments/smooth.d.mts +1 -1
- package/src/types/augments/tinyMCE.d.mts +1 -1
- package/src/types/config.d.mts +2 -5
- package/src/types/documentConfiguration.d.mts +1 -1
- package/src/types/lib.d.mts +1 -1
- package/src/types/workers/image-compressor.d.mts +1 -1
@@ -10,7 +10,7 @@ import type {
|
|
10
10
|
PrettifyType,
|
11
11
|
InterfaceToObject,
|
12
12
|
AnyArray,
|
13
|
-
} from "
|
13
|
+
} from "#utils";
|
14
14
|
import type { DataModel } from "../abstract/data.mts";
|
15
15
|
import type Document from "../abstract/document.mts";
|
16
16
|
import type { EmbeddedCollection, EmbeddedCollectionDelta, TypeDataModel } from "../abstract/module.d.mts";
|
@@ -36,10 +36,10 @@ export type DataSchema = Record<string, DataField.Any>;
|
|
36
36
|
* @typeParam PersistedType - the type of the persisted values of the DataField
|
37
37
|
* @remarks
|
38
38
|
* Defaults:
|
39
|
-
* AssignmentType: `unknown | null | undefined`
|
40
|
-
* InitializedType: `unknown | undefined`
|
41
|
-
* PersistedType: `unknown | undefined`
|
42
|
-
* InitialValue: `undefined`
|
39
|
+
* - AssignmentType: `unknown | null | undefined`
|
40
|
+
* - InitializedType: `unknown | undefined`
|
41
|
+
* - PersistedType: `unknown | undefined`
|
42
|
+
* - InitialValue: `undefined`
|
43
43
|
*/
|
44
44
|
declare abstract class DataField<
|
45
45
|
const Options extends DataField.Options.Any = DataField.DefaultOptions,
|
@@ -52,8 +52,10 @@ declare abstract class DataField<
|
|
52
52
|
|
53
53
|
/**
|
54
54
|
* @param options - Options which configure the behavior of the field
|
55
|
+
* @param context - Additional context which describes the field
|
55
56
|
*/
|
56
|
-
|
57
|
+
// options: not null (unchecked `in` operation), context: not null (destructured)
|
58
|
+
constructor(options?: Options, context?: DataField.ConstructionContext);
|
57
59
|
|
58
60
|
/** @internal */
|
59
61
|
" __fvtt_types_internal_source_data": PersistedType;
|
@@ -124,14 +126,14 @@ declare abstract class DataField<
|
|
124
126
|
*
|
125
127
|
* The field name of this DataField instance.
|
126
128
|
* This is assigned by SchemaField#initialize.
|
127
|
-
* @internal
|
129
|
+
* @remarks Foundry marked `@internal`
|
128
130
|
*/
|
129
131
|
name: string | undefined;
|
130
132
|
|
131
133
|
/**
|
132
134
|
* A reference to the parent schema to which this DataField belongs.
|
133
135
|
* This is assigned by SchemaField#initialize.
|
134
|
-
* @internal
|
136
|
+
* @remarks Foundry marked `@internal`
|
135
137
|
*/
|
136
138
|
parent: DataField.Any | undefined;
|
137
139
|
|
@@ -157,6 +159,7 @@ declare abstract class DataField<
|
|
157
159
|
|
158
160
|
/**
|
159
161
|
* A dot-separated string representation of the field path within the parent schema.
|
162
|
+
* @remarks Returns `""` if both `this.parent?.fieldPath` and `this.name` are falsey
|
160
163
|
*/
|
161
164
|
get fieldPath(): string;
|
162
165
|
|
@@ -164,13 +167,14 @@ declare abstract class DataField<
|
|
164
167
|
* Apply a function to this DataField which propagates through recursively to any contained data schema.
|
165
168
|
* @param fn - The function to apply
|
166
169
|
* @param value - The current value of this field
|
167
|
-
* @param options - Additional options passed to the applied function
|
168
|
-
* (default `{}`)
|
170
|
+
* @param options - Additional options passed to the applied function (default `{}`)
|
169
171
|
* @returns The results object
|
170
172
|
*/
|
171
|
-
|
172
|
-
|
173
|
-
|
173
|
+
// TODO: Determine `value` based upon the field metadata in fields-v2 (while allowing subclasses to narrow allowed values)
|
174
|
+
// options: not null (could be forwarded somewhere destructured, parameter default only)
|
175
|
+
apply<Options, Return>(
|
176
|
+
fn: keyof this | ((this: this, value: unknown, options: Options) => Return),
|
177
|
+
value?: unknown,
|
174
178
|
options?: Options,
|
175
179
|
): Return;
|
176
180
|
|
@@ -182,6 +186,7 @@ declare abstract class DataField<
|
|
182
186
|
* @param options - Additional options for how the field is cleaned
|
183
187
|
* @returns The cast value
|
184
188
|
*/
|
189
|
+
// options: not null (parameter default only, property access)
|
185
190
|
clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
|
186
191
|
|
187
192
|
/**
|
@@ -189,8 +194,9 @@ declare abstract class DataField<
|
|
189
194
|
* @param value - The appropriately coerced value.
|
190
195
|
* @param options - Additional options for how the field is cleaned.
|
191
196
|
* @returns The cleaned value.
|
197
|
+
* @remarks Simply returns `value` in `DataField`. `options` is unused in `DataField`
|
192
198
|
*/
|
193
|
-
protected _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
|
199
|
+
protected _cleanType(value: InitializedType, options?: DataField.CleanOptions | null): InitializedType;
|
194
200
|
|
195
201
|
/**
|
196
202
|
* Cast a non-default value to ensure it is the correct type for the field
|
@@ -204,8 +210,12 @@ declare abstract class DataField<
|
|
204
210
|
* @param data - The source data object for which an initial value is required
|
205
211
|
* @returns A valid initial value
|
206
212
|
* @throws An error if there is no valid initial value defined
|
213
|
+
* @remarks The `@throws` is Foundry's, and is wrong, as all fields will at a minimum inherit `initial: undefined` from DataField.
|
214
|
+
*
|
215
|
+
* `data` is unused if the field's `initial` is not a function.
|
207
216
|
*/
|
208
|
-
|
217
|
+
// TODO: the @throws is omitted in v13, clean up remarks
|
218
|
+
getInitialValue(data?: unknown): InitializedType;
|
209
219
|
|
210
220
|
/**
|
211
221
|
* Validate a candidate input for this field, ensuring it meets the field requirements.
|
@@ -217,10 +227,8 @@ declare abstract class DataField<
|
|
217
227
|
* (default: `{}`)
|
218
228
|
* @returns Returns a ModelValidationError if a validation failure occurred
|
219
229
|
*/
|
220
|
-
|
221
|
-
|
222
|
-
options?: DataField.ValidationOptions<DataField.Any>,
|
223
|
-
): DataModelValidationFailure | void;
|
230
|
+
// options: not null (parameter default only, property access)
|
231
|
+
validate(value: AssignmentType, options?: DataField.ValidateOptions<this>): DataModelValidationFailure | void;
|
224
232
|
|
225
233
|
/**
|
226
234
|
* Special validation rules which supersede regular field validation.
|
@@ -241,9 +249,10 @@ declare abstract class DataField<
|
|
241
249
|
* otherwise void.
|
242
250
|
* @throws May throw a specific error if the value is not valid
|
243
251
|
*/
|
252
|
+
// options: not null (parameter default only, property access in subclasses)
|
244
253
|
protected _validateType(
|
245
254
|
value: InitializedType,
|
246
|
-
options?: DataField.
|
255
|
+
options?: DataField.ValidateOptions<this>,
|
247
256
|
): boolean | DataModelValidationFailure | void;
|
248
257
|
|
249
258
|
/**
|
@@ -252,9 +261,17 @@ declare abstract class DataField<
|
|
252
261
|
* @param data - Candidate data for joint model validation
|
253
262
|
* @param options - Options which modify joint model validation
|
254
263
|
* @throws An error if joint model validation fails
|
255
|
-
* @internal
|
264
|
+
* @remarks Foundry marked `@internal`
|
265
|
+
*
|
266
|
+
* The only place core checks the `options` for any property is in {@link TypeDataField._validateModel | `TypeDataField#_validateModel`},
|
267
|
+
* where it checks `options.source?.type`
|
268
|
+
*
|
269
|
+
* {@link SchemaField._validateModel | `SchemaField._validateModel`} enforces `source`'s existence for subsidiary calls
|
270
|
+
*
|
271
|
+
* The only place core *calls* this at a top level, it does not pass anything for `options`, relying on SchemaField above
|
272
|
+
* to make TypeDataField work
|
256
273
|
*/
|
257
|
-
protected _validateModel(data: AnyObject, options?:
|
274
|
+
protected _validateModel(data: AnyObject, options?: DataField.ValidateModelOptions | null): void; // TODO: Type further.
|
258
275
|
|
259
276
|
/**
|
260
277
|
* Initialize the original source data into a mutable copy for the DataModel instance.
|
@@ -262,12 +279,18 @@ declare abstract class DataField<
|
|
262
279
|
* @param model - The DataModel instance that this field belongs to
|
263
280
|
* @param options - Initialization options
|
264
281
|
* @returns An initialized copy of the source data
|
282
|
+
* @remarks Core fields that return a function:
|
283
|
+
* - {@link ForeignDocumentField | `ForeignDocumentField`}
|
284
|
+
* - `ActorDeltaField` (exported in the BaseToken file but not re-exported by the relevant `_module`, so unlinkable)
|
265
285
|
*/
|
286
|
+
// TODO: investigate narrowing return to just `InitializedType` on inheritance lines that don't possibly return one
|
287
|
+
// TODO: (everything except SchemaField and ObjectField and their descendants)
|
288
|
+
// options: not null (parameter default only)
|
266
289
|
initialize(
|
267
290
|
value: PersistedType,
|
268
291
|
model: DataModel.Any,
|
269
|
-
options?:
|
270
|
-
): (() => InitializedType | null)
|
292
|
+
options?: DataField.InitializeOptions,
|
293
|
+
): InitializedType | (() => InitializedType | null);
|
271
294
|
|
272
295
|
/**
|
273
296
|
* Export the current value of the field into a serializable object.
|
@@ -280,7 +303,7 @@ declare abstract class DataField<
|
|
280
303
|
* Recursively traverse a schema and retrieve a field specification by a given path
|
281
304
|
* @param path - The field path as an array of strings
|
282
305
|
*/
|
283
|
-
protected _getField(path: string[]):
|
306
|
+
protected _getField(path: string[]): DataField.Any | undefined;
|
284
307
|
|
285
308
|
/**
|
286
309
|
* Does this form field class have defined form support?
|
@@ -340,13 +363,15 @@ declare abstract class DataField<
|
|
340
363
|
* @param model - The model instance.
|
341
364
|
* @param change - The original change data.
|
342
365
|
* @returns - The updated value.
|
366
|
+
*
|
367
|
+
* @remarks Returns `value + delta`. `model` and `change` are unused in `DataField`
|
343
368
|
*/
|
344
369
|
protected _applyChangeAdd(
|
345
370
|
value: InitializedType,
|
346
371
|
delta: InitializedType,
|
347
372
|
model: DataModel.Any,
|
348
373
|
change: ActiveEffect.EffectChangeData,
|
349
|
-
): InitializedType
|
374
|
+
): InitializedType;
|
350
375
|
|
351
376
|
/**
|
352
377
|
* Apply a MULTIPLY change to this field.
|
@@ -355,6 +380,8 @@ declare abstract class DataField<
|
|
355
380
|
* @param model - The model instance.
|
356
381
|
* @param change - The original change data.
|
357
382
|
* @returns The updated value.
|
383
|
+
*
|
384
|
+
* @remarks No-op in `DataField`, returns `undefined` unless overridden
|
358
385
|
*/
|
359
386
|
protected _applyChangeMultiply(
|
360
387
|
value: InitializedType,
|
@@ -370,13 +397,15 @@ declare abstract class DataField<
|
|
370
397
|
* @param model - The model instance.
|
371
398
|
* @param change - The original change data.
|
372
399
|
* @returns The updated value.
|
400
|
+
*
|
401
|
+
* @returns Simply returns `delta`. `value`, `model`, and `change` are unused in `DataField`
|
373
402
|
*/
|
374
403
|
protected _applyChangeOverride(
|
375
404
|
value: InitializedType,
|
376
405
|
delta: InitializedType,
|
377
406
|
model: DataModel.Any,
|
378
407
|
change: ActiveEffect.EffectChangeData,
|
379
|
-
): InitializedType
|
408
|
+
): InitializedType;
|
380
409
|
|
381
410
|
/**
|
382
411
|
* Apply an UPGRADE change to this field.
|
@@ -385,6 +414,8 @@ declare abstract class DataField<
|
|
385
414
|
* @param model - The model instance.
|
386
415
|
* @param change - The original change data.
|
387
416
|
* @returns - The updated value.
|
417
|
+
*
|
418
|
+
* @remarks No-op in `DataField`, returns `undefined` unless overridden
|
388
419
|
*/
|
389
420
|
protected _applyChangeUpgrade(
|
390
421
|
value: InitializedType,
|
@@ -400,6 +431,8 @@ declare abstract class DataField<
|
|
400
431
|
* @param model - The model instance.
|
401
432
|
* @param change - The original change data.
|
402
433
|
* @returns The updated value.
|
434
|
+
*
|
435
|
+
* @remarks No-op in `DataField`, returns `undefined` unless overridden
|
403
436
|
*/
|
404
437
|
protected _applyChangeDowngrade(
|
405
438
|
value: InitializedType,
|
@@ -415,13 +448,14 @@ declare abstract class DataField<
|
|
415
448
|
* @param model - The model instance.
|
416
449
|
* @param change - The original change data.
|
417
450
|
* @returns - The updated value.
|
451
|
+
* @remarks Only returns a value if the target value of the change actually changed
|
418
452
|
*/
|
419
453
|
protected _applyChangeCustom(
|
420
454
|
value: InitializedType,
|
421
455
|
delta: InitializedType,
|
422
456
|
model: DataModel.Any,
|
423
457
|
change: ActiveEffect.EffectChangeData,
|
424
|
-
): InitializedType;
|
458
|
+
): InitializedType | undefined;
|
425
459
|
}
|
426
460
|
|
427
461
|
declare namespace DataField {
|
@@ -525,24 +559,6 @@ declare namespace DataField {
|
|
525
559
|
| (RequiredOption extends true ? never : undefined);
|
526
560
|
}
|
527
561
|
|
528
|
-
interface DataValidationOptions {
|
529
|
-
/** Whether this is a partial schema validation, or a complete one. */
|
530
|
-
partial?: boolean;
|
531
|
-
|
532
|
-
/** Whether to allow replacing invalid values with valid fallbacks. */
|
533
|
-
fallback?: boolean;
|
534
|
-
|
535
|
-
/** The full source object being evaluated. */
|
536
|
-
source?: AnyObject;
|
537
|
-
|
538
|
-
/**
|
539
|
-
* If true, invalid embedded documents will emit a warning and be placed in
|
540
|
-
* the invalidDocuments collection rather than causing the parent to be
|
541
|
-
* considered invalid.
|
542
|
-
*/
|
543
|
-
dropInvalidEmbedded?: boolean;
|
544
|
-
}
|
545
|
-
|
546
562
|
/**
|
547
563
|
* A helper type for the given options type merged into the default options of the DataField class.
|
548
564
|
* @typeParam Options - the options that override the default options
|
@@ -601,16 +617,81 @@ declare namespace DataField {
|
|
601
617
|
*/
|
602
618
|
type InitializedType<Options extends DataField.Options.Any> = DerivedInitializedType<any, MergedOptions<Options>>;
|
603
619
|
|
604
|
-
/**
|
605
|
-
|
620
|
+
/** @internal */
|
621
|
+
type _ConstructionContext = NullishProps<{
|
622
|
+
/** A field name to assign to the constructed field */
|
623
|
+
name?: string;
|
624
|
+
}> &
|
625
|
+
InexactPartial<{
|
626
|
+
/**
|
627
|
+
* Another data field which is a hierarchical parent of this one
|
628
|
+
* @remarks Can't be `null` as there's a `!== undefined` check in {@link SchemaField._initialize | `SchemaField#_initialize`}
|
629
|
+
*/
|
630
|
+
parent?: DataField.Any;
|
631
|
+
}>;
|
632
|
+
|
633
|
+
interface ConstructionContext extends _ConstructionContext {}
|
634
|
+
|
635
|
+
/** @internal */
|
636
|
+
type _ValidationOptions = NullishProps<{
|
637
|
+
/** Whether this is a partial schema validation, or a complete one. */
|
638
|
+
partial: boolean;
|
639
|
+
|
640
|
+
/** Whether to allow replacing invalid values with valid fallbacks. */
|
641
|
+
fallback: boolean;
|
642
|
+
|
643
|
+
/**
|
644
|
+
* If true, invalid embedded documents will emit a warning and be placed in the invalidDocuments
|
645
|
+
* collection rather than causing the parent to be considered invalid.
|
646
|
+
*/
|
647
|
+
dropInvalidEmbedded?: boolean;
|
648
|
+
}> &
|
649
|
+
InexactPartial<{
|
650
|
+
/**
|
651
|
+
* The full source object being evaluated.
|
652
|
+
* @privateRemarks Disallowing `null` as this value gets passed to provided `initial` functions,
|
653
|
+
* and users shouldn't have to expect `null`
|
654
|
+
*/
|
655
|
+
source: AnyObject;
|
656
|
+
}>;
|
657
|
+
|
658
|
+
/**
|
659
|
+
* @remarks This is the type for the options for `#validate` and associate methods *without* the
|
660
|
+
* possible inclusion of a `validator` function.
|
661
|
+
*
|
662
|
+
* If you are looking for the type with a generic formerly under this name, see {@link ValidateOptions | `DataField.ValidateOptions`}
|
663
|
+
*/
|
664
|
+
interface ValidationOptions extends _ValidationOptions {}
|
665
|
+
|
666
|
+
/**
|
667
|
+
* @deprecated Use {@link ValidateOptions | `DataField.ValidationOptions`} instead if you need a direct replacement,
|
668
|
+
* or {@link ValidateOptions | `DataField.ValidateOptions`} if you're typing the options of `#validate` or an associated
|
669
|
+
* method.
|
670
|
+
*/
|
671
|
+
interface DataValidationOptions extends ValidationOptions {}
|
672
|
+
|
673
|
+
/** @internal */
|
674
|
+
type _CleanOptions = NullishProps<{
|
606
675
|
/** Whether to perform partial cleaning? */
|
607
|
-
partial
|
676
|
+
partial: boolean;
|
608
677
|
|
609
678
|
/** The root data model being cleaned */
|
610
|
-
source
|
611
|
-
|
612
|
-
|
613
|
-
}
|
679
|
+
source: AnyObject;
|
680
|
+
}>;
|
681
|
+
|
682
|
+
/** An interface for the options of {@link DataField.clean | `DataField#clean`} and {@link DataField._cleanType | `DataField#_cleanType`}. */
|
683
|
+
interface CleanOptions extends _CleanOptions {}
|
684
|
+
|
685
|
+
/**
|
686
|
+
* @remarks The only place core checks the `options` for any property is in {@link TypeDataField._validateModel | `TypeDataField#_validateModel`},
|
687
|
+
* where it checks `options.source?.type`
|
688
|
+
*
|
689
|
+
* {@link SchemaField._validateModel | `SchemaField._validateModel`} enforces `source`'s existence for subsidiary calls
|
690
|
+
*
|
691
|
+
* The only place core *calls* this at a top level, it does not pass anything for `options`, relying on SchemaField above
|
692
|
+
* to make TypeDataField work
|
693
|
+
*/
|
694
|
+
interface ValidateModelOptions extends Pick<ValidationOptions, "source"> {}
|
614
695
|
|
615
696
|
/**
|
616
697
|
* A Custom DataField validator function.
|
@@ -628,21 +709,21 @@ declare namespace DataField {
|
|
628
709
|
validate(
|
629
710
|
this: CurrentField,
|
630
711
|
value: unknown,
|
631
|
-
options:
|
712
|
+
options: ValidateOptions<CurrentField>,
|
632
713
|
): value is BaseAssignmentType;
|
633
714
|
}["validate"]
|
634
715
|
| {
|
635
716
|
validate(
|
636
717
|
this: CurrentField,
|
637
718
|
value: unknown,
|
638
|
-
options:
|
719
|
+
options: ValidateOptions<CurrentField>,
|
639
720
|
): asserts value is BaseAssignmentType;
|
640
721
|
}["validate"]
|
641
722
|
| {
|
642
723
|
validate(
|
643
724
|
this: CurrentField,
|
644
725
|
value: unknown,
|
645
|
-
options:
|
726
|
+
options: ValidateOptions<CurrentField>,
|
646
727
|
): DataModelValidationFailure | boolean | void;
|
647
728
|
}["validate"];
|
648
729
|
|
@@ -650,18 +731,28 @@ declare namespace DataField {
|
|
650
731
|
* An interface for the options of the {@link DataField | `DataField`} validation functions.
|
651
732
|
* @typeParam CurrentField - the type of the DataField, which is the receiver of the validate function
|
652
733
|
*/
|
653
|
-
interface
|
654
|
-
|
734
|
+
interface ValidateOptions<CurrentField extends DataField.Any> extends ValidationOptions {
|
735
|
+
/**
|
736
|
+
* @remarks If {@link DataField.validate | `DataField#validate`} is called with a `validate: someFunc` in its `options`,
|
737
|
+
* it will then pass that `options` object on to that function when it calls it, without alteration.
|
738
|
+
* Nothing in core makes use of the fact that a reference to the function is available, this seems incidental.
|
739
|
+
*/
|
655
740
|
validate?: Validator<CurrentField, DataField.AssignmentTypeFor<CurrentField>>;
|
656
741
|
}
|
657
742
|
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
743
|
+
/**
|
744
|
+
* @remarks The `options` passed to {@link DataField.initialize | `DataField#initialize`} exclusively (in core) come from
|
745
|
+
* {@link DataModel._initialize | `DataModel#_initialize`} or an override (meaning `parent` has been stripped from the
|
746
|
+
* interface), and eventually hits one of:
|
747
|
+
* 1. Document construction, in all cases with `parent` already provided
|
748
|
+
* 2. Gets fed back {@link DataModel._initialize | `DataModel#_initialize`} or an override
|
749
|
+
* 3. {@link Document.get | `Document.get`}, but the one place this happens, `pack` is already provided, and that's the only
|
750
|
+
* option that method cares about.
|
751
|
+
*
|
752
|
+
* This extends the `Document` interface because several core fields use the `pack` property, which isn't available on the
|
753
|
+
* `DataModel` interface
|
754
|
+
*/
|
755
|
+
interface InitializeOptions extends Document.InitializeOptions {}
|
665
756
|
|
666
757
|
interface ToInputConfig<InitializedType> extends FormInputConfig<InitializedType> {}
|
667
758
|
|
@@ -696,9 +787,9 @@ declare abstract class AnyDataField extends DataField<any, any, any, any> {
|
|
696
787
|
* @typeParam PersistedType - the type of the persisted values of the SchemaField
|
697
788
|
* @remarks
|
698
789
|
* Defaults:
|
699
|
-
* AssignmentType: `SchemaField.AssignmentType<Fields> | null | undefined`
|
700
|
-
* InitializedType: `SchemaField.InitializedType<Fields>`
|
701
|
-
* PersistedType: `SchemaField.PersistedType<Fields>`
|
790
|
+
* - AssignmentType: `SchemaField.AssignmentType<Fields> | null | undefined`
|
791
|
+
* - InitializedType: `SchemaField.InitializedType<Fields>`
|
792
|
+
* - PersistedType: `SchemaField.PersistedType<Fields>`
|
702
793
|
*/
|
703
794
|
declare class SchemaField<
|
704
795
|
Fields extends DataSchema,
|
@@ -713,9 +804,11 @@ declare class SchemaField<
|
|
713
804
|
/**
|
714
805
|
* @param fields - The contained field definitions
|
715
806
|
* @param options - Options which configure the behavior of the field
|
807
|
+
* @param context - Additional context which describes the field
|
716
808
|
*/
|
717
809
|
// Saying `fields: Fields` here causes the inference for the fields to be unnecessarily widened. This might effectively be a no-op but it fixes the inference.
|
718
|
-
|
810
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
811
|
+
constructor(fields: { [K in keyof Fields]: Fields[K] }, options?: Options, context?: DataField.ConstructionContext);
|
719
812
|
|
720
813
|
/** @defaultValue `true` */
|
721
814
|
override required: boolean;
|
@@ -748,6 +841,7 @@ declare class SchemaField<
|
|
748
841
|
*/
|
749
842
|
[Symbol.iterator](): Generator<DataField.Unknown>;
|
750
843
|
|
844
|
+
// TODO: see if its viable to narrow keys, values, entries, has, and get's types via the schema
|
751
845
|
/**
|
752
846
|
* An array of field names which are present in the schema.
|
753
847
|
*/
|
@@ -784,35 +878,40 @@ declare class SchemaField<
|
|
784
878
|
*/
|
785
879
|
getField(fieldName: string | string[]): DataField.Unknown | undefined;
|
786
880
|
|
787
|
-
protected override _getField(path: string[]): DataField.
|
881
|
+
protected override _getField(path: string[]): DataField.Any;
|
788
882
|
|
789
883
|
protected override _cast(value: AssignmentType): InitializedType;
|
790
884
|
|
885
|
+
/**
|
886
|
+
* @remarks Ensures `options.source` is set via effectively `||= data`, then forwards to each field's `#clean`
|
887
|
+
*
|
888
|
+
* Deletes any keys from `value` not in the schema
|
889
|
+
*/
|
890
|
+
// options: not null (parameter default only, property access)
|
791
891
|
protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
|
792
892
|
|
893
|
+
// options: not null (parameter default only)
|
793
894
|
override initialize(
|
794
895
|
value: PersistedType,
|
795
896
|
model: DataModel.Any,
|
796
|
-
options?:
|
897
|
+
options?: DataField.InitializeOptions,
|
797
898
|
): InitializedType | (() => InitializedType | null);
|
798
899
|
|
900
|
+
// options: not null (parameter default only, property access)
|
799
901
|
protected override _validateType(
|
800
902
|
value: InitializedType,
|
801
|
-
options?: DataField.
|
903
|
+
options?: DataField.ValidateOptions<this>,
|
802
904
|
): boolean | DataModelValidationFailure | void;
|
803
905
|
|
804
|
-
|
906
|
+
// options: not null (parameter default only, property access)
|
907
|
+
protected override _validateModel(data: AnyObject, options?: DataField.ValidateModelOptions): void;
|
805
908
|
|
806
909
|
override toObject(value: InitializedType): PersistedType;
|
807
910
|
|
911
|
+
// options: not null (could be forwarded somewhere destructured, parameter default only)
|
808
912
|
override apply<Options, Return>(
|
809
|
-
fn: keyof this | ((this: this, value:
|
810
|
-
value?:
|
811
|
-
options?: Options,
|
812
|
-
): Return;
|
813
|
-
override apply<Value, Options, Return>(
|
814
|
-
fn: keyof this | ((this: this, value: Value, options: Options) => Return),
|
815
|
-
value: Value,
|
913
|
+
fn: keyof this | ((this: this, value: AnyObject, options: Options) => Return),
|
914
|
+
value?: AnyObject,
|
816
915
|
options?: Options,
|
817
916
|
): Return;
|
818
917
|
|
@@ -1039,10 +1138,10 @@ declare namespace SchemaField {
|
|
1039
1138
|
* @typeParam PersistedType - the type of the persisted values of the BooleanField
|
1040
1139
|
* @remarks
|
1041
1140
|
* Defaults:
|
1042
|
-
* AssignmentType: `boolean | null | undefined`
|
1043
|
-
* InitializedType: `boolean`
|
1044
|
-
* PersistedType: `boolean`
|
1045
|
-
* InitialValue: `false`
|
1141
|
+
* - AssignmentType: `boolean | null | undefined`
|
1142
|
+
* - InitializedType: `boolean`
|
1143
|
+
* - PersistedType: `boolean`
|
1144
|
+
* - InitialValue: `false`
|
1046
1145
|
*/
|
1047
1146
|
declare class BooleanField<
|
1048
1147
|
const Options extends BooleanField.Options = BooleanField.DefaultOptions,
|
@@ -1065,12 +1164,45 @@ declare class BooleanField<
|
|
1065
1164
|
|
1066
1165
|
protected override _cast(value: AssignmentType): InitializedType;
|
1067
1166
|
|
1167
|
+
/** @remarks `options` is unused in `BooleanField` */
|
1068
1168
|
protected override _validateType(
|
1069
1169
|
value: InitializedType,
|
1070
|
-
options?: DataField.
|
1170
|
+
options?: DataField.ValidateOptions<this> | null,
|
1071
1171
|
): boolean | DataModelValidationFailure | void;
|
1072
1172
|
|
1073
1173
|
protected override _toInput(config: DataField.ToInputConfig<InitializedType>): HTMLElement | HTMLCollection;
|
1174
|
+
|
1175
|
+
/** @remarks Returns `value || delta`. `model` and `change` are unused in `BooleanField` */
|
1176
|
+
protected override _applyChangeAdd(
|
1177
|
+
value: InitializedType,
|
1178
|
+
delta: InitializedType,
|
1179
|
+
model: DataModel.Any,
|
1180
|
+
change: ActiveEffect.EffectChangeData,
|
1181
|
+
): InitializedType;
|
1182
|
+
|
1183
|
+
/** @remarks Returns `value && delta`. `model` and `change` are unused in `BooleanField` */
|
1184
|
+
protected override _applyChangeMultiply(
|
1185
|
+
value: InitializedType,
|
1186
|
+
delta: InitializedType,
|
1187
|
+
model: DataModel.Any,
|
1188
|
+
change: ActiveEffect.EffectChangeData,
|
1189
|
+
): InitializedType;
|
1190
|
+
|
1191
|
+
/** @remarks Returns `delta > value ? delta : value`. `model` and `change` are unused in `BooleanField` */
|
1192
|
+
protected override _applyChangeUpgrade(
|
1193
|
+
value: InitializedType,
|
1194
|
+
delta: InitializedType,
|
1195
|
+
model: DataModel.Any,
|
1196
|
+
change: ActiveEffect.EffectChangeData,
|
1197
|
+
): InitializedType;
|
1198
|
+
|
1199
|
+
/** @remarks Returns `delta < value ? delta : value`. `model` and `change` are unused in `BooleanField` */
|
1200
|
+
protected override _applyChangeDowngrade(
|
1201
|
+
value: InitializedType,
|
1202
|
+
delta: InitializedType,
|
1203
|
+
model: DataModel.Any,
|
1204
|
+
change: ActiveEffect.EffectChangeData,
|
1205
|
+
): InitializedType;
|
1074
1206
|
}
|
1075
1207
|
|
1076
1208
|
declare namespace BooleanField {
|
@@ -1114,10 +1246,10 @@ declare namespace BooleanField {
|
|
1114
1246
|
* @typeParam PersistedType - the type of the persisted values of the NumberField
|
1115
1247
|
* @remarks
|
1116
1248
|
* Defaults:
|
1117
|
-
* AssignmentType: `number | null | undefined`
|
1118
|
-
* InitializedType: `number | null`
|
1119
|
-
* PersistedType: `number | null`
|
1120
|
-
* InitialValue: `null`
|
1249
|
+
* - AssignmentType: `number | null | undefined`
|
1250
|
+
* - InitializedType: `number | null`
|
1251
|
+
* - PersistedType: `number | null`
|
1252
|
+
* - InitialValue: `null`
|
1121
1253
|
*/
|
1122
1254
|
declare class NumberField<
|
1123
1255
|
const Options extends NumberField.Options = NumberField.DefaultOptions,
|
@@ -1127,13 +1259,19 @@ declare class NumberField<
|
|
1127
1259
|
> extends DataField<Options, AssignmentType, InitializedType, PersistedType> {
|
1128
1260
|
/**
|
1129
1261
|
* @param options - Options which configure the behavior of the field
|
1262
|
+
* @param context - Additional context which describes the field
|
1263
|
+
* @remarks Changes the default of `nullable` if passed `choices`
|
1130
1264
|
*/
|
1131
|
-
|
1265
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
1266
|
+
constructor(options?: Options, context?: DataField.ConstructionContext);
|
1132
1267
|
|
1133
1268
|
/** @defaultValue `null` */
|
1134
1269
|
override initial: DataField.Options.InitialType<InitializedType>;
|
1135
1270
|
|
1136
|
-
/**
|
1271
|
+
/**
|
1272
|
+
* @defaultValue `true`
|
1273
|
+
* @remarks If this field is created with `choices`, the default becomes `false`
|
1274
|
+
*/
|
1137
1275
|
override nullable: boolean;
|
1138
1276
|
|
1139
1277
|
/**
|
@@ -1178,20 +1316,19 @@ declare class NumberField<
|
|
1178
1316
|
|
1179
1317
|
protected override _cast(value: AssignmentType): InitializedType;
|
1180
1318
|
|
1181
|
-
|
1319
|
+
/**
|
1320
|
+
* @remarks Applies `integer`, `min`, `max`, and `step`
|
1321
|
+
*
|
1322
|
+
* `options` is only passed to super, so effectively unused
|
1323
|
+
* */
|
1324
|
+
protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions | null): InitializedType;
|
1182
1325
|
|
1326
|
+
/** @remarks `options` is unused in `NumberField` */
|
1183
1327
|
protected override _validateType(
|
1184
1328
|
value: InitializedType,
|
1185
|
-
options?: DataField.
|
1329
|
+
options?: DataField.ValidateOptions<this> | null,
|
1186
1330
|
): boolean | DataModelValidationFailure | void;
|
1187
1331
|
|
1188
|
-
/**
|
1189
|
-
* Test whether a provided value is a valid choice from the allowed choice set
|
1190
|
-
* @param value - The provided value
|
1191
|
-
* @returns Is the choice valid?
|
1192
|
-
*/
|
1193
|
-
#isValidChoice(value: AssignmentType): boolean;
|
1194
|
-
|
1195
1332
|
// These verbose overloads are because otherwise there would be a misleading errors about `choices` being required without mentioning `options` or vice versa.
|
1196
1333
|
toFormGroup(
|
1197
1334
|
groupConfig?: DataField.GroupConfig,
|
@@ -1222,6 +1359,30 @@ declare class NumberField<
|
|
1222
1359
|
protected override _toInput(
|
1223
1360
|
config: NumberField.ToInputConfigWithChoices<InitializedType, Options["choices"]>,
|
1224
1361
|
): HTMLElement | HTMLCollection;
|
1362
|
+
|
1363
|
+
/** @remarks Returns `value * delta`. `model` and `change` are unused in `NumberField` */
|
1364
|
+
protected override _applyChangeMultiply(
|
1365
|
+
value: InitializedType,
|
1366
|
+
delta: InitializedType,
|
1367
|
+
model: DataModel.Any,
|
1368
|
+
change: ActiveEffect.EffectChangeData,
|
1369
|
+
): InitializedType;
|
1370
|
+
|
1371
|
+
/** @remarks Returns `delta > value ? delta : value`. `model` and `change` are unused in `NumberField` */
|
1372
|
+
protected override _applyChangeUpgrade(
|
1373
|
+
value: InitializedType,
|
1374
|
+
delta: InitializedType,
|
1375
|
+
model: DataModel.Any,
|
1376
|
+
change: ActiveEffect.EffectChangeData,
|
1377
|
+
): InitializedType;
|
1378
|
+
|
1379
|
+
/** @remarks Returns `delta < value ? delta : value`. `model` and `change` are unused in `NumberField` */
|
1380
|
+
protected override _applyChangeDowngrade(
|
1381
|
+
value: InitializedType,
|
1382
|
+
delta: InitializedType,
|
1383
|
+
model: DataModel.Any,
|
1384
|
+
change: ActiveEffect.EffectChangeData,
|
1385
|
+
): InitializedType;
|
1225
1386
|
}
|
1226
1387
|
|
1227
1388
|
declare namespace NumberField {
|
@@ -1349,10 +1510,10 @@ declare namespace NumberField {
|
|
1349
1510
|
* @typeParam PersistedType - the type of the persisted values of the StringField
|
1350
1511
|
* @remarks
|
1351
1512
|
* Defaults:
|
1352
|
-
* AssignmentType: `string | null | undefined`
|
1353
|
-
* InitializedType: `string`
|
1354
|
-
* PersistedType: `string`
|
1355
|
-
* InitialValue: `""`
|
1513
|
+
* - AssignmentType: `string | null | undefined`
|
1514
|
+
* - InitializedType: `string`
|
1515
|
+
* - PersistedType: `string`
|
1516
|
+
* - InitialValue: `""`
|
1356
1517
|
*/
|
1357
1518
|
declare class StringField<
|
1358
1519
|
const Options extends StringField.Options<unknown> = StringField.DefaultOptions,
|
@@ -1362,8 +1523,11 @@ declare class StringField<
|
|
1362
1523
|
> extends DataField<Options, AssignmentType, InitializedType, PersistedType> {
|
1363
1524
|
/**
|
1364
1525
|
* @param options - Options which configure the behavior of the field
|
1526
|
+
* @param context - Additional context which describes the field
|
1527
|
+
* @remarks If passed `choices`, changes the defaults of `nullable` and `blank`
|
1365
1528
|
*/
|
1366
|
-
|
1529
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
1530
|
+
constructor(options?: Options, context?: DataField.ConstructionContext);
|
1367
1531
|
|
1368
1532
|
/** @defaultValue `undefined` */
|
1369
1533
|
override initial: DataField.Options.InitialType<InitializedType>;
|
@@ -1371,6 +1535,7 @@ declare class StringField<
|
|
1371
1535
|
/**
|
1372
1536
|
* Is the string allowed to be blank (empty)?
|
1373
1537
|
* @defaultValue `true`
|
1538
|
+
* @remarks If this field is created with `choices`, the default changes to `false`
|
1374
1539
|
*/
|
1375
1540
|
blank: boolean;
|
1376
1541
|
|
@@ -1380,7 +1545,10 @@ declare class StringField<
|
|
1380
1545
|
*/
|
1381
1546
|
trim: boolean;
|
1382
1547
|
|
1383
|
-
/**
|
1548
|
+
/**
|
1549
|
+
* @defaultValue `false`
|
1550
|
+
* @remarks If this field is created with `choices`, the default changes to `false`
|
1551
|
+
*/
|
1384
1552
|
override nullable: boolean;
|
1385
1553
|
|
1386
1554
|
/**
|
@@ -1396,26 +1564,31 @@ declare class StringField<
|
|
1396
1564
|
|
1397
1565
|
protected static override get _defaults(): StringField.Options<unknown>;
|
1398
1566
|
|
1567
|
+
// options: not null (parameter default only, property access)
|
1399
1568
|
override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
|
1400
1569
|
|
1401
1570
|
protected override _cast(value: AssignmentType): InitializedType;
|
1402
1571
|
|
1403
1572
|
protected override _validateSpecial(value: AssignmentType): boolean | void;
|
1404
1573
|
|
1574
|
+
/** @remarks `options` is unused in `StringField` */
|
1405
1575
|
protected override _validateType(
|
1406
1576
|
value: InitializedType,
|
1407
|
-
options?: DataField.
|
1577
|
+
options?: DataField.ValidateOptions<this>,
|
1408
1578
|
): boolean | DataModelValidationFailure | void;
|
1409
1579
|
|
1410
1580
|
/**
|
1411
1581
|
* Test whether a provided value is a valid choice from the allowed choice set
|
1412
1582
|
* @param value - The provided value
|
1413
1583
|
* @returns Is the choice valid?
|
1584
|
+
*
|
1585
|
+
* @privateRemarks `#_validateType` throws if `value` is not `string` before forwarding here
|
1414
1586
|
*/
|
1415
|
-
protected _isValidChoice(value:
|
1587
|
+
protected _isValidChoice(value: string): boolean;
|
1416
1588
|
|
1417
1589
|
/**
|
1418
1590
|
* Get a record of eligible choices for the field.
|
1591
|
+
* @remarks Foundry marked `@internal`
|
1419
1592
|
*/
|
1420
1593
|
static _getChoices(options?: StringField.GetChoicesOptions): FormSelectOption[];
|
1421
1594
|
|
@@ -1553,11 +1726,10 @@ declare namespace StringField {
|
|
1553
1726
|
}
|
1554
1727
|
| readonly string[];
|
1555
1728
|
|
1729
|
+
// TODO: consolidate with inline type in GetChoicesOptions if possible
|
1556
1730
|
type Choices = BaseChoices | (() => BaseChoices);
|
1557
1731
|
|
1558
|
-
/**
|
1559
|
-
* @internal
|
1560
|
-
*/
|
1732
|
+
/** @internal */
|
1561
1733
|
interface _GetChoicesOptions {
|
1562
1734
|
/**
|
1563
1735
|
* The property in the choice object values to use as the option label.
|
@@ -1590,10 +1762,10 @@ declare namespace StringField {
|
|
1590
1762
|
* @typeParam PersistedType - the type of the persisted values of the ObjectField
|
1591
1763
|
* @remarks
|
1592
1764
|
* Defaults:
|
1593
|
-
* AssignmentType: `object | null | undefined`
|
1594
|
-
* InitializedType: `object`
|
1595
|
-
* PersistedType: `object`
|
1596
|
-
* InitialValue: `{}`
|
1765
|
+
* - AssignmentType: `object | null | undefined`
|
1766
|
+
* - InitializedType: `object`
|
1767
|
+
* - PersistedType: `object`
|
1768
|
+
* - InitialValue: `{}`
|
1597
1769
|
*/
|
1598
1770
|
declare class ObjectField<
|
1599
1771
|
const Options extends DataField.Options<AnyObject> = ObjectField.DefaultOptions,
|
@@ -1612,19 +1784,24 @@ declare class ObjectField<
|
|
1612
1784
|
|
1613
1785
|
protected static override get _defaults(): DataField.Options<AnyObject>;
|
1614
1786
|
|
1787
|
+
override getInitialValue(data?: unknown): InitializedType;
|
1788
|
+
|
1615
1789
|
protected override _cast(value: AssignmentType): InitializedType;
|
1616
1790
|
|
1791
|
+
// options: not null (parameter default only)
|
1617
1792
|
override initialize(
|
1618
1793
|
value: PersistedType,
|
1619
1794
|
model: DataModel.Any,
|
1620
|
-
options?:
|
1795
|
+
options?: DataField.InitializeOptions,
|
1621
1796
|
): InitializedType | (() => InitializedType | null);
|
1622
1797
|
|
1623
1798
|
override toObject(value: InitializedType): PersistedType;
|
1624
1799
|
|
1800
|
+
/** @remarks `options` is unused in `ObjectField` */
|
1801
|
+
// options: not null (parameter default only, despite being unused)
|
1625
1802
|
protected override _validateType(
|
1626
1803
|
value: InitializedType,
|
1627
|
-
options?: DataField.
|
1804
|
+
options?: DataField.ValidateOptions<this>,
|
1628
1805
|
): boolean | DataModelValidationFailure | void;
|
1629
1806
|
}
|
1630
1807
|
|
@@ -1702,11 +1879,14 @@ declare namespace ObjectField {
|
|
1702
1879
|
* @typeParam PersistedElementType - the persisted type for the elements in the array
|
1703
1880
|
* @typeParam PersistedType - the type of the persisted values of the ArrayField
|
1704
1881
|
* @remarks
|
1882
|
+
* `ArrayField` itself will not accept Document class instances, that exists on `ElementFieldType` to support
|
1883
|
+
* {@link EmbeddedCollectionField | `EmbeddedCollectionField` }
|
1884
|
+
*
|
1705
1885
|
* Defaults:
|
1706
|
-
* AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
|
1707
|
-
* InitializedType: `InitializedElementType[]`
|
1708
|
-
* PersistedType: `PersistedElementType[]`
|
1709
|
-
* InitialValue: `[]`
|
1886
|
+
* - AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
|
1887
|
+
* - InitializedType: `InitializedElementType[]`
|
1888
|
+
* - PersistedType: `PersistedElementType[]`
|
1889
|
+
* - InitialValue: `[]`
|
1710
1890
|
*/
|
1711
1891
|
declare class ArrayField<
|
1712
1892
|
const ElementFieldType extends DataField.Any | Document.AnyConstructor,
|
@@ -1727,8 +1907,11 @@ declare class ArrayField<
|
|
1727
1907
|
/**
|
1728
1908
|
* @param element - A DataField instance which defines the type of element contained in the Array.
|
1729
1909
|
* @param options - Options which configure the behavior of the field
|
1910
|
+
* @param context - Additional context which describes the field
|
1911
|
+
* @throws If provided a `max` that is lower than `min` (default `0`)
|
1730
1912
|
*/
|
1731
|
-
|
1913
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
1914
|
+
constructor(element: ElementFieldType, options?: Options, context?: DataField.ConstructionContext);
|
1732
1915
|
|
1733
1916
|
/** @defaultValue `true` */
|
1734
1917
|
override required: boolean;
|
@@ -1759,15 +1942,21 @@ declare class ArrayField<
|
|
1759
1942
|
*/
|
1760
1943
|
protected static _validateElementType<T extends DataField.Any>(element: T): T;
|
1761
1944
|
|
1762
|
-
|
1945
|
+
// options: not null (could be destructured in element#_validateModel)
|
1946
|
+
protected override _validateModel(data: AnyObject, options?: DataField.ValidateModelOptions): void;
|
1763
1947
|
|
1764
1948
|
protected override _cast(value: AssignmentType): InitializedType;
|
1765
1949
|
|
1766
|
-
|
1950
|
+
/**
|
1951
|
+
* @remarks `options` gets its `partial` property forced `false`, then each element gets run through its field's `#clean`
|
1952
|
+
* @privateRemarks `null` is allowed for `options` as it gets spread, and `...null` doesn't error
|
1953
|
+
*/
|
1954
|
+
protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions | null): InitializedType;
|
1767
1955
|
|
1956
|
+
// options: not null (parameter default only)
|
1768
1957
|
protected override _validateType(
|
1769
1958
|
value: InitializedType,
|
1770
|
-
options?: DataField.
|
1959
|
+
options?: DataField.ValidateOptions<this>,
|
1771
1960
|
): boolean | DataModelValidationFailure | void;
|
1772
1961
|
|
1773
1962
|
/**
|
@@ -1778,7 +1967,7 @@ declare class ArrayField<
|
|
1778
1967
|
*/
|
1779
1968
|
protected _validateElements(
|
1780
1969
|
value: AnyArray,
|
1781
|
-
options?: DataField.
|
1970
|
+
options?: DataField.ValidateOptions<this> | null,
|
1782
1971
|
): DataModelValidationFailure | void;
|
1783
1972
|
|
1784
1973
|
/**
|
@@ -1789,25 +1978,27 @@ declare class ArrayField<
|
|
1789
1978
|
*/
|
1790
1979
|
protected _validateElement(
|
1791
1980
|
value: unknown,
|
1792
|
-
options: DataField.
|
1981
|
+
options: DataField.ValidateOptions<this>,
|
1793
1982
|
): DataModelValidationFailure | void;
|
1794
1983
|
|
1984
|
+
// options: not null (parameter default only)
|
1795
1985
|
override initialize(
|
1796
1986
|
value: PersistedType,
|
1797
1987
|
model: DataModel.Any,
|
1798
|
-
options?:
|
1988
|
+
options?: DataField.InitializeOptions,
|
1799
1989
|
): InitializedType | (() => InitializedType | null);
|
1800
1990
|
|
1801
1991
|
override toObject(value: InitializedType): PersistedType;
|
1802
1992
|
|
1803
1993
|
// TODO: Limit to the keys of `this` that are actually callable.
|
1804
|
-
|
1805
|
-
|
1806
|
-
value:
|
1994
|
+
// options: not null (could be forwarded somewhere destructured, parameter default only)
|
1995
|
+
override apply<Options, Return>(
|
1996
|
+
fn: keyof this | ((this: this, value: AnyArray, options: Options) => Return),
|
1997
|
+
value?: AnyArray,
|
1807
1998
|
options?: Options,
|
1808
1999
|
): Return;
|
1809
2000
|
|
1810
|
-
protected override _getField(path: string[]):
|
2001
|
+
protected override _getField(path: string[]): DataField.Any;
|
1811
2002
|
|
1812
2003
|
/**
|
1813
2004
|
* Migrate this field's candidate source data.
|
@@ -1815,6 +2006,16 @@ declare class ArrayField<
|
|
1815
2006
|
* @param fieldData - The value of this field within the source data
|
1816
2007
|
*/
|
1817
2008
|
migrateSource(sourceData: AnyObject, fieldData: unknown): unknown;
|
2009
|
+
|
2010
|
+
protected override _castChangeDelta(delta: string): InitializedType;
|
2011
|
+
|
2012
|
+
/** @remarks Returns `value` with `delta` `push`ed. `model` and `change` are unused in `ArrayField` */
|
2013
|
+
protected override _applyChangeAdd(
|
2014
|
+
value: InitializedType,
|
2015
|
+
delta: InitializedType,
|
2016
|
+
model: DataModel.Any,
|
2017
|
+
change: ActiveEffect.EffectChangeData,
|
2018
|
+
): InitializedType;
|
1818
2019
|
}
|
1819
2020
|
|
1820
2021
|
declare namespace ArrayField {
|
@@ -1940,10 +2141,10 @@ declare namespace ArrayField {
|
|
1940
2141
|
* @typeParam PersistedType - the type of the persisted values of the SetField
|
1941
2142
|
* @remarks
|
1942
2143
|
* Defaults:
|
1943
|
-
* AssignmentType: `SetField.BaseAssignmentType<AssignmentElementType> | null | undefined`
|
1944
|
-
* InitializedType: `Set<InitializedElementType>`
|
1945
|
-
* PersistedType: `PersistedElementType[]`
|
1946
|
-
* InitialValue: `new Set()`
|
2144
|
+
* - AssignmentType: `SetField.BaseAssignmentType<AssignmentElementType> | null | undefined`
|
2145
|
+
* - InitializedType: `Set<InitializedElementType>`
|
2146
|
+
* - PersistedType: `PersistedElementType[]`
|
2147
|
+
* - InitialValue: `new Set()`
|
1947
2148
|
*/
|
1948
2149
|
declare class SetField<
|
1949
2150
|
ElementFieldType extends DataField.Any,
|
@@ -1968,15 +2169,17 @@ declare class SetField<
|
|
1968
2169
|
PersistedElementType,
|
1969
2170
|
PersistedType
|
1970
2171
|
> {
|
2172
|
+
// options: required (property access with no default)
|
1971
2173
|
protected override _validateElements(
|
1972
2174
|
value: any[],
|
1973
|
-
options
|
2175
|
+
options: DataField.ValidateOptions<this>,
|
1974
2176
|
): void | DataModelValidationFailure;
|
1975
2177
|
|
2178
|
+
// options: not null (parameter default only)
|
1976
2179
|
override initialize(
|
1977
2180
|
value: PersistedType,
|
1978
2181
|
model: DataModel.Any,
|
1979
|
-
options?:
|
2182
|
+
options?: DataField.InitializeOptions,
|
1980
2183
|
): InitializedType | (() => InitializedType | null);
|
1981
2184
|
|
1982
2185
|
override toObject(value: InitializedType): PersistedType;
|
@@ -1991,6 +2194,19 @@ declare class SetField<
|
|
1991
2194
|
protected override _toInput(
|
1992
2195
|
config: SetField.ToInputConfig<ElementFieldType, InitializedType>,
|
1993
2196
|
): HTMLElement | HTMLCollection;
|
2197
|
+
|
2198
|
+
protected override _castChangeDelta(delta: string): InitializedType;
|
2199
|
+
|
2200
|
+
/**
|
2201
|
+
* @remarks Returns `value` with each element of `delta` `add`ed in order.
|
2202
|
+
* `model` and `change` are unused in `SetField`
|
2203
|
+
*/
|
2204
|
+
protected override _applyChangeAdd(
|
2205
|
+
value: InitializedType,
|
2206
|
+
delta: InitializedType,
|
2207
|
+
model: DataModel.Any,
|
2208
|
+
change: ActiveEffect.EffectChangeData,
|
2209
|
+
): InitializedType;
|
1994
2210
|
}
|
1995
2211
|
|
1996
2212
|
declare namespace SetField {
|
@@ -2079,10 +2295,10 @@ declare namespace SetField {
|
|
2079
2295
|
* @typeParam PersistedType - the type of the persisted values of the EmbeddedDataField
|
2080
2296
|
* @remarks
|
2081
2297
|
* Defaults:
|
2082
|
-
* AssignmentType: `SchemaField.AssignmentType<ModelType["schema"]["fields"]> | null | undefined`
|
2083
|
-
* InitializedType: `SchemaField.InitializedType<ModelType["schema"]["fields"]>`
|
2084
|
-
* PersistedType: `SchemaField.PersistedType<ModelType["schema"]["fields"]>`
|
2085
|
-
* InitialValue: `{}`
|
2298
|
+
* - AssignmentType: `SchemaField.AssignmentType<ModelType["schema"]["fields"]> | null | undefined`
|
2299
|
+
* - InitializedType: `SchemaField.InitializedType<ModelType["schema"]["fields"]>`
|
2300
|
+
* - PersistedType: `SchemaField.PersistedType<ModelType["schema"]["fields"]>`
|
2301
|
+
* - InitialValue: `{}`
|
2086
2302
|
*/
|
2087
2303
|
declare class EmbeddedDataField<
|
2088
2304
|
const ModelType extends DataModel.AnyConstructor,
|
@@ -2094,20 +2310,32 @@ declare class EmbeddedDataField<
|
|
2094
2310
|
/**
|
2095
2311
|
* @param model - The class of DataModel which should be embedded in this field
|
2096
2312
|
* @param options - Options which configure the behavior of the field
|
2313
|
+
* @param context - Additional context which describes the field
|
2097
2314
|
*/
|
2098
|
-
|
2315
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
2316
|
+
constructor(model: ModelType, options?: Options, context?: DataField.ConstructionContext);
|
2099
2317
|
|
2100
2318
|
/**
|
2101
2319
|
* The embedded DataModel definition which is contained in this field.
|
2102
2320
|
*/
|
2103
2321
|
model: ModelType;
|
2104
2322
|
|
2105
|
-
|
2323
|
+
/** @remarks Passed `options.source` will be ignored, forwarded to super with `source: value` */
|
2324
|
+
// options: not null (parameter default only, property access)
|
2325
|
+
override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
|
2326
|
+
|
2327
|
+
/** @remarks Forwards to super with `options.source: value` */
|
2328
|
+
// options: not null (parameter default only, property access)
|
2329
|
+
override validate(
|
2330
|
+
value: AssignmentType,
|
2331
|
+
options?: DataField.ValidateOptions<this>,
|
2332
|
+
): DataModelValidationFailure | void;
|
2106
2333
|
|
2334
|
+
// options: not null (parameter default only)
|
2107
2335
|
override initialize(
|
2108
2336
|
value: PersistedType,
|
2109
2337
|
model: DataModel.Any,
|
2110
|
-
options?:
|
2338
|
+
options?: DataField.InitializeOptions,
|
2111
2339
|
): InitializedType | (() => InitializedType | null);
|
2112
2340
|
|
2113
2341
|
override toObject(value: InitializedType): PersistedType;
|
@@ -2119,7 +2347,7 @@ declare class EmbeddedDataField<
|
|
2119
2347
|
*/
|
2120
2348
|
migrateSource(sourceData: AnyObject, fieldData: unknown): unknown;
|
2121
2349
|
|
2122
|
-
protected override _validateModel(data: AnyObject, options?:
|
2350
|
+
protected override _validateModel(data: AnyObject, options?: DataField.ValidateModelOptions | null): void;
|
2123
2351
|
}
|
2124
2352
|
|
2125
2353
|
declare namespace EmbeddedDataField {
|
@@ -2195,10 +2423,10 @@ declare namespace EmbeddedDataField {
|
|
2195
2423
|
* @typeParam PersistedType - the type of the persisted values of the EmbeddedCollectionField
|
2196
2424
|
* @remarks
|
2197
2425
|
* Defaults:
|
2198
|
-
* AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
|
2199
|
-
* InitializedType: `Collection<InitializedElementType>`
|
2200
|
-
* PersistedType: `PersistedElementType[]`
|
2201
|
-
* InitialValue: `[]`
|
2426
|
+
* - AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
|
2427
|
+
* - InitializedType: `Collection<InitializedElementType>`
|
2428
|
+
* - PersistedType: `PersistedElementType[]`
|
2429
|
+
* - InitialValue: `[]`
|
2202
2430
|
*/
|
2203
2431
|
declare class EmbeddedCollectionField<
|
2204
2432
|
ElementFieldType extends Document.AnyConstructor,
|
@@ -2235,10 +2463,16 @@ declare class EmbeddedCollectionField<
|
|
2235
2463
|
/**
|
2236
2464
|
* @param element - The type of Document which belongs to this embedded collection
|
2237
2465
|
* @param options - Options which configure the behavior of the field
|
2466
|
+
* @param context - Additional context which describes the field
|
2467
|
+
* @remarks Forces `readonly: true`, regardless of passed value
|
2238
2468
|
*/
|
2239
|
-
|
2469
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
2470
|
+
constructor(element: ElementFieldType, options?: Options, context?: DataField.ConstructionContext);
|
2240
2471
|
|
2241
|
-
/**
|
2472
|
+
/**
|
2473
|
+
* @defaultValue `true`
|
2474
|
+
* @remarks Enforced by the constructor
|
2475
|
+
*/
|
2242
2476
|
override readonly: true;
|
2243
2477
|
|
2244
2478
|
protected static override _validateElementType<T extends DataField.Any | Document.AnyConstructor>(element: T): T;
|
@@ -2261,24 +2495,35 @@ declare class EmbeddedCollectionField<
|
|
2261
2495
|
*/
|
2262
2496
|
get schema(): this["model"]["schema"];
|
2263
2497
|
|
2264
|
-
protected override
|
2498
|
+
protected override _cast(value: AssignmentType): InitializedType;
|
2265
2499
|
|
2500
|
+
/**
|
2501
|
+
* @remarks Calls the Collection's Document's Implementation's `schema.clean` on every entry in `value`,
|
2502
|
+
* with `options.source` set to that entry
|
2503
|
+
* @privateRemarks `null` is allowed for `options` as it gets spread, and `...null` doesn't error
|
2504
|
+
*/
|
2505
|
+
protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions | null): InitializedType;
|
2506
|
+
|
2507
|
+
// options: required (property access with no default)
|
2266
2508
|
protected override _validateElements(
|
2267
2509
|
value: any[],
|
2268
|
-
options
|
2510
|
+
options: DataField.ValidateOptions<this>,
|
2269
2511
|
): DataModelValidationFailure | void;
|
2270
2512
|
|
2513
|
+
// options: not null (parameter default only)
|
2271
2514
|
override initialize(
|
2272
2515
|
value: PersistedType,
|
2273
2516
|
model: DataModel.Any,
|
2274
|
-
options?:
|
2517
|
+
options?: DataField.InitializeOptions,
|
2275
2518
|
): InitializedType | (() => InitializedType | null);
|
2276
2519
|
|
2277
2520
|
override toObject(value: InitializedType): PersistedType;
|
2278
2521
|
|
2522
|
+
// TODO: Find a way to limit `Value` to `AnyObject | undefined` here while allowing it to be `unknown` in DataField
|
2523
|
+
// options: not null (could be forwarded somewhere destructured, parameter default only)
|
2279
2524
|
override apply<Value, Options, Return>(
|
2280
2525
|
fn: keyof this | ((this: this, value: Value, options: Options) => Return),
|
2281
|
-
value
|
2526
|
+
value?: Value,
|
2282
2527
|
options?: Options,
|
2283
2528
|
): Return;
|
2284
2529
|
|
@@ -2405,10 +2650,10 @@ declare namespace EmbeddedCollectionField {
|
|
2405
2650
|
* @typeParam PersistedType - the type of the persisted values of the EmbeddedCollectionDeltaField
|
2406
2651
|
* @remarks
|
2407
2652
|
* Defaults:
|
2408
|
-
* AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
|
2409
|
-
* InitializedType: `Collection<InitializedElementType>`
|
2410
|
-
* PersistedType: `PersistedElementType[]`
|
2411
|
-
* InitialValue: `[]`
|
2653
|
+
* - AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
|
2654
|
+
* - InitializedType: `Collection<InitializedElementType>`
|
2655
|
+
* - PersistedType: `PersistedElementType[]`
|
2656
|
+
* - InitialValue: `[]`
|
2412
2657
|
*/
|
2413
2658
|
declare class EmbeddedCollectionDeltaField<
|
2414
2659
|
ElementFieldType extends Document.AnyConstructor,
|
@@ -2444,11 +2689,17 @@ declare class EmbeddedCollectionDeltaField<
|
|
2444
2689
|
> {
|
2445
2690
|
static override get implementation(): typeof EmbeddedCollectionDelta;
|
2446
2691
|
|
2447
|
-
|
2692
|
+
/**
|
2693
|
+
* @remarks Calls the Collection's Document's Implementation's `schema.clean` on every entry in `value`,
|
2694
|
+
* with `options.source` set to that entry, and some special handling for Tombstone data
|
2695
|
+
* @privateRemarks `null` is allowed for `options` as it gets spread, and `...null` doesn't error
|
2696
|
+
*/
|
2697
|
+
protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions | null): InitializedType;
|
2448
2698
|
|
2699
|
+
// options: required (property access with no default)
|
2449
2700
|
protected override _validateElements(
|
2450
2701
|
value: any[],
|
2451
|
-
options
|
2702
|
+
options: DataField.ValidateOptions<this>,
|
2452
2703
|
): void | DataModelValidationFailure;
|
2453
2704
|
}
|
2454
2705
|
|
@@ -2554,10 +2805,10 @@ declare namespace EmbeddedCollectionDeltaField {
|
|
2554
2805
|
* @typeParam PersistedType - the type of the persisted values of the EmbeddedDocumentField
|
2555
2806
|
* @remarks
|
2556
2807
|
* Defaults:
|
2557
|
-
* AssignmentType: `SchemaField.AssignmentType<DocumentType["schema"]["fields"]> | null | undefined`
|
2558
|
-
* InitializedType: `SchemaField.InitializedType<DocumentType["schema"]["fields"]> | null`
|
2559
|
-
* PersistedType: `SchemaField.PersistedType<DocumentType["schema"]["fields"]> | null`
|
2560
|
-
* InitialValue: `{}`
|
2808
|
+
* - AssignmentType: `SchemaField.AssignmentType<DocumentType["schema"]["fields"]> | null | undefined`
|
2809
|
+
* - InitializedType: `SchemaField.InitializedType<DocumentType["schema"]["fields"]> | null`
|
2810
|
+
* - PersistedType: `SchemaField.PersistedType<DocumentType["schema"]["fields"]> | null`
|
2811
|
+
* - InitialValue: `{}`
|
2561
2812
|
*/
|
2562
2813
|
declare class EmbeddedDocumentField<
|
2563
2814
|
const DocumentType extends Document.AnyConstructor,
|
@@ -2569,8 +2820,10 @@ declare class EmbeddedDocumentField<
|
|
2569
2820
|
/**
|
2570
2821
|
* @param model - The type of Document which is embedded.
|
2571
2822
|
* @param options - Options which configure the behavior of the field.
|
2823
|
+
* @param context - Additional context which describes the field
|
2572
2824
|
*/
|
2573
|
-
|
2825
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
2826
|
+
constructor(model: DocumentType, options?: Options, context?: DataField.ConstructionContext);
|
2574
2827
|
|
2575
2828
|
/** @defaultValue `true` */
|
2576
2829
|
override nullable: boolean;
|
@@ -2580,10 +2833,11 @@ declare class EmbeddedDocumentField<
|
|
2580
2833
|
/** @defaultValue `true` */
|
2581
2834
|
static override hierarchical: boolean;
|
2582
2835
|
|
2836
|
+
// options: not null (parameter default only)
|
2583
2837
|
override initialize(
|
2584
2838
|
value: PersistedType,
|
2585
2839
|
model: DataModel.Any,
|
2586
|
-
options?:
|
2840
|
+
options?: DataField.InitializeOptions,
|
2587
2841
|
): InitializedType | (() => InitializedType | null);
|
2588
2842
|
|
2589
2843
|
/**
|
@@ -2671,10 +2925,10 @@ declare namespace EmbeddedDocumentField {
|
|
2671
2925
|
* @typeParam PersistedType - the type of the persisted values of the DocumentIdField
|
2672
2926
|
* @remarks
|
2673
2927
|
* Defaults:
|
2674
|
-
* AssignmentType: `string | Document.Any | null | undefined`
|
2675
|
-
* InitializedType: `string | null`
|
2676
|
-
* PersistedType: `string | null`
|
2677
|
-
* InitialValue: `null`
|
2928
|
+
* - AssignmentType: `string | Document.Any | null | undefined`
|
2929
|
+
* - InitializedType: `string | null`
|
2930
|
+
* - PersistedType: `string | null`
|
2931
|
+
* - InitialValue: `null`
|
2678
2932
|
*/
|
2679
2933
|
declare class DocumentIdField<
|
2680
2934
|
Options extends DocumentIdField.Options = DocumentIdField.DefaultOptions,
|
@@ -2704,9 +2958,10 @@ declare class DocumentIdField<
|
|
2704
2958
|
|
2705
2959
|
protected override _cast(value: AssignmentType): InitializedType;
|
2706
2960
|
|
2961
|
+
/** @remarks `options` is unused in `DocumentIdField` */
|
2707
2962
|
protected override _validateType(
|
2708
2963
|
value: InitializedType,
|
2709
|
-
options?: DataField.
|
2964
|
+
options?: DataField.ValidateOptions<this> | null,
|
2710
2965
|
): boolean | DataModelValidationFailure | void;
|
2711
2966
|
}
|
2712
2967
|
|
@@ -2767,7 +3022,8 @@ declare class DocumentUUIDField<
|
|
2767
3022
|
* @param options - Options which configure the behavior of the field
|
2768
3023
|
* @param context - Additional context which describes the field
|
2769
3024
|
*/
|
2770
|
-
|
3025
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
3026
|
+
constructor(options?: Options, context?: DataField.ConstructionContext);
|
2771
3027
|
|
2772
3028
|
/** A specific document type in CONST.ALL_DOCUMENT_TYPES required by this field */
|
2773
3029
|
type: Document.Type | undefined;
|
@@ -2777,9 +3033,10 @@ declare class DocumentUUIDField<
|
|
2777
3033
|
|
2778
3034
|
static get _defaults(): DocumentUUIDField.Options;
|
2779
3035
|
|
3036
|
+
/** @remarks `options` is unused in `DocumentUUIDField` */
|
2780
3037
|
protected override _validateType(
|
2781
3038
|
value: InitializedType,
|
2782
|
-
options?: DataField.
|
3039
|
+
options?: DataField.ValidateOptions<this> | null,
|
2783
3040
|
): boolean | DataModelValidationFailure | void;
|
2784
3041
|
|
2785
3042
|
// These verbose overloads are because otherwise there would be a misleading errors about `choices` being required without mentioning `options` or vice versa.
|
@@ -2861,10 +3118,10 @@ declare namespace DocumentUUIDField {
|
|
2861
3118
|
* @typeParam PersistedType - the type of the persisted values of the ForeignDocumentField
|
2862
3119
|
* @remarks
|
2863
3120
|
* Defaults:
|
2864
|
-
* AssignmentType: `string | InstanceType<DocumentType> | null | undefined`
|
2865
|
-
* InitializedType: `InstanceType<DocumentType> | null`
|
2866
|
-
* PersistedType: `string | null`
|
2867
|
-
* InitialValue: `null`
|
3121
|
+
* - AssignmentType: `string | InstanceType<DocumentType> | null | undefined`
|
3122
|
+
* - InitializedType: `InstanceType<DocumentType> | null`
|
3123
|
+
* - PersistedType: `string | null`
|
3124
|
+
* - InitialValue: `null`
|
2868
3125
|
*/
|
2869
3126
|
declare class ForeignDocumentField<
|
2870
3127
|
DocumentType extends Document.AnyConstructor,
|
@@ -2876,8 +3133,12 @@ declare class ForeignDocumentField<
|
|
2876
3133
|
/**
|
2877
3134
|
* @param model - The foreign DataModel class definition which this field should link to.
|
2878
3135
|
* @param options - Options which configure the behavior of the field
|
3136
|
+
* @param context - Additional context which describes the field
|
3137
|
+
*
|
3138
|
+
* @privateRemarks Technically the runtime check allows any DataModel, but that seems unintended
|
2879
3139
|
*/
|
2880
|
-
|
3140
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
3141
|
+
constructor(model: DocumentType, options?: Options, context?: DataField.ConstructionContext);
|
2881
3142
|
|
2882
3143
|
/** @defaultValue `true` */
|
2883
3144
|
override nullable: boolean;
|
@@ -2897,13 +3158,16 @@ declare class ForeignDocumentField<
|
|
2897
3158
|
|
2898
3159
|
protected override _cast(value: AssignmentType): InitializedType;
|
2899
3160
|
|
3161
|
+
// options: not null (parameter default only)
|
2900
3162
|
override initialize(
|
2901
3163
|
value: PersistedType,
|
2902
3164
|
model: DataModel.Any,
|
2903
|
-
options?:
|
3165
|
+
options?: DataField.InitializeOptions,
|
2904
3166
|
): InitializedType | (() => InitializedType | null);
|
2905
3167
|
|
2906
3168
|
override toObject(value: InitializedType): PersistedType;
|
3169
|
+
|
3170
|
+
//TODO: _toInput
|
2907
3171
|
}
|
2908
3172
|
|
2909
3173
|
declare namespace ForeignDocumentField {
|
@@ -2966,10 +3230,10 @@ declare namespace ForeignDocumentField {
|
|
2966
3230
|
* @typeParam PersistedType - the type of the persisted values of the ColorField
|
2967
3231
|
* @remarks
|
2968
3232
|
* Defaults:
|
2969
|
-
* AssignmentType: `string | null | undefined`
|
2970
|
-
* InitializedType: `string | null`
|
2971
|
-
* PersistedType: `string | null`
|
2972
|
-
* InitialValue: `null`
|
3233
|
+
* - AssignmentType: `string | null | undefined`
|
3234
|
+
* - InitializedType: `string | null`
|
3235
|
+
* - PersistedType: `string | null`
|
3236
|
+
* - InitialValue: `null`
|
2973
3237
|
*/
|
2974
3238
|
declare class ColorField<
|
2975
3239
|
Options extends StringField.Options = ColorField.DefaultOptions,
|
@@ -2991,12 +3255,32 @@ declare class ColorField<
|
|
2991
3255
|
|
2992
3256
|
protected static override get _defaults(): StringField.Options;
|
2993
3257
|
|
2994
|
-
|
3258
|
+
// options: not null (parameter default only)
|
3259
|
+
override initialize(
|
3260
|
+
value: PersistedType,
|
3261
|
+
model: DataModel.Any,
|
3262
|
+
options?: DataField.InitializeOptions,
|
3263
|
+
): InitializedType | (() => InitializedType | null);
|
3264
|
+
|
3265
|
+
/** @throws If the value isn't a valid {@link foundry.utils.Color.Source | `Color.Source`} *after* going through `super` */
|
3266
|
+
override getInitialValue(data?: unknown): InitializedType;
|
2995
3267
|
|
3268
|
+
protected override _cast(value: AssignmentType): InitializedType;
|
3269
|
+
|
3270
|
+
/**
|
3271
|
+
* @remarks Returns `value.css` if it's a `.valid` `Color`, otherwise `this.getInitialValue(options.source)`
|
3272
|
+
*
|
3273
|
+
* `options` is required as it lacks any default handling and has its `.source` property accessed
|
3274
|
+
*/
|
3275
|
+
protected override _cleanType(value: InitializedType, options: DataField.CleanOptions): InitializedType;
|
3276
|
+
|
3277
|
+
/** @remarks `options` is only passed to super, where it is unused in `StringField` */
|
2996
3278
|
protected override _validateType(
|
2997
3279
|
value: InitializedType,
|
2998
|
-
options?: DataField.
|
3280
|
+
options?: DataField.ValidateOptions<this> | null,
|
2999
3281
|
): boolean | DataModelValidationFailure | void;
|
3282
|
+
|
3283
|
+
protected override _toInput(config: DataField.ToInputConfig<InitializedType>): HTMLElement | HTMLCollection;
|
3000
3284
|
}
|
3001
3285
|
|
3002
3286
|
declare namespace ColorField {
|
@@ -3053,10 +3337,10 @@ declare namespace ColorField {
|
|
3053
3337
|
* @typeParam PersistedType - the type of the persisted values of the FilePathField
|
3054
3338
|
* @remarks
|
3055
3339
|
* Defaults:
|
3056
|
-
* AssignmentType: `string | null | undefined`
|
3057
|
-
* InitializedType: `string | null`
|
3058
|
-
* PersistedType: `string | null`
|
3059
|
-
* InitialValue: `null`
|
3340
|
+
* - AssignmentType: `string | null | undefined`
|
3341
|
+
* - InitializedType: `string | null`
|
3342
|
+
* - PersistedType: `string | null`
|
3343
|
+
* - InitialValue: `null`
|
3060
3344
|
*/
|
3061
3345
|
declare class FilePathField<
|
3062
3346
|
Options extends FilePathField.Options = FilePathField.DefaultOptions,
|
@@ -3066,8 +3350,10 @@ declare class FilePathField<
|
|
3066
3350
|
> extends StringField<Options, AssignmentType, InitializedType, PersistedType> {
|
3067
3351
|
/**
|
3068
3352
|
* @param options - Options which configure the behavior of the field
|
3353
|
+
* @param context - Additional context which describes the field
|
3069
3354
|
*/
|
3070
|
-
|
3355
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
3356
|
+
constructor(options?: Options, context?: DataField.ConstructionContext);
|
3071
3357
|
|
3072
3358
|
/**
|
3073
3359
|
* A set of categories in CONST.FILE_CATEGORIES which this field supports
|
@@ -3100,10 +3386,13 @@ declare class FilePathField<
|
|
3100
3386
|
|
3101
3387
|
override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
|
3102
3388
|
|
3389
|
+
/** @remarks `options` is unused in `FilePathField` */
|
3103
3390
|
protected override _validateType(
|
3104
3391
|
value: InitializedType,
|
3105
|
-
options?: DataField.
|
3392
|
+
options?: DataField.ValidateOptions<this>,
|
3106
3393
|
): boolean | DataModelValidationFailure | void;
|
3394
|
+
|
3395
|
+
// TODO: _toInput
|
3107
3396
|
}
|
3108
3397
|
|
3109
3398
|
declare namespace FilePathField {
|
@@ -3173,10 +3462,10 @@ declare namespace FilePathField {
|
|
3173
3462
|
* @typeParam PersistedType - the type of the persisted values of the AngleField
|
3174
3463
|
* @remarks
|
3175
3464
|
* Defaults:
|
3176
|
-
* AssignmentType: `number | null | undefined`
|
3177
|
-
* InitializedType: `number`
|
3178
|
-
* PersistedType: `number`
|
3179
|
-
* InitialValue: `0`
|
3465
|
+
* - AssignmentType: `number | null | undefined`
|
3466
|
+
* - InitializedType: `number`
|
3467
|
+
* - PersistedType: `number`
|
3468
|
+
* - InitialValue: `0`
|
3180
3469
|
*/
|
3181
3470
|
declare class AngleField<
|
3182
3471
|
Options extends NumberField.Options = AngleField.DefaultOptions,
|
@@ -3184,6 +3473,13 @@ declare class AngleField<
|
|
3184
3473
|
InitializedType = AngleField.InitializedType<Options>,
|
3185
3474
|
PersistedType extends number | null | undefined = AngleField.InitializedType<Options>,
|
3186
3475
|
> extends NumberField<Options, AssignmentType, InitializedType, PersistedType> {
|
3476
|
+
/**
|
3477
|
+
* @param options - Options which configure the behavior of the field
|
3478
|
+
* @param context - Additional context which describes the field
|
3479
|
+
*/
|
3480
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
3481
|
+
constructor(options?: Options, context?: DataField.ConstructionContext);
|
3482
|
+
|
3187
3483
|
/** @defaultValue `true` */
|
3188
3484
|
override required: boolean;
|
3189
3485
|
|
@@ -3193,8 +3489,11 @@ declare class AngleField<
|
|
3193
3489
|
/** @defaultValue `0` */
|
3194
3490
|
override initial: DataField.Options.InitialType<InitializedType>;
|
3195
3491
|
|
3196
|
-
/**
|
3197
|
-
|
3492
|
+
/**
|
3493
|
+
* Whether the angle should be normalized to [0,360) before being clamped to [0,360]. The default is true.
|
3494
|
+
* @defaultValue `true`
|
3495
|
+
*/
|
3496
|
+
normalize: boolean;
|
3198
3497
|
|
3199
3498
|
/** @defaultValue `0` */
|
3200
3499
|
override min: number | undefined;
|
@@ -3208,6 +3507,14 @@ declare class AngleField<
|
|
3208
3507
|
protected static override get _defaults(): NumberField.Options;
|
3209
3508
|
|
3210
3509
|
protected override _cast(value: AssignmentType): InitializedType;
|
3510
|
+
|
3511
|
+
/**
|
3512
|
+
* @deprecated since v12, until v14
|
3513
|
+
* @remarks "The `AngleField#base` is deprecated in favor of {@link AngleField.normalize | `AngleField#normalize`}."
|
3514
|
+
*/
|
3515
|
+
get base(): number;
|
3516
|
+
|
3517
|
+
set base(value);
|
3211
3518
|
}
|
3212
3519
|
|
3213
3520
|
declare namespace AngleField {
|
@@ -3218,7 +3525,7 @@ declare namespace AngleField {
|
|
3218
3525
|
required: true;
|
3219
3526
|
nullable: false;
|
3220
3527
|
initial: 0;
|
3221
|
-
|
3528
|
+
normalize: true;
|
3222
3529
|
min: 0;
|
3223
3530
|
max: 360;
|
3224
3531
|
validationError: "is not a number between 0 and 360";
|
@@ -3258,10 +3565,10 @@ declare namespace AngleField {
|
|
3258
3565
|
* @typeParam PersistedType - the type of the persisted values of the AlphaField
|
3259
3566
|
* @remarks
|
3260
3567
|
* Defaults:
|
3261
|
-
* AssignmentType: `number | null | undefined`
|
3262
|
-
* InitializedType: `number`
|
3263
|
-
* PersistedType: `number`
|
3264
|
-
* InitialValue: `1`
|
3568
|
+
* - AssignmentType: `number | null | undefined`
|
3569
|
+
* - InitializedType: `number`
|
3570
|
+
* - PersistedType: `number`
|
3571
|
+
* - InitialValue: `1`
|
3265
3572
|
*/
|
3266
3573
|
declare class AlphaField<
|
3267
3574
|
Options extends NumberField.Options = AlphaField.DefaultOptions,
|
@@ -3368,10 +3675,10 @@ declare namespace HueField {
|
|
3368
3675
|
* @typeParam PersistedType - the type of the persisted values of the DocumentOwnershipField
|
3369
3676
|
* @remarks
|
3370
3677
|
* Defaults:
|
3371
|
-
* AssignmentType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS> | null | undefined`
|
3372
|
-
* InitializedType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS>`
|
3373
|
-
* PersistedType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS>`
|
3374
|
-
* InitialValue: `{ default: DOCUMENT_OWNERSHIP_LEVELS.NONE }`
|
3678
|
+
* - AssignmentType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS> | null | undefined`
|
3679
|
+
* - InitializedType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS>`
|
3680
|
+
* - PersistedType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS>`
|
3681
|
+
* - InitialValue: `{ default: DOCUMENT_OWNERSHIP_LEVELS.NONE }`
|
3375
3682
|
*/
|
3376
3683
|
declare class DocumentOwnershipField<
|
3377
3684
|
Options extends DocumentOwnershipField.Options = DocumentOwnershipField.DefaultOptions,
|
@@ -3390,9 +3697,10 @@ declare class DocumentOwnershipField<
|
|
3390
3697
|
|
3391
3698
|
protected static override get _defaults(): DocumentOwnershipField.Options;
|
3392
3699
|
|
3700
|
+
/** @remarks `options` is unused in `DocumentOwnershipField` */
|
3393
3701
|
protected override _validateType(
|
3394
3702
|
value: InitializedType,
|
3395
|
-
options?: DataField.
|
3703
|
+
options?: DataField.ValidateOptions<this> | null,
|
3396
3704
|
): boolean | DataModelValidationFailure | void;
|
3397
3705
|
}
|
3398
3706
|
|
@@ -3442,10 +3750,10 @@ declare namespace DocumentOwnershipField {
|
|
3442
3750
|
* @typeParam PersistedType - the type of the persisted values of the JSONField
|
3443
3751
|
* @remarks
|
3444
3752
|
* Defaults:
|
3445
|
-
* AssignmentType: `string | null | undefined`
|
3446
|
-
* InitializedType: `object | undefined`
|
3447
|
-
* PersistedType: `string | undefined`
|
3448
|
-
* InitialValue: `undefined`
|
3753
|
+
* - AssignmentType: `string | null | undefined`
|
3754
|
+
* - InitializedType: `object | undefined`
|
3755
|
+
* - PersistedType: `string | undefined`
|
3756
|
+
* - InitialValue: `undefined`
|
3449
3757
|
*/
|
3450
3758
|
declare class JSONField<
|
3451
3759
|
// TODO(LukeAbby): Due to the unconditional setting of `blank`, `trim`, and `choices` setting them is meaningless which basically means they're removed from the options.
|
@@ -3454,7 +3762,8 @@ declare class JSONField<
|
|
3454
3762
|
InitializedType = JSONField.InitializedType<Options>,
|
3455
3763
|
PersistedType extends string | null | undefined = JSONField.PersistedType<Options>,
|
3456
3764
|
> extends StringField<Options, AssignmentType, InitializedType, PersistedType> {
|
3457
|
-
|
3765
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
3766
|
+
constructor(options?: Options, context?: DataField.ConstructionContext);
|
3458
3767
|
|
3459
3768
|
/** @defaultValue `false` */
|
3460
3769
|
override blank: boolean;
|
@@ -3469,15 +3778,17 @@ declare class JSONField<
|
|
3469
3778
|
|
3470
3779
|
override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
|
3471
3780
|
|
3781
|
+
/** @remarks `options` is unused in `JSONField` */
|
3472
3782
|
protected override _validateType(
|
3473
3783
|
value: InitializedType,
|
3474
|
-
options?: DataField.
|
3784
|
+
options?: DataField.ValidateOptions<this> | null,
|
3475
3785
|
): boolean | DataModelValidationFailure | void;
|
3476
3786
|
|
3787
|
+
// options: not null (parameter default only)
|
3477
3788
|
override initialize(
|
3478
3789
|
value: PersistedType,
|
3479
3790
|
model: DataModel.Any,
|
3480
|
-
options?:
|
3791
|
+
options?: DataField.InitializeOptions,
|
3481
3792
|
): InitializedType | (() => InitializedType | null);
|
3482
3793
|
|
3483
3794
|
override toObject(value: InitializedType): PersistedType;
|
@@ -3559,11 +3870,17 @@ declare namespace JSONField {
|
|
3559
3870
|
*/
|
3560
3871
|
// TODO(LukeAbby): This field effectively removes all options because there's no point asking for an options when none of them do anything.
|
3561
3872
|
declare class AnyField extends DataField<DataField.Options.Any, unknown, unknown, unknown> {
|
3873
|
+
/** @remarks Simply returns `value` */
|
3562
3874
|
override _cast(value: unknown): unknown;
|
3563
3875
|
|
3876
|
+
/**
|
3877
|
+
* @remarks `options` is unused in `AnyField`
|
3878
|
+
*
|
3879
|
+
* Always returns `true`
|
3880
|
+
*/
|
3564
3881
|
protected override _validateType(
|
3565
3882
|
value: unknown,
|
3566
|
-
options?: DataField.
|
3883
|
+
options?: DataField.ValidateOptions<this> | null,
|
3567
3884
|
): boolean | DataModelValidationFailure | void;
|
3568
3885
|
}
|
3569
3886
|
|
@@ -3577,10 +3894,10 @@ declare class AnyField extends DataField<DataField.Options.Any, unknown, unknown
|
|
3577
3894
|
* @typeParam PersistedType - the type of the persisted values of the HTMLField
|
3578
3895
|
* @remarks
|
3579
3896
|
* Defaults:
|
3580
|
-
* AssignmentType: `string | null | undefined`
|
3581
|
-
* InitializedType: `string`
|
3582
|
-
* PersistedType: `string`
|
3583
|
-
* InitialValue: `""`
|
3897
|
+
* - AssignmentType: `string | null | undefined`
|
3898
|
+
* - InitializedType: `string`
|
3899
|
+
* - PersistedType: `string`
|
3900
|
+
* - InitialValue: `""`
|
3584
3901
|
*/
|
3585
3902
|
declare class HTMLField<
|
3586
3903
|
Options extends StringField.Options = HTMLField.DefaultOptions,
|
@@ -3597,6 +3914,7 @@ declare class HTMLField<
|
|
3597
3914
|
protected static override get _defaults(): StringField.Options;
|
3598
3915
|
|
3599
3916
|
// These verbose overloads are because otherwise there would be a misleading errors about `choices` being required without mentioning `options` or vice versa.
|
3917
|
+
/** @remarks Sets `groupConfig.stacked ??= true` before calling super */
|
3600
3918
|
toFormGroup(
|
3601
3919
|
groupConfig?: HTMLField.GroupConfig,
|
3602
3920
|
inputConfig?: DataField.ToInputConfig<InitializedType> | DataField.ToInputConfigWithOptions<InitializedType>,
|
@@ -3667,10 +3985,10 @@ declare namespace HTMLField {
|
|
3667
3985
|
* @typeParam PersistedType - the type of the persisted values of the IntegerSortField
|
3668
3986
|
* @remarks
|
3669
3987
|
* Defaults:
|
3670
|
-
* AssignmentType: `number | null | undefined`
|
3671
|
-
* InitializedType: `number`
|
3672
|
-
* PersistedType: `number`
|
3673
|
-
* InitialValue: `0`
|
3988
|
+
* - AssignmentType: `number | null | undefined`
|
3989
|
+
* - InitializedType: `number`
|
3990
|
+
* - PersistedType: `number`
|
3991
|
+
* - InitialValue: `0`
|
3674
3992
|
*/
|
3675
3993
|
declare class IntegerSortField<
|
3676
3994
|
Options extends NumberField.Options = IntegerSortField.DefaultOptions,
|
@@ -3695,12 +4013,14 @@ declare class IntegerSortField<
|
|
3695
4013
|
|
3696
4014
|
/** @defaultValue `"FOLDER.DocumentSortHint"` */
|
3697
4015
|
override hint: string;
|
4016
|
+
|
4017
|
+
static override get _defaults(): NumberField.Options;
|
3698
4018
|
}
|
3699
4019
|
|
3700
4020
|
declare namespace IntegerSortField {
|
3701
4021
|
/** The type of the default options for the {@link IntegerSortField | `IntegerSortField`} class. */
|
3702
4022
|
type DefaultOptions = SimpleMerge<
|
3703
|
-
|
4023
|
+
NumberField.DefaultOptions,
|
3704
4024
|
{
|
3705
4025
|
required: true;
|
3706
4026
|
nullable: false;
|
@@ -3744,10 +4064,10 @@ declare namespace IntegerSortField {
|
|
3744
4064
|
* @typeParam PersistedType - the type of the persisted values of the DocumentStatsField
|
3745
4065
|
* @remarks
|
3746
4066
|
* Defaults:
|
3747
|
-
* AssignmentType: `Partial<DocumentStats> | null | undefined`
|
3748
|
-
* InitializedType: `DocumentStats`
|
3749
|
-
* PersistedType: `object`
|
3750
|
-
* InitialValue:
|
4067
|
+
* - AssignmentType: `Partial<DocumentStats> | null | undefined`
|
4068
|
+
* - InitializedType: `DocumentStats`
|
4069
|
+
* - PersistedType: `object`
|
4070
|
+
* - InitialValue:
|
3751
4071
|
* ```typescript
|
3752
4072
|
* {
|
3753
4073
|
* systemId: null,
|
@@ -3765,7 +4085,47 @@ declare class DocumentStatsField<
|
|
3765
4085
|
InitializedType = DocumentStatsField.InitializedType<Options>,
|
3766
4086
|
PersistedType extends AnyObject | null | undefined = DocumentStatsField.PersistedType<Options>,
|
3767
4087
|
> extends SchemaField<DocumentStatsField.Schema, Options, AssignmentType, InitializedType, PersistedType> {
|
3768
|
-
|
4088
|
+
/**
|
4089
|
+
* @param options - Options which configure the behavior of the field
|
4090
|
+
* @param context - Additional context which describes the field
|
4091
|
+
*/
|
4092
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
4093
|
+
constructor(options?: Options, context?: DataField.ConstructionContext);
|
4094
|
+
|
4095
|
+
/**
|
4096
|
+
* All Document stats.
|
4097
|
+
* @defaultValue
|
4098
|
+
* ```js
|
4099
|
+
* [
|
4100
|
+
* "coreVersion",
|
4101
|
+
* "systemId",
|
4102
|
+
* "systemVersion",
|
4103
|
+
* "createdTime",
|
4104
|
+
* "modifiedTime",
|
4105
|
+
* "lastModifiedBy",
|
4106
|
+
* "compendiumSource",
|
4107
|
+
* "duplicateSource"
|
4108
|
+
* ]
|
4109
|
+
* ```
|
4110
|
+
*/
|
4111
|
+
static fields: string[];
|
4112
|
+
|
4113
|
+
/**
|
4114
|
+
* These fields are managed by the server and are ignored if they appear in creation or update data.
|
4115
|
+
* @defaultValue
|
4116
|
+
* ```js
|
4117
|
+
* [
|
4118
|
+
* "coreVersion",
|
4119
|
+
* "systemId",
|
4120
|
+
* "systemVersion",
|
4121
|
+
* "createdTime",
|
4122
|
+
* "modifiedTime",
|
4123
|
+
* "lastModifiedBy",
|
4124
|
+
* ]
|
4125
|
+
* ```
|
4126
|
+
* @remarks The only fields not managed are `compendiumSource` and `duplicateSource`
|
4127
|
+
*/
|
4128
|
+
static managedFields: string[];
|
3769
4129
|
}
|
3770
4130
|
|
3771
4131
|
declare namespace DocumentStatsField {
|
@@ -3887,14 +4247,21 @@ declare class DocumentTypeField<
|
|
3887
4247
|
* @param documentClass - The base document class which belongs in this field
|
3888
4248
|
* @param options - Options which configure the behavior of the field
|
3889
4249
|
* @param context - Additional context which describes the field
|
4250
|
+
* @remarks Enforces `choices` being `documentClass.TYPES`
|
3890
4251
|
*/
|
3891
|
-
|
4252
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
4253
|
+
constructor(
|
4254
|
+
documentClass: ConcreteDocumentClass,
|
4255
|
+
options?: DocumentTypeField.Options,
|
4256
|
+
context?: DataField.ConstructionContext,
|
4257
|
+
);
|
3892
4258
|
|
3893
4259
|
static override get _defaults(): DocumentTypeField.Options;
|
3894
4260
|
|
4261
|
+
/** @remarks `options` is required as it has no default handling and its `fallback` property is accessed */
|
3895
4262
|
protected override _validateType(
|
3896
4263
|
value: InitializedType,
|
3897
|
-
options
|
4264
|
+
options: DataField.ValidateOptions<this>,
|
3898
4265
|
): boolean | DataModelValidationFailure | void;
|
3899
4266
|
}
|
3900
4267
|
|
@@ -3946,10 +4313,10 @@ declare namespace DocumentTypeField {
|
|
3946
4313
|
* @typeParam PersistedType - the type of the persisted values of the TypeDataField
|
3947
4314
|
* @remarks
|
3948
4315
|
* Defaults:
|
3949
|
-
* AssignmentType: `SchemaField.AssignmentType<DocumentType["schema"]["fields"]> | null | undefined`
|
3950
|
-
* InitializedType: `SchemaField.InitializedType<DocumentType["schema"]["fields"]>`
|
3951
|
-
* PersistedType: `SchemaField.PersistedType<DocumentType["schema"]["fields"]>`
|
3952
|
-
* InitialValue: `{}`
|
4316
|
+
* - AssignmentType: `SchemaField.AssignmentType<DocumentType["schema"]["fields"]> | null | undefined`
|
4317
|
+
* - InitializedType: `SchemaField.InitializedType<DocumentType["schema"]["fields"]>`
|
4318
|
+
* - PersistedType: `SchemaField.PersistedType<DocumentType["schema"]["fields"]>`
|
4319
|
+
* - InitialValue: `{}`
|
3953
4320
|
*/
|
3954
4321
|
declare class TypeDataField<
|
3955
4322
|
const SystemDocument extends Document.SystemConstructor,
|
@@ -3961,8 +4328,10 @@ declare class TypeDataField<
|
|
3961
4328
|
/**
|
3962
4329
|
* @param document - The base document class which belongs in this field
|
3963
4330
|
* @param options - Options which configure the behavior of the field
|
4331
|
+
* @param context - Additional context which describes the field
|
3964
4332
|
*/
|
3965
|
-
|
4333
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
4334
|
+
constructor(document: SystemDocument, options?: Options, context?: DataField.ConstructionContext);
|
3966
4335
|
|
3967
4336
|
/** @defaultValue `true` */
|
3968
4337
|
override required: boolean;
|
@@ -3995,22 +4364,34 @@ declare class TypeDataField<
|
|
3995
4364
|
*/
|
3996
4365
|
getModelForType(type: string): DataModel.AnyConstructor | null;
|
3997
4366
|
|
3998
|
-
|
4367
|
+
/** @remarks If an object with a valid `type` isn't passed, returns `{}` */
|
4368
|
+
override getInitialValue(data?: { type?: string }): InitializedType;
|
3999
4369
|
|
4000
|
-
|
4370
|
+
/**
|
4371
|
+
* @remarks Returns:
|
4372
|
+
* - If a valid TypeDataModel, the `value` run through its `.cleanData` with `options.source: value`, else
|
4373
|
+
* - If `options.partial`, simply `value`, else
|
4374
|
+
* - A `mergeObject` of `this.getInitialValue(options.source)` and `value`
|
4375
|
+
*
|
4376
|
+
* `options` is required as it lacks any default handling and has its properties accessed
|
4377
|
+
*/
|
4378
|
+
protected override _cleanType(value: InitializedType, options: DataField.CleanOptions): InitializedType;
|
4001
4379
|
|
4380
|
+
// options: not null (parameter default only)
|
4002
4381
|
override initialize(
|
4003
4382
|
value: PersistedType,
|
4004
4383
|
model: DataModel.Any,
|
4005
|
-
options?:
|
4384
|
+
options?: DataField.InitializeOptions,
|
4006
4385
|
): InitializedType | (() => InitializedType | null);
|
4007
4386
|
|
4387
|
+
// options: not null (parameter default only, property access)
|
4008
4388
|
protected override _validateType(
|
4009
4389
|
value: InitializedType,
|
4010
|
-
options?: DataField.
|
4390
|
+
options?: DataField.ValidateOptions<this>,
|
4011
4391
|
): boolean | DataModelValidationFailure | void;
|
4012
4392
|
|
4013
|
-
|
4393
|
+
// options: not ull (parameter default only, property access)
|
4394
|
+
protected override _validateModel(data: AnyObject, options?: DataField.ValidateModelOptions): void;
|
4014
4395
|
|
4015
4396
|
override toObject(value: InitializedType): PersistedType;
|
4016
4397
|
|
@@ -4117,7 +4498,8 @@ declare class TypedSchemaField<
|
|
4117
4498
|
* @param options - Options which configure the behavior of the field
|
4118
4499
|
* @param context - Additional context which describes the field
|
4119
4500
|
*/
|
4120
|
-
|
4501
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
4502
|
+
constructor(types: Types, options?: Options, context?: DataField.ConstructionContext);
|
4121
4503
|
|
4122
4504
|
static get _defaults(): DataField.Options.Any;
|
4123
4505
|
|
@@ -4126,28 +4508,42 @@ declare class TypedSchemaField<
|
|
4126
4508
|
*/
|
4127
4509
|
types: TypedSchemaField.ToConfiguredTypes<Types>;
|
4128
4510
|
|
4129
|
-
protected override _getField(path: string[]):
|
4511
|
+
protected override _getField(path: string[]): DataField.Any;
|
4130
4512
|
|
4513
|
+
/**
|
4514
|
+
* @remarks Returns `value` if `value?.type` doesn't map to a valid type, otherwise it runs `value`
|
4515
|
+
* through the matching type's `#clean`
|
4516
|
+
*/
|
4517
|
+
// options: not null (parameter default only, property access in super)
|
4131
4518
|
protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
|
4132
4519
|
|
4133
4520
|
protected override _cast(value: AssignmentType): InitializedType;
|
4134
4521
|
|
4135
4522
|
protected override _validateSpecial(value: AssignmentType): boolean | void;
|
4136
4523
|
|
4524
|
+
/** @remarks Forwards to the SchemaField designated by `value.type`'s `#validate` */
|
4525
|
+
// options: not null (parameter default only, property access in super)
|
4137
4526
|
protected override _validateType(
|
4138
4527
|
value: InitializedType,
|
4139
|
-
options?: DataField.
|
4528
|
+
options?: DataField.ValidateOptions<this>,
|
4140
4529
|
): boolean | DataModelValidationFailure | void;
|
4141
4530
|
|
4531
|
+
// options: not null (parameter default only)
|
4142
4532
|
override initialize(
|
4143
4533
|
value: PersistedType,
|
4144
4534
|
model: DataModel.Any,
|
4145
|
-
options?:
|
4146
|
-
): (() => InitializedType | null)
|
4535
|
+
options?: DataField.InitializeOptions,
|
4536
|
+
): InitializedType | (() => InitializedType | null);
|
4147
4537
|
|
4148
4538
|
override toObject(value: InitializedType): PersistedType;
|
4149
4539
|
|
4150
4540
|
// TODO(LukeAbby): Type `TypedSchemaField#apply`.
|
4541
|
+
// options: not null (could be forwarded somewhere destructured, parameter default only)
|
4542
|
+
override apply<Options, Return>(
|
4543
|
+
fn: keyof this | ((this: this, value: AnyObject, options: Options) => Return),
|
4544
|
+
value?: AnyObject,
|
4545
|
+
options?: Options,
|
4546
|
+
): Return;
|
4151
4547
|
|
4152
4548
|
migrateSource(sourceData: AnyObject, fieldData: unknown): unknown;
|
4153
4549
|
}
|
@@ -4237,7 +4633,7 @@ declare namespace TypedSchemaField {
|
|
4237
4633
|
}
|
4238
4634
|
|
4239
4635
|
/**
|
4240
|
-
* @deprecated since v11; ModelValidationError is deprecated. Please use DataModelValidationError instead.
|
4636
|
+
* @deprecated since v11 until v13; ModelValidationError is deprecated. Please use DataModelValidationError instead.
|
4241
4637
|
* @typeParam Errors - the type of the errors contained in this error
|
4242
4638
|
*/
|
4243
4639
|
declare class ModelValidationError<
|
@@ -4263,7 +4659,7 @@ declare class ModelValidationError<
|
|
4263
4659
|
|
4264
4660
|
declare namespace ModelValidationError {
|
4265
4661
|
/**
|
4266
|
-
* @deprecated since v11; ModelValidationError is deprecated. Please use DataModelValidationError instead.
|
4662
|
+
* @deprecated since v11 until v13; ModelValidationError is deprecated. Please use DataModelValidationError instead.
|
4267
4663
|
*/
|
4268
4664
|
type Errors = Record<number | string | symbol, Error> | Error[] | string;
|
4269
4665
|
}
|
@@ -4292,15 +4688,23 @@ declare class JavaScriptField<
|
|
4292
4688
|
const InitializedType = StringField.InitializedType<Options>,
|
4293
4689
|
const PersistedType extends string | null | undefined = StringField.InitializedType<Options>,
|
4294
4690
|
> extends _InternalJavaScriptField<Options, AssignmentType, InitializedType, PersistedType> {
|
4295
|
-
|
4691
|
+
/**
|
4692
|
+
* @param options - Options which configure the behavior of the field
|
4693
|
+
* @param context - Additional context which describes the field
|
4694
|
+
* @remarks Enforces `choices = undefined`
|
4695
|
+
*/
|
4696
|
+
// options: not null (unchecked `in` operation in super), context: not null (destructured in super)
|
4697
|
+
constructor(options?: Options, context?: DataField.ConstructionContext);
|
4296
4698
|
|
4297
4699
|
static get _defaults(): JavaScriptField.Options;
|
4298
4700
|
|
4701
|
+
/** @remarks `options` is only passed to super, where it is unused in `StringField` */
|
4299
4702
|
protected override _validateType(
|
4300
4703
|
value: InitializedType,
|
4301
|
-
options?: DataField.
|
4704
|
+
options?: DataField.ValidateOptions<this> | null,
|
4302
4705
|
): boolean | DataModelValidationFailure | void;
|
4303
4706
|
|
4707
|
+
/** @remarks Sets `groupConfig.stacked ??= true` then forwards to super */
|
4304
4708
|
override toFormGroup(
|
4305
4709
|
groupConfig?: JavaScriptField.GroupConfig,
|
4306
4710
|
inputConfig?: JavaScriptField.ToInputConfig<InitializedType>,
|