@7h3laughingman/foundry-types 13.351.0 → 13.351.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@7h3laughingman/foundry-types",
3
- "version": "13.351.0",
3
+ "version": "13.351.1",
4
4
  "description": "Basic TypeScript types for FoundryVTT.",
5
5
  "homepage": "https://github.com/7H3LaughingMan/foundry-types#readme",
6
6
  "bugs": {
@@ -777,6 +777,8 @@ export interface SettingConfig<TChoices extends Record<string, unknown> | undefi
777
777
  default?: number | string | boolean | object | (() => number | string | boolean | object);
778
778
  /** Executes when the value of this Setting changes */
779
779
  onChange?: (choice: TChoices extends object ? keyof TChoices : unknown) => void | Promise<void>;
780
+ /** The combination of `{namespace}.{key}` */
781
+ id?: string;
780
782
  }
781
783
 
782
784
  export interface SettingSubmenuConfig {
@@ -96,7 +96,7 @@ export default class RollTable extends ClientBaseRollTable {
96
96
  normalize(): Promise<this>;
97
97
 
98
98
  /** Reset the state of the RollTable to return any drawn items to the table */
99
- reset(): Promise<this>;
99
+ resetResults(): Promise<this>;
100
100
 
101
101
  /**
102
102
  * Evaluate a RollTable by rolling its formula and retrieving a drawn result.
@@ -185,7 +185,23 @@ interface ClientSettingsMap extends Map<string, SettingConfig> {
185
185
  export class WorldSettings extends Collection<string, Setting> {
186
186
  constructor(settings: object);
187
187
 
188
- getItem(key: string): string | null;
188
+ /* -------------------------------------------- */
189
+ /* World Settings Methods */
190
+ /* -------------------------------------------- */
189
191
 
190
- setItem(key: string, value: unknown): void;
192
+ /**
193
+ * Return the Setting document with the given key.
194
+ * @param key The setting key
195
+ * @param user For user-scoped settings, the user ID.
196
+ * @returns The Setting
197
+ */
198
+ getSetting(key: string, user?: string): Setting;
199
+
200
+ /**
201
+ * Return the serialized value of the world setting as a string
202
+ * @param key The setting key
203
+ * @param user For user-scoped settings, the user ID.
204
+ * @returns The serialized setting string
205
+ */
206
+ getItem(key: string, user?: string): string | null;
191
207
  }
@@ -43,6 +43,7 @@ type SettingSchema = {
43
43
  _id: fields.DocumentIdField;
44
44
  key: fields.StringField<string, string, true>;
45
45
  value: fields.JSONField<NonNullable<JSONValue>, true, true, false>;
46
+ user: fields.ForeignDocumentField<BaseUser>;
46
47
  _stats: fields.DocumentStatsField;
47
48
  };
48
49
 
@@ -46,8 +46,10 @@ type TileSchema = {
46
46
  x: fields.NumberField<number, number, true, false, true>;
47
47
  /** The y-coordinate position of the top-left corner of the tile */
48
48
  y: fields.NumberField<number, number, true, false, true>;
49
+ /** The elevation of the tile */
50
+ elevation: fields.NumberField<number, number, true, false, true>;
49
51
  /** The z-index ordering of this tile relative to its siblings */
50
- z: fields.NumberField<number, number, true, false, true>;
52
+ sort: fields.NumberField<number, number, true, false, true>;
51
53
  /** The angle of rotation for the tile between 0 and 360 */
52
54
  rotation: fields.AngleField;
53
55
  /** The tile opacity */
@@ -56,9 +58,8 @@ type TileSchema = {
56
58
  hidden: fields.BooleanField;
57
59
  /** Is the tile currently locked? */
58
60
  locked: fields.BooleanField;
59
- /** Is the tile an overhead tile? */
60
- overhead: fields.BooleanField;
61
- roof: fields.BooleanField;
61
+ /** The tile's restrictions settings */
62
+ restrictions: fields.SchemaField<TileRestrictionsSchema>;
62
63
  /** The tile's occlusion settings */
63
64
  occlusion: fields.SchemaField<TileOcclusionSchema>;
64
65
  /** The tile's video settings */
@@ -67,6 +68,13 @@ type TileSchema = {
67
68
  flags: fields.DocumentFlagsField;
68
69
  };
69
70
 
71
+ type TileRestrictionsSchema = {
72
+ /** Should we restricts light? */
73
+ light: fields.BooleanField;
74
+ /** Should we restricts weather? */
75
+ weather: fields.BooleanField;
76
+ };
77
+
70
78
  type TileOcclusionSchema = {
71
79
  /** The occlusion mode from CONST.TILE_OCCLUSION_MODES */
72
80
  mode: fields.NumberField<TileOcclusionMode, TileOcclusionMode, false, true, true>;
@@ -121,7 +121,7 @@ export function isDeletionKey(key: string): key is "-=";
121
121
  * @param parent Some other class which may be a parent
122
122
  * @returns Is the class a subclass of the parent?
123
123
  */
124
- export function isSubclass(cls: ConstructorOf<Object>, parent: ConstructorOf<Object>): boolean;
124
+ export function isSubclass<TParent extends AnyConstructor>(cls: unknown, parent: TParent): cls is TParent;
125
125
 
126
126
  /**
127
127
  * Search up the prototype chain and return the class that defines the given property.
package/src/util.d.mts CHANGED
@@ -25,6 +25,10 @@ declare global {
25
25
 
26
26
  type CollectionValue<T> = T extends Collection<string, infer U> ? U : never;
27
27
 
28
+ type AnyConstructor = abstract new (...args: never) => unknown;
29
+
30
+ type AnyConcreteConstructor = new (...args: never) => unknown;
31
+
28
32
  type AbstractConstructorOf<T> = abstract new (...args: any[]) => T;
29
33
 
30
34
  type ConstructorOf<T> = new (...args: any[]) => T;
File without changes