@league-of-foundry-developers/foundry-vtt-types 0.8.9-9 → 9.238.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/README.md +44 -27
  2. package/index.d.ts +2 -2
  3. package/package.json +34 -15
  4. package/src/foundry/common/abstract/document.mjs.d.ts +24 -10
  5. package/src/foundry/common/config.mjs/index.d.ts +1 -0
  6. package/src/foundry/common/config.mjs/releaseData.d.ts +98 -0
  7. package/src/foundry/common/constants.mjs.d.ts +402 -213
  8. package/src/foundry/common/data/data.mjs/activeEffectData.d.ts +36 -29
  9. package/src/foundry/common/data/data.mjs/actorData.d.ts +32 -21
  10. package/src/foundry/common/data/data.mjs/adventureData.d.ts +165 -0
  11. package/src/foundry/common/data/data.mjs/ambientLightData.d.ts +45 -124
  12. package/src/foundry/common/data/data.mjs/ambientSoundData.d.ts +49 -77
  13. package/src/foundry/common/data/data.mjs/animationData.d.ts +17 -9
  14. package/src/foundry/common/data/data.mjs/cardData.d.ts +265 -0
  15. package/src/foundry/common/data/data.mjs/cardFaceData.d.ts +66 -0
  16. package/src/foundry/common/data/data.mjs/cardsData.d.ts +238 -0
  17. package/src/foundry/common/data/data.mjs/chatMessageData.d.ts +51 -39
  18. package/src/foundry/common/data/data.mjs/chatSpeakerData.d.ts +18 -11
  19. package/src/foundry/common/data/data.mjs/combatData.d.ts +51 -25
  20. package/src/foundry/common/data/data.mjs/combatantData.d.ts +48 -30
  21. package/src/foundry/common/data/data.mjs/darknessActivation.d.ts +8 -7
  22. package/src/foundry/common/data/data.mjs/drawingData.d.ts +68 -67
  23. package/src/foundry/common/data/data.mjs/effectChangeData.d.ts +21 -25
  24. package/src/foundry/common/data/data.mjs/effectDurationData.d.ts +24 -23
  25. package/src/foundry/common/data/data.mjs/fogExplorationData.d.ts +23 -16
  26. package/src/foundry/common/data/data.mjs/folderData.d.ts +28 -25
  27. package/src/foundry/common/data/data.mjs/index.d.ts +5 -0
  28. package/src/foundry/common/data/data.mjs/itemData.d.ts +26 -18
  29. package/src/foundry/common/data/data.mjs/journalEntryData.d.ts +21 -20
  30. package/src/foundry/common/data/data.mjs/lightData.d.ts +228 -0
  31. package/src/foundry/common/data/data.mjs/macroData.d.ts +52 -35
  32. package/src/foundry/common/data/data.mjs/measuredTemplateData.d.ts +41 -38
  33. package/src/foundry/common/data/data.mjs/noteData.d.ts +47 -37
  34. package/src/foundry/common/data/data.mjs/playlistData.d.ts +55 -26
  35. package/src/foundry/common/data/data.mjs/playlistSoundData.d.ts +32 -16
  36. package/src/foundry/common/data/data.mjs/prototypeTokenData.d.ts +7 -11
  37. package/src/foundry/common/data/data.mjs/rollTableData.d.ts +30 -24
  38. package/src/foundry/common/data/data.mjs/sceneData.d.ts +132 -111
  39. package/src/foundry/common/data/data.mjs/settingData.d.ts +11 -8
  40. package/src/foundry/common/data/data.mjs/tableResultData.d.ts +30 -26
  41. package/src/foundry/common/data/data.mjs/tileData.d.ts +43 -36
  42. package/src/foundry/common/data/data.mjs/tileOcclusion.d.ts +10 -9
  43. package/src/foundry/common/data/data.mjs/tokenBarData.d.ts +6 -3
  44. package/src/foundry/common/data/data.mjs/tokenData.d.ts +105 -157
  45. package/src/foundry/common/data/data.mjs/userData.d.ts +111 -33
  46. package/src/foundry/common/data/data.mjs/videoData.d.ts +9 -8
  47. package/src/foundry/common/data/data.mjs/wallData.d.ts +67 -39
  48. package/src/foundry/common/data/fields.mjs.d.ts +180 -83
  49. package/src/foundry/common/documents.mjs/baseActiveEffect.d.ts +9 -3
  50. package/src/foundry/common/documents.mjs/baseActor.d.ts +17 -45
  51. package/src/foundry/common/documents.mjs/baseAdventure.d.ts +38 -0
  52. package/src/foundry/common/documents.mjs/baseAmbientLight.d.ts +3 -0
  53. package/src/foundry/common/documents.mjs/baseAmbientSound.d.ts +3 -1
  54. package/src/foundry/common/documents.mjs/baseCard.d.ts +62 -0
  55. package/src/foundry/common/documents.mjs/baseCards.d.ts +39 -0
  56. package/src/foundry/common/documents.mjs/baseChatMessage.d.ts +3 -0
  57. package/src/foundry/common/documents.mjs/baseCombat.d.ts +5 -2
  58. package/src/foundry/common/documents.mjs/baseCombatant.d.ts +10 -1
  59. package/src/foundry/common/documents.mjs/baseDrawing.d.ts +11 -1
  60. package/src/foundry/common/documents.mjs/baseFogExploration.d.ts +4 -3
  61. package/src/foundry/common/documents.mjs/baseFolder.d.ts +10 -1
  62. package/src/foundry/common/documents.mjs/baseItem.d.ts +11 -29
  63. package/src/foundry/common/documents.mjs/baseJournalEntry.d.ts +3 -0
  64. package/src/foundry/common/documents.mjs/baseMacro.d.ts +16 -14
  65. package/src/foundry/common/documents.mjs/baseMeasuredTemplate.d.ts +4 -1
  66. package/src/foundry/common/documents.mjs/baseNote.d.ts +2 -2
  67. package/src/foundry/common/documents.mjs/basePlaylist.d.ts +1 -0
  68. package/src/foundry/common/documents.mjs/basePlaylistSound.d.ts +2 -1
  69. package/src/foundry/common/documents.mjs/baseRollTable.d.ts +3 -0
  70. package/src/foundry/common/documents.mjs/baseScene.d.ts +1 -0
  71. package/src/foundry/common/documents.mjs/baseSetting.d.ts +1 -0
  72. package/src/foundry/common/documents.mjs/baseTableResult.d.ts +10 -3
  73. package/src/foundry/common/documents.mjs/baseTile.d.ts +1 -0
  74. package/src/foundry/common/documents.mjs/baseToken.d.ts +3 -0
  75. package/src/foundry/common/documents.mjs/baseUser.d.ts +7 -1
  76. package/src/foundry/common/documents.mjs/baseWall.d.ts +7 -10
  77. package/src/foundry/common/documents.mjs/index.d.ts +3 -0
  78. package/src/foundry/common/module.mjs.d.ts +3 -0
  79. package/src/foundry/common/packages.mjs/moduleData.d.ts +12 -9
  80. package/src/foundry/common/packages.mjs/packageAuthorData.d.ts +24 -24
  81. package/src/foundry/common/packages.mjs/packageCompendiumData.d.ts +27 -21
  82. package/src/foundry/common/packages.mjs/packageData.d.ts +108 -82
  83. package/src/foundry/common/packages.mjs/packageDependencyData.d.ts +18 -11
  84. package/src/foundry/common/packages.mjs/packageLanguageData.d.ts +16 -15
  85. package/src/foundry/common/packages.mjs/systemData.d.ts +21 -20
  86. package/src/foundry/common/packages.mjs/tagPackageAvailability.d.ts +3 -3
  87. package/src/foundry/common/packages.mjs/worldData.d.ts +29 -18
  88. package/src/foundry/common/types.mjs.d.ts +95 -0
  89. package/src/foundry/common/utils/helpers.mjs.d.ts +27 -2
  90. package/src/foundry/common/utils/primitives.mjs.d.ts +99 -16
  91. package/src/foundry/foundry.js/application.d.ts +2 -2
  92. package/src/foundry/foundry.js/applications/filePicker.d.ts +1 -1
  93. package/src/foundry/foundry.js/applications/formApplication.d.ts +1 -1
  94. package/src/foundry/foundry.js/applications/formApplications/documentSheet.d.ts +1 -1
  95. package/src/foundry/foundry.js/applications/formApplications/documentSheets/activeEffectConfig.d.ts +1 -1
  96. package/src/foundry/foundry.js/applications/formApplications/documentSheets/actorSheet.d.ts +1 -1
  97. package/src/foundry/foundry.js/applications/formApplications/documentSheets/ambientLightConfig.d.ts +104 -0
  98. package/src/foundry/foundry.js/applications/formApplications/documentSheets/ambientSoundConfig.d.ts +1 -1
  99. package/src/foundry/foundry.js/applications/formApplications/documentSheets/folderConfig.d.ts +1 -1
  100. package/src/foundry/foundry.js/applications/formApplications/documentSheets/index.d.ts +1 -0
  101. package/src/foundry/foundry.js/applications/formApplications/documentSheets/lightConfig.d.ts +5 -79
  102. package/src/foundry/foundry.js/applications/formApplications/documentSheets/measuredTemplateConfig.d.ts +1 -1
  103. package/src/foundry/foundry.js/applications/formApplications/documentSheets/noteConfig.d.ts +2 -2
  104. package/src/foundry/foundry.js/applications/formApplications/documentSheets/permissionControl.d.ts +5 -5
  105. package/src/foundry/foundry.js/applications/formApplications/documentSheets/playlistConfig.d.ts +1 -1
  106. package/src/foundry/foundry.js/applications/formApplications/documentSheets/rollTableConfig.d.ts +5 -8
  107. package/src/foundry/foundry.js/applications/formApplications/documentSheets/sceneConfig.d.ts +3 -3
  108. package/src/foundry/foundry.js/applications/formApplications/documentSheets/tileConfig.d.ts +1 -1
  109. package/src/foundry/foundry.js/applications/formApplications/drawingConfig.d.ts +1 -1
  110. package/src/foundry/foundry.js/applications/formApplications/gridConfig.d.ts +1 -1
  111. package/src/foundry/foundry.js/applications/formApplications/imagePopout.d.ts +1 -1
  112. package/src/foundry/foundry.js/applications/formApplications/index.d.ts +1 -0
  113. package/src/foundry/foundry.js/applications/formApplications/keybindingsConfig.d.ts +257 -0
  114. package/src/foundry/foundry.js/applications/formApplications/tokenConfig.d.ts +8 -9
  115. package/src/foundry/foundry.js/applications/formApplications/wallConfig.d.ts +6 -6
  116. package/src/foundry/foundry.js/applications/sidebarTab.d.ts +1 -1
  117. package/src/foundry/foundry.js/applications/sidebarTabs/chatLog.d.ts +7 -6
  118. package/src/foundry/foundry.js/applications/sidebarTabs/compendiumDirectory.d.ts +2 -2
  119. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/cardsDirectory.d.ts +7 -0
  120. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/index.d.ts +1 -0
  121. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectories/playlistDirectory.d.ts +2 -2
  122. package/src/foundry/foundry.js/applications/sidebarTabs/sidebarDirectory.d.ts +2 -2
  123. package/src/foundry/foundry.js/avSettings.d.ts +7 -7
  124. package/src/foundry/foundry.js/canvas.d.ts +148 -46
  125. package/src/foundry/foundry.js/canvasAnimation.d.ts +1 -1
  126. package/src/foundry/foundry.js/canvasDocumentMixin.d.ts +7 -0
  127. package/src/foundry/foundry.js/clientDocumentMixin.d.ts +45 -91
  128. package/src/foundry/foundry.js/clientDocuments/activeEffect.d.ts +3 -2
  129. package/src/foundry/foundry.js/clientDocuments/actor.d.ts +3 -7
  130. package/src/foundry/foundry.js/clientDocuments/canvasDocuments/ambientSoundDocument.d.ts +1 -6
  131. package/src/foundry/foundry.js/clientDocuments/card.d.ts +133 -0
  132. package/src/foundry/foundry.js/clientDocuments/cards.d.ts +384 -0
  133. package/src/foundry/foundry.js/clientDocuments/chatMessage.d.ts +11 -10
  134. package/src/foundry/foundry.js/clientDocuments/combat.d.ts +4 -8
  135. package/src/foundry/foundry.js/clientDocuments/combatant.d.ts +1 -1
  136. package/src/foundry/foundry.js/clientDocuments/folder.d.ts +4 -6
  137. package/src/foundry/foundry.js/clientDocuments/index.d.ts +2 -0
  138. package/src/foundry/foundry.js/clientDocuments/item.d.ts +3 -4
  139. package/src/foundry/foundry.js/clientDocuments/playlist.d.ts +4 -3
  140. package/src/foundry/foundry.js/clientDocuments/rollTable.d.ts +1 -1
  141. package/src/foundry/foundry.js/clientDocuments/scene.d.ts +30 -23
  142. package/src/foundry/foundry.js/clientKeybindings.d.ts +299 -0
  143. package/src/foundry/foundry.js/clientSettings.d.ts +11 -9
  144. package/src/foundry/foundry.js/collections/documentCollections/compendiumCollection.d.ts +1 -1
  145. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/cardStacks.d.ts +9 -0
  146. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/index.d.ts +1 -0
  147. package/src/foundry/foundry.js/collections/documentCollections/worldCollections/playlists.d.ts +3 -2
  148. package/src/foundry/foundry.js/config.d.ts +465 -887
  149. package/src/foundry/foundry.js/game.d.ts +86 -11
  150. package/src/foundry/foundry.js/gamepadManager.d.ts +41 -0
  151. package/src/foundry/foundry.js/handlebarsHelpers.d.ts +4 -4
  152. package/src/foundry/foundry.js/hooks.d.ts +57 -0
  153. package/src/foundry/foundry.js/keyboardManager.d.ts +165 -213
  154. package/src/foundry/foundry.js/mouseManager.d.ts +18 -0
  155. package/src/foundry/foundry.js/newUserExperience.d.ts +34 -0
  156. package/src/foundry/foundry.js/pixi/containers/cachedContainer.d.ts +8 -0
  157. package/src/foundry/foundry.js/pixi/containers/cachedContainers/index.d.ts +1 -0
  158. package/src/foundry/foundry.js/pixi/containers/cachedContainers/primaryCanvasGroup.d.ts +42 -0
  159. package/src/foundry/foundry.js/pixi/containers/canvasLayers/gridLayer.d.ts +2 -2
  160. package/src/foundry/foundry.js/pixi/containers/canvasLayers/index.d.ts +1 -1
  161. package/src/foundry/foundry.js/pixi/containers/canvasLayers/placeablesLayers/wallsLayer.d.ts +3 -3
  162. package/src/foundry/foundry.js/pixi/containers/canvasLayers/{effectsLayer.d.ts → weatherLayer.d.ts} +7 -7
  163. package/src/foundry/foundry.js/pixi/containers/effectsCanvasGroup.d.ts +29 -0
  164. package/src/foundry/foundry.js/pixi/containers/index.d.ts +3 -0
  165. package/src/foundry/foundry.js/pixi/containers/interfaceCanvasGroup.d.ts +27 -0
  166. package/src/foundry/foundry.js/pixi/containers/placeableObjects/token.d.ts +1 -1
  167. package/src/foundry/foundry.js/pointSource.d.ts +2 -2
  168. package/src/foundry/foundry.js/roll.d.ts +25 -36
  169. package/src/foundry/foundry.js/rollTerm.d.ts +7 -4
  170. package/src/foundry/foundry.js/rollTerms/diceTerm.d.ts +4 -22
  171. package/src/foundry/foundry.js/rollTerms/mathTerm.d.ts +3 -0
  172. package/src/foundry/foundry.js/rollTerms/parentheticalTerm.d.ts +3 -0
  173. package/src/foundry/foundry.js/rollTerms/poolTerm.d.ts +3 -5
  174. package/src/foundry/foundry.js/rollTerms/stringTerm.d.ts +4 -1
  175. package/src/foundry/foundry.js/searchFilter.d.ts +1 -1
  176. package/src/foundry/foundry.js/textEditor.d.ts +1 -1
  177. package/src/foundry/index.d.ts +4 -0
  178. package/src/types/utils.d.ts +11 -3
@@ -6,24 +6,24 @@ import { EffectChangeData, EffectChangeDataConstructorData } from './effectChang
6
6
  import { EffectDurationData, EffectDurationDataConstructorData } from './effectDurationData';
7
7
 
8
8
  interface ActiveEffectDataSchema extends DocumentSchema {
9
- _id: typeof fields.DOCUMENT_ID;
9
+ _id: fields.DocumentId;
10
10
  changes: DocumentField<EffectChangeData[]> & {
11
- default: [];
12
- required: true;
13
11
  type: [typeof EffectChangeData];
12
+ required: true;
13
+ default: [];
14
14
  };
15
- disabled: typeof fields.BOOLEAN_FIELD;
15
+ disabled: fields.BooleanField;
16
16
  duration: DocumentField<EffectDurationData> & {
17
- default: {};
18
- required: true;
19
17
  type: typeof EffectDurationData;
18
+ required: true;
19
+ default: Record<string, never>;
20
20
  };
21
- icon: typeof fields.IMAGE_FIELD;
22
- label: typeof fields.BLANK_STRING;
23
- origin: typeof fields.STRING_FIELD;
24
- tint: typeof fields.COLOR_FIELD;
25
- transfer: FieldReturnType<typeof fields.BOOLEAN_FIELD, { default: true }>;
26
- flags: typeof fields.OBJECT_FIELD; // TODO: add more concrete object type
21
+ icon: fields.ImageField;
22
+ label: fields.BlankString;
23
+ origin: fields.StringField;
24
+ tint: fields.ColorField;
25
+ transfer: FieldReturnType<fields.BooleanField, { default: true }>;
26
+ flags: fields.ObjectField;
27
27
  }
28
28
 
29
29
  interface CoreFlags {
@@ -33,11 +33,13 @@ interface CoreFlags {
33
33
  interface ActiveEffectDataProperties {
34
34
  /**
35
35
  * The _id which uniquely identifies the ActiveEffect within a parent Actor or Item
36
+ * @defaultValue `null`
36
37
  */
37
38
  _id: string | null;
38
39
 
39
40
  /**
40
41
  * The array of EffectChangeData objects which the ActiveEffect applies
42
+ * @defaultValue `[]`
41
43
  */
42
44
  changes: EffectChangeData[];
43
45
 
@@ -49,29 +51,30 @@ interface ActiveEffectDataProperties {
49
51
 
50
52
  /**
51
53
  * An EffectDurationData object which describes the duration of the ActiveEffect
54
+ * @defaultValue `new EffectDurationData({})`
52
55
  */
53
56
  duration: EffectDurationData;
54
57
 
55
58
  /**
56
59
  * An icon image path used to depict the ActiveEffect
57
60
  */
58
- icon?: string | null;
61
+ icon: string | null | undefined;
59
62
 
60
63
  /**
61
64
  * A text label which describes the name of the ActiveEffect
62
- * @defaultValue `''`
65
+ * @defaultValue `""`
63
66
  */
64
67
  label: string;
65
68
 
66
69
  /**
67
70
  * A UUID reference to the document from which this ActiveEffect originated
68
71
  */
69
- origin?: string;
72
+ origin: string | undefined;
70
73
 
71
74
  /**
72
75
  * A color string which applies a tint to the ActiveEffect icon
73
76
  */
74
- tint?: string | null;
77
+ tint: string | null | undefined;
75
78
 
76
79
  /**
77
80
  * Does this ActiveEffect automatically transfer from an Item to an Actor?
@@ -89,72 +92,76 @@ interface ActiveEffectDataProperties {
89
92
  interface ActiveEffectDataConstructorData {
90
93
  /**
91
94
  * The _id which uniquely identifies the ActiveEffect within a parent Actor or Item
95
+ * @defaultValue `null`
92
96
  */
93
- _id?: string | null;
97
+ _id?: string | null | undefined;
94
98
 
95
99
  /**
96
100
  * The array of EffectChangeData objects which the ActiveEffect applies
101
+ * @defaultValue `[]`
97
102
  */
98
- changes?: EffectChangeDataConstructorData[] | null;
103
+ changes?: EffectChangeDataConstructorData[] | null | undefined;
99
104
 
100
105
  /**
101
106
  * Is this ActiveEffect currently disabled?
102
107
  * @defaultValue `false`
103
108
  */
104
- disabled?: boolean | null;
109
+ disabled?: boolean | null | undefined;
105
110
 
106
111
  /**
107
112
  * An EffectDurationData object which describes the duration of the ActiveEffect
113
+ * @defaultValue `new EffectDurationData({})`
108
114
  */
109
- duration?: EffectDurationDataConstructorData | null;
115
+ duration?: EffectDurationDataConstructorData | null | undefined;
110
116
 
111
117
  /**
112
118
  * An icon image path used to depict the ActiveEffect
113
119
  */
114
- icon?: string | null;
120
+ icon?: string | null | undefined;
115
121
 
116
122
  /**
117
123
  * A text label which describes the name of the ActiveEffect
118
- * @defaultValue `''`
124
+ * @defaultValue `""`
119
125
  */
120
- label?: string | null;
126
+ label?: string | null | undefined;
121
127
 
122
128
  /**
123
129
  * A UUID reference to the document from which this ActiveEffect originated
124
130
  */
125
- origin?: string | null;
131
+ origin?: string | null | undefined;
126
132
 
127
133
  /**
128
134
  * A color string which applies a tint to the ActiveEffect icon
129
135
  */
130
- tint?: string | null;
136
+ tint?: string | null | undefined;
131
137
 
132
138
  /**
133
139
  * Does this ActiveEffect automatically transfer from an Item to an Actor?
134
140
  * @defaultValue `true`
135
141
  */
136
- transfer?: boolean | null;
142
+ transfer?: boolean | null | undefined;
137
143
 
138
144
  /**
139
145
  * An object of optional key/value flags
140
146
  * @defaultValue `{}`
141
147
  */
142
- flags?: (ConfiguredFlags<'ActiveEffect'> & CoreFlags) | null;
148
+ flags?: (ConfiguredFlags<'ActiveEffect'> & CoreFlags) | null | undefined;
143
149
  }
144
150
 
145
151
  /**
146
152
  * The data schema for an ActiveEffect document.
147
153
  * @see BaseActiveEffect
148
154
  */
149
- export declare class ActiveEffectData extends DocumentData<
155
+ export class ActiveEffectData extends DocumentData<
150
156
  ActiveEffectDataSchema,
151
157
  ActiveEffectDataProperties,
152
158
  PropertiesToSource<ActiveEffectDataProperties>,
153
159
  ActiveEffectDataConstructorData,
154
160
  documents.BaseActiveEffect
155
161
  > {
162
+ /** @override */
156
163
  static defineSchema(): ActiveEffectDataSchema;
157
164
  }
158
165
 
159
166
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
160
- export declare interface ActiveEffectData extends ActiveEffectDataProperties {}
167
+ export interface ActiveEffectData extends ActiveEffectDataProperties {}
@@ -1,4 +1,3 @@
1
- import EmbeddedCollection from '../../abstract/embedded-collection.mjs';
2
1
  import {
3
2
  ConfiguredData,
4
3
  ConfiguredDocumentClass,
@@ -7,23 +6,24 @@ import {
7
6
  FieldReturnType,
8
7
  PropertiesToSource
9
8
  } from '../../../../types/helperTypes';
9
+ import EmbeddedCollection from '../../abstract/embedded-collection.mjs';
10
10
  import { DocumentData } from '../../abstract/module.mjs';
11
11
  import * as documents from '../../documents.mjs';
12
- import * as fields from '../fields.mjs';
13
12
  import { PrototypeTokenData } from '../data.mjs';
13
+ import * as fields from '../fields.mjs';
14
14
  import { PrototypeTokenDataConstructorData } from './prototypeTokenData.js';
15
15
 
16
16
  interface ActorDataSchema extends DocumentSchema {
17
- _id: typeof fields.DOCUMENT_ID;
18
- name: typeof fields.REQUIRED_STRING;
17
+ _id: fields.DocumentId;
18
+ name: fields.RequiredString;
19
19
  type: DocumentField<string> & {
20
20
  type: typeof String;
21
21
  required: true;
22
22
  validate: (t: unknown) => boolean;
23
23
  validationError: 'The provided Actor type must be in the array of types defined by the game system';
24
24
  };
25
- img: FieldReturnType<typeof fields.IMAGE_FIELD, { default: () => string }>;
26
- data: FieldReturnType<typeof fields.OBJECT_FIELD, { default: (data: { type: string }) => any }>; // TODO
25
+ img: FieldReturnType<fields.ImageField, { default: () => string }>;
26
+ data: fields.SystemDataField;
27
27
  token: DocumentField<PrototypeTokenData> & {
28
28
  type: typeof PrototypeTokenData;
29
29
  required: true;
@@ -32,9 +32,9 @@ interface ActorDataSchema extends DocumentSchema {
32
32
  items: fields.EmbeddedCollectionField<typeof documents.BaseItem>;
33
33
  effects: fields.EmbeddedCollectionField<typeof documents.BaseActiveEffect>;
34
34
  folder: fields.ForeignDocumentField<{ type: typeof documents.BaseFolder }>;
35
- sort: typeof fields.INTEGER_SORT_FIELD;
36
- permission: typeof fields.DOCUMENT_PERMISSIONS;
37
- flags: typeof fields.OBJECT_FIELD;
35
+ sort: fields.IntegerSortField;
36
+ permission: fields.DocumentPermissions;
37
+ flags: fields.ObjectField;
38
38
  }
39
39
 
40
40
  interface ActorDataBaseProperties {
@@ -62,21 +62,25 @@ interface ActorDataBaseProperties {
62
62
 
63
63
  /**
64
64
  * The system data object which is defined by the system template.json model
65
+ * @defaultValue template from template.json for type or `{}`
65
66
  */
66
67
  data: object;
67
68
 
68
69
  /**
69
70
  * Default Token settings which are used for Tokens created from this Actor
71
+ * @defaultValue `new PrototypeTokenData({ this.data.name, this.data.img })`
70
72
  */
71
73
  token: PrototypeTokenData;
72
74
 
73
75
  /**
74
76
  * A Collection of Item embedded Documents
77
+ * @defaultValue `new EmbeddedCollection(ItemData, [], BaseItem.implementation)`
75
78
  */
76
79
  items: EmbeddedCollection<ConfiguredDocumentClass<typeof documents.BaseItem>, ActorData>;
77
80
 
78
81
  /**
79
82
  * A collection of ActiveEffect embedded Documents
83
+ * @defaultValue `new EmbeddedCollection(ActiveEffectData, [], BaseActiveEffect.implementation)`
80
84
  */
81
85
  effects: EmbeddedCollection<ConfiguredDocumentClass<typeof documents.BaseActiveEffect>, ActorData>;
82
86
 
@@ -96,7 +100,7 @@ interface ActorDataBaseProperties {
96
100
  * An object which configures user permissions to this Actor
97
101
  * @defaultValue `{ default: CONST.ENTITY_PERMISSIONS.NONE }`
98
102
  */
99
- permission: Partial<Record<string, foundry.CONST.EntityPermission>>;
103
+ permission: Partial<Record<string, foundry.CONST.DOCUMENT_PERMISSION_LEVELS>>;
100
104
 
101
105
  /**
102
106
  * An object of optional key/value flags
@@ -110,7 +114,7 @@ interface ActorDataConstructorData {
110
114
  * The _id which uniquely identifies this Actor document
111
115
  * @defaultValue `null`
112
116
  */
113
- _id?: string | null;
117
+ _id?: string | null | undefined;
114
118
 
115
119
  /**
116
120
  * The name of this Actor
@@ -126,51 +130,55 @@ interface ActorDataConstructorData {
126
130
  * An image file path which provides the artwork for this Actor
127
131
  * @defaultValue `ActorDataConstructor.DEFAULT_ICON`
128
132
  */
129
- img?: string | null;
133
+ img?: string | null | undefined;
130
134
 
131
135
  /**
132
136
  * The system data object which is defined by the system template.json model
137
+ * @defaultValue template from template.json for type or `{}`
133
138
  */
134
- data?: DeepPartial<ActorDataSource['data']> | null;
139
+ data?: DeepPartial<ActorDataSource['data']> | null | undefined;
135
140
 
136
141
  /**
137
142
  * Default Token settings which are used for Tokens created from this Actor
143
+ * @defaultValue `new PrototypeTokenData({ this.data.name, this.data.img })`
138
144
  */
139
- token?: PrototypeTokenDataConstructorData | null;
145
+ token?: PrototypeTokenDataConstructorData | null | undefined;
140
146
 
141
147
  /**
142
148
  * A Collection of Item embedded Documents
149
+ * @defaultValue `new EmbeddedCollection(ItemData, [], BaseItem.implementation)`
143
150
  */
144
- items?: ConstructorParameters<ConfiguredDocumentClass<typeof documents.BaseItem>>[0][] | null;
151
+ items?: ConstructorParameters<ConfiguredDocumentClass<typeof documents.BaseItem>>[0][] | null | undefined;
145
152
 
146
153
  /**
147
154
  * A collection of ActiveEffect embedded Documents
155
+ * @defaultValue `new EmbeddedCollection(ActiveEffectData, [], BaseActiveEffect.implementation)`
148
156
  */
149
- effects?: ConstructorParameters<ConfiguredDocumentClass<typeof documents.BaseActiveEffect>>[0][] | null;
157
+ effects?: ConstructorParameters<ConfiguredDocumentClass<typeof documents.BaseActiveEffect>>[0][] | null | undefined;
150
158
 
151
159
  /**
152
160
  * The _id of a Folder which contains this Actor
153
161
  * @defaultValue `null`
154
162
  */
155
- folder?: string | null;
163
+ folder?: InstanceType<ConfiguredDocumentClass<typeof documents.BaseFolder>> | string | null | undefined;
156
164
 
157
165
  /**
158
166
  * The numeric sort value which orders this Actor relative to its siblings
159
167
  * @defaultValue `0`
160
168
  */
161
- sort?: number | null;
169
+ sort?: number | null | undefined;
162
170
 
163
171
  /**
164
172
  * An object which configures user permissions to this Actor
165
173
  * @defaultValue `{ default: CONST.ENTITY_PERMISSIONS.NONE }`
166
174
  */
167
- permission?: Partial<Record<string, foundry.CONST.EntityPermission>> | null;
175
+ permission?: Partial<Record<string, foundry.CONST.DOCUMENT_PERMISSION_LEVELS>> | null | undefined;
168
176
 
169
177
  /**
170
178
  * An object of optional key/value flags
171
179
  * @defaultValue `{}`
172
180
  */
173
- flags?: ConfiguredFlags<'Actor'> | null;
181
+ flags?: ConfiguredFlags<'Actor'> | null | undefined;
174
182
  }
175
183
 
176
184
  type ActorDataBaseSource = PropertiesToSource<ActorDataBaseProperties>;
@@ -182,6 +190,7 @@ type DocumentDataConstructor = Pick<typeof DocumentData, keyof typeof DocumentDa
182
190
  interface ActorDataConstructor extends DocumentDataConstructor {
183
191
  new (data: ActorDataConstructorData, document?: documents.BaseActor | null): ActorData;
184
192
 
193
+ /** @override */
185
194
  defineSchema(): ActorDataSchema;
186
195
 
187
196
  /**
@@ -203,9 +212,11 @@ export type ActorData = DocumentData<
203
212
  documents.BaseActor
204
213
  > &
205
214
  ActorDataProperties & {
215
+ /** @override */
206
216
  _initializeSource(data: ActorDataConstructorData): ActorDataSource;
207
217
 
218
+ /** @override */
208
219
  _initialize(): void;
209
220
  };
210
221
 
211
- export declare const ActorData: ActorDataConstructor;
222
+ export const ActorData: ActorDataConstructor;
@@ -0,0 +1,165 @@
1
+ import type { PropertiesToSource } from '../../../../types/helperTypes.js';
2
+ import type DocumentData from '../../abstract/data.mjs';
3
+ import { AnyDocumentData } from '../../abstract/data.mjs';
4
+ import * as fields from '../fields.mjs';
5
+ import type { ActorData } from './actorData.js';
6
+ import type { CardsData } from './cardsData.js';
7
+ import type { CombatData } from './combatData.js';
8
+ import type { FolderData } from './folderData.js';
9
+ import type { ItemData } from './itemData.js';
10
+ import type { JournalEntryData } from './journalEntryData.js';
11
+ import type { MacroData } from './macroData.js';
12
+ import type { PlaylistData } from './playlistData.js';
13
+ import type { RollTableData } from './rollTableData.js';
14
+ import type { SceneData } from './sceneData.js';
15
+
16
+ interface AdventureDataSchema extends DocumentSchema {
17
+ _id: fields.DocumentId;
18
+ name: fields.RequiredString;
19
+ img: fields.ImageField;
20
+ description: fields.BlankString;
21
+ actors: AdventureDocumentsField<typeof ActorData>;
22
+ combats: AdventureDocumentsField<typeof CombatData>;
23
+ items: AdventureDocumentsField<typeof ItemData>;
24
+ scenes: AdventureDocumentsField<typeof SceneData>;
25
+ journal: AdventureDocumentsField<typeof JournalEntryData>;
26
+ tables: AdventureDocumentsField<typeof RollTableData>;
27
+ macros: AdventureDocumentsField<typeof MacroData>;
28
+ cards: AdventureDocumentsField<typeof CardsData>;
29
+ playlists: AdventureDocumentsField<typeof PlaylistData>;
30
+ folders: AdventureDocumentsField<typeof FolderData>;
31
+ sort: fields.IntegerSortField;
32
+ flags: fields.ObjectField;
33
+ }
34
+
35
+ interface AdventureDataProperties {
36
+ /** @defaultValue `null` */
37
+ _id: string | null;
38
+
39
+ name: string;
40
+
41
+ img: string | null | undefined;
42
+
43
+ /** @defaultValue `""` */
44
+ description: string;
45
+
46
+ /** @defaultValue `[]` */
47
+ actors: ActorData[];
48
+
49
+ /** @defaultValue `[]` */
50
+ combats: CombatData[];
51
+
52
+ /** @defaultValue `[]` */
53
+ items: ItemData[];
54
+
55
+ /** @defaultValue `[]` */
56
+ scenes: SceneData[];
57
+
58
+ /** @defaultValue `[]` */
59
+ journal: JournalEntryData[];
60
+
61
+ /** @defaultValue `[]` */
62
+ tables: RollTableData[];
63
+
64
+ /** @defaultValue `[]` */
65
+ macros: MacroData[];
66
+
67
+ /** @defaultValue `[]` */
68
+ cards: CardsData[];
69
+
70
+ /** @defaultValue `[]` */
71
+ playlists: PlaylistData[];
72
+
73
+ /** @defaultValue `[]` */
74
+ folders: FolderData[];
75
+
76
+ /** @defaultValue `0` */
77
+ sort: number;
78
+
79
+ /** @defaultValue `{}` */
80
+ flags: Record<string, unknown>;
81
+ }
82
+
83
+ interface AdventureDataConstructorData {
84
+ /** @defaultValue `null` */
85
+ _id?: string | null | undefined;
86
+
87
+ name: string;
88
+
89
+ img?: string | null | undefined;
90
+
91
+ /** @defaultValue `""` */
92
+ description?: string | null | undefined;
93
+
94
+ /** @defaultValue `[]` */
95
+ actors?: ActorData[] | null | undefined;
96
+
97
+ /** @defaultValue `[]` */
98
+ combats?: CombatData[] | null | undefined;
99
+
100
+ /** @defaultValue `[]` */
101
+ items?: ItemData[] | null | undefined;
102
+
103
+ /** @defaultValue `[]` */
104
+ scenes?: SceneData[] | null | undefined;
105
+
106
+ /** @defaultValue `[]` */
107
+ journal?: JournalEntryData[] | null | undefined;
108
+
109
+ /** @defaultValue `[]` */
110
+ tables?: RollTableData[] | null | undefined;
111
+
112
+ /** @defaultValue `[]` */
113
+ macros?: MacroData[] | null | undefined;
114
+
115
+ /** @defaultValue `[]` */
116
+ cards?: CardsData[] | null | undefined;
117
+
118
+ /** @defaultValue `[]` */
119
+ playlists?: PlaylistData[] | null | undefined;
120
+
121
+ /** @defaultValue `[]` */
122
+ folders?: FolderData[] | null | undefined;
123
+
124
+ /** @defaultValue `0` */
125
+ sort?: number | null | undefined;
126
+
127
+ /** @defaultValue `{}` */
128
+ flags?: Record<string, unknown> | null | undefined;
129
+ }
130
+
131
+ /**
132
+ * A data schema which encompasses a collection of base Documents which comprise an adventure module.
133
+ *
134
+ * WARNING: This data schema is an early prototype which will be fully implemented in V10.
135
+ * Until then it is for internal use only. Use this at your own risk.
136
+ * @internal
137
+ *
138
+ * @see BaseAdventure
139
+ */
140
+ export class AdventureData extends DocumentData<
141
+ AdventureDataSchema,
142
+ AdventureDataProperties,
143
+ PropertiesToSource<AdventureDataProperties>,
144
+ AdventureDataConstructorData
145
+ > {
146
+ /** @override */
147
+ static defineSchema(): AdventureDataSchema;
148
+
149
+ /**
150
+ * A type of data field which stores a collection of document data objects
151
+ * @typeParam D - the type of the DocumentData constructor
152
+ */
153
+ static ADVENTURE_DOCUMENTS_FIELD<D extends ConstructorOf<AnyDocumentData>>(dataCls: D): AdventureDocumentsField<D>;
154
+ }
155
+
156
+ /**
157
+ * Property type: `D[]`
158
+ * Constructor type: `D[] | null | undefined`
159
+ * Default: `[]`
160
+ */
161
+ type AdventureDocumentsField<D extends ConstructorOf<AnyDocumentData>> = DocumentField<D> & {
162
+ type: [D];
163
+ required: true;
164
+ default: [];
165
+ };