@league-of-foundry-developers/foundry-vtt-types 9.255.2 → 9.255.3

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": "@league-of-foundry-developers/foundry-vtt-types",
3
- "version": "9.255.2",
3
+ "version": "9.255.3",
4
4
  "description": "TypeScript type definitions for Foundry VTT",
5
5
  "exports": {
6
6
  ".": {
@@ -55,7 +55,7 @@ interface SettingConfig<T = unknown> {
55
55
  : ConstructorOf<T>;
56
56
 
57
57
  /** For string Types, defines the allowable values */
58
- choices?: (T extends string ? Record<string, string> : never) | undefined;
58
+ choices?: (T extends number | string ? Record<T, string> : never) | undefined;
59
59
 
60
60
  /** For numeric Types, defines the allowable range */
61
61
  range?:
@@ -95,10 +95,7 @@ interface SettingSubmenuConfig {
95
95
  icon?: string | undefined;
96
96
 
97
97
  /** The FormApplication to render */
98
- // TODO: Find a better way to type this. Ideally, we would find a way to conditionally make the first parameter of FormApplication optional...
99
- type:
100
- | (new () => FormApplication<any, any, any>)
101
- | ConstructorOf<FormApplication<FormApplicationOptions, object, undefined>>;
98
+ type: new () => FormApplication<any, any, any>;
102
99
 
103
100
  /** If true, only a GM can edit this Setting */
104
101
  restricted?: boolean | undefined;
@@ -98,7 +98,7 @@ declare global {
98
98
  * Handle attribute bar update
99
99
  * @internal
100
100
  */
101
- protected _onAttributeUpdate(event: JQuery.ChangeEvent): void;
101
+ protected _onAttributeUpdate(event: JQuery.FocusOutEvent): void;
102
102
 
103
103
  /**
104
104
  * Toggle Token combat state
@@ -126,12 +126,16 @@ declare global {
126
126
 
127
127
  /**
128
128
  * Handle toggling a token status effect icon
129
- * @param overlay - (default: `false`)
130
129
  * @internal
131
130
  */
132
131
  protected _onToggleEffect(
133
132
  event: JQuery.ClickEvent | JQuery.ContextMenuEvent,
134
- { overlay }?: { overlay?: boolean }
133
+ {
134
+ overlay
135
+ }?: {
136
+ /** @defaultValue `@false` */
137
+ overlay?: boolean;
138
+ }
135
139
  ): Promise<boolean>;
136
140
 
137
141
  /**
@@ -14,7 +14,7 @@ declare class CameraViews<
14
14
  * return foundry.utils.mergeObject(super.defaultOptions, {
15
15
  * id: "camera-views",
16
16
  * template: "templates/hud/camera-views.html",
17
- * popOut: false,
17
+ * popOut: false
18
18
  * })
19
19
  * ```
20
20
  */
@@ -27,14 +27,14 @@ declare class CameraViews<
27
27
 
28
28
  /**
29
29
  * Obtain a reference to the div.camera-view which is used to portray a given Foundry User.
30
- * @param userId - The ID of the User entity
30
+ * @param userId - The ID of the User document
31
31
  */
32
32
  getUserCameraView(userId: string): HTMLElement | null;
33
33
 
34
34
  /**
35
35
  * Obtain a reference to the video.user-camera which displays the video channel for a requested Foundry User.
36
36
  * If the user is not broadcasting video this will return null.
37
- * @param userId - The ID of the User entity
37
+ * @param userId - The ID of the User document
38
38
  */
39
39
  getUserVideoElement(userId: string): HTMLVideoElement | null;
40
40
 
@@ -59,6 +59,11 @@ declare abstract class FormApplication<
59
59
  * @remarks Foundry allows passing no value to the constructor at all.
60
60
  */
61
61
  constructor(object: ConcreteObject, options?: Partial<Options>);
62
+ constructor(
63
+ ...args: ConcreteObject extends undefined
64
+ ? [ConcreteObject?, Partial<Options>?]
65
+ : [ConcreteObject, Partial<Options>?]
66
+ );
62
67
 
63
68
  /**
64
69
  * The object target which we are using this form to modify
@@ -94,11 +94,15 @@ declare global {
94
94
  /** @override */
95
95
  activateListeners(html: JQuery): void;
96
96
 
97
+ /** @override */
98
+ protected _contextMenu(html: JQuery): void;
99
+
97
100
  /**
98
- * Create a Context Menu attached to each Macro button
99
- * @param html - The HTML being rendered for the hotbar
101
+ * Get the Macro entry context options
102
+ * @returns The Macro entry context options
103
+ * @internal
100
104
  */
101
- protected _contextMenu(html: JQuery): void;
105
+ protected _getEntryContextOptions(): ContextMenuEntry[];
102
106
 
103
107
  /**
104
108
  * Handle left-click events to
@@ -9,6 +9,7 @@ import './cursor';
9
9
  import './doorControl';
10
10
  import './effectsCanvasGroup';
11
11
  import './interfaceCanvasGroup';
12
+ import './objectHUD';
12
13
  import './placeableObject';
13
14
  import './placeableObjects';
14
15
  import './ruler';
@@ -0,0 +1,82 @@
1
+ /**
2
+ * An extension of PIXI.Container used as the interface frame for a PlaceableObject on the ControlsLayer
3
+ *
4
+ * @see {@link PlaceableObject}
5
+ * @see {@link ControlsLayer}
6
+ */
7
+ declare class ObjectHUD extends PIXI.Container {
8
+ constructor(object: PIXI.DisplayObject);
9
+
10
+ /**
11
+ * The object that this HUD container is linked to
12
+ */
13
+ object: PIXI.DisplayObject;
14
+
15
+ /**
16
+ * Use the linked object's transform matrix to easily synchronize position
17
+ */
18
+ transform: PIXI.Transform;
19
+
20
+ /** @override */
21
+ // @ts-expect-error this is a property in `PIXI.Container` but foundry overrides it as an accessor.
22
+ get visible(): boolean;
23
+ set visible(value: boolean);
24
+
25
+ /** @override */
26
+ // @ts-expect-error this is a property in `PIXI.Container` but foundry overrides it as an accessor.
27
+ get renderable(): boolean;
28
+ set renderable(value: boolean);
29
+
30
+ /**
31
+ * Display scrolling status text originating from this ObjectHUD container.
32
+ * @param content - The text content to display
33
+ * @param options - (default: `{}`)
34
+ * @returns The created PreciseText object which is scrolling
35
+ */
36
+ createScrollingText(
37
+ content: string,
38
+ options?: ObjectHUD.CreateScrollingTextOptions | undefined
39
+ ): Promise<PreciseText | null>;
40
+
41
+ /**
42
+ * Orchestrate the animation of the scrolling text in this HUD
43
+ * @param text - The PrecisText instance to animate
44
+ * @param duration - A desired duration of animation
45
+ * @param dx - A horizontal distance to animate the text
46
+ * (default: `0`)
47
+ * @param dy - A vertical distance to animate the text
48
+ * (default: `0`)
49
+ * @internal
50
+ */
51
+ protected _animateScrollText(text: PreciseText, duration: number, dx?: number, dy?: number): Promise<void>;
52
+ }
53
+
54
+ type TextStyleProperties = Exclude<ConstructorParameters<typeof PIXI.TextStyle>[0], undefined>;
55
+
56
+ declare namespace ObjectHUD {
57
+ interface CreateScrollingTextOptions extends TextStyleProperties {
58
+ /**
59
+ * The original anchor point where the text first appears
60
+ * @defaultValue `CONST.TEXT_ANCHOR_POINTS.CENTER`
61
+ */
62
+ anchor?: foundry.CONST.TEXT_ANCHOR_POINTS | undefined;
63
+
64
+ /**
65
+ * The direction in which the text scrolls
66
+ * @defaultValue `CONST.TEXT_ANCHOR_POINTS.TOP`
67
+ */
68
+ direction?: foundry.CONST.TEXT_ANCHOR_POINTS | undefined;
69
+
70
+ /**
71
+ * The duration of the scrolling effect in milliseconds
72
+ * @defaultValue `2000`
73
+ */
74
+ duration?: number | undefined;
75
+
76
+ /**
77
+ * An amount of randomization between 0 and 1 to apply to the initial Position
78
+ * @defaultValue `0`
79
+ */
80
+ jitter?: number | undefined;
81
+ }
82
+ }
@@ -3,30 +3,40 @@ import { DocumentModificationOptions } from '../../../../common/abstract/documen
3
3
 
4
4
  declare global {
5
5
  /**
6
- * A MeasuredTemplate is an implementation of PlaceableObject which represents an area of the canvas grid which is
7
- * covered by some effect.
6
+ * A type of Placeable Object which highlights an area of the grid as covered by some area of effect.
7
+ * @see {@link MeasuredTemplateDocument}
8
+ * @see {@link TemplateLayer}
8
9
  */
9
10
  class MeasuredTemplate extends PlaceableObject<
10
11
  InstanceType<ConfiguredDocumentClass<typeof MeasuredTemplateDocument>>
11
12
  > {
12
- constructor(document: InstanceType<ConfiguredDocumentClass<typeof MeasuredTemplateDocument>>);
13
-
14
- controlIcon: ControlIcon | null;
15
- template: PIXI.Graphics | null;
16
- ruler: PreciseText | null;
13
+ /**
14
+ * The geometry shape used for testing point intersection
15
+ * @defaultValue `undefined`
16
+ */
17
+ shape: PIXI.Circle | PIXI.Ellipse | PIXI.Polygon | PIXI.Rectangle | PIXI.RoundedRectangle | undefined;
17
18
 
18
19
  /**
19
20
  * The tiling texture used for this template, if any
20
21
  */
21
- texture: PIXI.Texture | null;
22
+ texture: PIXI.Texture | undefined;
22
23
 
23
24
  /**
24
- * The template shape used for testing point intersection
25
+ * The template graphics
26
+ * @defaultValue `undefined`
25
27
  */
26
- shape: PIXI.Circle | PIXI.Ellipse | PIXI.Polygon | PIXI.Rectangle | PIXI.RoundedRectangle;
28
+ template: PIXI.Graphics | undefined;
29
+
30
+ /**
31
+ * The UI frame container which depicts Token metadata and status, displayed in the ControlsLayer.
32
+ * @defaultValue `new ObjectHUD(this)`
33
+ */
34
+ hud: MeasuredTemplate.ObjectHUD;
27
35
 
28
36
  /**
29
37
  * Internal property used to configure the control border thickness
38
+ * @defaultValue `3`
39
+ * @internal
30
40
  */
31
41
  protected _borderThickness: number;
32
42
 
@@ -54,13 +64,24 @@ declare global {
54
64
  /** @override */
55
65
  draw(): Promise<this>;
56
66
 
67
+ /** @override */
68
+ destroy(options?: Parameters<PlaceableObject['destroy']>[0]): void;
69
+
70
+ /**
71
+ * Draw the HUD container which provides an interface for managing this template
72
+ * @internal
73
+ */
74
+ protected _drawHUD(): MeasuredTemplate.InitializedObjectHUD;
75
+
57
76
  /**
58
77
  * Draw the ControlIcon for the MeasuredTemplate
78
+ * @internal
59
79
  */
60
80
  protected _drawControlIcon(): ControlIcon;
61
81
 
62
82
  /**
63
83
  * Draw the Text label used for the MeasuredTemplate
84
+ * @internal
64
85
  */
65
86
  protected _drawRulerText(): PreciseText;
66
87
 
@@ -69,31 +90,31 @@ declare global {
69
90
 
70
91
  /**
71
92
  * Get a Circular area of effect given a radius of effect
93
+ * @internal
72
94
  */
73
95
  protected _getCircleShape(distance: number): PIXI.Circle;
74
96
 
75
97
  /**
76
98
  * Get a Conical area of effect given a direction, angle, and distance
99
+ * @internal
77
100
  */
78
101
  protected _getConeShape(direction: number, angle: number, distance: number): PIXI.Polygon;
79
102
 
80
103
  /**
81
104
  * Get a Rectangular area of effect given a width and height
105
+ * @internal
82
106
  */
83
107
  protected _getRectShape(direction: number, distance: number): NormalizedRectangle;
84
108
 
85
109
  /**
86
110
  * Get a rotated Rectangular area of effect given a width, height, and direction
111
+ * @internal
87
112
  */
88
113
  protected _getRayShape(direction: number, distance: number, width: number): PIXI.Polygon;
89
114
 
90
- /**
91
- * Draw the rotation control handle and assign event listeners
92
- */
93
- protected _drawRotationHandle(radius: number): void;
94
-
95
115
  /**
96
116
  * Update the displayed ruler tooltip text
117
+ * @internal
97
118
  */
98
119
  protected _refreshRulerText(): void;
99
120
 
@@ -124,4 +145,20 @@ declare global {
124
145
  /** @override */
125
146
  protected _onDelete(options: DocumentModificationOptions, userId: string): void;
126
147
  }
148
+
149
+ namespace MeasuredTemplate {
150
+ interface ObjectHUD extends globalThis.ObjectHUD {
151
+ /**
152
+ * Template control icon
153
+ */
154
+ icon?: ControlIcon;
155
+
156
+ /**
157
+ * Ruler text tooltip
158
+ */
159
+ ruler?: PreciseText;
160
+ }
161
+
162
+ type InitializedObjectHUD = RequiredProps<ObjectHUD, 'icon' | 'ruler'>;
163
+ }
127
164
  }