@league-of-foundry-developers/foundry-vtt-types 9.280.1 → 12.331.2-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -20
- package/index-lenient.d.mts +7 -0
- package/index.d.mts +5 -0
- package/package.json +67 -39
- package/src/foundry/client/apps/app.d.mts +602 -0
- package/src/foundry/client/apps/av/av-config.d.mts +93 -0
- package/src/foundry/client/apps/av/cameras.d.mts +189 -0
- package/src/foundry/client/apps/av/index.d.mts +3 -0
- package/src/foundry/client/apps/dialogs/folder-export.d.mts +16 -0
- package/src/foundry/client/apps/dialogs/index.d.mts +1 -0
- package/src/foundry/client/apps/form.d.mts +484 -0
- package/src/foundry/client/apps/forms/actor.d.mts +176 -0
- package/src/foundry/client/apps/forms/adventure-exporter.d.mts +132 -0
- package/src/foundry/client/apps/forms/adventure-importer.d.mts +85 -0
- package/src/foundry/client/apps/forms/base-sheet.d.mts +45 -0
- package/src/foundry/client/apps/forms/card-config.d.mts +48 -0
- package/src/foundry/client/apps/forms/cards-config.d.mts +141 -0
- package/src/foundry/client/apps/forms/combat-config.d.mts +51 -0
- package/src/foundry/client/apps/forms/combatant-config.d.mts +45 -0
- package/src/foundry/client/apps/forms/default-sheets-config.d.mts +46 -0
- package/src/foundry/client/apps/forms/effect-config.d.mts +77 -0
- package/src/foundry/client/apps/forms/folder-config.d.mts +60 -0
- package/src/foundry/client/apps/forms/fonts.d.mts +168 -0
- package/src/foundry/client/apps/forms/grid-config.d.mts +144 -0
- package/src/foundry/client/apps/forms/image-popout.d.mts +179 -0
- package/src/foundry/client/apps/forms/index.d.mts +26 -0
- package/src/foundry/client/apps/forms/item.d.mts +58 -0
- package/src/foundry/client/apps/forms/journal-page-sheet.d.mts +313 -0
- package/src/foundry/client/apps/forms/journal-sheet.d.mts +312 -0
- package/src/foundry/client/apps/forms/macro-config.d.mts +59 -0
- package/src/foundry/client/apps/forms/measure-template.d.mts +59 -0
- package/src/foundry/client/apps/forms/ownership.d.mts +66 -0
- package/src/foundry/client/apps/forms/playlist-config.d.mts +46 -0
- package/src/foundry/client/apps/forms/playlist-sound-config.d.mts +63 -0
- package/src/foundry/client/apps/forms/roll-table-config.d.mts +160 -0
- package/src/foundry/client/apps/forms/scene-config.d.mts +157 -0
- package/src/foundry/client/apps/forms/sheet-config.d.mts +203 -0
- package/src/foundry/client/apps/forms/user-config.d.mts +71 -0
- package/src/foundry/client/apps/hud/chatbubble.d.mts +113 -0
- package/src/foundry/client/apps/hud/container.d.mts +54 -0
- package/src/foundry/client/apps/hud/controls.d.mts +166 -0
- package/src/foundry/client/apps/hud/hotbar.d.mts +169 -0
- package/src/foundry/client/apps/hud/hud.d.mts +87 -0
- package/src/foundry/client/apps/hud/index.d.mts +9 -0
- package/src/foundry/client/apps/hud/menu.d.mts +77 -0
- package/src/foundry/client/apps/hud/navigation.d.mts +116 -0
- package/src/foundry/client/apps/hud/pause.d.mts +32 -0
- package/src/foundry/client/apps/hud/players.d.mts +82 -0
- package/src/foundry/client/apps/i18n.d.mts +218 -0
- package/src/foundry/client/apps/index.d.mts +10 -0
- package/src/foundry/client/apps/placeables/drawing-config.d.mts +80 -0
- package/src/foundry/client/apps/placeables/drawing-hud.d.mts +31 -0
- package/src/foundry/client/apps/placeables/index.d.mts +10 -0
- package/src/foundry/client/apps/placeables/light-config.d.mts +100 -0
- package/src/foundry/client/apps/placeables/note-config.d.mts +65 -0
- package/src/foundry/client/apps/placeables/sound-config.d.mts +43 -0
- package/src/foundry/client/apps/placeables/tile-config.d.mts +54 -0
- package/src/foundry/client/apps/placeables/tile-hud.d.mts +37 -0
- package/src/foundry/client/apps/placeables/token-config.d.mts +244 -0
- package/src/foundry/client/apps/placeables/token-hud.d.mts +134 -0
- package/src/foundry/client/apps/placeables/wall-config.d.mts +63 -0
- package/src/foundry/client/apps/sidebar/apps/chat-popout.d.mts +39 -0
- package/src/foundry/client/apps/sidebar/apps/client-settings.d.mts +98 -0
- package/src/foundry/client/apps/sidebar/apps/compendium.d.mts +93 -0
- package/src/foundry/client/apps/sidebar/apps/index.d.mts +10 -0
- package/src/foundry/client/apps/sidebar/apps/invitation-links.d.mts +32 -0
- package/src/foundry/client/apps/sidebar/apps/keybindings-config.d.mts +180 -0
- package/src/foundry/client/apps/sidebar/apps/module-management.d.mts +135 -0
- package/src/foundry/client/apps/sidebar/apps/permission-config.d.mts +72 -0
- package/src/foundry/client/apps/sidebar/apps/support-details.d.mts +121 -0
- package/src/foundry/client/apps/sidebar/apps/tours-management.d.mts +54 -0
- package/src/foundry/client/apps/sidebar/apps/world-config.d.mts +57 -0
- package/src/foundry/client/apps/sidebar/directory-tab-mixin.d.mts +276 -0
- package/src/foundry/client/apps/sidebar/document-directory.d.mts +163 -0
- package/src/foundry/client/apps/sidebar/index.d.mts +7 -0
- package/src/foundry/client/apps/sidebar/package-configuration.d.mts +86 -0
- package/src/foundry/client/apps/sidebar/sidebar-tab.d.mts +80 -0
- package/src/foundry/client/apps/sidebar/sidebar.d.mts +95 -0
- package/src/foundry/client/apps/sidebar/tabs/actors-directory.d.mts +20 -0
- package/src/foundry/client/apps/sidebar/tabs/cards-directory.d.mts +12 -0
- package/src/foundry/client/apps/sidebar/tabs/chat-log.d.mts +364 -0
- package/src/foundry/client/apps/sidebar/tabs/combat-tracker.d.mts +156 -0
- package/src/foundry/client/apps/sidebar/tabs/compendium-directory.d.mts +105 -0
- package/src/foundry/client/apps/sidebar/tabs/index.d.mts +12 -0
- package/src/foundry/client/apps/sidebar/tabs/items-directory.d.mts +14 -0
- package/src/foundry/client/apps/sidebar/tabs/journal-directory.d.mts +13 -0
- package/src/foundry/client/apps/sidebar/tabs/macros-directory.d.mts +16 -0
- package/src/foundry/client/apps/sidebar/tabs/playlists-directory.d.mts +275 -0
- package/src/foundry/client/apps/sidebar/tabs/roll-table-directory.d.mts +13 -0
- package/src/foundry/client/apps/sidebar/tabs/scenes-directory.d.mts +34 -0
- package/src/foundry/client/apps/sidebar/tabs/settings.d.mts +72 -0
- package/src/foundry/client/apps/templates.d.mts +482 -0
- package/src/foundry/client/av/client.d.mts +162 -0
- package/src/foundry/client/av/clients/index.d.mts +1 -0
- package/src/foundry/client/av/clients/simplepeer.d.mts +155 -0
- package/src/foundry/client/av/index.d.mts +4 -0
- package/src/foundry/client/av/master.d.mts +191 -0
- package/src/foundry/client/av/settings.d.mts +315 -0
- package/src/foundry/client/config.d.mts +3164 -0
- package/src/foundry/client/core/clipboard.d.mts +20 -0
- package/src/foundry/client/core/document-index.d.mts +118 -0
- package/src/foundry/client/core/gamepad.d.mts +76 -0
- package/src/foundry/client/core/hooks.d.mts +132 -0
- package/src/foundry/client/core/image.d.mts +190 -0
- package/src/foundry/client/core/index.d.mts +21 -0
- package/src/foundry/client/core/issues.d.mts +102 -0
- package/src/foundry/client/core/keybindings.d.mts +413 -0
- package/src/foundry/client/core/keyboard.d.mts +271 -0
- package/src/foundry/client/core/mouse.d.mts +28 -0
- package/src/foundry/client/core/nue.d.mts +38 -0
- package/src/foundry/client/core/packages.d.mts +201 -0
- package/src/foundry/client/core/settings.d.mts +361 -0
- package/src/foundry/client/core/socket.d.mts +62 -0
- package/src/foundry/client/core/sorting.d.mts +76 -0
- package/src/foundry/client/core/time.d.mts +73 -0
- package/src/foundry/client/core/tooltip.d.mts +198 -0
- package/src/foundry/client/core/tour.d.mts +279 -0
- package/src/foundry/client/core/tours.d.mts +22 -0
- package/src/foundry/client/core/utils.d.mts +71 -0
- package/src/foundry/client/core/video.d.mts +161 -0
- package/src/foundry/client/core/workers.d.mts +128 -0
- package/src/foundry/client/data/abstract/canvas-document.d.mts +70 -0
- package/src/foundry/client/data/abstract/client-document.d.mts +717 -0
- package/src/foundry/client/data/abstract/directory-collection-mixin.d.mts +135 -0
- package/src/foundry/client/data/abstract/document-collection.d.mts +218 -0
- package/src/foundry/client/data/abstract/index.d.mts +5 -0
- package/src/foundry/client/data/abstract/world-collection.d.mts +165 -0
- package/src/foundry/client/data/collections/actors.d.mts +49 -0
- package/src/foundry/client/data/collections/cards.d.mts +12 -0
- package/src/foundry/client/data/collections/combats.d.mts +43 -0
- package/src/foundry/client/data/collections/compendium-collection.d.mts +490 -0
- package/src/foundry/client/data/collections/compendium-folders.d.mts +27 -0
- package/src/foundry/client/data/collections/compendium-packs.d.mts +27 -0
- package/src/foundry/client/data/collections/fog.d.mts +17 -0
- package/src/foundry/client/data/collections/folder.d.mts +33 -0
- package/src/foundry/client/data/collections/index.d.mts +17 -0
- package/src/foundry/client/data/collections/items.d.mts +14 -0
- package/src/foundry/client/data/collections/journal.d.mts +64 -0
- package/src/foundry/client/data/collections/macros.d.mts +32 -0
- package/src/foundry/client/data/collections/messages.d.mts +35 -0
- package/src/foundry/client/data/collections/playlists.d.mts +32 -0
- package/src/foundry/client/data/collections/scenes.d.mts +68 -0
- package/src/foundry/client/data/collections/settings.d.mts +29 -0
- package/src/foundry/client/data/collections/tables.d.mts +21 -0
- package/src/foundry/client/data/collections/users.d.mts +50 -0
- package/src/foundry/client/data/documents/active-effect.d.mts +360 -0
- package/src/foundry/client/data/documents/actor-delta.d.mts +99 -0
- package/src/foundry/client/data/documents/actor.d.mts +315 -0
- package/src/foundry/client/data/documents/adventure.d.mts +105 -0
- package/src/foundry/client/data/documents/ambient-light.d.mts +43 -0
- package/src/foundry/client/data/documents/ambient-sound.d.mts +30 -0
- package/src/foundry/client/data/documents/card.d.mts +127 -0
- package/src/foundry/client/data/documents/cards.d.mts +354 -0
- package/src/foundry/client/data/documents/chat-message.d.mts +230 -0
- package/src/foundry/client/data/documents/combat.d.mts +328 -0
- package/src/foundry/client/data/documents/combatant.d.mts +114 -0
- package/src/foundry/client/data/documents/drawing.d.mts +35 -0
- package/src/foundry/client/data/documents/fog-exploration.d.mts +62 -0
- package/src/foundry/client/data/documents/folder.d.mts +135 -0
- package/src/foundry/client/data/documents/index.d.mts +30 -0
- package/src/foundry/client/data/documents/item.d.mts +67 -0
- package/src/foundry/client/data/documents/journal-entry-page.d.mts +231 -0
- package/src/foundry/client/data/documents/journal-entry.d.mts +81 -0
- package/src/foundry/client/data/documents/macro.d.mts +87 -0
- package/src/foundry/client/data/documents/measured-template.d.mts +40 -0
- package/src/foundry/client/data/documents/note.d.mts +46 -0
- package/src/foundry/client/data/documents/playlist-sound.d.mts +127 -0
- package/src/foundry/client/data/documents/playlist.d.mts +207 -0
- package/src/foundry/client/data/documents/scene.d.mts +256 -0
- package/src/foundry/client/data/documents/setting.d.mts +54 -0
- package/src/foundry/client/data/documents/table-result.d.mts +41 -0
- package/src/foundry/client/data/documents/table.d.mts +321 -0
- package/src/foundry/client/data/documents/tile.d.mts +32 -0
- package/src/foundry/client/data/documents/token.d.mts +356 -0
- package/src/foundry/client/data/documents/user.d.mts +164 -0
- package/src/foundry/client/data/documents/wall.d.mts +30 -0
- package/src/foundry/client/data/index.d.mts +3 -0
- package/src/foundry/client/game.d.mts +783 -0
- package/src/foundry/client/head.d.mts +86 -0
- package/src/foundry/client/hooks.d.mts +1234 -0
- package/src/foundry/client/index.d.mts +12 -0
- package/src/foundry/client/pixi/board.d.mts +820 -0
- package/src/foundry/client/pixi/core/containers/base-canvas-group.d.mts +83 -0
- package/src/foundry/client/pixi/core/containers/cached-container.d.mts +118 -0
- package/src/foundry/client/pixi/core/containers/full-canvas-container.d.mts +37 -0
- package/src/foundry/client/pixi/core/containers/index.d.mts +8 -0
- package/src/foundry/client/pixi/core/containers/point-source-mesh.d.mts +62 -0
- package/src/foundry/client/pixi/core/containers/quad-mesh.d.mts +43 -0
- package/src/foundry/client/pixi/core/containers/quadtree.d.mts +199 -0
- package/src/foundry/client/pixi/core/containers/sprite-mesh.d.mts +326 -0
- package/src/foundry/client/pixi/core/containers/unbound-container.d.mts +21 -0
- package/src/foundry/client/pixi/core/index.d.mts +4 -0
- package/src/foundry/client/pixi/core/interaction/canvas-animation.d.mts +177 -0
- package/src/foundry/client/pixi/core/interaction/control-icon.d.mts +89 -0
- package/src/foundry/client/pixi/core/interaction/index.d.mts +8 -0
- package/src/foundry/client/pixi/core/interaction/mouse-handler.d.mts +291 -0
- package/src/foundry/client/pixi/core/interaction/ping.d.mts +58 -0
- package/src/foundry/client/pixi/core/interaction/pings/chevron.d.mts +73 -0
- package/src/foundry/client/pixi/core/interaction/pings/index.d.mts +2 -0
- package/src/foundry/client/pixi/core/interaction/pings/pulse.d.mts +115 -0
- package/src/foundry/client/pixi/core/interaction/render-flags.d.mts +126 -0
- package/src/foundry/client/pixi/core/interaction/resize-handle.d.mts +52 -0
- package/src/foundry/client/pixi/core/interaction/targets.d.mts +45 -0
- package/src/foundry/client/pixi/core/loader.d.mts +246 -0
- package/src/foundry/client/pixi/core/shapes/index.d.mts +5 -0
- package/src/foundry/client/pixi/core/shapes/limited-angle-polygon.d.mts +119 -0
- package/src/foundry/client/pixi/core/shapes/polygon-mesher.d.mts +110 -0
- package/src/foundry/client/pixi/core/shapes/precise-text.d.mts +27 -0
- package/src/foundry/client/pixi/core/shapes/ray.d.mts +165 -0
- package/src/foundry/client/pixi/core/shapes/source-polygon.d.mts +249 -0
- package/src/foundry/client/pixi/extensions/circle.d.mts +132 -0
- package/src/foundry/client/pixi/extensions/graphics.d.mts +43 -0
- package/src/foundry/client/pixi/extensions/index.d.mts +5 -0
- package/src/foundry/client/pixi/extensions/observable-transform.d.mts +30 -0
- package/src/foundry/client/pixi/extensions/polygon.d.mts +142 -0
- package/src/foundry/client/pixi/extensions/rectangle.d.mts +248 -0
- package/src/foundry/client/pixi/groups/effects.d.mts +186 -0
- package/src/foundry/client/pixi/groups/environment.d.mts +80 -0
- package/src/foundry/client/pixi/groups/hidden.d.mts +40 -0
- package/src/foundry/client/pixi/groups/index.d.mts +7 -0
- package/src/foundry/client/pixi/groups/interface.d.mts +74 -0
- package/src/foundry/client/pixi/groups/overlay.d.mts +18 -0
- package/src/foundry/client/pixi/groups/primary.d.mts +200 -0
- package/src/foundry/client/pixi/groups/rendered.d.mts +18 -0
- package/src/foundry/client/pixi/index.d.mts +10 -0
- package/src/foundry/client/pixi/layers/base/canvas-layer.d.mts +95 -0
- package/src/foundry/client/pixi/layers/base/index.d.mts +3 -0
- package/src/foundry/client/pixi/layers/base/interaction-layer.d.mts +162 -0
- package/src/foundry/client/pixi/layers/base/placeables-layer.d.mts +643 -0
- package/src/foundry/client/pixi/layers/controls/cursor.d.mts +33 -0
- package/src/foundry/client/pixi/layers/controls/door.d.mts +68 -0
- package/src/foundry/client/pixi/layers/controls/index.d.mts +4 -0
- package/src/foundry/client/pixi/layers/controls/layer.d.mts +262 -0
- package/src/foundry/client/pixi/layers/controls/ruler.d.mts +475 -0
- package/src/foundry/client/pixi/layers/effects/background-effects.d.mts +50 -0
- package/src/foundry/client/pixi/layers/effects/coloration-effects.d.mts +42 -0
- package/src/foundry/client/pixi/layers/effects/darkness-effects.d.mts +33 -0
- package/src/foundry/client/pixi/layers/effects/illumination-effects.d.mts +151 -0
- package/src/foundry/client/pixi/layers/effects/index.d.mts +7 -0
- package/src/foundry/client/pixi/layers/effects/visibility.d.mts +225 -0
- package/src/foundry/client/pixi/layers/effects/weather/particles/effect.d.mts +47 -0
- package/src/foundry/client/pixi/layers/effects/weather/particles/index.d.mts +2 -0
- package/src/foundry/client/pixi/layers/effects/weather/particles/leaves.d.mts +20 -0
- package/src/foundry/client/pixi/layers/effects/weather-effects.d.mts +227 -0
- package/src/foundry/client/pixi/layers/grid/highlight.d.mts +33 -0
- package/src/foundry/client/pixi/layers/grid/index.d.mts +3 -0
- package/src/foundry/client/pixi/layers/grid/layer.d.mts +269 -0
- package/src/foundry/client/pixi/layers/grid/mesh.d.mts +73 -0
- package/src/foundry/client/pixi/layers/index.d.mts +6 -0
- package/src/foundry/client/pixi/layers/masks/depth.d.mts +62 -0
- package/src/foundry/client/pixi/layers/masks/index.d.mts +3 -0
- package/src/foundry/client/pixi/layers/masks/occlusion.d.mts +91 -0
- package/src/foundry/client/pixi/layers/masks/vision.d.mts +116 -0
- package/src/foundry/client/pixi/layers/placeables/drawings.d.mts +111 -0
- package/src/foundry/client/pixi/layers/placeables/index.d.mts +8 -0
- package/src/foundry/client/pixi/layers/placeables/lighting.d.mts +83 -0
- package/src/foundry/client/pixi/layers/placeables/notes.d.mts +110 -0
- package/src/foundry/client/pixi/layers/placeables/sounds.d.mts +320 -0
- package/src/foundry/client/pixi/layers/placeables/templates.d.mts +72 -0
- package/src/foundry/client/pixi/layers/placeables/tiles.d.mts +116 -0
- package/src/foundry/client/pixi/layers/placeables/tokens.d.mts +193 -0
- package/src/foundry/client/pixi/layers/placeables/walls.d.mts +209 -0
- package/src/foundry/client/pixi/perception/clockwise-sweep.d.mts +157 -0
- package/src/foundry/client/pixi/perception/detection-mode.d.mts +212 -0
- package/src/foundry/client/pixi/perception/fog.d.mts +130 -0
- package/src/foundry/client/pixi/perception/index.d.mts +6 -0
- package/src/foundry/client/pixi/perception/perception-manager.d.mts +167 -0
- package/src/foundry/client/pixi/perception/vision-mode.d.mts +202 -0
- package/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.mts +152 -0
- package/src/foundry/client/pixi/placeable.d.mts +631 -0
- package/src/foundry/client/pixi/placeables/drawing.d.mts +292 -0
- package/src/foundry/client/pixi/placeables/index.d.mts +9 -0
- package/src/foundry/client/pixi/placeables/light.d.mts +140 -0
- package/src/foundry/client/pixi/placeables/note.d.mts +114 -0
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/index.d.mts +4 -0
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-canvas-object.d.mts +177 -0
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-graphics.d.mts +30 -0
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-occludable-object.d.mts +161 -0
- package/src/foundry/client/pixi/placeables/primary-canvas-objects/primary-sprite-mesh.d.mts +111 -0
- package/src/foundry/client/pixi/placeables/sound.d.mts +134 -0
- package/src/foundry/client/pixi/placeables/template.d.mts +211 -0
- package/src/foundry/client/pixi/placeables/tile.d.mts +284 -0
- package/src/foundry/client/pixi/placeables/token.d.mts +820 -0
- package/src/foundry/client/pixi/placeables/wall.d.mts +275 -0
- package/src/foundry/client/pixi/webgl/extensions/batch-renderer.d.mts +95 -0
- package/src/foundry/client/pixi/webgl/extensions/batch-shader-generator.d.mts +30 -0
- package/src/foundry/client/pixi/webgl/extensions/blend-modes.d.mts +53 -0
- package/src/foundry/client/pixi/webgl/extensions/index.d.mts +3 -0
- package/src/foundry/client/pixi/webgl/helpers/framebugger-snapshot.d.mts +30 -0
- package/src/foundry/client/pixi/webgl/helpers/index.d.mts +3 -0
- package/src/foundry/client/pixi/webgl/helpers/smooth-noise.d.mts +65 -0
- package/src/foundry/client/pixi/webgl/helpers/texture-extractor.d.mts +90 -0
- package/src/foundry/client/pixi/webgl/index.d.mts +3 -0
- package/src/foundry/client/pixi/webgl/shaders/base-shader-mixin.d.mts +119 -0
- package/src/foundry/client/pixi/webgl/shaders/base-shader.d.mts +94 -0
- package/src/foundry/client/pixi/webgl/shaders/filters/base-filter.d.mts +47 -0
- package/src/foundry/client/pixi/webgl/shaders/filters/base-mask-filter.d.mts +29 -0
- package/src/foundry/client/pixi/webgl/shaders/filters/blur.d.mts +185 -0
- package/src/foundry/client/pixi/webgl/shaders/filters/effects-masking.d.mts +121 -0
- package/src/foundry/client/pixi/webgl/shaders/filters/environment.d.mts +40 -0
- package/src/foundry/client/pixi/webgl/shaders/filters/glow-overlay.d.mts +75 -0
- package/src/foundry/client/pixi/webgl/shaders/filters/index.d.mts +13 -0
- package/src/foundry/client/pixi/webgl/shaders/filters/invisibility.d.mts +29 -0
- package/src/foundry/client/pixi/webgl/shaders/filters/outline-overlay.d.mts +86 -0
- package/src/foundry/client/pixi/webgl/shaders/filters/transition.d.mts +119 -0
- package/src/foundry/client/pixi/webgl/shaders/filters/visibility.d.mts +70 -0
- package/src/foundry/client/pixi/webgl/shaders/filters/vision-mask-filter.d.mts +33 -0
- package/src/foundry/client/pixi/webgl/shaders/filters/void.d.mts +18 -0
- package/src/foundry/client/pixi/webgl/shaders/filters/weather-occlusion-masks.d.mts +56 -0
- package/src/foundry/client/pixi/webgl/shaders/fragment-channel-mixin.d.mts +54 -0
- package/src/foundry/client/pixi/webgl/shaders/grid/grid.d.mts +112 -0
- package/src/foundry/client/pixi/webgl/shaders/grid/index.d.mts +1 -0
- package/src/foundry/client/pixi/webgl/shaders/index.d.mts +10 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/background-lighting.d.mts +65 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/base-lighting.d.mts +178 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/coloration-lighting.d.mts +73 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/darkness-lighting.d.mts +73 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/bewitching-wave.d.mts +33 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/black-hole.d.mts +18 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/chroma.d.mts +23 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/emanation.d.mts +23 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/energy-field.d.mts +23 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fairy-light.d.mts +38 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/flame.d.mts +55 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/fog.d.mts +23 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/force-grid.d.mts +22 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/ghost-light.d.mts +33 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/hexa-dome.d.mts +23 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/index.d.mts +25 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/light-dome.d.mts +23 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/magical-gloom.d.mts +18 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/pulse.d.mts +44 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/radial-rainbow.d.mts +23 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/revolving-light.d.mts +36 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/roiling-mass.d.mts +18 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/siren-light.d.mts +61 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/smoke-patch.d.mts +32 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/star-light.d.mts +23 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/sunburst.d.mts +33 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/swirling-rainbow.d.mts +23 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/torch.d.mts +45 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/vortex.d.mts +38 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/effects/wave.d.mts +33 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/illumination-lighting.d.mts +79 -0
- package/src/foundry/client/pixi/webgl/shaders/lighting/index.d.mts +6 -0
- package/src/foundry/client/pixi/webgl/shaders/region/adjust-darkness-level.d.mts +93 -0
- package/src/foundry/client/pixi/webgl/shaders/region/base.d.mts +35 -0
- package/src/foundry/client/pixi/webgl/shaders/region/highlight.d.mts +35 -0
- package/src/foundry/client/pixi/webgl/shaders/region/index.d.mts +3 -0
- package/src/foundry/client/pixi/webgl/shaders/samplers/base-sampler.d.mts +206 -0
- package/src/foundry/client/pixi/webgl/shaders/samplers/baseline-illumination.d.mts +38 -0
- package/src/foundry/client/pixi/webgl/shaders/samplers/color-adjustment.d.mts +109 -0
- package/src/foundry/client/pixi/webgl/shaders/samplers/depth.d.mts +103 -0
- package/src/foundry/client/pixi/webgl/shaders/samplers/fog-of-war.d.mts +24 -0
- package/src/foundry/client/pixi/webgl/shaders/samplers/index.d.mts +8 -0
- package/src/foundry/client/pixi/webgl/shaders/samplers/occlusion.d.mts +104 -0
- package/src/foundry/client/pixi/webgl/shaders/samplers/primary.d.mts +26 -0
- package/src/foundry/client/pixi/webgl/shaders/samplers/token-ring.d.mts +47 -0
- package/src/foundry/client/pixi/webgl/shaders/vision/background-vision.d.mts +42 -0
- package/src/foundry/client/pixi/webgl/shaders/vision/base-vision.d.mts +31 -0
- package/src/foundry/client/pixi/webgl/shaders/vision/coloration-vision.d.mts +41 -0
- package/src/foundry/client/pixi/webgl/shaders/vision/effects/amplification.d.mts +32 -0
- package/src/foundry/client/pixi/webgl/shaders/vision/effects/index.d.mts +2 -0
- package/src/foundry/client/pixi/webgl/shaders/vision/effects/wave.d.mts +59 -0
- package/src/foundry/client/pixi/webgl/shaders/vision/illumination-vision.d.mts +36 -0
- package/src/foundry/client/pixi/webgl/shaders/vision/index.d.mts +5 -0
- package/src/foundry/client/pixi/webgl/shaders/weather/base-weather.d.mts +106 -0
- package/src/foundry/client/pixi/webgl/shaders/weather/effect.d.mts +62 -0
- package/src/foundry/client/pixi/webgl/shaders/weather/fog.d.mts +50 -0
- package/src/foundry/client/pixi/webgl/shaders/weather/index.d.mts +5 -0
- package/src/foundry/client/pixi/webgl/shaders/weather/rain.d.mts +42 -0
- package/src/foundry/client/pixi/webgl/shaders/weather/snow.d.mts +34 -0
- package/src/foundry/client/pixi/workers/index.d.mts +1 -0
- package/src/foundry/client/pixi/workers/texture-worker.d.mts +125 -0
- package/src/foundry/client/tours/canvas-tour.d.mts +9 -0
- package/src/foundry/client/tours/index.d.mts +3 -0
- package/src/foundry/client/tours/setup-tour.d.mts +26 -0
- package/src/foundry/client/tours/sidebar-tour.d.mts +9 -0
- package/src/foundry/client/ui/context.d.mts +213 -0
- package/src/foundry/client/ui/dialog.d.mts +326 -0
- package/src/foundry/client/ui/drag.d.mts +128 -0
- package/src/foundry/client/ui/dragdrop.d.mts +124 -0
- package/src/foundry/client/ui/editor.d.mts +546 -0
- package/src/foundry/client/ui/filepicker.d.mts +477 -0
- package/src/foundry/client/ui/filter.d.mts +148 -0
- package/src/foundry/client/ui/forms.d.mts +85 -0
- package/src/foundry/client/ui/index.d.mts +12 -0
- package/src/foundry/client/ui/notifications.d.mts +136 -0
- package/src/foundry/client/ui/prosemirror.d.mts +171 -0
- package/src/foundry/client/ui/secrets.d.mts +75 -0
- package/src/foundry/client/ui/tabs.d.mts +117 -0
- package/src/foundry/client-esm/applications/_module.d.mts +25 -0
- package/src/foundry/client-esm/applications/_types.d.mts +36 -0
- package/src/foundry/client-esm/applications/api/_module.d.mts +9 -0
- package/src/foundry/client-esm/applications/api/application.d.mts +711 -0
- package/src/foundry/client-esm/applications/api/dialog.d.mts +268 -0
- package/src/foundry/client-esm/applications/api/document-sheet.d.mts +127 -0
- package/src/foundry/client-esm/applications/api/handlebars-application.d.mts +180 -0
- package/src/foundry/client-esm/applications/apps/_module.d.mts +7 -0
- package/src/foundry/client-esm/applications/apps/compendium-art-config.d.mts +53 -0
- package/src/foundry/client-esm/applications/apps/permission-config.d.mts +60 -0
- package/src/foundry/client-esm/applications/dice/_module.d.mts +6 -0
- package/src/foundry/client-esm/applications/dice/roll-resolver.d.mts +98 -0
- package/src/foundry/client-esm/applications/elements/_module.d.mts +16 -0
- package/src/foundry/client-esm/applications/elements/color-picker.d.mts +26 -0
- package/src/foundry/client-esm/applications/elements/document-tags.d.mts +90 -0
- package/src/foundry/client-esm/applications/elements/file-picker.d.mts +62 -0
- package/src/foundry/client-esm/applications/elements/form-element.d.mts +106 -0
- package/src/foundry/client-esm/applications/elements/hue-slider.d.mts +20 -0
- package/src/foundry/client-esm/applications/elements/multi-select.d.mts +95 -0
- package/src/foundry/client-esm/applications/elements/prosemirror-editor.d.mts +53 -0
- package/src/foundry/client-esm/applications/elements/range-picker.d.mts +41 -0
- package/src/foundry/client-esm/applications/elements/string-tags.d.mts +73 -0
- package/src/foundry/client-esm/applications/forms/fields.d.mts +265 -0
- package/src/foundry/client-esm/applications/sheets/_module.d.mts +12 -0
- package/src/foundry/client-esm/applications/sheets/actor-sheet.d.mts +31 -0
- package/src/foundry/client-esm/applications/sheets/ambient-light-config.d.mts +77 -0
- package/src/foundry/client-esm/applications/sheets/ambient-sound-config.d.mts +52 -0
- package/src/foundry/client-esm/applications/sheets/item-sheet.d.mts +22 -0
- package/src/foundry/client-esm/applications/sheets/region-behavior-config.d.mts +13 -0
- package/src/foundry/client-esm/applications/sheets/region-config.d.mts +13 -0
- package/src/foundry/client-esm/applications/sheets/user-config.d.mts +44 -0
- package/src/foundry/client-esm/applications/ui/_module.d.mts +6 -0
- package/src/foundry/client-esm/applications/ui/region-legend.d.mts +12 -0
- package/src/foundry/client-esm/audio/_module.d.mts +13 -0
- package/src/foundry/client-esm/audio/_types.d.mts +16 -0
- package/src/foundry/client-esm/audio/biquad.d.mts +51 -0
- package/src/foundry/client-esm/audio/cache.d.mts +68 -0
- package/src/foundry/client-esm/audio/convolver.d.mts +71 -0
- package/src/foundry/client-esm/audio/helper.d.mts +325 -0
- package/src/foundry/client-esm/audio/sound.d.mts +401 -0
- package/src/foundry/client-esm/audio/timeout.d.mts +82 -0
- package/src/foundry/client-esm/canvas/_module.d.mts +11 -0
- package/src/foundry/client-esm/canvas/edges/_module.d.mts +9 -0
- package/src/foundry/client-esm/canvas/edges/collision.d.mts +93 -0
- package/src/foundry/client-esm/canvas/edges/edge.d.mts +184 -0
- package/src/foundry/client-esm/canvas/edges/edges.d.mts +23 -0
- package/src/foundry/client-esm/canvas/edges/vertex.d.mts +136 -0
- package/src/foundry/client-esm/canvas/regions/_module.d.mts +10 -0
- package/src/foundry/client-esm/canvas/scene-manager.d.mts +93 -0
- package/src/foundry/client-esm/canvas/smaa/blend.d.mts +6 -0
- package/src/foundry/client-esm/canvas/smaa/edges.d.mts +6 -0
- package/src/foundry/client-esm/canvas/smaa/smaa.d.mts +56 -0
- package/src/foundry/client-esm/canvas/smaa/weights.d.mts +6 -0
- package/src/foundry/client-esm/canvas/sources/_module.d.mts +15 -0
- package/src/foundry/client-esm/canvas/sources/base-effect-source.d.mts +250 -0
- package/src/foundry/client-esm/canvas/sources/base-light-source.d.mts +159 -0
- package/src/foundry/client-esm/canvas/sources/global-light-source.d.mts +47 -0
- package/src/foundry/client-esm/canvas/sources/point-darkness-source.d.mts +77 -0
- package/src/foundry/client-esm/canvas/sources/point-effect-source.d.mts +93 -0
- package/src/foundry/client-esm/canvas/sources/point-light-source.d.mts +43 -0
- package/src/foundry/client-esm/canvas/sources/point-movement-source.d.mts +15 -0
- package/src/foundry/client-esm/canvas/sources/point-sound-source.d.mts +29 -0
- package/src/foundry/client-esm/canvas/sources/point-vision-source.d.mts +212 -0
- package/src/foundry/client-esm/canvas/sources/rendered-effect-source.d.mts +330 -0
- package/src/foundry/client-esm/canvas/tokens/_module.d.mts +9 -0
- package/src/foundry/client-esm/canvas/tokens/ring-config.d.mts +80 -0
- package/src/foundry/client-esm/canvas/tokens/ring-data.d.mts +7 -0
- package/src/foundry/client-esm/canvas/tokens/ring.d.mts +5 -0
- package/src/foundry/client-esm/client.d.mts +286 -0
- package/src/foundry/client-esm/data/_module.d.mts +8 -0
- package/src/foundry/client-esm/data/client-backend.d.mts +52 -0
- package/src/foundry/client-esm/data/region-behaviors/_module.d.mts +14 -0
- package/src/foundry/client-esm/dice/_module.d.mts +13 -0
- package/src/foundry/client-esm/dice/_types.d.mts +61 -0
- package/src/foundry/client-esm/dice/parser.d.mts +205 -0
- package/src/foundry/client-esm/dice/roll.d.mts +645 -0
- package/src/foundry/client-esm/dice/terms/_module.d.mts +17 -0
- package/src/foundry/client-esm/dice/terms/coin.d.mts +68 -0
- package/src/foundry/client-esm/dice/terms/dice.d.mts +381 -0
- package/src/foundry/client-esm/dice/terms/die.d.mts +241 -0
- package/src/foundry/client-esm/dice/terms/fate.d.mts +50 -0
- package/src/foundry/client-esm/dice/terms/function.d.mts +103 -0
- package/src/foundry/client-esm/dice/terms/numeric.d.mts +56 -0
- package/src/foundry/client-esm/dice/terms/operator.d.mts +55 -0
- package/src/foundry/client-esm/dice/terms/parenthetical.d.mts +105 -0
- package/src/foundry/client-esm/dice/terms/pool.d.mts +278 -0
- package/src/foundry/client-esm/dice/terms/string.d.mts +34 -0
- package/src/foundry/client-esm/dice/terms/term.d.mts +160 -0
- package/src/foundry/client-esm/dice/twister.d.mts +134 -0
- package/src/foundry/client-esm/helpers/_module.d.mts +8 -0
- package/src/foundry/client-esm/helpers/_types.d.mts +51 -0
- package/src/foundry/client-esm/helpers/compendium-art.d.mts +47 -0
- package/src/foundry/clipper/clipper.d.mts +927 -0
- package/src/foundry/clipper/index.d.mts +1 -0
- package/src/foundry/common/abstract/_types.d.mts +274 -0
- package/src/foundry/common/abstract/backend.d.mts +190 -0
- package/src/foundry/common/abstract/data.d.mts +461 -0
- package/src/foundry/common/abstract/document.d.mts +1409 -0
- package/src/foundry/common/abstract/embedded-collection-delta.d.mts +96 -0
- package/src/foundry/common/abstract/embedded-collection.d.mts +252 -0
- package/src/foundry/common/abstract/module.d.mts +13 -0
- package/src/foundry/common/abstract/singleton-collection.d.mts +19 -0
- package/src/foundry/common/abstract/socket.d.mts +36 -0
- package/src/foundry/common/abstract/type-data.d.mts +343 -0
- package/src/foundry/common/config.d.mts +302 -0
- package/src/foundry/common/constants.d.mts +2054 -0
- package/src/foundry/common/data/data.d.mts +667 -0
- package/src/foundry/common/data/fields.d.mts +4207 -0
- package/src/foundry/common/data/module.d.mts +9 -0
- package/src/foundry/common/data/validation-failure.d.mts +174 -0
- package/src/foundry/common/data/validators.d.mts +30 -0
- package/src/foundry/common/documents/_module.d.mts +35 -0
- package/src/foundry/common/documents/_types.d.mts +175 -0
- package/src/foundry/common/documents/active-effect.d.mts +238 -0
- package/src/foundry/common/documents/actor-delta.d.mts +120 -0
- package/src/foundry/common/documents/actor.d.mts +168 -0
- package/src/foundry/common/documents/adventure.d.mts +184 -0
- package/src/foundry/common/documents/ambient-light.d.mts +98 -0
- package/src/foundry/common/documents/ambient-sound.d.mts +132 -0
- package/src/foundry/common/documents/card.d.mts +224 -0
- package/src/foundry/common/documents/cards.d.mts +156 -0
- package/src/foundry/common/documents/chat-message.d.mts +207 -0
- package/src/foundry/common/documents/combat.d.mts +130 -0
- package/src/foundry/common/documents/combatant.d.mts +123 -0
- package/src/foundry/common/documents/drawing.d.mts +240 -0
- package/src/foundry/common/documents/fog-exploration.d.mts +95 -0
- package/src/foundry/common/documents/folder.d.mts +113 -0
- package/src/foundry/common/documents/item.d.mts +142 -0
- package/src/foundry/common/documents/journal-entry-page.d.mts +211 -0
- package/src/foundry/common/documents/journal-entry.d.mts +91 -0
- package/src/foundry/common/documents/macro.d.mts +174 -0
- package/src/foundry/common/documents/measured-template.d.mts +168 -0
- package/src/foundry/common/documents/module.d.mts +35 -0
- package/src/foundry/common/documents/note.d.mts +183 -0
- package/src/foundry/common/documents/playlist-sound.d.mts +127 -0
- package/src/foundry/common/documents/playlist.d.mts +154 -0
- package/src/foundry/common/documents/roll-table.d.mts +130 -0
- package/src/foundry/common/documents/scene.d.mts +373 -0
- package/src/foundry/common/documents/setting.d.mts +77 -0
- package/src/foundry/common/documents/table-result.d.mts +131 -0
- package/src/foundry/common/documents/tile.d.mts +195 -0
- package/src/foundry/common/documents/token.d.mts +497 -0
- package/src/foundry/common/documents/user.d.mts +238 -0
- package/src/foundry/common/documents/wall.d.mts +184 -0
- package/src/foundry/common/grid/_module.d.mts +10 -0
- package/src/foundry/common/grid/base.d.mts +640 -0
- package/src/foundry/common/grid/grid-hex.d.mts +55 -0
- package/src/foundry/common/grid/gridless.d.mts +71 -0
- package/src/foundry/common/grid/hexagonal.d.mts +391 -0
- package/src/foundry/common/grid/square.d.mts +100 -0
- package/src/foundry/common/packages/base-module.d.mts +46 -0
- package/src/foundry/common/packages/base-package.d.mts +677 -0
- package/src/foundry/common/packages/base-system.d.mts +90 -0
- package/src/foundry/common/packages/base-world.d.mts +116 -0
- package/src/foundry/common/packages/module.d.mts +28 -0
- package/src/foundry/common/packages/sub-types.d.mts +42 -0
- package/src/foundry/common/primitives/array.d.mts +56 -0
- package/src/foundry/common/primitives/date.d.mts +24 -0
- package/src/foundry/common/primitives/math.d.mts +103 -0
- package/src/foundry/common/primitives/module.d.mts +8 -0
- package/src/foundry/common/primitives/number.d.mts +91 -0
- package/src/foundry/common/primitives/regex.d.mts +12 -0
- package/src/foundry/common/primitives/regexp.d.mts +12 -0
- package/src/foundry/common/primitives/set.d.mts +105 -0
- package/src/foundry/common/primitives/string.d.mts +58 -0
- package/src/foundry/common/primitives/url.d.mts +18 -0
- package/src/foundry/common/prosemirror/_module.d.mts +82 -0
- package/src/foundry/common/prosemirror/click-handler.d.mts +34 -0
- package/src/foundry/common/prosemirror/content-link-plugin.d.mts +47 -0
- package/src/foundry/common/prosemirror/dirty-plugin.d.mts +13 -0
- package/src/foundry/common/prosemirror/dom-parser.d.mts +9 -0
- package/src/foundry/common/prosemirror/dropdown.d.mts +65 -0
- package/src/foundry/common/prosemirror/extensions.d.mts +12 -0
- package/src/foundry/common/prosemirror/highlight-matches-plugin.d.mts +82 -0
- package/src/foundry/common/prosemirror/image-plugin.d.mts +82 -0
- package/src/foundry/common/prosemirror/index.d.mts +22 -0
- package/src/foundry/common/prosemirror/input-rules.d.mts +34 -0
- package/src/foundry/common/prosemirror/keymaps.d.mts +47 -0
- package/src/foundry/common/prosemirror/menu.d.mts +255 -0
- package/src/foundry/common/prosemirror/paste-transformer.d.mts +22 -0
- package/src/foundry/common/prosemirror/plugin.d.mts +24 -0
- package/src/foundry/common/prosemirror/schema/attribute-capture.d.mts +39 -0
- package/src/foundry/common/prosemirror/schema/core.d.mts +51 -0
- package/src/foundry/common/prosemirror/schema/image-link-node.d.mts +29 -0
- package/src/foundry/common/prosemirror/schema/image-node.d.mts +19 -0
- package/src/foundry/common/prosemirror/schema/index.d.mts +12 -0
- package/src/foundry/common/prosemirror/schema/link-mark.d.mts +30 -0
- package/src/foundry/common/prosemirror/schema/lists.d.mts +55 -0
- package/src/foundry/common/prosemirror/schema/marks.d.mts +44 -0
- package/src/foundry/common/prosemirror/schema/other.d.mts +149 -0
- package/src/foundry/common/prosemirror/schema/schema-definition.d.mts +39 -0
- package/src/foundry/common/prosemirror/schema/secret-node.d.mts +27 -0
- package/src/foundry/common/prosemirror/schema/tables.d.mts +106 -0
- package/src/foundry/common/prosemirror/schema/utils.d.mts +37 -0
- package/src/foundry/common/prosemirror/schema.d.mts +138 -0
- package/src/foundry/common/prosemirror/string-serializer.d.mts +120 -0
- package/src/foundry/common/prosemirror/util.d.mts +43 -0
- package/src/foundry/common/types.d.mts +74 -0
- package/src/foundry/common/utils/bitmask.d.mts +110 -0
- package/src/foundry/common/utils/collection.d.mts +176 -0
- package/src/foundry/common/utils/color.d.mts +299 -0
- package/src/foundry/common/utils/event-emitter.d.mts +62 -0
- package/src/foundry/common/utils/geometry.d.mts +198 -0
- package/src/foundry/common/utils/helpers.d.mts +752 -0
- package/src/foundry/common/utils/http.d.mts +52 -0
- package/src/foundry/common/utils/iterable-weak-map.d.mts +80 -0
- package/src/foundry/common/utils/iterable-weak-set.d.mts +47 -0
- package/src/foundry/common/utils/logging.d.mts +42 -0
- package/src/foundry/common/utils/module.d.mts +18 -0
- package/src/foundry/common/utils/semaphore.d.mts +82 -0
- package/src/foundry/common/utils/string-tree.d.mts +95 -0
- package/src/foundry/common/utils/word-tree.d.mts +66 -0
- package/src/foundry/index.d.mts +5 -0
- package/src/foundry/public/index.d.mts +1 -0
- package/src/foundry/public/scripts/earcut-edges/earcut-edges.d.mts +11 -0
- package/src/foundry/public/scripts/earcut-edges/index.d.mts +1 -0
- package/src/foundry/public/scripts/index.d.mts +1 -0
- package/src/index.d.mts +2 -0
- package/src/types/augments/index.d.mts +4 -0
- package/src/types/augments/pixi.d.mts +99 -0
- package/src/types/augments/simple-peer.d.mts +13 -0
- package/src/types/augments/socket.io-client.d.mts +12 -0
- package/src/types/augments/tinyMCE.d.mts +72 -0
- package/src/types/config.d.mts +331 -0
- package/src/types/documentConfiguration.d.mts +606 -0
- package/src/types/helperTypes.d.mts +389 -0
- package/src/types/index.d.mts +4 -0
- package/src/types/utils.d.mts +520 -0
- package/index-lenient.d.ts +0 -10
- package/index.d.ts +0 -4
- package/src/foundry/client/apps/app.d.ts +0 -560
- package/src/foundry/client/apps/av/av-config.d.ts +0 -85
- package/src/foundry/client/apps/av/cameras.d.ts +0 -174
- package/src/foundry/client/apps/av/index.d.ts +0 -3
- package/src/foundry/client/apps/form.d.ts +0 -384
- package/src/foundry/client/apps/forms/actor.d.ts +0 -192
- package/src/foundry/client/apps/forms/card-config.d.ts +0 -51
- package/src/foundry/client/apps/forms/cards-config.d.ts +0 -128
- package/src/foundry/client/apps/forms/combat-config.d.ts +0 -41
- package/src/foundry/client/apps/forms/combatant-config.d.ts +0 -49
- package/src/foundry/client/apps/forms/effect-config.d.ts +0 -65
- package/src/foundry/client/apps/forms/folder-config.d.ts +0 -63
- package/src/foundry/client/apps/forms/grid-config.d.ts +0 -151
- package/src/foundry/client/apps/forms/image-popout.d.ts +0 -166
- package/src/foundry/client/apps/forms/index.d.ts +0 -20
- package/src/foundry/client/apps/forms/item.d.ts +0 -71
- package/src/foundry/client/apps/forms/journal-sheet.d.ts +0 -107
- package/src/foundry/client/apps/forms/macro-config.d.ts +0 -71
- package/src/foundry/client/apps/forms/measure-template.d.ts +0 -53
- package/src/foundry/client/apps/forms/permission.d.ts +0 -58
- package/src/foundry/client/apps/forms/playlist-config.d.ts +0 -43
- package/src/foundry/client/apps/forms/playlist-sound-config.d.ts +0 -61
- package/src/foundry/client/apps/forms/roll-table-config.d.ts +0 -175
- package/src/foundry/client/apps/forms/scene-config.d.ts +0 -148
- package/src/foundry/client/apps/forms/sheet-config.d.ts +0 -184
- package/src/foundry/client/apps/forms/user-config.d.ts +0 -74
- package/src/foundry/client/apps/hud/chatbubble.d.ts +0 -89
- package/src/foundry/client/apps/hud/container.d.ts +0 -46
- package/src/foundry/client/apps/hud/controls.d.ts +0 -156
- package/src/foundry/client/apps/hud/hotbar.d.ts +0 -143
- package/src/foundry/client/apps/hud/hud.d.ts +0 -84
- package/src/foundry/client/apps/hud/index.d.ts +0 -9
- package/src/foundry/client/apps/hud/menu.d.ts +0 -71
- package/src/foundry/client/apps/hud/navigation.d.ts +0 -110
- package/src/foundry/client/apps/hud/pause.d.ts +0 -20
- package/src/foundry/client/apps/hud/players.d.ts +0 -55
- package/src/foundry/client/apps/i18n.d.ts +0 -136
- package/src/foundry/client/apps/index.d.ts +0 -9
- package/src/foundry/client/apps/placeables/drawing-config.d.ts +0 -99
- package/src/foundry/client/apps/placeables/drawing-hud.d.ts +0 -32
- package/src/foundry/client/apps/placeables/index.d.ts +0 -10
- package/src/foundry/client/apps/placeables/light-config.d.ts +0 -95
- package/src/foundry/client/apps/placeables/note-config.d.ts +0 -57
- package/src/foundry/client/apps/placeables/sound-config.d.ts +0 -47
- package/src/foundry/client/apps/placeables/tile-config.d.ts +0 -55
- package/src/foundry/client/apps/placeables/tile-hud.d.ts +0 -37
- package/src/foundry/client/apps/placeables/token-config.d.ts +0 -226
- package/src/foundry/client/apps/placeables/token-hud.d.ts +0 -140
- package/src/foundry/client/apps/placeables/wall-config.d.ts +0 -75
- package/src/foundry/client/apps/sidebar/apps/chat-popout.d.ts +0 -34
- package/src/foundry/client/apps/sidebar/apps/client-settings.d.ts +0 -116
- package/src/foundry/client/apps/sidebar/apps/compendium.d.ts +0 -86
- package/src/foundry/client/apps/sidebar/apps/controls-reference.d.ts +0 -30
- package/src/foundry/client/apps/sidebar/apps/index.d.ts +0 -10
- package/src/foundry/client/apps/sidebar/apps/invitation-links.d.ts +0 -37
- package/src/foundry/client/apps/sidebar/apps/keybindings-config.d.ts +0 -247
- package/src/foundry/client/apps/sidebar/apps/module-management.d.ts +0 -120
- package/src/foundry/client/apps/sidebar/apps/permission-config.d.ts +0 -64
- package/src/foundry/client/apps/sidebar/apps/support-details.d.ts +0 -76
- package/src/foundry/client/apps/sidebar/apps/world-config.d.ts +0 -77
- package/src/foundry/client/apps/sidebar/index.d.ts +0 -5
- package/src/foundry/client/apps/sidebar/sidebar.d.ts +0 -102
- package/src/foundry/client/apps/sidebar/tab-base.d.ts +0 -68
- package/src/foundry/client/apps/sidebar/tab-directory.d.ts +0 -236
- package/src/foundry/client/apps/sidebar/tabs/actors-directory.d.ts +0 -16
- package/src/foundry/client/apps/sidebar/tabs/cards-directory.d.ts +0 -6
- package/src/foundry/client/apps/sidebar/tabs/chat-log.d.ts +0 -351
- package/src/foundry/client/apps/sidebar/tabs/combat-tracker.d.ts +0 -205
- package/src/foundry/client/apps/sidebar/tabs/compendium-directory.d.ts +0 -77
- package/src/foundry/client/apps/sidebar/tabs/index.d.ts +0 -12
- package/src/foundry/client/apps/sidebar/tabs/items-directory.d.ts +0 -10
- package/src/foundry/client/apps/sidebar/tabs/journal-directory.d.ts +0 -11
- package/src/foundry/client/apps/sidebar/tabs/macros-directory.d.ts +0 -12
- package/src/foundry/client/apps/sidebar/tabs/playlists-directory.d.ts +0 -306
- package/src/foundry/client/apps/sidebar/tabs/roll-table-directory.d.ts +0 -9
- package/src/foundry/client/apps/sidebar/tabs/scenes-directory.d.ts +0 -18
- package/src/foundry/client/apps/sidebar/tabs/settings.d.ts +0 -88
- package/src/foundry/client/apps/templates.d.ts +0 -425
- package/src/foundry/client/audio/audio.d.ts +0 -343
- package/src/foundry/client/audio/container.d.ts +0 -175
- package/src/foundry/client/audio/index.d.ts +0 -3
- package/src/foundry/client/audio/sound.d.ts +0 -303
- package/src/foundry/client/av/client.d.ts +0 -158
- package/src/foundry/client/av/clients/index.d.ts +0 -1
- package/src/foundry/client/av/clients/simplepeer.d.ts +0 -151
- package/src/foundry/client/av/index.d.ts +0 -4
- package/src/foundry/client/av/master.d.ts +0 -187
- package/src/foundry/client/av/settings.d.ts +0 -236
- package/src/foundry/client/config.d.ts +0 -1425
- package/src/foundry/client/core/gamepad.d.ts +0 -53
- package/src/foundry/client/core/hooks.d.ts +0 -967
- package/src/foundry/client/core/image.d.ts +0 -129
- package/src/foundry/client/core/index.d.ts +0 -13
- package/src/foundry/client/core/keybindings.d.ts +0 -298
- package/src/foundry/client/core/keyboard.d.ts +0 -247
- package/src/foundry/client/core/mouse.d.ts +0 -18
- package/src/foundry/client/core/nue.d.ts +0 -34
- package/src/foundry/client/core/settings.d.ts +0 -222
- package/src/foundry/client/core/socket.d.ts +0 -46
- package/src/foundry/client/core/sorting.d.ts +0 -78
- package/src/foundry/client/core/time.d.ts +0 -67
- package/src/foundry/client/core/utils.d.ts +0 -33
- package/src/foundry/client/core/video.d.ts +0 -65
- package/src/foundry/client/data/abstract/canvas-document.d.ts +0 -70
- package/src/foundry/client/data/abstract/client-backend.d.ts +0 -206
- package/src/foundry/client/data/abstract/client-document.d.ts +0 -439
- package/src/foundry/client/data/abstract/document-collection.d.ts +0 -192
- package/src/foundry/client/data/abstract/index.d.ts +0 -5
- package/src/foundry/client/data/abstract/world-collection.d.ts +0 -167
- package/src/foundry/client/data/collections/actors.d.ts +0 -35
- package/src/foundry/client/data/collections/cards.d.ts +0 -8
- package/src/foundry/client/data/collections/combats.d.ts +0 -43
- package/src/foundry/client/data/collections/compendium.d.ts +0 -321
- package/src/foundry/client/data/collections/fog.d.ts +0 -7
- package/src/foundry/client/data/collections/folder.d.ts +0 -27
- package/src/foundry/client/data/collections/index.d.ts +0 -15
- package/src/foundry/client/data/collections/items.d.ts +0 -10
- package/src/foundry/client/data/collections/journal.d.ts +0 -26
- package/src/foundry/client/data/collections/macros.d.ts +0 -26
- package/src/foundry/client/data/collections/messages.d.ts +0 -39
- package/src/foundry/client/data/collections/playlists.d.ts +0 -41
- package/src/foundry/client/data/collections/scenes.d.ts +0 -62
- package/src/foundry/client/data/collections/settings.d.ts +0 -25
- package/src/foundry/client/data/collections/tables.d.ts +0 -17
- package/src/foundry/client/data/collections/users.d.ts +0 -43
- package/src/foundry/client/data/documents/active-effect.d.ts +0 -172
- package/src/foundry/client/data/documents/actor.d.ts +0 -231
- package/src/foundry/client/data/documents/ambient-light.d.ts +0 -18
- package/src/foundry/client/data/documents/ambient-sound.d.ts +0 -9
- package/src/foundry/client/data/documents/card.d.ts +0 -133
- package/src/foundry/client/data/documents/cards.d.ts +0 -376
- package/src/foundry/client/data/documents/chat-message.d.ts +0 -267
- package/src/foundry/client/data/documents/combat.d.ts +0 -227
- package/src/foundry/client/data/documents/combatant.d.ts +0 -104
- package/src/foundry/client/data/documents/drawing.d.ts +0 -19
- package/src/foundry/client/data/documents/fog-exploration.d.ts +0 -64
- package/src/foundry/client/data/documents/folder.d.ts +0 -115
- package/src/foundry/client/data/documents/index.d.ts +0 -27
- package/src/foundry/client/data/documents/item.d.ts +0 -59
- package/src/foundry/client/data/documents/journal-entry.d.ts +0 -71
- package/src/foundry/client/data/documents/macro.d.ts +0 -60
- package/src/foundry/client/data/documents/measured-template.d.ts +0 -21
- package/src/foundry/client/data/documents/note.d.ts +0 -19
- package/src/foundry/client/data/documents/playlist-sound.d.ts +0 -117
- package/src/foundry/client/data/documents/playlist.d.ts +0 -192
- package/src/foundry/client/data/documents/scene.d.ts +0 -465
- package/src/foundry/client/data/documents/setting.d.ts +0 -35
- package/src/foundry/client/data/documents/table-result.d.ts +0 -30
- package/src/foundry/client/data/documents/table.d.ts +0 -220
- package/src/foundry/client/data/documents/tile.d.ts +0 -13
- package/src/foundry/client/data/documents/token.d.ts +0 -281
- package/src/foundry/client/data/documents/user.d.ts +0 -155
- package/src/foundry/client/data/documents/wall.d.ts +0 -9
- package/src/foundry/client/data/index.d.ts +0 -3
- package/src/foundry/client/dice/dice/coin.d.ts +0 -49
- package/src/foundry/client/dice/dice/die.d.ts +0 -230
- package/src/foundry/client/dice/dice/fate.d.ts +0 -37
- package/src/foundry/client/dice/dice/index.d.ts +0 -3
- package/src/foundry/client/dice/index.d.ts +0 -5
- package/src/foundry/client/dice/roll.d.ts +0 -495
- package/src/foundry/client/dice/term.d.ts +0 -123
- package/src/foundry/client/dice/terms/dice.d.ts +0 -277
- package/src/foundry/client/dice/terms/index.d.ts +0 -7
- package/src/foundry/client/dice/terms/math.d.ts +0 -69
- package/src/foundry/client/dice/terms/numeric.d.ts +0 -53
- package/src/foundry/client/dice/terms/operator.d.ts +0 -18
- package/src/foundry/client/dice/terms/parenthetical.d.ts +0 -51
- package/src/foundry/client/dice/terms/pool.d.ts +0 -235
- package/src/foundry/client/dice/terms/string.d.ts +0 -31
- package/src/foundry/client/dice/twister.d.ts +0 -134
- package/src/foundry/client/game.d.ts +0 -682
- package/src/foundry/client/head.d.ts +0 -44
- package/src/foundry/client/index.d.ts +0 -12
- package/src/foundry/client/pixi/board.d.ts +0 -632
- package/src/foundry/client/pixi/core/containers/cached-container.d.ts +0 -64
- package/src/foundry/client/pixi/core/containers/index.d.ts +0 -3
- package/src/foundry/client/pixi/core/containers/quadtree.d.ts +0 -166
- package/src/foundry/client/pixi/core/containers/sampler-mesh.d.ts +0 -22
- package/src/foundry/client/pixi/core/culling.d.ts +0 -37
- package/src/foundry/client/pixi/core/index.d.ts +0 -5
- package/src/foundry/client/pixi/core/interaction/canvas-animation.d.ts +0 -148
- package/src/foundry/client/pixi/core/interaction/control-icon.d.ts +0 -58
- package/src/foundry/client/pixi/core/interaction/index.d.ts +0 -5
- package/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts +0 -323
- package/src/foundry/client/pixi/core/interaction/resize-handle.d.ts +0 -48
- package/src/foundry/client/pixi/core/interaction/targets.d.ts +0 -51
- package/src/foundry/client/pixi/core/loader.d.ts +0 -157
- package/src/foundry/client/pixi/core/shapes/index.d.ts +0 -5
- package/src/foundry/client/pixi/core/shapes/normalized-rectangle.d.ts +0 -31
- package/src/foundry/client/pixi/core/shapes/polygon-helpers.d.ts +0 -263
- package/src/foundry/client/pixi/core/shapes/precise-text.d.ts +0 -18
- package/src/foundry/client/pixi/core/shapes/ray.d.ts +0 -200
- package/src/foundry/client/pixi/core/shapes/source-polygon.d.ts +0 -110
- package/src/foundry/client/pixi/groups/effects.d.ts +0 -29
- package/src/foundry/client/pixi/groups/index.d.ts +0 -3
- package/src/foundry/client/pixi/groups/interface.d.ts +0 -27
- package/src/foundry/client/pixi/groups/primary.d.ts +0 -40
- package/src/foundry/client/pixi/index.d.ts +0 -10
- package/src/foundry/client/pixi/layer.d.ts +0 -105
- package/src/foundry/client/pixi/layers/controls/cursor.d.ts +0 -27
- package/src/foundry/client/pixi/layers/controls/door.d.ts +0 -67
- package/src/foundry/client/pixi/layers/controls/hud.d.ts +0 -117
- package/src/foundry/client/pixi/layers/controls/index.d.ts +0 -4
- package/src/foundry/client/pixi/layers/controls/ruler.d.ts +0 -207
- package/src/foundry/client/pixi/layers/controls.d.ts +0 -144
- package/src/foundry/client/pixi/layers/drawings.d.ts +0 -116
- package/src/foundry/client/pixi/layers/effects/effect.d.ts +0 -133
- package/src/foundry/client/pixi/layers/effects/index.d.ts +0 -4
- package/src/foundry/client/pixi/layers/effects/leaves.d.ts +0 -79
- package/src/foundry/client/pixi/layers/effects/rain.d.ts +0 -107
- package/src/foundry/client/pixi/layers/effects/snow.d.ts +0 -62
- package/src/foundry/client/pixi/layers/effects.d.ts +0 -61
- package/src/foundry/client/pixi/layers/grid/grid.d.ts +0 -171
- package/src/foundry/client/pixi/layers/grid/hex.d.ts +0 -118
- package/src/foundry/client/pixi/layers/grid/highlight.d.ts +0 -28
- package/src/foundry/client/pixi/layers/grid/index.d.ts +0 -4
- package/src/foundry/client/pixi/layers/grid/square.d.ts +0 -48
- package/src/foundry/client/pixi/layers/grid.d.ts +0 -204
- package/src/foundry/client/pixi/layers/index.d.ts +0 -15
- package/src/foundry/client/pixi/layers/lighting.d.ts +0 -229
- package/src/foundry/client/pixi/layers/map.d.ts +0 -263
- package/src/foundry/client/pixi/layers/notes.d.ts +0 -64
- package/src/foundry/client/pixi/layers/sight.d.ts +0 -313
- package/src/foundry/client/pixi/layers/sounds.d.ts +0 -112
- package/src/foundry/client/pixi/layers/templates.d.ts +0 -51
- package/src/foundry/client/pixi/layers/tokens.d.ts +0 -169
- package/src/foundry/client/pixi/layers/walls.d.ts +0 -321
- package/src/foundry/client/pixi/perception/clockwise-sweep.d.ts +0 -406
- package/src/foundry/client/pixi/perception/index.d.ts +0 -2
- package/src/foundry/client/pixi/perception/perception-manager.d.ts +0 -107
- package/src/foundry/client/pixi/placeable.d.ts +0 -414
- package/src/foundry/client/pixi/placeables/drawing.d.ts +0 -289
- package/src/foundry/client/pixi/placeables/index.d.ts +0 -8
- package/src/foundry/client/pixi/placeables/light.d.ts +0 -126
- package/src/foundry/client/pixi/placeables/note.d.ts +0 -67
- package/src/foundry/client/pixi/placeables/sound.d.ts +0 -131
- package/src/foundry/client/pixi/placeables/template.d.ts +0 -153
- package/src/foundry/client/pixi/placeables/tile.d.ts +0 -315
- package/src/foundry/client/pixi/placeables/token.d.ts +0 -722
- package/src/foundry/client/pixi/placeables/wall.d.ts +0 -268
- package/src/foundry/client/pixi/placeables.d.ts +0 -520
- package/src/foundry/client/pixi/sources/base-source.d.ts +0 -145
- package/src/foundry/client/pixi/sources/index.d.ts +0 -4
- package/src/foundry/client/pixi/sources/light-source.d.ts +0 -413
- package/src/foundry/client/pixi/sources/sound-source.d.ts +0 -45
- package/src/foundry/client/pixi/sources/vision-source.d.ts +0 -123
- package/src/foundry/client/pixi/webgl/base.d.ts +0 -69
- package/src/foundry/client/pixi/webgl/blend_modes.d.ts +0 -33
- package/src/foundry/client/pixi/webgl/filters.d.ts +0 -182
- package/src/foundry/client/pixi/webgl/index.d.ts +0 -5
- package/src/foundry/client/pixi/webgl/lighting.d.ts +0 -480
- package/src/foundry/client/pixi/webgl/sampler.d.ts +0 -19
- package/src/foundry/client/ui/context.d.ts +0 -136
- package/src/foundry/client/ui/dialog.d.ts +0 -286
- package/src/foundry/client/ui/drag.d.ts +0 -105
- package/src/foundry/client/ui/dragdrop.d.ts +0 -118
- package/src/foundry/client/ui/editor.d.ts +0 -321
- package/src/foundry/client/ui/filepicker.d.ts +0 -510
- package/src/foundry/client/ui/filter.d.ts +0 -106
- package/src/foundry/client/ui/forms.d.ts +0 -47
- package/src/foundry/client/ui/index.d.ts +0 -10
- package/src/foundry/client/ui/notifications.d.ts +0 -110
- package/src/foundry/client/ui/tabs.d.ts +0 -103
- package/src/foundry/common/abstract/backend.mjs.d.ts +0 -253
- package/src/foundry/common/abstract/data.mjs.d.ts +0 -316
- package/src/foundry/common/abstract/document.mjs.d.ts +0 -838
- package/src/foundry/common/abstract/embedded-collection.mjs.d.ts +0 -79
- package/src/foundry/common/abstract/module.mjs.d.ts +0 -6
- package/src/foundry/common/config.mjs/index.d.ts +0 -1
- package/src/foundry/common/config.mjs/releaseData.d.ts +0 -100
- package/src/foundry/common/constants.mjs.d.ts +0 -940
- package/src/foundry/common/data/data.mjs/activeEffectData.d.ts +0 -168
- package/src/foundry/common/data/data.mjs/actorData.d.ts +0 -219
- package/src/foundry/common/data/data.mjs/adventureData.d.ts +0 -166
- package/src/foundry/common/data/data.mjs/ambientLightData.d.ts +0 -154
- package/src/foundry/common/data/data.mjs/ambientSoundData.d.ts +0 -195
- package/src/foundry/common/data/data.mjs/animationData.d.ts +0 -91
- package/src/foundry/common/data/data.mjs/cardData.d.ts +0 -264
- package/src/foundry/common/data/data.mjs/cardFaceData.d.ts +0 -67
- package/src/foundry/common/data/data.mjs/cardsData.d.ts +0 -237
- package/src/foundry/common/data/data.mjs/chatMessageData.d.ts +0 -220
- package/src/foundry/common/data/data.mjs/chatSpeakerData.d.ts +0 -80
- package/src/foundry/common/data/data.mjs/combatData.d.ts +0 -149
- package/src/foundry/common/data/data.mjs/combatantData.d.ts +0 -136
- package/src/foundry/common/data/data.mjs/darknessActivation.d.ts +0 -55
- package/src/foundry/common/data/data.mjs/drawingData.d.ts +0 -407
- package/src/foundry/common/data/data.mjs/effectChangeData.d.ts +0 -80
- package/src/foundry/common/data/data.mjs/effectDurationData.d.ts +0 -109
- package/src/foundry/common/data/data.mjs/fogExplorationData.d.ts +0 -115
- package/src/foundry/common/data/data.mjs/folderData.d.ts +0 -155
- package/src/foundry/common/data/data.mjs/index.d.ts +0 -31
- package/src/foundry/common/data/data.mjs/itemData.d.ts +0 -184
- package/src/foundry/common/data/data.mjs/journalEntryData.d.ts +0 -132
- package/src/foundry/common/data/data.mjs/lightData.d.ts +0 -227
- package/src/foundry/common/data/data.mjs/macroData.d.ts +0 -199
- package/src/foundry/common/data/data.mjs/measuredTemplateData.d.ts +0 -212
- package/src/foundry/common/data/data.mjs/noteData.d.ts +0 -233
- package/src/foundry/common/data/data.mjs/playlistData.d.ts +0 -201
- package/src/foundry/common/data/data.mjs/playlistSoundData.d.ts +0 -159
- package/src/foundry/common/data/data.mjs/prototypeTokenData.d.ts +0 -75
- package/src/foundry/common/data/data.mjs/rollTableData.d.ts +0 -189
- package/src/foundry/common/data/data.mjs/sceneData.d.ts +0 -665
- package/src/foundry/common/data/data.mjs/settingData.d.ts +0 -86
- package/src/foundry/common/data/data.mjs/tableResultData.d.ts +0 -167
- package/src/foundry/common/data/data.mjs/tileData.d.ts +0 -246
- package/src/foundry/common/data/data.mjs/tileOcclusion.d.ts +0 -62
- package/src/foundry/common/data/data.mjs/tokenBarData.d.ts +0 -47
- package/src/foundry/common/data/data.mjs/tokenData.d.ts +0 -505
- package/src/foundry/common/data/data.mjs/userData.d.ts +0 -177
- package/src/foundry/common/data/data.mjs/videoData.d.ts +0 -70
- package/src/foundry/common/data/data.mjs/wallData.d.ts +0 -222
- package/src/foundry/common/data/fields.mjs.d.ts +0 -526
- package/src/foundry/common/data/module.mjs.d.ts +0 -3
- package/src/foundry/common/data/validators.mjs.d.ts +0 -56
- package/src/foundry/common/documents.mjs/baseActiveEffect.d.ts +0 -44
- package/src/foundry/common/documents.mjs/baseActor.d.ts +0 -68
- package/src/foundry/common/documents.mjs/baseAdventure.d.ts +0 -38
- package/src/foundry/common/documents.mjs/baseAmbientLight.d.ts +0 -31
- package/src/foundry/common/documents.mjs/baseAmbientSound.d.ts +0 -29
- package/src/foundry/common/documents.mjs/baseCard.d.ts +0 -58
- package/src/foundry/common/documents.mjs/baseCards.d.ts +0 -39
- package/src/foundry/common/documents.mjs/baseChatMessage.d.ts +0 -49
- package/src/foundry/common/documents.mjs/baseCombat.d.ts +0 -40
- package/src/foundry/common/documents.mjs/baseCombatant.d.ts +0 -48
- package/src/foundry/common/documents.mjs/baseDrawing.d.ts +0 -54
- package/src/foundry/common/documents.mjs/baseFogExploration.d.ts +0 -41
- package/src/foundry/common/documents.mjs/baseFolder.d.ts +0 -30
- package/src/foundry/common/documents.mjs/baseItem.d.ts +0 -57
- package/src/foundry/common/documents.mjs/baseJournalEntry.d.ts +0 -26
- package/src/foundry/common/documents.mjs/baseMacro.d.ts +0 -42
- package/src/foundry/common/documents.mjs/baseMeasuredTemplate.d.ts +0 -66
- package/src/foundry/common/documents.mjs/baseNote.d.ts +0 -39
- package/src/foundry/common/documents.mjs/basePlaylist.d.ts +0 -32
- package/src/foundry/common/documents.mjs/basePlaylistSound.d.ts +0 -37
- package/src/foundry/common/documents.mjs/baseRollTable.d.ts +0 -31
- package/src/foundry/common/documents.mjs/baseScene.d.ts +0 -120
- package/src/foundry/common/documents.mjs/baseSetting.d.ts +0 -38
- package/src/foundry/common/documents.mjs/baseTableResult.d.ts +0 -52
- package/src/foundry/common/documents.mjs/baseTile.d.ts +0 -29
- package/src/foundry/common/documents.mjs/baseToken.d.ts +0 -44
- package/src/foundry/common/documents.mjs/baseUser.d.ts +0 -102
- package/src/foundry/common/documents.mjs/baseWall.d.ts +0 -43
- package/src/foundry/common/documents.mjs/index.d.ts +0 -28
- package/src/foundry/common/module.mjs.d.ts +0 -114
- package/src/foundry/common/packages.mjs/index.d.ts +0 -8
- package/src/foundry/common/packages.mjs/moduleData.d.ts +0 -55
- package/src/foundry/common/packages.mjs/packageAuthorData.d.ts +0 -58
- package/src/foundry/common/packages.mjs/packageCompendiumData.d.ts +0 -88
- package/src/foundry/common/packages.mjs/packageData.d.ts +0 -319
- package/src/foundry/common/packages.mjs/packageDependencyData.d.ts +0 -69
- package/src/foundry/common/packages.mjs/packageLanguageData.d.ts +0 -75
- package/src/foundry/common/packages.mjs/systemData.d.ts +0 -58
- package/src/foundry/common/packages.mjs/tagPackageAvailability.d.ts +0 -9
- package/src/foundry/common/packages.mjs/worldData.d.ts +0 -76
- package/src/foundry/common/types.mjs.d.ts +0 -299
- package/src/foundry/common/utils/collection.mjs.d.ts +0 -151
- package/src/foundry/common/utils/geometry.mjs.d.ts +0 -148
- package/src/foundry/common/utils/helpers.mjs.d.ts +0 -498
- package/src/foundry/common/utils/http.mjs.d.ts +0 -52
- package/src/foundry/common/utils/module.mjs.d.ts +0 -5
- package/src/foundry/common/utils/primitives.mjs.d.ts +0 -287
- package/src/foundry/common/utils/semaphore.mjs.d.ts +0 -83
- package/src/foundry/index.d.ts +0 -3
- package/src/foundry/templates/index.d.ts +0 -1
- package/src/foundry/templates/views/layouts/main.hbs.d.ts +0 -11
- package/src/index.d.ts +0 -2
- package/src/types/augments/index.d.ts +0 -6
- package/src/types/augments/pixiGraphicsSmooth.d.ts +0 -7
- package/src/types/augments/pixiLegacyGraphics.d.ts +0 -7
- package/src/types/augments/pixiParticles.d.ts +0 -7
- package/src/types/augments/simple-peer.d.ts +0 -13
- package/src/types/augments/socket.io-client.d.ts +0 -12
- package/src/types/augments/tinyMCE.d.ts +0 -82
- package/src/types/config.d.ts +0 -183
- package/src/types/helperTypes.d.ts +0 -151
- package/src/types/index.d.ts +0 -3
- package/src/types/utils.d.ts +0 -143
- /package/src/foundry/client/apps/av/{camera-popout.d.ts → camera-popout.d.mts} +0 -0
- /package/src/foundry/client/{tail.d.ts → tail.d.mts} +0 -0
@@ -0,0 +1,4207 @@
|
|
1
|
+
import type {
|
2
|
+
RemoveIndexSignatures,
|
3
|
+
SimpleMerge,
|
4
|
+
ValueOf,
|
5
|
+
AnyObject,
|
6
|
+
EmptyObject,
|
7
|
+
NullishProps,
|
8
|
+
InexactPartial,
|
9
|
+
} from "../../../types/utils.d.mts";
|
10
|
+
import type { DataModel } from "../abstract/data.mts";
|
11
|
+
import type Document from "../abstract/document.mts";
|
12
|
+
import type { EmbeddedCollection, EmbeddedCollectionDelta } from "../abstract/module.d.mts";
|
13
|
+
import type { DOCUMENT_OWNERSHIP_LEVELS } from "../constants.d.mts";
|
14
|
+
import type { CONST } from "../../client-esm/client.d.mts";
|
15
|
+
import type { DataModelValidationFailure } from "./validation-failure.mts";
|
16
|
+
import type { EffectChangeData } from "../documents/_types.d.mts";
|
17
|
+
import type {
|
18
|
+
FormGroupConfig,
|
19
|
+
FormInputConfig,
|
20
|
+
FormSelectOption,
|
21
|
+
MultiSelectInputConfig,
|
22
|
+
SelectInputConfig,
|
23
|
+
TextAreaInputConfig,
|
24
|
+
} from "../../client-esm/applications/forms/fields.d.mts";
|
25
|
+
|
26
|
+
declare global {
|
27
|
+
/**
|
28
|
+
* @typeParam BaseAssignmentType - the base assignment type for a DataField, without null or undefined
|
29
|
+
*/
|
30
|
+
interface DataFieldOptions<BaseAssignmentType> {
|
31
|
+
/**
|
32
|
+
* Is this field required to be populated?
|
33
|
+
* @defaultValue `false`
|
34
|
+
*/
|
35
|
+
required?: boolean | undefined;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Can this field have null values?
|
39
|
+
* @defaultValue `false`
|
40
|
+
*/
|
41
|
+
nullable?: boolean | undefined;
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Can this field only be modified by a gamemaster or assistant gamemaster?
|
45
|
+
* @defaultValue `false`
|
46
|
+
*/
|
47
|
+
gmOnly?: boolean | undefined;
|
48
|
+
|
49
|
+
/** The initial value of a field, or a function which assigns that initial value. */
|
50
|
+
initial?:
|
51
|
+
| DataFieldOptions.InitialType<
|
52
|
+
DataFieldOptions.InitialReturnType<BaseAssignmentType, this["nullable"], this["required"]>
|
53
|
+
>
|
54
|
+
| undefined;
|
55
|
+
|
56
|
+
/** A data validation function which accepts one argument with the current value. */
|
57
|
+
validate?: DataField.Validator | undefined;
|
58
|
+
|
59
|
+
/** A localizable label displayed on forms which render this field. */
|
60
|
+
label?: string | undefined;
|
61
|
+
|
62
|
+
/** Localizable help text displayed on forms which render this field. */
|
63
|
+
hint?: string | undefined;
|
64
|
+
|
65
|
+
/**
|
66
|
+
* A custom validation error string. When displayed will be prepended with the
|
67
|
+
* document name, field name, and candidate value. This error string is only
|
68
|
+
* used when the return type of the validate function is a boolean. If an Error
|
69
|
+
* is thrown in the validate function, the string message of that Error is used.
|
70
|
+
*/
|
71
|
+
validationError?: string | undefined;
|
72
|
+
}
|
73
|
+
|
74
|
+
namespace DataFieldOptions {
|
75
|
+
/** Any DataFieldOptions. */
|
76
|
+
type Any = DataFieldOptions<any>;
|
77
|
+
|
78
|
+
/**
|
79
|
+
* A helper type for the {@link DataFieldOptions.initial} option.
|
80
|
+
* @typeParam ReturnType - the return type of the option
|
81
|
+
*/
|
82
|
+
type InitialType<ReturnType> = ReturnType | ((initialData: unknown) => ReturnType);
|
83
|
+
|
84
|
+
/**
|
85
|
+
* The decorated return type for the {@link DataFieldOptions.initial} option.
|
86
|
+
* @typeParam BaseAssignmentType - the base assignment type for a DataField
|
87
|
+
* @typeParam NullableOption - the value of the nullable option
|
88
|
+
* @typeParam RequiredOption - the value of the required option
|
89
|
+
*/
|
90
|
+
type InitialReturnType<BaseAssignmentType, NullableOption, RequiredOption> =
|
91
|
+
| Exclude<BaseAssignmentType, null | undefined>
|
92
|
+
| (NullableOption extends true ? null : never)
|
93
|
+
| (RequiredOption extends true ? never : undefined);
|
94
|
+
}
|
95
|
+
|
96
|
+
interface DataFieldValidationOptions {
|
97
|
+
/** Whether this is a partial schema validation, or a complete one. */
|
98
|
+
partial?: boolean;
|
99
|
+
|
100
|
+
/** Whether to allow replacing invalid values with valid fallbacks. */
|
101
|
+
fallback?: boolean;
|
102
|
+
|
103
|
+
/** The full source object being evaluated. */
|
104
|
+
source?: AnyObject;
|
105
|
+
|
106
|
+
/**
|
107
|
+
* If true, invalid embedded documents will emit a warning and be placed in
|
108
|
+
* the invalidDocuments collection rather than causing the parent to be
|
109
|
+
* considered invalid.
|
110
|
+
*/
|
111
|
+
dropInvalidEmbedded?: boolean;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
/**
|
116
|
+
* An abstract class that defines the base pattern for a data field within a data schema.
|
117
|
+
* @typeParam Options - the options of the DataField instance
|
118
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the DataField
|
119
|
+
* @typeParam InitializedType - the type of the initialized values of the DataField
|
120
|
+
* @typeParam PersistedType - the type of the persisted values of the DataField
|
121
|
+
* @remarks
|
122
|
+
* Defaults:
|
123
|
+
* AssignmentType: `any | null | undefined`
|
124
|
+
* InitializedType: `unknown | undefined`
|
125
|
+
* PersistedType: `unknown | undefined`
|
126
|
+
* InitialValue: `undefined`
|
127
|
+
*/
|
128
|
+
declare abstract class DataField<
|
129
|
+
const Options extends DataFieldOptions.Any = DataField.DefaultOptions,
|
130
|
+
const AssignmentType = DataField.AssignmentType<Options>,
|
131
|
+
const InitializedType = DataField.InitializedType<Options>,
|
132
|
+
const PersistedType extends unknown | null | undefined = InitializedType,
|
133
|
+
> {
|
134
|
+
/**
|
135
|
+
* @param options - Options which configure the behavior of the field
|
136
|
+
*/
|
137
|
+
constructor(options?: Options, context?: DataField.Context);
|
138
|
+
|
139
|
+
/** The initially provided options which configure the data field */
|
140
|
+
options: Options;
|
141
|
+
|
142
|
+
/**
|
143
|
+
* Is this field required to be populated?
|
144
|
+
* @defaultValue `false`
|
145
|
+
*/
|
146
|
+
required: boolean;
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Can this field have null values?
|
150
|
+
* @defaultValue `false`
|
151
|
+
*/
|
152
|
+
nullable: boolean;
|
153
|
+
|
154
|
+
/**
|
155
|
+
* Can this field only be modified by a gamemaster or assistant gamemaster?
|
156
|
+
* @defaultValue `false`
|
157
|
+
*/
|
158
|
+
gmOnly: boolean;
|
159
|
+
|
160
|
+
/**
|
161
|
+
* The initial value of a field, or a function which assigns that initial value.
|
162
|
+
* @defaultValue `undefined`
|
163
|
+
*/
|
164
|
+
initial: DataFieldOptions.InitialType<InitializedType>;
|
165
|
+
|
166
|
+
/**
|
167
|
+
* Should the prepared value of the field be read-only, preventing it from being
|
168
|
+
* changed unless a change to the _source data is applied.
|
169
|
+
* @defaultValue `false`
|
170
|
+
*/
|
171
|
+
readonly: boolean;
|
172
|
+
|
173
|
+
/**
|
174
|
+
* A localizable label displayed on forms which render this field.
|
175
|
+
* @defaultValue `""`
|
176
|
+
*/
|
177
|
+
label: string;
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Localizable help text displayed on forms which render this field.
|
181
|
+
* @defaultValue `""`
|
182
|
+
*/
|
183
|
+
hint: string;
|
184
|
+
|
185
|
+
/**
|
186
|
+
* A custom validation error string. When displayed will be prepended with the
|
187
|
+
* document name, field name, and candidate value. This error string is only
|
188
|
+
* used when the return type of the validate function is a boolean. If an Error
|
189
|
+
* is thrown in the validate function, the string message of that Error is used.
|
190
|
+
* @defaultValue `"is not a valid value"`
|
191
|
+
*/
|
192
|
+
validationError: string;
|
193
|
+
|
194
|
+
/**
|
195
|
+
* The name of this data field within the schema that contains it
|
196
|
+
*
|
197
|
+
* The field name of this DataField instance.
|
198
|
+
* This is assigned by SchemaField#initialize.
|
199
|
+
* @internal
|
200
|
+
*/
|
201
|
+
name: string | undefined;
|
202
|
+
|
203
|
+
/**
|
204
|
+
* A reference to the parent schema to which this DataField belongs.
|
205
|
+
* This is assigned by SchemaField#initialize.
|
206
|
+
* @internal
|
207
|
+
*/
|
208
|
+
parent: DataField.Any | undefined;
|
209
|
+
|
210
|
+
/**
|
211
|
+
* Whether this field defines part of a Document/Embedded Document hierarchy.
|
212
|
+
* @defaultValue `false`
|
213
|
+
*/
|
214
|
+
static hierarchical: boolean;
|
215
|
+
|
216
|
+
/**
|
217
|
+
* Does this field type contain other fields in a recursive structure?
|
218
|
+
* Examples of recursive fields are SchemaField, ArrayField, or TypeDataField
|
219
|
+
* Examples of non-recursive fields are StringField, NumberField, or ObjectField
|
220
|
+
* @defaultValue `false`
|
221
|
+
*/
|
222
|
+
static recursive: boolean;
|
223
|
+
|
224
|
+
/**
|
225
|
+
* Default parameters for this field type
|
226
|
+
* @remarks This is not entirely type-safe, overrides should specify a more concrete return type.
|
227
|
+
*/
|
228
|
+
protected static get _defaults(): DataFieldOptions.Any;
|
229
|
+
|
230
|
+
/**
|
231
|
+
* A dot-separated string representation of the field path within the parent schema.
|
232
|
+
*/
|
233
|
+
get fieldPath(): string;
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Apply a function to this DataField which propagates through recursively to any contained data schema.
|
237
|
+
* @param fn - The function to apply
|
238
|
+
* @param value - The current value of this field
|
239
|
+
* @param options - Additional options passed to the applied function
|
240
|
+
* (default `{}`)
|
241
|
+
* @returns The results object
|
242
|
+
*/
|
243
|
+
apply<Value, Options, Return>(
|
244
|
+
fn: keyof this | ((this: this, value: Value, options: Options) => Return),
|
245
|
+
value: Value,
|
246
|
+
options?: Options,
|
247
|
+
): Return;
|
248
|
+
|
249
|
+
/**
|
250
|
+
* Coerce source data to ensure that it conforms to the correct data type for the field.
|
251
|
+
* Data coercion operations should be simple and synchronous as these are applied whenever a DataModel is constructed.
|
252
|
+
* For one-off cleaning of user-provided input the sanitize method should be used.
|
253
|
+
* @param value - The initial value
|
254
|
+
* @param options - Additional options for how the field is cleaned
|
255
|
+
* @returns The cast value
|
256
|
+
*/
|
257
|
+
clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
|
258
|
+
|
259
|
+
/**
|
260
|
+
* Apply any cleaning logic specific to this DataField type.
|
261
|
+
* @param value - The appropriately coerced value.
|
262
|
+
* @param options - Additional options for how the field is cleaned.
|
263
|
+
* @returns The cleaned value.
|
264
|
+
*/
|
265
|
+
protected _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
|
266
|
+
|
267
|
+
/**
|
268
|
+
* Cast a non-default value to ensure it is the correct type for the field
|
269
|
+
* @param value - The provided non-default value
|
270
|
+
* @returns The standardized value
|
271
|
+
*/
|
272
|
+
protected abstract _cast(value: AssignmentType): InitializedType;
|
273
|
+
|
274
|
+
/**
|
275
|
+
* Attempt to retrieve a valid initial value for the DataField.
|
276
|
+
* @param data - The source data object for which an initial value is required
|
277
|
+
* @returns A valid initial value
|
278
|
+
* @throws An error if there is no valid initial value defined
|
279
|
+
*/
|
280
|
+
getInitialValue(data: DataField.CleanOptions["source"]): InitializedType;
|
281
|
+
|
282
|
+
/**
|
283
|
+
* Validate a candidate input for this field, ensuring it meets the field requirements.
|
284
|
+
* A validation failure can be provided as a raised Error (with a string message), by returning false, or by returning
|
285
|
+
* a DataModelValidationFailure instance.
|
286
|
+
* A validator which returns true denotes that the result is certainly valid and further validations are unnecessary.
|
287
|
+
* @param value - The initial value
|
288
|
+
* @param options - Options which affect validation behavior
|
289
|
+
* (default: `{}`)
|
290
|
+
* @returns Returns a ModelValidationError if a validation failure occurred
|
291
|
+
*/
|
292
|
+
validate(
|
293
|
+
value: AssignmentType,
|
294
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
295
|
+
): DataModelValidationFailure | undefined;
|
296
|
+
|
297
|
+
/**
|
298
|
+
* Special validation rules which supersede regular field validation.
|
299
|
+
* This validator screens for certain values which are otherwise incompatible with this field like null or undefined.
|
300
|
+
* @param value - The candidate value
|
301
|
+
* @returns A boolean to indicate with certainty whether the value is valid.
|
302
|
+
* Otherwise, return void.
|
303
|
+
* @throws May throw a specific error if the value is not valid
|
304
|
+
*/
|
305
|
+
protected _validateSpecial(value: AssignmentType): boolean | void;
|
306
|
+
|
307
|
+
/**
|
308
|
+
* A default type-specific validator that can be overridden by child classes
|
309
|
+
* @param value - The candidate value
|
310
|
+
* @param options - Options which affect validation behavior
|
311
|
+
* @returns A boolean to indicate with certainty whether the value is
|
312
|
+
* valid, or specific DataModelValidationFailure information,
|
313
|
+
* otherwise void.
|
314
|
+
* @throws May throw a specific error if the value is not valid
|
315
|
+
*/
|
316
|
+
protected _validateType(
|
317
|
+
value: InitializedType,
|
318
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
319
|
+
): boolean | DataModelValidationFailure | void;
|
320
|
+
|
321
|
+
/**
|
322
|
+
* Certain fields may declare joint data validation criteria.
|
323
|
+
* This method will only be called if the field is designated as recursive.
|
324
|
+
* @param data - Candidate data for joint model validation
|
325
|
+
* @param options - Options which modify joint model validation
|
326
|
+
* @throws An error if joint model validation fails
|
327
|
+
* @internal
|
328
|
+
*/
|
329
|
+
protected _validateModel(data: AnyObject, options?: AnyObject): void; // TODO: Type further.
|
330
|
+
|
331
|
+
/**
|
332
|
+
* Initialize the original source data into a mutable copy for the DataModel instance.
|
333
|
+
* @param value - The source value of the field
|
334
|
+
* @param model - The DataModel instance that this field belongs to
|
335
|
+
* @param options - Initialization options
|
336
|
+
* @returns An initialized copy of the source data
|
337
|
+
*/
|
338
|
+
initialize(
|
339
|
+
value: PersistedType,
|
340
|
+
model: DataModel.Any,
|
341
|
+
options?: AnyObject, // TODO: Type further.
|
342
|
+
): (() => InitializedType | null) | InitializedType;
|
343
|
+
|
344
|
+
/**
|
345
|
+
* Export the current value of the field into a serializable object.
|
346
|
+
* @param value - The initialized value of the field
|
347
|
+
* @returns An exported representation of the field
|
348
|
+
*/
|
349
|
+
toObject(value: InitializedType): PersistedType;
|
350
|
+
|
351
|
+
/**
|
352
|
+
* Recursively traverse a schema and retrieve a field specification by a given path
|
353
|
+
* @param path - The field path as an array of strings
|
354
|
+
*/
|
355
|
+
protected _getField(path: string[]): unknown; // TODO: Type further.
|
356
|
+
|
357
|
+
/**
|
358
|
+
* Does this form field class have defined form support?
|
359
|
+
*/
|
360
|
+
static get hasFormSupport(): boolean;
|
361
|
+
|
362
|
+
/**
|
363
|
+
* Render this DataField as an HTML element.
|
364
|
+
* @param config - Form element configuration parameters
|
365
|
+
* @throws An Error if this DataField subclass does not support input rendering
|
366
|
+
* @returns A rendered HTMLElement for the field
|
367
|
+
*/
|
368
|
+
toInput(config?: DataField.ToInputConfig<InitializedType>): HTMLElement | HTMLCollection;
|
369
|
+
|
370
|
+
/**
|
371
|
+
* Render this DataField as an HTML element.
|
372
|
+
* Subclasses should implement this method rather than the public toInput method which wraps it.
|
373
|
+
* @param config - Form element configuration parameters
|
374
|
+
* @throws An Error if this DataField subclass does not support input rendering
|
375
|
+
* @returns A rendered HTMLElement for the field
|
376
|
+
*/
|
377
|
+
protected _toInput(config: DataField.ToInputConfig<InitializedType>): HTMLElement | HTMLCollection;
|
378
|
+
|
379
|
+
/**
|
380
|
+
* Render this DataField as a standardized form-group element.
|
381
|
+
* @param groupConfig - Configuration options passed to the wrapping form-group
|
382
|
+
* @param inputConfig - Input element configuration options passed to DataField#toInput
|
383
|
+
* @returns The rendered form group element
|
384
|
+
*/
|
385
|
+
toFormGroup(
|
386
|
+
groupConfig?: DataField.GroupConfig,
|
387
|
+
inputConfig?: DataField.ToInputConfig<InitializedType>,
|
388
|
+
): HTMLDivElement;
|
389
|
+
|
390
|
+
/**
|
391
|
+
* Apply an ActiveEffectChange to this field.
|
392
|
+
* @param value - The field's current value.
|
393
|
+
* @param model - The model instance.
|
394
|
+
* @param change - The change to apply.
|
395
|
+
* @returns The updated value.
|
396
|
+
*/
|
397
|
+
applyChange(value: InitializedType, model: DataModel.Any, change: EffectChangeData): InitializedType;
|
398
|
+
|
399
|
+
/**
|
400
|
+
* Cast a change delta into an appropriate type to be applied to this field.
|
401
|
+
* @param delta - The change delta.
|
402
|
+
* @internal
|
403
|
+
*/
|
404
|
+
// Note(LukeAbby): Technically since this defers to `_cast` it should take whatever `_cast` can.
|
405
|
+
// But it always must be able to take a `string` because that's how `applyChange` calls it.
|
406
|
+
protected _castChangeDelta(delta: string): InitializedType;
|
407
|
+
|
408
|
+
/**
|
409
|
+
* Apply an ADD change to this field.
|
410
|
+
* @param value - The field's current value.
|
411
|
+
* @param delta - The change delta.
|
412
|
+
* @param model - The model instance.
|
413
|
+
* @param change - The original change data.
|
414
|
+
* @returns - The updated value.
|
415
|
+
*/
|
416
|
+
protected _applyChangeAdd(
|
417
|
+
value: InitializedType,
|
418
|
+
delta: InitializedType,
|
419
|
+
model: DataModel.Any,
|
420
|
+
change: EffectChangeData,
|
421
|
+
): InitializedType | undefined;
|
422
|
+
|
423
|
+
/**
|
424
|
+
* Apply a MULTIPLY change to this field.
|
425
|
+
* @param value - The field's current value.
|
426
|
+
* @param delta - The change delta.
|
427
|
+
* @param model - The model instance.
|
428
|
+
* @param change - The original change data.
|
429
|
+
* @returns The updated value.
|
430
|
+
*/
|
431
|
+
protected _applyChangeMultiply(
|
432
|
+
value: InitializedType,
|
433
|
+
delta: InitializedType,
|
434
|
+
model: DataModel.Any,
|
435
|
+
change: EffectChangeData,
|
436
|
+
): InitializedType | undefined;
|
437
|
+
|
438
|
+
/**
|
439
|
+
* Apply an OVERRIDE change to this field.
|
440
|
+
* @param value - The field's current value.
|
441
|
+
* @param delta - The change delta.
|
442
|
+
* @param model - The model instance.
|
443
|
+
* @param change - The original change data.
|
444
|
+
* @returns The updated value.
|
445
|
+
*/
|
446
|
+
protected _applyChangeOverride(
|
447
|
+
value: InitializedType,
|
448
|
+
delta: InitializedType,
|
449
|
+
model: DataModel.Any,
|
450
|
+
change: EffectChangeData,
|
451
|
+
): InitializedType | undefined;
|
452
|
+
|
453
|
+
/**
|
454
|
+
* Apply an UPGRADE change to this field.
|
455
|
+
* @param value - The field's current value.
|
456
|
+
* @param delta - The change delta.
|
457
|
+
* @param model - The model instance.
|
458
|
+
* @param change - The original change data.
|
459
|
+
* @returns - The updated value.
|
460
|
+
*/
|
461
|
+
protected _applyChangeUpgrade(
|
462
|
+
value: InitializedType,
|
463
|
+
delta: InitializedType,
|
464
|
+
model: DataModel.Any,
|
465
|
+
change: EffectChangeData,
|
466
|
+
): InitializedType | undefined;
|
467
|
+
|
468
|
+
/**
|
469
|
+
* Apply a DOWNGRADE change to this field.
|
470
|
+
* @param value - The field's current value.
|
471
|
+
* @param delta - The change delta.
|
472
|
+
* @param model - The model instance.
|
473
|
+
* @param change - The original change data.
|
474
|
+
* @returns The updated value.
|
475
|
+
*/
|
476
|
+
protected _applyChangeDowngrade(
|
477
|
+
value: InitializedType,
|
478
|
+
delta: InitializedType,
|
479
|
+
model: DataModel.Any,
|
480
|
+
change: EffectChangeData,
|
481
|
+
): InitializedType | undefined;
|
482
|
+
|
483
|
+
/**
|
484
|
+
* Apply a CUSTOM change to this field.
|
485
|
+
* @param value - The field's current value.
|
486
|
+
* @param delta - The change delta.
|
487
|
+
* @param model - The model instance.
|
488
|
+
* @param change - The original change data.
|
489
|
+
* @returns - The updated value.
|
490
|
+
*/
|
491
|
+
protected _applyChangeCustom(
|
492
|
+
value: InitializedType,
|
493
|
+
delta: InitializedType,
|
494
|
+
model: DataModel.Any,
|
495
|
+
change: EffectChangeData,
|
496
|
+
): InitializedType;
|
497
|
+
}
|
498
|
+
|
499
|
+
declare namespace DataField {
|
500
|
+
/** Any DataField. */
|
501
|
+
type Any = DataField<any, any, any, any>;
|
502
|
+
|
503
|
+
type AnyConstructor = typeof AnyDataField;
|
504
|
+
|
505
|
+
/** A DataField with unknown inner types. */
|
506
|
+
type Unknown = DataField<any, unknown, unknown, unknown>;
|
507
|
+
|
508
|
+
type AssignmentTypeFor<ConcreteDataField extends Any> =
|
509
|
+
ConcreteDataField extends DataField<any, infer AssignmentType, any, any> ? AssignmentType : never;
|
510
|
+
|
511
|
+
type InitializedTypeFor<ConcreteDataField extends Any> =
|
512
|
+
ConcreteDataField extends DataField<any, any, infer InitializedType, any> ? InitializedType : never;
|
513
|
+
|
514
|
+
type PersistedTypeFor<ConcreteDataField extends Any> =
|
515
|
+
ConcreteDataField extends DataField<any, any, any, infer PersistedType> ? PersistedType : never;
|
516
|
+
|
517
|
+
/** The type of the default options for the {@link DataField} class. */
|
518
|
+
interface DefaultOptions {
|
519
|
+
required: false;
|
520
|
+
nullable: false;
|
521
|
+
initial: undefined;
|
522
|
+
readonly: false;
|
523
|
+
gmOnly: false;
|
524
|
+
label: "";
|
525
|
+
hint: "";
|
526
|
+
validationError: "is not a valid value";
|
527
|
+
}
|
528
|
+
|
529
|
+
/**
|
530
|
+
* A helper type for the given options type merged into the default options of the DataField class.
|
531
|
+
* @typeParam Options - the options that override the default options
|
532
|
+
*/
|
533
|
+
type MergedOptions<Options extends DataFieldOptions.Any> = SimpleMerge<DefaultOptions, Options>;
|
534
|
+
|
535
|
+
/**
|
536
|
+
* A type to decorate the base assignment type to a DataField, based on the options of the field.
|
537
|
+
* @typeParam BaseAssignmentType - the base assignment type of the DataField, without null or undefined
|
538
|
+
* @typeParam Options - the options of the DataField
|
539
|
+
*/
|
540
|
+
type DerivedAssignmentType<BaseAssignmentType, Options extends DataFieldOptions.Any> =
|
541
|
+
| Exclude<BaseAssignmentType, null | undefined> // Always include the base type
|
542
|
+
| (Options["nullable"] extends true // determine whether null is in the union
|
543
|
+
? // when nullable, null is always allowed
|
544
|
+
null
|
545
|
+
: // otherwise, it depends on required
|
546
|
+
Options["required"] extends true
|
547
|
+
? // when required and not nullable, null can only be passed when initial is present
|
548
|
+
"initial" extends keyof Options
|
549
|
+
? // when initial is present, null can be passed
|
550
|
+
null
|
551
|
+
: // when initial is not in the options, then null can not be passed
|
552
|
+
never
|
553
|
+
: // when not required, null can safely be passed
|
554
|
+
null)
|
555
|
+
| (Options["required"] extends true // determine whether undefined is in the union
|
556
|
+
? // when required, it depends on initial
|
557
|
+
"initial" extends keyof Options
|
558
|
+
? // when initial is in the options, undefined is allowed
|
559
|
+
undefined
|
560
|
+
: // when initial is not in the options, then undefined is not allowed
|
561
|
+
never
|
562
|
+
: // when not required, undefined can safely be passed
|
563
|
+
undefined);
|
564
|
+
|
565
|
+
/**
|
566
|
+
* A type to decorate the base initialized type of a DataField, based on the options of the field.
|
567
|
+
* @typeParam BaseInitializedType - the base initialized type of the DataField, without null or undefined
|
568
|
+
* @typeParam Options - the options of the DataField
|
569
|
+
*/
|
570
|
+
type DerivedInitializedType<BaseInitializedType, Options extends DataFieldOptions.Any> =
|
571
|
+
| Exclude<BaseInitializedType, null | undefined>
|
572
|
+
| (Options["nullable"] extends true ? null : never)
|
573
|
+
| (Options["required"] extends true ? never : undefined);
|
574
|
+
|
575
|
+
/**
|
576
|
+
* A shorthand for the assignment type of a DataField class.
|
577
|
+
* @typeParam Options - the options overriding the defaults
|
578
|
+
*/
|
579
|
+
type AssignmentType<Options extends DataFieldOptions.Any> = DerivedAssignmentType<any, MergedOptions<Options>>;
|
580
|
+
|
581
|
+
/**
|
582
|
+
* A shorthand for the initialized type of a DataField class.
|
583
|
+
* @typeParam Options - the options overriding the defaults
|
584
|
+
*/
|
585
|
+
type InitializedType<Options extends DataFieldOptions.Any> = DerivedInitializedType<any, MergedOptions<Options>>;
|
586
|
+
|
587
|
+
/** An interface for the options of the {@link DataField} clean functions. */
|
588
|
+
interface CleanOptions {
|
589
|
+
/** Whether to perform partial cleaning? */
|
590
|
+
partial?: boolean;
|
591
|
+
|
592
|
+
/** The root data model being cleaned */
|
593
|
+
source?: {
|
594
|
+
type?: string;
|
595
|
+
};
|
596
|
+
}
|
597
|
+
|
598
|
+
/**
|
599
|
+
* A Custom DataField validator function.
|
600
|
+
*
|
601
|
+
* A boolean return value indicates that the value is valid (true) or invalid (false) with certainty. With an explicit
|
602
|
+
* boolean return value no further validation functions will be evaluated.
|
603
|
+
*
|
604
|
+
* An undefined return indicates that the value may be valid but further validation functions should be performed,
|
605
|
+
* if defined.
|
606
|
+
*
|
607
|
+
* An Error may be thrown which provides a custom error message explaining the reason the value is invalid.
|
608
|
+
*/
|
609
|
+
// TODO(LukeAbby): `value: never` is a stopgap because of emergent errors. Pass back in `BaseAssignmentType` instead of `value: never` which is too lenient.
|
610
|
+
type Validator = (this: DataField, value: never, options: ValidationOptions<DataField>) => boolean | void;
|
611
|
+
|
612
|
+
/**
|
613
|
+
* An interface for the options of the {@link DataField} validation functions.
|
614
|
+
* @typeParam DataField - the type of the DataField, which is the receiver of the validate function
|
615
|
+
*/
|
616
|
+
interface ValidationOptions<DataField extends DataField.Any> extends DataValidationOptions {
|
617
|
+
source?: AnyObject;
|
618
|
+
validate?: Validator;
|
619
|
+
}
|
620
|
+
|
621
|
+
interface Context {
|
622
|
+
/** A field name to assign to the constructed field */
|
623
|
+
name: string;
|
624
|
+
|
625
|
+
/** Another data field which is a hierarchical parent of this one */
|
626
|
+
parent: DataField.Any;
|
627
|
+
}
|
628
|
+
|
629
|
+
interface ToInputConfig<InitializedType> extends FormInputConfig<InitializedType> {}
|
630
|
+
|
631
|
+
interface ToInputConfigWithOptions<InitializedType> extends FormInputConfig<InitializedType>, SelectInputConfig {}
|
632
|
+
|
633
|
+
type AnyChoices = StringField.Choices | NumberField.Choices;
|
634
|
+
|
635
|
+
type ToInputConfigWithChoices<InitializedType, Choices extends AnyChoices | undefined> = SimpleMerge<
|
636
|
+
Omit<ToInputConfigWithOptions<InitializedType>, "options">,
|
637
|
+
Choices extends undefined ? StringField.GetChoicesOptions : NullishProps<StringField.GetChoicesOptions, "choices">
|
638
|
+
>;
|
639
|
+
|
640
|
+
type SelectableToInputConfig<InitializedType, Choices extends StringField.Choices | undefined> =
|
641
|
+
| ToInputConfig<InitializedType>
|
642
|
+
| ToInputConfigWithOptions<InitializedType>
|
643
|
+
| ToInputConfigWithChoices<InitializedType, Choices>;
|
644
|
+
|
645
|
+
// `DataField#toFormGroup` provides default values for these by way of `??=`.
|
646
|
+
interface GroupConfig extends NullishProps<FormGroupConfig, "label" | "hint" | "input"> {}
|
647
|
+
}
|
648
|
+
|
649
|
+
declare abstract class AnyDataField extends DataField<any, any, any, any> {}
|
650
|
+
|
651
|
+
/**
|
652
|
+
* A special class of {@link DataField} which defines a data schema.
|
653
|
+
* @typeParam Fields - the DataSchema fields of the SchemaField
|
654
|
+
* @typeParam Options - the options of the SchemaField instance
|
655
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the SchemaField
|
656
|
+
* @typeParam InitializedType - the type of the initialized values of the SchemaField
|
657
|
+
* @typeParam PersistedType - the type of the persisted values of the SchemaField
|
658
|
+
* @remarks
|
659
|
+
* Defaults:
|
660
|
+
* AssignmentType: `SchemaField.AssignmentType<Fields> | null | undefined`
|
661
|
+
* InitializedType: `SchemaField.InitializedType<Fields>`
|
662
|
+
* PersistedType: `SchemaField.PersistedType<Fields>`
|
663
|
+
*/
|
664
|
+
declare class SchemaField<
|
665
|
+
Fields extends DataSchema,
|
666
|
+
Options extends SchemaField.Options<Fields> = SchemaField.DefaultOptions,
|
667
|
+
AssignmentType = SchemaField.AssignmentType<Fields, SimpleMerge<Options, SchemaField.DefaultOptions>>,
|
668
|
+
InitializedType = SchemaField.InitializedType<Fields, SimpleMerge<Options, SchemaField.DefaultOptions>>,
|
669
|
+
PersistedType extends AnyObject | null | undefined = SchemaField.PersistedType<
|
670
|
+
Fields,
|
671
|
+
SimpleMerge<Options, SchemaField.DefaultOptions>
|
672
|
+
>,
|
673
|
+
> extends DataField<Options, AssignmentType, InitializedType, PersistedType> {
|
674
|
+
/**
|
675
|
+
* @param fields - The contained field definitions
|
676
|
+
* @param options - Options which configure the behavior of the field
|
677
|
+
*/
|
678
|
+
// 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.
|
679
|
+
constructor(fields: { [K in keyof Fields]: Fields[K] }, options?: Options, context?: DataField.Context);
|
680
|
+
|
681
|
+
/** @defaultValue `true` */
|
682
|
+
override required: boolean;
|
683
|
+
|
684
|
+
/** @defaultValue `false` */
|
685
|
+
override nullable: boolean;
|
686
|
+
|
687
|
+
/** @defaultValue `() => this.clean({})` */
|
688
|
+
override initial: DataFieldOptions.InitialType<InitializedType>;
|
689
|
+
|
690
|
+
protected static override get _defaults(): SchemaField.Options<DataSchema>;
|
691
|
+
|
692
|
+
/** @defaultValue `true` */
|
693
|
+
static override recursive: boolean;
|
694
|
+
|
695
|
+
/**
|
696
|
+
* The contained field definitions.
|
697
|
+
*/
|
698
|
+
fields: Fields;
|
699
|
+
|
700
|
+
/**
|
701
|
+
* Initialize and validate the structure of the provided field definitions.
|
702
|
+
* @param fields - The provided field definitions
|
703
|
+
* @returns The validated schema
|
704
|
+
*/
|
705
|
+
protected _initialize(fields: Fields): Fields;
|
706
|
+
|
707
|
+
/**
|
708
|
+
* Iterate over a SchemaField by iterating over its fields.
|
709
|
+
*/
|
710
|
+
[Symbol.iterator](): Generator<DataField.Unknown>;
|
711
|
+
|
712
|
+
/**
|
713
|
+
* An array of field names which are present in the schema.
|
714
|
+
*/
|
715
|
+
keys(): string[];
|
716
|
+
|
717
|
+
/**
|
718
|
+
* An array of DataField instances which are present in the schema.
|
719
|
+
*/
|
720
|
+
values(): DataField.Unknown[];
|
721
|
+
|
722
|
+
/**
|
723
|
+
* An array of [name, DataField] tuples which define the schema.
|
724
|
+
*/
|
725
|
+
entries(): [name: string, dataField: DataField.Unknown][];
|
726
|
+
|
727
|
+
/**
|
728
|
+
* Test whether a certain field name belongs to this schema definition.
|
729
|
+
* @param fieldName - The field name
|
730
|
+
* @returns Does the named field exist in this schema?
|
731
|
+
*/
|
732
|
+
has(fieldName: string): boolean;
|
733
|
+
|
734
|
+
/**
|
735
|
+
* Get a DataField instance from the schema by name
|
736
|
+
* @param fieldName - The field name
|
737
|
+
* @returns The DataField instance or undefined
|
738
|
+
*/
|
739
|
+
get(fieldName: string): DataField.Unknown | undefined;
|
740
|
+
|
741
|
+
/**
|
742
|
+
* Traverse the schema, obtaining the DataField definition for a particular field.
|
743
|
+
* @param fieldName - A field path like ["abilities", "strength"] or "abilities.strength"
|
744
|
+
* @returns The corresponding DataField definition for that field, or undefined
|
745
|
+
*/
|
746
|
+
getField(fieldName: string | string[]): DataField.Unknown | undefined;
|
747
|
+
|
748
|
+
protected override _getField(path: string[]): DataField.Unknown;
|
749
|
+
|
750
|
+
protected override _cast(value: AssignmentType): InitializedType;
|
751
|
+
|
752
|
+
protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
|
753
|
+
|
754
|
+
override initialize(
|
755
|
+
value: PersistedType,
|
756
|
+
model: DataModel.Any,
|
757
|
+
options?: AnyObject,
|
758
|
+
): InitializedType | (() => InitializedType | null);
|
759
|
+
|
760
|
+
protected override _validateType(
|
761
|
+
value: InitializedType,
|
762
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
763
|
+
): boolean | DataModelValidationFailure | void;
|
764
|
+
|
765
|
+
protected override _validateModel(data: AnyObject, options?: AnyObject): void;
|
766
|
+
|
767
|
+
override toObject(value: InitializedType): PersistedType;
|
768
|
+
|
769
|
+
override apply<Value, Options, Return>(
|
770
|
+
fn: keyof this | ((this: this, value: Value, options: Options) => Return),
|
771
|
+
value: Value,
|
772
|
+
options?: Options,
|
773
|
+
): Return;
|
774
|
+
|
775
|
+
/**
|
776
|
+
* Migrate this field's candidate source data.
|
777
|
+
* @param sourceData - Candidate source data of the root model
|
778
|
+
* @param fieldData - The value of this field within the source data
|
779
|
+
*/
|
780
|
+
migrateSource(sourceData: AnyObject, fieldData: unknown): unknown;
|
781
|
+
}
|
782
|
+
|
783
|
+
// FIXME(LukeAbby): This is a quick patch that avoids issues with the fact that the `initial` in `SchemaField` is not actually assignable to its assignment type etc.
|
784
|
+
// This will be superceded once proper field treatment is applied.
|
785
|
+
declare const __SchemaFieldInitialSymbol: unique symbol;
|
786
|
+
|
787
|
+
type __SchemaFieldInitial = typeof __SchemaFieldInitialSymbol;
|
788
|
+
|
789
|
+
declare namespace SchemaField {
|
790
|
+
/**
|
791
|
+
* A shorthand for the options of a SchemaField class.
|
792
|
+
* @typeParam Fields - the DataSchema fields of the SchemaField
|
793
|
+
*/
|
794
|
+
type Options<Fields extends DataSchema> = DataFieldOptions<InnerAssignmentType<Fields> | __SchemaFieldInitial>;
|
795
|
+
|
796
|
+
/** Any SchemaField. */
|
797
|
+
type Any = SchemaField<any, any, any, any, any>;
|
798
|
+
|
799
|
+
/**
|
800
|
+
* Get the constructor type for the given DataSchema.
|
801
|
+
* @typeParam Fields - the DataSchema fields of the SchemaField
|
802
|
+
*/
|
803
|
+
type InnerConstructorType<Fields extends DataSchema> = InnerAssignmentType<Fields>;
|
804
|
+
|
805
|
+
/**
|
806
|
+
* Get the inner assignment type for the given DataSchema.
|
807
|
+
* @typeParam Fields - the DataSchema fields of the SchemaField
|
808
|
+
*/
|
809
|
+
type InnerAssignmentType<Fields extends DataSchema> = RemoveIndexSignatures<{
|
810
|
+
[Key in keyof Fields]?: Fields[Key] extends DataField<any, infer AssignType, any, any>
|
811
|
+
? Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
|
812
|
+
? // FIXME(LukeAbby): This is a quick hack into InnerAssignmentType that assumes that the `initial` of `SchemaField` is not changed from the default of `{}`
|
813
|
+
// This will be fixed with the refactoring of the types
|
814
|
+
EmptyObject extends InnerAssignmentType<SubSchema>
|
815
|
+
? InnerAssignmentType<SubSchema> | undefined | null
|
816
|
+
: InnerAssignmentType<SubSchema>
|
817
|
+
: AssignType
|
818
|
+
: never;
|
819
|
+
}>;
|
820
|
+
|
821
|
+
/**
|
822
|
+
* Get the inner initialized type for the given DataSchema.
|
823
|
+
* @typeParam Fields - the DataSchema fields of the SchemaField
|
824
|
+
*/
|
825
|
+
type InnerInitializedType<Fields extends DataSchema> = RemoveIndexSignatures<{
|
826
|
+
[Key in keyof Fields]: Fields[Key] extends DataField<any, any, infer InitType, any>
|
827
|
+
? Fields[Key] extends EmbeddedDataField<infer Model, any, any, any, any>
|
828
|
+
? InstanceType<Model>
|
829
|
+
: Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
|
830
|
+
? InnerInitializedType<SubSchema>
|
831
|
+
: InitType
|
832
|
+
: never;
|
833
|
+
}>;
|
834
|
+
|
835
|
+
/**
|
836
|
+
* Get the inner persisted type for the given DataSchema.
|
837
|
+
* @typeParam Fields - the DataSchema fields of the SchemaField
|
838
|
+
*/
|
839
|
+
type InnerPersistedType<Fields extends DataSchema> = RemoveIndexSignatures<{
|
840
|
+
[Key in keyof Fields]: Fields[Key] extends DataField<any, any, any, infer PersistType>
|
841
|
+
? Fields[Key] extends SchemaField<infer SubSchema, any, any, any, any>
|
842
|
+
? InnerPersistedType<SubSchema>
|
843
|
+
: PersistType
|
844
|
+
: never;
|
845
|
+
}>;
|
846
|
+
|
847
|
+
/** The type of the default options for the {@link SchemaField} class. */
|
848
|
+
type DefaultOptions = SimpleMerge<
|
849
|
+
DataField.DefaultOptions,
|
850
|
+
{
|
851
|
+
required: true;
|
852
|
+
nullable: false;
|
853
|
+
initial: __SchemaFieldInitial;
|
854
|
+
}
|
855
|
+
>;
|
856
|
+
|
857
|
+
/**
|
858
|
+
* A helper type for the given options type merged into the default options of the SchemaField class.
|
859
|
+
* @typeParam Fields - the DataSchema fields of the SchemaField
|
860
|
+
* @typeParam Opts - the options that override the default options
|
861
|
+
*/
|
862
|
+
type MergedOptions<Fields extends DataSchema, Opts extends Options<Fields>> = SimpleMerge<DefaultOptions, Opts>;
|
863
|
+
|
864
|
+
// FIXME: null or undefined should be permissible, cast as the initialized type
|
865
|
+
/**
|
866
|
+
* A shorthand for the assignment type of a SchemaField class.
|
867
|
+
* @typeParam Fields - the DataSchema fields of the SchemaField
|
868
|
+
* @typeParam Opts - the options that override the default options
|
869
|
+
*/
|
870
|
+
type AssignmentType<
|
871
|
+
Fields extends DataSchema,
|
872
|
+
Opts extends Options<Fields> = DefaultOptions,
|
873
|
+
> = DataField.DerivedAssignmentType<InnerAssignmentType<Fields>, MergedOptions<Fields, Opts>>;
|
874
|
+
|
875
|
+
/**
|
876
|
+
* A shorthand for the assignment type of a SchemaField class.
|
877
|
+
* @typeParam Fields - the DataSchema fields of the SchemaField
|
878
|
+
* @typeParam Opts - the options that override the default options
|
879
|
+
*/
|
880
|
+
type InitializedType<
|
881
|
+
Fields extends DataSchema,
|
882
|
+
Opts extends Options<Fields> = DefaultOptions,
|
883
|
+
> = DataField.DerivedInitializedType<InnerInitializedType<Fields>, MergedOptions<Fields, Opts>>;
|
884
|
+
|
885
|
+
/**
|
886
|
+
* A shorthand for the assignment type of a SchemaField class.
|
887
|
+
* @typeParam Fields - the DataSchema fields of the SchemaField
|
888
|
+
* @typeParam Opts - the options that override the default options
|
889
|
+
*/
|
890
|
+
type PersistedType<
|
891
|
+
Fields extends DataSchema,
|
892
|
+
Opts extends Options<Fields> = DefaultOptions,
|
893
|
+
> = DataField.DerivedInitializedType<InnerPersistedType<Fields>, MergedOptions<Fields, Opts>>;
|
894
|
+
}
|
895
|
+
|
896
|
+
/**
|
897
|
+
* A subclass of [DataField]{@link DataField} which deals with boolean-typed data.
|
898
|
+
* @typeParam Options - the options of the BooleanField instance
|
899
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the BooleanField
|
900
|
+
* @typeParam InitializedType - the type of the initialized values of the BooleanField
|
901
|
+
* @typeParam PersistedType - the type of the persisted values of the BooleanField
|
902
|
+
* @remarks
|
903
|
+
* Defaults:
|
904
|
+
* AssignmentType: `boolean | null | undefined`
|
905
|
+
* InitializedType: `boolean`
|
906
|
+
* PersistedType: `boolean`
|
907
|
+
* InitialValue: `false`
|
908
|
+
*/
|
909
|
+
declare class BooleanField<
|
910
|
+
const Options extends BooleanField.Options = BooleanField.DefaultOptions,
|
911
|
+
const AssignmentType = BooleanField.AssignmentType<SimpleMerge<Options, BooleanField.DefaultOptions>>,
|
912
|
+
const InitializedType = BooleanField.InitializedType<SimpleMerge<Options, BooleanField.DefaultOptions>>,
|
913
|
+
const PersistedType extends boolean | null | undefined = BooleanField.InitializedType<
|
914
|
+
SimpleMerge<Options, BooleanField.DefaultOptions>
|
915
|
+
>,
|
916
|
+
> extends DataField<Options, AssignmentType, InitializedType, PersistedType> {
|
917
|
+
/** @defaultValue `true` */
|
918
|
+
override required: boolean;
|
919
|
+
|
920
|
+
/** @defaultValue `false` */
|
921
|
+
override nullable: boolean;
|
922
|
+
|
923
|
+
/** @defaultValue `false` */
|
924
|
+
override initial: DataFieldOptions.InitialType<InitializedType>;
|
925
|
+
|
926
|
+
protected static override get _defaults(): BooleanField.Options;
|
927
|
+
|
928
|
+
protected override _cast(value: AssignmentType): InitializedType;
|
929
|
+
|
930
|
+
protected override _validateType(
|
931
|
+
value: InitializedType,
|
932
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
933
|
+
): boolean | DataModelValidationFailure | void;
|
934
|
+
|
935
|
+
protected override _toInput(config: DataField.ToInputConfig<InitializedType>): HTMLElement | HTMLCollection;
|
936
|
+
}
|
937
|
+
|
938
|
+
declare namespace BooleanField {
|
939
|
+
/** A shorthand for the options of a BooleanField class. */
|
940
|
+
type Options = DataFieldOptions<boolean>;
|
941
|
+
|
942
|
+
/** The type of the default options for the {@link BooleanField} class. */
|
943
|
+
type DefaultOptions = SimpleMerge<
|
944
|
+
DataField.DefaultOptions,
|
945
|
+
{
|
946
|
+
required: true;
|
947
|
+
nullable: false;
|
948
|
+
initial: boolean;
|
949
|
+
}
|
950
|
+
>;
|
951
|
+
|
952
|
+
/**
|
953
|
+
* A helper type for the given options type merged into the default options of the BooleanField class.
|
954
|
+
* @typeParam Opts - the options that override the default options
|
955
|
+
*/
|
956
|
+
type MergedOptions<Opts extends Options> = SimpleMerge<DefaultOptions, Opts>;
|
957
|
+
|
958
|
+
/**
|
959
|
+
* A shorthand for the assignment type of a BooleanField class.
|
960
|
+
* @typeParam Opts - the options that override the default options
|
961
|
+
*/
|
962
|
+
type AssignmentType<Opts extends Options> = DataField.DerivedAssignmentType<boolean, MergedOptions<Opts>>;
|
963
|
+
|
964
|
+
/**
|
965
|
+
* A shorthand for the initialized type of a BooleanField class.
|
966
|
+
* @typeParam Opts - the options that override the default options
|
967
|
+
*/
|
968
|
+
type InitializedType<Opts extends Options> = DataField.DerivedInitializedType<boolean, MergedOptions<Opts>>;
|
969
|
+
}
|
970
|
+
|
971
|
+
declare global {
|
972
|
+
interface NumberFieldOptions extends DataFieldOptions<number> {
|
973
|
+
/**
|
974
|
+
* A minimum allowed value
|
975
|
+
* @defaultValue `undefined`
|
976
|
+
*/
|
977
|
+
min?: number | undefined;
|
978
|
+
|
979
|
+
/**
|
980
|
+
* A maximum allowed value
|
981
|
+
* @defaultValue `undefined`
|
982
|
+
*/
|
983
|
+
max?: number | undefined;
|
984
|
+
|
985
|
+
/**
|
986
|
+
* A permitted step size
|
987
|
+
* @defaultValue `undefined`
|
988
|
+
*/
|
989
|
+
step?: number | undefined;
|
990
|
+
|
991
|
+
/**
|
992
|
+
* Must the number be an integer?
|
993
|
+
* @defaultValue `false`
|
994
|
+
*/
|
995
|
+
integer?: boolean | undefined;
|
996
|
+
|
997
|
+
/**
|
998
|
+
* Must the number be positive?
|
999
|
+
* @defaultValue `false`
|
1000
|
+
*/
|
1001
|
+
positive?: boolean | undefined;
|
1002
|
+
|
1003
|
+
/**
|
1004
|
+
* An array of values or an object of values/labels which represent
|
1005
|
+
* allowed choices for the field. A function may be provided which dynamically
|
1006
|
+
* returns the array of choices.
|
1007
|
+
* @defaultValue `undefined`
|
1008
|
+
*/
|
1009
|
+
choices?: NumberField.Choices | undefined;
|
1010
|
+
}
|
1011
|
+
}
|
1012
|
+
|
1013
|
+
/**
|
1014
|
+
* A subclass of [DataField]{@link DataField} which deals with number-typed data.
|
1015
|
+
* @typeParam Options - the options of the NumberField instance
|
1016
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the NumberField
|
1017
|
+
* @typeParam InitializedType - the type of the initialized values of the NumberField
|
1018
|
+
* @typeParam PersistedType - the type of the persisted values of the NumberField
|
1019
|
+
* @remarks
|
1020
|
+
* Defaults:
|
1021
|
+
* AssignmentType: `number | null | undefined`
|
1022
|
+
* InitializedType: `number | null`
|
1023
|
+
* PersistedType: `number | null`
|
1024
|
+
* InitialValue: `null`
|
1025
|
+
*/
|
1026
|
+
declare class NumberField<
|
1027
|
+
const Options extends NumberFieldOptions = NumberField.DefaultOptions,
|
1028
|
+
const AssignmentType = NumberField.AssignmentType<Options>,
|
1029
|
+
const InitializedType = NumberField.InitializedType<Options>,
|
1030
|
+
const PersistedType extends number | null | undefined = NumberField.InitializedType<Options>,
|
1031
|
+
> extends DataField<Options, AssignmentType, InitializedType, PersistedType> {
|
1032
|
+
/**
|
1033
|
+
* @param options - Options which configure the behavior of the field
|
1034
|
+
*/
|
1035
|
+
constructor(options?: Options, context?: DataField.Context);
|
1036
|
+
|
1037
|
+
/** @defaultValue `null` */
|
1038
|
+
override initial: DataFieldOptions.InitialType<InitializedType>;
|
1039
|
+
|
1040
|
+
/** @defaultValue `true` */
|
1041
|
+
override nullable: boolean;
|
1042
|
+
|
1043
|
+
/**
|
1044
|
+
* A minimum allowed value
|
1045
|
+
* @defaultValue `undefined`
|
1046
|
+
*/
|
1047
|
+
min: number | undefined;
|
1048
|
+
|
1049
|
+
/**
|
1050
|
+
* A maximum allowed value
|
1051
|
+
* @defaultValue `undefined`
|
1052
|
+
*/
|
1053
|
+
max: number | undefined;
|
1054
|
+
|
1055
|
+
/**
|
1056
|
+
* A permitted step size
|
1057
|
+
* @defaultValue `undefined`
|
1058
|
+
*/
|
1059
|
+
step: number | undefined;
|
1060
|
+
|
1061
|
+
/**
|
1062
|
+
* Must the number be an integer?
|
1063
|
+
* @defaultValue `false`
|
1064
|
+
*/
|
1065
|
+
integer: boolean;
|
1066
|
+
|
1067
|
+
/**
|
1068
|
+
* Must the number be positive?
|
1069
|
+
* @defaultValue `false`
|
1070
|
+
*/
|
1071
|
+
positive: boolean;
|
1072
|
+
|
1073
|
+
/**
|
1074
|
+
* An array of values or an object of values/labels which represent
|
1075
|
+
* allowed choices for the field. A function may be provided which dynamically
|
1076
|
+
* returns the array of choices.
|
1077
|
+
* @defaultValue `undefined`
|
1078
|
+
*/
|
1079
|
+
choices: number[] | Record<number, string> | (() => number[] | Record<number, string>) | undefined;
|
1080
|
+
|
1081
|
+
protected static override get _defaults(): NumberFieldOptions;
|
1082
|
+
|
1083
|
+
protected override _cast(value: AssignmentType): InitializedType;
|
1084
|
+
|
1085
|
+
protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
|
1086
|
+
|
1087
|
+
protected override _validateType(
|
1088
|
+
value: InitializedType,
|
1089
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
1090
|
+
): boolean | DataModelValidationFailure | void;
|
1091
|
+
|
1092
|
+
/**
|
1093
|
+
* Test whether a provided value is a valid choice from the allowed choice set
|
1094
|
+
* @param value - The provided value
|
1095
|
+
* @returns Is the choice valid?
|
1096
|
+
*/
|
1097
|
+
#isValidChoice(value: AssignmentType): boolean;
|
1098
|
+
|
1099
|
+
// These verbose overloads are because otherwise there would be a misleading errors about `choices` being required without mentioning `options` or vice versa.
|
1100
|
+
toFormGroup(
|
1101
|
+
groupConfig?: DataField.GroupConfig,
|
1102
|
+
// TODO(LukeAbby): `Options["Choices"]` is inappropriate as it does not account for `DefaultOptions`.
|
1103
|
+
inputConfig?:
|
1104
|
+
| NumberField.ToInputConfig<InitializedType, Options["choices"]>
|
1105
|
+
| NumberField.ToInputConfigWithOptions<InitializedType>,
|
1106
|
+
): HTMLDivElement;
|
1107
|
+
toFormGroup(
|
1108
|
+
groupConfig?: DataField.GroupConfig,
|
1109
|
+
inputConfig?: NumberField.ToInputConfigWithChoices<InitializedType, Options["choices"]>,
|
1110
|
+
): HTMLDivElement;
|
1111
|
+
|
1112
|
+
toInput(
|
1113
|
+
config?:
|
1114
|
+
| NumberField.ToInputConfig<InitializedType, Options["choices"]>
|
1115
|
+
| NumberField.ToInputConfigWithOptions<InitializedType>,
|
1116
|
+
): HTMLElement | HTMLCollection;
|
1117
|
+
toInput(
|
1118
|
+
config?: NumberField.ToInputConfigWithChoices<InitializedType, Options["choices"]>,
|
1119
|
+
): HTMLElement | HTMLCollection;
|
1120
|
+
|
1121
|
+
protected override _toInput(
|
1122
|
+
config:
|
1123
|
+
| NumberField.ToInputConfig<InitializedType, Options["choices"]>
|
1124
|
+
| NumberField.ToInputConfigWithOptions<InitializedType>,
|
1125
|
+
): HTMLElement | HTMLCollection;
|
1126
|
+
protected override _toInput(
|
1127
|
+
config: NumberField.ToInputConfigWithChoices<InitializedType, Options["choices"]>,
|
1128
|
+
): HTMLElement | HTMLCollection;
|
1129
|
+
}
|
1130
|
+
|
1131
|
+
declare namespace NumberField {
|
1132
|
+
/** The type of the default options for the {@link NumberField} class. */
|
1133
|
+
type DefaultOptions = SimpleMerge<
|
1134
|
+
DataField.DefaultOptions,
|
1135
|
+
{
|
1136
|
+
initial: null;
|
1137
|
+
nullable: true;
|
1138
|
+
min: undefined;
|
1139
|
+
max: undefined;
|
1140
|
+
step: undefined;
|
1141
|
+
integer: false;
|
1142
|
+
positive: false;
|
1143
|
+
choices: undefined;
|
1144
|
+
}
|
1145
|
+
>;
|
1146
|
+
|
1147
|
+
/** The type of the default options for the {@link NumberField} class when choices are provided. */
|
1148
|
+
type DefaultOptionsWhenChoicesProvided = SimpleMerge<DefaultOptions, { nullable: false }>;
|
1149
|
+
|
1150
|
+
/**
|
1151
|
+
* A helper type for the given options type merged into the default options of the NumberField class.
|
1152
|
+
* @typeParam Options - the options that override the default options
|
1153
|
+
*/
|
1154
|
+
type MergedOptions<Options extends NumberFieldOptions> = SimpleMerge<
|
1155
|
+
undefined extends Options["choices"] ? DefaultOptions : DefaultOptionsWhenChoicesProvided,
|
1156
|
+
Options
|
1157
|
+
>;
|
1158
|
+
|
1159
|
+
/**
|
1160
|
+
* A shorthand for the assignment type of a NumberField class.
|
1161
|
+
* @typeParam Options - the options that override the default options
|
1162
|
+
*/
|
1163
|
+
type AssignmentType<Options extends NumberFieldOptions> = DataField.DerivedAssignmentType<
|
1164
|
+
number,
|
1165
|
+
MergedOptions<Options>
|
1166
|
+
>;
|
1167
|
+
|
1168
|
+
/**
|
1169
|
+
* A shorthand for the initialized type of a NumberField class.
|
1170
|
+
* @typeParam Options - the options that override the default options
|
1171
|
+
*/
|
1172
|
+
type InitializedType<Options extends NumberFieldOptions> = DataField.DerivedInitializedType<
|
1173
|
+
number,
|
1174
|
+
MergedOptions<Options>
|
1175
|
+
>;
|
1176
|
+
|
1177
|
+
type BaseChoices =
|
1178
|
+
| {
|
1179
|
+
readonly [K: number | `${number}`]: string;
|
1180
|
+
}
|
1181
|
+
| readonly number[];
|
1182
|
+
|
1183
|
+
type Choices = BaseChoices | (() => BaseChoices);
|
1184
|
+
|
1185
|
+
/** @internal */
|
1186
|
+
type _ToInputConfig<InitializedType> = DataField.ToInputConfig<InitializedType> &
|
1187
|
+
NullishProps<{
|
1188
|
+
min: number;
|
1189
|
+
max: number;
|
1190
|
+
step: number;
|
1191
|
+
}>;
|
1192
|
+
|
1193
|
+
type ToInputConfigWithChoices<InitializedType, Choices extends NumberField.Choices | undefined> = SimpleMerge<
|
1194
|
+
DataField.ToInputConfigWithChoices<InitializedType, Choices>,
|
1195
|
+
_ToInputConfig<InitializedType>
|
1196
|
+
>;
|
1197
|
+
|
1198
|
+
interface ToInputConfigWithOptions<InitializedType>
|
1199
|
+
extends DataField.ToInputConfigWithOptions<InitializedType>,
|
1200
|
+
_ToInputConfig<InitializedType> {}
|
1201
|
+
|
1202
|
+
type ToInputConfig<InitializedType, Choices extends NumberField.Choices | undefined> =
|
1203
|
+
| _ToInputConfig<InitializedType>
|
1204
|
+
| ToInputConfigWithChoices<InitializedType, Choices>
|
1205
|
+
| ToInputConfigWithOptions<InitializedType>;
|
1206
|
+
}
|
1207
|
+
|
1208
|
+
declare global {
|
1209
|
+
interface StringFieldOptions extends DataFieldOptions<string> {
|
1210
|
+
/**
|
1211
|
+
* Is the string allowed to be blank (empty)?
|
1212
|
+
* @defaultValue `true`
|
1213
|
+
*/
|
1214
|
+
blank?: boolean | undefined;
|
1215
|
+
|
1216
|
+
/**
|
1217
|
+
* Should any provided string be trimmed as part of cleaning?
|
1218
|
+
* @defaultValue `true`
|
1219
|
+
*/
|
1220
|
+
trim?: boolean | undefined;
|
1221
|
+
|
1222
|
+
/**
|
1223
|
+
* An array of values or an object of values/labels which represent
|
1224
|
+
* allowed choices for the field. A function may be provided which dynamically
|
1225
|
+
* returns the array of choices.
|
1226
|
+
* @defaultValue `undefined`
|
1227
|
+
*/
|
1228
|
+
choices?: StringField.Choices | undefined;
|
1229
|
+
|
1230
|
+
/**
|
1231
|
+
* @defaultValue `false`
|
1232
|
+
*/
|
1233
|
+
textSearch?: boolean | undefined;
|
1234
|
+
}
|
1235
|
+
}
|
1236
|
+
|
1237
|
+
/**
|
1238
|
+
* A subclass of [DataField]{@link DataField} which deals with string-typed data.
|
1239
|
+
* @typeParam Options - the options of the StringField instance
|
1240
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the StringField
|
1241
|
+
* @typeParam InitializedType - the type of the initialized values of the StringField
|
1242
|
+
* @typeParam PersistedType - the type of the persisted values of the StringField
|
1243
|
+
* @remarks
|
1244
|
+
* Defaults:
|
1245
|
+
* AssignmentType: `string | null | undefined`
|
1246
|
+
* InitializedType: `string`
|
1247
|
+
* PersistedType: `string`
|
1248
|
+
* InitialValue: `""`
|
1249
|
+
*/
|
1250
|
+
declare class StringField<
|
1251
|
+
const Options extends StringFieldOptions = StringField.DefaultOptions,
|
1252
|
+
const AssignmentType = StringField.AssignmentType<Options>,
|
1253
|
+
const InitializedType = StringField.InitializedType<Options>,
|
1254
|
+
const PersistedType extends string | null | undefined = StringField.InitializedType<Options>,
|
1255
|
+
> extends DataField<Options, AssignmentType, InitializedType, PersistedType> {
|
1256
|
+
/**
|
1257
|
+
* @param options - Options which configure the behavior of the field
|
1258
|
+
*/
|
1259
|
+
constructor(options?: Options, context?: DataField.Context);
|
1260
|
+
|
1261
|
+
/** @defaultValue `undefined` */
|
1262
|
+
override initial: DataFieldOptions.InitialType<InitializedType>;
|
1263
|
+
|
1264
|
+
/**
|
1265
|
+
* Is the string allowed to be blank (empty)?
|
1266
|
+
* @defaultValue `true`
|
1267
|
+
*/
|
1268
|
+
blank: boolean;
|
1269
|
+
|
1270
|
+
/**
|
1271
|
+
* Should any provided string be trimmed as part of cleaning?
|
1272
|
+
* @defaultValue `true`
|
1273
|
+
*/
|
1274
|
+
trim: boolean;
|
1275
|
+
|
1276
|
+
/** @defaultValue `false` */
|
1277
|
+
override nullable: boolean;
|
1278
|
+
|
1279
|
+
/**
|
1280
|
+
* An array of values or an object of values/labels which represent
|
1281
|
+
* allowed choices for the field. A function may be provided which dynamically
|
1282
|
+
* returns the array of choices.
|
1283
|
+
* @defaultValue `undefined`
|
1284
|
+
*/
|
1285
|
+
choices: string[] | Record<string, string> | (() => string[] | Record<string, string>) | undefined;
|
1286
|
+
|
1287
|
+
/** @defaultValue `false` */
|
1288
|
+
textSearch: boolean;
|
1289
|
+
|
1290
|
+
protected static override get _defaults(): StringFieldOptions;
|
1291
|
+
|
1292
|
+
override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
|
1293
|
+
|
1294
|
+
protected override _cast(value: AssignmentType): InitializedType;
|
1295
|
+
|
1296
|
+
protected override _validateSpecial(value: AssignmentType): boolean | void;
|
1297
|
+
|
1298
|
+
protected override _validateType(
|
1299
|
+
value: InitializedType,
|
1300
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
1301
|
+
): boolean | DataModelValidationFailure | void;
|
1302
|
+
|
1303
|
+
/**
|
1304
|
+
* Test whether a provided value is a valid choice from the allowed choice set
|
1305
|
+
* @param value - The provided value
|
1306
|
+
* @returns Is the choice valid?
|
1307
|
+
*/
|
1308
|
+
protected _isValidChoice(value: AssignmentType): boolean;
|
1309
|
+
|
1310
|
+
/**
|
1311
|
+
* Get a record of eligible choices for the field.
|
1312
|
+
*/
|
1313
|
+
static _getChoices(options?: StringField.GetChoicesOptions): FormSelectOption[];
|
1314
|
+
|
1315
|
+
// These verbose overloads are because otherwise there would be a misleading errors about `choices` being required without mentioning `options` or vice versa.
|
1316
|
+
toFormGroup(
|
1317
|
+
groupConfig?: DataField.GroupConfig,
|
1318
|
+
inputConfig?: DataField.ToInputConfig<InitializedType> | DataField.ToInputConfigWithOptions<InitializedType>,
|
1319
|
+
): HTMLDivElement;
|
1320
|
+
toFormGroup(
|
1321
|
+
groupConfig?: DataField.GroupConfig,
|
1322
|
+
inputConfig?: DataField.ToInputConfigWithChoices<InitializedType, Options["choices"]>,
|
1323
|
+
): HTMLDivElement;
|
1324
|
+
|
1325
|
+
toInput(
|
1326
|
+
config?: DataField.ToInputConfig<InitializedType> | DataField.ToInputConfigWithOptions<InitializedType>,
|
1327
|
+
): HTMLElement | HTMLCollection;
|
1328
|
+
toInput(
|
1329
|
+
config?: DataField.ToInputConfigWithChoices<InitializedType, Options["choices"]>,
|
1330
|
+
): HTMLElement | HTMLCollection;
|
1331
|
+
|
1332
|
+
protected override _toInput(
|
1333
|
+
config: DataField.ToInputConfig<InitializedType> | DataField.ToInputConfigWithOptions<InitializedType>,
|
1334
|
+
): HTMLElement | HTMLCollection;
|
1335
|
+
protected override _toInput(
|
1336
|
+
config: DataField.ToInputConfigWithChoices<InitializedType, Options["choices"]>,
|
1337
|
+
): HTMLElement | HTMLCollection;
|
1338
|
+
}
|
1339
|
+
|
1340
|
+
declare namespace StringField {
|
1341
|
+
/** The type of the default options for the {@link StringField} class. */
|
1342
|
+
type DefaultOptions = SimpleMerge<
|
1343
|
+
DataField.DefaultOptions,
|
1344
|
+
{
|
1345
|
+
initial: string;
|
1346
|
+
blank: true;
|
1347
|
+
trim: true;
|
1348
|
+
nullable: false;
|
1349
|
+
choices: undefined;
|
1350
|
+
}
|
1351
|
+
>;
|
1352
|
+
|
1353
|
+
/** The type of the default options for the {@link StringField} class when choices are provided. */
|
1354
|
+
type DefaultOptionsWhenChoicesProvided = SimpleMerge<DefaultOptions, { nullable: false; blank: false }>;
|
1355
|
+
|
1356
|
+
/**
|
1357
|
+
* A helper type for the given options type merged into the default options of the StringField class.
|
1358
|
+
* @typeParam Options - the options that override the default options
|
1359
|
+
*/
|
1360
|
+
type MergedOptions<Options extends StringFieldOptions> = SimpleMerge<
|
1361
|
+
_OptionsForInitial<_OptionsForChoices<Options["choices"]>>,
|
1362
|
+
Options
|
1363
|
+
>;
|
1364
|
+
|
1365
|
+
type _OptionsForChoices<Choices extends StringFieldOptions["choices"]> = undefined extends Choices
|
1366
|
+
? DefaultOptions
|
1367
|
+
: DefaultOptionsWhenChoicesProvided;
|
1368
|
+
|
1369
|
+
// FIXME: `"initial" extends keyof Options` does not work for modeling `"initial" in options`.
|
1370
|
+
type _OptionsForInitial<Options extends StringFieldOptions> = "initial" extends keyof Options
|
1371
|
+
? Options
|
1372
|
+
: SimpleMerge<Options, { initial: _InitialForOptions<Options> }>;
|
1373
|
+
|
1374
|
+
type _InitialForOptions<Options extends StringFieldOptions> = Options["required"] extends false | undefined
|
1375
|
+
? undefined
|
1376
|
+
: Options["blank"] extends true
|
1377
|
+
? string
|
1378
|
+
: Options["nullable"] extends true
|
1379
|
+
? null
|
1380
|
+
: undefined;
|
1381
|
+
|
1382
|
+
// choices?: string[] | Record<string, string> | (() => string[] | Record<string, string>) | undefined;
|
1383
|
+
|
1384
|
+
type ValidChoice<Options extends StringFieldOptions> = Options["choices"] extends undefined
|
1385
|
+
? string
|
1386
|
+
: Options["choices"] extends (...args: any) => infer Choices
|
1387
|
+
? FixedChoice<Choices>
|
1388
|
+
: FixedChoice<Options["choices"]>;
|
1389
|
+
|
1390
|
+
type FixedChoice<Choices> = Choices extends Array<infer U> ? U : Choices extends Record<infer K, any> ? K : string;
|
1391
|
+
|
1392
|
+
/**
|
1393
|
+
* A shorthand for the assignment type of a StringField class.
|
1394
|
+
* @typeParam Options - the options that override the default options
|
1395
|
+
*/
|
1396
|
+
type AssignmentType<Options extends StringFieldOptions> = DataField.DerivedAssignmentType<
|
1397
|
+
ValidChoice<Options>,
|
1398
|
+
MergedOptions<Options>
|
1399
|
+
>;
|
1400
|
+
|
1401
|
+
/**
|
1402
|
+
* A shorthand for the initialized type of a StringField class.
|
1403
|
+
* @typeParam Options - the options that override the default options
|
1404
|
+
*/
|
1405
|
+
type InitializedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
|
1406
|
+
// TODO(LukeAbby): This is a workaround for how `ValidChoice` is defined ignorant of the `StringField`/`NumberField` divide.
|
1407
|
+
ValidChoice<Options> & (string | null | undefined),
|
1408
|
+
MergedOptions<Options>
|
1409
|
+
>;
|
1410
|
+
|
1411
|
+
type BaseChoices =
|
1412
|
+
| {
|
1413
|
+
readonly [K: string]: string;
|
1414
|
+
}
|
1415
|
+
| readonly string[];
|
1416
|
+
|
1417
|
+
type Choices = BaseChoices | (() => BaseChoices);
|
1418
|
+
|
1419
|
+
/**
|
1420
|
+
* @internal
|
1421
|
+
*/
|
1422
|
+
interface _GetChoicesOptions {
|
1423
|
+
/**
|
1424
|
+
* The property in the choice object values to use as the option label.
|
1425
|
+
* @defaultValue `"label"`
|
1426
|
+
*/
|
1427
|
+
labelAttr: string;
|
1428
|
+
|
1429
|
+
valueAttr: string;
|
1430
|
+
|
1431
|
+
/**
|
1432
|
+
* Pass each label through string localization?
|
1433
|
+
*
|
1434
|
+
* @defaultValue `false`
|
1435
|
+
*/
|
1436
|
+
localize: boolean;
|
1437
|
+
}
|
1438
|
+
|
1439
|
+
// Note: This usage of `InexactPartial` is correct over `NonNullish` because
|
1440
|
+
// Foundry writes `static _getChoices({choices, labelAttr="label", valueAttr, localize=false}={})`.
|
1441
|
+
interface GetChoicesOptions extends InexactPartial<_GetChoicesOptions> {
|
1442
|
+
choices: { readonly [K: string]: string } | { readonly [K: number]: string } | ReadonlyArray<number | string>;
|
1443
|
+
}
|
1444
|
+
}
|
1445
|
+
|
1446
|
+
/**
|
1447
|
+
* A subclass of [DataField]{@link DataField} which deals with object-typed data.
|
1448
|
+
* @typeParam Options - the options of the ObjectField instance
|
1449
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the ObjectField
|
1450
|
+
* @typeParam InitializedType - the type of the initialized values of the ObjectField
|
1451
|
+
* @typeParam PersistedType - the type of the persisted values of the ObjectField
|
1452
|
+
* @remarks
|
1453
|
+
* Defaults:
|
1454
|
+
* AssignmentType: `object | null | undefined`
|
1455
|
+
* InitializedType: `object`
|
1456
|
+
* PersistedType: `object`
|
1457
|
+
* InitialValue: `{}`
|
1458
|
+
*/
|
1459
|
+
declare class ObjectField<
|
1460
|
+
const Options extends DataFieldOptions<AnyObject> = ObjectField.DefaultOptions,
|
1461
|
+
const AssignmentType = ObjectField.AssignmentType<Options>,
|
1462
|
+
const InitializedType = ObjectField.InitializedType<Options>,
|
1463
|
+
const PersistedType extends AnyObject | null | undefined = ObjectField.InitializedType<Options>,
|
1464
|
+
> extends DataField<Options, AssignmentType, InitializedType, PersistedType> {
|
1465
|
+
/** @defaultValue `true` */
|
1466
|
+
override required: boolean;
|
1467
|
+
|
1468
|
+
/** @defaultValue `false` */
|
1469
|
+
override nullable: boolean;
|
1470
|
+
|
1471
|
+
/** @defaultValue `() => ({})` */
|
1472
|
+
override initial: DataFieldOptions.InitialType<InitializedType>;
|
1473
|
+
|
1474
|
+
protected static override get _defaults(): DataFieldOptions<AnyObject>;
|
1475
|
+
|
1476
|
+
protected override _cast(value: AssignmentType): InitializedType;
|
1477
|
+
|
1478
|
+
override initialize(
|
1479
|
+
value: PersistedType,
|
1480
|
+
model: DataModel.Any,
|
1481
|
+
options?: AnyObject,
|
1482
|
+
): InitializedType | (() => InitializedType | null);
|
1483
|
+
|
1484
|
+
override toObject(value: InitializedType): PersistedType;
|
1485
|
+
|
1486
|
+
protected override _validateType(
|
1487
|
+
value: InitializedType,
|
1488
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
1489
|
+
): boolean | DataModelValidationFailure | void;
|
1490
|
+
}
|
1491
|
+
|
1492
|
+
declare namespace ObjectField {
|
1493
|
+
/** The type of the default options for the {@link ObjectField} class. */
|
1494
|
+
type DefaultOptions = SimpleMerge<
|
1495
|
+
DataField.DefaultOptions,
|
1496
|
+
{
|
1497
|
+
required: true;
|
1498
|
+
nullable: false;
|
1499
|
+
}
|
1500
|
+
>;
|
1501
|
+
|
1502
|
+
/**
|
1503
|
+
* A helper type for the given options type merged into the default options of the ObjectField class.
|
1504
|
+
* @typeParam Options - the options that override the default options
|
1505
|
+
*/
|
1506
|
+
type MergedOptions<Options extends DataFieldOptions<AnyObject>> = SimpleMerge<DefaultOptions, Options>;
|
1507
|
+
|
1508
|
+
/**
|
1509
|
+
* A shorthand for the assignment type of a ObjectField class.
|
1510
|
+
* @typeParam Options - the options that override the default options
|
1511
|
+
*/
|
1512
|
+
type AssignmentType<Options extends DataFieldOptions<AnyObject>> = DataField.DerivedAssignmentType<
|
1513
|
+
AnyObject,
|
1514
|
+
MergedOptions<Options>
|
1515
|
+
>;
|
1516
|
+
|
1517
|
+
/**
|
1518
|
+
* A shorthand for the initialized type of a ObjectField class.
|
1519
|
+
* @typeParam Options - the options that override the default options
|
1520
|
+
*/
|
1521
|
+
type InitializedType<Options extends DataFieldOptions<AnyObject>> = DataField.DerivedInitializedType<
|
1522
|
+
AnyObject,
|
1523
|
+
MergedOptions<Options>
|
1524
|
+
>;
|
1525
|
+
|
1526
|
+
/**
|
1527
|
+
* A helper to create a flags object field for the given key in the {@link FlagConfig}.
|
1528
|
+
* @typeParam Key - the key to look for in the FlagConfig
|
1529
|
+
* @typeParam ExtensionFlags - additional flags besides the ones configured for the class
|
1530
|
+
* @typeParam Options - the options of the field
|
1531
|
+
*/
|
1532
|
+
type FlagsField<
|
1533
|
+
Name extends Document.Type,
|
1534
|
+
// The type `{}` is useful here because in an intersection it reduces down to nothing unlike `EmptyObject`.
|
1535
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
1536
|
+
ExtensionFlags extends AnyObject = {},
|
1537
|
+
Options extends DataFieldOptions.Any = ObjectField.DefaultOptions,
|
1538
|
+
> = ObjectField<
|
1539
|
+
Options,
|
1540
|
+
DataField.DerivedAssignmentType<Document.ConfiguredFlagsForName<Name> & ExtensionFlags, MergedOptions<Options>>,
|
1541
|
+
DataField.DerivedInitializedType<Document.ConfiguredFlagsForName<Name> & ExtensionFlags, MergedOptions<Options>>,
|
1542
|
+
DataField.DerivedInitializedType<Document.ConfiguredFlagsForName<Name> & ExtensionFlags, MergedOptions<Options>>
|
1543
|
+
>;
|
1544
|
+
}
|
1545
|
+
|
1546
|
+
/**
|
1547
|
+
* A subclass of [DataField]{@link DataField} which deals with array-typed data.
|
1548
|
+
* @typeParam ElementFieldType - the field type for the elements in the ArrayField
|
1549
|
+
* @typeParam AssignmentElementType - the assignment type for the elements in the array
|
1550
|
+
* @typeParam InitializedElementType - the initialized type for the elements in the array
|
1551
|
+
* @typeParam Options - the options of the ArrayField instance
|
1552
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the ArrayField
|
1553
|
+
* @typeParam InitializedType - the type of the initialized values of the ArrayField
|
1554
|
+
* @typeParam PersistedElementType - the persisted type for the elements in the array
|
1555
|
+
* @typeParam PersistedType - the type of the persisted values of the ArrayField
|
1556
|
+
* @remarks
|
1557
|
+
* Defaults:
|
1558
|
+
* AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
|
1559
|
+
* InitializedType: `InitializedElementType[]`
|
1560
|
+
* PersistedType: `PersistedElementType[]`
|
1561
|
+
* InitialValue: `[]`
|
1562
|
+
*/
|
1563
|
+
declare class ArrayField<
|
1564
|
+
const ElementFieldType extends DataField.Any | Document.AnyConstructor,
|
1565
|
+
const AssignmentElementType = ArrayField.AssignmentElementType<ElementFieldType>,
|
1566
|
+
const InitializedElementType = ArrayField.InitializedElementType<ElementFieldType>,
|
1567
|
+
const Options extends ArrayField.Options<AssignmentElementType> = ArrayField.DefaultOptions<AssignmentElementType>,
|
1568
|
+
const AssignmentType = ArrayField.AssignmentType<AssignmentElementType, Options>,
|
1569
|
+
const InitializedType = ArrayField.InitializedType<AssignmentElementType, InitializedElementType, Options>,
|
1570
|
+
const PersistedElementType = ArrayField.PersistedElementType<ElementFieldType>,
|
1571
|
+
const PersistedType extends PersistedElementType[] | null | undefined = ArrayField.PersistedType<
|
1572
|
+
AssignmentElementType,
|
1573
|
+
PersistedElementType,
|
1574
|
+
Options
|
1575
|
+
>,
|
1576
|
+
> extends DataField<Options, AssignmentType, InitializedType, PersistedType> {
|
1577
|
+
/**
|
1578
|
+
* @param element - A DataField instance which defines the type of element contained in the Array.
|
1579
|
+
* @param options - Options which configure the behavior of the field
|
1580
|
+
*/
|
1581
|
+
constructor(element: ElementFieldType, options?: Options, context?: DataField.Context);
|
1582
|
+
|
1583
|
+
/** @defaultValue `true` */
|
1584
|
+
override required: boolean;
|
1585
|
+
|
1586
|
+
/** @defaultValue `false` */
|
1587
|
+
override nullable: boolean;
|
1588
|
+
|
1589
|
+
/** @defaultValue `() => []` */
|
1590
|
+
override initial: DataFieldOptions.InitialType<InitializedType>;
|
1591
|
+
|
1592
|
+
/**
|
1593
|
+
* The data type of each element in this array
|
1594
|
+
*/
|
1595
|
+
element: ElementFieldType;
|
1596
|
+
|
1597
|
+
protected static override get _defaults(): ArrayField.Options<
|
1598
|
+
ArrayField.AssignmentElementType<DataField.Any | Document.AnyConstructor>
|
1599
|
+
>;
|
1600
|
+
|
1601
|
+
/** @defaultValue `true` */
|
1602
|
+
static override recursive: boolean;
|
1603
|
+
|
1604
|
+
/**
|
1605
|
+
* Validate the contained element type of the ArrayField
|
1606
|
+
* @param element - The type of Array element
|
1607
|
+
* @returns The validated element type
|
1608
|
+
* @throws An error if the element is not a valid type
|
1609
|
+
*/
|
1610
|
+
protected static _validateElementType<T extends DataField.Any>(element: T): T;
|
1611
|
+
|
1612
|
+
protected override _validateModel(data: AnyObject, options?: AnyObject): void;
|
1613
|
+
|
1614
|
+
protected override _cast(value: AssignmentType): InitializedType;
|
1615
|
+
|
1616
|
+
protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
|
1617
|
+
|
1618
|
+
protected override _validateType(
|
1619
|
+
value: InitializedType,
|
1620
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
1621
|
+
): boolean | DataModelValidationFailure | void;
|
1622
|
+
|
1623
|
+
/**
|
1624
|
+
* Validate every element of the ArrayField
|
1625
|
+
* @param value - The array to validate
|
1626
|
+
* @param options - Validation options
|
1627
|
+
* @returns An array of element-specific errors
|
1628
|
+
*/
|
1629
|
+
protected _validateElements(
|
1630
|
+
value: any[],
|
1631
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
1632
|
+
): DataModelValidationFailure | void;
|
1633
|
+
|
1634
|
+
/**
|
1635
|
+
* Validate a single element of the ArrayField.
|
1636
|
+
* @param value - The value of the array element
|
1637
|
+
* @param options - Validation options
|
1638
|
+
* @returns A validation failure if the element failed validation
|
1639
|
+
*/
|
1640
|
+
protected _validateElement(
|
1641
|
+
value: any,
|
1642
|
+
options: DataField.ValidationOptions<DataField.Any>,
|
1643
|
+
): DataModelValidationFailure | void;
|
1644
|
+
|
1645
|
+
override initialize(
|
1646
|
+
value: PersistedType,
|
1647
|
+
model: DataModel.Any,
|
1648
|
+
options?: AnyObject,
|
1649
|
+
): InitializedType | (() => InitializedType | null);
|
1650
|
+
|
1651
|
+
override toObject(value: InitializedType): PersistedType;
|
1652
|
+
|
1653
|
+
// TODO: Limit to the keys of `this` that are actually callable.
|
1654
|
+
override apply<Value, Options, Return>(
|
1655
|
+
fn: keyof this | ((this: this, value: Value, options: Options) => Return),
|
1656
|
+
value: Value,
|
1657
|
+
options?: Options,
|
1658
|
+
): Return;
|
1659
|
+
|
1660
|
+
protected override _getField(path: string[]): unknown;
|
1661
|
+
|
1662
|
+
/**
|
1663
|
+
* Migrate this field's candidate source data.
|
1664
|
+
* @param sourceData - Candidate source data of the root model
|
1665
|
+
* @param fieldData - The value of this field within the source data
|
1666
|
+
*/
|
1667
|
+
migrateSource(sourceData: AnyObject, fieldData: unknown): unknown;
|
1668
|
+
}
|
1669
|
+
|
1670
|
+
declare namespace ArrayField {
|
1671
|
+
/**
|
1672
|
+
* A shorthand for the options of an ArrayField class.
|
1673
|
+
* @typeParam AssignmentElementType - the assignment type of the elements in the array
|
1674
|
+
*/
|
1675
|
+
type Options<AssignmentElementType> = DataFieldOptions<BaseAssignmentType<AssignmentElementType>>;
|
1676
|
+
|
1677
|
+
/**
|
1678
|
+
* The base assignment type for the {@link ArrayField} class.
|
1679
|
+
* @typeParam AssignmentElementType - the assignment type of the elements in the array
|
1680
|
+
*/
|
1681
|
+
type BaseAssignmentType<AssignmentElementType> =
|
1682
|
+
| Record<number | string, AssignmentElementType>
|
1683
|
+
| Iterable<AssignmentElementType>
|
1684
|
+
| AssignmentElementType[]
|
1685
|
+
| AssignmentElementType;
|
1686
|
+
|
1687
|
+
/**
|
1688
|
+
* The type of the default options for the {@link ArrayField} class.
|
1689
|
+
* @typeParam AssignmentElementType - the assignment type of the elements in the array
|
1690
|
+
*/
|
1691
|
+
type DefaultOptions<AssignmentElementType> = SimpleMerge<
|
1692
|
+
DataField.DefaultOptions,
|
1693
|
+
{
|
1694
|
+
required: true;
|
1695
|
+
nullable: false;
|
1696
|
+
initial: () => AssignmentElementType[];
|
1697
|
+
}
|
1698
|
+
>;
|
1699
|
+
|
1700
|
+
/**
|
1701
|
+
* A helper type for the given options type merged into the default options of the ArrayField class.
|
1702
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the ArrayField
|
1703
|
+
* @typeParam Opts - the options that override the default options
|
1704
|
+
*/
|
1705
|
+
type MergedOptions<AssignmentElementType, Opts extends Options<AssignmentElementType>> = SimpleMerge<
|
1706
|
+
DefaultOptions<AssignmentElementType>,
|
1707
|
+
Opts
|
1708
|
+
>;
|
1709
|
+
|
1710
|
+
/**
|
1711
|
+
* A type to infer the assignment element type of an ArrayField from its ElementFieldType.
|
1712
|
+
* @typeParam ElementFieldType - the DataField type of the elements in the ArrayField
|
1713
|
+
*/
|
1714
|
+
type AssignmentElementType<ElementFieldType extends DataField.Any | Document.AnyConstructor> =
|
1715
|
+
ElementFieldType extends DataField<any, infer Assign, any, any>
|
1716
|
+
? Assign
|
1717
|
+
: ElementFieldType extends new (...args: any[]) => Document<any, infer Schema extends DataSchema, any>
|
1718
|
+
? SchemaField.InnerAssignmentType<Schema>
|
1719
|
+
: never;
|
1720
|
+
|
1721
|
+
/**
|
1722
|
+
* A type to infer the initialized element type of an ArrayField from its ElementFieldType.
|
1723
|
+
* @typeParam ElementFieldType - the DataField type of the elements in the ArrayField
|
1724
|
+
*/
|
1725
|
+
type InitializedElementType<ElementFieldType extends DataField.Any | Document.AnyConstructor> =
|
1726
|
+
ElementFieldType extends DataField<any, any, infer Init, any>
|
1727
|
+
? Init
|
1728
|
+
: ElementFieldType extends new (...args: any[]) => Document<any, infer Schema extends DataSchema, any>
|
1729
|
+
? SchemaField.InnerInitializedType<Schema>
|
1730
|
+
: never;
|
1731
|
+
|
1732
|
+
/**
|
1733
|
+
* A type to infer the initialized element type of an ArrayField from its ElementFieldType.
|
1734
|
+
* @typeParam ElementFieldType - the DataField type of the elements in the ArrayField
|
1735
|
+
*/
|
1736
|
+
type PersistedElementType<ElementFieldType extends DataField.Any | Document.AnyConstructor> =
|
1737
|
+
ElementFieldType extends DataField<any, any, any, infer Persist>
|
1738
|
+
? Persist
|
1739
|
+
: ElementFieldType extends new (...args: any[]) => Document<any, infer Schema extends DataSchema, any>
|
1740
|
+
? SchemaField.InnerPersistedType<Schema>
|
1741
|
+
: never;
|
1742
|
+
|
1743
|
+
/**
|
1744
|
+
* A shorthand for the assignment type of an ArrayField class.
|
1745
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the ArrayField
|
1746
|
+
* @typeParam Opts - the options that override the default options
|
1747
|
+
*/
|
1748
|
+
type AssignmentType<
|
1749
|
+
AssignmentElementType,
|
1750
|
+
Opts extends Options<AssignmentElementType>,
|
1751
|
+
> = DataField.DerivedAssignmentType<
|
1752
|
+
BaseAssignmentType<AssignmentElementType>,
|
1753
|
+
MergedOptions<AssignmentElementType, Opts>
|
1754
|
+
>;
|
1755
|
+
|
1756
|
+
/**
|
1757
|
+
* A shorthand for the initialized type of an ArrayField class.
|
1758
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the ArrayField
|
1759
|
+
* @typeParam InitializedElementType - the initialized type of the elements of the ArrayField
|
1760
|
+
* @typeParam Opts - the options that override the default options
|
1761
|
+
*/
|
1762
|
+
type InitializedType<
|
1763
|
+
AssignmentElementType,
|
1764
|
+
InitializedElementType,
|
1765
|
+
Opts extends Options<AssignmentElementType>,
|
1766
|
+
> = DataField.DerivedInitializedType<InitializedElementType[], MergedOptions<AssignmentElementType, Opts>>;
|
1767
|
+
|
1768
|
+
/**
|
1769
|
+
* A shorthand for the persisted type of an ArrayField class.
|
1770
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the ArrayField
|
1771
|
+
* @typeParam PersistedElementType - the perssited type of the elements of the ArrayField
|
1772
|
+
* @typeParam Opts - the options that override the default options
|
1773
|
+
*/
|
1774
|
+
type PersistedType<
|
1775
|
+
AssignmentElementType,
|
1776
|
+
PersistedElementType,
|
1777
|
+
Opts extends Options<AssignmentElementType>,
|
1778
|
+
> = DataField.DerivedInitializedType<PersistedElementType[], MergedOptions<AssignmentElementType, Opts>>;
|
1779
|
+
}
|
1780
|
+
|
1781
|
+
/**
|
1782
|
+
* A subclass of [ArrayField]{@link ArrayField} which supports a set of contained elements.
|
1783
|
+
* Elements in this set are treated as fungible and may be represented in any order or discarded if invalid.
|
1784
|
+
* @typeParam ElementFieldType - the field type for the elements in the SetField
|
1785
|
+
* @typeParam AssignmentElementType - the assignment type for the elements in the set
|
1786
|
+
* @typeParam InitializedElementType - the initialized type for the elements in the set
|
1787
|
+
* @typeParam Options - the options of the SetField instance
|
1788
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the SetField
|
1789
|
+
* @typeParam InitializedType - the type of the initialized values of the SetField
|
1790
|
+
* @typeParam PersistedElementType - the persisted type for the elements in the set
|
1791
|
+
* @typeParam PersistedType - the type of the persisted values of the SetField
|
1792
|
+
* @remarks
|
1793
|
+
* Defaults:
|
1794
|
+
* AssignmentType: `SetField.BaseAssignmentType<AssignmentElementType> | null | undefined`
|
1795
|
+
* InitializedType: `Set<InitializedElementType>`
|
1796
|
+
* PersistedType: `PersistedElementType[]`
|
1797
|
+
* InitialValue: `new Set()`
|
1798
|
+
*/
|
1799
|
+
declare class SetField<
|
1800
|
+
ElementFieldType extends DataField.Any,
|
1801
|
+
AssignmentElementType = ArrayField.AssignmentElementType<ElementFieldType>,
|
1802
|
+
InitializedElementType = ArrayField.InitializedElementType<ElementFieldType>,
|
1803
|
+
Options extends SetField.Options<AssignmentElementType> = SetField.DefaultOptions<AssignmentElementType>,
|
1804
|
+
AssignmentType = SetField.AssignmentType<AssignmentElementType, Options>,
|
1805
|
+
InitializedType = SetField.InitializedType<AssignmentElementType, InitializedElementType, Options>,
|
1806
|
+
PersistedElementType = ArrayField.PersistedElementType<ElementFieldType>,
|
1807
|
+
PersistedType extends PersistedElementType[] | null | undefined = SetField.PersistedType<
|
1808
|
+
AssignmentElementType,
|
1809
|
+
PersistedElementType,
|
1810
|
+
Options
|
1811
|
+
>,
|
1812
|
+
> extends ArrayField<
|
1813
|
+
ElementFieldType,
|
1814
|
+
AssignmentElementType,
|
1815
|
+
InitializedElementType,
|
1816
|
+
Options,
|
1817
|
+
AssignmentType,
|
1818
|
+
InitializedType,
|
1819
|
+
PersistedElementType,
|
1820
|
+
PersistedType
|
1821
|
+
> {
|
1822
|
+
protected override _validateElements(
|
1823
|
+
value: any[],
|
1824
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
1825
|
+
): void | DataModelValidationFailure;
|
1826
|
+
|
1827
|
+
override initialize(
|
1828
|
+
value: PersistedType,
|
1829
|
+
model: DataModel.Any,
|
1830
|
+
options?: AnyObject,
|
1831
|
+
): InitializedType | (() => InitializedType | null);
|
1832
|
+
|
1833
|
+
override toObject(value: InitializedType): PersistedType;
|
1834
|
+
|
1835
|
+
toFormGroup(
|
1836
|
+
groupConfig?: DataField.GroupConfig,
|
1837
|
+
inputConfig?: SetField.ToInputConfig<ElementFieldType, InitializedType>,
|
1838
|
+
): HTMLDivElement;
|
1839
|
+
|
1840
|
+
toInput(config?: SetField.ToInputConfig<ElementFieldType, InitializedType>): HTMLElement | HTMLCollection;
|
1841
|
+
|
1842
|
+
protected override _toInput(
|
1843
|
+
config: SetField.ToInputConfig<ElementFieldType, InitializedType>,
|
1844
|
+
): HTMLElement | HTMLCollection;
|
1845
|
+
}
|
1846
|
+
|
1847
|
+
declare namespace SetField {
|
1848
|
+
/** Any SetField */
|
1849
|
+
type Any = SetField<DataField.Any, any, any, any, any, any, any, any>;
|
1850
|
+
|
1851
|
+
/**
|
1852
|
+
* A shorthand for the options of a SetField class.
|
1853
|
+
* @typeParam AssignmentElementType - the assignment type of the elements in the array
|
1854
|
+
*/
|
1855
|
+
type Options<AssignmentElementType> = DataFieldOptions<SetField.BaseAssignmentType<AssignmentElementType>>;
|
1856
|
+
|
1857
|
+
/**
|
1858
|
+
* The base assignment type for the {@link SetField} class.
|
1859
|
+
* @typeParam AssignmentElementType - the assignment type of the elements in the array
|
1860
|
+
*/
|
1861
|
+
type BaseAssignmentType<AssignmentElementType> = ArrayField.BaseAssignmentType<AssignmentElementType>;
|
1862
|
+
|
1863
|
+
/**
|
1864
|
+
* The type of the default options for the {@link SetField} class.
|
1865
|
+
* @typeParam AssignmentElementType - the assignment type of the elements in the array
|
1866
|
+
*/
|
1867
|
+
type DefaultOptions<AssignmentElementType> = ArrayField.DefaultOptions<AssignmentElementType>;
|
1868
|
+
|
1869
|
+
/**
|
1870
|
+
* A helper type for the given options type merged into the default options of the SetField class.
|
1871
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the SetField
|
1872
|
+
* @typeParam Opts - the options that override the default options
|
1873
|
+
*/
|
1874
|
+
type MergedOptions<AssignmentElementType, Opts extends Options<AssignmentElementType>> = SimpleMerge<
|
1875
|
+
DefaultOptions<AssignmentElementType>,
|
1876
|
+
Opts
|
1877
|
+
>;
|
1878
|
+
|
1879
|
+
/**
|
1880
|
+
* A shorthand for the assignment type of a SetField class.
|
1881
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the SetField
|
1882
|
+
* @typeParam Opts - the options that override the default options
|
1883
|
+
*/
|
1884
|
+
type AssignmentType<
|
1885
|
+
AssignmentElementType,
|
1886
|
+
Opts extends Options<AssignmentElementType>,
|
1887
|
+
> = DataField.DerivedAssignmentType<
|
1888
|
+
BaseAssignmentType<AssignmentElementType>,
|
1889
|
+
MergedOptions<AssignmentElementType, Opts>
|
1890
|
+
>;
|
1891
|
+
|
1892
|
+
/**
|
1893
|
+
* A shorthand for the initialized type of a SetField class.
|
1894
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the SetField
|
1895
|
+
* @typeParam InitializedElementType - the initialized type of the elements of the SetField
|
1896
|
+
* @typeParam Opts - the options that override the default options
|
1897
|
+
*/
|
1898
|
+
type InitializedType<
|
1899
|
+
AssignmentElementType,
|
1900
|
+
InitializedElementType,
|
1901
|
+
Opts extends Options<AssignmentElementType>,
|
1902
|
+
> = DataField.DerivedInitializedType<Set<InitializedElementType>, MergedOptions<AssignmentElementType, Opts>>;
|
1903
|
+
|
1904
|
+
/**
|
1905
|
+
* A shorthand for the persisted type of a SetField class.
|
1906
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the SetField
|
1907
|
+
* @typeParam PersistedElementType - the perssited type of the elements of the SetField
|
1908
|
+
* @typeParam Opts - the options that override the default options
|
1909
|
+
*/
|
1910
|
+
type PersistedType<
|
1911
|
+
AssignmentElementType,
|
1912
|
+
PersistedElementType,
|
1913
|
+
Opts extends Options<AssignmentElementType>,
|
1914
|
+
> = DataField.DerivedInitializedType<PersistedElementType[], MergedOptions<AssignmentElementType, Opts>>;
|
1915
|
+
|
1916
|
+
type ToInputConfig<ElementFieldType extends DataField.Any, InitializedType> = ElementFieldType extends {
|
1917
|
+
readonly choices: readonly string[];
|
1918
|
+
}
|
1919
|
+
? // If the field has `choices` then you _must_ provide options for `createMultiSelectInput`.
|
1920
|
+
DataField.ToInputConfig<InitializedType> & MultiSelectInputConfig
|
1921
|
+
: // Otherwise it's optional to provide.
|
1922
|
+
DataField.ToInputConfig<InitializedType> | (DataField.ToInputConfig<InitializedType> & MultiSelectInputConfig);
|
1923
|
+
}
|
1924
|
+
|
1925
|
+
/**
|
1926
|
+
* A subclass of [ObjectField]{@link ObjectField} which embeds some other DataModel definition as an inner object.
|
1927
|
+
* @typeParam ModelType - the DataModel for the embedded data
|
1928
|
+
* @typeParam Options - the options of the EmbeddedDataField instance
|
1929
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the EmbeddedDataField
|
1930
|
+
* @typeParam InitializedType - the type of the initialized values of the EmbeddedDataField
|
1931
|
+
* @typeParam PersistedType - the type of the persisted values of the EmbeddedDataField
|
1932
|
+
* @remarks
|
1933
|
+
* Defaults:
|
1934
|
+
* AssignmentType: `SchemaField.AssignmentType<ModelType["schema"]["fields"]> | null | undefined`
|
1935
|
+
* InitializedType: `SchemaField.InitializedType<ModelType["schema"]["fields"]>`
|
1936
|
+
* PersistedType: `SchemaField.PersistedType<ModelType["schema"]["fields"]>`
|
1937
|
+
* InitialValue: `{}`
|
1938
|
+
*/
|
1939
|
+
declare class EmbeddedDataField<
|
1940
|
+
const ModelType extends DataModel.AnyConstructor,
|
1941
|
+
const Options extends EmbeddedDataField.Options<ModelType> = EmbeddedDataField.DefaultOptions,
|
1942
|
+
const AssignmentType = EmbeddedDataField.AssignmentType<ModelType, Options>,
|
1943
|
+
const InitializedType = EmbeddedDataField.InitializedType<ModelType, Options>,
|
1944
|
+
const PersistedType extends AnyObject | null | undefined = EmbeddedDataField.PersistedType<ModelType, Options>,
|
1945
|
+
> extends SchemaField<DataModel.SchemaOfClass<ModelType>, Options, AssignmentType, InitializedType, PersistedType> {
|
1946
|
+
/**
|
1947
|
+
* @param model - The class of DataModel which should be embedded in this field
|
1948
|
+
* @param options - Options which configure the behavior of the field
|
1949
|
+
*/
|
1950
|
+
constructor(model: ModelType, options?: Options, context?: DataField.Context);
|
1951
|
+
|
1952
|
+
/**
|
1953
|
+
* The embedded DataModel definition which is contained in this field.
|
1954
|
+
*/
|
1955
|
+
model: ModelType;
|
1956
|
+
|
1957
|
+
protected override _initialize(fields: DataSchema): DataSchema;
|
1958
|
+
|
1959
|
+
override initialize(
|
1960
|
+
value: PersistedType,
|
1961
|
+
model: DataModel.Any,
|
1962
|
+
options?: AnyObject,
|
1963
|
+
): InitializedType | (() => InitializedType | null);
|
1964
|
+
|
1965
|
+
override toObject(value: InitializedType): PersistedType;
|
1966
|
+
|
1967
|
+
/**
|
1968
|
+
* Migrate this field's candidate source data.
|
1969
|
+
* @param sourceData - Candidate source data of the root model
|
1970
|
+
* @param fieldData - The value of this field within the source data
|
1971
|
+
*/
|
1972
|
+
migrateSource(sourceData: AnyObject, fieldData: unknown): unknown;
|
1973
|
+
|
1974
|
+
protected override _validateModel(data: AnyObject, options?: AnyObject): void;
|
1975
|
+
}
|
1976
|
+
|
1977
|
+
declare namespace EmbeddedDataField {
|
1978
|
+
/**
|
1979
|
+
* A shorthand for the options of an EmbeddedDataField class.
|
1980
|
+
* @typeParam ModelType - the DataModel for the embedded data
|
1981
|
+
*/
|
1982
|
+
type Options<ModelType extends DataModel.AnyConstructor> = DataFieldOptions<
|
1983
|
+
SchemaField.InnerAssignmentType<DataModel.SchemaOfClass<ModelType>> | __SchemaFieldInitial
|
1984
|
+
>;
|
1985
|
+
|
1986
|
+
/** The type of the default options for the {@link EmbeddedDataField} class. */
|
1987
|
+
type DefaultOptions = SchemaField.DefaultOptions;
|
1988
|
+
|
1989
|
+
/**
|
1990
|
+
* A helper type for the given options type merged into the default options of the EmbeddedDataField class.
|
1991
|
+
* @typeParam ModelType - the DataModel for the embedded data
|
1992
|
+
* @typeParam Opts - the options that override the default options
|
1993
|
+
*/
|
1994
|
+
type MergedOptions<ModelType extends DataModel.AnyConstructor, Opts extends Options<ModelType>> = SimpleMerge<
|
1995
|
+
DefaultOptions,
|
1996
|
+
Opts
|
1997
|
+
>;
|
1998
|
+
|
1999
|
+
/**
|
2000
|
+
* A shorthand for the assignment type of an EmbeddedDataField class.
|
2001
|
+
* @typeParam ModelType - the DataModel for the embedded data
|
2002
|
+
* @typeParam Opts - the options that override the default options
|
2003
|
+
*/
|
2004
|
+
type AssignmentType<
|
2005
|
+
ModelType extends DataModel.AnyConstructor,
|
2006
|
+
Opts extends Options<ModelType>,
|
2007
|
+
> = DataField.DerivedAssignmentType<
|
2008
|
+
SchemaField.InnerAssignmentType<DataModel.SchemaOfClass<ModelType>>,
|
2009
|
+
MergedOptions<ModelType, Opts>
|
2010
|
+
>;
|
2011
|
+
|
2012
|
+
/**
|
2013
|
+
* A shorthand for the initialized type of an EmbeddedDataField class.
|
2014
|
+
* @typeParam ModelType - the DataModel for the embedded data
|
2015
|
+
* @typeParam Opts - the options that override the default options
|
2016
|
+
*/
|
2017
|
+
// FIXME: Schema is unsure in src\foundry\common\data\data.d.mts
|
2018
|
+
type InitializedType<
|
2019
|
+
ModelType extends DataModel.AnyConstructor,
|
2020
|
+
Opts extends Options<ModelType>,
|
2021
|
+
> = DataField.DerivedInitializedType<
|
2022
|
+
SchemaField.InnerInitializedType<DataModel.SchemaOfClass<ModelType>>,
|
2023
|
+
MergedOptions<ModelType, Opts>
|
2024
|
+
>;
|
2025
|
+
|
2026
|
+
/**
|
2027
|
+
* A shorthand for the persisted type of an EmbeddedDataField class.
|
2028
|
+
* @typeParam ModelType - the DataModel for the embedded data
|
2029
|
+
* @typeParam Opts - the options that override the default options
|
2030
|
+
*/
|
2031
|
+
type PersistedType<
|
2032
|
+
ModelType extends DataModel.AnyConstructor,
|
2033
|
+
Opts extends Options<ModelType>,
|
2034
|
+
> = DataField.DerivedInitializedType<
|
2035
|
+
SchemaField.InnerPersistedType<DataModel.SchemaOfClass<ModelType>>,
|
2036
|
+
MergedOptions<ModelType, Opts>
|
2037
|
+
>;
|
2038
|
+
}
|
2039
|
+
|
2040
|
+
/**
|
2041
|
+
* A subclass of [ArrayField]{@link ArrayField} which supports an embedded Document collection.
|
2042
|
+
* Invalid elements will be dropped from the collection during validation rather than failing for the field entirely.
|
2043
|
+
* @typeParam ElementFieldType - the field type for the elements in the EmbeddedCollectionField
|
2044
|
+
* @typeParam AssignmentElementType - the assignment type for the elements in the collection
|
2045
|
+
* @typeParam InitializedElementType - the initialized type for the elements in the collection
|
2046
|
+
* @typeParam Options - the options of the EmbeddedCollectionField instance
|
2047
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the EmbeddedCollectionField
|
2048
|
+
* @typeParam InitializedType - the type of the initialized values of the EmbeddedCollectionField
|
2049
|
+
* @typeParam PersistedElementType - the persisted type for the elements in the collection
|
2050
|
+
* @typeParam PersistedType - the type of the persisted values of the EmbeddedCollectionField
|
2051
|
+
* @remarks
|
2052
|
+
* Defaults:
|
2053
|
+
* AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
|
2054
|
+
* InitializedType: `Collection<InitializedElementType>`
|
2055
|
+
* PersistedType: `PersistedElementType[]`
|
2056
|
+
* InitialValue: `[]`
|
2057
|
+
*/
|
2058
|
+
declare class EmbeddedCollectionField<
|
2059
|
+
ElementFieldType extends Document.AnyConstructor,
|
2060
|
+
ParentDataModel extends Document.Any,
|
2061
|
+
AssignmentElementType = EmbeddedCollectionField.AssignmentElementType<ElementFieldType>,
|
2062
|
+
InitializedElementType extends Document.Any = EmbeddedCollectionField.InitializedElementType<ElementFieldType>,
|
2063
|
+
Options extends
|
2064
|
+
EmbeddedCollectionField.Options<AssignmentElementType> = EmbeddedCollectionField.DefaultOptions<AssignmentElementType>,
|
2065
|
+
AssignmentType = EmbeddedCollectionField.AssignmentType<AssignmentElementType, Options>,
|
2066
|
+
InitializedType = EmbeddedCollectionField.InitializedType<
|
2067
|
+
AssignmentElementType,
|
2068
|
+
InitializedElementType,
|
2069
|
+
ParentDataModel,
|
2070
|
+
Options
|
2071
|
+
>,
|
2072
|
+
PersistedElementType = EmbeddedCollectionField.PersistedElementType<ElementFieldType>,
|
2073
|
+
PersistedType extends PersistedElementType[] | null | undefined = EmbeddedCollectionField.PersistedType<
|
2074
|
+
AssignmentElementType,
|
2075
|
+
PersistedElementType,
|
2076
|
+
Options
|
2077
|
+
>,
|
2078
|
+
> extends ArrayField<
|
2079
|
+
ElementFieldType,
|
2080
|
+
AssignmentElementType,
|
2081
|
+
InitializedElementType,
|
2082
|
+
Options,
|
2083
|
+
AssignmentType,
|
2084
|
+
InitializedType,
|
2085
|
+
PersistedElementType,
|
2086
|
+
PersistedType
|
2087
|
+
> {
|
2088
|
+
/**
|
2089
|
+
* @param element - The type of Document which belongs to this embedded collection
|
2090
|
+
* @param options - Options which configure the behavior of the field
|
2091
|
+
*/
|
2092
|
+
constructor(element: ElementFieldType, options?: Options, context?: DataField.Context);
|
2093
|
+
|
2094
|
+
/** @defaultValue `true` */
|
2095
|
+
override readonly: true;
|
2096
|
+
|
2097
|
+
protected static override _validateElementType<T extends DataField.Any | Document.AnyConstructor>(element: T): T;
|
2098
|
+
|
2099
|
+
/**
|
2100
|
+
* The Collection implementation to use when initializing the collection.
|
2101
|
+
*/
|
2102
|
+
static get implementation(): typeof EmbeddedCollection;
|
2103
|
+
|
2104
|
+
/** @defaultValue `true` */
|
2105
|
+
static override hierarchical: boolean;
|
2106
|
+
|
2107
|
+
/**
|
2108
|
+
* A reference to the DataModel subclass of the embedded document element
|
2109
|
+
*/
|
2110
|
+
get model(): Document.AnyConstructor;
|
2111
|
+
|
2112
|
+
/**
|
2113
|
+
* The DataSchema of the contained Document model.
|
2114
|
+
*/
|
2115
|
+
get schema(): this["model"]["schema"];
|
2116
|
+
|
2117
|
+
protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
|
2118
|
+
|
2119
|
+
protected override _validateElements(
|
2120
|
+
value: any[],
|
2121
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
2122
|
+
): DataModelValidationFailure | void;
|
2123
|
+
|
2124
|
+
override initialize(
|
2125
|
+
value: PersistedType,
|
2126
|
+
model: DataModel.Any,
|
2127
|
+
options?: AnyObject,
|
2128
|
+
): InitializedType | (() => InitializedType | null);
|
2129
|
+
|
2130
|
+
override toObject(value: InitializedType): PersistedType;
|
2131
|
+
|
2132
|
+
override apply<Value, Options, Return>(
|
2133
|
+
fn: keyof this | ((this: this, value: Value, options: Options) => Return),
|
2134
|
+
value: Value,
|
2135
|
+
options?: Options,
|
2136
|
+
): Return;
|
2137
|
+
|
2138
|
+
/**
|
2139
|
+
* Migrate this field's candidate source data.
|
2140
|
+
* @param sourceData - Candidate source data of the root model
|
2141
|
+
* @param fieldData - The value of this field within the source data
|
2142
|
+
*/
|
2143
|
+
migrateSource(sourceData: AnyObject, fieldData: unknown): unknown;
|
2144
|
+
|
2145
|
+
/**
|
2146
|
+
* Return the embedded document(s) as a Collection.
|
2147
|
+
* @param parent - The parent document.
|
2148
|
+
*/
|
2149
|
+
getCollection<P extends Document.Any>(parent: P): Collection<P>;
|
2150
|
+
}
|
2151
|
+
|
2152
|
+
declare namespace EmbeddedCollectionField {
|
2153
|
+
type Any = EmbeddedCollectionField<any, any, any, any, any, any, any, any, any>;
|
2154
|
+
|
2155
|
+
/**
|
2156
|
+
* A shorthand for the options of an EmbeddedCollectionField class.
|
2157
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionField
|
2158
|
+
*/
|
2159
|
+
type Options<AssignmentElementType> = DataFieldOptions<ArrayField.BaseAssignmentType<AssignmentElementType>>;
|
2160
|
+
|
2161
|
+
/**
|
2162
|
+
* The type of the default options for the {@link EmbeddedCollectionField} class.
|
2163
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionField
|
2164
|
+
*/
|
2165
|
+
type DefaultOptions<AssignmentElementType> = ArrayField.DefaultOptions<AssignmentElementType>;
|
2166
|
+
|
2167
|
+
/**
|
2168
|
+
* A helper type for the given options type merged into the default options of the EmbeddedCollectionField class.
|
2169
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionField
|
2170
|
+
* @typeParam Opts - the options that override the default options
|
2171
|
+
*/
|
2172
|
+
type MergedOptions<AssignmentElementType, Opts extends Options<AssignmentElementType>> = SimpleMerge<
|
2173
|
+
DefaultOptions<AssignmentElementType>,
|
2174
|
+
Opts
|
2175
|
+
>;
|
2176
|
+
|
2177
|
+
/**
|
2178
|
+
* A type to infer the assignment element type of an EmbeddedCollectionField from its ElementFieldType.
|
2179
|
+
* @typeParam ElementFieldType - the DataField type of the elements in the EmbeddedCollectionField
|
2180
|
+
*/
|
2181
|
+
type AssignmentElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends new (
|
2182
|
+
...args: any[]
|
2183
|
+
) => Document<any, infer Schema extends DataSchema, any>
|
2184
|
+
? SchemaField.InnerAssignmentType<Schema>
|
2185
|
+
: never;
|
2186
|
+
|
2187
|
+
/**
|
2188
|
+
* A type to infer the initialized element type of an EmbeddedCollectionField from its ElementFieldType.
|
2189
|
+
* @typeParam ElementFieldType - the DataField type of the elements in the EmbeddedCollectionField
|
2190
|
+
*/
|
2191
|
+
type InitializedElementType<ElementFieldType extends Document.AnyConstructor> =
|
2192
|
+
Document.ToConfiguredInstance<ElementFieldType>;
|
2193
|
+
|
2194
|
+
/**
|
2195
|
+
* A type to infer the initialized element type of an EmbeddedCollectionField from its ElementFieldType.
|
2196
|
+
* @typeParam ElementFieldType - the DataField type of the elements in the EmbeddedCollectionField
|
2197
|
+
*/
|
2198
|
+
type PersistedElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends new (
|
2199
|
+
...args: any[]
|
2200
|
+
) => Document<any, infer Schema extends DataSchema, any>
|
2201
|
+
? SchemaField.InnerPersistedType<Schema>
|
2202
|
+
: never;
|
2203
|
+
|
2204
|
+
/**
|
2205
|
+
* A shorthand for the assignment type of an ArrayField class.
|
2206
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionField
|
2207
|
+
* @typeParam Opts - the options that override the default options
|
2208
|
+
*/
|
2209
|
+
type AssignmentType<
|
2210
|
+
AssignmentElementType,
|
2211
|
+
Opts extends Options<AssignmentElementType>,
|
2212
|
+
> = DataField.DerivedAssignmentType<
|
2213
|
+
ArrayField.BaseAssignmentType<AssignmentElementType>,
|
2214
|
+
MergedOptions<AssignmentElementType, Opts>
|
2215
|
+
>;
|
2216
|
+
|
2217
|
+
/**
|
2218
|
+
* A shorthand for the initialized type of an ArrayField class.
|
2219
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionField
|
2220
|
+
* @typeParam InitializedElementType - the initialized type of the elements of the EmbeddedCollectionField
|
2221
|
+
* @typeParam Opts - the options that override the default options
|
2222
|
+
*/
|
2223
|
+
type InitializedType<
|
2224
|
+
AssignmentElementType,
|
2225
|
+
InitializedElementType extends Document.Internal.Instance.Any,
|
2226
|
+
ParentDataModel extends Document.Any,
|
2227
|
+
Opts extends Options<AssignmentElementType>,
|
2228
|
+
> = DataField.DerivedInitializedType<
|
2229
|
+
EmbeddedCollection<Document.Internal.Instance.Complete<InitializedElementType>, ParentDataModel>,
|
2230
|
+
MergedOptions<AssignmentElementType, Opts>
|
2231
|
+
>;
|
2232
|
+
|
2233
|
+
/**
|
2234
|
+
* A shorthand for the persisted type of an ArrayField class.
|
2235
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionField
|
2236
|
+
* @typeParam PersistedElementType - the perssited type of the elements of the EmbeddedCollectionField
|
2237
|
+
* @typeParam Opts - the options that override the default options
|
2238
|
+
*/
|
2239
|
+
type PersistedType<
|
2240
|
+
AssignmentElementType,
|
2241
|
+
PersistedElementType,
|
2242
|
+
Opts extends Options<AssignmentElementType>,
|
2243
|
+
> = DataField.DerivedInitializedType<PersistedElementType[], MergedOptions<AssignmentElementType, Opts>>;
|
2244
|
+
}
|
2245
|
+
|
2246
|
+
/**
|
2247
|
+
* A subclass of {@link EmbeddedCollectionField} which manages a collection of delta objects relative to another
|
2248
|
+
* collection.
|
2249
|
+
* @typeParam ElementFieldType - the field type for the elements in the EmbeddedCollectionDeltaField
|
2250
|
+
* @typeParam AssignmentElementType - the assignment type for the elements in the collection
|
2251
|
+
* @typeParam InitializedElementType - the initialized type for the elements in the collection
|
2252
|
+
* @typeParam Options - the options of the EmbeddedCollectionDeltaField instance
|
2253
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the EmbeddedCollectionDeltaField
|
2254
|
+
* @typeParam InitializedType - the type of the initialized values of the EmbeddedCollectionDeltaField
|
2255
|
+
* @typeParam PersistedElementType - the persisted type for the elements in the collection
|
2256
|
+
* @typeParam PersistedType - the type of the persisted values of the EmbeddedCollectionDeltaField
|
2257
|
+
* @remarks
|
2258
|
+
* Defaults:
|
2259
|
+
* AssignmentType: `ArrayField.BaseAssignmentType<AssignmentElementType> | null | undefined`
|
2260
|
+
* InitializedType: `Collection<InitializedElementType>`
|
2261
|
+
* PersistedType: `PersistedElementType[]`
|
2262
|
+
* InitialValue: `[]`
|
2263
|
+
*/
|
2264
|
+
declare class EmbeddedCollectionDeltaField<
|
2265
|
+
ElementFieldType extends Document.AnyConstructor,
|
2266
|
+
ParentDataModel extends Document.Any,
|
2267
|
+
AssignmentElementType = EmbeddedCollectionDeltaField.AssignmentElementType<ElementFieldType>,
|
2268
|
+
InitializedElementType extends Document.Any = EmbeddedCollectionDeltaField.InitializedElementType<ElementFieldType>,
|
2269
|
+
Options extends
|
2270
|
+
EmbeddedCollectionDeltaField.Options<AssignmentElementType> = EmbeddedCollectionDeltaField.DefaultOptions<AssignmentElementType>,
|
2271
|
+
AssignmentType = EmbeddedCollectionDeltaField.AssignmentType<AssignmentElementType, Options>,
|
2272
|
+
InitializedType = EmbeddedCollectionDeltaField.InitializedType<
|
2273
|
+
AssignmentElementType,
|
2274
|
+
InitializedElementType,
|
2275
|
+
ParentDataModel,
|
2276
|
+
Options
|
2277
|
+
>,
|
2278
|
+
PersistedElementType = EmbeddedCollectionDeltaField.PersistedElementType<ElementFieldType>,
|
2279
|
+
PersistedType extends PersistedElementType[] | null | undefined = EmbeddedCollectionDeltaField.PersistedType<
|
2280
|
+
AssignmentElementType,
|
2281
|
+
PersistedElementType,
|
2282
|
+
Options
|
2283
|
+
>,
|
2284
|
+
> extends EmbeddedCollectionField<
|
2285
|
+
ElementFieldType,
|
2286
|
+
ParentDataModel,
|
2287
|
+
AssignmentElementType,
|
2288
|
+
InitializedElementType,
|
2289
|
+
Options,
|
2290
|
+
AssignmentType,
|
2291
|
+
InitializedType,
|
2292
|
+
PersistedElementType,
|
2293
|
+
PersistedType
|
2294
|
+
> {
|
2295
|
+
static override get implementation(): typeof EmbeddedCollectionDelta;
|
2296
|
+
|
2297
|
+
protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
|
2298
|
+
|
2299
|
+
protected override _validateElements(
|
2300
|
+
value: any[],
|
2301
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
2302
|
+
): void | DataModelValidationFailure;
|
2303
|
+
}
|
2304
|
+
|
2305
|
+
declare namespace EmbeddedCollectionDeltaField {
|
2306
|
+
/**
|
2307
|
+
* A shorthand for the options of an EmbeddedCollectionDeltaField class.
|
2308
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionDeltaField
|
2309
|
+
*/
|
2310
|
+
type Options<AssignmentElementType> = DataFieldOptions<ArrayField.BaseAssignmentType<AssignmentElementType>>;
|
2311
|
+
|
2312
|
+
/**
|
2313
|
+
* The type of the default options for the {@link EmbeddedCollectionDeltaField} class.
|
2314
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionDeltaField
|
2315
|
+
*/
|
2316
|
+
type DefaultOptions<AssignmentElementType> = ArrayField.DefaultOptions<AssignmentElementType>;
|
2317
|
+
|
2318
|
+
/**
|
2319
|
+
* A helper type for the given options type merged into the default options of the EmbeddedCollectionDeltaField class.
|
2320
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionDeltaField
|
2321
|
+
* @typeParam Opts - the options that override the default options
|
2322
|
+
*/
|
2323
|
+
type MergedOptions<AssignmentElementType, Opts extends Options<AssignmentElementType>> = SimpleMerge<
|
2324
|
+
DefaultOptions<AssignmentElementType>,
|
2325
|
+
Opts
|
2326
|
+
>;
|
2327
|
+
|
2328
|
+
/**
|
2329
|
+
* A type to infer the assignment element type of an EmbeddedCollectionDeltaField from its ElementFieldType.
|
2330
|
+
* @typeParam ElementFieldType - the DataField type of the elements in the EmbeddedCollectionDeltaField
|
2331
|
+
*/
|
2332
|
+
type AssignmentElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends new (
|
2333
|
+
...args: any[]
|
2334
|
+
) => Document<any, infer Schema extends DataSchema, any>
|
2335
|
+
? SchemaField.InnerAssignmentType<Schema>
|
2336
|
+
: never;
|
2337
|
+
|
2338
|
+
/**
|
2339
|
+
* A type to infer the initialized element type of an EmbeddedCollectionDeltaField from its ElementFieldType.
|
2340
|
+
* @typeParam ElementFieldType - the DataField type of the elements in the EmbeddedCollectionDeltaField
|
2341
|
+
*/
|
2342
|
+
type InitializedElementType<ElementFieldType extends Document.AnyConstructor> =
|
2343
|
+
Document.ToConfiguredInstance<ElementFieldType>;
|
2344
|
+
|
2345
|
+
/**
|
2346
|
+
* A type to infer the initialized element type of an EmbeddedCollectionDeltaField from its ElementFieldType.
|
2347
|
+
* @typeParam ElementFieldType - the DataField type of the elements in the EmbeddedCollectionDeltaField
|
2348
|
+
*/
|
2349
|
+
type PersistedElementType<ElementFieldType extends Document.AnyConstructor> = ElementFieldType extends new (
|
2350
|
+
...args: any[]
|
2351
|
+
) => Document<any, infer Schema extends DataSchema, any>
|
2352
|
+
? SchemaField.InnerPersistedType<Schema>
|
2353
|
+
: never;
|
2354
|
+
|
2355
|
+
/**
|
2356
|
+
* A shorthand for the assignment type of an ArrayField class.
|
2357
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionDeltaField
|
2358
|
+
* @typeParam Opts - the options that override the default options
|
2359
|
+
*/
|
2360
|
+
type AssignmentType<
|
2361
|
+
AssignmentElementType,
|
2362
|
+
Opts extends Options<AssignmentElementType>,
|
2363
|
+
> = DataField.DerivedAssignmentType<
|
2364
|
+
ArrayField.BaseAssignmentType<AssignmentElementType>,
|
2365
|
+
MergedOptions<AssignmentElementType, Opts>
|
2366
|
+
>;
|
2367
|
+
|
2368
|
+
/**
|
2369
|
+
* A shorthand for the initialized type of an ArrayField class.
|
2370
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionDeltaField
|
2371
|
+
* @typeParam InitializedElementType - the initialized type of the elements of the EmbeddedCollectionDeltaField
|
2372
|
+
* @typeParam Opts - the options that override the default options
|
2373
|
+
*/
|
2374
|
+
type InitializedType<
|
2375
|
+
AssignmentElementType,
|
2376
|
+
InitializedElementType extends Document.Internal.Instance.Any,
|
2377
|
+
ParentDataModel extends Document.Any,
|
2378
|
+
Opts extends Options<AssignmentElementType>,
|
2379
|
+
> = DataField.DerivedInitializedType<
|
2380
|
+
EmbeddedCollectionDelta<Document.Internal.Instance.Complete<InitializedElementType>, ParentDataModel>,
|
2381
|
+
MergedOptions<AssignmentElementType, Opts>
|
2382
|
+
>;
|
2383
|
+
|
2384
|
+
/**
|
2385
|
+
* A shorthand for the persisted type of an ArrayField class.
|
2386
|
+
* @typeParam AssignmentElementType - the assignment type of the elements of the EmbeddedCollectionDeltaField
|
2387
|
+
* @typeParam PersistedElementType - the perssited type of the elements of the EmbeddedCollectionDeltaField
|
2388
|
+
* @typeParam Opts - the options that override the default options
|
2389
|
+
*/
|
2390
|
+
type PersistedType<
|
2391
|
+
AssignmentElementType,
|
2392
|
+
PersistedElementType,
|
2393
|
+
Opts extends Options<AssignmentElementType>,
|
2394
|
+
> = DataField.DerivedInitializedType<PersistedElementType[], MergedOptions<AssignmentElementType, Opts>>;
|
2395
|
+
}
|
2396
|
+
|
2397
|
+
/**
|
2398
|
+
* A subclass of {@link EmbeddedDataField} which supports a single embedded Document.
|
2399
|
+
* @typeParam DocumentType - the type of the embedded Document
|
2400
|
+
* @typeParam Options - the options of the EmbeddedDocumentField instance
|
2401
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the EmbeddedDocumentField
|
2402
|
+
* @typeParam InitializedType - the type of the initialized values of the EmbeddedDocumentField
|
2403
|
+
* @typeParam PersistedType - the type of the persisted values of the EmbeddedDocumentField
|
2404
|
+
* @remarks
|
2405
|
+
* Defaults:
|
2406
|
+
* AssignmentType: `SchemaField.AssignmentType<DocumentType["schema"]["fields"]> | null | undefined`
|
2407
|
+
* InitializedType: `SchemaField.InitializedType<DocumentType["schema"]["fields"]> | null`
|
2408
|
+
* PersistedType: `SchemaField.PersistedType<DocumentType["schema"]["fields"]> | null`
|
2409
|
+
* InitialValue: `{}`
|
2410
|
+
*/
|
2411
|
+
declare class EmbeddedDocumentField<
|
2412
|
+
const DocumentType extends Document.AnyConstructor,
|
2413
|
+
const Options extends EmbeddedDocumentField.Options<DocumentType> = EmbeddedDocumentField.DefaultOptions,
|
2414
|
+
const AssignmentType = EmbeddedDocumentField.AssignmentType<DocumentType, Options>,
|
2415
|
+
const InitializedType = EmbeddedDocumentField.InitializedType<DocumentType, Options>,
|
2416
|
+
const PersistedType extends AnyObject | null | undefined = EmbeddedDocumentField.PersistedType<DocumentType, Options>,
|
2417
|
+
> extends EmbeddedDataField<DocumentType, Options, AssignmentType, InitializedType, PersistedType> {
|
2418
|
+
/**
|
2419
|
+
* @param model - The type of Document which is embedded.
|
2420
|
+
* @param options - Options which configure the behavior of the field.
|
2421
|
+
*/
|
2422
|
+
constructor(model: DocumentType, options?: Options, context?: DataField.Context);
|
2423
|
+
|
2424
|
+
/** @defaultValue `true` */
|
2425
|
+
override nullable: boolean;
|
2426
|
+
|
2427
|
+
protected static override get _defaults(): EmbeddedDocumentField.Options<Document.AnyConstructor>;
|
2428
|
+
|
2429
|
+
/** @defaultValue `true` */
|
2430
|
+
static override hierarchical: boolean;
|
2431
|
+
|
2432
|
+
override initialize(
|
2433
|
+
value: PersistedType,
|
2434
|
+
model: DataModel.Any,
|
2435
|
+
options?: AnyObject,
|
2436
|
+
): InitializedType | (() => InitializedType | null);
|
2437
|
+
|
2438
|
+
/**
|
2439
|
+
* Return the embedded document(s) as a Collection.
|
2440
|
+
* @param parent - The parent document.
|
2441
|
+
*/
|
2442
|
+
getCollection<P extends Document.Any>(parent: P): Collection<P>;
|
2443
|
+
}
|
2444
|
+
|
2445
|
+
declare namespace EmbeddedDocumentField {
|
2446
|
+
/**
|
2447
|
+
* A shorthand for the options of an EmbeddedDocumentField class.
|
2448
|
+
* @typeParam DocumentType - the type of the embedded Document
|
2449
|
+
*/
|
2450
|
+
type Options<DocumentType extends Document.AnyConstructor> = DataFieldOptions<
|
2451
|
+
SchemaField.InnerAssignmentType<DataModel.SchemaOfClass<DocumentType>> | __SchemaFieldInitial
|
2452
|
+
>;
|
2453
|
+
|
2454
|
+
/** The type of the default options for the {@link EmbeddedDocumentField} class. */
|
2455
|
+
type DefaultOptions = SimpleMerge<
|
2456
|
+
EmbeddedDataField.DefaultOptions,
|
2457
|
+
{
|
2458
|
+
nullable: true;
|
2459
|
+
}
|
2460
|
+
>;
|
2461
|
+
|
2462
|
+
/**
|
2463
|
+
* A helper type for the given options type merged into the default options of the EmbeddedDocumentField class.
|
2464
|
+
* @typeParam DocumentType - the type of the embedded Document
|
2465
|
+
* @typeParam Opts - the options that override the default options
|
2466
|
+
*/
|
2467
|
+
type MergedOptions<DocumentType extends Document.AnyConstructor, Opts extends Options<DocumentType>> = SimpleMerge<
|
2468
|
+
DefaultOptions,
|
2469
|
+
Opts
|
2470
|
+
>;
|
2471
|
+
|
2472
|
+
/**
|
2473
|
+
* A shorthand for the assignment type of an EmbeddedDocumentField class.
|
2474
|
+
* @typeParam DocumentType - the type of the embedded Document
|
2475
|
+
* @typeParam Opts - the options that override the default options
|
2476
|
+
*/
|
2477
|
+
type AssignmentType<
|
2478
|
+
DocumentType extends Document.AnyConstructor,
|
2479
|
+
Opts extends Options<DocumentType>,
|
2480
|
+
> = DataField.DerivedAssignmentType<
|
2481
|
+
SchemaField.InnerAssignmentType<DataModel.SchemaOfClass<DocumentType>>,
|
2482
|
+
MergedOptions<DocumentType, Opts>
|
2483
|
+
>;
|
2484
|
+
|
2485
|
+
/**
|
2486
|
+
* A shorthand for the initialized type of an EmbeddedDocumentField class.
|
2487
|
+
* @typeParam DocumentType - the type of the embedded Document
|
2488
|
+
* @typeParam Opts - the options that override the default options
|
2489
|
+
*/
|
2490
|
+
type InitializedType<
|
2491
|
+
DocumentType extends Document.AnyConstructor,
|
2492
|
+
Opts extends Options<DocumentType>,
|
2493
|
+
> = DataField.DerivedInitializedType<
|
2494
|
+
SchemaField.InnerInitializedType<DataModel.SchemaOfClass<DocumentType>>,
|
2495
|
+
MergedOptions<DocumentType, Opts>
|
2496
|
+
>;
|
2497
|
+
|
2498
|
+
/**
|
2499
|
+
* A shorthand for the persisted type of an EmbeddedDocumentField class.
|
2500
|
+
* @typeParam DocumentType - the type of the embedded Document
|
2501
|
+
* @typeParam Opts - the options that override the default options
|
2502
|
+
*/
|
2503
|
+
type PersistedType<
|
2504
|
+
DocumentType extends Document.AnyConstructor,
|
2505
|
+
Opts extends Options<DocumentType>,
|
2506
|
+
> = DataField.DerivedInitializedType<
|
2507
|
+
SchemaField.InnerPersistedType<DataModel.SchemaOfClass<DocumentType>>,
|
2508
|
+
MergedOptions<DocumentType, Opts>
|
2509
|
+
>;
|
2510
|
+
}
|
2511
|
+
|
2512
|
+
/**
|
2513
|
+
* A subclass of [StringField]{@link StringField} which provides the primary _id for a Document.
|
2514
|
+
* The field may be initially null, but it must be non-null when it is saved to the database.
|
2515
|
+
* @typeParam Options - the options of the DocumentIdField instance
|
2516
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the DocumentIdField
|
2517
|
+
* @typeParam InitializedType - the type of the initialized values of the DocumentIdField
|
2518
|
+
* @typeParam PersistedType - the type of the persisted values of the DocumentIdField
|
2519
|
+
* @remarks
|
2520
|
+
* Defaults:
|
2521
|
+
* AssignmentType: `string | Document.Any | null | undefined`
|
2522
|
+
* InitializedType: `string | null`
|
2523
|
+
* PersistedType: `string | null`
|
2524
|
+
* InitialValue: `null`
|
2525
|
+
*/
|
2526
|
+
declare class DocumentIdField<
|
2527
|
+
Options extends StringFieldOptions = DocumentIdField.DefaultOptions,
|
2528
|
+
AssignmentType = DocumentIdField.AssignmentType<Options>,
|
2529
|
+
InitializedType = DocumentIdField.InitializedType<Options>,
|
2530
|
+
PersistedType extends string | null | undefined = DocumentIdField.InitializedType<Options>,
|
2531
|
+
> extends StringField<Options, AssignmentType, InitializedType, PersistedType> {
|
2532
|
+
/** @defaultValue `true` */
|
2533
|
+
override required: boolean;
|
2534
|
+
|
2535
|
+
/** @defaultValue `false` */
|
2536
|
+
override blank: boolean;
|
2537
|
+
|
2538
|
+
/** @defaultValue `true` */
|
2539
|
+
override nullable: boolean;
|
2540
|
+
|
2541
|
+
/** @defaultValue `null` */
|
2542
|
+
override initial: DataFieldOptions.InitialType<InitializedType>;
|
2543
|
+
|
2544
|
+
/** @defaultValue `true` */
|
2545
|
+
override readonly: boolean;
|
2546
|
+
|
2547
|
+
/** @defaultValue `"is not a valid Document ID string"` */
|
2548
|
+
override validationError: string;
|
2549
|
+
|
2550
|
+
protected static override get _defaults(): StringFieldOptions;
|
2551
|
+
|
2552
|
+
protected override _cast(value: AssignmentType): InitializedType;
|
2553
|
+
|
2554
|
+
protected override _validateType(
|
2555
|
+
value: InitializedType,
|
2556
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
2557
|
+
): boolean | DataModelValidationFailure | void;
|
2558
|
+
}
|
2559
|
+
|
2560
|
+
declare namespace DocumentIdField {
|
2561
|
+
/** The type of the default options for the {@link DocumentIdField} class. */
|
2562
|
+
type DefaultOptions = SimpleMerge<
|
2563
|
+
StringField.DefaultOptions,
|
2564
|
+
{
|
2565
|
+
required: true;
|
2566
|
+
blank: false;
|
2567
|
+
nullable: true;
|
2568
|
+
initial: null;
|
2569
|
+
readonly: true;
|
2570
|
+
validationError: "is not a valid Document ID string";
|
2571
|
+
}
|
2572
|
+
>;
|
2573
|
+
|
2574
|
+
/**
|
2575
|
+
* A helper type for the given options type merged into the default options of the DocumentIdField class.
|
2576
|
+
* @typeParam Options - the options that override the default options
|
2577
|
+
*/
|
2578
|
+
type MergedOptions<Options extends StringFieldOptions> = SimpleMerge<DefaultOptions, Options>;
|
2579
|
+
|
2580
|
+
/**
|
2581
|
+
* A shorthand for the assignment type of a StringField class.
|
2582
|
+
* @typeParam Options - the options that override the default options
|
2583
|
+
*/
|
2584
|
+
type AssignmentType<Options extends StringFieldOptions> = DataField.DerivedAssignmentType<
|
2585
|
+
string | Document.Any,
|
2586
|
+
MergedOptions<Options>
|
2587
|
+
>;
|
2588
|
+
|
2589
|
+
/**
|
2590
|
+
* A shorthand for the initialized type of a StringField class.
|
2591
|
+
* @typeParam Options - the options that override the default options
|
2592
|
+
*/
|
2593
|
+
type InitializedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
|
2594
|
+
string,
|
2595
|
+
MergedOptions<Options>
|
2596
|
+
>;
|
2597
|
+
}
|
2598
|
+
|
2599
|
+
/**
|
2600
|
+
* A subclass of {@link StringField} which supports referencing some other Document by its UUID.
|
2601
|
+
* This field may not be blank, but may be null to indicate that no UUID is referenced.
|
2602
|
+
*/
|
2603
|
+
declare class DocumentUUIDField<
|
2604
|
+
const Options extends DocumentUUIDField.Options = DocumentUUIDField.DefaultOptions,
|
2605
|
+
const AssignmentType = StringField.AssignmentType<Options>,
|
2606
|
+
const InitializedType = StringField.InitializedType<Options>,
|
2607
|
+
const PersistedType extends string | null | undefined = StringField.InitializedType<Options>,
|
2608
|
+
> extends StringField<Options, AssignmentType, InitializedType, PersistedType> {
|
2609
|
+
/**
|
2610
|
+
* @param options - Options which configure the behavior of the field
|
2611
|
+
* @param context - Additional context which describes the field
|
2612
|
+
*/
|
2613
|
+
constructor(options?: Options, context?: DataField.Context);
|
2614
|
+
|
2615
|
+
/** A specific document type in CONST.ALL_DOCUMENT_TYPES required by this field */
|
2616
|
+
type: Document.Type | undefined;
|
2617
|
+
|
2618
|
+
/** Does this field require (or prohibit) embedded documents? */
|
2619
|
+
embedded: boolean | undefined;
|
2620
|
+
|
2621
|
+
static get _defaults(): DocumentUUIDField.Options;
|
2622
|
+
|
2623
|
+
protected override _validateType(
|
2624
|
+
value: InitializedType,
|
2625
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
2626
|
+
): boolean | DataModelValidationFailure | void;
|
2627
|
+
|
2628
|
+
// These verbose overloads are because otherwise there would be a misleading errors about `choices` being required without mentioning `options` or vice versa.
|
2629
|
+
toFormGroup(
|
2630
|
+
groupConfig?: DataField.GroupConfig,
|
2631
|
+
inputConfig?:
|
2632
|
+
| DocumentUUIDField.RootToInputConfig<InitializedType>
|
2633
|
+
| DocumentUUIDField.ToInputConfigWithOptions<InitializedType>,
|
2634
|
+
): HTMLDivElement;
|
2635
|
+
toFormGroup(
|
2636
|
+
groupConfig?: DataField.GroupConfig,
|
2637
|
+
inputConfig?: DocumentUUIDField.ToInputConfigWithChoices<InitializedType>,
|
2638
|
+
): HTMLDivElement;
|
2639
|
+
|
2640
|
+
toInput(
|
2641
|
+
config?:
|
2642
|
+
| DocumentUUIDField.RootToInputConfig<InitializedType>
|
2643
|
+
| DocumentUUIDField.ToInputConfigWithOptions<InitializedType>,
|
2644
|
+
): HTMLElement | HTMLCollection;
|
2645
|
+
toInput(config?: DocumentUUIDField.ToInputConfigWithChoices<InitializedType>): HTMLElement | HTMLCollection;
|
2646
|
+
|
2647
|
+
protected override _toInput(
|
2648
|
+
config:
|
2649
|
+
| DocumentUUIDField.RootToInputConfig<InitializedType>
|
2650
|
+
| DocumentUUIDField.ToInputConfigWithOptions<InitializedType>,
|
2651
|
+
): HTMLElement | HTMLCollection;
|
2652
|
+
protected override _toInput(
|
2653
|
+
config: DocumentUUIDField.ToInputConfigWithChoices<InitializedType>,
|
2654
|
+
): HTMLElement | HTMLCollection;
|
2655
|
+
}
|
2656
|
+
|
2657
|
+
declare namespace DocumentUUIDField {
|
2658
|
+
type Options = StringFieldOptions &
|
2659
|
+
StringFieldOptions & {
|
2660
|
+
/* A specific document type in CONST.ALL_DOCUMENT_TYPES required by this field */
|
2661
|
+
type?: Document.Type | undefined;
|
2662
|
+
|
2663
|
+
/* Does this field require (or prohibit) embedded documents? */
|
2664
|
+
embedded?: boolean | undefined;
|
2665
|
+
};
|
2666
|
+
|
2667
|
+
type DefaultOptions = SimpleMerge<
|
2668
|
+
StringField.DefaultOptions,
|
2669
|
+
{
|
2670
|
+
required: true;
|
2671
|
+
blank: false;
|
2672
|
+
nullable: true;
|
2673
|
+
initial: null;
|
2674
|
+
type: undefined;
|
2675
|
+
embedded: undefined;
|
2676
|
+
}
|
2677
|
+
>;
|
2678
|
+
|
2679
|
+
interface RootToInputConfig<InitializedType>
|
2680
|
+
extends Omit<DataField.ToInputConfig<InitializedType>, "type" | "single"> {}
|
2681
|
+
|
2682
|
+
/** @internal */
|
2683
|
+
type _Choices = Omit<SelectInputConfig, "options"> & StringField.GetChoicesOptions;
|
2684
|
+
|
2685
|
+
interface ToInputConfigWithOptions<InitializedType> extends RootToInputConfig<InitializedType>, SelectInputConfig {}
|
2686
|
+
interface ToInputConfigWithChoices<InitializedType>
|
2687
|
+
extends SimpleMerge<RootToInputConfig<InitializedType>, _Choices> {}
|
2688
|
+
|
2689
|
+
/**
|
2690
|
+
* @remarks `DocumentUUIDField#_toInput` writes `Object.assign(config, {type: this.type, single: true});` which is why they have been removed as options.
|
2691
|
+
*/
|
2692
|
+
type ToInputConfig<InitializedType> =
|
2693
|
+
| RootToInputConfig<InitializedType>
|
2694
|
+
| ToInputConfigWithOptions<InitializedType>
|
2695
|
+
| ToInputConfigWithChoices<InitializedType>;
|
2696
|
+
}
|
2697
|
+
|
2698
|
+
/**
|
2699
|
+
* A special class of [StringField]{@link StringField} field which references another DataModel by its id.
|
2700
|
+
* This field may also be null to indicate that no foreign model is linked.
|
2701
|
+
* @typeParam DocumentType - the type of the foreign document constructor
|
2702
|
+
* @typeParam Options - the options for the ForeignDocumentField
|
2703
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the ForeignDocumentField
|
2704
|
+
* @typeParam InitializedType - the type of the initialized values of the ForeignDocumentField
|
2705
|
+
* @typeParam PersistedType - the type of the persisted values of the ForeignDocumentField
|
2706
|
+
* @remarks
|
2707
|
+
* Defaults:
|
2708
|
+
* AssignmentType: `string | InstanceType<DocumentType> | null | undefined`
|
2709
|
+
* InitializedType: `InstanceType<DocumentType> | null`
|
2710
|
+
* PersistedType: `string | null`
|
2711
|
+
* InitialValue: `null`
|
2712
|
+
*/
|
2713
|
+
declare class ForeignDocumentField<
|
2714
|
+
DocumentType extends Document.AnyConstructor,
|
2715
|
+
Options extends ForeignDocumentField.Options = ForeignDocumentField.DefaultOptions,
|
2716
|
+
AssignmentType = ForeignDocumentField.AssignmentType<DocumentType, Options>,
|
2717
|
+
InitializedType = ForeignDocumentField.InitializedType<DocumentType, Options>,
|
2718
|
+
PersistedType extends string | null | undefined = ForeignDocumentField.PersistedType<Options>,
|
2719
|
+
> extends DocumentIdField<Options, AssignmentType, InitializedType, PersistedType> {
|
2720
|
+
/**
|
2721
|
+
* @param model - The foreign DataModel class definition which this field should link to.
|
2722
|
+
* @param options - Options which configure the behavior of the field
|
2723
|
+
*/
|
2724
|
+
constructor(model: DocumentType, options?: Options, context?: DataField.Context);
|
2725
|
+
|
2726
|
+
/** @defaultValue `true` */
|
2727
|
+
override nullable: boolean;
|
2728
|
+
|
2729
|
+
/** @defaultValue `false` */
|
2730
|
+
override readonly: boolean;
|
2731
|
+
|
2732
|
+
/** @defaultValue `false` */
|
2733
|
+
idOnly: boolean;
|
2734
|
+
|
2735
|
+
/**
|
2736
|
+
* A reference to the model class which is stored in this field
|
2737
|
+
*/
|
2738
|
+
model: DocumentType;
|
2739
|
+
|
2740
|
+
protected static override get _defaults(): ForeignDocumentField.Options;
|
2741
|
+
|
2742
|
+
protected override _cast(value: AssignmentType): InitializedType;
|
2743
|
+
|
2744
|
+
override initialize(
|
2745
|
+
value: PersistedType,
|
2746
|
+
model: DataModel.Any,
|
2747
|
+
options?: AnyObject,
|
2748
|
+
): InitializedType | (() => InitializedType | null);
|
2749
|
+
|
2750
|
+
override toObject(value: InitializedType): PersistedType;
|
2751
|
+
}
|
2752
|
+
|
2753
|
+
declare namespace ForeignDocumentField {
|
2754
|
+
/** The options for the ForeignDocumentField class. */
|
2755
|
+
type Options = StringFieldOptions &
|
2756
|
+
DataFieldOptions<string | Document.Any> & {
|
2757
|
+
// Making this ---------^ more concrete leads to excessively deep instantiation
|
2758
|
+
idOnly?: boolean;
|
2759
|
+
};
|
2760
|
+
|
2761
|
+
/** The type of the default options for the {@link ForeignDocumentField} class. */
|
2762
|
+
type DefaultOptions = SimpleMerge<
|
2763
|
+
DocumentIdField.DefaultOptions,
|
2764
|
+
{
|
2765
|
+
nullable: true;
|
2766
|
+
readonly: false;
|
2767
|
+
idOnly: false;
|
2768
|
+
}
|
2769
|
+
>;
|
2770
|
+
|
2771
|
+
/**
|
2772
|
+
* A helper type for the given options type merged into the default options of the ForeignDocumentField class.
|
2773
|
+
* @typeParam Opts - the options that override the default options
|
2774
|
+
*/
|
2775
|
+
type MergedOptions<Opts extends Options> = SimpleMerge<DefaultOptions, Opts>;
|
2776
|
+
|
2777
|
+
/**
|
2778
|
+
* A shorthand for the assignment type of a ForeignDocumentField class.
|
2779
|
+
* @typeParam Opts - the options that override the default options
|
2780
|
+
*/
|
2781
|
+
type AssignmentType<
|
2782
|
+
ConcreteDocument extends Document.AnyConstructor,
|
2783
|
+
Opts extends Options,
|
2784
|
+
> = DataField.DerivedAssignmentType<string | Document.ToConfiguredClass<ConcreteDocument>, MergedOptions<Opts>>;
|
2785
|
+
|
2786
|
+
/**
|
2787
|
+
* A shorthand for the initialized type of a ForeignDocumentField class.
|
2788
|
+
* @typeParam Opts - the options that override the default options
|
2789
|
+
*/
|
2790
|
+
type InitializedType<
|
2791
|
+
ConcreteDocument extends Document.AnyConstructor,
|
2792
|
+
Opts extends Options,
|
2793
|
+
> = DataField.DerivedInitializedType<
|
2794
|
+
Opts["idOnly"] extends true ? string : Document.ToConfiguredInstance<ConcreteDocument>,
|
2795
|
+
MergedOptions<Opts>
|
2796
|
+
>;
|
2797
|
+
|
2798
|
+
/**
|
2799
|
+
* A shorthand for the persisted type of a ForeignDocumentField class.
|
2800
|
+
* @typeParam Opts - the options that override the default options
|
2801
|
+
*/
|
2802
|
+
type PersistedType<Opts extends Options> = DataField.DerivedInitializedType<string, MergedOptions<Opts>>;
|
2803
|
+
}
|
2804
|
+
|
2805
|
+
/**
|
2806
|
+
* A special [StringField]{@link StringField} which records a standardized CSS color string.
|
2807
|
+
* @typeParam Options - the options of the ColorField instance
|
2808
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the ColorField
|
2809
|
+
* @typeParam InitializedType - the type of the initialized values of the ColorField
|
2810
|
+
* @typeParam PersistedType - the type of the persisted values of the ColorField
|
2811
|
+
* @remarks
|
2812
|
+
* Defaults:
|
2813
|
+
* AssignmentType: `string | null | undefined`
|
2814
|
+
* InitializedType: `string | null`
|
2815
|
+
* PersistedType: `string | null`
|
2816
|
+
* InitialValue: `null`
|
2817
|
+
*/
|
2818
|
+
declare class ColorField<
|
2819
|
+
Options extends StringFieldOptions = ColorField.DefaultOptions,
|
2820
|
+
AssignmentType = ColorField.AssignmentType<Options>,
|
2821
|
+
InitializedType = ColorField.InitializedType<Options>,
|
2822
|
+
PersistedType extends string | null | undefined = ColorField.PersistedType<Options>,
|
2823
|
+
> extends StringField<Options, AssignmentType, InitializedType, PersistedType> {
|
2824
|
+
/** @defaultValue `true` */
|
2825
|
+
override nullable: boolean;
|
2826
|
+
|
2827
|
+
/** @defaultValue `null` */
|
2828
|
+
override initial: DataFieldOptions.InitialType<InitializedType>;
|
2829
|
+
|
2830
|
+
/** @defaultValue `false` */
|
2831
|
+
override blank: boolean;
|
2832
|
+
|
2833
|
+
/** @defaultValue `"is not a valid hexadecimal color string"` */
|
2834
|
+
override validationError: string;
|
2835
|
+
|
2836
|
+
protected static override get _defaults(): StringFieldOptions;
|
2837
|
+
|
2838
|
+
override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
|
2839
|
+
|
2840
|
+
protected override _validateType(
|
2841
|
+
value: InitializedType,
|
2842
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
2843
|
+
): boolean | DataModelValidationFailure | void;
|
2844
|
+
}
|
2845
|
+
|
2846
|
+
declare namespace ColorField {
|
2847
|
+
/** The type of the default options for the {@link ColorField} class. */
|
2848
|
+
type DefaultOptions = SimpleMerge<
|
2849
|
+
StringField.DefaultOptions,
|
2850
|
+
{
|
2851
|
+
nullable: true;
|
2852
|
+
initial: null;
|
2853
|
+
blank: false;
|
2854
|
+
validationError: "is not a valid hexadecimal color string";
|
2855
|
+
}
|
2856
|
+
>;
|
2857
|
+
|
2858
|
+
/**
|
2859
|
+
* A helper type for the given options type merged into the default options of the ColorField class.
|
2860
|
+
* @typeParam Options - the options that override the default options
|
2861
|
+
*/
|
2862
|
+
type MergedOptions<Options extends StringFieldOptions> = SimpleMerge<DefaultOptions, Options>;
|
2863
|
+
|
2864
|
+
/**
|
2865
|
+
* A shorthand for the assignment type of a ColorField class.
|
2866
|
+
* @typeParam Options - the options that override the default options
|
2867
|
+
*/
|
2868
|
+
type AssignmentType<Options extends StringFieldOptions> = DataField.DerivedAssignmentType<
|
2869
|
+
string,
|
2870
|
+
MergedOptions<Options>
|
2871
|
+
>;
|
2872
|
+
|
2873
|
+
/**
|
2874
|
+
* A shorthand for the initialized type of a ColorField class.
|
2875
|
+
* @typeParam Options - the options that override the default options
|
2876
|
+
*/
|
2877
|
+
type InitializedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
|
2878
|
+
Color,
|
2879
|
+
MergedOptions<Options>
|
2880
|
+
>;
|
2881
|
+
|
2882
|
+
/**
|
2883
|
+
* A shorthand for the persisted type of a ColorField class.
|
2884
|
+
* @typeParam Options - the options that override the default options
|
2885
|
+
*/
|
2886
|
+
type PersistedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
|
2887
|
+
string,
|
2888
|
+
MergedOptions<Options>
|
2889
|
+
>;
|
2890
|
+
}
|
2891
|
+
|
2892
|
+
declare global {
|
2893
|
+
/**
|
2894
|
+
* @typeParam Value - the type of the value of the field
|
2895
|
+
*/
|
2896
|
+
interface FilePathFieldOptions extends StringFieldOptions {
|
2897
|
+
/**
|
2898
|
+
* A set of categories in CONST.FILE_CATEGORIES which this field supports
|
2899
|
+
* @defaultValue `[]`
|
2900
|
+
*/
|
2901
|
+
categories?: (keyof typeof CONST.FILE_CATEGORIES)[];
|
2902
|
+
|
2903
|
+
/**
|
2904
|
+
* Is embedded base64 data supported in lieu of a file path?
|
2905
|
+
* @defaultValue `false`
|
2906
|
+
*/
|
2907
|
+
base64?: boolean;
|
2908
|
+
|
2909
|
+
/**
|
2910
|
+
* Does this file path field allow wildcard characters?
|
2911
|
+
* @defaultValue `false`
|
2912
|
+
*/
|
2913
|
+
wildcard?: boolean;
|
2914
|
+
}
|
2915
|
+
}
|
2916
|
+
|
2917
|
+
/**
|
2918
|
+
* A special [StringField]{@link StringField} which records a file path or inline base64 data.
|
2919
|
+
* @typeParam Options - the options of the FilePathField instance
|
2920
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the FilePathField
|
2921
|
+
* @typeParam InitializedType - the type of the initialized values of the FilePathField
|
2922
|
+
* @typeParam PersistedType - the type of the persisted values of the FilePathField
|
2923
|
+
* @remarks
|
2924
|
+
* Defaults:
|
2925
|
+
* AssignmentType: `string | null | undefined`
|
2926
|
+
* InitializedType: `string | null`
|
2927
|
+
* PersistedType: `string | null`
|
2928
|
+
* InitialValue: `null`
|
2929
|
+
*/
|
2930
|
+
declare class FilePathField<
|
2931
|
+
Options extends FilePathFieldOptions = FilePathField.DefaultOptions,
|
2932
|
+
AssignmentType = FilePathField.AssignmentType<Options>,
|
2933
|
+
InitializedType = FilePathField.InitializedType<Options>,
|
2934
|
+
PersistedType extends string | null | undefined = FilePathField.InitializedType<Options>,
|
2935
|
+
> extends StringField<Options, AssignmentType, InitializedType, PersistedType> {
|
2936
|
+
/**
|
2937
|
+
* @param options - Options which configure the behavior of the field
|
2938
|
+
*/
|
2939
|
+
constructor(options?: Options, context?: DataField.Context);
|
2940
|
+
|
2941
|
+
/**
|
2942
|
+
* A set of categories in CONST.FILE_CATEGORIES which this field supports
|
2943
|
+
* @defaultValue `[]`
|
2944
|
+
*/
|
2945
|
+
categories: (keyof typeof CONST.FILE_CATEGORIES)[];
|
2946
|
+
|
2947
|
+
/**
|
2948
|
+
* Is embedded base64 data supported in lieu of a file path?
|
2949
|
+
* @defaultValue `false`
|
2950
|
+
*/
|
2951
|
+
base64: boolean;
|
2952
|
+
|
2953
|
+
/**
|
2954
|
+
* Does this file path field allow wildcard characters?
|
2955
|
+
* @defaultValue `false`
|
2956
|
+
*/
|
2957
|
+
wildcard: boolean;
|
2958
|
+
|
2959
|
+
/** @defaultValue `true` */
|
2960
|
+
override nullable: boolean;
|
2961
|
+
|
2962
|
+
/** @defaultValue `false` */
|
2963
|
+
override blank: boolean;
|
2964
|
+
|
2965
|
+
/** @defaultValue `null` */
|
2966
|
+
override initial: DataFieldOptions.InitialType<InitializedType>;
|
2967
|
+
|
2968
|
+
protected static override get _defaults(): FilePathFieldOptions;
|
2969
|
+
|
2970
|
+
override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
|
2971
|
+
|
2972
|
+
protected override _validateType(
|
2973
|
+
value: InitializedType,
|
2974
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
2975
|
+
): boolean | DataModelValidationFailure | void;
|
2976
|
+
}
|
2977
|
+
|
2978
|
+
declare namespace FilePathField {
|
2979
|
+
/** The type of the default options for the {@link FilePathField} class. */
|
2980
|
+
type DefaultOptions = SimpleMerge<
|
2981
|
+
StringField.DefaultOptions,
|
2982
|
+
{
|
2983
|
+
categories: (keyof typeof CONST.FILE_CATEGORIES)[];
|
2984
|
+
base64: false;
|
2985
|
+
wildcard: false;
|
2986
|
+
nullable: true;
|
2987
|
+
blank: false;
|
2988
|
+
initial: null;
|
2989
|
+
}
|
2990
|
+
>;
|
2991
|
+
|
2992
|
+
/**
|
2993
|
+
* A helper type for the given options type merged into the default options of the FilePathField class.
|
2994
|
+
* @typeParam Options - the options that override the default options
|
2995
|
+
*/
|
2996
|
+
type MergedOptions<Options extends StringFieldOptions> = SimpleMerge<DefaultOptions, Options>;
|
2997
|
+
|
2998
|
+
/**
|
2999
|
+
* A shorthand for the assignment type of a FilePathField class.
|
3000
|
+
* @typeParam Options - the options that override the default options
|
3001
|
+
*/
|
3002
|
+
type AssignmentType<Options extends StringFieldOptions> = DataField.DerivedAssignmentType<
|
3003
|
+
string,
|
3004
|
+
MergedOptions<Options>
|
3005
|
+
>;
|
3006
|
+
|
3007
|
+
/**
|
3008
|
+
* A shorthand for the initialized type of a FilePathField class.
|
3009
|
+
* @typeParam Options - the options that override the default options
|
3010
|
+
*/
|
3011
|
+
type InitializedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
|
3012
|
+
string,
|
3013
|
+
MergedOptions<Options>
|
3014
|
+
>;
|
3015
|
+
}
|
3016
|
+
|
3017
|
+
/**
|
3018
|
+
* A special [NumberField]{@link NumberField} which represents an angle of rotation in degrees between 0 and 360.
|
3019
|
+
* @typeParam Options - the options of the AngleField instance
|
3020
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the AngleField
|
3021
|
+
* @typeParam InitializedType - the type of the initialized values of the AngleField
|
3022
|
+
* @typeParam PersistedType - the type of the persisted values of the AngleField
|
3023
|
+
* @remarks
|
3024
|
+
* Defaults:
|
3025
|
+
* AssignmentType: `number | null | undefined`
|
3026
|
+
* InitializedType: `number`
|
3027
|
+
* PersistedType: `number`
|
3028
|
+
* InitialValue: `0`
|
3029
|
+
*/
|
3030
|
+
declare class AngleField<
|
3031
|
+
Options extends NumberFieldOptions = AngleField.DefaultOptions,
|
3032
|
+
AssignmentType = AngleField.AssignmentType<Options>,
|
3033
|
+
InitializedType = AngleField.InitializedType<Options>,
|
3034
|
+
PersistedType extends number | null | undefined = AngleField.InitializedType<Options>,
|
3035
|
+
> extends NumberField<Options, AssignmentType, InitializedType, PersistedType> {
|
3036
|
+
/** @defaultValue `true` */
|
3037
|
+
override required: boolean;
|
3038
|
+
|
3039
|
+
/** @defaultValue `false` */
|
3040
|
+
override nullable: boolean;
|
3041
|
+
|
3042
|
+
/** @defaultValue `0` */
|
3043
|
+
override initial: DataFieldOptions.InitialType<InitializedType>;
|
3044
|
+
|
3045
|
+
/** @defaultValue `0` */
|
3046
|
+
base: number;
|
3047
|
+
|
3048
|
+
/** @defaultValue `0` */
|
3049
|
+
override min: number | undefined;
|
3050
|
+
|
3051
|
+
/** @defaultValue `360` */
|
3052
|
+
override max: number | undefined;
|
3053
|
+
|
3054
|
+
/** @defaultValue `"is not a number between 0 and 360"` */
|
3055
|
+
override validationError: string;
|
3056
|
+
|
3057
|
+
protected static override get _defaults(): NumberFieldOptions;
|
3058
|
+
|
3059
|
+
protected override _cast(value: AssignmentType): InitializedType;
|
3060
|
+
}
|
3061
|
+
|
3062
|
+
declare namespace AngleField {
|
3063
|
+
/** The type of the default options for the {@link AngleField} class. */
|
3064
|
+
type DefaultOptions = SimpleMerge<
|
3065
|
+
NumberField.DefaultOptions,
|
3066
|
+
{
|
3067
|
+
required: true;
|
3068
|
+
nullable: false;
|
3069
|
+
initial: 0;
|
3070
|
+
base: 0;
|
3071
|
+
min: 0;
|
3072
|
+
max: 360;
|
3073
|
+
validationError: "is not a number between 0 and 360";
|
3074
|
+
}
|
3075
|
+
>;
|
3076
|
+
|
3077
|
+
/**
|
3078
|
+
* A helper type for the given options type merged into the default options of the AngleField class.
|
3079
|
+
* @typeParam Options - the options that override the default options
|
3080
|
+
*/
|
3081
|
+
type MergedOptions<Options extends NumberFieldOptions> = SimpleMerge<DefaultOptions, Options>;
|
3082
|
+
|
3083
|
+
/**
|
3084
|
+
* A shorthand for the assignment type of a AngleField class.
|
3085
|
+
* @typeParam Options - the options that override the default options
|
3086
|
+
*/
|
3087
|
+
type AssignmentType<Options extends NumberFieldOptions> = DataField.DerivedAssignmentType<
|
3088
|
+
number,
|
3089
|
+
MergedOptions<Options>
|
3090
|
+
>;
|
3091
|
+
|
3092
|
+
/**
|
3093
|
+
* A shorthand for the initialized type of a AngleField class.
|
3094
|
+
* @typeParam Options - the options that override the default options
|
3095
|
+
*/
|
3096
|
+
type InitializedType<Options extends NumberFieldOptions> = DataField.DerivedInitializedType<
|
3097
|
+
number,
|
3098
|
+
MergedOptions<Options>
|
3099
|
+
>;
|
3100
|
+
}
|
3101
|
+
|
3102
|
+
/**
|
3103
|
+
* A special [NumberField]{@link NumberField} represents a number between 0 and 1.
|
3104
|
+
* @typeParam Options - the options of the AlphaField instance
|
3105
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the AlphaField
|
3106
|
+
* @typeParam InitializedType - the type of the initialized values of the AlphaField
|
3107
|
+
* @typeParam PersistedType - the type of the persisted values of the AlphaField
|
3108
|
+
* @remarks
|
3109
|
+
* Defaults:
|
3110
|
+
* AssignmentType: `number | null | undefined`
|
3111
|
+
* InitializedType: `number`
|
3112
|
+
* PersistedType: `number`
|
3113
|
+
* InitialValue: `1`
|
3114
|
+
*/
|
3115
|
+
declare class AlphaField<
|
3116
|
+
Options extends NumberFieldOptions = AlphaField.DefaultOptions,
|
3117
|
+
AssignmentType = AlphaField.AssignmentType<Options>,
|
3118
|
+
InitializedType = AlphaField.InitializedType<Options>,
|
3119
|
+
PersistedType extends number | null | undefined = AlphaField.InitializedType<Options>,
|
3120
|
+
> extends NumberField<Options, AssignmentType, InitializedType, PersistedType> {
|
3121
|
+
/** @defaultValue `true` */
|
3122
|
+
override required: boolean;
|
3123
|
+
|
3124
|
+
/** @defaultValue `false` */
|
3125
|
+
override nullable: boolean;
|
3126
|
+
|
3127
|
+
/** @defaultValue `1` */
|
3128
|
+
override initial: DataFieldOptions.InitialType<InitializedType>;
|
3129
|
+
|
3130
|
+
/** @defaultValue `0` */
|
3131
|
+
override min: number | undefined;
|
3132
|
+
|
3133
|
+
/** @defaultValue `1` */
|
3134
|
+
override max: number | undefined;
|
3135
|
+
|
3136
|
+
/** @defaultValue `"is not a number between 0 and 1"` */
|
3137
|
+
override validationError: string;
|
3138
|
+
|
3139
|
+
protected static override get _defaults(): NumberFieldOptions;
|
3140
|
+
}
|
3141
|
+
|
3142
|
+
declare namespace AlphaField {
|
3143
|
+
/** The type of the default options for the {@link AlphaField} class. */
|
3144
|
+
type DefaultOptions = SimpleMerge<
|
3145
|
+
NumberField.DefaultOptions,
|
3146
|
+
{
|
3147
|
+
required: true;
|
3148
|
+
nullable: false;
|
3149
|
+
initial: 1;
|
3150
|
+
min: 0;
|
3151
|
+
max: 1;
|
3152
|
+
validationError: "is not a number between 0 and 1";
|
3153
|
+
}
|
3154
|
+
>;
|
3155
|
+
|
3156
|
+
/**
|
3157
|
+
* A helper type for the given options type merged into the default options of the AlphaField class.
|
3158
|
+
* @typeParam Options - the options that override the default options
|
3159
|
+
*/
|
3160
|
+
type MergedOptions<Options extends NumberFieldOptions> = SimpleMerge<DefaultOptions, Options>;
|
3161
|
+
|
3162
|
+
/**
|
3163
|
+
* A shorthand for the assignment type of a AlphaField class.
|
3164
|
+
* @typeParam Options - the options that override the default options
|
3165
|
+
*/
|
3166
|
+
type AssignmentType<Options extends NumberFieldOptions> = DataField.DerivedAssignmentType<
|
3167
|
+
number,
|
3168
|
+
MergedOptions<Options>
|
3169
|
+
>;
|
3170
|
+
|
3171
|
+
/**
|
3172
|
+
* A shorthand for the initialized type of a AlphaField class.
|
3173
|
+
* @typeParam Options - the options that override the default options
|
3174
|
+
*/
|
3175
|
+
type InitializedType<Options extends NumberFieldOptions> = DataField.DerivedInitializedType<
|
3176
|
+
number,
|
3177
|
+
MergedOptions<Options>
|
3178
|
+
>;
|
3179
|
+
}
|
3180
|
+
|
3181
|
+
/**
|
3182
|
+
* A special [NumberField]{@link NumberField} represents a number between 0 (inclusive) and 1 (exclusive).
|
3183
|
+
* Its values are normalized (modulo 1) to the range [0, 1) instead of being clamped.
|
3184
|
+
*/
|
3185
|
+
declare class HueField<
|
3186
|
+
const Options extends NumberFieldOptions = NumberField.DefaultOptions,
|
3187
|
+
const AssignmentType = NumberField.AssignmentType<Options>,
|
3188
|
+
const InitializedType = NumberField.InitializedType<Options>,
|
3189
|
+
const PersistedType extends number | null | undefined = NumberField.InitializedType<Options>,
|
3190
|
+
> extends NumberField<Options, AssignmentType, InitializedType, PersistedType> {
|
3191
|
+
static get _defaults(): HueField.Options;
|
3192
|
+
|
3193
|
+
protected override _cast(value: AssignmentType): InitializedType;
|
3194
|
+
}
|
3195
|
+
|
3196
|
+
declare namespace HueField {
|
3197
|
+
type Options = NumberFieldOptions;
|
3198
|
+
|
3199
|
+
type DefaultOptions = SimpleMerge<
|
3200
|
+
NumberField.DefaultOptions,
|
3201
|
+
{
|
3202
|
+
required: true;
|
3203
|
+
nullable: false;
|
3204
|
+
initial: 0;
|
3205
|
+
min: 0;
|
3206
|
+
max: 1;
|
3207
|
+
validationError: "is not a number between 0 (inclusive) and 1 (exclusive)";
|
3208
|
+
}
|
3209
|
+
>;
|
3210
|
+
}
|
3211
|
+
|
3212
|
+
/**
|
3213
|
+
* A special [ObjectField]{@link ObjectField} which captures a mapping of User IDs to Document permission levels.
|
3214
|
+
* @typeParam Options - the options of the DocumentOwnershipField instance
|
3215
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the DocumentOwnershipField
|
3216
|
+
* @typeParam InitializedType - the type of the initialized values of the DocumentOwnershipField
|
3217
|
+
* @typeParam PersistedType - the type of the persisted values of the DocumentOwnershipField
|
3218
|
+
* @remarks
|
3219
|
+
* Defaults:
|
3220
|
+
* AssignmentType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS> | null | undefined`
|
3221
|
+
* InitializedType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS>`
|
3222
|
+
* PersistedType: `Record<string, DOCUMENT_OWNERSHIP_LEVELS>`
|
3223
|
+
* InitialValue: `{ default: DOCUMENT_OWNERSHIP_LEVELS.NONE }`
|
3224
|
+
*/
|
3225
|
+
declare class DocumentOwnershipField<
|
3226
|
+
Options extends DocumentOwnershipField.Options = DocumentOwnershipField.DefaultOptions,
|
3227
|
+
AssignmentType = DocumentOwnershipField.AssignmentType<Options>,
|
3228
|
+
InitializedType = DocumentOwnershipField.InitializedType<Options>,
|
3229
|
+
PersistedType extends
|
3230
|
+
| Record<string, DOCUMENT_OWNERSHIP_LEVELS>
|
3231
|
+
| null
|
3232
|
+
| undefined = DocumentOwnershipField.InitializedType<Options>,
|
3233
|
+
> extends ObjectField<Options, AssignmentType, InitializedType, PersistedType> {
|
3234
|
+
/** @defaultValue `{"default": DOCUMENT_OWNERSHIP_LEVELS.NONE}` */
|
3235
|
+
override initial: DataFieldOptions.InitialType<InitializedType>;
|
3236
|
+
|
3237
|
+
/** @defaultValue `"is not a mapping of user IDs and document permission levels"` */
|
3238
|
+
override validationError: string;
|
3239
|
+
|
3240
|
+
protected static override get _defaults(): DocumentOwnershipField.Options;
|
3241
|
+
|
3242
|
+
protected override _validateType(
|
3243
|
+
value: InitializedType,
|
3244
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
3245
|
+
): boolean | DataModelValidationFailure | void;
|
3246
|
+
}
|
3247
|
+
|
3248
|
+
declare namespace DocumentOwnershipField {
|
3249
|
+
/** A shorthand for the options of a DocumentOwnershipField class. */
|
3250
|
+
type Options = DataFieldOptions<Record<string, DOCUMENT_OWNERSHIP_LEVELS>>;
|
3251
|
+
|
3252
|
+
/** The type of the default options for the {@link DocumentOwnershipField} class. */
|
3253
|
+
type DefaultOptions = SimpleMerge<
|
3254
|
+
ObjectField.DefaultOptions,
|
3255
|
+
{
|
3256
|
+
initial: Record<string, DOCUMENT_OWNERSHIP_LEVELS>;
|
3257
|
+
validationError: "is not a mapping of user IDs and document permission levels";
|
3258
|
+
}
|
3259
|
+
>;
|
3260
|
+
|
3261
|
+
/**
|
3262
|
+
* A helper type for the given options type merged into the default options of the ObjectField class.
|
3263
|
+
* @typeParam Opts - the options that override the default options
|
3264
|
+
*/
|
3265
|
+
type MergedOptions<Opts extends Options> = SimpleMerge<DefaultOptions, Opts>;
|
3266
|
+
|
3267
|
+
/**
|
3268
|
+
* A shorthand for the assignment type of a ObjectField class.
|
3269
|
+
* @typeParam Opts - the options that override the default options
|
3270
|
+
*/
|
3271
|
+
type AssignmentType<Opts extends Options> = DataField.DerivedAssignmentType<
|
3272
|
+
Record<string, DOCUMENT_OWNERSHIP_LEVELS>,
|
3273
|
+
MergedOptions<Opts>
|
3274
|
+
>;
|
3275
|
+
|
3276
|
+
/**
|
3277
|
+
* A shorthand for the initialized type of a ObjectField class.
|
3278
|
+
* @typeParam Opts - the options that override the default options
|
3279
|
+
*/
|
3280
|
+
type InitializedType<Opts extends Options> = DataField.DerivedInitializedType<
|
3281
|
+
Record<string, DOCUMENT_OWNERSHIP_LEVELS>,
|
3282
|
+
MergedOptions<Opts>
|
3283
|
+
>;
|
3284
|
+
}
|
3285
|
+
|
3286
|
+
/**
|
3287
|
+
* A special [StringField]{@link StringField} which contains serialized JSON data.
|
3288
|
+
* @typeParam Options - the options of the JSONField instance
|
3289
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the JSONField
|
3290
|
+
* @typeParam InitializedType - the type of the initialized values of the JSONField
|
3291
|
+
* @typeParam PersistedType - the type of the persisted values of the JSONField
|
3292
|
+
* @remarks
|
3293
|
+
* Defaults:
|
3294
|
+
* AssignmentType: `string | null | undefined`
|
3295
|
+
* InitializedType: `object | undefined`
|
3296
|
+
* PersistedType: `string | undefined`
|
3297
|
+
* InitialValue: `undefined`
|
3298
|
+
*/
|
3299
|
+
declare class JSONField<
|
3300
|
+
// 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.
|
3301
|
+
Options extends StringFieldOptions = JSONField.DefaultOptions,
|
3302
|
+
AssignmentType = JSONField.AssignmentType<Options>,
|
3303
|
+
InitializedType = JSONField.InitializedType<Options>,
|
3304
|
+
PersistedType extends string | null | undefined = JSONField.PersistedType<Options>,
|
3305
|
+
> extends StringField<Options, AssignmentType, InitializedType, PersistedType> {
|
3306
|
+
constructor(options?: Options, context?: DataField.Context);
|
3307
|
+
|
3308
|
+
/** @defaultValue `false` */
|
3309
|
+
override blank: boolean;
|
3310
|
+
|
3311
|
+
/** @defaultValue `undefined` */
|
3312
|
+
override initial: DataFieldOptions.InitialType<InitializedType>;
|
3313
|
+
|
3314
|
+
/** @defaultValue `"is not a valid JSON string"` */
|
3315
|
+
override validationError: string;
|
3316
|
+
|
3317
|
+
protected static override get _defaults(): StringFieldOptions;
|
3318
|
+
|
3319
|
+
override clean(value: AssignmentType, options?: DataField.CleanOptions): InitializedType;
|
3320
|
+
|
3321
|
+
protected override _validateType(
|
3322
|
+
value: InitializedType,
|
3323
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
3324
|
+
): boolean | DataModelValidationFailure | void;
|
3325
|
+
|
3326
|
+
override initialize(
|
3327
|
+
value: PersistedType,
|
3328
|
+
model: DataModel.Any,
|
3329
|
+
options?: AnyObject,
|
3330
|
+
): InitializedType | (() => InitializedType | null);
|
3331
|
+
|
3332
|
+
override toObject(value: InitializedType): PersistedType;
|
3333
|
+
|
3334
|
+
// These verbose overloads are because otherwise there would be a misleading errors about `choices` being required without mentioning `options` or vice versa.
|
3335
|
+
toFormGroup(
|
3336
|
+
groupConfig?: DataField.GroupConfig,
|
3337
|
+
inputConfig?: DataField.ToInputConfig<InitializedType> | DataField.ToInputConfigWithOptions<InitializedType>,
|
3338
|
+
): HTMLDivElement;
|
3339
|
+
toFormGroup(
|
3340
|
+
groupConfig?: DataField.GroupConfig,
|
3341
|
+
inputConfig?: DataField.ToInputConfigWithChoices<InitializedType, Options["choices"]>,
|
3342
|
+
): HTMLDivElement;
|
3343
|
+
|
3344
|
+
toInput(
|
3345
|
+
config?: DataField.ToInputConfig<InitializedType> | DataField.ToInputConfigWithOptions<InitializedType>,
|
3346
|
+
): HTMLElement | HTMLCollection;
|
3347
|
+
toInput(
|
3348
|
+
config?: DataField.ToInputConfigWithChoices<InitializedType, Options["choices"]>,
|
3349
|
+
): HTMLElement | HTMLCollection;
|
3350
|
+
|
3351
|
+
protected override _toInput(
|
3352
|
+
config: DataField.ToInputConfig<InitializedType> | DataField.ToInputConfigWithOptions<InitializedType>,
|
3353
|
+
): HTMLElement | HTMLCollection;
|
3354
|
+
protected override _toInput(
|
3355
|
+
config: DataField.ToInputConfigWithChoices<InitializedType, Options["choices"]>,
|
3356
|
+
): HTMLElement | HTMLCollection;
|
3357
|
+
}
|
3358
|
+
|
3359
|
+
declare namespace JSONField {
|
3360
|
+
/** The type of the default options for the {@link JSONField} class. */
|
3361
|
+
type DefaultOptions = SimpleMerge<
|
3362
|
+
StringField.DefaultOptions,
|
3363
|
+
{
|
3364
|
+
blank: false;
|
3365
|
+
initial: undefined;
|
3366
|
+
validationError: "is not a valid JSON string";
|
3367
|
+
}
|
3368
|
+
>;
|
3369
|
+
|
3370
|
+
/**
|
3371
|
+
* A helper type for the given options type merged into the default options of the JSONField class.
|
3372
|
+
* @typeParam Options - the options that override the default options
|
3373
|
+
*/
|
3374
|
+
type MergedOptions<Options extends StringFieldOptions> = SimpleMerge<DefaultOptions, Options>;
|
3375
|
+
|
3376
|
+
/**
|
3377
|
+
* A shorthand for the assignment type of a JSONField class.
|
3378
|
+
* @typeParam Options - the options that override the default options
|
3379
|
+
*/
|
3380
|
+
type AssignmentType<Options extends StringFieldOptions> = DataField.DerivedAssignmentType<
|
3381
|
+
string,
|
3382
|
+
MergedOptions<Options>
|
3383
|
+
>;
|
3384
|
+
|
3385
|
+
/**
|
3386
|
+
* A shorthand for the initialized type of a JSONField class.
|
3387
|
+
* @typeParam Options - the options that override the default options
|
3388
|
+
*/
|
3389
|
+
type InitializedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
|
3390
|
+
AnyObject,
|
3391
|
+
MergedOptions<Options>
|
3392
|
+
>;
|
3393
|
+
|
3394
|
+
/**
|
3395
|
+
* A shorthand for the persisted type of a JSONField class.
|
3396
|
+
* @typeParam Options - the options that override the default options
|
3397
|
+
*/
|
3398
|
+
type PersistedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
|
3399
|
+
string,
|
3400
|
+
MergedOptions<Options>
|
3401
|
+
>;
|
3402
|
+
}
|
3403
|
+
|
3404
|
+
/**
|
3405
|
+
* A special subclass of {@link DataField} which can contain any value of any type.
|
3406
|
+
* Any input is accepted and is treated as valid.
|
3407
|
+
* It is not recommended to use this class except for very specific circumstances.
|
3408
|
+
*/
|
3409
|
+
// TODO(LukeAbby): This field effectively removes all options because there's no point asking for an options when none of them do anything.
|
3410
|
+
declare class AnyField extends DataField<DataFieldOptions.Any, unknown, unknown, unknown> {
|
3411
|
+
override _cast(value: unknown): unknown;
|
3412
|
+
|
3413
|
+
protected override _validateType(
|
3414
|
+
value: unknown,
|
3415
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
3416
|
+
): boolean | DataModelValidationFailure | void;
|
3417
|
+
}
|
3418
|
+
|
3419
|
+
/**
|
3420
|
+
* A subclass of [StringField]{@link StringField} which contains a sanitized HTML string.
|
3421
|
+
* This class does not override any StringField behaviors, but is used by the server-side to identify fields which
|
3422
|
+
* require sanitization of user input.
|
3423
|
+
* @typeParam Options - the options of the HTMLField instance
|
3424
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the HTMLField
|
3425
|
+
* @typeParam InitializedType - the type of the initialized values of the HTMLField
|
3426
|
+
* @typeParam PersistedType - the type of the persisted values of the HTMLField
|
3427
|
+
* @remarks
|
3428
|
+
* Defaults:
|
3429
|
+
* AssignmentType: `string | null | undefined`
|
3430
|
+
* InitializedType: `string`
|
3431
|
+
* PersistedType: `string`
|
3432
|
+
* InitialValue: `""`
|
3433
|
+
*/
|
3434
|
+
declare class HTMLField<
|
3435
|
+
Options extends StringFieldOptions = HTMLField.DefaultOptions,
|
3436
|
+
AssignmentType = HTMLField.AssignmentType<Options>,
|
3437
|
+
InitializedType = HTMLField.InitializedType<Options>,
|
3438
|
+
PersistedType extends string | null | undefined = HTMLField.InitializedType<Options>,
|
3439
|
+
> extends StringField<Options, AssignmentType, InitializedType, PersistedType> {
|
3440
|
+
/** @defaultValue `true` */
|
3441
|
+
override required: boolean;
|
3442
|
+
|
3443
|
+
/** @defaultValue `true` */
|
3444
|
+
override blank: boolean;
|
3445
|
+
|
3446
|
+
protected static override get _defaults(): StringFieldOptions;
|
3447
|
+
|
3448
|
+
// These verbose overloads are because otherwise there would be a misleading errors about `choices` being required without mentioning `options` or vice versa.
|
3449
|
+
toFormGroup(
|
3450
|
+
groupConfig?: HTMLField.GroupConfig,
|
3451
|
+
inputConfig?: DataField.ToInputConfig<InitializedType> | DataField.ToInputConfigWithOptions<InitializedType>,
|
3452
|
+
): HTMLDivElement;
|
3453
|
+
toFormGroup(
|
3454
|
+
groupConfig?: HTMLField.GroupConfig,
|
3455
|
+
inputConfig?: DataField.ToInputConfigWithChoices<InitializedType, Options["choices"]>,
|
3456
|
+
): HTMLDivElement;
|
3457
|
+
|
3458
|
+
toInput(
|
3459
|
+
config?: DataField.ToInputConfig<InitializedType> | DataField.ToInputConfigWithOptions<InitializedType>,
|
3460
|
+
): HTMLElement | HTMLCollection;
|
3461
|
+
toInput(
|
3462
|
+
config?: DataField.ToInputConfigWithChoices<InitializedType, Options["choices"]>,
|
3463
|
+
): HTMLElement | HTMLCollection;
|
3464
|
+
|
3465
|
+
protected override _toInput(
|
3466
|
+
config: DataField.ToInputConfig<InitializedType> | DataField.ToInputConfigWithOptions<InitializedType>,
|
3467
|
+
): HTMLElement | HTMLCollection;
|
3468
|
+
protected override _toInput(
|
3469
|
+
config: DataField.ToInputConfigWithChoices<InitializedType, Options["choices"]>,
|
3470
|
+
): HTMLElement | HTMLCollection;
|
3471
|
+
}
|
3472
|
+
|
3473
|
+
declare namespace HTMLField {
|
3474
|
+
/** The type of the default options for the {@link HTMLField} class. */
|
3475
|
+
type DefaultOptions = SimpleMerge<
|
3476
|
+
StringField.DefaultOptions,
|
3477
|
+
{
|
3478
|
+
required: true;
|
3479
|
+
blank: true;
|
3480
|
+
}
|
3481
|
+
>;
|
3482
|
+
|
3483
|
+
/**
|
3484
|
+
* A helper type for the given options type merged into the default options of the HTMLField class.
|
3485
|
+
* @typeParam Options - the options that override the default options
|
3486
|
+
*/
|
3487
|
+
type MergedOptions<Options extends StringFieldOptions> = SimpleMerge<DefaultOptions, Options>;
|
3488
|
+
|
3489
|
+
/**
|
3490
|
+
* A shorthand for the assignment type of a HTMLField class.
|
3491
|
+
* @typeParam Options - the options that override the default options
|
3492
|
+
*/
|
3493
|
+
type AssignmentType<Options extends StringFieldOptions> = DataField.DerivedAssignmentType<
|
3494
|
+
string,
|
3495
|
+
MergedOptions<Options>
|
3496
|
+
>;
|
3497
|
+
|
3498
|
+
/**
|
3499
|
+
* A shorthand for the initialized type of a HTMLField class.
|
3500
|
+
* @typeParam Options - the options that override the default options
|
3501
|
+
*/
|
3502
|
+
type InitializedType<Options extends StringFieldOptions> = DataField.DerivedInitializedType<
|
3503
|
+
string,
|
3504
|
+
MergedOptions<Options>
|
3505
|
+
>;
|
3506
|
+
|
3507
|
+
// `HTMLField#toFormGroup` provides a default by way of `groupConfig.stacked ??= true`.
|
3508
|
+
interface GroupConfig extends NullishProps<DataField.GroupConfig, "stacked"> {}
|
3509
|
+
}
|
3510
|
+
|
3511
|
+
/**
|
3512
|
+
* A subclass of {@link NumberField} which is used for storing integer sort keys.
|
3513
|
+
* @typeParam Options - the options of the IntegerSortField instance
|
3514
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the IntegerSortField
|
3515
|
+
* @typeParam InitializedType - the type of the initialized values of the IntegerSortField
|
3516
|
+
* @typeParam PersistedType - the type of the persisted values of the IntegerSortField
|
3517
|
+
* @remarks
|
3518
|
+
* Defaults:
|
3519
|
+
* AssignmentType: `number | null | undefined`
|
3520
|
+
* InitializedType: `number`
|
3521
|
+
* PersistedType: `number`
|
3522
|
+
* InitialValue: `0`
|
3523
|
+
*/
|
3524
|
+
declare class IntegerSortField<
|
3525
|
+
Options extends NumberFieldOptions = IntegerSortField.DefaultOptions,
|
3526
|
+
AssignmentType = IntegerSortField.AssignmentType<Options>,
|
3527
|
+
InitializedType = IntegerSortField.InitializedType<Options>,
|
3528
|
+
PersistedType extends number | null | undefined = IntegerSortField.InitializedType<Options>,
|
3529
|
+
> extends NumberField<Options, AssignmentType, InitializedType, PersistedType> {
|
3530
|
+
/** @defaultValue `true` */
|
3531
|
+
override required: boolean;
|
3532
|
+
|
3533
|
+
/** @defaultValue `false` */
|
3534
|
+
override nullable: boolean;
|
3535
|
+
|
3536
|
+
/** @defaultValue `true` */
|
3537
|
+
override integer: boolean;
|
3538
|
+
|
3539
|
+
/** @defaultValue `0` */
|
3540
|
+
override initial: DataFieldOptions.InitialType<InitializedType>;
|
3541
|
+
|
3542
|
+
/** @defaultValue `"FOLDER.DocumentSort"` */
|
3543
|
+
override label: string;
|
3544
|
+
|
3545
|
+
/** @defaultValue `"FOLDER.DocumentSortHint"` */
|
3546
|
+
override hint: string;
|
3547
|
+
}
|
3548
|
+
|
3549
|
+
declare namespace IntegerSortField {
|
3550
|
+
/** The type of the default options for the {@link IntegerSortField} class. */
|
3551
|
+
type DefaultOptions = SimpleMerge<
|
3552
|
+
DataField.DefaultOptions,
|
3553
|
+
{
|
3554
|
+
required: true;
|
3555
|
+
nullable: false;
|
3556
|
+
integer: true;
|
3557
|
+
initial: 0;
|
3558
|
+
label: "FOLDER.DocumentSort";
|
3559
|
+
hint: "FOLDER.DocumentSortHint";
|
3560
|
+
}
|
3561
|
+
>;
|
3562
|
+
|
3563
|
+
/**
|
3564
|
+
* A helper type for the given options type merged into the default options of the IntegerSortField class.
|
3565
|
+
* @typeParam Options - the options that override the default options
|
3566
|
+
*/
|
3567
|
+
type MergedOptions<Options extends NumberFieldOptions> = SimpleMerge<DefaultOptions, Options>;
|
3568
|
+
|
3569
|
+
/**
|
3570
|
+
* A shorthand for the assignment type of a IntegerSortField class.
|
3571
|
+
* @typeParam Options - the options that override the default options
|
3572
|
+
*/
|
3573
|
+
type AssignmentType<Options extends NumberFieldOptions> = DataField.DerivedAssignmentType<
|
3574
|
+
number,
|
3575
|
+
MergedOptions<Options>
|
3576
|
+
>;
|
3577
|
+
|
3578
|
+
/**
|
3579
|
+
* A shorthand for the initialized type of a IntegerSortField class.
|
3580
|
+
* @typeParam Options - the options that override the default options
|
3581
|
+
*/
|
3582
|
+
type InitializedType<Options extends NumberFieldOptions> = DataField.DerivedInitializedType<
|
3583
|
+
number,
|
3584
|
+
MergedOptions<Options>
|
3585
|
+
>;
|
3586
|
+
}
|
3587
|
+
|
3588
|
+
declare global {
|
3589
|
+
type DocumentStats = DocumentStatsField.Properties;
|
3590
|
+
}
|
3591
|
+
|
3592
|
+
/**
|
3593
|
+
* A subclass of {@link SchemaField} which stores document metadata in the _stats field.
|
3594
|
+
* @typeParam Options - the options of the DocumentStatsField instance
|
3595
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the DocumentStatsField
|
3596
|
+
* @typeParam InitializedType - the type of the initialized values of the DocumentStatsField
|
3597
|
+
* @typeParam PersistedType - the type of the persisted values of the DocumentStatsField
|
3598
|
+
* @remarks
|
3599
|
+
* Defaults:
|
3600
|
+
* AssignmentType: `Partial<DocumentStats> | null | undefined`
|
3601
|
+
* InitializedType: `DocumentStats`
|
3602
|
+
* PersistedType: `object`
|
3603
|
+
* InitialValue:
|
3604
|
+
* ```typescript
|
3605
|
+
* {
|
3606
|
+
* systemId: null,
|
3607
|
+
* systemVersion: null,
|
3608
|
+
* coreVersion: null,
|
3609
|
+
* createdTime: null,
|
3610
|
+
* modifiedTime: null,
|
3611
|
+
* lastModifiedBy: null
|
3612
|
+
* }
|
3613
|
+
* ```
|
3614
|
+
*/
|
3615
|
+
declare class DocumentStatsField<
|
3616
|
+
Options extends DocumentStatsField.Options = DocumentStatsField.DefaultOptions,
|
3617
|
+
AssignmentType = DocumentStatsField.AssignmentType<Options>,
|
3618
|
+
InitializedType = DocumentStatsField.InitializedType<Options>,
|
3619
|
+
PersistedType extends AnyObject | null | undefined = DocumentStatsField.PersistedType<Options>,
|
3620
|
+
> extends SchemaField<DocumentStatsField.Schema, Options, AssignmentType, InitializedType, PersistedType> {
|
3621
|
+
constructor(options?: Options);
|
3622
|
+
}
|
3623
|
+
|
3624
|
+
declare namespace DocumentStatsField {
|
3625
|
+
/** A shorthand for the options of a DocumentStatsField class. */
|
3626
|
+
type Options = DataFieldOptions<SchemaField.InnerAssignmentType<Schema>>;
|
3627
|
+
|
3628
|
+
/** The type of the default options for the {@link DocumentStatsField} class. */
|
3629
|
+
type DefaultOptions = SimpleMerge<SchemaField.DefaultOptions, { initial: SchemaField.InnerAssignmentType<Schema> }>;
|
3630
|
+
|
3631
|
+
/**
|
3632
|
+
* A helper type for the given options type merged into the default options of the {@link DocumentStatsField} class.
|
3633
|
+
* @typeParam Opts - the options that override the default options
|
3634
|
+
*/
|
3635
|
+
type MergedOptions<Opts extends Options> = SimpleMerge<DefaultOptions, Opts>;
|
3636
|
+
|
3637
|
+
/**
|
3638
|
+
* A shorthand for the assignment type of a DocumentStatsField class.
|
3639
|
+
* @typeParam Opts - the options that override the default options
|
3640
|
+
*/
|
3641
|
+
type AssignmentType<Opts extends Options = DefaultOptions> = DataField.DerivedAssignmentType<
|
3642
|
+
SchemaField.InnerAssignmentType<Schema>,
|
3643
|
+
MergedOptions<Opts>
|
3644
|
+
>;
|
3645
|
+
|
3646
|
+
/**
|
3647
|
+
* A shorthand for the assignment type of a DocumentStatsField class.
|
3648
|
+
* @typeParam Opts - the options that override the default options
|
3649
|
+
*/
|
3650
|
+
type InitializedType<Opts extends Options = DefaultOptions> = DataField.DerivedInitializedType<
|
3651
|
+
SchemaField.InnerInitializedType<Schema>,
|
3652
|
+
MergedOptions<Opts>
|
3653
|
+
>;
|
3654
|
+
|
3655
|
+
/**
|
3656
|
+
* A shorthand for the assignment type of a DocumentStatsField class.
|
3657
|
+
* @typeParam Opts - the options that override the default options
|
3658
|
+
*/
|
3659
|
+
type PersistedType<Opts extends Options = DefaultOptions> = DataField.DerivedInitializedType<
|
3660
|
+
SchemaField.InnerPersistedType<Schema>,
|
3661
|
+
MergedOptions<Opts>
|
3662
|
+
>;
|
3663
|
+
|
3664
|
+
type ConstructorData = SchemaField.InnerConstructorType<Schema>;
|
3665
|
+
type Properties = SchemaField.InnerInitializedType<Schema>;
|
3666
|
+
type Source = SchemaField.InnerPersistedType<Schema>;
|
3667
|
+
|
3668
|
+
interface Schema extends DataSchema {
|
3669
|
+
/**
|
3670
|
+
* The core version the Document was created in.
|
3671
|
+
* @defaultValue `null`
|
3672
|
+
*/
|
3673
|
+
coreVersion: StringField<{ required: true; blank: false; nullable: true; initial: null }>;
|
3674
|
+
|
3675
|
+
/**
|
3676
|
+
* The package name of the system the Document was created in.
|
3677
|
+
* @defaultValue `null`
|
3678
|
+
*/
|
3679
|
+
systemId: StringField<{ required: true; blank: false; nullable: true; initial: null }>;
|
3680
|
+
|
3681
|
+
/**
|
3682
|
+
* The version of the system the Document was created in.
|
3683
|
+
* @defaultValue `null`
|
3684
|
+
*/
|
3685
|
+
systemVersion: StringField<{ required: true; blank: false; nullable: true; initial: null }>;
|
3686
|
+
|
3687
|
+
/**
|
3688
|
+
* A timestamp of when the Document was created.
|
3689
|
+
* @defaultValue `null`
|
3690
|
+
*/
|
3691
|
+
createdTime: NumberField;
|
3692
|
+
|
3693
|
+
/**
|
3694
|
+
* A timestamp of when the Document was last modified.
|
3695
|
+
* @defaultValue `null`
|
3696
|
+
*/
|
3697
|
+
modifiedTime: NumberField;
|
3698
|
+
|
3699
|
+
/**
|
3700
|
+
* The ID of the user who last modified the Document.
|
3701
|
+
* @defaultValue `null`
|
3702
|
+
*/
|
3703
|
+
lastModifiedBy: ForeignDocumentField<typeof foundry.documents.BaseUser, { idOnly: true }>;
|
3704
|
+
|
3705
|
+
compendiumSource: DocumentUUIDField;
|
3706
|
+
duplicateSource: DocumentUUIDField;
|
3707
|
+
}
|
3708
|
+
}
|
3709
|
+
|
3710
|
+
/**
|
3711
|
+
* A subclass of [StringField]{@link StringField} that is used specifically for the Document "type" field.
|
3712
|
+
*/
|
3713
|
+
declare class DocumentTypeField<
|
3714
|
+
const ConcreteDocumentClass extends Document.AnyConstructor,
|
3715
|
+
const Options extends DocumentTypeField.Options = DocumentTypeField.DefaultOptions,
|
3716
|
+
const AssignmentType = DocumentTypeField.AssignmentType<ConcreteDocumentClass, Options>,
|
3717
|
+
const InitializedType = DocumentTypeField.InitializedType<ConcreteDocumentClass, Options>,
|
3718
|
+
const PersistedType extends string | null | undefined = DocumentTypeField.InitializedType<
|
3719
|
+
ConcreteDocumentClass,
|
3720
|
+
Options
|
3721
|
+
>,
|
3722
|
+
> extends StringField<
|
3723
|
+
DocumentTypeField.MergedOptions<ConcreteDocumentClass, Options>,
|
3724
|
+
AssignmentType,
|
3725
|
+
InitializedType,
|
3726
|
+
PersistedType
|
3727
|
+
> {
|
3728
|
+
/**
|
3729
|
+
* @param documentClass - The base document class which belongs in this field
|
3730
|
+
* @param options - Options which configure the behavior of the field
|
3731
|
+
* @param context - Additional context which describes the field
|
3732
|
+
*/
|
3733
|
+
constructor(documentClass: ConcreteDocumentClass, options: DocumentTypeField.Options, context?: DataField.Context);
|
3734
|
+
|
3735
|
+
static override get _defaults(): DocumentTypeField.Options;
|
3736
|
+
|
3737
|
+
protected override _validateType(
|
3738
|
+
value: InitializedType,
|
3739
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
3740
|
+
): boolean | DataModelValidationFailure | void;
|
3741
|
+
}
|
3742
|
+
|
3743
|
+
declare namespace DocumentTypeField {
|
3744
|
+
/** The type of the default options for the {@link DocumentTypeField} class. */
|
3745
|
+
type DefaultOptions = SimpleMerge<
|
3746
|
+
StringField.DefaultOptions,
|
3747
|
+
{
|
3748
|
+
required: true;
|
3749
|
+
nullable: false;
|
3750
|
+
blank: false;
|
3751
|
+
}
|
3752
|
+
>;
|
3753
|
+
|
3754
|
+
interface Options extends StringFieldOptions {}
|
3755
|
+
|
3756
|
+
// TODO(LukeAbby): This class has effectively removed `choices` and `validationError` since they're unconditionally set in the constructor.
|
3757
|
+
type MergedOptions<
|
3758
|
+
ConcreteDocumentClass extends Document.AnyConstructor,
|
3759
|
+
Options extends StringFieldOptions,
|
3760
|
+
> = SimpleMerge<
|
3761
|
+
SimpleMerge<DefaultOptions, Options>,
|
3762
|
+
{
|
3763
|
+
choices: () => ConcreteDocumentClass["TYPES"];
|
3764
|
+
validationError: string;
|
3765
|
+
}
|
3766
|
+
>;
|
3767
|
+
|
3768
|
+
type AssignmentType<
|
3769
|
+
ConcreteDocumentClass extends Document.AnyConstructor,
|
3770
|
+
Options extends StringFieldOptions,
|
3771
|
+
> = StringField.AssignmentType<MergedOptions<ConcreteDocumentClass, Options>>;
|
3772
|
+
type InitializedType<
|
3773
|
+
ConcreteDocumentClass extends Document.AnyConstructor,
|
3774
|
+
Options extends StringFieldOptions,
|
3775
|
+
> = StringField.InitializedType<MergedOptions<ConcreteDocumentClass, Options>>;
|
3776
|
+
type PersistedType<
|
3777
|
+
ConcreteDocumentClass extends Document.AnyConstructor,
|
3778
|
+
Options extends StringFieldOptions,
|
3779
|
+
> = StringField.InitializedType<MergedOptions<ConcreteDocumentClass, Options>>;
|
3780
|
+
}
|
3781
|
+
|
3782
|
+
/**
|
3783
|
+
* A subclass of [ObjectField]{@link ObjectField} which supports a type-specific data object.
|
3784
|
+
* @typeParam DocumentType - the type of the embedded Document
|
3785
|
+
* @typeParam Options - the options of the TypeDataField instance
|
3786
|
+
* @typeParam AssignmentType - the type of the allowed assignment values of the TypeDataField
|
3787
|
+
* @typeParam InitializedType - the type of the initialized values of the TypeDataField
|
3788
|
+
* @typeParam PersistedType - the type of the persisted values of the TypeDataField
|
3789
|
+
* @remarks
|
3790
|
+
* Defaults:
|
3791
|
+
* AssignmentType: `SchemaField.AssignmentType<DocumentType["schema"]["fields"]> | null | undefined`
|
3792
|
+
* InitializedType: `SchemaField.InitializedType<DocumentType["schema"]["fields"]>`
|
3793
|
+
* PersistedType: `SchemaField.PersistedType<DocumentType["schema"]["fields"]>`
|
3794
|
+
* InitialValue: `{}`
|
3795
|
+
*/
|
3796
|
+
declare class TypeDataField<
|
3797
|
+
const SystemDocument extends Document.SystemConstructor,
|
3798
|
+
const Options extends TypeDataField.Options<SystemDocument> = TypeDataField.DefaultOptions,
|
3799
|
+
const AssignmentType = TypeDataField.AssignmentType<SystemDocument, Options>,
|
3800
|
+
const InitializedType = TypeDataField.InitializedType<SystemDocument, Options>,
|
3801
|
+
const PersistedType extends AnyObject | null | undefined = TypeDataField.PersistedType<SystemDocument, Options>,
|
3802
|
+
> extends ObjectField<Options, AssignmentType, InitializedType, PersistedType> {
|
3803
|
+
/**
|
3804
|
+
* @param document - The base document class which belongs in this field
|
3805
|
+
* @param options - Options which configure the behavior of the field
|
3806
|
+
*/
|
3807
|
+
constructor(document: SystemDocument, options?: Options);
|
3808
|
+
|
3809
|
+
/** @defaultValue `true` */
|
3810
|
+
override required: boolean;
|
3811
|
+
|
3812
|
+
/**
|
3813
|
+
* The canonical document name of the document type which belongs in this field
|
3814
|
+
*/
|
3815
|
+
document: SystemDocument;
|
3816
|
+
|
3817
|
+
protected static override get _defaults(): TypeDataField.Options<Document.SystemConstructor>;
|
3818
|
+
|
3819
|
+
/** @defaultValue `true` */
|
3820
|
+
static override recursive: boolean;
|
3821
|
+
|
3822
|
+
/**
|
3823
|
+
* Return the package that provides the sub-type for the given model.
|
3824
|
+
* @param model - The model instance created for this sub-type.
|
3825
|
+
*/
|
3826
|
+
static getModelProvider(model: DataModel.Any): System | Module | null;
|
3827
|
+
|
3828
|
+
/**
|
3829
|
+
* A convenience accessor for the name of the document type associated with this TypeDataField
|
3830
|
+
*/
|
3831
|
+
get documentName(): string;
|
3832
|
+
|
3833
|
+
/**
|
3834
|
+
* Get the DataModel definition that should be used for this type of document.
|
3835
|
+
* @param type - The Document instance type
|
3836
|
+
* @returns The DataModel class or null
|
3837
|
+
*/
|
3838
|
+
getModelForType(type: string): DataModel.AnyConstructor | null;
|
3839
|
+
|
3840
|
+
override getInitialValue(data: { type?: string }): InitializedType;
|
3841
|
+
|
3842
|
+
protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
|
3843
|
+
|
3844
|
+
override initialize(
|
3845
|
+
value: PersistedType,
|
3846
|
+
model: DataModel.Any,
|
3847
|
+
options?: AnyObject,
|
3848
|
+
): InitializedType | (() => InitializedType | null);
|
3849
|
+
|
3850
|
+
protected override _validateType(
|
3851
|
+
value: InitializedType,
|
3852
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
3853
|
+
): boolean | DataModelValidationFailure | void;
|
3854
|
+
|
3855
|
+
protected override _validateModel(data: AnyObject, options?: AnyObject): void;
|
3856
|
+
|
3857
|
+
override toObject(value: InitializedType): PersistedType;
|
3858
|
+
|
3859
|
+
/**
|
3860
|
+
* Migrate this field's candidate source data.
|
3861
|
+
* @param sourceData - Candidate source data of the root model
|
3862
|
+
* @param fieldData - The value of this field within the source data
|
3863
|
+
*/
|
3864
|
+
migrateSource(sourceData: AnyObject, fieldData: unknown): unknown;
|
3865
|
+
}
|
3866
|
+
|
3867
|
+
declare namespace TypeDataField {
|
3868
|
+
/**
|
3869
|
+
* A shorthand for the options of a TypeDataField class.
|
3870
|
+
* @typeParam DocumentType - the type of the embedded Document
|
3871
|
+
*/
|
3872
|
+
type Options<DocumentType extends Document.SystemConstructor> = DataFieldOptions<
|
3873
|
+
SchemaField.InnerAssignmentType<DataModel.SchemaOfClass<DocumentType>>
|
3874
|
+
>;
|
3875
|
+
|
3876
|
+
/** The type of the default options for the {@link TypeDataField} class. */
|
3877
|
+
type DefaultOptions = SimpleMerge<
|
3878
|
+
ObjectField.DefaultOptions,
|
3879
|
+
{
|
3880
|
+
required: true;
|
3881
|
+
}
|
3882
|
+
>;
|
3883
|
+
|
3884
|
+
/**
|
3885
|
+
* A helper type for the given options type merged into the default options of the TypeDataField class.
|
3886
|
+
* @typeParam DocumentType - the type of the embedded Document
|
3887
|
+
* @typeParam Options - the options that override the default options
|
3888
|
+
*/
|
3889
|
+
type MergedOptions<DocumentType extends Document.SystemConstructor, Opts extends Options<DocumentType>> = SimpleMerge<
|
3890
|
+
DefaultOptions,
|
3891
|
+
Opts
|
3892
|
+
>;
|
3893
|
+
|
3894
|
+
/**
|
3895
|
+
* Get the system DataModel configuration for a specific document type.
|
3896
|
+
* @typeParam DocumentType - the type of the Document this system data is for
|
3897
|
+
*/
|
3898
|
+
type Config<DocumentType extends Document.SystemConstructor> =
|
3899
|
+
DocumentType["metadata"]["name"] extends keyof DataModelConfig
|
3900
|
+
? DataModelConfig[DocumentType["metadata"]["name"]]
|
3901
|
+
: EmptyObject;
|
3902
|
+
|
3903
|
+
/**
|
3904
|
+
* Get the configured core and system type names for a specific document type.
|
3905
|
+
* @typeParam ConcreteDocument - the type of the Document this data is for
|
3906
|
+
* @deprecated Use the Game.Model namespace instead of TypeDataField
|
3907
|
+
*/
|
3908
|
+
type TypeNames<ConcreteDocument extends Document.SystemConstructor> = Game.Model.TypeNames<
|
3909
|
+
ConcreteDocument["metadata"]["name"]
|
3910
|
+
>;
|
3911
|
+
|
3912
|
+
/**
|
3913
|
+
* Get the core type names for a specific document type.
|
3914
|
+
* @typeParam DocumentType - the type of the Document this data is for
|
3915
|
+
* @deprecated Use `DocumentType["metadata"]["coreTypes"][number]`
|
3916
|
+
*/
|
3917
|
+
type CoreTypeNames<DocumentType extends Document.SystemConstructor> = DocumentType["metadata"]["coreTypes"][number];
|
3918
|
+
|
3919
|
+
/**
|
3920
|
+
* A shorthand for the assignment type of a TypeDataField class.
|
3921
|
+
* @typeParam DocumentType - the type of the embedded Document
|
3922
|
+
* @typeParam Options - the options that override the default options
|
3923
|
+
*/
|
3924
|
+
type AssignmentType<
|
3925
|
+
SystemDocumentConstructor extends Document.SystemConstructor,
|
3926
|
+
Opts extends Options<InstanceType<SystemDocumentConstructor>>,
|
3927
|
+
> = DataField.DerivedAssignmentType<AnyObject, MergedOptions<InstanceType<SystemDocumentConstructor>, Opts>>;
|
3928
|
+
|
3929
|
+
/**
|
3930
|
+
* A shorthand for the initialized type of a TypeDataField class.
|
3931
|
+
* @typeParam DocumentType - the type of the embedded Document
|
3932
|
+
* @typeParam Options - the options that override the default options
|
3933
|
+
*/
|
3934
|
+
type InitializedType<
|
3935
|
+
SystemDocumentConstructor extends Document.SystemConstructor,
|
3936
|
+
Opts extends Options<InstanceType<SystemDocumentConstructor>>,
|
3937
|
+
> = DataField.DerivedInitializedType<
|
3938
|
+
ValueOf<Config<SystemDocumentConstructor>> | AnyObject,
|
3939
|
+
MergedOptions<InstanceType<SystemDocumentConstructor>, Opts>
|
3940
|
+
>;
|
3941
|
+
|
3942
|
+
/**
|
3943
|
+
* A shorthand for the persisted type of a TypeDataField class.
|
3944
|
+
* @typeParam DocumentType - the type of the embedded Document
|
3945
|
+
* @typeParam Opts - the options that override the default options
|
3946
|
+
*/
|
3947
|
+
type PersistedType<
|
3948
|
+
SystemDocumentConstructor extends Document.SystemConstructor,
|
3949
|
+
Opts extends Options<InstanceType<SystemDocumentConstructor>>,
|
3950
|
+
> = DataField.DerivedInitializedType<AnyObject, MergedOptions<InstanceType<SystemDocumentConstructor>, Opts>>;
|
3951
|
+
}
|
3952
|
+
|
3953
|
+
/**
|
3954
|
+
* A subclass of [DataField]{@link DataField} which allows to typed schemas.
|
3955
|
+
*/
|
3956
|
+
declare class TypedSchemaField<
|
3957
|
+
const Types extends TypedSchemaField.Types,
|
3958
|
+
const Options extends TypedSchemaField.DefaultOptions = TypedSchemaField.DefaultOptions,
|
3959
|
+
const AssignmentType = TypedSchemaField.AssignmentType<Types, Options>,
|
3960
|
+
const InitializedType = TypedSchemaField.InitializedType<Types, Options>,
|
3961
|
+
const PersistedType extends unknown | null | undefined = TypedSchemaField.PersistedType<Types, Options>,
|
3962
|
+
> extends DataField<Options, AssignmentType, InitializedType, PersistedType> {
|
3963
|
+
/**
|
3964
|
+
* @param types - The different types this field can represent.
|
3965
|
+
* @param options - Options which configure the behavior of the field
|
3966
|
+
* @param context - Additional context which describes the field
|
3967
|
+
*/
|
3968
|
+
constructor(types: Types, options: Options, context?: DataField.Context);
|
3969
|
+
|
3970
|
+
static get _defaults(): DataFieldOptions.Any;
|
3971
|
+
|
3972
|
+
/**
|
3973
|
+
* The types of this field.
|
3974
|
+
*/
|
3975
|
+
types: TypedSchemaField.ToConfiguredTypes<Types>;
|
3976
|
+
|
3977
|
+
protected override _getField(path: string[]): unknown;
|
3978
|
+
|
3979
|
+
protected override _cleanType(value: InitializedType, options?: DataField.CleanOptions): InitializedType;
|
3980
|
+
|
3981
|
+
protected override _cast(value: AssignmentType): InitializedType;
|
3982
|
+
|
3983
|
+
protected override _validateSpecial(value: AssignmentType): boolean | void;
|
3984
|
+
|
3985
|
+
protected override _validateType(
|
3986
|
+
value: InitializedType,
|
3987
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
3988
|
+
): boolean | DataModelValidationFailure | void;
|
3989
|
+
|
3990
|
+
override initialize(
|
3991
|
+
value: PersistedType,
|
3992
|
+
model: DataModel.Any,
|
3993
|
+
options?: AnyObject, // TODO: Type further.
|
3994
|
+
): (() => InitializedType | null) | InitializedType;
|
3995
|
+
|
3996
|
+
override toObject(value: InitializedType): PersistedType;
|
3997
|
+
|
3998
|
+
// TODO(LukeAbby): Type `TypedSchemaField#apply`.
|
3999
|
+
|
4000
|
+
migrateSource(sourceData: AnyObject, fieldData: unknown): unknown;
|
4001
|
+
}
|
4002
|
+
|
4003
|
+
declare namespace TypedSchemaField {
|
4004
|
+
type DefaultOptions = SimpleMerge<
|
4005
|
+
DataField.DefaultOptions,
|
4006
|
+
{
|
4007
|
+
required: true;
|
4008
|
+
}
|
4009
|
+
>;
|
4010
|
+
|
4011
|
+
type ValidField = DataField<
|
4012
|
+
{
|
4013
|
+
required: true;
|
4014
|
+
nullable: false;
|
4015
|
+
},
|
4016
|
+
any,
|
4017
|
+
any,
|
4018
|
+
any
|
4019
|
+
>;
|
4020
|
+
|
4021
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
4022
|
+
type ValidDataSchema = {
|
4023
|
+
readonly [field: string]: ValidField;
|
4024
|
+
};
|
4025
|
+
|
4026
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
4027
|
+
type Types = {
|
4028
|
+
[type: string]:
|
4029
|
+
| ValidDataSchema
|
4030
|
+
| SchemaField<ValidDataSchema, any, any, any, any>
|
4031
|
+
| typeof DataModel<ValidDataSchema, any>;
|
4032
|
+
};
|
4033
|
+
|
4034
|
+
type ToConfiguredTypes<Types extends TypedSchemaField.Types> = {
|
4035
|
+
[K in keyof Types]: Types[K] extends DataModel.AnyConstructor ? EmbeddedDataField<Types[K]> : never;
|
4036
|
+
};
|
4037
|
+
|
4038
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
4039
|
+
type ConfiguredTypes = {
|
4040
|
+
[type: string]: SchemaField.Any;
|
4041
|
+
};
|
4042
|
+
|
4043
|
+
/**
|
4044
|
+
* @internal
|
4045
|
+
*/
|
4046
|
+
type _AssignmentType<Types extends ConfiguredTypes> = {
|
4047
|
+
[K in keyof Types]: DataField.AssignmentTypeFor<Types[K]>;
|
4048
|
+
}[keyof Types];
|
4049
|
+
|
4050
|
+
type AssignmentType<
|
4051
|
+
Types extends TypedSchemaField.Types,
|
4052
|
+
Options extends TypedSchemaField.DefaultOptions,
|
4053
|
+
> = DataField.DerivedAssignmentType<_AssignmentType<ToConfiguredTypes<Types>>, Options>;
|
4054
|
+
|
4055
|
+
/**
|
4056
|
+
* @internal
|
4057
|
+
*/
|
4058
|
+
type _InitializedType<Types extends ConfiguredTypes> = {
|
4059
|
+
[K in keyof Types]: DataField.InitializedTypeFor<Types[K]>;
|
4060
|
+
}[keyof Types];
|
4061
|
+
|
4062
|
+
type InitializedType<
|
4063
|
+
Types extends TypedSchemaField.Types,
|
4064
|
+
Options extends TypedSchemaField.DefaultOptions,
|
4065
|
+
> = DataField.DerivedInitializedType<_InitializedType<ToConfiguredTypes<Types>>, Options>;
|
4066
|
+
|
4067
|
+
/**
|
4068
|
+
* @internal
|
4069
|
+
*/
|
4070
|
+
type _PersistedType<Types extends ConfiguredTypes> = {
|
4071
|
+
[K in keyof Types]: DataField.PersistedTypeFor<Types[K]>;
|
4072
|
+
}[keyof Types];
|
4073
|
+
|
4074
|
+
type PersistedType<
|
4075
|
+
Types extends TypedSchemaField.Types,
|
4076
|
+
_Options extends TypedSchemaField.DefaultOptions,
|
4077
|
+
> = DataField.DerivedInitializedType<_PersistedType<ToConfiguredTypes<Types>>, _Options>;
|
4078
|
+
}
|
4079
|
+
|
4080
|
+
/**
|
4081
|
+
* @deprecated since v11; ModelValidationError is deprecated. Please use DataModelValidationError instead.
|
4082
|
+
* @typeParam Errors - the type of the errors contained in this error
|
4083
|
+
*/
|
4084
|
+
declare class ModelValidationError<
|
4085
|
+
Errors extends ModelValidationError.Errors = ModelValidationError.Errors,
|
4086
|
+
> extends Error {
|
4087
|
+
/**
|
4088
|
+
* @deprecated since v11; ModelValidationError is deprecated. Please use DataModelValidationError instead.
|
4089
|
+
* @param errors - An array or object containing several errors.
|
4090
|
+
*/
|
4091
|
+
constructor(errors: Errors);
|
4092
|
+
|
4093
|
+
errors: Errors;
|
4094
|
+
|
4095
|
+
/**
|
4096
|
+
* Collect all the errors into a single message for consumers who do not handle the ModelValidationError specially.
|
4097
|
+
* @param errors - The raw error structure
|
4098
|
+
* @returns A formatted error message
|
4099
|
+
*/
|
4100
|
+
static formatErrors(errors: ModelValidationError.Errors): string;
|
4101
|
+
}
|
4102
|
+
|
4103
|
+
declare namespace ModelValidationError {
|
4104
|
+
/**
|
4105
|
+
* @deprecated since v11; ModelValidationError is deprecated. Please use DataModelValidationError instead.
|
4106
|
+
*/
|
4107
|
+
type Errors = Record<number | string | symbol, Error> | Error[] | string;
|
4108
|
+
}
|
4109
|
+
|
4110
|
+
// The subclassing of `StringField` can't be done in one step because
|
4111
|
+
// `ToInputOptions` both adds and removes properties.
|
4112
|
+
// This is done this way to avoid the need for some `@ts-expect-error`
|
4113
|
+
// directives that could mask other errors.
|
4114
|
+
declare class _InternalJavaScriptField<
|
4115
|
+
const Options extends JavaScriptField.Options = JavaScriptField.DefaultOptions,
|
4116
|
+
const AssignmentType = StringField.AssignmentType<Options>,
|
4117
|
+
const InitializedType = StringField.InitializedType<Options>,
|
4118
|
+
const PersistedType extends string | null | undefined = StringField.InitializedType<Options>,
|
4119
|
+
> extends StringField<Options, AssignmentType, InitializedType, PersistedType> {
|
4120
|
+
override toFormGroup(groupConfig?: any, inputConfig?: any): HTMLDivElement;
|
4121
|
+
|
4122
|
+
protected override _toInput(config: any): HTMLElement | HTMLCollection;
|
4123
|
+
}
|
4124
|
+
|
4125
|
+
/**
|
4126
|
+
* A subclass of {@link StringField} which contains JavaScript code.
|
4127
|
+
*/
|
4128
|
+
declare class JavaScriptField<
|
4129
|
+
const Options extends JavaScriptField.Options = JavaScriptField.DefaultOptions,
|
4130
|
+
const AssignmentType = StringField.AssignmentType<Options>,
|
4131
|
+
const InitializedType = StringField.InitializedType<Options>,
|
4132
|
+
const PersistedType extends string | null | undefined = StringField.InitializedType<Options>,
|
4133
|
+
> extends _InternalJavaScriptField<Options, AssignmentType, InitializedType, PersistedType> {
|
4134
|
+
constructor(options?: Options, context?: DataField.Context);
|
4135
|
+
|
4136
|
+
static get _defaults(): JavaScriptField.Options;
|
4137
|
+
|
4138
|
+
protected override _validateType(
|
4139
|
+
value: InitializedType,
|
4140
|
+
options?: DataField.ValidationOptions<DataField.Any>,
|
4141
|
+
): boolean | DataModelValidationFailure | void;
|
4142
|
+
|
4143
|
+
override toFormGroup(
|
4144
|
+
groupConfig?: JavaScriptField.GroupConfig,
|
4145
|
+
inputConfig?: JavaScriptField.ToInputConfig<InitializedType>,
|
4146
|
+
): HTMLDivElement;
|
4147
|
+
|
4148
|
+
protected override _toInput(config: JavaScriptField.ToInputConfig<InitializedType>): HTMLElement | HTMLCollection;
|
4149
|
+
}
|
4150
|
+
|
4151
|
+
declare namespace JavaScriptField {
|
4152
|
+
// TODO(LukeAbby): `choices` is effectively deleted due to being unconditionally set to `undefined` in the constructor.
|
4153
|
+
type Options = StringFieldOptions & {
|
4154
|
+
/**
|
4155
|
+
* Does the field allow async code?
|
4156
|
+
* @defaultValue `false`
|
4157
|
+
*/
|
4158
|
+
async?: boolean;
|
4159
|
+
};
|
4160
|
+
|
4161
|
+
type DefaultOptions = SimpleMerge<
|
4162
|
+
StringFieldOptions,
|
4163
|
+
{
|
4164
|
+
async: false;
|
4165
|
+
}
|
4166
|
+
>;
|
4167
|
+
|
4168
|
+
// `JavaScriptField#toFormGroup` provides a default by way of `groupConfig.stacked ??= true`.
|
4169
|
+
interface GroupConfig extends NullishProps<DataField.GroupConfig, "stacked"> {}
|
4170
|
+
|
4171
|
+
interface ToInputConfig<InitializedType>
|
4172
|
+
extends SimpleMerge<DataField.ToInputConfig<InitializedType>, TextAreaInputConfig> {}
|
4173
|
+
}
|
4174
|
+
|
4175
|
+
export {
|
4176
|
+
AlphaField,
|
4177
|
+
AngleField,
|
4178
|
+
AnyField,
|
4179
|
+
ArrayField,
|
4180
|
+
BooleanField,
|
4181
|
+
ColorField,
|
4182
|
+
DataField,
|
4183
|
+
DocumentIdField,
|
4184
|
+
DocumentOwnershipField,
|
4185
|
+
DocumentStatsField,
|
4186
|
+
DocumentTypeField,
|
4187
|
+
DocumentUUIDField,
|
4188
|
+
EmbeddedDataField,
|
4189
|
+
EmbeddedCollectionField,
|
4190
|
+
EmbeddedCollectionDeltaField,
|
4191
|
+
EmbeddedDocumentField,
|
4192
|
+
FilePathField,
|
4193
|
+
ForeignDocumentField,
|
4194
|
+
HTMLField,
|
4195
|
+
HueField,
|
4196
|
+
IntegerSortField,
|
4197
|
+
JavaScriptField,
|
4198
|
+
JSONField,
|
4199
|
+
NumberField,
|
4200
|
+
ObjectField,
|
4201
|
+
TypedSchemaField,
|
4202
|
+
SchemaField,
|
4203
|
+
SetField,
|
4204
|
+
StringField,
|
4205
|
+
TypeDataField,
|
4206
|
+
ModelValidationError,
|
4207
|
+
};
|