From 24297b3e3720197b2f4e2b7123b9484321d76c7c Mon Sep 17 00:00:00 2001 From: 7H3LaughingMan <7H3LaughingMan@proton.me> Date: Sun, 3 May 2026 13:31:02 -0500 Subject: [PATCH 1/7] BaseDocument Updates --- types/foundry/common/abstract/_types.d.mts | 38 +++++- types/foundry/common/abstract/document.d.mts | 31 +---- types/foundry/common/constants.d.mts | 2 + types/foundry/common/data/fields.d.mts | 15 ++- .../common/documents/active-effect.d.mts | 70 +++++----- .../common/documents/actor-delta.d.mts | 41 +++--- types/foundry/common/documents/actor.d.mts | 28 ++-- .../foundry/common/documents/adventure.d.mts | 101 ++++++--------- .../common/documents/ambient-light.d.mts | 59 ++++++--- .../common/documents/ambient-sound.d.mts | 76 +++++++---- types/foundry/common/documents/card.d.mts | 59 ++++----- types/foundry/common/documents/cards.d.mts | 57 +++----- .../common/documents/chat-message.d.mts | 59 ++++----- types/foundry/common/documents/combat.d.mts | 52 ++++++-- .../common/documents/combatant-group.d.mts | 22 +++- .../foundry/common/documents/combatant.d.mts | 50 +++++-- types/foundry/common/documents/drawing.d.mts | 69 +++++----- .../common/documents/fog-exploration.d.mts | 35 +++-- types/foundry/common/documents/folder.d.mts | 20 +-- types/foundry/common/documents/item.d.mts | 44 +++---- .../documents/journal-entry-category.d.mts | 28 ++-- .../common/documents/journal-entry-page.d.mts | 63 +++++---- .../common/documents/journal-entry.d.mts | 39 +++--- types/foundry/common/documents/level.d.mts | 27 +++- types/foundry/common/documents/macro.d.mts | 37 +++--- types/foundry/common/documents/note.d.mts | 49 +++---- .../common/documents/playlist-sound.d.mts | 36 +++--- types/foundry/common/documents/playlist.d.mts | 39 ++++-- .../common/documents/region-behavior.d.mts | 31 +++-- types/foundry/common/documents/region.d.mts | 38 ++++-- .../foundry/common/documents/roll-table.d.mts | 22 ++-- types/foundry/common/documents/scene.d.mts | 122 +++++++++++------- types/foundry/common/documents/setting.d.mts | 26 ++-- .../common/documents/table-result.d.mts | 50 ++++--- types/foundry/common/documents/tile.d.mts | 80 ++++++------ types/foundry/common/documents/token.d.mts | 53 +++++--- types/foundry/common/documents/user.d.mts | 43 ++++-- types/foundry/common/documents/wall.d.mts | 78 +++++++---- 38 files changed, 1024 insertions(+), 765 deletions(-) diff --git a/types/foundry/common/abstract/_types.d.mts b/types/foundry/common/abstract/_types.d.mts index e370b30f7b0..e083b9ba6e0 100644 --- a/types/foundry/common/abstract/_types.d.mts +++ b/types/foundry/common/abstract/_types.d.mts @@ -1,6 +1,8 @@ import { DocumentUUID } from "@client/utils/helpers.mjs"; import { DataField } from "@common/data/fields.mjs"; import { DataModel, Document } from "./_module.mjs"; +import BaseUser from "@common/documents/user.mjs"; +import { DocumentOwnershipString, UserPermission, UserRoleName } from "@common/constants.mjs"; export type DataSchema = { [K in string]: DataField }; @@ -57,6 +59,10 @@ export interface DataModelUpdateOptions { restoreDelta?: boolean; } +export type DatabaseAction = "get" | "create" | "update" | "delete"; + +export type DatabaseWriteAction = Exclude; + export interface DatabaseGetOperation { action: "get"; /** A query object which identifies the set of Documents retrieved */ @@ -168,14 +174,17 @@ export interface DatabaseDeleteCallbackOptions extends Omit< "action" | "deleteAll" | "ids" | "pack" | "parent" | "noHook" > {} -export type DatabaseAction = "get" | "create" | "update" | "delete"; - export type DatabaseOperation = | DatabaseGetOperation | DatabaseCreateOperation | DatabaseUpdateOperation | DatabaseDeleteOperation; +export type DatabaseWriteOperation = Exclude< + DatabaseOperation, + DatabaseGetOperation +>; + export interface DocumentSocketRequest { /** The type of Document being transacted */ type: string; @@ -188,3 +197,28 @@ export interface DocumentSocketRequest { /** Should the response be broadcast to other connected clients? */ broadcast: boolean; } + +export type DocumentPermissionTest = (user: BaseUser, document: Document, data?: object) => boolean; + +type MetadataPermission = UserRoleName | UserPermission | DocumentOwnershipString | ((...args: unknown[]) => boolean); + +export interface DocumentClassMetadata { + name: string; + label: string; + coreTypes: readonly string[]; + collection: string; + embedded: Record; + permissions: { + view: MetadataPermission; + create: MetadataPermission; + update: MetadataPermission; + delete: MetadataPermission; + }; + hasTypeData: boolean; + /** If the Document class has type data, can users normally create instances of the "base" type? */ + baseTypeAllowed?: boolean; + indexed: boolean; + compendiumIndexFields: string[]; + preserveOnImport: string[]; + schemaVersion?: string; +} diff --git a/types/foundry/common/abstract/document.d.mts b/types/foundry/common/abstract/document.d.mts index e79c49f3b7d..acd5802427a 100644 --- a/types/foundry/common/abstract/document.d.mts +++ b/types/foundry/common/abstract/document.d.mts @@ -1,12 +1,6 @@ import { DocumentUUID } from "@client/utils/helpers.mjs"; import { DocumentConstructionContext } from "@common/_types.mjs"; -import { - DocumentOwnershipLevel, - DocumentOwnershipNumber, - UserAction, - UserPermission, - UserRoleName, -} from "@common/constants.mjs"; +import { DocumentOwnershipLevel, DocumentOwnershipNumber, UserAction } from "@common/constants.mjs"; import BaseUser from "@common/documents/user.mjs"; import { AppV1RenderOptions } from "../../client/appv1/api/application-v1.mjs"; import { DataField, SourceFromSchema } from "../data/fields.mjs"; @@ -20,6 +14,7 @@ import { DatabaseUpdateOperation, DataModelValidationOptions, DataSchema, + DocumentClassMetadata, } from "./_types.mjs"; import DatabaseBackend from "./backend.mjs"; import DataModel from "./data.mjs"; @@ -54,7 +49,7 @@ export default abstract class Document< /* -------------------------------------------- */ /** Default metadata which applies to each instance of this Document type. */ - static get metadata(): DocumentMetadata; + static get metadata(): Readonly; /** * The database backend used to execute operations and handle results. @@ -701,26 +696,6 @@ export default abstract class Document< override toObject(source?: boolean): this["_source"]; } -type MetadataPermission = UserRoleName | UserPermission | ((...args: unknown[]) => boolean); - -export interface DocumentMetadata { - name: string; - collection: string; - label: string; - coreTypes: readonly string[]; - embedded: Record; - hasTypeData: boolean; - indexed: boolean; - compendiumIndexFields: string[]; - permissions: { - view: MetadataPermission; - create: MetadataPermission; - update: MetadataPermission; - delete: MetadataPermission; - }; - preserveOnImport: string[]; -} - type _Document = Document<_Document | null>; declare global { diff --git a/types/foundry/common/constants.d.mts b/types/foundry/common/constants.d.mts index c250955e20c..0f0f0a657b9 100644 --- a/types/foundry/common/constants.d.mts +++ b/types/foundry/common/constants.d.mts @@ -826,6 +826,8 @@ export const AUDIO_CHANNELS: Readonly<{ interface: "AUDIO.CHANNELS.INTERFACE.label"; }>; +export type AudioChannel = keyof typeof AUDIO_CHANNELS; + /** * The allowed playback modes for an audio Playlist * @see https://foundryvtt.com/article/playlists/ diff --git a/types/foundry/common/data/fields.d.mts b/types/foundry/common/data/fields.d.mts index 782bb422034..1813e7f72c3 100644 --- a/types/foundry/common/data/fields.d.mts +++ b/types/foundry/common/data/fields.d.mts @@ -1496,6 +1496,19 @@ export class HueField< protected static get _defaults(): NumberFieldOptions; } +/** + * A special `ForeignDocumentField` which defines the original author of a document. + * This can only be changed later by GM users. + */ +export class DocumentAuthorField< + TModelProp extends string | abstract.Document = abstract.Document, + TRequired extends boolean = true, + TNullable extends boolean = true, + THasInitial extends boolean = true, +> extends ForeignDocumentField { + protected static override get _defaults(): StringFieldOptions; +} + /** A special `ObjectField` which captures a mapping of User IDs to Document permission levels. */ export class DocumentOwnershipField extends ObjectField<{ [K in string]?: DocumentOwnershipNumber }> { protected static override get _defaults(): ObjectFieldOptions< @@ -1830,7 +1843,7 @@ export class JavaScriptField< /** * A nullable set field used to reference a set of specific Scene Level documents. */ -export class SceneLevelsSetField extends SetField> { +export class SceneLevelsSetField extends SetField> { /** * @param options Options which configure the behavior of the field * @param context Additional context which describes the field diff --git a/types/foundry/common/documents/active-effect.d.mts b/types/foundry/common/documents/active-effect.d.mts index 533120f0dd2..f347d294af4 100644 --- a/types/foundry/common/documents/active-effect.d.mts +++ b/types/foundry/common/documents/active-effect.d.mts @@ -1,43 +1,30 @@ import { DatabaseCreateCallbackOptions } from "@common/abstract/_types.mjs"; -import { - ActiveEffectDurationUnit, - ActiveEffectShowIcon, - DocumentOwnershipLevel, - ImageFilePath, - UserAction, -} from "@common/constants.mjs"; -import { Document, DocumentMetadata } from "../abstract/_module.mjs"; +import { ActiveEffectDurationUnit, ActiveEffectShowIcon, ImageFilePath } from "@common/constants.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; -import { ActorUUID, BaseActor, BaseCombat, BaseItem, BaseUser, ItemUUID } from "./_module.mjs"; +import { ActorUUID, BaseActor, BaseCombat, BaseFolder, BaseItem, BaseUser, ItemUUID } from "./_module.mjs"; /** - * The ActiveEffect document model. - * @param data Initial data from which to construct the document. - * @param context Construction context options + * The ActiveEffect Document. + * Defines the DataSchema and common behaviors for an ActiveEffect which are shared between both client and server. */ -export default class BaseActiveEffect | null> extends Document< - TParent, - ActiveEffectSchema -> { +export default class BaseActiveEffect< + TParent extends BaseActor | BaseItem | null = BaseActor | BaseItem | null, +> extends Document { /* -------------------------------------------- */ /* Model Configuration */ /* -------------------------------------------- */ - static override get metadata(): ActiveEffectMetadata; + static override get metadata(): Readonly; static override defineSchema(): ActiveEffectSchema; - /* -------------------------------------------- */ - /* Model Methods */ - /* -------------------------------------------- */ + static override LOCALIZATION_PREFIXES: string[]; - override canUserModify(user: BaseUser, action: UserAction, data?: object): boolean; + /** The default icon used for newly created ActiveEffect documents */ + static DEFAULT_ICON: string; - override testUserPermission( - user: BaseUser, - permission: DocumentOwnershipLevel, - { exact }?: { exact?: boolean }, - ): boolean; + static override canUserCreate(user: BaseUser): boolean; /* -------------------------------------------- */ /* Database Event Handlers */ @@ -50,34 +37,55 @@ export default class BaseActiveEffect; } -export default interface BaseActiveEffect | null> +export default interface BaseActiveEffect< + TParent extends BaseActor | BaseItem | null = BaseActor | BaseItem | null, +> extends Document, fields.ModelPropsFromSchema { get documentName(): ActiveEffectMetadata["name"]; + + get folder(): BaseFolder | null; } -export interface ActiveEffectMetadata extends DocumentMetadata { +export interface ActiveEffectMetadata extends DocumentClassMetadata { name: "ActiveEffect"; collection: "effects"; + hasTypeData: true; + baseTypeAllowed: true; + indexed: true; + compendiumIndexFields: ["_id", "name", "img", "type", "sort", "folder"]; label: "DOCUMENT.ActiveEffect"; - isEmbedded: true; + labelPlural: "DOCUMENT.ActiveEffects"; } type ActiveEffectSchema = { + /** The _id which uniquely identifies this ActiveEffect document */ _id: fields.DocumentIdField; + /** The name of this ActiveEffect */ name: fields.StringField; - system: fields.TypeDataField; + /** An image file path which provides the artwork for this ActiveEffect */ + img: fields.FilePathField; + /** An ActorEffect subtype which configures the system data model applied */ type: fields.StringField; + /** They system data object which is defined by the system data model */ + system: fields.TypeDataField; + /** Is this ActiveEffect disabled? */ disabled: fields.BooleanField; start: fields.SchemaField; duration: fields.SchemaField; description: fields.HTMLField; - img: fields.FilePathField; origin: fields.DocumentUUIDField; tint: fields.ColorField; transfer: fields.BooleanField; statuses: fields.SetField>; + /** Is the icon for this ActiveEffect displayed? */ showIcon: fields.NumberField; + /** The Folder which contains this ActiveEffect */ + folder: fields.ForeignDocumentField; + /** The numeric sort value which orders this ActiveEffect relative to its siblings */ + sort: fields.IntegerSortField; + /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/actor-delta.d.mts b/types/foundry/common/documents/actor-delta.d.mts index 68eb0433d15..b26ee459582 100644 --- a/types/foundry/common/documents/actor-delta.d.mts +++ b/types/foundry/common/documents/actor-delta.d.mts @@ -1,21 +1,18 @@ -import { DocumentOwnershipLevel, ImageFilePath, UserAction } from "@common/constants.mjs"; +import { ImageFilePath } from "@common/constants.mjs"; import { DocumentConstructionContext } from "../_types.mjs"; import * as abstract from "../abstract/_module.mjs"; import { TombstoneDataSchema } from "../data/data.mjs"; import * as fields from "../data/fields.mjs"; import Collection from "../utils/collection.mjs"; -import { BaseActiveEffect, BaseActor, BaseItem, BaseToken, BaseUser } from "./_module.mjs"; +import { BaseActiveEffect, BaseActor, BaseItem, BaseToken } from "./_module.mjs"; import { ItemSchema } from "./item.mjs"; /** - * The Document definition for an ActorDelta. + * The ActorDelta Document. * Defines the DataSchema and common behaviors for an ActorDelta which are shared between both client and server. * ActorDeltas store a delta that can be applied to a particular Actor in order to produce a new Actor. - * - * @param data Initial data used to construct the ActorDelta. - * @param context Construction context options. */ -export default class BaseActorDelta extends abstract.Document< +export default class BaseActorDelta extends abstract.Document< TParent, ActorDeltaSchema > { @@ -23,34 +20,27 @@ export default class BaseActorDelta extends ab /* Model Configuration */ /* -------------------------------------------- */ - static override readonly metadata: ActorDeltaMetadata; + static override readonly metadata: Readonly; static override defineSchema(): ActorDeltaSchema; - override canUserModify(user: BaseUser, action: UserAction, data?: Record): boolean; - - override testUserPermission( - user: BaseUser, - permission: DocumentOwnershipLevel, - { exact }?: { exact?: boolean }, - ): boolean; - /* -------------------------------------------- */ /* Methods */ /* -------------------------------------------- */ + override getUserLevel(user: foundry.documents.BaseUser): CONST.DocumentOwnershipNumber; + /** * Retrieve the base actor's collection, if it exists. - * @param collectionName The collection name. + * @param collectionName The collection name. */ getBaseCollection(collectionName: string): Collection | undefined; /** * Apply an ActorDelta to an Actor and return the resultant synthetic Actor. - * @param {ActorDelta} delta The ActorDelta. - * @param {Actor} baseActor The base Actor. - * @param {object} [context] Context to supply to synthetic Actor instantiation. - * @returns {Actor|null} + * @param delta The ActorDelta. + * @param baseActor The base Actor. + * @param context Context to supply to synthetic Actor instantiation. */ static applyDelta( delta: BaseActorDelta, @@ -59,10 +49,12 @@ export default class BaseActorDelta extends ab ): BaseActor; } -export default interface BaseActorDelta - extends abstract.Document, fields.ModelPropsFromSchema {} +export default interface BaseActorDelta + extends abstract.Document, fields.ModelPropsFromSchema { + readonly items: abstract.EmbeddedCollection>; +} -interface ActorDeltaMetadata extends abstract.DocumentMetadata { +interface ActorDeltaMetadata extends abstract.DocumentClassMetadata { name: "ActorDelta"; collection: "delta"; label: "DOCUMENT.ActorDelta"; @@ -75,6 +67,7 @@ interface ActorDeltaMetadata extends abstract.DocumentMetadata { } type ActorDeltaSchema = { + /** The _id which uniquely identifies this ActorDelta document */ _id: fields.DocumentIdField; name: fields.StringField; type: fields.StringField; diff --git a/types/foundry/common/documents/actor.d.mts b/types/foundry/common/documents/actor.d.mts index d8cdbe03bd7..934506b8484 100644 --- a/types/foundry/common/documents/actor.d.mts +++ b/types/foundry/common/documents/actor.d.mts @@ -4,7 +4,7 @@ import { DatabaseCreateCallbackOptions, DatabaseUpdateCallbackOptions, Document, - DocumentMetadata, + DocumentClassMetadata, EmbeddedCollection, } from "../abstract/_module.mjs"; import * as data from "../data/data.mjs"; @@ -12,12 +12,8 @@ import * as fields from "../data/fields.mjs"; import { ActorUUID, BaseActiveEffect, BaseFolder, BaseItem, BaseToken, BaseUser, ItemSource } from "./_module.mjs"; /** - * The Document definition for an Actor. + * The Actor Document. * Defines the DataSchema and common behaviors for an Actor which are shared between both client and server. - * @memberof documents - * - * @param data Initial data from which to construct the Actor - * @param context Construction context options */ export default class BaseActor extends Document< TParent, @@ -27,7 +23,7 @@ export default class BaseActor; static override defineSchema(): ActorSchema; @@ -79,12 +75,14 @@ export default interface BaseActor; - /** An Actor subtype which configures the system data model applied */ - type: fields.StringField; /** An image file path which provides the artwork for this Actor */ img: fields.FilePathField; - /** The system data object which is defined by the system template.json model */ + /** An Actor subtype which configures the system data model applied */ + type: fields.DocumentTypeField; + /** They system data object which is defined by the system data model */ system: fields.TypeDataField; /** Default Token settings which are used for Tokens created from this Actor */ prototypeToken: fields.EmbeddedDataField>; - /** A Collection of Item embedded Documents */ + /** An EmbeddedCollection of Item documents */ items: fields.EmbeddedCollectionField>, TItemSource[]>; - /** A Collection of ActiveEffect embedded Documents */ + /** An EmbeddedCollection of ActiveEffect documents */ effects: fields.EmbeddedCollectionField>>; - /** The _id of a Folder which contains this Actor */ + /** The Folder which contains this Actor */ folder: fields.ForeignDocumentField; /** The numeric sort value which orders this Actor relative to its siblings */ sort: fields.IntegerSortField; @@ -118,7 +116,7 @@ type ActorSchema< ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information. */ + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/adventure.d.mts b/types/foundry/common/documents/adventure.d.mts index 5ecb56c7811..4bd15e862f5 100644 --- a/types/foundry/common/documents/adventure.d.mts +++ b/types/foundry/common/documents/adventure.d.mts @@ -1,61 +1,32 @@ -import { - DocumentOwnershipNumber, - ImageFilePath, - UserAction, - UserPermission, - UserRole, - UserRoleName, -} from "@common/constants.mjs"; -import { Document, DocumentMetadata } from "../abstract/_module.mjs"; +import { ImageFilePath } from "@common/constants.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; import * as documents from "./_module.mjs"; /** - * The Document definition for an Adventure. + * The Adventure Document. * Defines the DataSchema and common behaviors for an Adventure which are shared between both client and server. - * @memberof documents - * - * @param data Initial data from which to construct the Actor - * @param context Construction context options */ export default class BaseAdventure extends Document { - static override get metadata(): AdventureMetadata; + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ - static override defineSchema(): AdventureSchema; - - /* ---------------------------------------- */ - /* Permissions */ - /* ---------------------------------------- */ + static override get metadata(): Readonly; - /** Test whether the User has a GAMEMASTER or ASSISTANT role in this World? */ - get isGM(): boolean; + static override defineSchema(): AdventureSchema; - /** - * Test whether the User is able to perform a certain permission action. - * The provided permission string may pertain to an explicit permission setting or a named user role. - * Alternatively, Gamemaster users are assumed to be allowed to take all actions. - * - * @param action The action to test - * @return Does the user have the ability to perform this action? - */ - can(action: UserAction): boolean; + static override LOCALIZATION_PREFIXES: string[]; - override getUserLevel(user: documents.BaseUser): DocumentOwnershipNumber; + /* -------------------------------------------- */ + /* Model Properties */ + /* -------------------------------------------- */ - /** - * Test whether the User has at least a specific permission - * @param permission The permission name from USER_PERMISSIONS to test - * @return Does the user have at least this permission - */ - hasPermission(permission: UserPermission): boolean; + /** An array of the fields which provide imported content from the Adventure.*/ + static get contentFields(): Record; - /** - * Test whether the User has at least the permission level of a certain role - * @param role The role name from USER_ROLES to test - * @param [exact] Require the role match to be exact - * @return Does the user have at this role level (or greater)? - */ - hasRole(role: UserRole | UserRoleName, { exact }?: { exact: boolean }): boolean; + /** Provide a thumbnail image path used to represent the Adventure document. */ + get thumbnail(): string; } export default interface BaseAdventure @@ -63,50 +34,52 @@ export default interface BaseAdventure get documentName(): AdventureMetadata["name"]; } -interface AdventureMetadata extends DocumentMetadata { +interface AdventureMetadata extends DocumentClassMetadata { name: "Adventure"; - collection: "Adventures"; + collection: "adventures"; + compendiumIndexFields: ["_id", "name", "caption", "description", "img", "sort", "folder", "flags.core.sheetClass"]; label: "DOCUMENT.Adventure"; - isPrimary: true; + labelPlural: "DOCUMENT.Adventures"; } type AdventureSchema = { /** The _id which uniquely identifies this Adventure document */ _id: fields.DocumentIdField; - /** The human-readable name of the Adventure */ + /** The name of this Adventure */ name: fields.StringField; - /** The human-readable name of the Adventure*/ + /** An image file path which provides the artwork for this Adventure */ img: fields.FilePathField; - /** A string caption displayed under the primary image banner */ + /** The caption displayed under the primary image banner */ caption: fields.HTMLField; - /** An HTML text description for the adventure */ + /** The description for this Adventure */ description: fields.HTMLField; - /** An array of Actor documents which are included in the adventure */ + /** An array of Actor documents which are included in this Adventure */ actors: fields.SetField>>; - /** An array of Combat documents which are included in the adventure */ + /** An array of Combat documents which are included in this Adventure */ combats: fields.SetField>; - /** An array of Item documents which are included in the adventure */ + /** An array of Item documents which are included in this Adventure */ items: fields.SetField>>; - /** An array of JournalEntry documents which are included in the adventure */ + /** An array of JournalEntry documents which are included in this Adventure */ journal: fields.SetField>; - /** An array of Scene documents which are included in the adventure */ + /** An array of Scene documents which are included in this Adventure */ scenes: fields.SetField>; - /** An array of RollTable documents which are included in the adventure */ + /** An array of RollTable documents which are included in this Adventure */ tables: fields.SetField>; - /** An array of Macro documents which are included in the adventure */ + /** An array of Macro documents which are included in this Adventure */ macros: fields.SetField>; - /** An array of Cards documents which are included in the adventure */ + /** An array of Cards documents which are included in this Adventure */ cards: fields.SetField>; - /** An array of Playlist documents which are included in the adventure */ + /** An array of Playlist documents which are included in this Adventure */ playlists: fields.SetField>; - /** An array of Folder documents which are included in the adventure */ + /** An array of Folder documents which are included in this Adventure */ folders: fields.SetField>; + /** The Folder which contains this Adventure */ folder: fields.ForeignDocumentField; - /** The sort order of this adventure relative to its siblings */ + /** The numeric sort valute which orders this Adventure relative to its siblings */ sort: fields.IntegerSortField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information */ + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/ambient-light.d.mts b/types/foundry/common/documents/ambient-light.d.mts index 6cab4ab6e5a..9d8f3c70d06 100644 --- a/types/foundry/common/documents/ambient-light.d.mts +++ b/types/foundry/common/documents/ambient-light.d.mts @@ -1,49 +1,72 @@ -import { Document, DocumentMetadata } from "../abstract/_module.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import * as data from "../data/data.mjs"; import * as fields from "../data/fields.mjs"; import BaseScene from "./scene.mjs"; -/** The AmbientLight embedded document model. */ -export default class BaseAmbientLight extends Document { - static override get metadata(): AmbientLightMetadata; +/** + * The AmbientLight Document. + * Defines the DataSchema and common behaviors for an AmbientLight which are shared between both client and server. + */ +export default class BaseAmbientLight extends Document< + TParent, + AmbientLightSchema +> { + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ + + static override get metadata(): Readonly; static override defineSchema(): AmbientLightSchema; - protected override _initialize(): void; + static override LOCALIZATION_PREFIXES: string[]; + + /* -------------------------------------------- */ + /* Document Methods */ + /* -------------------------------------------- */ + + override getUserLevel(user: foundry.documents.BaseUser): CONST.DocumentOwnershipNumber; } -export default interface BaseAmbientLight - extends Document, fields.ModelPropsFromSchema {} +export default interface BaseAmbientLight + extends Document, fields.ModelPropsFromSchema { + get documentName(): AmbientLightMetadata["name"]; +} -interface AmbientLightMetadata extends DocumentMetadata { +interface AmbientLightMetadata extends DocumentClassMetadata { name: "AmbientLight"; collection: "lights"; label: "DOCUMENT.AmbientLight"; - isEmbedded: true; + labelPlural: "DOCUMENT.AmbientLights"; } export type AmbientLightSchema = { - /** The _id which uniquely identifies this BaseAmbientLight embedded document */ + /** The _id which uniquely identifies this AmbientLight document */ _id: fields.DocumentIdField; - /** The x-coordinate position of the origin of the light */ + /** The name of this AmbientLight */ + name: fields.StringField; + /** The x-coordinate position of the origin of this AmbientLight */ x: fields.NumberField; - /** The y-coordinate position of the origin of the light */ + /** The y-coordinate position of the origin of this AmbientLight */ y: fields.NumberField; + /** The elevation of this AmbientLight */ elevation: fields.NumberField; - /** The angle of rotation for the tile between 0 and 360 */ + /** An array of Levels that this AmbientLight is on */ + levels: fields.SceneLevelsSetField; + /** The angle of rotation of this AmbientLight between 0 and 360 */ rotation: fields.AngleField; - /** Whether or not this light source is constrained by Walls */ + /** Whether or not this AmbientLight is constrained by walls */ walls: fields.BooleanField; - /** Whether or not this light source provides a source of vision */ + /** Whether or not this AmbientLight provides a source of vision */ vision: fields.BooleanField; /** Light configuration data */ config: fields.EmbeddedDataField>>; - /** Is the light source currently hidden? */ + /** Is this AmbientLight currently hidden? */ hidden: fields.BooleanField; + /** Is this AmbientLight currently locked? */ + locked: fields.BooleanField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; }; export type AmbientLightSource = fields.SourceFromSchema; - -export {}; diff --git a/types/foundry/common/documents/ambient-sound.d.mts b/types/foundry/common/documents/ambient-sound.d.mts index 27f86e2d7d0..420c74927fe 100644 --- a/types/foundry/common/documents/ambient-sound.d.mts +++ b/types/foundry/common/documents/ambient-sound.d.mts @@ -1,28 +1,39 @@ import { AudioFilePath } from "@common/constants.mjs"; -import { Document, DocumentMetadata } from "../abstract/_module.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; import BaseScene from "./scene.mjs"; /** - * The Document definition for an AmbientSound. + * The AmbientSound Document. * Defines the DataSchema and common behaviors for an AmbientSound which are shared between both client and server. - * @memberof documents - * - * @param data Initial data from which to construct the AmbientSound - * @param context Construction context options */ -export default class BaseAmbientSound extends Document { - static override get metadata(): AmbientSoundMetadata; +export default class BaseAmbientSound extends Document< + TParent, + AmbientSoundSchema +> { + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ + + static override get metadata(): Readonly; static defineSchema(): AmbientSoundSchema; + + static override LOCALIZATION_PREFIXES: string[]; + + /* -------------------------------------------- */ + /* Document Methods */ + /* -------------------------------------------- */ + + override getUserLevel(user: foundry.documents.BaseUser): CONST.DocumentOwnershipNumber; } -export default interface BaseAmbientSound +export default interface BaseAmbientSound extends Document, fields.ModelPropsFromSchema { get documentName(): AmbientSoundMetadata["name"]; } -interface AmbientSoundMetadata extends DocumentMetadata { +interface AmbientSoundMetadata extends DocumentClassMetadata { name: "AmbientSound"; collection: "sounds"; label: "DOCUMENT.AmbientSound"; @@ -30,42 +41,53 @@ interface AmbientSoundMetadata extends DocumentMetadata { isEmbedded: true; } -/** - * @typedef {Object} AmbientSoundData +type OneToTen = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; - * @property {{min: number, max: number}} darkness A darkness range (min and max) for which the source should be active - * @property {object} [flags] An object of optional key/value flags - */ type AmbientSoundSchema = { /** The _id which uniquely identifies this AmbientSound document */ _id: fields.DocumentIdField; - /** The x-coordinate position of the origin of the sound. */ + /** The name of this AmbientSound */ + name: fields.StringField; + /** The x-coordinate position of the origin of this AmbientSound */ x: fields.NumberField; - /** The y-coordinate position of the origin of the sound. */ + /** The y-coordinate position of the origin of this AmbientSound */ y: fields.NumberField; - /** The radius of the emitted sound. */ + /** The elevation of the origin of this AmbientSound */ + elevation: fields.NumberField; + /** An array of Levels that this AmbientSound is on */ + levels: fields.SceneLevelsSetField; + /** The radius of the emitted sound */ radius: fields.NumberField; - /** The audio file path that is played by this sound */ + /** The audio file path that is played by this AmbientSound */ path: fields.FilePathField; /** Does this sound loop? */ repeat: fields.BooleanField; /** The audio volume of the sound, from 0 to 1 */ volume: fields.AlphaField; - /** Whether or not this sound source is constrained by Walls. */ + /** Whether or not this AmbientSound is constrained by walls */ walls: fields.BooleanField; - /** - * Whether to adjust the volume of the sound heard by the listener based on how close the listener is to the center - * of the sound source. - */ + /** Whether to adjust the volume of the sound heard by the listener based on how close the listener is to the center of the sound source */ easing: fields.BooleanField; - /** Is the sound source currently hidden? */ + /** Is this AmbientSound currently hidden? */ hidden: fields.BooleanField; - /** A darkness range (min and max) for which the source should be active */ + /** Is this AmbientSound currently locked? */ + locked: fields.BooleanField; + /** A darknes range (min and max) for which the source should be active */ darkness: fields.SchemaField<{ min: fields.AlphaField; max: fields.AlphaField; }>; - /** A darkness range (min and max) for which the source should be active */ + effects: fields.SchemaField<{ + base: fields.SchemaField<{ + type: fields.StringField; + intensity: fields.NumberField; + }>; + muffled: fields.SchemaField<{ + type: fields.StringField; + intensity: fields.NumberField; + }>; + }>; + /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; }; diff --git a/types/foundry/common/documents/card.d.mts b/types/foundry/common/documents/card.d.mts index 908cf733c04..dc141b28946 100644 --- a/types/foundry/common/documents/card.d.mts +++ b/types/foundry/common/documents/card.d.mts @@ -1,65 +1,57 @@ -import { DocumentOwnershipLevel, ImageFilePath, VideoFilePath } from "@common/constants.mjs"; -import Document, { DocumentMetadata } from "../abstract/document.mjs"; +import { ImageFilePath, VideoFilePath } from "@common/constants.mjs"; +import Document from "../abstract/document.mjs"; import * as fields from "../data/fields.mjs"; -import { BaseCards, BaseUser } from "./_module.mjs"; +import { BaseCards } from "./_module.mjs"; +import { DocumentClassMetadata } from "@common/abstract/_module.mjs"; /** - * The Document definition for a Card. + * The Card Document. * Defines the DataSchema and common behaviors for a Card which are shared between both client and server. - * @memberof documents - * - * @param data Initial data from which to construct the Card - * @param context Construction context options */ -export default class BaseCard extends Document { +export default class BaseCard extends Document< + TParent, + CardSchema +> { /* -------------------------------------------- */ /* Model Configuration */ /* -------------------------------------------- */ - static override get metadata(): CardMetadata; + static override get metadata(): Readonly; static override defineSchema(): CardSchema; /** The default icon used for a Card face that does not have a custom image set */ static DEFAULT_ICON: ImageFilePath | VideoFilePath; - /** The allowed set of Card types which may exist */ - static get TYPES(): string[]; - - /* -------------------------------------------- */ - /* Model Methods */ - /* -------------------------------------------- */ - - override testUserPermission( - user: BaseUser, - permission: DocumentOwnershipLevel, - { exact }?: { exact?: boolean | undefined }, - ): boolean; + static override LOCALIZATION_PREFIXES: string[]; } -export default interface BaseCard +export default interface BaseCard extends Document, fields.ModelPropsFromSchema { get documentName(): CardMetadata["name"]; } -interface CardMetadata extends DocumentMetadata { +interface CardMetadata extends DocumentClassMetadata { name: "Card"; collection: "cards"; + hasTypeData: true; + baseTypeAllowed: true; indexed: true; label: "DOCUMENT.Card"; - labelPlural: "DOCUMENT.Cards"; + labelPlural: "DOCUMENT.CardPlural"; + compendiumIndexFields: ["name", "type", "suit", "sort"]; } type CardSchema = { /** The _id which uniquely identifies this Card document */ _id: fields.DocumentIdField; - /** The text name of this card */ + /** The name of this Card */ name: fields.StringField; - /** A text description of this card which applies to all faces */ + /** The description of this card which applies to all faces */ description: fields.HTMLField; - /** A category of card (for example, a suit) to which this card belongs */ - type: fields.StringField; - /** Game system data which is defined by the system template.json model */ + /** An Card subtype which configures the system data model applied */ + type: fields.DocumentTypeField; + /** They system data object which is defined by the system data model */ system: fields.TypeDataField; /** An optional suit designation which is used by default sorting */ suit: fields.StringField; @@ -81,18 +73,17 @@ type CardSchema = { height: fields.NumberField; /** The angle of rotation of this card */ rotation: fields.AngleField; - /** The sort order of this card relative to others in the same stack */ + /** The numeric sort valute which orders this Card relative to its siblings */ sort: fields.IntegerSortField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; + /** An object containing document metadata */ + _stats: fields.DocumentStatsField; }; type CardFaceSchema = { - /** A name for this card face */ name: fields.StringField; - /** Displayed text that belongs to this face */ text: fields.HTMLField; - /** A displayed image or video file which depicts the face */ img: fields.FilePathField; }; diff --git a/types/foundry/common/documents/cards.d.mts b/types/foundry/common/documents/cards.d.mts index 68b591fb26d..6eee50aebc2 100644 --- a/types/foundry/common/documents/cards.d.mts +++ b/types/foundry/common/documents/cards.d.mts @@ -1,35 +1,25 @@ -import { DocumentOwnershipLevel, ImageFilePath, VideoFilePath } from "@common/constants.mjs"; +import { ImageFilePath, VideoFilePath } from "@common/constants.mjs"; import * as abstract from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; -import { BaseCard, BaseFolder, BaseUser } from "./_module.mjs"; +import { BaseCard, BaseFolder } from "./_module.mjs"; /** - * The Document definition for Cards. - * Defines the DataSchema and common behaviors for Cards which are shared between both client and server. - * @memberof documents - * - * @param data Initial data from which to construct the Cards - * @param context Construction context options + * The Cards Document. + * Defines the DataSchema and common behaviors for a Cards Document which are shared between both client and server. */ export default class BaseCards extends abstract.Document { /* -------------------------------------------- */ /* Model Configuration */ /* -------------------------------------------- */ - static override get metadata(): CardsMetadata; + static override get metadata(): Readonly; static override defineSchema(): CardsSchema; + static override LOCALIZATION_PREFIXES: string[]; + /** The default icon used for a cards stack that does not have a custom image set */ static DEFAULT_ICON: ImageFilePath | VideoFilePath; - - static get TYPES(): string[]; - - override testUserPermission( - user: BaseUser, - permission: DocumentOwnershipLevel, - { exact }?: { exact?: boolean }, - ): boolean; } export default interface BaseCards @@ -37,37 +27,32 @@ export default interface BaseCards get documentName(): CardsMetadata["name"]; } -interface CardsMetadata extends abstract.DocumentMetadata { +interface CardsMetadata extends abstract.DocumentClassMetadata { name: "Cards"; collection: "cards"; indexed: true; compendiumIndexFields: ["_id", "name", "description", "img", "type", "sort", "folder"]; embedded: { Card: "cards" }; + hasTypeData: true; label: "DOCUMENT.Cards"; labelPlural: "DOCUMENT.CardsPlural"; - permissions: { - view: abstract.MetadataPermission; - create: "CARDS_CREATE"; - update: abstract.MetadataPermission; - delete: abstract.MetadataPermission; - }; coreTypes: ["deck", "hand", "pile"]; } type CardsSchema = { - /** The _id which uniquely identifies this stack of Cards document */ + /** The _id which uniquely identifies this stack of cards */ _id: fields.DocumentIdField; - /** The text name of this stack */ + /** The name of this stack of cards */ name: fields.StringField; - /** The type of this stack, in BaseCards.metadata.types */ - type: fields.StringField; - /** A text description of this stack */ + /** The subtype which configures the system data model applied */ + type: fields.DocumentTypeField; + /** The descript of this stack of cards */ description: fields.HTMLField; - /** An image or video which is used to represent the stack of cards */ + /** An image or video which is used to represent this stack of cards */ img: fields.FilePathField; - /** Game system data which is defined by the system template.json model */ + /** They system data object which is defined by the system data model */ system: fields.TypeDataField; - /** A collection of Card documents which currently belong to this stack */ + /** An EmbeddedCollection of Card documents which currently belong to this stack of cards */ cards: fields.EmbeddedCollectionField>; /** The visible width of this stack */ width: fields.NumberField; @@ -77,15 +62,15 @@ type CardsSchema = { rotation: fields.AngleField; /** Whether or not to publicly display the number of cards in this stack */ displayCount: fields.BooleanField; - /** The _id of a Folder which contains this document */ + /** The Folder which contains this stack of cards */ folder: fields.ForeignDocumentField; - /** The sort order of this stack relative to others in its parent collection */ + /** The numeric sort valute which orders this stack of cards relative to its siblings */ sort: fields.IntegerSortField; - /** An object which configures user permissions to this stack */ + /** An object which configures ownership of this stack of cards */ ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information */ + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/chat-message.d.mts b/types/foundry/common/documents/chat-message.d.mts index 4af139222aa..6b0331d799b 100644 --- a/types/foundry/common/documents/chat-message.d.mts +++ b/types/foundry/common/documents/chat-message.d.mts @@ -1,46 +1,57 @@ import Roll from "@client/dice/roll.mjs"; import { AudioFilePath, ChatMessageStyle, DocumentOwnershipNumber } from "@common/constants.mjs"; import { DocumentFlags } from "@common/data/_module.mjs"; -import { Document, DocumentMetadata } from "../abstract/_module.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; import BaseUser from "./user.mjs"; /** - * The ChatMessage document model. - * @memberof documents - * - * @param data Initial data from which to construct the document. - * @property data The constructed data object for the document. + * The ChatMessage Document. + * Defines the DataSchema and common behaviors for a ChatMessage which are shared between both client and server. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars export default class BaseChatMessage extends Document< null, ChatMessageSchema > { - static override get metadata(): ChatMessageMetadata; + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ + + static override get metadata(): Readonly; static override defineSchema(): ChatMessageSchema; override getUserLevel(user: BaseUser): DocumentOwnershipNumber; } -export default interface BaseChatMessage +export default interface BaseChatMessage extends Document, Omit, "author"> { get documentName(): ChatMessageMetadata["name"]; author: TUser; } +interface ChatMessageMetadata extends DocumentClassMetadata { + name: "ChatMessage"; + collection: "messages"; + label: "DOCUMENT.ChatMessage"; + labelPlural: "DOCUMENT.ChatMessages"; + hasTypeData: true; + baseTypeAllowed: true; + isPrimary: true; +} + declare type ChatMessageSchema = { /** The _id which uniquely identifies this ChatMessage document */ _id: fields.DocumentIdField; - /** An ChatMessage subtype which configures the system data model applied */ + /** An ChatMEssage subtype which configures the system data model applied */ type: fields.DocumentTypeField; - /** The system data object */ + /** They system data object which is defined by the system data model */ system: fields.TypeDataField; /** The message style from CONST.CHAT_MESSAGE_STYLES */ style: fields.NumberField; - /** The _id of the User document who generated this message */ + /** The User Document who generated this message */ author: fields.ForeignDocumentField; /** The timestamp at which point this message was generated */ timestamp: fields.NumberField; @@ -48,21 +59,21 @@ declare type ChatMessageSchema = { flavor: fields.HTMLField; /** The HTML content of this chat message */ content: fields.HTMLField; - /** A ChatSpeakerData object which describes the origin of the ChatMessage */ + /** A ChatSpeakData object which describes the origin of the ChatMessage */ speaker: fields.SchemaField; - /** An array of User _id values to whom this message is privately whispered */ + /** An array of User _id values to whome this message is privately whispered */ whisper: fields.ArrayField>; /** Is this message sent blindly where the creating User cannot see it? */ blind: fields.BooleanField; /** Serialized content of any Roll instances attached to the ChatMessage */ rolls: fields.ArrayField>; - /** The URL of an audio file which plays when this message is received */ + /** The audio file path which plays when this message is received */ sound: fields.FilePathField; - /** Is this message styled as an emote? */ + /** IS this message syled as an emote? */ emote: fields.BooleanField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information. */ + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; @@ -77,24 +88,14 @@ export type ChatMessageFlags = DocumentFlags & { declare type ChatSpeakerSchema = { /** The _id of the Scene where this message was created */ scene: fields.ForeignDocumentField; - /** The _id of the Actor who generated this message */ + /** The _id of Actor who generated this message */ actor: fields.ForeignDocumentField; - /** The _id of the Token who generated this message */ + /** The _id of Token who generated this message */ token: fields.ForeignDocumentField; - /** An overridden alias name used instead of the Actor or Token name */ + /** An overriden alias name used instead of the Actor or Token name */ alias: fields.StringField; }; export type ChatSpeakerData = fields.SourceFromSchema; -interface ChatMessageMetadata extends DocumentMetadata { - name: "ChatMessage"; - collection: "messages"; - label: "DOCUMENT.ChatMessage"; - labelPlural: "DOCUMENT.ChatMessages"; - isPrimary: true; -} - export type ChatMessageSource = fields.SourceFromSchema; - -export {}; diff --git a/types/foundry/common/documents/combat.d.mts b/types/foundry/common/documents/combat.d.mts index 5e99800b62d..d4d472049a3 100644 --- a/types/foundry/common/documents/combat.d.mts +++ b/types/foundry/common/documents/combat.d.mts @@ -1,10 +1,24 @@ -import { DatabaseUpdateCallbackOptions, Document, DocumentMetadata, EmbeddedCollection } from "../abstract/_module.mjs"; +import { + DatabaseUpdateCallbackOptions, + Document, + DocumentClassMetadata, + EmbeddedCollection, +} from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; -import { BaseCombatant, BaseScene, BaseUser } from "./_module.mjs"; +import { BaseCombatant, BaseCombatantGroup, BaseScene, BaseUser } from "./_module.mjs"; -/** The Combat document model. */ +/** + * The Combat Document. + * Defines the DataSchema and common behaviors for a Combat which are shared between both client and server. + */ export default class BaseCombat extends Document { - static override get metadata(): CombatMetadata; + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ + + static override get metadata(): Readonly; + + static override LOCALIZATION_PREFIXES: string[]; static override defineSchema(): CombatSchema; @@ -20,39 +34,49 @@ export default class BaseCombat extends Document { } export default interface BaseCombat extends Document, fields.ModelPropsFromSchema { - readonly combatants: EmbeddedCollection>; - get documentName(): CombatMetadata["name"]; + + readonly combatants: EmbeddedCollection>; + readonly groups: EmbeddedCollection>; } -interface CombatMetadata extends DocumentMetadata { +interface CombatMetadata extends DocumentClassMetadata { name: "Combat"; collection: "combats"; label: "DOCUMENT.Combat"; + labelPlural: "DOCUMENT.Combats"; embedded: { Combatant: "combatants"; + CombatantGroup: "groups"; }; - isPrimary: true; + hasTypeData: true; + baseTypeAllowed: true; } type CombatSchema = { - /** The _id which uniquely identifies this Combat document */ + /** The _id which uniquely identifies this Combate document */ _id: fields.DocumentIdField; - /** The _id of a Scene within which this Combat occurs */ + /** An Combate subtype which configures the system data model applied */ + type: fields.DocumentTypeField; + /** They system data object which is defined by the system data model */ + system: fields.TypeDataField; + /** The Scene within which this Combat occurs */ scene: fields.ForeignDocumentField; - /** A Collection of Combatant embedded Documents */ + /** An EmbeddedCollection of CombatantGroup documents */ + groups: fields.EmbeddedCollectionField>; + /** An EmbeddedCollection of Combatant documents */ combatants: fields.EmbeddedCollectionField>; /** Is the Combat encounter currently active? */ active: fields.BooleanField; /** The current round of the Combat encounter */ round: fields.NumberField; - /** The current turn in the Combat round */ + /** The current turn of the Combat encounter */ turn: fields.NumberField; - /** The current sort order of this Combat relative to others in the same Scene */ + /** The numeric sort value which orders this Combat relative to its siblings */ sort: fields.IntegerSortField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information */ + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/combatant-group.d.mts b/types/foundry/common/documents/combatant-group.d.mts index 24d37cd0e10..710d2547a63 100644 --- a/types/foundry/common/documents/combatant-group.d.mts +++ b/types/foundry/common/documents/combatant-group.d.mts @@ -1,7 +1,8 @@ import { ImageFilePath } from "@common/constants.mjs"; -import Document, { DocumentMetadata } from "../abstract/document.mjs"; +import Document from "../abstract/document.mjs"; import * as fields from "../data/fields.mjs"; import BaseCombat from "./combat.mjs"; +import { DocumentClassMetadata } from "@common/abstract/_module.mjs"; /** * A Document that represents a grouping of individual Combatants in a Combat. @@ -23,26 +24,35 @@ export default class BaseCombatantGroup extends Document, fields.ModelPropsFromSchema {} -declare interface CombatantGroupMetadata extends DocumentMetadata { +declare interface CombatantGroupMetadata extends DocumentClassMetadata { name: "CombatantGroup"; collection: "groups"; label: "DOCUMENT.CombatantGroup"; labelPlural: "DOCUMENT.CombatantGroups"; isEmbedded: true; hasTypeData: true; - schemaVersion: "13.337"; + baseTypeAllowed: true; } -export type CombatantGroupSchema = { +type CombatantGroupSchema = { + /** The _id which uniquely identifies this CombatantGroup document */ _id: fields.DocumentIdField; - type: fields.DocumentTypeField<"base">; + /** An CombatantGroup subtype which configures the system data model applied */ + type: fields.DocumentTypeField; + /** They system data object which is defined by the system data model */ system: fields.TypeDataField; + /** The name of this CombatantGroup */ name: fields.StringField; + /** The image file path which provides the artwork for this CombatantGroup */ img: fields.FilePathField; + /** The initiative score for the CombatantGRoup which determins its turn order */ initiative: fields.NumberField; + /** An object which configures ownership of this CombatantGroup */ ownership: fields.DocumentOwnershipField; + /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; -export {}; +export type CombatantGroupSource = fields.SourceFromSchema; diff --git a/types/foundry/common/documents/combatant.d.mts b/types/foundry/common/documents/combatant.d.mts index 5c9ed1e7fb2..0faa1027d94 100644 --- a/types/foundry/common/documents/combatant.d.mts +++ b/types/foundry/common/documents/combatant.d.mts @@ -1,47 +1,75 @@ import { ImageFilePath } from "@common/constants.mjs"; -import { Document, DocumentMetadata } from "../abstract/_module.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; import BaseCombat from "./combat.mjs"; -/** The Combat document model. */ -export default class BaseCombatant extends Document { - static override get metadata(): CombatantMetadata; +/** + * The Combatant Document. + * Defines the DataSchema and common behaviors for a Combatant which are shared between both client and server. + */ +export default class BaseCombatant extends Document< + TParent, + CombatantSchema +> { + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ + + static override get metadata(): Readonly; static override defineSchema(): CombatantSchema; + + static override LOCALIZATION_PREFIXES: string[]; + + override getUserLevel(user: foundry.documents.BaseUser): CONST.DocumentOwnershipNumber; } -export default interface BaseCombatant +export default interface BaseCombatant extends Document, fields.ModelPropsFromSchema { get documentName(): CombatantMetadata["name"]; } -interface CombatantMetadata extends DocumentMetadata { +interface CombatantMetadata extends DocumentClassMetadata { name: "Combatant"; collection: "combatants"; label: "DOCUMENT.Combatant"; + labelPlural: "DOCUMENT.Combatants"; + isEmbedded: true; + hasTypeData: true; + baseTypeAllowed: true; } -/** The data schema for a Combat document. */ type CombatantSchema = { - /** The _id which uniquely identifies this Combatant embedded document */ + /** The _id which uniquely identifies this Combatant document */ _id: fields.DocumentIdField; + /** A Combatant subtype which configures the system data model applied */ + type: fields.DocumentTypeField; + /** They system data object which is defined by the system data model */ + system: fields.TypeDataField; /** The _id of an Actor associated with this Combatant */ actorId: fields.ForeignDocumentField; /** The _id of a Token associated with this Combatant */ tokenId: fields.ForeignDocumentField; + /** The _id of a Scene associated with this Combatant */ sceneId: fields.ForeignDocumentField; - /** A customized name which replaces the name of the Token in the tracker */ + /** A customized name which replaces the name of the Actor/Token in the tracker */ name: fields.StringField; - /** A customized image which replaces the Token image in the tracker */ + /** A customized image which replaced the Token image in the tracker */ img: fields.FilePathField; /** The initiative score for the Combatant which determines its turn order */ initiative: fields.NumberField; - /** Is this Combatant currently hidden? */ + /** Is the Combatant currently hidden? */ hidden: fields.BooleanField; /** Has this Combatant been defeated? */ defeated: fields.BooleanField; + /** The _id of the CombatantGroup that this Combatant is associated with */ + group: fields.DocumentIdField; + /** The rounder that this Combatant joined initiative */ + roundJoined: fields.NumberField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; + /** An object containing document metadata */ + _stats: fields.DocumentStatsField; }; export type CombatantSource = fields.SourceFromSchema; diff --git a/types/foundry/common/documents/drawing.d.mts b/types/foundry/common/documents/drawing.d.mts index 68165bef7c6..3d6198f40f7 100644 --- a/types/foundry/common/documents/drawing.d.mts +++ b/types/foundry/common/documents/drawing.d.mts @@ -1,62 +1,57 @@ -import { DocumentOwnershipLevel, DrawingFillType, ImageFilePath } from "@common/constants.mjs"; +import { DrawingFillType, ImageFilePath } from "@common/constants.mjs"; import * as abstract from "../abstract/_module.mjs"; import * as data from "../data/data.mjs"; import * as fields from "../data/fields.mjs"; import { BaseScene, BaseUser } from "./_module.mjs"; /** - * The Document definition for a Drawing. + * The Drawing Document. * Defines the DataSchema and common behaviors for a Drawing which are shared between both client and server. - * @memberof documents - * - * @param data Initial data from which to construct the Drawing - * @param context Construction context options */ -export default class BaseDrawing extends abstract.Document { +export default class BaseDrawing extends abstract.Document< + TParent, + DrawingSchema +> { /* ---------------------------------------- */ /* Model Configuration */ /* ---------------------------------------- */ - static override get metadata(): DrawingMetadata; + static override get metadata(): Readonly; + + static override LOCALIZATION_PREFIXES: string[]; static override defineSchema(): DrawingSchema; static override validateJoint(data: DrawingSource): void; + static override canUserCreate(user: BaseUser): boolean; + /* ---------------------------------------- */ /* Model Methods */ /* ---------------------------------------- */ - override testUserPermission( - user: BaseUser, - permission: DocumentOwnershipLevel, - { exact }?: { exact?: boolean }, - ): boolean; + override getUserLevel(user: BaseUser): CONST.DocumentOwnershipNumber; } -export default interface BaseDrawing +export default interface BaseDrawing extends abstract.Document, fields.ModelPropsFromSchema { get documentName(): DrawingMetadata["name"]; } -interface DrawingMetadata extends abstract.DocumentMetadata { +interface DrawingMetadata extends abstract.DocumentClassMetadata { name: "Drawing"; collection: "drawings"; label: "DOCUMENT.Drawing"; labelPlural: "DOCUMENT.Drawings"; isEmbedded: true; - permissions: { - view: abstract.MetadataPermission; - create: "DRAWING_CREATE"; - update: abstract.MetadataPermission; - delete: abstract.MetadataPermission; - }; } type DrawingSchema = { - /** The _id which uniquely identifies this BaseDrawing embedded document */ + /** The _id which uniquely identifies this Drawing document */ _id: fields.DocumentIdField; - /** The _id of the user who created the drawing */ + /** The name of this Drawing */ + name: fields.StringField; + /** The user who created this drawing */ author: fields.ForeignDocumentField; /** The geometric shape of the drawing */ shape: fields.EmbeddedDataField>>; @@ -64,25 +59,29 @@ type DrawingSchema = { x: fields.NumberField; /** The y-coordinate position of the top-left corner of the drawn shape */ y: fields.NumberField; - /** The z-index of this drawing relative to other siblings */ - z: fields.NumberField; + /** The elevation of the drawn shape */ + elevation: fields.NumberField; + /** Any array of Levels that this Drawing is on */ + levels: fields.SceneLevelsSetField; + /** The numeric sort value which orders this Actor relative to its siblings */ + sort: fields.NumberField; /** The angle of rotation for the drawing figure */ rotation: fields.AngleField; - /** An amount of bezier smoothing applied, between 0 and 1 */ + /** An amoutn of bezier smoothing applied, between 0 and 1 */ bezierFactor: fields.AlphaField; - /** The fill type of the drawing shape, a value from CONST.DRAWING_FILL_TYPES */ + /** The fill type of the drawing shapw, a value from CONST.DRAWING_FILL_TYPES */ fillType: fields.NumberField; - /** An optional color string with which to fill the drawing geometry */ + /** An optional color string which to fill the drawing geometry */ fillColor: fields.ColorField; - /** The opacity of the fill applied to the drawing geometry */ + /** The opacity of hte fill applied to the drawing geometery */ fillAlpha: fields.AlphaField; - /** The width in pixels of the boundary lines of the drawing geometry */ + /** The width in pixels of the boundary lines of the drawing geometery */ strokeWidth: fields.NumberField; - /** The color of the boundary lines of the drawing geometry */ + /** The color of the boundary lines of the drawing geometery */ strokeColor: fields.ColorField; - /** The opacity of the boundary lines of the drawing geometry */ + /** The opacity of the boundary lines of the drawing geometery */ strokeAlpha: fields.AlphaField; - /** The path to a tiling image texture used to fill the drawing geometry */ + /** The path to a tiling image texture used to file the drawing geometery */ texture: fields.FilePathField; /** Optional text which is displayed overtop of the drawing */ text: fields.StringField; @@ -98,7 +97,9 @@ type DrawingSchema = { hidden: fields.BooleanField; /** Is the drawing currently locked? */ locked: fields.BooleanField; - /** An object of optional key/value flags */ + /** IS the drawing rendered in the interface group? */ + interface: fields.BooleanField; + /** An object containing document metadata */ flags: fields.DocumentFlagsField; }; diff --git a/types/foundry/common/documents/fog-exploration.d.mts b/types/foundry/common/documents/fog-exploration.d.mts index bdb8de90f51..f46c662d7e3 100644 --- a/types/foundry/common/documents/fog-exploration.d.mts +++ b/types/foundry/common/documents/fog-exploration.d.mts @@ -1,21 +1,25 @@ import { ImageFilePath } from "@common/constants.mjs"; -import { DatabaseUpdateCallbackOptions, Document, DocumentMetadata } from "../abstract/_module.mjs"; +import { DatabaseUpdateCallbackOptions, Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; import { BaseScene, BaseUser } from "./_module.mjs"; /** - * The Document definition for FogExploration. - * Defines the DataSchema and common behaviors for FogExploration which are shared between both client and server. - * @memberof documents - * - * @param data Initial data from which to construct the FogExploration - * @param context Construction context options + * The FogExploration Document. + * Defines the DataSchema and common behaviors for a FogExploration which are shared between both client and server. */ export default class BaseFogExploration extends Document { - static override get metadata(): FogExplorationMetadata; + /* ---------------------------------------- */ + /* Model Configuration */ + /* ---------------------------------------- */ + + static override get metadata(): Readonly; static override defineSchema(): FogExplorationSchema; + /* ---------------------------------------- */ + /* Database Event Handlers */ + /* ---------------------------------------- */ + protected override _preUpdate( changed: DeepPartial, options: DatabaseUpdateCallbackOptions, @@ -28,7 +32,7 @@ export default interface BaseFogExploration get documentName(): FogExplorationMetadata["name"]; } -interface FogExplorationMetadata extends DocumentMetadata { +interface FogExplorationMetadata extends DocumentClassMetadata { name: "FogExploration"; collection: "fog"; label: "DOCUMENT.FogExploration"; @@ -39,17 +43,22 @@ interface FogExplorationMetadata extends DocumentMetadata { type FogExplorationSchema = { /** The _id which uniquely identifies this FogExploration document */ _id: fields.DocumentIdField; - /** The _id of the Scene document to which this fog applies */ - scene: fields.ForeignDocumentField; - /** The _id of the User document to which this fog applies */ + /** The User document which this FogExploration applies to */ user: fields.ForeignDocumentField; - /** The base64 png image of the explored fog polygon */ + /** The Scene document which this FogExploration applies to */ + scene: fields.ForeignDocumentField; + /** The _id of the Level to which this FogExploration applies to */ + level: fields.DocumentIdField; + /** The base64 png image ofthe explored fog polygon */ explored: fields.FilePathField; /** The object of scene positions which have been explored at a certain vision radius */ positions: fields.ObjectField; /** The timestamp at which this fog exploration was last updated */ timestamp: fields.NumberField; + /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; + /** An object containing document metadata */ + _stats: fields.DocumentStatsField; }; export type FogExplorationSource = fields.SourceFromSchema; diff --git a/types/foundry/common/documents/folder.d.mts b/types/foundry/common/documents/folder.d.mts index 2a753026f9e..513ae2b3080 100644 --- a/types/foundry/common/documents/folder.d.mts +++ b/types/foundry/common/documents/folder.d.mts @@ -1,18 +1,17 @@ -import { Document, DocumentMetadata } from "../abstract/_module.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import { FOLDER_DOCUMENT_TYPES, FolderDocumentType } from "../constants.mjs"; import * as fields from "../data/fields.mjs"; /** - * The Folder Document model. - * - * @param data Initial data from which to construct the document. - * @property data The constructed data object for the document. + * The Folder Document. + * Defines the DataSchema and common behaviors for a Folder which are shared between both client and server. */ export default class BaseFolder extends Document { /* ---------------------------------------- */ /* Model Configuration */ /* ---------------------------------------- */ - static override get metadata(): FolderMetadata; + + static override get metadata(): Readonly; static override defineSchema(): FolderSchema; @@ -30,7 +29,7 @@ export default interface BaseFolder extends Document, fields get documentName(): FolderMetadata["name"]; } -interface FolderMetadata extends DocumentMetadata { +interface FolderMetadata extends DocumentClassMetadata { name: "Folder"; collection: "folders"; label: "DOCUMENT.Folder"; @@ -46,19 +45,20 @@ type FolderSchema = { /** The name of this Folder */ name: fields.StringField; /** The document type which this Folder contains, from CONST.FOLDER_DOCUMENT_TYPES */ - type: fields.StringField; + type: fields.DocumentTypeField; /** An HTML description of the contents of this folder */ description: fields.StringField; + /** The Folder which contains this Folder */ folder: fields.ForeignDocumentField; /** The sorting mode used to organize documents within this Folder, in ["a", "m"] */ sorting: fields.StringField; - /** The numeric sort value which orders this Folder relative to its siblings */ + /** The numeric sort value which orders this Actor relative to its siblings */ sort: fields.IntegerSortField; /** A color string used for the background color of this Folder */ color: fields.ColorField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information. */ + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/item.d.mts b/types/foundry/common/documents/item.d.mts index ed5ead0d915..4f305f24986 100644 --- a/types/foundry/common/documents/item.d.mts +++ b/types/foundry/common/documents/item.d.mts @@ -1,15 +1,11 @@ -import { DocumentOwnershipLevel, ImageFilePath, UserAction } from "@common/constants.mjs"; +import { ImageFilePath } from "@common/constants.mjs"; import * as abstract from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; import { BaseActiveEffect, BaseActor, BaseFolder, BaseUser, ItemUUID } from "./_module.mjs"; /** - * The Document definition for an Item. - * Defines the DataSchema and common behaviors for an Item which are shared between both client and server. - * @memberof documents - * - * @param data Initial data from which to construct the Item - * @param context Construction context options + * The Item Document. + * Defines the DataSchema and common behaviors for a Item which are shared between both client and server. */ export default class BaseItem extends abstract.Document< TParent, @@ -19,7 +15,7 @@ export default class BaseItem; static override defineSchema(): ItemSchema; @@ -28,21 +24,14 @@ export default class BaseItem): boolean; - - override testUserPermission( - user: BaseUser, - permission: DocumentOwnershipLevel, - { exact }?: { exact?: boolean }, - ): boolean; + static override canUserCreate(user: BaseUser): boolean; } export default interface BaseItem @@ -52,17 +41,16 @@ export default interface BaseItem>; } -interface ItemMetadata extends abstract.DocumentMetadata { +interface ItemMetadata extends abstract.DocumentClassMetadata { name: "Item"; collection: "items"; + hasTypeData: true; + baseTypeAllowed: false; indexed: true; compendiumIndexFields: ["_id", "name", "img", "type", "sort", "folder"]; embedded: { ActiveEffect: "effects" }; label: "DOCUMENT.Item"; labelPlural: "DOCUMENT.Items"; - permissions: Omit & { - create: "ITEM_CREATE"; - }; } export type ItemSchema = { @@ -71,22 +59,22 @@ export type ItemSchema; /** An Item subtype which configures the system data model applied */ - type: fields.StringField; + type: fields.DocumentTypeField; /** An image file path which provides the artwork for this Item */ img: fields.FilePathField; - /** The system data object which is defined by the system template.json model */ + /** They system data object which is defined by the system data model */ system: fields.TypeDataField; - /** A collection of ActiveEffect embedded Documents */ + /** An EmbeddedCollection of ActiveEffect documents */ effects: fields.EmbeddedCollectionField>>; - /** The _id of a Folder which contains this Item */ + /** The Folder which contains this Item */ folder: fields.ForeignDocumentField; /** The numeric sort value which orders this Item relative to its siblings */ sort: fields.IntegerSortField; - /** An object which configures ownership of this Item */ + /** An object which configures ownership of this Actor */ ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information */ + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/journal-entry-category.d.mts b/types/foundry/common/documents/journal-entry-category.d.mts index 1b469c9c0fd..0facb5fa5ff 100644 --- a/types/foundry/common/documents/journal-entry-category.d.mts +++ b/types/foundry/common/documents/journal-entry-category.d.mts @@ -1,4 +1,5 @@ -import Document, { DocumentMetadata } from "../abstract/document.mjs"; +import { DocumentClassMetadata } from "@common/abstract/_module.mjs"; +import Document from "../abstract/document.mjs"; import * as fields from "../data/fields.mjs"; import BaseJournalEntry from "./journal-entry.mjs"; @@ -6,22 +7,26 @@ import BaseJournalEntry from "./journal-entry.mjs"; * An embedded Document that represents a category in a JournalEntry. * Defines the DataSchema and common behaviors for a JournalEntryCategory which are shared between both client and * server. - * @category Documents */ -export default class BaseJournalEntryCategory extends Document< - TParent, - JournalEntryCategorySchema -> { +export default class BaseJournalEntryCategory< + TParent extends BaseJournalEntry | null = BaseJournalEntry | null, +> extends Document { /* -------------------------------------------- */ /* Model Configuration */ /* -------------------------------------------- */ - static override get metadata(): JournalEntryCategoryMetadata; + static override get metadata(): Readonly; static override defineSchema(): JournalEntryCategorySchema; } -interface JournalEntryCategoryMetadata extends DocumentMetadata { +export default interface BaseJournalEntryCategory< + TParent extends BaseJournalEntry | null = BaseJournalEntry | null, +> extends Document { + get documentName(): JournalEntryCategoryMetadata["name"]; +} + +interface JournalEntryCategoryMetadata extends DocumentClassMetadata { name: "JournalEntryCategory"; collection: "categories"; label: "DOCUMENT.JournalEntryCategory"; @@ -30,11 +35,14 @@ interface JournalEntryCategoryMetadata extends DocumentMetadata { } type JournalEntryCategorySchema = { + /** The _id which uniquely identifies this JournalEntryCategory document */ _id: fields.DocumentIdField; + /** The name of this JournalEntryCategory */ name: fields.StringField; + /** The numeric sort value which orders this JournalEntryCategory relative to its siblings */ sort: fields.IntegerSortField; + /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; - -export {}; diff --git a/types/foundry/common/documents/journal-entry-page.d.mts b/types/foundry/common/documents/journal-entry-page.d.mts index 33232791c03..4ff27ea1c96 100644 --- a/types/foundry/common/documents/journal-entry-page.d.mts +++ b/types/foundry/common/documents/journal-entry-page.d.mts @@ -1,32 +1,40 @@ -import { DocumentOwnershipNumber, JournalEntryPageFormat } from "@common/constants.mjs"; -import { Document, DocumentMetadata } from "../abstract/_module.mjs"; +import { JournalEntryPageFormat } from "@common/constants.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; -import { BaseJournalEntry, BaseUser } from "./_module.mjs"; +import { BaseJournalEntry } from "./_module.mjs"; + +/** + * The JournalEntryPage Document. + * Defines the DataSchema and common behaviors for a JournalEntryPage which are shared between both client and server. + */ +export default class BaseJournalEntryPage< + TParent extends BaseJournalEntry | null = BaseJournalEntry | null, +> extends Document { + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ -/** The JournalEntryPage document model. */ -export default class BaseJournalEntryPage extends Document< - TParent, - JournalEntryPageSchema -> { static override get metadata(): JournalEntryPageMetadata; static override defineSchema(): JournalEntryPageSchema; - override getUserLevel(user: BaseUser): DocumentOwnershipNumber; + static override LOCALIZATION_PREFIXES: string[]; } -export default interface BaseJournalEntryPage +export default interface BaseJournalEntryPage extends Document, fields.ModelPropsFromSchema { get documentName(): JournalEntryPageMetadata["name"]; } -interface JournalEntryPageMetadata extends DocumentMetadata { +interface JournalEntryPageMetadata extends DocumentClassMetadata { name: "JournalEntryPage"; collection: "pages"; + hasTypeData: true; indexed: true; label: "DOCUMENT.JournalEntryPage"; labelPlural: "DOCUMENT.JournalEntryPages"; - coreTypes: ["image", "pdf", "text", "video"]; + coreTypes: ["text", "image", "pdf", "video"]; + compendiumIndexFields: ["name", "type", "sort"]; } type JournalEntryPageSchema< @@ -34,27 +42,30 @@ type JournalEntryPageSchema< TSystemSource extends object = object, TSystemData extends object = TSystemSource, > = { + /** The _id which uniquely identifies this JournalEntryPage document */ _id: fields.DocumentIdField; - /** The text name of this page. */ + /** The name of this JournalEntryPage */ name: fields.StringField; - /** The type of this page, in {@link BaseJournalEntryPage.TYPES}. */ - type: fields.StringField; - /** Data that control's the display of this page's title. */ + /** An JournalEntryPage subtype which configures the system data model applied */ + type: fields.DocumentTypeField; + /** They system data object which is defined by the system data model */ + system: fields.TypeDataField; + /** Data the controls the display of this page's title */ title: fields.SchemaField<{ show: fields.BooleanField; level: fields.NumberField; }>; - /** Data particular to image journal entry pages. */ + /** Data particular to image journal entry pages */ image: fields.SchemaField<{ caption: fields.StringField; }>; - /** Data particular to text journal entry pages. */ + /** Data particular to text journal entry pages */ text: fields.SchemaField<{ content: fields.HTMLField; markdown: fields.StringField; format: fields.NumberField; }>; - /** Data particular to video journal entry pages. */ + /** Data particular to video journal entry pages */ video: fields.SchemaField<{ controls: fields.BooleanField; loop: fields.BooleanField; @@ -66,18 +77,18 @@ type JournalEntryPageSchema< }>; /** The URI of the image or other external media to be used for this page. */ src: fields.StringField; - /** System-specific data. */ - system: fields.TypeDataField; - /** The numeric sort value which orders this page relative to its siblings. */ + /** The _id of the JournalEntryCategory applied to this page */ + category: fields.DocumentIdField; + /** The numeric sort value which orders this JournalEntryPage relative to its siblings */ sort: fields.IntegerSortField; - /** An object which configures the ownership of this page. */ + /** An object which configures ownership of this JournalEntryPage */ ownership: fields.DocumentOwnershipField; - /** An object of optional key/value flags. */ + /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information */ + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; export type JournalEntryPageSource = fields.SourceFromSchema; -export type CorePageType = "image" | "pdf" | "text" | "video"; +export type CorePageType = JournalEntryPageMetadata["coreTypes"][number]; diff --git a/types/foundry/common/documents/journal-entry.d.mts b/types/foundry/common/documents/journal-entry.d.mts index 7e1e3d26706..68e0fb0af1d 100644 --- a/types/foundry/common/documents/journal-entry.d.mts +++ b/types/foundry/common/documents/journal-entry.d.mts @@ -1,35 +1,42 @@ -import { Document, DocumentMetadata, EmbeddedCollection } from "../abstract/_module.mjs"; +import { Document, DocumentClassMetadata, EmbeddedCollection } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; -import { BaseFolder, BaseJournalEntryPage } from "./_module.mjs"; +import { BaseFolder, BaseJournalEntryCategory, BaseJournalEntryPage } from "./_module.mjs"; -/** The JournalEntry document model. */ +/** + * The JournalEntry Document. + * Defines the DataSchema and common behaviors for a JournalEntry which are shared between both client and server. + */ export default class BaseJournalEntry extends Document { - static override get metadata(): JournalEntryMetadata; + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ + + static override get metadata(): Readonly; static override defineSchema(): JournalEntrySchema; + + static override LOCALIZATION_PREFIXES: string[]; } export default interface BaseJournalEntry extends Document, fields.ModelPropsFromSchema { - readonly pages: EmbeddedCollection>; - get documentName(): JournalEntryMetadata["name"]; + + readonly pages: EmbeddedCollection>; + readonly categories: EmbeddedCollection>; } -interface JournalEntryMetadata extends DocumentMetadata { +interface JournalEntryMetadata extends DocumentClassMetadata { name: "JournalEntry"; collection: "journal"; indexed: true; - compendiumIndexFields: ["_id", "name", "sort"]; + compendiumIndexFields: ["_id", "name", "sort", "folder"]; embedded: { + JournalEntryCategory: "categories"; JournalEntryPage: "pages"; }; label: "DOCUMENT.JournalEntry"; labelPlural: "DOCUMENT.JournalEntries"; - isPrimary: true; - permissions: Omit & { - create: "JOURNAL_CREATE"; - }; } type JournalEntrySchema = { @@ -37,17 +44,19 @@ type JournalEntrySchema = { _id: fields.DocumentIdField; /** The name of this JournalEntry */ name: fields.StringField; - /** The pages contained within this JournalEntry document */ + /** An EmbeddedCollection of JournalEntryPage documents */ pages: fields.EmbeddedCollectionField>; - /** The _id of a Folder which contains this JournalEntry */ + /** The Folder which contains this JournalEntry */ folder: fields.ForeignDocumentField; + /** An EmbeddedCollection of JournalEntryCategory documents */ + categories: fields.EmbeddedCollectionField>; /** The numeric sort value which orders this JournalEntry relative to its siblings */ sort: fields.IntegerSortField; /** An object which configures ownership of this JournalEntry */ ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information */ + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/level.d.mts b/types/foundry/common/documents/level.d.mts index 5a5c129e08c..9ff1ad5e99b 100644 --- a/types/foundry/common/documents/level.d.mts +++ b/types/foundry/common/documents/level.d.mts @@ -1,12 +1,12 @@ import { ImageFilePath, TextureDataFitMode, VideoFilePath } from "@common/constants.mjs"; -import Document, { DocumentMetadata } from "../abstract/document.mjs"; +import Document from "../abstract/document.mjs"; import * as fields from "../data/fields.mjs"; import BaseScene from "./scene.mjs"; +import { DocumentClassMetadata } from "@common/abstract/_module.mjs"; /** * The Level Document. * Defines the DataSchema and common behaviors for a Level which are shared between both client and server. - * @category Documents * * @example Create Scene Levels * ```js @@ -44,24 +44,27 @@ import BaseScene from "./scene.mjs"; * ]); * ``` */ -export default class BaseLevel extends Document { +export default class BaseLevel extends Document< + TParent, + LevelSchema +> { /* ---------------------------------------- */ /* Model Configuration */ /* ---------------------------------------- */ - static override metadata: LevelMetadata; + static override metadata: Readonly; static override LOCALIZATION_PREFIXES: string[]; static override defineSchema(): LevelSchema; } -export default interface BaseLevel +export default interface BaseLevel extends Document, fields.ModelPropsFromSchema { get documentName(): LevelMetadata["name"]; } -interface LevelMetadata extends DocumentMetadata { +interface LevelMetadata extends DocumentClassMetadata { name: "Level"; collection: "levels"; label: "DOCUMENT.Level"; @@ -70,27 +73,34 @@ interface LevelMetadata extends DocumentMetadata { } type LevelSchema = { + /** The _id which uniquely identifies this Level document */ _id: fields.DocumentIdField; + /** The name of this Level */ name: fields.StringField; + /** Data related to the elevation range of this Level */ elevation: fields.SchemaField<{ bottom: fields.NumberField; // Treat null as -Infinity top: fields.NumberField; // Treat null as +Infinity }>; + /** Data related to the background of this Level */ background: fields.SchemaField<{ color: fields.ColorField; src: fields.FilePathField; tint: fields.ColorField; alphaThreshold: fields.AlphaField; }>; + /** Data related to the foreground of this Level */ foreground: fields.SchemaField<{ src: fields.FilePathField; tint: fields.ColorField; alphaThreshold: fields.AlphaField; }>; + /** Data related to the fog settings of this Level */ fog: fields.SchemaField<{ src: fields.FilePathField; tint: fields.ColorField; }>; + /** Data related to the positioning of textures for this Level */ textures: fields.SchemaField<{ anchorX: fields.NumberField; anchorY: fields.NumberField; @@ -101,11 +111,14 @@ type LevelSchema = { scaleY: fields.NumberField; rotation: fields.AngleField; }>; + /** Data related to the visibility of this Level */ visibility: fields.SchemaField<{ levels: fields.SceneLevelsSetField; }>; + /** The numeric sort value which orders this Level relative to its siblings */ sort: fields.IntegerSortField; + /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; }; -export {}; +export type LevelSource = fields.SourceFromSchema; diff --git a/types/foundry/common/documents/macro.d.mts b/types/foundry/common/documents/macro.d.mts index 286b6dc24d5..4698cbe226f 100644 --- a/types/foundry/common/documents/macro.d.mts +++ b/types/foundry/common/documents/macro.d.mts @@ -1,26 +1,25 @@ import { ImageFilePath, MacroScope, MacroType } from "@common/constants.mjs"; -import { Document, DocumentMetadata, MetadataPermission } from "../abstract/_module.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import { DatabaseCreateCallbackOptions } from "../abstract/_types.mjs"; import * as fields from "../data/fields.mjs"; import BaseUser from "./user.mjs"; +import BaseFolder from "./folder.mjs"; /** - * The Document definition for a Macro. + * The Macro Document. * Defines the DataSchema and common behaviors for a Macro which are shared between both client and server. - * @memberof documents - * - * @param data Initial data from which to construct the Macro - * @param context Construction context options */ export default class BaseMacro extends Document { /* -------------------------------------------- */ /* Model Configuration */ /* -------------------------------------------- */ - static override get metadata(): MacroMetadata; + static override get metadata(): Readonly; static override defineSchema(): MacroSchema; + static override LOCALIZATION_PREFIXES: string[]; + /** The default icon used for newly created Macro documents. */ static DEFAULT_ICON: ImageFilePath; @@ -28,7 +27,11 @@ export default class BaseMacro extends Document { /* Model Methods */ /* -------------------------------------------- */ - override testUserPermission(user: BaseUser, permission: unknown, options?: { exact?: boolean }): boolean; + static override validateJoint(data: fields.SourceFromSchema): void; + + static override canUserCreate(user: BaseUser): boolean; + + override getUserLevel(user: BaseUser): CONST.DocumentOwnershipNumber; /* -------------------------------------------- */ /* Database Event Handlers */ @@ -45,7 +48,7 @@ export default interface BaseMacro extends Document, fields.M get documentName(): MacroMetadata["name"]; } -interface MacroMetadata extends DocumentMetadata { +interface MacroMetadata extends DocumentClassMetadata { name: "Macro"; collection: "macros"; indexed: true; @@ -53,12 +56,6 @@ interface MacroMetadata extends DocumentMetadata { label: "DOCUMENT.Macro"; labelPlural: "DOCUMENT.Macros"; coreTypes: MacroType[]; - permissions: { - view: MetadataPermission; - create: "PLAYER"; - update: MetadataPermission; - delete: MetadataPermission; - }; } type MacroSchema = { @@ -67,8 +64,8 @@ type MacroSchema = { /** The name of this Macro */ name: fields.StringField; /** A Macro subtype from CONST.MACRO_TYPES */ - type: fields.StringField; - /** The _id of a User document which created this Macro */ + type: fields.DocumentTypeField; + /** The User who created this Macro */ author: fields.ForeignDocumentField; /** An image file path which provides the thumbnail artwork for this Macro */ img: fields.FilePathField; @@ -76,15 +73,15 @@ type MacroSchema = { scope: fields.StringField; /** The string content of the macro command */ command: fields.StringField; - /** The _id of a Folder which contains this Macro */ - folder: fields.ForeignDocumentField; + /** The Folder which contains this Macro */ + folder: fields.ForeignDocumentField; /** The numeric sort value which orders this Macro relative to its siblings */ sort: fields.IntegerSortField; /** An object which configures ownership of this Macro */ ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information */ + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/note.d.mts b/types/foundry/common/documents/note.d.mts index 065da93f6a7..7c98085b45b 100644 --- a/types/foundry/common/documents/note.d.mts +++ b/types/foundry/common/documents/note.d.mts @@ -1,26 +1,27 @@ -import { DocumentOwnershipLevel, ImageFilePath, TextAnchorPoint } from "@common/constants.mjs"; -import { Document, DocumentMetadata, MetadataPermission } from "../abstract/_module.mjs"; +import { ImageFilePath, TextAnchorPoint } from "@common/constants.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import * as data from "../data/data.mjs"; import * as fields from "../data/fields.mjs"; import { BaseScene, BaseUser } from "./_module.mjs"; /** - * The Document definition for a Note. + * The Note Document. * Defines the DataSchema and common behaviors for a Note which are shared between both client and server. - * @memberof documents - * - * @param data Initial data from which to construct the Note - * @param context Construction context options */ -export default class BaseNote extends Document { +export default class BaseNote extends Document< + TParent, + NoteSchema +> { /* -------------------------------------------- */ /* Model Configuration */ /* -------------------------------------------- */ - static override get metadata(): NoteMetadata; + static override get metadata(): Readonly; static override defineSchema(): NoteSchema; + static override LOCALIZATION_PREFIXES: string[]; + /** The default icon used for newly created Note documents. */ static DEFAULT_ICON: ImageFilePath; @@ -28,34 +29,28 @@ export default class BaseNote extends Document /* Model Methods */ /* -------------------------------------------- */ - override testUserPermission( - user: BaseUser, - permission: DocumentOwnershipLevel, - { exact }?: { exact?: boolean }, - ): boolean; + static override canUserCreate(user: BaseUser): boolean; + + override getUserLevel(user: BaseUser): CONST.DocumentOwnershipNumber; } -export default interface BaseNote +export default interface BaseNote extends Document, fields.ModelPropsFromSchema { get documentName(): NoteMetadata["name"]; } -interface NoteMetadata extends DocumentMetadata { +interface NoteMetadata extends DocumentClassMetadata { name: "Note"; collection: "notes"; label: "DOCUMENT.Note"; labelPlural: "DOCUMENT.Notes"; - permissions: { - view: MetadataPermission; - create: "NOTE_CREATE"; - update: MetadataPermission; - delete: MetadataPermission; - }; } type NoteSchema = { - /** The _id which uniquely identifies this BaseNote embedded document */ + /** The _id which uniquely identifies this Note document */ _id: fields.DocumentIdField; + /** The user who created this Note */ + author: fields.DocumentAuthorField; /** The _id of a JournalEntry document which this Note represents */ entryId: fields.ForeignDocumentField; /** The _id of a specific JournalEntryPage document which this Note represents */ @@ -64,6 +59,14 @@ type NoteSchema = { x: fields.NumberField; /** The y-coordinate position of the center of the note icon */ y: fields.NumberField; + /** The elevation of the note icon */ + elevation: fields.NumberField; + /** An array of Levels that this Note is on */ + levels: fields.SceneLevelsSetField; + /** The numeric sort value which orders this Note relative to its siblings */ + sort: fields.NumberField; + /** Is this Note currently locked? */ + locked: fields.BooleanField; /** An image icon used to represent this note */ texture: data.TextureData; /** The pixel size of the map note icon */ diff --git a/types/foundry/common/documents/playlist-sound.d.mts b/types/foundry/common/documents/playlist-sound.d.mts index 812d882fffb..24ca71dd4ed 100644 --- a/types/foundry/common/documents/playlist-sound.d.mts +++ b/types/foundry/common/documents/playlist-sound.d.mts @@ -1,22 +1,25 @@ -import { AudioFilePath, DocumentOwnershipLevel } from "@common/constants.mjs"; -import { Document, DocumentMetadata } from "../abstract/_module.mjs"; +import { AudioFilePath } from "@common/constants.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; -import { BasePlaylist, BaseUser } from "./_module.mjs"; +import { BasePlaylist } from "./_module.mjs"; -/** The PlaylistSound document model. */ +/** + * The PlaylistSound Document. + * Defines the DataSchema and common behaviors for a PlaylistSound which are shared between both client and server. + */ export default class BasePlaylistSound extends Document< TParent, PlaylistSoundSchema > { - static override get metadata(): PlaylistSoundMetadata; + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ + + static override get metadata(): Readonly; static override defineSchema(): PlaylistSoundSchema; - override testUserPermission( - user: BaseUser, - permission: DocumentOwnershipLevel, - { exact }?: { exact?: boolean }, - ): boolean; + static override LOCALIZATION_PREFIXES: string[]; } export default interface BasePlaylistSound @@ -24,24 +27,25 @@ export default interface BasePlaylistSound; - /** The description of this sound */ + /** The description of this PlaylistSound */ description: fields.StringField; - /** The audio file path that is played by this sound */ + /** The audio file path that is played by this PlaylistSound */ path: fields.FilePathField; - /** Is this sound currently playing? */ + /** IS this PlaylistSound currently playing? */ playing: fields.BooleanField; /** The time in seconds at which playback was paused */ pausedTime: fields.NumberField; @@ -51,7 +55,7 @@ type PlaylistSoundSchema = { volume: fields.AlphaField; /** A duration in milliseconds to fade volume transition */ fade: fields.NumberField; - /** The sort order of the PlaylistSound relative to others in the same collection */ + /** The numeric sort value which orders this PlaylistSound relative to its siblings */ sort: fields.IntegerSortField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; diff --git a/types/foundry/common/documents/playlist.d.mts b/types/foundry/common/documents/playlist.d.mts index 974586d9227..8d8305b1c56 100644 --- a/types/foundry/common/documents/playlist.d.mts +++ b/types/foundry/common/documents/playlist.d.mts @@ -1,23 +1,32 @@ -import { PlaylistMode, PlaylistSortMode } from "@common/constants.mjs"; -import { Document, DocumentMetadata, EmbeddedCollection } from "../abstract/_module.mjs"; +import { AudioChannel, PlaylistMode, PlaylistSortMode } from "@common/constants.mjs"; +import { Document, DocumentClassMetadata, EmbeddedCollection } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; import { BaseFolder, BasePlaylistSound } from "./_module.mjs"; -/** The Playlist document model. */ +/** + * The Playlist Document. + * Defines the DataSchema and common behaviors for a Playlist which are shared between both client and server. + */ export default class BasePlaylist extends Document { - static override get metadata(): PlaylistMetadata; + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ + + static override get metadata(): Readonly; static override defineSchema(): PlaylistSchema; + + static override LOCALIZATION_PREFIXES: string[]; } export default interface BasePlaylist extends Document, fields.ModelPropsFromSchema { get documentName(): PlaylistMetadata["name"]; - readonly sounds: EmbeddedCollection; + readonly sounds: EmbeddedCollection>; } -interface PlaylistMetadata extends DocumentMetadata { +interface PlaylistMetadata extends DocumentClassMetadata { name: "Playlist"; collection: "playlists"; indexed: true; @@ -28,22 +37,36 @@ interface PlaylistMetadata extends DocumentMetadata { } type PlaylistSchema = { + /** The _id which uniquely identifies this Playlist document */ _id: fields.DocumentIdField; + /** The name of this Playlist */ name: fields.StringField; + /** The description of this Playlist */ description: fields.StringField; + /** An EmbeddedCollection of PlaylistSound documents */ sounds: fields.EmbeddedCollectionField>; + /** The audio channel this Playlist is played on, CONST.AUDIO_CHANNELS */ + channel: fields.StringField; + /** The mode of this Playlist, CONST.PLAYLIST_MODES */ mode: fields.NumberField; + /** Is this Playlist currently playing? */ playing: fields.BooleanField; + /** A duration in milliseconds to fade volume transition */ fade: fields.NumberField; + /** The Folder which contains this Playlist */ folder: fields.ForeignDocumentField; + /** How this Playlist is sorted, CONST.PLAYLIST_SORT_MODES */ sorting: fields.StringField; + /** A stored seed used for randomization to guarantee that all clients generate the same random order */ seed: fields.NumberField; + /** The numeric sort value which orders this Playlist relative to its siblings */ sort: fields.IntegerSortField; + /** An object which configures ownership of this Playlist */ ownership: fields.DocumentOwnershipField; + /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; export type PlaylistSource = fields.SourceFromSchema; - -export {}; diff --git a/types/foundry/common/documents/region-behavior.d.mts b/types/foundry/common/documents/region-behavior.d.mts index e1de3604d54..71a73a3288b 100644 --- a/types/foundry/common/documents/region-behavior.d.mts +++ b/types/foundry/common/documents/region-behavior.d.mts @@ -9,9 +9,19 @@ import BaseRegion from "./region.mjs"; export default class BaseRegionBehavior< TParent extends BaseRegion | null = BaseRegion | null, > extends abstract.Document { - static override get metadata(): RegionBehaviorMetadata; + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ + + static override get metadata(): Readonly; static override defineSchema(): RegionBehaviorSchema; + + static override LOCALIZATION_PREFIXES: string[]; + + static override canUserCreate(user: foundry.documents.BaseUser): boolean; + + override getUserLevel(user: foundry.documents.BaseUser): CONST.DocumentOwnershipNumber; } export default interface BaseRegionBehavior @@ -19,15 +29,20 @@ export default interface BaseRegionBehavior = { - /** The _id which uniquely identifies this RegionBehavior document */ + /** The _id which uniquely identifies this RegionBehavior document */ _id: fields.DocumentIdField; - /** The name used to describe the RegionBehavior */ + /** The name of this RegionBehavior */ name: fields.StringField; - /** A RegionBehavior subtype which configures the system data model applied */ + /** An RegionBehavior subtype which configures the system data model applied */ type: fields.DocumentTypeField; - /** The system data object which is defined by the system template.json model */ + /** They system data object which is defined by the system data model */ system: fields.TypeDataField; - /** Is the RegionBehavior currently disabled? */ + /** IS the RegionBehavior currently disabled? */ disabled: fields.BooleanField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information */ + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/region.d.mts b/types/foundry/common/documents/region.d.mts index fc0c6c009b3..d2fb8456b76 100644 --- a/types/foundry/common/documents/region.d.mts +++ b/types/foundry/common/documents/region.d.mts @@ -1,7 +1,7 @@ import { DatabaseUpdateCallbackOptions, Document, - DocumentMetadata, + DocumentClassMetadata, EmbeddedCollection, } from "@common/abstract/_module.mjs"; import { DocumentOwnershipNumber, EdgeRestrictionType, RegionVisibilityType } from "../constants.mjs"; @@ -9,11 +9,19 @@ import { BaseShapeData } from "../data/data.mjs"; import * as fields from "../data/fields.mjs"; import { BaseRegionBehavior, BaseScene, BaseUser } from "./_module.mjs"; +/** + * The Region Document. + * Defines the DataSchema and common behaviors for a Region which are shared between both client and server. + */ export default class BaseRegion extends Document< TParent, RegionSchema > { - static override get metadata(): RegionMetadata; + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ + + static override get metadata(): Readonly; static override defineSchema(): RegionSchema; @@ -49,7 +57,7 @@ export default interface BaseRegion>; } -interface RegionMetadata extends DocumentMetadata { +interface RegionMetadata extends DocumentClassMetadata { name: "Region"; collection: "regions"; label: "DOCUMENT.Region"; @@ -61,33 +69,41 @@ interface RegionMetadata extends DocumentMetadata { } type RegionSchema = { - /** The Region _id which uniquely identifies it within its parent Scene */ + /** The _id which uniquely identifies this Region document */ _id: fields.DocumentIdField; - /** The name used to describe the Region */ + /** The name of this Region */ name: fields.StringField; /** The color used to highlight the Region */ color: fields.ColorField; /** The shapes that make up the Region */ shapes: fields.ArrayField>; - /** The elevation */ + /** The elevation of this Region */ elevation: fields.SchemaField; - /** The level IDs */ + /** An array of Levels that this Region is on */ levels: fields.SceneLevelsSetField; + /** Data related to if this Region is restricted by walls */ restriction: fields.SchemaField<{ enabled: fields.BooleanField; type: fields.StringField; priority: fields.NumberField; }>; + /** Data related to which Token this Region is attached to */ attachment: fields.SchemaField<{ token: fields.ForeignDocumentField; }>; - /** A collection of embedded RegionBehavior objects */ + /** An EmbeddedCollection of RegionBehavior documents */ behaviors: fields.EmbeddedCollectionField>; + /** When is this Region visible, see CONST.REGION_VISIBILITY */ visibility: fields.NumberField; + /** Are the true shapes of this Region highlighted, or are the grid spaces fully in the Region highlighted */ highlightMode: fields.StringField; + /** Are the measurements of this Region visible? */ displayMeasurements: fields.BooleanField; - /** Whether this region is locked or not */ + /** Is this Region currently hidden? */ + hidden: fields.BooleanField; + /** Is this Region currently locked? */ locked: fields.BooleanField; + /** An object which configures ownership of this Actor */ ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; @@ -100,12 +116,8 @@ type RegionSchema = { export type RegionHighlightMode = "shapes" | "coverage"; type RegionElevationSchema = { - /** null -> -Infinity */ bottom: fields.NumberField; - /** null -> +Infinity */ top: fields.NumberField; }; export type RegionSource = fields.SourceFromSchema; - -export {}; diff --git a/types/foundry/common/documents/roll-table.d.mts b/types/foundry/common/documents/roll-table.d.mts index 0d7e4e18934..7b99377c9fd 100644 --- a/types/foundry/common/documents/roll-table.d.mts +++ b/types/foundry/common/documents/roll-table.d.mts @@ -1,10 +1,10 @@ import { ImageFilePath } from "@common/constants.mjs"; -import { Document, DocumentMetadata, EmbeddedCollection } from "../abstract/_module.mjs"; +import { Document, DocumentClassMetadata, EmbeddedCollection } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; import { BaseFolder, BaseTableResult } from "./_module.mjs"; /** - * The Document definition for a RollTable. + * The RollTable Document. * Defines the DataSchema and common behaviors for a RollTable which are shared between both client and server. */ export default class BaseRollTable extends Document { @@ -12,23 +12,24 @@ export default class BaseRollTable extends Document { /* Model Configuration */ /* -------------------------------------------- */ - static override get metadata(): RollTableMetadata; + static override get metadata(): Readonly; - static override defineSchema(): RollTableSchema; + static override LOCALIZATION_PREFIXES: string[]; /** The default icon used for newly created Macro documents */ static DEFAULT_ICON: ImageFilePath; + + static override defineSchema(): RollTableSchema; } export default interface BaseRollTable extends Document, fields.ModelPropsFromSchema { - /** A reference to the Collection of TableResult instances in this document, indexed by _id. */ readonly results: EmbeddedCollection>; get documentName(): (typeof BaseRollTable)["metadata"]["name"]; } -interface RollTableMetadata extends DocumentMetadata { +interface RollTableMetadata extends DocumentClassMetadata { name: "RollTable"; collection: "tables"; indexed: true; @@ -47,16 +48,15 @@ type RollTableSchema = { img: fields.FilePathField; /** The HTML text description for this RollTable document */ description: fields.HTMLField; - /** A Collection of TableResult embedded documents which belong to this RollTable */ - // biome-ignore lint/suspicious/noExplicitAny: + /** An EmbeddedCollection of TableResult documents */ results: fields.EmbeddedCollectionField>; - /** The Roll formula which determines the results chosen from the table */ + /** The Roll formulate which determines the results chosen from this RollTable */ formula: fields.StringField; /** Are results from this table drawn with replacement? */ replacement: fields.BooleanField; /** Is the Roll result used to draw from this RollTable displayed in chat? */ displayRoll: fields.BooleanField; - /** The _id of a Folder which contains this RollTable */ + /** The Folder which contains this RollTable */ folder: fields.ForeignDocumentField; /** The numeric sort value which orders this RollTable relative to its siblings */ sort: fields.IntegerSortField; @@ -64,7 +64,7 @@ type RollTableSchema = { ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information */ + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/scene.d.mts b/types/foundry/common/documents/scene.d.mts index 2522c98150a..5c8085f7754 100644 --- a/types/foundry/common/documents/scene.d.mts +++ b/types/foundry/common/documents/scene.d.mts @@ -1,36 +1,58 @@ import { DatabaseOperation } from "@common/abstract/_types.mjs"; -import { GridType, ImageFilePath, VideoFilePath } from "@common/constants.mjs"; -import { Document, DocumentMetadata, EmbeddedCollection } from "../abstract/_module.mjs"; +import { FogExplorationMode, GridType, ImageFilePath } from "@common/constants.mjs"; +import { Document, DocumentClassMetadata, EmbeddedCollection } from "../abstract/_module.mjs"; import * as data from "../data/data.mjs"; import * as fields from "../data/fields.mjs"; import * as documents from "./_module.mjs"; +import { BaseGrid } from "@common/grid/base.mjs"; +import { GridlessGrid } from "@common/grid/gridless.mjs"; /** - * The Scene document model. - * @param data Initial data from which to construct the document. - * @property data The constructed data object for the document. + * The Scene Document. + * Defines the DataSchema and common behaviors for a Scene which are shared between both client and server. */ export default class BaseScene extends Document { - static override get metadata(): SceneMetadata; + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ + + static override get metadata(): Readonly; static override defineSchema(): SceneSchema; + + static override LOCALIZATION_PREFIXES: string[]; + + /** The default grid defined by the system. */ + static get defaultGrid(): BaseGrid; + + /** The gridless version of the default grid defined by the system. */ + static get defaultGridlessGrid(): GridlessGrid; + + /** The initial Level of the Scene. By default the first Level. */ + get initialLevel(): documents.BaseLevel; + + /** + * A convenience getter for the Scene's first created Level. This should not be relied on in multi-level scenes to + * mean the first level by sort order. + */ + get firstLevel(): documents.BaseLevel; } export default interface BaseScene extends Document, fields.ModelPropsFromSchema { get documentName(): SceneMetadata["name"]; readonly drawings: EmbeddedCollection>; + readonly tokens: EmbeddedCollection>; readonly levels: EmbeddedCollection>; readonly lights: EmbeddedCollection>; readonly notes: EmbeddedCollection>; - readonly regions: EmbeddedCollection>; readonly sounds: EmbeddedCollection>; - readonly tokens: EmbeddedCollection>; + readonly regions: EmbeddedCollection>; readonly tiles: EmbeddedCollection>; readonly walls: EmbeddedCollection>; } -export interface SceneMetadata extends DocumentMetadata { +export interface SceneMetadata extends DocumentClassMetadata { name: "Scene"; collection: "scenes"; indexed: true; @@ -49,16 +71,16 @@ export interface SceneMetadata extends DocumentMetadata { label: "DOCUMENT.Scene"; labelPlural: "DOCUMENT.Scenes"; preserveOnImport: string[]; + defaultLevelId: "defaultLevel0000"; } type SceneSchema = { /** The _id which uniquely identifies this Scene document */ _id: fields.DocumentIdField; - /** The name of this scene */ + /** The name of this Scene */ name: fields.StringField; // Navigation - /** Is this scene currently active? Only one scene may be active at a given time */ active: fields.BooleanField; /** Is this scene displayed in the top navigation bar? */ @@ -69,101 +91,103 @@ type SceneSchema = { navName: fields.HTMLField; // Canvas Dimensions - /** An image or video file that provides the background texture for the scene. */ - background: data.TextureData; - /** An image or video file path providing foreground media for the scene */ - foreground: fields.FilePathField; - /** The elevation of the foreground layer where overhead tiles reside */ - foregroundElevation: fields.NumberField; - - /** A thumbnail image which depicts the scene at lower resolution */ thumb: fields.FilePathField; /** The width of the scene canvas, normally the width of the background media */ width: fields.NumberField; /** The height of the scene canvas, normally the height of the background media */ height: fields.NumberField; - /** - * The proportion of canvas padding applied around the outside of the scene dimensions to provide additional buffer - * space - */ + /** The proportion of canvas padding applied around the outside of the scene dimensions to provide additional buffer space */ padding: fields.NumberField; + /** How much the background is shifted by in the x-coordinates */ + shiftX: fields.NumberField; + /** How much the background is shifted by in the y-coordinates */ + shiftY: fields.NumberField; /** The initial view coordinates for the scene */ initial: fields.SchemaField<{ x: fields.NumberField; y: fields.NumberField; scale: fields.NumberField; }>; - /** The color of the canvas displayed behind the scene background */ - backgroundColor: fields.ColorField; + /** The initial level for the scene */ + initialLevel: fields.DocumentIdField>; // Grid Configuration - /** Grid configuration for the scene */ grid: fields.SchemaField; // Vision and Lighting Configuration - /** Do Tokens require vision in order to see the Scene environment? */ tokenVision: fields.BooleanField; + /** Fog configuration for the scene */ fog: fields.SchemaField; // Environment Configuration + /** Environment configuration for the scene */ environment: fields.SchemaField; - // Embedded Collections + // Transition Configuration + /** Data related to the transition to/from the scene */ + transition: fields.SchemaField<{ + type: fields.StringField; + duration: fields.NumberField; + activeOnly: fields.BooleanField; + }>; - /** A collection of embedded Drawing objects. */ + // Embedded Collections + /** An EmbeddedCollection of Drawing documents */ drawings: fields.EmbeddedCollectionField>; - /** A collection of embedded Token objects. */ + /** An EmbeddedCollection of Token documents */ tokens: fields.EmbeddedCollectionField>; - /** A collection of embedded AmbientLight objects. */ + /** An EmbeddedCollection of Level documents */ + levels: fields.EmbeddedCollectionField>; + /** An EmbeddedCollection of AmbientLight documents */ lights: fields.EmbeddedCollectionField>; - /** A collection of embedded Note objects. */ + /** An EmbeddedCollection of Note documents */ notes: fields.EmbeddedCollectionField>; - /** A collection of embedded Region objects */ - regions: fields.EmbeddedCollectionField>; - /** A collection of embedded AmbientSound objects. */ + /** An EmbeddedCollection of AmbientSound documents */ sounds: fields.EmbeddedCollectionField>; - /** A collection of embedded Tile objects. */ + /** An EmbeddedCollection of Region documents */ + regions: fields.EmbeddedCollectionField>; + /** An EmbeddedCollection of Tile documents */ tiles: fields.EmbeddedCollectionField>; - /** A collection of embedded Wall objects. */ + /** An EmbeddedCollection of Wall documents */ walls: fields.EmbeddedCollectionField>; // Linked Documents - /** A linked Playlist document which should begin automatically playing when this Scene becomes active. */ playlist: fields.ForeignDocumentField; - /** - * A linked PlaylistSound document from the selected playlist that will begin automatically playing when this - * Scene becomes active - */ + /** The _id of the PlaylistSound document from the selected playlist that will begin automatically playing when this Scene becomes active */ playlistSound: fields.ForeignDocumentField; /** A JournalEntry document which provides narrative details about this Scene */ journal: fields.ForeignDocumentField; + /** The _id of the JournalEntryPage from the selected journal which provides narrative details about this Scene */ journalEntryPage: fields.ForeignDocumentField; /** A named weather effect which should be rendered in this Scene. */ weather: fields.StringField; // Permissions - - /** The _id of a Folder which contains this Actor */ + /** The Folder which contains this Scene */ folder: fields.ForeignDocumentField; - /** The numeric sort value which orders this Actor relative to its siblings */ + /** The numeric sort value which orders this Scene relative to its siblings */ sort: fields.IntegerSortField; /** An object which configures ownership of this Scene */ ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information */ + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; type GridDataSchema = { - /** The type of grid, a number from CONST.GRID_TYPES. */ + /** The type of grid, a number from CONST.GRID_TYPES */ type: fields.NumberField; /** The grid size which represents the width (or height) of a single grid space. */ size: fields.NumberField; + /** The style of the rendered grid lines */ + style: fields.StringField; + /** How thich the grid lines should be rendered */ + thickness: fields.NumberField; /** A string representing the color used to render the grid lines. */ color: fields.ColorField; /** A number between 0 and 1 for the opacity of the grid lines. */ @@ -175,9 +199,8 @@ type GridDataSchema = { }; type FogSchema = { - exploration: fields.BooleanField; + mode: fields.NumberField; reset: fields.NumberField; - overlay: fields.FilePathField; colors: fields.SchemaField<{ explored: fields.ColorField; unexplored: fields.ColorField; @@ -187,7 +210,6 @@ type FogSchema = { type EnvironmentSchema = { darknessLevel: fields.AlphaField; darknessLock: fields.BooleanField; - /** Is a global source of illumination present which provides dim light to all areas of the Scene? */ globalLight: fields.SchemaField<{ enabled: fields.BooleanField; alpha: data.LightDataSchema["alpha"]; diff --git a/types/foundry/common/documents/setting.d.mts b/types/foundry/common/documents/setting.d.mts index 7ed2debcb17..038462ba1f8 100644 --- a/types/foundry/common/documents/setting.d.mts +++ b/types/foundry/common/documents/setting.d.mts @@ -1,48 +1,44 @@ -import { Document, DocumentMetadata, MetadataPermission } from "../abstract/_module.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; import BaseUser from "./user.mjs"; /** - * The Document definition for a Setting. + * The Setting Document. * Defines the DataSchema and common behaviors for a Setting which are shared between both client and server. - * @memberof documents - * - * @param data Initial data from which to construct the Setting - * @param context Construction context options */ export default class BaseSetting extends Document { /* -------------------------------------------- */ /* Model Configuration */ /* -------------------------------------------- */ - static override get metadata(): SettingMetadata; + static override get metadata(): Readonly; static override defineSchema(): SettingSchema; - static canUserCreate(user: BaseUser): boolean; + static override canUserCreate(user: BaseUser): boolean; } export default interface BaseSetting extends Document, fields.ModelPropsFromSchema { get documentName(): SettingMetadata["name"]; } -interface SettingMetadata extends DocumentMetadata { +interface SettingMetadata extends DocumentClassMetadata { name: "Setting"; collection: "settings"; label: "DOCUMENT.Setting"; labelPlural: "DOCUMENT.Settings"; - permissions: { - view: MetadataPermission; - create: "SETTINGS_MODIFY"; - update: "SETTINGS_MODIFY"; - delete: "SETTINGS_MODIFY"; - }; } type SettingSchema = { + /** The _id which uniquely identifies this Setting document */ _id: fields.DocumentIdField; + /** The key of this stored setting*/ key: fields.StringField; + /** The value of this stored setting */ value: fields.JSONField, true, true, false>; + /** The _id of the User that this setting is for, only used for user scoped settings */ + user: fields.ForeignDocumentField; + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/table-result.d.mts b/types/foundry/common/documents/table-result.d.mts index a31ed68eb9c..ffe867864bb 100644 --- a/types/foundry/common/documents/table-result.d.mts +++ b/types/foundry/common/documents/table-result.d.mts @@ -1,65 +1,63 @@ -import { DocumentOwnershipLevel, ImageFilePath, TableResultType } from "@common/constants.mjs"; -import { Document, DocumentMetadata } from "../abstract/_module.mjs"; +import { ImageFilePath, TableResultType } from "@common/constants.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; import * as documents from "./_module.mjs"; -/** The TableResult document model. */ -export default class BaseTableResult extends Document< - TParent, - TableResultSchema -> { +/** + * The TableResult Document. + * Defines the DataSchema and common behaviors for a TableResult which are shared between both client and server. + */ +export default class BaseTableResult< + TParent extends documents.BaseRollTable | null = documents.BaseRollTable | null, +> extends Document { /* -------------------------------------------- */ /* Model Configuration */ /* -------------------------------------------- */ - static override get metadata(): TableResultMetadata; + static override get metadata(): Readonly; - static override defineSchema(): TableResultSchema; + static override LOCALIZATION_PREFIXES: string[]; - override testUserPermission( - user: documents.BaseUser, - permission: DocumentOwnershipLevel, - { exact }?: { exact?: boolean }, - ): boolean; + static override defineSchema(): TableResultSchema; } -export default interface BaseTableResult extends Document< - TParent, - TableResultSchema -> { +export default interface BaseTableResult< + TParent extends documents.BaseRollTable | null = documents.BaseRollTable | null, +> extends Document { get documentName(): TableResultMetadata["name"]; } -interface TableResultMetadata extends DocumentMetadata { +interface TableResultMetadata extends DocumentClassMetadata { name: "TableResult"; collection: "results"; label: "DOCUMENT.TableResult"; labelPlural: "DOCUMENT.TableResults"; coreTypes: TableResultType[]; + compendiumIndexFields: ["type"]; } type TableResultSchema = { - /** The _id which uniquely identifies this TableResult embedded document */ + /** The _id which uniquely identifies this TableResult document */ _id: fields.DocumentIdField; /** A result subtype from CONST.TABLE_RESULT_TYPES */ type: fields.DocumentTypeField; + /** The name of this TableResult */ name: fields.StringField; - /** An image file url that represents the table result */ + /** An image file path that represent this TableResult */ img: fields.FilePathField; + /** The descrioption of this TableResult */ description: fields.HTMLField; + /** The UUID that this TableResult is linked to, used for "document" types */ documentUuid: fields.DocumentUUIDField; /** The probabilistic weight of this result relative to other results */ weight: fields.NumberField; - /** - * A length 2 array of ascending integers which defines the range of dice roll totals which produce this drawn - * result - */ + /** A length 2 array of ascending integers which defines the range of dice roll totals which produce this drawn result */ range: fields.ArrayField; /** Has this result already been drawn (without replacement) */ drawn: fields.BooleanField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information */ + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/tile.d.mts b/types/foundry/common/documents/tile.d.mts index 9cde86960db..8dc55db3c60 100644 --- a/types/foundry/common/documents/tile.d.mts +++ b/types/foundry/common/documents/tile.d.mts @@ -1,18 +1,17 @@ import { TileOcclusionMode } from "@common/constants.mjs"; -import { Document, DocumentMetadata } from "../abstract/_module.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import { TextureData } from "../data/data.mjs"; import * as fields from "../data/fields.mjs"; import { BaseScene } from "./_module.mjs"; /** - * The Document definition for a Tile. - * Defines the DataSchema and common behaviors for a Tile which are shared between both client and server. - * @memberof documents - * - * @param data Initial data from which to construct the Tile - * @param context Construction context options + * The TableResult Document. + * Defines the DataSchema and common behaviors for a TableResult which are shared between both client and server. */ -export default class BaseTile extends Document { +export default class BaseTile extends Document< + TParent, + TileSchema +> { /* -------------------------------------------- */ /* Model Configuration */ /* -------------------------------------------- */ @@ -20,14 +19,22 @@ export default class BaseTile extends Document static override get metadata(): TileMetadata; static override defineSchema(): TileSchema; + + static override LOCALIZATION_PREFIXES: string[]; + + /* -------------------------------------------- */ + /* Document Methods */ + /* -------------------------------------------- */ + + override getUserLevel(user: foundry.documents.BaseUser): CONST.DocumentOwnershipNumber; } -export default interface BaseTile +export default interface BaseTile extends Document, fields.ModelPropsFromSchema { get documentName(): TileMetadata["name"]; } -interface TileMetadata extends DocumentMetadata { +interface TileMetadata extends DocumentClassMetadata { name: "Tile"; collection: "tiles"; label: "DOCUMENT.Tile"; @@ -35,8 +42,10 @@ interface TileMetadata extends DocumentMetadata { } type TileSchema = { - /** The _id which uniquely identifies this Tile embedded document */ + /** The _id which uniquely identifies this Tile document */ _id: fields.DocumentIdField; + /** The name of this Tile */ + name: fields.StringField; /** An image or video texture which this tile displays. */ texture: TextureData; /** The pixel width of the tile */ @@ -47,8 +56,10 @@ type TileSchema = { x: fields.NumberField; /** The y-coordinate position of the top-left corner of the tile */ y: fields.NumberField; - /** The z-index ordering of this tile relative to its siblings */ - z: fields.NumberField; + /** The elevation that this tile is on */ + elevation: fields.NumberField; + /** An array of Levels that this tile is on */ + levels: fields.SceneLevelsSetField; /** The angle of rotation for the tile between 0 and 360 */ rotation: fields.AngleField; /** The tile opacity */ @@ -57,33 +68,28 @@ type TileSchema = { hidden: fields.BooleanField; /** Is the tile currently locked? */ locked: fields.BooleanField; - /** Is the tile an overhead tile? */ - overhead: fields.BooleanField; - roof: fields.BooleanField; + /** The tile's restriction settings */ + restrictions: fields.SchemaField<{ + light: fields.BooleanField; + weather: fields.BooleanField; + }>; /** The tile's occlusion settings */ - occlusion: fields.SchemaField; + occlusion: fields.SchemaField<{ + /** The occlusion mode from CONST.TILE_OCCLUSION_MODES */ + modes: fields.SetField>; + /** The occlusion alpha between 0 and 1 */ + alpha: fields.AlphaField; + }>; /** The tile's video settings */ - video: fields.SchemaField; - /** An object of optional key/value flags */ + video: fields.SchemaField<{ + /** Automatically loop the video? */ + loop: fields.BooleanField; + /** Should the video play automatically? */ + autoplay: fields.BooleanField; + /** The volume level of any audio that the video file contains */ + volume: fields.AlphaField; + }>; flags: fields.DocumentFlagsField; }; -type TileOcclusionSchema = { - /** The occlusion mode from CONST.TILE_OCCLUSION_MODES */ - mode: fields.NumberField; - /** The occlusion alpha between 0 and 1 */ - alpha: fields.AlphaField; - /** An optional radius of occlusion used for RADIAL mode */ - radius: fields.NumberField; -}; - -type TileVideoSchema = { - /** Automatically loop the video? */ - loop: fields.BooleanField; - /** Should the video play automatically? */ - autoplay: fields.BooleanField; - /** The volume level of any audio that the video file contains */ - volume: fields.AlphaField; -}; - export type TileSource = fields.SourceFromSchema; diff --git a/types/foundry/common/documents/token.d.mts b/types/foundry/common/documents/token.d.mts index 58f3aa4fbfd..180a1754812 100644 --- a/types/foundry/common/documents/token.d.mts +++ b/types/foundry/common/documents/token.d.mts @@ -1,6 +1,6 @@ import { TerrainData } from "@client/data/terrain-data.mjs"; import { ElevatedPoint } from "@common/_types.mjs"; -import Document, { DocumentMetadata } from "@common/abstract/document.mjs"; +import Document from "@common/abstract/document.mjs"; import { ImageFilePath, TokenDisplayMode, @@ -13,30 +13,30 @@ import * as data from "../data/data.mjs"; import * as fields from "../data/fields.mjs"; import { BaseActorDelta, BaseScene } from "./_module.mjs"; import { TokenDimensions, TokenPosition } from "./_types.mjs"; +import { DocumentClassMetadata } from "@common/abstract/_module.mjs"; /** - * The Token document model. - * @param data Initial data from which to construct the document. - * @property data The constructed data object for the document. + * The Token Document. + * Defines the DataSchema and common behaviors for a Token which are shared between both client and server. */ export default class BaseToken extends Document< TParent, TokenSchema > { - static override get metadata(): TokenMetadata; + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ + + static override get metadata(): Readonly; static override defineSchema(): TokenSchema; static override LOCALIZATION_PREFIXES: string[]; - /** - * The fields of the data model for which changes count as a movement action. - */ + /** The fields of the data model for which changes count as a movement action. */ static readonly MOVEMENT_FIELDS: ["x", "y", "elevation", "width", "height", "shape"]; - /** - * Are the given positions equal? - */ + /** Are the given positions equal? */ static arePositionsEqual(position1: TokenPosition, position2: TokenPosition): boolean; /** The default icon used for newly created Token documents */ @@ -76,6 +76,14 @@ export default class BaseToken @@ -84,7 +92,7 @@ export default interface BaseToken; } -interface TokenMetadata extends DocumentMetadata { +interface TokenMetadata extends DocumentClassMetadata { name: "Token"; collection: "tokens"; label: "DOCUMENT.Token"; @@ -96,9 +104,9 @@ interface TokenMetadata extends DocumentMetadata { } type TokenSchema = { - /** The Token _id which uniquely identifies it within its parent Scene */ + /** The id which uniquely identifies this Token document */ _id: fields.DocumentIdField; - /** The name used to describe the Token */ + /** The name of this Token */ name: fields.StringField; /** The display mode of the Token nameplate, from CONST.TOKEN_DISPLAY_MODES */ displayName: fields.NumberField; @@ -106,10 +114,7 @@ type TokenSchema = { actorId: fields.ForeignDocumentField; /** Does this Token uniquely represent a singular Actor, or is it one of many? */ actorLink: fields.BooleanField; - /** - * The ActorDelta embedded document which stores the differences between this token and the base actor it - * represents. - */ + /** The ActorDelta embedded document which stores the differences between this token and the base actor it represents. */ delta: ActorDeltaField; /** The x-coordinate of the top-left corner of the Token */ x: fields.NumberField; @@ -121,12 +126,17 @@ type TokenSchema = { width: fields.NumberField; /** The height of the Token in grid units */ height: fields.NumberField; + /** The depth of the Token in grid units */ depth: fields.NumberField; + /** The shape of the Token, form CONST.TOKEN_SHAPES */ shape: fields.NumberField; + /** The _id of the Level that this Token is on */ level: fields.DocumentIdField; /** The token's texture on the canvas. */ texture: data.TextureData; + /** The numeric sort value which orders this Token relative to its siblings */ sort: fields.NumberField; + /** Is the Token currently locked? */ locked: fields.BooleanField; /** Prevent the Token image from visually rotating? */ lockRotation: fields.BooleanField; @@ -185,6 +195,7 @@ type TokenSchema = { occludable: fields.SchemaField<{ radius: fields.NumberField; }>; + /** Data related to the dynamic token ring of this Token */ ring: fields.SchemaField<{ enabled: fields.BooleanField; colors: fields.SchemaField<{ @@ -197,12 +208,14 @@ type TokenSchema = { texture: fields.FilePathField; }>; }>; + /** Data related to the turn marker of this Token */ turnMarker: fields.SchemaField<{ mode: fields.NumberField; animation: fields.StringField; src: fields.FilePathField; disposition: fields.BooleanField; }>; + /** The current type of movement that this Token is using */ movementAction: fields.StringField; /** @internal */ _movementHistory: fields.ArrayField< @@ -221,6 +234,7 @@ type TokenSchema = { checkpoint: fields.BooleanField; intermediate: fields.BooleanField; userId: fields.ForeignDocumentField; + movementId: fields.StringField; subpathId: fields.StringField; cost: fields.NumberField; }> @@ -233,6 +247,9 @@ type TokenSchema = { export type TokenSource = fields.SourceFromSchema; +/** + * A special subclass of EmbeddedDocumentField which allows construction of the ActorDelta to be lazily evaluated. + */ export class ActorDeltaField extends fields.EmbeddedDocumentField { override initialize( value: fields.MaybeSchemaProp, diff --git a/types/foundry/common/documents/user.d.mts b/types/foundry/common/documents/user.d.mts index a6f6d1d0c66..11f0658a167 100644 --- a/types/foundry/common/documents/user.d.mts +++ b/types/foundry/common/documents/user.d.mts @@ -6,29 +6,35 @@ import { UserRole, UserRoleName, } from "@common/constants.mjs"; -import Document, { DocumentMetadata } from "../abstract/document.mjs"; +import Document from "../abstract/document.mjs"; import * as fields from "../data/fields.mjs"; import { BaseActor } from "./_module.mjs"; +import { DocumentClassMetadata } from "@common/abstract/_module.mjs"; /** - * The base User document, which is extended by both the server and client. - * This base User provides shared functionality which is consistent for both sides of the application. - * Each client who connects to a Foundry Virtual Tabletop session assumes the identity of one (and only one) User. - * - * @param data Initial data from which to construct the document. - * @property data The constructed data object for the document. + * The User Document. + * Defines the DataSchema and common behaviors for a User which are shared between both client and server. */ export default class BaseUser = BaseActor> extends Document< null, UserSchema > { - static override get metadata(): UserMetadata; + /* -------------------------------------------- */ + /* Model Configuration */ + /* -------------------------------------------- */ + + static override get metadata(): Readonly; + + static override LOCALIZATION_PREFIXES: string[]; static override defineSchema(): UserSchema>; - /* ---------------------------------------- */ - /* Permissions */ - /* ---------------------------------------- */ + /* -------------------------------------------- */ + /* Model Properties */ + /* -------------------------------------------- */ + + /** A convenience test for whether this User has the NONE role. */ + get isBanned(): boolean; /** Test whether the User has a GAMEMASTER or ASSISTANT role in this World? */ get isGM(): boolean; @@ -66,7 +72,7 @@ export default interface BaseUser = BaseActor get documentName(): UserMetadata["name"]; } -interface UserMetadata extends DocumentMetadata { +interface UserMetadata extends DocumentClassMetadata { name: "User"; collection: "users"; label: "DOCUMENT.User"; @@ -74,18 +80,31 @@ interface UserMetadata extends DocumentMetadata { } type UserSchema> = { + /** The _id which uniquely identifies this User document */ _id: fields.DocumentIdField; + /** The name of this User */ name: fields.StringField; + /** What role is assigned to this User, taken from CONST.USER_ROLE_NAMES */ role: fields.NumberField; + /** The hashed password associated with this User */ password: fields.StringField; + /** The salt used to hash the password for this USer */ passwordSalt: fields.StringField; + /** An image file path used as the avatar for this User */ avatar: fields.FilePathField; + /** The Actor that is currently set as this User's character */ character: fields.ForeignDocumentField; + /** The color assigned to this User, used for various thing to indicate which user is doing something */ color: fields.ColorField; + /** The pronouns of this User */ pronouns: fields.StringField; + /** A record linking macros to hotbar slots for this User */ hotbar: fields.ObjectField>; + /** What permissions this User has, or doesn't have */ permissions: fields.ObjectField>; + /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; + /** An object containing document metadata */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/wall.d.mts b/types/foundry/common/documents/wall.d.mts index 08955aafdfb..c55daa8789c 100644 --- a/types/foundry/common/documents/wall.d.mts +++ b/types/foundry/common/documents/wall.d.mts @@ -1,32 +1,49 @@ -import { EdgeDirection, EdgeSenseType, WallDoorState, WallDoorType, WallMovementType } from "@common/constants.mjs"; -import { Document, DocumentMetadata } from "../abstract/_module.mjs"; +import { + EdgeDirection, + EdgeSenseType, + ImageFilePath, + WallDoorState, + WallDoorType, + WallMovementType, +} from "@common/constants.mjs"; +import { Document, DocumentClassMetadata } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; import BaseScene from "./scene.mjs"; /** - * The Document definition for a Wall. + * The Wall Document. * Defines the DataSchema and common behaviors for a Wall which are shared between both client and server. - * @memberof documents - * - * @param data Initial data from which to construct the Wall - * @param context Construction context options */ -export default class BaseWall extends Document { +export default class BaseWall extends Document< + TParent, + WallSchema +> { /* -------------------------------------------- */ /* Model Configuration */ /* -------------------------------------------- */ - static override get metadata(): WallMetadata; + static override get metadata(): Readonly; static override defineSchema(): WallSchema; + + static LOCALIZATION_PREFIXES: string[]; + + /** Colors for each category of wall. */ + static CATEGORY_COLORS: Record; + + /* -------------------------------------------- */ + /* Document Methods */ + /* -------------------------------------------- */ + + override getUserLevel(user: foundry.documents.BaseUser): CONST.DocumentOwnershipNumber; } -export default interface BaseWall +export default interface BaseWall extends Document, fields.ModelPropsFromSchema { get documentName(): WallMetadata["name"]; } -interface WallMetadata extends DocumentMetadata { +interface WallMetadata extends DocumentClassMetadata { name: "Wall"; collection: "walls"; label: "DOCUMENT.Wall"; @@ -34,14 +51,16 @@ interface WallMetadata extends DocumentMetadata { } type WallSchema = { - /** The _id which uniquely identifies the embedded Wall document */ + /** The _id which uniquely identifies this Wall document */ _id: fields.DocumentIdField; - /** The wall coordinates, a length-4 array of finite numbers [x0,y0,x1,y1] */ + /** The wall coordinates, a length-4 array of finite numbers [x0, y0, x1, y1] */ c: fields.ArrayField< fields.NumberField, [number, number, number, number], [number, number, number, number] >; + /** An array of Levels that this Wall is on */ + levels: fields.SceneLevelsSetField; /** The illumination restriction type of this wall */ light: fields.NumberField; /** The movement restriction type of this wall */ @@ -56,22 +75,31 @@ type WallSchema = { door: fields.NumberField; /** The state of the door this wall contains, if any */ ds: fields.NumberField; + /** The sound that this door makes when opened/closed */ doorSound: fields.StringField; /** Configuration of threshold data for this wall */ - threshold: fields.SchemaField; + threshold: fields.SchemaField<{ + /** Minimum distance from a light source for which this wall blocks light */ + light: fields.NumberField; + /** Minimum distance from a vision source for which this wall blocks vision */ + sight: fields.NumberField; + /** Minimum distance from a sound source for which this wall blocks sound */ + sound: fields.NumberField; + /** Whether to attenuate the source radius when passing through the wall */ + attenuation: fields.BooleanField; + }>; + /** Configuration of animation data for this wall */ + animation: fields.SchemaField<{ + direction: fields.NumberField<-1 | 1, -1 | 1, false, false, true>; + double: fields.BooleanField; + duration: fields.NumberField; + flip: fields.BooleanField; + strength: fields.NumberField; + texture: fields.FilePathField; + type: fields.StringField; + }>; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; }; -type WallThresholdSchema = { - /** Minimum distance from a light source for which this wall blocks light */ - light: fields.NumberField; - /** Minimum distance from a vision source for which this wall blocks vision */ - sight: fields.NumberField; - /** Minimum distance from a sound source for which this wall blocks sound */ - sound: fields.NumberField; - /** Whether to attenuate the source radius when passing through the wall */ - attenuation: fields.BooleanField; -}; - export type WallSource = fields.SourceFromSchema; From 046e94d3f6ff3d3873c28f454bef9982fde0d758 Mon Sep 17 00:00:00 2001 From: 7H3LaughingMan <7H3LaughingMan@proton.me> Date: Sun, 3 May 2026 21:30:35 -0500 Subject: [PATCH 2/7] Resolve Typos --- types/foundry/common/documents/chat-message.d.mts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/foundry/common/documents/chat-message.d.mts b/types/foundry/common/documents/chat-message.d.mts index 6b0331d799b..13ae27be6a4 100644 --- a/types/foundry/common/documents/chat-message.d.mts +++ b/types/foundry/common/documents/chat-message.d.mts @@ -45,7 +45,7 @@ interface ChatMessageMetadata extends DocumentClassMetadata { declare type ChatMessageSchema = { /** The _id which uniquely identifies this ChatMessage document */ _id: fields.DocumentIdField; - /** An ChatMEssage subtype which configures the system data model applied */ + /** An ChatMessage subtype which configures the system data model applied */ type: fields.DocumentTypeField; /** They system data object which is defined by the system data model */ system: fields.TypeDataField; @@ -59,7 +59,7 @@ declare type ChatMessageSchema = { flavor: fields.HTMLField; /** The HTML content of this chat message */ content: fields.HTMLField; - /** A ChatSpeakData object which describes the origin of the ChatMessage */ + /** A ChatSpeakerData object which describes the origin of the ChatMessage */ speaker: fields.SchemaField; /** An array of User _id values to whome this message is privately whispered */ whisper: fields.ArrayField>; From 4e5cafe217e64577e6e6eab5811bf0d5e85bd925 Mon Sep 17 00:00:00 2001 From: 7H3LaughingMan <7H3LaughingMan@proton.me> Date: Mon, 4 May 2026 00:15:23 -0500 Subject: [PATCH 3/7] Update Schema Comments, Copied from `common/documents/_types.mjs` --- .../common/documents/active-effect.d.mts | 52 +++++++++++++--- .../common/documents/actor-delta.d.mts | 8 +++ types/foundry/common/documents/actor.d.mts | 8 +-- .../foundry/common/documents/adventure.d.mts | 34 +++++----- .../common/documents/ambient-light.d.mts | 22 ++++--- .../common/documents/ambient-sound.d.mts | 25 ++++---- types/foundry/common/documents/card.d.mts | 15 +++-- types/foundry/common/documents/cards.d.mts | 22 +++---- .../common/documents/chat-message.d.mts | 20 +++--- types/foundry/common/documents/combat.d.mts | 18 +++--- .../common/documents/combatant-group.d.mts | 18 +++--- .../foundry/common/documents/combatant.d.mts | 18 +++--- types/foundry/common/documents/drawing.d.mts | 32 +++++----- .../common/documents/fog-exploration.d.mts | 12 ++-- types/foundry/common/documents/folder.d.mts | 6 +- types/foundry/common/documents/item.d.mts | 10 +-- .../documents/journal-entry-category.d.mts | 8 +-- .../common/documents/journal-entry-page.d.mts | 37 +++++++---- .../common/documents/journal-entry.d.mts | 8 +-- types/foundry/common/documents/level.d.mts | 10 --- types/foundry/common/documents/macro.d.mts | 6 +- types/foundry/common/documents/note.d.mts | 10 +-- .../common/documents/playlist-sound.d.mts | 12 ++-- types/foundry/common/documents/playlist.d.mts | 28 ++++----- .../common/documents/region-behavior.d.mts | 10 +-- types/foundry/common/documents/region.d.mts | 21 +++---- .../foundry/common/documents/roll-table.d.mts | 8 +-- types/foundry/common/documents/scene.d.mts | 62 ++++++++++++------- types/foundry/common/documents/setting.d.mts | 8 +-- .../common/documents/table-result.d.mts | 9 +-- types/foundry/common/documents/tile.d.mts | 19 +++--- types/foundry/common/documents/token.d.mts | 36 +++++++---- types/foundry/common/documents/user.d.mts | 24 +++---- types/foundry/common/documents/wall.d.mts | 15 +++-- 34 files changed, 364 insertions(+), 287 deletions(-) diff --git a/types/foundry/common/documents/active-effect.d.mts b/types/foundry/common/documents/active-effect.d.mts index f347d294af4..23c1e0c9452 100644 --- a/types/foundry/common/documents/active-effect.d.mts +++ b/types/foundry/common/documents/active-effect.d.mts @@ -58,62 +58,94 @@ export interface ActiveEffectMetadata extends DocumentClassMetadata { } type ActiveEffectSchema = { - /** The _id which uniquely identifies this ActiveEffect document */ + /** The _id which uniquely identifies the ActiveEffect within a parent Actor or Item */ _id: fields.DocumentIdField; - /** The name of this ActiveEffect */ + /** The name which describes the ActiveEffect */ name: fields.StringField; - /** An image file path which provides the artwork for this ActiveEffect */ + /** An icon image path used to depict the ActiveEffect */ img: fields.FilePathField; - /** An ActorEffect subtype which configures the system data model applied */ + /** The document type */ type: fields.StringField; - /** They system data object which is defined by the system data model */ + /** The system type data field */ system: fields.TypeDataField; - /** Is this ActiveEffect disabled? */ + /** Is this ActiveEffect currently disabled? Defaults to false. */ disabled: fields.BooleanField; + /** Data pertaining to when the ActiveEffect was created. */ start: fields.SchemaField; + /** An EffectDurationData object which describes the duration of the ActiveEffect */ duration: fields.SchemaField; + /** The HTML text description for this ActiveEffect document. */ description: fields.HTMLField; + /** A UUID reference to the document from which this ActiveEffect originated */ origin: fields.DocumentUUIDField; + /** A color string which applies a tint to the ActiveEffect icon. Defaults to "#FFFFFF". */ tint: fields.ColorField; + /** Does this ActiveEffect automatically transfer from an Item to an Actor? */ transfer: fields.BooleanField; + /** Special status IDs that pertain to this effect */ statuses: fields.SetField>; - /** Is the icon for this ActiveEffect displayed? */ + /** Should this ActiveEffect's image be prominently displayed as an icon alongside Tokens, Combatants, etc.? Defaults to a CONDITIONAL (1). */ showIcon: fields.NumberField; - /** The Folder which contains this ActiveEffect */ + /** The _id of a Folder which contains this ActiveEffect */ folder: fields.ForeignDocumentField; - /** The numeric sort value which orders this ActiveEffect relative to its siblings */ + /** The sort value. Defaults to 0. */ sort: fields.IntegerSortField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; type EffectChangeSchema = { + /** The modification type of this change */ type: fields.StringField; + /** The value of the change effect */ value: fields.AnyField; + /** + * The application phase under which this change is applied. Each phase is its own priority + * group; that is, application of a change in an earlier phase will occur before a change in + * a later phase, regardless of priority. A pair of phases are preconfigured, but a package + * can add more phases to be called at different points during data preparation or on + * certain events. + */ phase: fields.StringField; + /** The order in which this change is applied among other changes in a common phase: a null value is initialized to its default priority. */ priority: fields.NumberField; }; type EffectStartSchema = { + /** The _id of the Combat that was active when this Effect first started */ combat: fields.ForeignDocumentField; + /** The _id of the Combatant whose turn was active when the Effect first started */ combatant: fields.ForeignDocumentField; + /** The Combatant's initiative roll at the time the Effect first started */ initiative: fields.NumberField; + /** The round of the Combat when the Effect first started */ round: fields.NumberField; + /** The turn of the Combat when the Effect first started */ turn: fields.NumberField; + /** The world time when the Effect first started */ time: fields.NumberField; }; export type EffectStartSource = fields.SourceFromSchema; interface EffectStartData extends fields.ModelPropsFromSchema { + /** The world time when the Effect first started */ value: number; } type EffectDurationSchema = { + /** The maximum duration of the Effect in the quantity of the unit, with null being initialized to Infinity */ value: fields.NumberField; + /** The time- or combat-based unit of the duration value */ units: fields.StringField; + /** + * An identifier of an event at which the Effect will expire: expiration occurs when both + * the end of the duration and the expiry event are reached. A truly indefinite duration + * is one in which both duration value and expiry are null. + */ expiry: fields.StringField; + /** Is this ActiveEffect expired? */ expired: fields.BooleanField; }; diff --git a/types/foundry/common/documents/actor-delta.d.mts b/types/foundry/common/documents/actor-delta.d.mts index b26ee459582..a78b67a5715 100644 --- a/types/foundry/common/documents/actor-delta.d.mts +++ b/types/foundry/common/documents/actor-delta.d.mts @@ -69,16 +69,24 @@ interface ActorDeltaMetadata extends abstract.DocumentClassMetadata { type ActorDeltaSchema = { /** The _id which uniquely identifies this ActorDelta document */ _id: fields.DocumentIdField; + /** The name override, if any. */ name: fields.StringField; + /** The type override, if any. */ type: fields.StringField; + /** The image override, if any. */ img: fields.FilePathField; + /** The system data model override. */ system: fields.ObjectField; + /** An array of embedded item data overrides. */ items: fields.EmbeddedCollectionDeltaField< BaseItem, (fields.DocumentSourceFromSchema | fields.SourceFromSchema)[] >; + /** An array of embedded active effect data overrides. */ effects: fields.EmbeddedCollectionDeltaField>; + /** Ownership overrides. */ ownership: fields.DocumentOwnershipField; + /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; }; diff --git a/types/foundry/common/documents/actor.d.mts b/types/foundry/common/documents/actor.d.mts index 934506b8484..5245f559487 100644 --- a/types/foundry/common/documents/actor.d.mts +++ b/types/foundry/common/documents/actor.d.mts @@ -104,11 +104,11 @@ type ActorSchema< system: fields.TypeDataField; /** Default Token settings which are used for Tokens created from this Actor */ prototypeToken: fields.EmbeddedDataField>; - /** An EmbeddedCollection of Item documents */ + /** A Collection of Item embedded Documents */ items: fields.EmbeddedCollectionField>, TItemSource[]>; - /** An EmbeddedCollection of ActiveEffect documents */ + /** A Collection of ActiveEffect embedded Documents */ effects: fields.EmbeddedCollectionField>>; - /** The Folder which contains this Actor */ + /** The _id of a Folder which contains this Actor */ folder: fields.ForeignDocumentField; /** The numeric sort value which orders this Actor relative to its siblings */ sort: fields.IntegerSortField; @@ -116,7 +116,7 @@ type ActorSchema< ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/adventure.d.mts b/types/foundry/common/documents/adventure.d.mts index 4bd15e862f5..bcd759c225b 100644 --- a/types/foundry/common/documents/adventure.d.mts +++ b/types/foundry/common/documents/adventure.d.mts @@ -45,41 +45,41 @@ interface AdventureMetadata extends DocumentClassMetadata { type AdventureSchema = { /** The _id which uniquely identifies this Adventure document */ _id: fields.DocumentIdField; - /** The name of this Adventure */ + /** The human-readable name of the Adventure */ name: fields.StringField; - /** An image file path which provides the artwork for this Adventure */ + /** The file path for the primary image of the adventure */ img: fields.FilePathField; - /** The caption displayed under the primary image banner */ + /** A string caption displayed under the primary image banner */ caption: fields.HTMLField; - /** The description for this Adventure */ + /** An HTML text description for the adventure */ description: fields.HTMLField; - /** An array of Actor documents which are included in this Adventure */ + /** An array of included Actor documents */ actors: fields.SetField>>; - /** An array of Combat documents which are included in this Adventure */ + /** An array of included Combat documents */ combats: fields.SetField>; - /** An array of Item documents which are included in this Adventure */ + /** An array of included Item documents */ items: fields.SetField>>; - /** An array of JournalEntry documents which are included in this Adventure */ + /** An array of included JournalEntry documents*/ journal: fields.SetField>; - /** An array of Scene documents which are included in this Adventure */ + /** An array of included Scene documents */ scenes: fields.SetField>; - /** An array of RollTable documents which are included in this Adventure */ + /** An array of included RollTable documents */ tables: fields.SetField>; - /** An array of Macro documents which are included in this Adventure */ + /** An array of included Macro documents */ macros: fields.SetField>; - /** An array of Cards documents which are included in this Adventure */ + /** An array of included Cards documents */ cards: fields.SetField>; - /** An array of Playlist documents which are included in this Adventure */ + /** An array of included Playlist documents */ playlists: fields.SetField>; - /** An array of Folder documents which are included in this Adventure */ + /** An array of included Folder documents */ folders: fields.SetField>; - /** The Folder which contains this Adventure */ + /** The _id of a Folder which contains this Adventure */ folder: fields.ForeignDocumentField; - /** The numeric sort valute which orders this Adventure relative to its siblings */ + /** The sort order of this adventure relative to its siblings */ sort: fields.IntegerSortField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/ambient-light.d.mts b/types/foundry/common/documents/ambient-light.d.mts index 9d8f3c70d06..2bd88d624af 100644 --- a/types/foundry/common/documents/ambient-light.d.mts +++ b/types/foundry/common/documents/ambient-light.d.mts @@ -43,30 +43,32 @@ interface AmbientLightMetadata extends DocumentClassMetadata { export type AmbientLightSchema = { /** The _id which uniquely identifies this AmbientLight document */ _id: fields.DocumentIdField; - /** The name of this AmbientLight */ + /** An optional name. */ name: fields.StringField; - /** The x-coordinate position of the origin of this AmbientLight */ + /** The x-coordinate position of the origin of the light */ x: fields.NumberField; - /** The y-coordinate position of the origin of this AmbientLight */ + /** The y-coordinate position of the origin of the light */ y: fields.NumberField; - /** The elevation of this AmbientLight */ + /** The elevation */ elevation: fields.NumberField; - /** An array of Levels that this AmbientLight is on */ + /** The level IDs */ levels: fields.SceneLevelsSetField; - /** The angle of rotation of this AmbientLight between 0 and 360 */ + /** The angle of rotation for the tile between 0 and 360 */ rotation: fields.AngleField; - /** Whether or not this AmbientLight is constrained by walls */ + /** Whether or not this light source is constrained by Walls and surfaces */ walls: fields.BooleanField; - /** Whether or not this AmbientLight provides a source of vision */ + /** Whether or not this light source provides a source of vision */ vision: fields.BooleanField; /** Light configuration data */ config: fields.EmbeddedDataField>>; - /** Is this AmbientLight currently hidden? */ + /** Is the light source currently hidden? */ hidden: fields.BooleanField; - /** Is this AmbientLight currently locked? */ + /** Is the light source currently locked? */ locked: fields.BooleanField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; }; export type AmbientLightSource = fields.SourceFromSchema; + +export {}; diff --git a/types/foundry/common/documents/ambient-sound.d.mts b/types/foundry/common/documents/ambient-sound.d.mts index 420c74927fe..4c9531c206f 100644 --- a/types/foundry/common/documents/ambient-sound.d.mts +++ b/types/foundry/common/documents/ambient-sound.d.mts @@ -46,37 +46,38 @@ type OneToTen = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; type AmbientSoundSchema = { /** The _id which uniquely identifies this AmbientSound document */ _id: fields.DocumentIdField; - /** The name of this AmbientSound */ + /** An optional name. */ name: fields.StringField; - /** The x-coordinate position of the origin of this AmbientSound */ + /** The x-coordinate position of the origin of the sound. */ x: fields.NumberField; - /** The y-coordinate position of the origin of this AmbientSound */ + /** The y-coordinate position of the origin of the sound. */ y: fields.NumberField; - /** The elevation of the origin of this AmbientSound */ + /** The elevation */ elevation: fields.NumberField; - /** An array of Levels that this AmbientSound is on */ + /** The level IDs */ levels: fields.SceneLevelsSetField; - /** The radius of the emitted sound */ + /** The radius of the emitted sound. */ radius: fields.NumberField; - /** The audio file path that is played by this AmbientSound */ + /** The audio file path that is played by this sound */ path: fields.FilePathField; /** Does this sound loop? */ repeat: fields.BooleanField; /** The audio volume of the sound, from 0 to 1 */ volume: fields.AlphaField; - /** Whether or not this AmbientSound is constrained by walls */ + /** Whether or not this sound source is constrained by Walls and surfaces. True by default. */ walls: fields.BooleanField; - /** Whether to adjust the volume of the sound heard by the listener based on how close the listener is to the center of the sound source */ + /** Whether to adjust the volume of the sound heard by the listener based on how close the listener is to the center of the sound source. True by default. */ easing: fields.BooleanField; - /** Is this AmbientSound currently hidden? */ + /** Is the sound source currently hidden? False by default. */ hidden: fields.BooleanField; - /** Is this AmbientSound currently locked? */ + /** Is the sound source currently locked? */ locked: fields.BooleanField; - /** A darknes range (min and max) for which the source should be active */ + /** A darkness range (min and max) for which the source should be active */ darkness: fields.SchemaField<{ min: fields.AlphaField; max: fields.AlphaField; }>; + /** Special effects to apply to the sound */ effects: fields.SchemaField<{ base: fields.SchemaField<{ type: fields.StringField; diff --git a/types/foundry/common/documents/card.d.mts b/types/foundry/common/documents/card.d.mts index dc141b28946..904b7957e5c 100644 --- a/types/foundry/common/documents/card.d.mts +++ b/types/foundry/common/documents/card.d.mts @@ -45,13 +45,13 @@ interface CardMetadata extends DocumentClassMetadata { type CardSchema = { /** The _id which uniquely identifies this Card document */ _id: fields.DocumentIdField; - /** The name of this Card */ + /** The text name of this card */ name: fields.StringField; - /** The description of this card which applies to all faces */ + /** A text description of this card which applies to all faces */ description: fields.HTMLField; - /** An Card subtype which configures the system data model applied */ + /** A category of card (for example, a suit) to which this card belongs */ type: fields.DocumentTypeField; - /** They system data object which is defined by the system data model */ + /** Data for a Card subtype, defined by a System or Module */ system: fields.TypeDataField; /** An optional suit designation which is used by default sorting */ suit: fields.StringField; @@ -73,17 +73,20 @@ type CardSchema = { height: fields.NumberField; /** The angle of rotation of this card */ rotation: fields.AngleField; - /** The numeric sort valute which orders this Card relative to its siblings */ + /** The sort order of this card relative to others in the same stack */ sort: fields.IntegerSortField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; type CardFaceSchema = { + /** A name for this card face */ name: fields.StringField; + /** Displayed text that belongs to this face */ text: fields.HTMLField; + /** A displayed image or video file which depicts the face */ img: fields.FilePathField; }; diff --git a/types/foundry/common/documents/cards.d.mts b/types/foundry/common/documents/cards.d.mts index 6eee50aebc2..377551f0d33 100644 --- a/types/foundry/common/documents/cards.d.mts +++ b/types/foundry/common/documents/cards.d.mts @@ -40,19 +40,19 @@ interface CardsMetadata extends abstract.DocumentClassMetadata { } type CardsSchema = { - /** The _id which uniquely identifies this stack of cards */ + /** The _id which uniquely identifies this stack of Cards document */ _id: fields.DocumentIdField; - /** The name of this stack of cards */ + /** The text name of this stack */ name: fields.StringField; - /** The subtype which configures the system data model applied */ + /** The type of this stack, in BaseCards.metadata.types */ type: fields.DocumentTypeField; - /** The descript of this stack of cards */ + /** A text description of this stack */ description: fields.HTMLField; - /** An image or video which is used to represent this stack of cards */ + /** An image or video which is used to represent the stack of cards */ img: fields.FilePathField; - /** They system data object which is defined by the system data model */ + /** Data for a Cards subtype, defined by a System or Module */ system: fields.TypeDataField; - /** An EmbeddedCollection of Card documents which currently belong to this stack of cards */ + /** A collection of Card documents which currently belong to this stack */ cards: fields.EmbeddedCollectionField>; /** The visible width of this stack */ width: fields.NumberField; @@ -62,15 +62,15 @@ type CardsSchema = { rotation: fields.AngleField; /** Whether or not to publicly display the number of cards in this stack */ displayCount: fields.BooleanField; - /** The Folder which contains this stack of cards */ + /** The _id of a Folder which contains this document */ folder: fields.ForeignDocumentField; - /** The numeric sort valute which orders this stack of cards relative to its siblings */ + /** The sort order of this stack relative to others in its parent collection */ sort: fields.IntegerSortField; - /** An object which configures ownership of this stack of cards */ + /** An object which configures ownership of this Cards */ ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/chat-message.d.mts b/types/foundry/common/documents/chat-message.d.mts index 13ae27be6a4..f960690f81c 100644 --- a/types/foundry/common/documents/chat-message.d.mts +++ b/types/foundry/common/documents/chat-message.d.mts @@ -45,13 +45,13 @@ interface ChatMessageMetadata extends DocumentClassMetadata { declare type ChatMessageSchema = { /** The _id which uniquely identifies this ChatMessage document */ _id: fields.DocumentIdField; - /** An ChatMessage subtype which configures the system data model applied */ + /** The type of this chat message, in BaseChatMessage.metadata.types */ type: fields.DocumentTypeField; - /** They system data object which is defined by the system data model */ + /** Data for a ChatMessage subtype, defined by a System or Module */ system: fields.TypeDataField; /** The message style from CONST.CHAT_MESSAGE_STYLES */ style: fields.NumberField; - /** The User Document who generated this message */ + /** The _id of the User document who generated this message */ author: fields.ForeignDocumentField; /** The timestamp at which point this message was generated */ timestamp: fields.NumberField; @@ -61,19 +61,19 @@ declare type ChatMessageSchema = { content: fields.HTMLField; /** A ChatSpeakerData object which describes the origin of the ChatMessage */ speaker: fields.SchemaField; - /** An array of User _id values to whome this message is privately whispered */ + /** An array of User _id values to whom this message is privately whispered */ whisper: fields.ArrayField>; /** Is this message sent blindly where the creating User cannot see it? */ blind: fields.BooleanField; /** Serialized content of any Roll instances attached to the ChatMessage */ rolls: fields.ArrayField>; - /** The audio file path which plays when this message is received */ + /** The URL of an audio file which plays when this message is received */ sound: fields.FilePathField; - /** IS this message syled as an emote? */ + /** Is this message styled as an emote? */ emote: fields.BooleanField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; @@ -88,11 +88,11 @@ export type ChatMessageFlags = DocumentFlags & { declare type ChatSpeakerSchema = { /** The _id of the Scene where this message was created */ scene: fields.ForeignDocumentField; - /** The _id of Actor who generated this message */ + /** The _id of the Actor who generated this message */ actor: fields.ForeignDocumentField; - /** The _id of Token who generated this message */ + /** The _id of the Token who generated this message */ token: fields.ForeignDocumentField; - /** An overriden alias name used instead of the Actor or Token name */ + /** An overridden alias name used instead of the Actor or Token name */ alias: fields.StringField; }; diff --git a/types/foundry/common/documents/combat.d.mts b/types/foundry/common/documents/combat.d.mts index d4d472049a3..879c93bbfab 100644 --- a/types/foundry/common/documents/combat.d.mts +++ b/types/foundry/common/documents/combat.d.mts @@ -54,29 +54,29 @@ interface CombatMetadata extends DocumentClassMetadata { } type CombatSchema = { - /** The _id which uniquely identifies this Combate document */ + /** The _id which uniquely identifies this Combat document */ _id: fields.DocumentIdField; - /** An Combate subtype which configures the system data model applied */ + /** The type of this Combat. */ type: fields.DocumentTypeField; - /** They system data object which is defined by the system data model */ + /** Game system data which is defined by system data models. */ system: fields.TypeDataField; - /** The Scene within which this Combat occurs */ + /** The _id of a Scene within which this Combat occurs */ scene: fields.ForeignDocumentField; - /** An EmbeddedCollection of CombatantGroup documents */ + /** A Collection of Documents that represent a grouping of individual Combatants. */ groups: fields.EmbeddedCollectionField>; - /** An EmbeddedCollection of Combatant documents */ + /** A Collection of Combatant embedded Documents */ combatants: fields.EmbeddedCollectionField>; /** Is the Combat encounter currently active? */ active: fields.BooleanField; /** The current round of the Combat encounter */ round: fields.NumberField; - /** The current turn of the Combat encounter */ + /** The current turn in the Combat round */ turn: fields.NumberField; - /** The numeric sort value which orders this Combat relative to its siblings */ + /** The current sort order of this Combat relative to others in the same Scene */ sort: fields.IntegerSortField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/combatant-group.d.mts b/types/foundry/common/documents/combatant-group.d.mts index 710d2547a63..f0f7a3fda97 100644 --- a/types/foundry/common/documents/combatant-group.d.mts +++ b/types/foundry/common/documents/combatant-group.d.mts @@ -35,23 +35,23 @@ declare interface CombatantGroupMetadata extends DocumentClassMetadata { } type CombatantGroupSchema = { - /** The _id which uniquely identifies this CombatantGroup document */ + /** The _id which uniquely identifies this CombatantGroup embedded document. */ _id: fields.DocumentIdField; - /** An CombatantGroup subtype which configures the system data model applied */ + /** The type of this CombatantGroup. */ type: fields.DocumentTypeField; - /** They system data object which is defined by the system data model */ + /** Game system data which is defined by system data models. */ system: fields.TypeDataField; - /** The name of this CombatantGroup */ + /** A customized name which replaces the inferred group name. */ name: fields.StringField; - /** The image file path which provides the artwork for this CombatantGroup */ + /** A customized image which replaces the inferred group image. */ img: fields.FilePathField; - /** The initiative score for the CombatantGRoup which determins its turn order */ + /** The initiative value that will be used for all group members. */ initiative: fields.NumberField; - /** An object which configures ownership of this CombatantGroup */ + /** An object which configures ownership of this group. */ ownership: fields.DocumentOwnershipField; - /** An object of optional key/value flags */ + /** An object of optional key/value flags. */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information. */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/combatant.d.mts b/types/foundry/common/documents/combatant.d.mts index 0faa1027d94..560e8d4bef7 100644 --- a/types/foundry/common/documents/combatant.d.mts +++ b/types/foundry/common/documents/combatant.d.mts @@ -40,11 +40,11 @@ interface CombatantMetadata extends DocumentClassMetadata { } type CombatantSchema = { - /** The _id which uniquely identifies this Combatant document */ + /** The _id which uniquely identifies this Combatant embedded document */ _id: fields.DocumentIdField; - /** A Combatant subtype which configures the system data model applied */ + /** The type of this Combatant. */ type: fields.DocumentTypeField; - /** They system data object which is defined by the system data model */ + /** Game system data which is defined by system data models. */ system: fields.TypeDataField; /** The _id of an Actor associated with this Combatant */ actorId: fields.ForeignDocumentField; @@ -52,23 +52,23 @@ type CombatantSchema = { tokenId: fields.ForeignDocumentField; /** The _id of a Scene associated with this Combatant */ sceneId: fields.ForeignDocumentField; - /** A customized name which replaces the name of the Actor/Token in the tracker */ + /** A customized name which replaces the name of the Token in the tracker */ name: fields.StringField; - /** A customized image which replaced the Token image in the tracker */ + /** A customized image which replaces the Token image in the tracker */ img: fields.FilePathField; /** The initiative score for the Combatant which determines its turn order */ initiative: fields.NumberField; - /** Is the Combatant currently hidden? */ + /** Is this Combatant currently hidden? */ hidden: fields.BooleanField; /** Has this Combatant been defeated? */ defeated: fields.BooleanField; - /** The _id of the CombatantGroup that this Combatant is associated with */ + /** An optional group this Combatant belongs to. */ group: fields.DocumentIdField; - /** The rounder that this Combatant joined initiative */ + /** he round this Combatant joined Combat (i.e., was created). A Combatant created before the Combat starts is considered to have joined in round 1. */ roundJoined: fields.NumberField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information. */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/drawing.d.mts b/types/foundry/common/documents/drawing.d.mts index 3d6198f40f7..c51f38588e9 100644 --- a/types/foundry/common/documents/drawing.d.mts +++ b/types/foundry/common/documents/drawing.d.mts @@ -47,11 +47,11 @@ interface DrawingMetadata extends abstract.DocumentClassMetadata { } type DrawingSchema = { - /** The _id which uniquely identifies this Drawing document */ + /** The _id which uniquely identifies this BaseDrawing embedded document */ _id: fields.DocumentIdField; - /** The name of this Drawing */ + /** An optional name. */ name: fields.StringField; - /** The user who created this drawing */ + /** The _id of the user who created the drawing */ author: fields.ForeignDocumentField; /** The geometric shape of the drawing */ shape: fields.EmbeddedDataField>>; @@ -59,29 +59,29 @@ type DrawingSchema = { x: fields.NumberField; /** The y-coordinate position of the top-left corner of the drawn shape */ y: fields.NumberField; - /** The elevation of the drawn shape */ + /** The elevation of the drawing */ elevation: fields.NumberField; - /** Any array of Levels that this Drawing is on */ + /** The level IDs */ levels: fields.SceneLevelsSetField; - /** The numeric sort value which orders this Actor relative to its siblings */ + /** The z-index of this drawing relative to other siblings */ sort: fields.NumberField; /** The angle of rotation for the drawing figure */ rotation: fields.AngleField; - /** An amoutn of bezier smoothing applied, between 0 and 1 */ + /** An amount of bezier smoothing applied, between 0 and 1 */ bezierFactor: fields.AlphaField; - /** The fill type of the drawing shapw, a value from CONST.DRAWING_FILL_TYPES */ + /** The fill type of the drawing shape, a value from CONST.DRAWING_FILL_TYPES */ fillType: fields.NumberField; - /** An optional color string which to fill the drawing geometry */ + /** An optional color string with which to fill the drawing geometry */ fillColor: fields.ColorField; - /** The opacity of hte fill applied to the drawing geometery */ + /** The opacity of the fill applied to the drawing geometry */ fillAlpha: fields.AlphaField; - /** The width in pixels of the boundary lines of the drawing geometery */ + /** The width in pixels of the boundary lines of the drawing geometry */ strokeWidth: fields.NumberField; - /** The color of the boundary lines of the drawing geometery */ + /** The color of the boundary lines of the drawing geometry */ strokeColor: fields.ColorField; - /** The opacity of the boundary lines of the drawing geometery */ + /** The opacity of the boundary lines of the drawing geometry */ strokeAlpha: fields.AlphaField; - /** The path to a tiling image texture used to file the drawing geometery */ + /** The path to a tiling image texture used to fill the drawing geometry */ texture: fields.FilePathField; /** Optional text which is displayed overtop of the drawing */ text: fields.StringField; @@ -97,9 +97,9 @@ type DrawingSchema = { hidden: fields.BooleanField; /** Is the drawing currently locked? */ locked: fields.BooleanField; - /** IS the drawing rendered in the interface group? */ + /** Is the drawing rendered in the interface group? */ interface: fields.BooleanField; - /** An object containing document metadata */ + /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; }; diff --git a/types/foundry/common/documents/fog-exploration.d.mts b/types/foundry/common/documents/fog-exploration.d.mts index f46c662d7e3..8104cda6c69 100644 --- a/types/foundry/common/documents/fog-exploration.d.mts +++ b/types/foundry/common/documents/fog-exploration.d.mts @@ -43,21 +43,21 @@ interface FogExplorationMetadata extends DocumentClassMetadata { type FogExplorationSchema = { /** The _id which uniquely identifies this FogExploration document */ _id: fields.DocumentIdField; - /** The User document which this FogExploration applies to */ + /** The _id of the User document to which this fog applies */ user: fields.ForeignDocumentField; - /** The Scene document which this FogExploration applies to */ + /** The _id of the Scene document to which this fog applies */ scene: fields.ForeignDocumentField; - /** The _id of the Level to which this FogExploration applies to */ + /** The level ID */ level: fields.DocumentIdField; - /** The base64 png image ofthe explored fog polygon */ + /** The base64 image/jpeg of the explored fog polygon */ explored: fields.FilePathField; - /** The object of scene positions which have been explored at a certain vision radius */ + /** Optional custom exploration data */ positions: fields.ObjectField; /** The timestamp at which this fog exploration was last updated */ timestamp: fields.NumberField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/folder.d.mts b/types/foundry/common/documents/folder.d.mts index 513ae2b3080..15f1a266854 100644 --- a/types/foundry/common/documents/folder.d.mts +++ b/types/foundry/common/documents/folder.d.mts @@ -48,17 +48,17 @@ type FolderSchema = { type: fields.DocumentTypeField; /** An HTML description of the contents of this folder */ description: fields.StringField; - /** The Folder which contains this Folder */ + /** The _id of a parent Folder which contains this Folder */ folder: fields.ForeignDocumentField; /** The sorting mode used to organize documents within this Folder, in ["a", "m"] */ sorting: fields.StringField; - /** The numeric sort value which orders this Actor relative to its siblings */ + /** The numeric sort value which orders this Folder relative to its siblings */ sort: fields.IntegerSortField; /** A color string used for the background color of this Folder */ color: fields.ColorField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/item.d.mts b/types/foundry/common/documents/item.d.mts index 4f305f24986..3b734cc2fc6 100644 --- a/types/foundry/common/documents/item.d.mts +++ b/types/foundry/common/documents/item.d.mts @@ -62,19 +62,19 @@ export type ItemSchema; /** An image file path which provides the artwork for this Item */ img: fields.FilePathField; - /** They system data object which is defined by the system data model */ + /** Data for an Item subtype, defined by a System or Module */ system: fields.TypeDataField; - /** An EmbeddedCollection of ActiveEffect documents */ + /** A collection of ActiveEffect embedded Documents */ effects: fields.EmbeddedCollectionField>>; - /** The Folder which contains this Item */ + /** The _id of a Folder which contains this Item */ folder: fields.ForeignDocumentField; /** The numeric sort value which orders this Item relative to its siblings */ sort: fields.IntegerSortField; - /** An object which configures ownership of this Actor */ + /** An object which configures ownership of this Item */ ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/journal-entry-category.d.mts b/types/foundry/common/documents/journal-entry-category.d.mts index 0facb5fa5ff..cc693af3c94 100644 --- a/types/foundry/common/documents/journal-entry-category.d.mts +++ b/types/foundry/common/documents/journal-entry-category.d.mts @@ -35,14 +35,14 @@ interface JournalEntryCategoryMetadata extends DocumentClassMetadata { } type JournalEntryCategorySchema = { - /** The _id which uniquely identifies this JournalEntryCategory document */ + /** The _id which uniquely identifies this JournalEntryCategory document. */ _id: fields.DocumentIdField; - /** The name of this JournalEntryCategory */ + /** The name of this JournalEntryCategory. */ name: fields.StringField; - /** The numeric sort value which orders this JournalEntryCategory relative to its siblings */ + /** The numeric sort value which orders this category relative to other categories. */ sort: fields.IntegerSortField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information. */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/journal-entry-page.d.mts b/types/foundry/common/documents/journal-entry-page.d.mts index 4ff27ea1c96..1c43631e9e7 100644 --- a/types/foundry/common/documents/journal-entry-page.d.mts +++ b/types/foundry/common/documents/journal-entry-page.d.mts @@ -42,50 +42,63 @@ type JournalEntryPageSchema< TSystemSource extends object = object, TSystemData extends object = TSystemSource, > = { - /** The _id which uniquely identifies this JournalEntryPage document */ + /** The _id which uniquely identifies this JournalEntryPage embedded document.t */ _id: fields.DocumentIdField; - /** The name of this JournalEntryPage */ + /** The text name of this page. */ name: fields.StringField; - /** An JournalEntryPage subtype which configures the system data model applied */ + /** The type of this page. */ type: fields.DocumentTypeField; - /** They system data object which is defined by the system data model */ + /** System-specific data. */ system: fields.TypeDataField; - /** Data the controls the display of this page's title */ + /** Data that control's the display of this page's title. */ title: fields.SchemaField<{ + /** Whether to render the page's title in the overall journal view. */ show: fields.BooleanField; + /** The heading level to render this page's title at in the overall journal view. */ level: fields.NumberField; }>; - /** Data particular to image journal entry pages */ + /** Data particular to image journal entry pages. */ image: fields.SchemaField<{ + /** A caption for the image. */ caption: fields.StringField; }>; - /** Data particular to text journal entry pages */ + /** Data particular to text journal entry pages. */ text: fields.SchemaField<{ + /** The content of the JournalEntryPage in a format appropriate for its type. */ content: fields.HTMLField; + /** The original markdown source, if applicable. */ markdown: fields.StringField; + /** The format of the page's content, in CONST.JOURNAL_ENTRY_PAGE_FORMATS. */ format: fields.NumberField; }>; - /** Data particular to video journal entry pages */ + /** Data particular to video journal entry pages. */ video: fields.SchemaField<{ + /** Show player controls for this video? */ controls: fields.BooleanField; + /** Automatically loop the video? */ loop: fields.BooleanField; + /** Should the video play automatically? */ autoplay: fields.BooleanField; + /** The volume level of any audio that the video file contains. */ volume: fields.AlphaField; + /** The starting point of the video, in seconds. */ timestamp: fields.NumberField; + /** The width of the video, otherwise it will fill the available container width. */ width: fields.NumberField; + /** The height of the video, otherwise it will use the aspect ratio of the source video, or 16:9 if that aspect ratio is not available. */ height: fields.NumberField; }>; /** The URI of the image or other external media to be used for this page. */ src: fields.StringField; - /** The _id of the JournalEntryCategory applied to this page */ + /** An optional category that this page belongs to. */ category: fields.DocumentIdField; - /** The numeric sort value which orders this JournalEntryPage relative to its siblings */ + /** The numeric sort value which orders this page relative to its siblings. */ sort: fields.IntegerSortField; - /** An object which configures ownership of this JournalEntryPage */ + /** An object which configures the ownership of this page. */ ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/journal-entry.d.mts b/types/foundry/common/documents/journal-entry.d.mts index 68e0fb0af1d..8dec804ce7b 100644 --- a/types/foundry/common/documents/journal-entry.d.mts +++ b/types/foundry/common/documents/journal-entry.d.mts @@ -44,11 +44,11 @@ type JournalEntrySchema = { _id: fields.DocumentIdField; /** The name of this JournalEntry */ name: fields.StringField; - /** An EmbeddedCollection of JournalEntryPage documents */ + /** The pages contained within this JournalEntry document */ pages: fields.EmbeddedCollectionField>; - /** The Folder which contains this JournalEntry */ + /** The _id of a Folder which contains this JournalEntry */ folder: fields.ForeignDocumentField; - /** An EmbeddedCollection of JournalEntryCategory documents */ + /** The categories contained within this JournalEntry. */ categories: fields.EmbeddedCollectionField>; /** The numeric sort value which orders this JournalEntry relative to its siblings */ sort: fields.IntegerSortField; @@ -56,7 +56,7 @@ type JournalEntrySchema = { ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/level.d.mts b/types/foundry/common/documents/level.d.mts index 9ff1ad5e99b..8e892c6dea2 100644 --- a/types/foundry/common/documents/level.d.mts +++ b/types/foundry/common/documents/level.d.mts @@ -73,34 +73,27 @@ interface LevelMetadata extends DocumentClassMetadata { } type LevelSchema = { - /** The _id which uniquely identifies this Level document */ _id: fields.DocumentIdField; - /** The name of this Level */ name: fields.StringField; - /** Data related to the elevation range of this Level */ elevation: fields.SchemaField<{ bottom: fields.NumberField; // Treat null as -Infinity top: fields.NumberField; // Treat null as +Infinity }>; - /** Data related to the background of this Level */ background: fields.SchemaField<{ color: fields.ColorField; src: fields.FilePathField; tint: fields.ColorField; alphaThreshold: fields.AlphaField; }>; - /** Data related to the foreground of this Level */ foreground: fields.SchemaField<{ src: fields.FilePathField; tint: fields.ColorField; alphaThreshold: fields.AlphaField; }>; - /** Data related to the fog settings of this Level */ fog: fields.SchemaField<{ src: fields.FilePathField; tint: fields.ColorField; }>; - /** Data related to the positioning of textures for this Level */ textures: fields.SchemaField<{ anchorX: fields.NumberField; anchorY: fields.NumberField; @@ -111,13 +104,10 @@ type LevelSchema = { scaleY: fields.NumberField; rotation: fields.AngleField; }>; - /** Data related to the visibility of this Level */ visibility: fields.SchemaField<{ levels: fields.SceneLevelsSetField; }>; - /** The numeric sort value which orders this Level relative to its siblings */ sort: fields.IntegerSortField; - /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; }; diff --git a/types/foundry/common/documents/macro.d.mts b/types/foundry/common/documents/macro.d.mts index 4698cbe226f..571e86e1b1d 100644 --- a/types/foundry/common/documents/macro.d.mts +++ b/types/foundry/common/documents/macro.d.mts @@ -65,7 +65,7 @@ type MacroSchema = { name: fields.StringField; /** A Macro subtype from CONST.MACRO_TYPES */ type: fields.DocumentTypeField; - /** The User who created this Macro */ + /** The _id of a User document which created this Macro */ author: fields.ForeignDocumentField; /** An image file path which provides the thumbnail artwork for this Macro */ img: fields.FilePathField; @@ -73,7 +73,7 @@ type MacroSchema = { scope: fields.StringField; /** The string content of the macro command */ command: fields.StringField; - /** The Folder which contains this Macro */ + /** The _id of a Folder which contains this Macro */ folder: fields.ForeignDocumentField; /** The numeric sort value which orders this Macro relative to its siblings */ sort: fields.IntegerSortField; @@ -81,7 +81,7 @@ type MacroSchema = { ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/note.d.mts b/types/foundry/common/documents/note.d.mts index 7c98085b45b..d4e1b5dac0c 100644 --- a/types/foundry/common/documents/note.d.mts +++ b/types/foundry/common/documents/note.d.mts @@ -47,9 +47,9 @@ interface NoteMetadata extends DocumentClassMetadata { } type NoteSchema = { - /** The _id which uniquely identifies this Note document */ + /** The _id which uniquely identifies this BaseNote embedded document */ _id: fields.DocumentIdField; - /** The user who created this Note */ + /** The _id of a User document which created this Note */ author: fields.DocumentAuthorField; /** The _id of a JournalEntry document which this Note represents */ entryId: fields.ForeignDocumentField; @@ -59,11 +59,11 @@ type NoteSchema = { x: fields.NumberField; /** The y-coordinate position of the center of the note icon */ y: fields.NumberField; - /** The elevation of the note icon */ + /** The elevation */ elevation: fields.NumberField; - /** An array of Levels that this Note is on */ + /** The level IDs */ levels: fields.SceneLevelsSetField; - /** The numeric sort value which orders this Note relative to its siblings */ + /** The sort order */ sort: fields.NumberField; /** Is this Note currently locked? */ locked: fields.BooleanField; diff --git a/types/foundry/common/documents/playlist-sound.d.mts b/types/foundry/common/documents/playlist-sound.d.mts index 24ca71dd4ed..74b9f8b7e77 100644 --- a/types/foundry/common/documents/playlist-sound.d.mts +++ b/types/foundry/common/documents/playlist-sound.d.mts @@ -39,13 +39,15 @@ interface PlaylistSoundMetadata extends DocumentClassMetadata { type PlaylistSoundSchema = { /** The _id which uniquely identifies this PlaylistSound document */ _id: fields.DocumentIdField; - /** The name of this PlaylistSound */ + /** The name of this sound */ name: fields.StringField; - /** The description of this PlaylistSound */ + /** The description of this sound */ description: fields.StringField; - /** The audio file path that is played by this PlaylistSound */ + /** The audio file path that is played by this sound */ path: fields.FilePathField; - /** IS this PlaylistSound currently playing? */ + /** A channel in CONST.AUDIO_CHANNELS where this sound is played */ + channel: fields.StringField; + /** Is this sound currently playing? */ playing: fields.BooleanField; /** The time in seconds at which playback was paused */ pausedTime: fields.NumberField; @@ -55,7 +57,7 @@ type PlaylistSoundSchema = { volume: fields.AlphaField; /** A duration in milliseconds to fade volume transition */ fade: fields.NumberField; - /** The numeric sort value which orders this PlaylistSound relative to its siblings */ + /** The sort order of the PlaylistSound relative to others in the same collection */ sort: fields.IntegerSortField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; diff --git a/types/foundry/common/documents/playlist.d.mts b/types/foundry/common/documents/playlist.d.mts index 8d8305b1c56..8457e909963 100644 --- a/types/foundry/common/documents/playlist.d.mts +++ b/types/foundry/common/documents/playlist.d.mts @@ -1,4 +1,4 @@ -import { AudioChannel, PlaylistMode, PlaylistSortMode } from "@common/constants.mjs"; +import { PlaylistMode, PlaylistSortMode } from "@common/constants.mjs"; import { Document, DocumentClassMetadata, EmbeddedCollection } from "../abstract/_module.mjs"; import * as fields from "../data/fields.mjs"; import { BaseFolder, BasePlaylistSound } from "./_module.mjs"; @@ -39,33 +39,33 @@ interface PlaylistMetadata extends DocumentClassMetadata { type PlaylistSchema = { /** The _id which uniquely identifies this Playlist document */ _id: fields.DocumentIdField; - /** The name of this Playlist */ + /** The name of this playlist */ name: fields.StringField; - /** The description of this Playlist */ + /** The description of this playlist */ description: fields.StringField; - /** An EmbeddedCollection of PlaylistSound documents */ + /** A Collection of PlaylistSounds embedded documents which belong to this playlist */ sounds: fields.EmbeddedCollectionField>; - /** The audio channel this Playlist is played on, CONST.AUDIO_CHANNELS */ - channel: fields.StringField; - /** The mode of this Playlist, CONST.PLAYLIST_MODES */ - mode: fields.NumberField; - /** Is this Playlist currently playing? */ + /** A channel in CONST.AUDIO_CHANNELS where all sounds in this playlist are played */ + channel: fields.StringField; + /** The playback mode for sounds in this playlist */ + mode: fields.NumberField; + /** Is this playlist currently playing? */ playing: fields.BooleanField; /** A duration in milliseconds to fade volume transition */ fade: fields.NumberField; - /** The Folder which contains this Playlist */ + /** The _id of a Folder which contains this playlist */ folder: fields.ForeignDocumentField; - /** How this Playlist is sorted, CONST.PLAYLIST_SORT_MODES */ + /** The sorting mode used for this playlist. */ sorting: fields.StringField; - /** A stored seed used for randomization to guarantee that all clients generate the same random order */ + /** A seed used for playlist randomization to guarantee that all clients generate the same random order. */ seed: fields.NumberField; - /** The numeric sort value which orders this Playlist relative to its siblings */ + /** The numeric sort value which orders this playlist relative to its siblings */ sort: fields.IntegerSortField; /** An object which configures ownership of this Playlist */ ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/region-behavior.d.mts b/types/foundry/common/documents/region-behavior.d.mts index 71a73a3288b..57ecdd69c00 100644 --- a/types/foundry/common/documents/region-behavior.d.mts +++ b/types/foundry/common/documents/region-behavior.d.mts @@ -53,19 +53,19 @@ interface RegionBehaviorMetadata extends abstract.DocumentClassMetadata { } type RegionBehaviorSchema = { - /** The _id which uniquely identifies this RegionBehavior document */ + /** The _id which uniquely identifies this RegionBehavior document */ _id: fields.DocumentIdField; - /** The name of this RegionBehavior */ + /** The name used to describe the RegionBehavior */ name: fields.StringField; /** An RegionBehavior subtype which configures the system data model applied */ type: fields.DocumentTypeField; - /** They system data object which is defined by the system data model */ + /** Data for a RegionBehavior subtype, defined by a System or Module */ system: fields.TypeDataField; - /** IS the RegionBehavior currently disabled? */ + /** Is the RegionBehavior currently disabled? */ disabled: fields.BooleanField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/region.d.mts b/types/foundry/common/documents/region.d.mts index d2fb8456b76..20f519727eb 100644 --- a/types/foundry/common/documents/region.d.mts +++ b/types/foundry/common/documents/region.d.mts @@ -69,41 +69,36 @@ interface RegionMetadata extends DocumentClassMetadata { } type RegionSchema = { - /** The _id which uniquely identifies this Region document */ + /** The Region _id which uniquely identifies it within its parent Scene */ _id: fields.DocumentIdField; - /** The name of this Region */ + /** The name used to describe the Region */ name: fields.StringField; /** The color used to highlight the Region */ color: fields.ColorField; /** The shapes that make up the Region */ shapes: fields.ArrayField>; - /** The elevation of this Region */ + /** The elevation */ elevation: fields.SchemaField; - /** An array of Levels that this Region is on */ + /** The level IDs */ levels: fields.SceneLevelsSetField; - /** Data related to if this Region is restricted by walls */ restriction: fields.SchemaField<{ enabled: fields.BooleanField; type: fields.StringField; priority: fields.NumberField; }>; - /** Data related to which Token this Region is attached to */ attachment: fields.SchemaField<{ token: fields.ForeignDocumentField; }>; - /** An EmbeddedCollection of RegionBehavior documents */ + /** A collection of embedded RegionBehavior objects */ behaviors: fields.EmbeddedCollectionField>; - /** When is this Region visible, see CONST.REGION_VISIBILITY */ + /** The region visibility*/ visibility: fields.NumberField; - /** Are the true shapes of this Region highlighted, or are the grid spaces fully in the Region highlighted */ highlightMode: fields.StringField; - /** Are the measurements of this Region visible? */ displayMeasurements: fields.BooleanField; - /** Is this Region currently hidden? */ hidden: fields.BooleanField; - /** Is this Region currently locked? */ + /** Whether this region is locked or not */ locked: fields.BooleanField; - /** An object which configures ownership of this Actor */ + /** An object which configures ownership of this Playlist */ ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; diff --git a/types/foundry/common/documents/roll-table.d.mts b/types/foundry/common/documents/roll-table.d.mts index 7b99377c9fd..1ce128e3ac9 100644 --- a/types/foundry/common/documents/roll-table.d.mts +++ b/types/foundry/common/documents/roll-table.d.mts @@ -48,15 +48,15 @@ type RollTableSchema = { img: fields.FilePathField; /** The HTML text description for this RollTable document */ description: fields.HTMLField; - /** An EmbeddedCollection of TableResult documents */ + /** A Collection of TableResult embedded documents which belong to this RollTable */ results: fields.EmbeddedCollectionField>; - /** The Roll formulate which determines the results chosen from this RollTable */ + /** The Roll formula which determines the results chosen from the table */ formula: fields.StringField; /** Are results from this table drawn with replacement? */ replacement: fields.BooleanField; /** Is the Roll result used to draw from this RollTable displayed in chat? */ displayRoll: fields.BooleanField; - /** The Folder which contains this RollTable */ + /** The _id of a Folder which contains this RollTable */ folder: fields.ForeignDocumentField; /** The numeric sort value which orders this RollTable relative to its siblings */ sort: fields.IntegerSortField; @@ -64,7 +64,7 @@ type RollTableSchema = { ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/scene.d.mts b/types/foundry/common/documents/scene.d.mts index 5c8085f7754..a0d2c5b0c49 100644 --- a/types/foundry/common/documents/scene.d.mts +++ b/types/foundry/common/documents/scene.d.mts @@ -77,7 +77,7 @@ export interface SceneMetadata extends DocumentClassMetadata { type SceneSchema = { /** The _id which uniquely identifies this Scene document */ _id: fields.DocumentIdField; - /** The name of this Scene */ + /** The name of this scene */ name: fields.StringField; // Navigation @@ -91,7 +91,7 @@ type SceneSchema = { navName: fields.HTMLField; // Canvas Dimensions - /** An image or video file that provides the background texture for the scene. */ + /** A thumbnail image which depicts the scene at lower resolution */ thumb: fields.FilePathField; /** The width of the scene canvas, normally the width of the background media */ width: fields.NumberField; @@ -99,9 +99,9 @@ type SceneSchema = { height: fields.NumberField; /** The proportion of canvas padding applied around the outside of the scene dimensions to provide additional buffer space */ padding: fields.NumberField; - /** How much the background is shifted by in the x-coordinates */ + /** The shift of the scene rect in x-direction (pixels) */ shiftX: fields.NumberField; - /** How much the background is shifted by in the y-coordinates */ + /** The shift of the scene rect in y-direction (pixels) */ shiftY: fields.NumberField; /** The initial view coordinates for the scene */ initial: fields.SchemaField<{ @@ -109,7 +109,6 @@ type SceneSchema = { y: fields.NumberField; scale: fields.NumberField; }>; - /** The initial level for the scene */ initialLevel: fields.DocumentIdField>; // Grid Configuration @@ -119,15 +118,15 @@ type SceneSchema = { // Vision and Lighting Configuration /** Do Tokens require vision in order to see the Scene environment? */ tokenVision: fields.BooleanField; - /** Fog configuration for the scene */ + /** Fog-exploration settings and other data */ fog: fields.SchemaField; // Environment Configuration - /** Environment configuration for the scene */ + /** The environment data applied to the Scene. */ environment: fields.SchemaField; // Transition Configuration - /** Data related to the transition to/from the scene */ + /** The transition animation */ transition: fields.SchemaField<{ type: fields.StringField; duration: fields.NumberField; @@ -135,39 +134,39 @@ type SceneSchema = { }>; // Embedded Collections - /** An EmbeddedCollection of Drawing documents */ + /** A collection of embedded Drawing objects. */ drawings: fields.EmbeddedCollectionField>; - /** An EmbeddedCollection of Token documents */ + /** A collection of embedded Token objects. */ tokens: fields.EmbeddedCollectionField>; - /** An EmbeddedCollection of Level documents */ + /** A collection of embedded Level objects */ levels: fields.EmbeddedCollectionField>; - /** An EmbeddedCollection of AmbientLight documents */ + /** A collection of embedded AmbientLight object */ lights: fields.EmbeddedCollectionField>; - /** An EmbeddedCollection of Note documents */ + /** A collection of embedded Note objects. */ notes: fields.EmbeddedCollectionField>; - /** An EmbeddedCollection of AmbientSound documents */ + /** A collection of embedded AmbientSound objects. */ sounds: fields.EmbeddedCollectionField>; - /** An EmbeddedCollection of Region documents */ + /** A collection of embedded Region objects. */ regions: fields.EmbeddedCollectionField>; - /** An EmbeddedCollection of Tile documents */ + /** A collection of embedded Tile objects. */ tiles: fields.EmbeddedCollectionField>; - /** An EmbeddedCollection of Wall documents */ + /** A collection of embedded Wall objects */ walls: fields.EmbeddedCollectionField>; // Linked Documents /** A linked Playlist document which should begin automatically playing when this Scene becomes active. */ playlist: fields.ForeignDocumentField; - /** The _id of the PlaylistSound document from the selected playlist that will begin automatically playing when this Scene becomes active */ + /** A linked PlaylistSound document from the selected playlist that will begin automatically playing when this Scene becomes active */ playlistSound: fields.ForeignDocumentField; /** A JournalEntry document which provides narrative details about this Scene */ journal: fields.ForeignDocumentField; - /** The _id of the JournalEntryPage from the selected journal which provides narrative details about this Scene */ + /** A JournalEntry document which provides narrative details about this Scene */ journalEntryPage: fields.ForeignDocumentField; /** A named weather effect which should be rendered in this Scene. */ weather: fields.StringField; // Permissions - /** The Folder which contains this Scene */ + /** The _id of a Folder which contains this Scene */ folder: fields.ForeignDocumentField; /** The numeric sort value which orders this Scene relative to its siblings */ sort: fields.IntegerSortField; @@ -175,7 +174,7 @@ type SceneSchema = { ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; @@ -199,31 +198,52 @@ type GridDataSchema = { }; type FogSchema = { + /** Fog exploration mode configured for this Scene. */ mode: fields.NumberField; + /** The timestamp at which fog of war was last reset for this Scene. */ reset: fields.NumberField; + /** Fog-exploration coloration data */ colors: fields.SchemaField<{ + /** A color tint applied to explored regions of fog of war */ explored: fields.ColorField; + /** A color tint applied to unexplored regions of fog of war */ unexplored: fields.ColorField; }>; }; type EnvironmentSchema = { + /** The ambient darkness level in this Scene, where 0 represents midday (maximum illumination) and 1 represents midnight (maximum darkness) */ darknessLevel: fields.AlphaField; + /** The darkness level lock state. */ darknessLock: fields.BooleanField; + /** The global light data configuration. */ globalLight: fields.SchemaField<{ + /** Is the global light enabled? */ enabled: fields.BooleanField; + /** An opacity for the emitted light, if any */ alpha: data.LightDataSchema["alpha"]; + /** Is the global light in bright mode? */ bright: fields.BooleanField; + /** A tint color for the emitted light, if any */ color: data.LightDataSchema["color"]; + /** The coloration technique applied in the shader */ coloration: data.LightDataSchema["coloration"]; + /** The luminosity applied in the shader */ luminosity: data.LightDataSchema["luminosity"]; + /** The amount of color saturation this light applies to the background texture */ saturation: data.LightDataSchema["saturation"]; + /** The amount of contrast this light applies to the background texture */ contrast: data.LightDataSchema["contrast"]; + /** The depth of shadows this light applies to the background texture */ shadows: data.LightDataSchema["shadows"]; + /** A darkness range (min and max) for which the source should be active */ darkness: data.LightDataSchema["darkness"]; }>; + /** If cycling between base and dark is activated. */ cycle: fields.BooleanField; + /** The base (darkness level 0) ambience lighting data. */ base: fields.SchemaField; + /** The dark (darkness level 1) ambience lighting data. */ dark: fields.SchemaField; }; diff --git a/types/foundry/common/documents/setting.d.mts b/types/foundry/common/documents/setting.d.mts index 038462ba1f8..3dafa7d2634 100644 --- a/types/foundry/common/documents/setting.d.mts +++ b/types/foundry/common/documents/setting.d.mts @@ -32,13 +32,13 @@ interface SettingMetadata extends DocumentClassMetadata { type SettingSchema = { /** The _id which uniquely identifies this Setting document */ _id: fields.DocumentIdField; - /** The key of this stored setting*/ + /** The setting key, a composite of {scope}.{name} */ key: fields.StringField; - /** The value of this stored setting */ + /** The setting value, which is serialized to JSON */ value: fields.JSONField, true, true, false>; - /** The _id of the User that this setting is for, only used for user scoped settings */ + /** The ID of the user this Setting belongs to, if user-scoped. */ user: fields.ForeignDocumentField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/table-result.d.mts b/types/foundry/common/documents/table-result.d.mts index ffe867864bb..e5778b7a572 100644 --- a/types/foundry/common/documents/table-result.d.mts +++ b/types/foundry/common/documents/table-result.d.mts @@ -37,17 +37,14 @@ interface TableResultMetadata extends DocumentClassMetadata { } type TableResultSchema = { - /** The _id which uniquely identifies this TableResult document */ + /** The _id which uniquely identifies this TableResult embedded document */ _id: fields.DocumentIdField; /** A result subtype from CONST.TABLE_RESULT_TYPES */ type: fields.DocumentTypeField; - /** The name of this TableResult */ name: fields.StringField; - /** An image file path that represent this TableResult */ + /** An image file url that represents the table result */ img: fields.FilePathField; - /** The descrioption of this TableResult */ description: fields.HTMLField; - /** The UUID that this TableResult is linked to, used for "document" types */ documentUuid: fields.DocumentUUIDField; /** The probabilistic weight of this result relative to other results */ weight: fields.NumberField; @@ -57,7 +54,7 @@ type TableResultSchema = { drawn: fields.BooleanField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/tile.d.mts b/types/foundry/common/documents/tile.d.mts index 8dc55db3c60..2b7e38218ca 100644 --- a/types/foundry/common/documents/tile.d.mts +++ b/types/foundry/common/documents/tile.d.mts @@ -42,9 +42,9 @@ interface TileMetadata extends DocumentClassMetadata { } type TileSchema = { - /** The _id which uniquely identifies this Tile document */ + /** The _id which uniquely identifies this Tile embedded document */ _id: fields.DocumentIdField; - /** The name of this Tile */ + /** An optional name. */ name: fields.StringField; /** An image or video texture which this tile displays. */ texture: TextureData; @@ -52,14 +52,16 @@ type TileSchema = { width: fields.NumberField; /** The pixel height of the tile */ height: fields.NumberField; - /** The x-coordinate position of the top-left corner of the tile */ + /** The x-coordinate of the origin of the tile */ x: fields.NumberField; - /** The y-coordinate position of the top-left corner of the tile */ + /** The y-coordinate of the origin of the tile */ y: fields.NumberField; - /** The elevation that this tile is on */ + /** The elevation of the tile */ elevation: fields.NumberField; - /** An array of Levels that this tile is on */ + /** The level IDs */ levels: fields.SceneLevelsSetField; + /** The z-index ordering of this tile relative to its siblings */ + sort: fields.NumberField; /** The angle of rotation for the tile between 0 and 360 */ rotation: fields.AngleField; /** The tile opacity */ @@ -68,9 +70,11 @@ type TileSchema = { hidden: fields.BooleanField; /** Is the tile currently locked? */ locked: fields.BooleanField; - /** The tile's restriction settings */ + /** The tile's restrictions settings */ restrictions: fields.SchemaField<{ + /** Should we restricts light? */ light: fields.BooleanField; + /** Should we restricts weather? */ weather: fields.BooleanField; }>; /** The tile's occlusion settings */ @@ -89,6 +93,7 @@ type TileSchema = { /** The volume level of any audio that the video file contains */ volume: fields.AlphaField; }>; + /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; }; diff --git a/types/foundry/common/documents/token.d.mts b/types/foundry/common/documents/token.d.mts index 180a1754812..c0d04168db3 100644 --- a/types/foundry/common/documents/token.d.mts +++ b/types/foundry/common/documents/token.d.mts @@ -104,9 +104,9 @@ interface TokenMetadata extends DocumentClassMetadata { } type TokenSchema = { - /** The id which uniquely identifies this Token document */ + /** The Token _id which uniquely identifies it within its parent Scene */ _id: fields.DocumentIdField; - /** The name of this Token */ + /** The name used to describe the Token */ name: fields.StringField; /** The display mode of the Token nameplate, from CONST.TOKEN_DISPLAY_MODES */ displayName: fields.NumberField; @@ -128,15 +128,15 @@ type TokenSchema = { height: fields.NumberField; /** The depth of the Token in grid units */ depth: fields.NumberField; - /** The shape of the Token, form CONST.TOKEN_SHAPES */ + /** The shape of the Token */ shape: fields.NumberField; - /** The _id of the Level that this Token is on */ + /** The level ID */ level: fields.DocumentIdField; /** The token's texture on the canvas. */ texture: data.TextureData; - /** The numeric sort value which orders this Token relative to its siblings */ + /** The sort order */ sort: fields.NumberField; - /** Is the Token currently locked? */ + /** Is the Token currently locked? A locked token cannot be moved or rotated via standard keyboard or mouse interaction. */ locked: fields.BooleanField; /** Prevent the Token image from visually rotating? */ lockRotation: fields.BooleanField; @@ -166,7 +166,7 @@ type TokenSchema = { sight: fields.SchemaField<{ /** Should vision computation and rendering be active for this Token? */ enabled: fields.BooleanField; - /** How far in distance units the Token can see without the aid of a light source */ + /** How far in distance units the Token can see without the aid of a light source. If null, the sight range is unlimited. */ range: fields.NumberField; /** An angle at which the Token can see relative to their direction of facing */ angle: fields.AngleField; @@ -183,39 +183,49 @@ type TokenSchema = { /** An advanced customization for contrast within the visible area */ contrast: fields.NumberField; }>; - /** An array of detection modes which are available to this Token */ + /** A record of detection modes which are available to this Token */ detectionModes: fields.TypedObjectField< fields.SchemaField<{ - /** Whether or not this detection mode is presently enabled */ + /** Whether or not this detection mode is presently enabled. */ enabled: fields.BooleanField; - /** The maximum range in distance units at which this mode can detect targets */ + /** + * The maximum range in distance units at which this mode + * can detect targets. If null, which is only possible for modes in the document source, the detection range is + * unlimited. On document preparation null is converted to Infinity. + */ range: fields.NumberField; }> >; + /** Configuration of occlusion options */ occludable: fields.SchemaField<{ + /** Occlusion radius. */ radius: fields.NumberField; }>; - /** Data related to the dynamic token ring of this Token */ + /** Configuration of the Dynamic Token Ring */ ring: fields.SchemaField<{ + /** Dynamic Token ring is enabled? */ enabled: fields.BooleanField; colors: fields.SchemaField<{ + /** Color of the ring. */ ring: fields.ColorField; + /** Color of the background (behind the token, inside the ring). */ background: fields.ColorField; }>; + /** Numerical bitmask to toggle effects. Default: 0x01 */ effects: fields.NumberField; subject: fields.SchemaField<{ + /** Scale of the subject texture. */ scale: fields.NumberField; + /** Path of the subject texture. */ texture: fields.FilePathField; }>; }>; - /** Data related to the turn marker of this Token */ turnMarker: fields.SchemaField<{ mode: fields.NumberField; animation: fields.StringField; src: fields.FilePathField; disposition: fields.BooleanField; }>; - /** The current type of movement that this Token is using */ movementAction: fields.StringField; /** @internal */ _movementHistory: fields.ArrayField< diff --git a/types/foundry/common/documents/user.d.mts b/types/foundry/common/documents/user.d.mts index 11f0658a167..f1f77744bf7 100644 --- a/types/foundry/common/documents/user.d.mts +++ b/types/foundry/common/documents/user.d.mts @@ -80,31 +80,31 @@ interface UserMetadata extends DocumentClassMetadata { } type UserSchema> = { - /** The _id which uniquely identifies this User document */ + /** The _id which uniquely identifies this User document. */ _id: fields.DocumentIdField; - /** The name of this User */ + /** The user's name. */ name: fields.StringField; - /** What role is assigned to this User, taken from CONST.USER_ROLE_NAMES */ + /** The user's role, see CONST.USER_ROLES. */ role: fields.NumberField; - /** The hashed password associated with this User */ + /** The user's password. Available only on the Server side for security. */ password: fields.StringField; - /** The salt used to hash the password for this USer */ + /** The user's password salt. Available only on the Server side for security. */ passwordSalt: fields.StringField; - /** An image file path used as the avatar for this User */ + /** The user's avatar image. */ avatar: fields.FilePathField; - /** The Actor that is currently set as this User's character */ + /** A linked Actor document that is this user's impersonated character. */ character: fields.ForeignDocumentField; - /** The color assigned to this User, used for various thing to indicate which user is doing something */ + /** A color to represent this user. */ color: fields.ColorField; - /** The pronouns of this User */ + /** The user's personal pronouns. */ pronouns: fields.StringField; - /** A record linking macros to hotbar slots for this User */ + /** A mapping of hotbar slot number to Macro id for the user. */ hotbar: fields.ObjectField>; - /** What permissions this User has, or doesn't have */ + /** The user's individual permission configuration, see CONST.USER_PERMISSIONS. */ permissions: fields.ObjectField>; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object containing document metadata */ + /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/wall.d.mts b/types/foundry/common/documents/wall.d.mts index c55daa8789c..1499cea4cdc 100644 --- a/types/foundry/common/documents/wall.d.mts +++ b/types/foundry/common/documents/wall.d.mts @@ -51,15 +51,15 @@ interface WallMetadata extends DocumentClassMetadata { } type WallSchema = { - /** The _id which uniquely identifies this Wall document */ + /** The _id which uniquely identifies the embedded Wall document */ _id: fields.DocumentIdField; - /** The wall coordinates, a length-4 array of finite numbers [x0, y0, x1, y1] */ + /** The wall coordinates, a length-4 array of finite numbers [x0,y0,x1,y1] */ c: fields.ArrayField< fields.NumberField, [number, number, number, number], [number, number, number, number] >; - /** An array of Levels that this Wall is on */ + /** The level IDs */ levels: fields.SceneLevelsSetField; /** The illumination restriction type of this wall */ light: fields.NumberField; @@ -75,20 +75,19 @@ type WallSchema = { door: fields.NumberField; /** The state of the door this wall contains, if any */ ds: fields.NumberField; - /** The sound that this door makes when opened/closed */ + /** The type of door sound to play, if any */ doorSound: fields.StringField; /** Configuration of threshold data for this wall */ threshold: fields.SchemaField<{ - /** Minimum distance from a light source for which this wall blocks light */ + /** Minimum distance in grid units from a light source for which this wall blocks light and darkness */ light: fields.NumberField; - /** Minimum distance from a vision source for which this wall blocks vision */ + /** Minimum distance in grid units from a vision source for which this wall blocks vision */ sight: fields.NumberField; - /** Minimum distance from a sound source for which this wall blocks sound */ + /** Minimum distance in grid units from a sound source for which this wall blocks sound */ sound: fields.NumberField; /** Whether to attenuate the source radius when passing through the wall */ attenuation: fields.BooleanField; }>; - /** Configuration of animation data for this wall */ animation: fields.SchemaField<{ direction: fields.NumberField<-1 | 1, -1 | 1, false, false, true>; double: fields.BooleanField; From 7d0d05015b058a368aad68bc57c3627c576102c4 Mon Sep 17 00:00:00 2001 From: 7H3LaughingMan <7H3LaughingMan@proton.me> Date: Mon, 4 May 2026 00:24:49 -0500 Subject: [PATCH 4/7] Minor Update --- types/foundry/common/documents/fog-exploration.d.mts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/foundry/common/documents/fog-exploration.d.mts b/types/foundry/common/documents/fog-exploration.d.mts index 8104cda6c69..296c0d6964d 100644 --- a/types/foundry/common/documents/fog-exploration.d.mts +++ b/types/foundry/common/documents/fog-exploration.d.mts @@ -47,7 +47,7 @@ type FogExplorationSchema = { user: fields.ForeignDocumentField; /** The _id of the Scene document to which this fog applies */ scene: fields.ForeignDocumentField; - /** The level ID */ + /** The _id of the Level document to which this fog applies */ level: fields.DocumentIdField; /** The base64 image/jpeg of the explored fog polygon */ explored: fields.FilePathField; From 33d1f2c0cfeee6e9798af95037fcea2b577a5007 Mon Sep 17 00:00:00 2001 From: 7H3LaughingMan <7H3LaughingMan@proton.me> Date: Mon, 4 May 2026 00:31:54 -0500 Subject: [PATCH 5/7] Forgot to update one thing --- types/foundry/common/documents/actor.d.mts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/foundry/common/documents/actor.d.mts b/types/foundry/common/documents/actor.d.mts index 5245f559487..3ad71d22620 100644 --- a/types/foundry/common/documents/actor.d.mts +++ b/types/foundry/common/documents/actor.d.mts @@ -100,7 +100,7 @@ type ActorSchema< img: fields.FilePathField; /** An Actor subtype which configures the system data model applied */ type: fields.DocumentTypeField; - /** They system data object which is defined by the system data model */ + /** Data for an Actor subtype, defined by a System or Modulel */ system: fields.TypeDataField; /** Default Token settings which are used for Tokens created from this Actor */ prototypeToken: fields.EmbeddedDataField>; From d8d8d4caa5923dafa90534289d2b9f36084639d6 Mon Sep 17 00:00:00 2001 From: 7H3LaughingMan <7H3LaughingMan@proton.me> Date: Mon, 4 May 2026 00:36:07 -0500 Subject: [PATCH 6/7] Another Small Fix --- types/foundry/common/documents/region.d.mts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/foundry/common/documents/region.d.mts b/types/foundry/common/documents/region.d.mts index 20f519727eb..61438c70dfe 100644 --- a/types/foundry/common/documents/region.d.mts +++ b/types/foundry/common/documents/region.d.mts @@ -98,7 +98,7 @@ type RegionSchema = { hidden: fields.BooleanField; /** Whether this region is locked or not */ locked: fields.BooleanField; - /** An object which configures ownership of this Playlist */ + /** An object which configures ownership of this Region */ ownership: fields.DocumentOwnershipField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; From dccced5153b8d1fb1b4daff45d63e1878daddd23 Mon Sep 17 00:00:00 2001 From: 7H3LaughingMan <7H3LaughingMan@proton.me> Date: Mon, 4 May 2026 08:03:42 -0500 Subject: [PATCH 7/7] Updates --- types/foundry/common/documents/active-effect.d.mts | 3 --- types/foundry/common/documents/actor.d.mts | 2 +- types/foundry/common/documents/adventure.d.mts | 1 - types/foundry/common/documents/ambient-light.d.mts | 2 -- types/foundry/common/documents/ambient-sound.d.mts | 6 ++++-- types/foundry/common/documents/card.d.mts | 1 - types/foundry/common/documents/chat-message.d.mts | 1 - types/foundry/common/documents/combatant.d.mts | 3 +-- types/foundry/common/documents/drawing.d.mts | 2 -- types/foundry/common/documents/fog-exploration.d.mts | 2 -- types/foundry/common/documents/note.d.mts | 3 --- types/foundry/common/documents/scene.d.mts | 10 +++++++--- types/foundry/common/documents/tile.d.mts | 1 - 13 files changed, 13 insertions(+), 24 deletions(-) diff --git a/types/foundry/common/documents/active-effect.d.mts b/types/foundry/common/documents/active-effect.d.mts index 23c1e0c9452..839feb4532b 100644 --- a/types/foundry/common/documents/active-effect.d.mts +++ b/types/foundry/common/documents/active-effect.d.mts @@ -86,13 +86,11 @@ type ActiveEffectSchema = { statuses: fields.SetField>; /** Should this ActiveEffect's image be prominently displayed as an icon alongside Tokens, Combatants, etc.? Defaults to a CONDITIONAL (1). */ showIcon: fields.NumberField; - /** The _id of a Folder which contains this ActiveEffect */ folder: fields.ForeignDocumentField; /** The sort value. Defaults to 0. */ sort: fields.IntegerSortField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; @@ -130,7 +128,6 @@ type EffectStartSchema = { export type EffectStartSource = fields.SourceFromSchema; interface EffectStartData extends fields.ModelPropsFromSchema { - /** The world time when the Effect first started */ value: number; } diff --git a/types/foundry/common/documents/actor.d.mts b/types/foundry/common/documents/actor.d.mts index 3ad71d22620..abc9318f3d5 100644 --- a/types/foundry/common/documents/actor.d.mts +++ b/types/foundry/common/documents/actor.d.mts @@ -100,7 +100,7 @@ type ActorSchema< img: fields.FilePathField; /** An Actor subtype which configures the system data model applied */ type: fields.DocumentTypeField; - /** Data for an Actor subtype, defined by a System or Modulel */ + /** Data for an Actor subtype, defined by a System or Module */ system: fields.TypeDataField; /** Default Token settings which are used for Tokens created from this Actor */ prototypeToken: fields.EmbeddedDataField>; diff --git a/types/foundry/common/documents/adventure.d.mts b/types/foundry/common/documents/adventure.d.mts index bcd759c225b..2f6d4a42a93 100644 --- a/types/foundry/common/documents/adventure.d.mts +++ b/types/foundry/common/documents/adventure.d.mts @@ -73,7 +73,6 @@ type AdventureSchema = { playlists: fields.SetField>; /** An array of included Folder documents */ folders: fields.SetField>; - /** The _id of a Folder which contains this Adventure */ folder: fields.ForeignDocumentField; /** The sort order of this adventure relative to its siblings */ sort: fields.IntegerSortField; diff --git a/types/foundry/common/documents/ambient-light.d.mts b/types/foundry/common/documents/ambient-light.d.mts index 2bd88d624af..f82f16ce7eb 100644 --- a/types/foundry/common/documents/ambient-light.d.mts +++ b/types/foundry/common/documents/ambient-light.d.mts @@ -51,7 +51,6 @@ export type AmbientLightSchema = { y: fields.NumberField; /** The elevation */ elevation: fields.NumberField; - /** The level IDs */ levels: fields.SceneLevelsSetField; /** The angle of rotation for the tile between 0 and 360 */ rotation: fields.AngleField; @@ -63,7 +62,6 @@ export type AmbientLightSchema = { config: fields.EmbeddedDataField>>; /** Is the light source currently hidden? */ hidden: fields.BooleanField; - /** Is the light source currently locked? */ locked: fields.BooleanField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; diff --git a/types/foundry/common/documents/ambient-sound.d.mts b/types/foundry/common/documents/ambient-sound.d.mts index 4c9531c206f..3947d3c7238 100644 --- a/types/foundry/common/documents/ambient-sound.d.mts +++ b/types/foundry/common/documents/ambient-sound.d.mts @@ -54,7 +54,6 @@ type AmbientSoundSchema = { y: fields.NumberField; /** The elevation */ elevation: fields.NumberField; - /** The level IDs */ levels: fields.SceneLevelsSetField; /** The radius of the emitted sound. */ radius: fields.NumberField; @@ -70,7 +69,6 @@ type AmbientSoundSchema = { easing: fields.BooleanField; /** Is the sound source currently hidden? False by default. */ hidden: fields.BooleanField; - /** Is the sound source currently locked? */ locked: fields.BooleanField; /** A darkness range (min and max) for which the source should be active */ darkness: fields.SchemaField<{ @@ -80,11 +78,15 @@ type AmbientSoundSchema = { /** Special effects to apply to the sound */ effects: fields.SchemaField<{ base: fields.SchemaField<{ + /** The type of effect in CONFIG.soundEffects */ type: fields.StringField; + /** The intensity of the effect on the scale of [1, 10] */ intensity: fields.NumberField; }>; muffled: fields.SchemaField<{ + /** The type of effect in CONFIG.soundEffects */ type: fields.StringField; + /** The intensity of the effect on the scale of [1, 10] */ intensity: fields.NumberField; }>; }>; diff --git a/types/foundry/common/documents/card.d.mts b/types/foundry/common/documents/card.d.mts index 904b7957e5c..a9d33a54ec1 100644 --- a/types/foundry/common/documents/card.d.mts +++ b/types/foundry/common/documents/card.d.mts @@ -77,7 +77,6 @@ type CardSchema = { sort: fields.IntegerSortField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/chat-message.d.mts b/types/foundry/common/documents/chat-message.d.mts index f960690f81c..afcdfa1fca6 100644 --- a/types/foundry/common/documents/chat-message.d.mts +++ b/types/foundry/common/documents/chat-message.d.mts @@ -51,7 +51,6 @@ declare type ChatMessageSchema = { system: fields.TypeDataField; /** The message style from CONST.CHAT_MESSAGE_STYLES */ style: fields.NumberField; - /** The _id of the User document who generated this message */ author: fields.ForeignDocumentField; /** The timestamp at which point this message was generated */ timestamp: fields.NumberField; diff --git a/types/foundry/common/documents/combatant.d.mts b/types/foundry/common/documents/combatant.d.mts index 560e8d4bef7..2eb2c15e0ec 100644 --- a/types/foundry/common/documents/combatant.d.mts +++ b/types/foundry/common/documents/combatant.d.mts @@ -50,7 +50,6 @@ type CombatantSchema = { actorId: fields.ForeignDocumentField; /** The _id of a Token associated with this Combatant */ tokenId: fields.ForeignDocumentField; - /** The _id of a Scene associated with this Combatant */ sceneId: fields.ForeignDocumentField; /** A customized name which replaces the name of the Token in the tracker */ name: fields.StringField; @@ -64,7 +63,7 @@ type CombatantSchema = { defeated: fields.BooleanField; /** An optional group this Combatant belongs to. */ group: fields.DocumentIdField; - /** he round this Combatant joined Combat (i.e., was created). A Combatant created before the Combat starts is considered to have joined in round 1. */ + /** The round this Combatant joined Combat (i.e., was created). A Combatant created before the Combat starts is considered to have joined in round 1. */ roundJoined: fields.NumberField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; diff --git a/types/foundry/common/documents/drawing.d.mts b/types/foundry/common/documents/drawing.d.mts index c51f38588e9..0afa2f46396 100644 --- a/types/foundry/common/documents/drawing.d.mts +++ b/types/foundry/common/documents/drawing.d.mts @@ -61,7 +61,6 @@ type DrawingSchema = { y: fields.NumberField; /** The elevation of the drawing */ elevation: fields.NumberField; - /** The level IDs */ levels: fields.SceneLevelsSetField; /** The z-index of this drawing relative to other siblings */ sort: fields.NumberField; @@ -97,7 +96,6 @@ type DrawingSchema = { hidden: fields.BooleanField; /** Is the drawing currently locked? */ locked: fields.BooleanField; - /** Is the drawing rendered in the interface group? */ interface: fields.BooleanField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; diff --git a/types/foundry/common/documents/fog-exploration.d.mts b/types/foundry/common/documents/fog-exploration.d.mts index 296c0d6964d..67354d6218e 100644 --- a/types/foundry/common/documents/fog-exploration.d.mts +++ b/types/foundry/common/documents/fog-exploration.d.mts @@ -47,7 +47,6 @@ type FogExplorationSchema = { user: fields.ForeignDocumentField; /** The _id of the Scene document to which this fog applies */ scene: fields.ForeignDocumentField; - /** The _id of the Level document to which this fog applies */ level: fields.DocumentIdField; /** The base64 image/jpeg of the explored fog polygon */ explored: fields.FilePathField; @@ -57,7 +56,6 @@ type FogExplorationSchema = { timestamp: fields.NumberField; /** An object of optional key/value flags */ flags: fields.DocumentFlagsField; - /** An object of creation and access information */ _stats: fields.DocumentStatsField; }; diff --git a/types/foundry/common/documents/note.d.mts b/types/foundry/common/documents/note.d.mts index d4e1b5dac0c..6e1dd8d4155 100644 --- a/types/foundry/common/documents/note.d.mts +++ b/types/foundry/common/documents/note.d.mts @@ -49,7 +49,6 @@ interface NoteMetadata extends DocumentClassMetadata { type NoteSchema = { /** The _id which uniquely identifies this BaseNote embedded document */ _id: fields.DocumentIdField; - /** The _id of a User document which created this Note */ author: fields.DocumentAuthorField; /** The _id of a JournalEntry document which this Note represents */ entryId: fields.ForeignDocumentField; @@ -61,11 +60,9 @@ type NoteSchema = { y: fields.NumberField; /** The elevation */ elevation: fields.NumberField; - /** The level IDs */ levels: fields.SceneLevelsSetField; /** The sort order */ sort: fields.NumberField; - /** Is this Note currently locked? */ locked: fields.BooleanField; /** An image icon used to represent this note */ texture: data.TextureData; diff --git a/types/foundry/common/documents/scene.d.mts b/types/foundry/common/documents/scene.d.mts index a0d2c5b0c49..7547c87b15e 100644 --- a/types/foundry/common/documents/scene.d.mts +++ b/types/foundry/common/documents/scene.d.mts @@ -138,7 +138,6 @@ type SceneSchema = { drawings: fields.EmbeddedCollectionField>; /** A collection of embedded Token objects. */ tokens: fields.EmbeddedCollectionField>; - /** A collection of embedded Level objects */ levels: fields.EmbeddedCollectionField>; /** A collection of embedded AmbientLight object */ lights: fields.EmbeddedCollectionField>; @@ -166,9 +165,9 @@ type SceneSchema = { weather: fields.StringField; // Permissions - /** The _id of a Folder which contains this Scene */ + /** The _id of a Folder which contains this Actor */ folder: fields.ForeignDocumentField; - /** The numeric sort value which orders this Scene relative to its siblings */ + /** The numeric sort value which orders this Actor relative to its siblings */ sort: fields.IntegerSortField; /** An object which configures ownership of this Scene */ ownership: fields.DocumentOwnershipField; @@ -248,10 +247,15 @@ type EnvironmentSchema = { }; type EnvironmentDataSchema = { + /** The normalized hue angle. */ hue: fields.HueField; + /** The intensity of the tinting (0 = no tinting). */ intensity: fields.AlphaField; + /** The luminosity. */ luminosity: fields.NumberField; + /** The saturation. */ saturation: fields.NumberField; + /** The strength of the shadows. */ shadows: fields.NumberField; }; diff --git a/types/foundry/common/documents/tile.d.mts b/types/foundry/common/documents/tile.d.mts index 2b7e38218ca..0938e92f521 100644 --- a/types/foundry/common/documents/tile.d.mts +++ b/types/foundry/common/documents/tile.d.mts @@ -58,7 +58,6 @@ type TileSchema = { y: fields.NumberField; /** The elevation of the tile */ elevation: fields.NumberField; - /** The level IDs */ levels: fields.SceneLevelsSetField; /** The z-index ordering of this tile relative to its siblings */ sort: fields.NumberField;