@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250723121215 → 13.346.0-beta.20250724011756

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@league-of-foundry-developers/foundry-vtt-types",
4
- "version": "13.346.0-beta.20250723121215",
4
+ "version": "13.346.0-beta.20250724011756",
5
5
  "description": "TypeScript type definitions for Foundry VTT",
6
6
  "type": "module",
7
7
  "types": "./src/index.d.mts",
@@ -62,7 +62,8 @@ declare namespace Module {
62
62
  */
63
63
  interface Schema extends BasePackage.Schema {
64
64
  /**
65
- * The current package version
65
+ * The current package version. It is recommended to stick to dot-separated numbers like "5.0.3"
66
+ * and to not include a leading "v" to avoid string comparison. See {@linkcode foundry.utils.isNewerVersion}.
66
67
  * @remarks Actually defined in BasePackage but defined here to avoid conflict with BaseWorld
67
68
  */
68
69
  version: fields.StringField<{ required: true; blank: false; initial: "0" }>;
@@ -72,7 +72,8 @@ declare namespace System {
72
72
  */
73
73
  interface Schema extends BasePackage.Schema {
74
74
  /**
75
- * The current package version
75
+ * The current package version. It is recommended to stick to dot-separated numbers like "5.0.3"
76
+ * and to not include a leading "v" to avoid string comparison. See {@linkcode foundry.utils.isNewerVersion}.
76
77
  * @remarks Actually defined in BasePackage but defined here to avoid conflict with BaseWorld
77
78
  */
78
79
  version: fields.StringField<{ required: true; blank: false; initial: "0" }>;
@@ -64,16 +64,22 @@ declare namespace BasePackage {
64
64
  }
65
65
 
66
66
  interface PackageMediaSchema extends DataSchema {
67
+ /** Usage type for the media asset. "setup" means it will be used on the setup screen. */
67
68
  type: fields.StringField<OptionalString>;
68
69
 
70
+ /** A web url link to the media element. */
69
71
  url: fields.StringField<OptionalString>;
70
72
 
73
+ /** A caption for the media element. */
71
74
  caption: fields.StringField<OptionalString>;
72
75
 
76
+ /** Should the media play on loop? */
73
77
  loop: fields.BooleanField<{ required: false; blank: false; initial: false }>;
74
78
 
79
+ /** A link to the thumbnail for the media element. */
75
80
  thumbnail: fields.StringField<OptionalString>;
76
81
 
82
+ /** An object of optional key/value flags. */
77
83
  flags: fields.ObjectField;
78
84
  }
79
85
 
@@ -228,14 +234,21 @@ declare namespace BasePackage {
228
234
 
229
235
  /** @internal */
230
236
  interface _PackageCompendiumFolderSchema extends DataSchema {
237
+ /** Name for the folder. Multiple packages with identical folder names will merge by name. */
231
238
  name: fields.StringField<{ required: true; blank: false }>;
239
+
240
+ /** Alphabetical or manual sorting. */
232
241
  sorting: fields.StringField<{
233
242
  required: false;
234
243
  blank: false;
235
244
  initial: undefined;
236
245
  choices: typeof BaseFolder.SORTING_MODES;
237
246
  }>;
247
+
248
+ /** A hex string for the pack's color. */
238
249
  color: fields.ColorField;
250
+
251
+ /** A list of the pack names to include in this folder. */
239
252
  packs: fields.SetField<fields.StringField<{ required: true; blank: false }>>;
240
253
  }
241
254
 
@@ -244,6 +257,7 @@ declare namespace BasePackage {
244
257
 
245
258
  type PackageCompendiumFolderSchema<Depth> = Depth extends number
246
259
  ? _PackageCompendiumFolderSchema & {
260
+ /** Nested folder data, up to three levels. */
247
261
  folders: fields.SetField<fields.SchemaField<PackageCompendiumFolderSchema<FolderRecursion[Depth]>>>;
248
262
  }
249
263
  : _PackageCompendiumFolderSchema;
@@ -300,34 +314,37 @@ declare namespace BasePackage {
300
314
  */
301
315
  changelog: fields.StringField<OptionalString>;
302
316
 
317
+ /**
318
+ * An object of optional key/value flags. Packages can use this namespace for their own purposes,
319
+ * preferably within a namespace matching their package ID.
320
+ */
303
321
  flags: fields.ObjectField;
304
322
 
323
+ /** An array of objects containing media info about the package. */
305
324
  media: fields.SetField<fields.SchemaField<PackageMediaSchema>>;
306
325
 
307
326
  // Moved to base-module and base-system to avoid conflict with base-world
308
327
 
309
- /**
310
- * The current package version
311
- */
312
328
  // version: fields.StringField<{ required: true; blank: false; initial: "0" }>;
313
329
 
314
330
  /**
315
- * The compatibility of this version with the core Foundry software
331
+ * The compatibility of this version with the core Foundry software. See https://foundryvtt.com/article/versioning/
332
+ * for more info on how the core software structures its releases.
316
333
  */
317
334
  compatibility: PackageCompatibility;
318
335
 
319
336
  /**
320
- * An array of urls or relative file paths for JavaScript files which should be included
337
+ * An array of urls or relative file paths for JavaScript files to include
321
338
  */
322
339
  scripts: fields.SetField<fields.StringField<{ required: true; blank: false }>>;
323
340
 
324
341
  /**
325
- * An array of urls or relative file paths for ESModule files which should be included
342
+ * An array of urls or relative file paths for ESModule files to include
326
343
  */
327
344
  esmodules: fields.SetField<fields.StringField<{ required: true; blank: false }>>;
328
345
 
329
346
  /**
330
- * An array of urls or relative file paths for CSS stylesheet files which should be included
347
+ * An array of urls or relative file paths for CSS stylesheet files to include
331
348
  */
332
349
  styles: fields.SetField<fields.StringField<{ required: true; blank: false }>>;
333
350
 
@@ -341,6 +358,9 @@ declare namespace BasePackage {
341
358
  */
342
359
  packs: PackageCompendiumPacks<fields.SchemaField<PackageCompendiumSchema>>;
343
360
 
361
+ /**
362
+ * An array of pack folders that will be initialized once per world.
363
+ */
344
364
  packFolders: fields.SetField<fields.SchemaField<PackageCompendiumFolderSchema<1>>>;
345
365
 
346
366
  /**
@@ -368,11 +388,63 @@ declare namespace BasePackage {
368
388
  */
369
389
  protected: fields.BooleanField;
370
390
 
391
+ /**
392
+ * Whether this package is a free Exclusive pack.
393
+ */
371
394
  exclusive: fields.BooleanField;
372
395
 
396
+ /**
397
+ * Whether updates should leave the contents of the package's /storage folder.
398
+ */
373
399
  persistentStorage: fields.BooleanField;
374
400
  }
375
401
 
402
+ /**
403
+ * @remarks Package flags do not operate under the same rules as Document flags
404
+ * 1. They are constructed directly from the provided manifest.json files
405
+ * 2. There are no helper getFlag/setFlag functions
406
+ * 3. There is no enforced namespacing
407
+ * 4. There are *many* layers that accept flags, rather than just the top level
408
+ */
409
+ namespace Flags {
410
+ /**
411
+ * Flags used by the core software.
412
+ * @remarks Flags for the top level of the schema. Notably *not* namespaced as "core..."
413
+ */
414
+ interface Core {
415
+ /** Can you upload to this package's folder using the built-in FilePicker. */
416
+ canUpload?: boolean | undefined;
417
+
418
+ /** Configuration information for hot reload logic */
419
+ hotReload?: HotReloadConfig | undefined;
420
+
421
+ /**
422
+ * Mapping information for CompendiumArt.
423
+ * Each key is a unique system ID, e.g. "dnd5e" or "pf2e".
424
+ */
425
+ compendiumArtMappings?: Record<string, CompendiumArtFlag> | undefined;
426
+
427
+ /** A mapping of token subject paths to configured subject images. */
428
+ tokenRingSubjectMappings?: Record<string, string> | undefined;
429
+ }
430
+
431
+ interface HotReloadConfig {
432
+ /** A list of file extensions, e.g. `["css", "hbs", "json"]` */
433
+ extensions?: string[] | undefined;
434
+
435
+ /** File paths to watch, e.g. `["src/styles", "templates", "lang"]` */
436
+ paths?: string[] | undefined;
437
+ }
438
+
439
+ interface CompendiumArtFlag {
440
+ /** The path to the art mapping file. */
441
+ mapping: string;
442
+
443
+ /** An optional credit string for use by the game system to apply in an appropriate place. */
444
+ credit?: string | undefined;
445
+ }
446
+ }
447
+
376
448
  interface PackageManifestData {
377
449
  availability: foundry.CONST.PACKAGE_AVAILABILITY_CODES;
378
450
  locked: boolean;
@@ -13,14 +13,14 @@ declare class AdditionalTypesField<
13
13
  > extends ObjectField<
14
14
  Options,
15
15
  // Note(LukeAbby): `{}` is a valid initial so `| null | undefined` is added. Needs to respect overriden `initial` in the future.
16
- AdditionalTypesField.ServerTypeDeclarations | null | undefined,
17
- AdditionalTypesField.ServerTypeDeclarations,
18
- AdditionalTypesField.ServerTypeDeclarations
16
+ AdditionalTypesField.DocumentTypesConfiguration | null | undefined,
17
+ AdditionalTypesField.DocumentTypesConfiguration,
18
+ AdditionalTypesField.DocumentTypesConfiguration
19
19
  > {
20
20
  static get _defaults(): AdditionalTypesField.DefaultOptions;
21
21
 
22
22
  protected _validateType(
23
- value: AdditionalTypesField.ServerTypeDeclarations,
23
+ value: AdditionalTypesField.DocumentTypesConfiguration,
24
24
  options?: DataField.ValidateOptions<this>,
25
25
  ): boolean | void;
26
26
  }
@@ -36,5 +36,34 @@ declare namespace AdditionalTypesField {
36
36
  }
37
37
  >;
38
38
 
39
- type ServerTypeDeclarations = Record<Document.SystemType, Record<string, Record<string, unknown>>>;
39
+ /**
40
+ * Document subtype registration information for systems and modules.
41
+ * The first layer of keys are document types, e.g. "Actor" or "Item".
42
+ * The second layer of keys are document subtypes, e.g. "character" or "feature".
43
+ */
44
+ type DocumentTypesConfiguration = Record<Document.SystemType, Record<string, ServerSanitationFields>>;
45
+
46
+ /** @deprecated Internal type will be removed */
47
+ type ServerTypeDeclarations = DocumentTypesConfiguration;
48
+
49
+ /**
50
+ * Fields that need dedicated server-side handling. Paths are automatically relative to `system`.
51
+ */
52
+ interface ServerSanitationFields {
53
+ /**
54
+ * HTML fields that must be cleaned by the server, e.g. "description.value"
55
+ */
56
+ htmlFields?: string[] | undefined;
57
+
58
+ /**
59
+ * File path fields that must be cleaned by the server.
60
+ * Each key is a field path and the values are an array of keys in {@linkcode CONST.FILE_CATEGORIES}.
61
+ */
62
+ filePathFields?: Record<string, CONST.FILE_CATEGORIES> | undefined;
63
+
64
+ /**
65
+ * Fields that can only be updated by a GM user.
66
+ */
67
+ gmOnlyFields?: string[] | undefined;
68
+ }
40
69
  }