@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250718083608 → 13.346.0-beta.20250720082736

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 (33) hide show
  1. package/package.json +1 -1
  2. package/src/foundry/client/applications/ui/game-pause.d.mts +17 -2
  3. package/src/foundry/client/applications/ui/hotbar.d.mts +96 -2
  4. package/src/foundry/client/applications/ui/main-menu.d.mts +29 -2
  5. package/src/foundry/client/applications/ui/players.d.mts +77 -2
  6. package/src/foundry/client/applications/ui/region-legend.d.mts +1 -0
  7. package/src/foundry/client/applications/ui/scene-navigation.d.mts +1 -1
  8. package/src/foundry/client/canvas/containers/advanced/cached-container.d.mts +15 -15
  9. package/src/foundry/client/canvas/containers/advanced/full-canvas-mixin.d.mts +2 -2
  10. package/src/foundry/client/canvas/containers/elements/control-icon.d.mts +12 -32
  11. package/src/foundry/client/canvas/containers/elements/cursor.d.mts +14 -1
  12. package/src/foundry/client/canvas/containers/elements/door-control.d.mts +2 -2
  13. package/src/foundry/client/canvas/containers/elements/door-mesh.d.mts +215 -3
  14. package/src/foundry/client/canvas/containers/elements/grid-highlight.d.mts +3 -3
  15. package/src/foundry/client/canvas/containers/elements/grid-mesh.d.mts +4 -4
  16. package/src/foundry/client/canvas/containers/elements/particles/leaves.d.mts +7 -6
  17. package/src/foundry/client/canvas/containers/elements/particles/particle-effect.d.mts +4 -5
  18. package/src/foundry/client/canvas/containers/elements/point-source-mesh.d.mts +18 -23
  19. package/src/foundry/client/canvas/containers/elements/precise-text.d.mts +9 -10
  20. package/src/foundry/client/canvas/containers/elements/quad-mesh.d.mts +1 -2
  21. package/src/foundry/client/canvas/containers/elements/resize-handle.d.mts +37 -11
  22. package/src/foundry/client/canvas/containers/elements/sprite-mesh.d.mts +34 -26
  23. package/src/foundry/client/canvas/layers/masks/depth.d.mts +1 -1
  24. package/src/foundry/client/canvas/layers/masks/occlusion.d.mts +1 -1
  25. package/src/foundry/client/canvas/primary/primary-canvas-container.d.mts +32 -0
  26. package/src/foundry/client/canvas/primary/primary-canvas-object.d.mts +39 -38
  27. package/src/foundry/client/canvas/primary/primary-graphics.d.mts +22 -18
  28. package/src/foundry/client/canvas/primary/primary-occludable-object.d.mts +59 -29
  29. package/src/foundry/client/canvas/primary/primary-particle-effect.d.mts +51 -0
  30. package/src/foundry/client/canvas/primary/primary-sprite-mesh.d.mts +72 -66
  31. package/src/foundry/client/config.d.mts +444 -311
  32. package/src/foundry/client/documents/wall.d.mts +13 -2
  33. package/src/foundry/client/hooks.d.mts +14 -4
@@ -6,12 +6,10 @@ import type { BaseSamplerShader } from "#client/canvas/rendering/shaders/_module
6
6
  */
7
7
  declare class SpriteMesh extends PIXI.Container {
8
8
  /**
9
- * @param texture - Texture bound to this sprite mesh.
10
- * (default: `PIXI.Texture.EMPTY`)
11
- * @param shaderCls - Shader class used by this sprite mesh.
12
- * (default: `BaseSamplerShader`)
9
+ * @param texture - Texture bound to this sprite mesh. (default: {@linkcode PIXI.Texture.EMPTY})
10
+ * @param shaderCls - Shader class used by this sprite mesh. (default: {@linkcode foundry.canvas.rendering.shaders.BaseSamplerShader | BaseSamplerShader})
13
11
  */
14
- constructor(texture?: PIXI.Texture | null, shaderClass?: BaseSamplerShader.AnyConstructor);
12
+ constructor(texture?: PIXI.Texture, shaderClass?: BaseSamplerShader.AnyConstructor);
15
13
 
16
14
  /** @defaultValue `true` */
17
15
  override isSprite: boolean;
@@ -40,6 +38,7 @@ declare class SpriteMesh extends PIXI.Container {
40
38
 
41
39
  /**
42
40
  * The texture that the sprite is using.
41
+ * @remarks Set `null` in {@linkcode destroy | #destroy}, or if this mesh was constructed with no texture
43
42
  */
44
43
  protected _texture: PIXI.Texture | null;
45
44
 
@@ -81,7 +80,7 @@ declare class SpriteMesh extends PIXI.Container {
81
80
  *
82
81
  * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}
83
82
  */
84
- protected _anchor: PIXI.ObservablePoint;
83
+ protected _anchor: PIXI.ObservablePoint<SpriteMesh.Any>;
85
84
 
86
85
  /**
87
86
  * This is used to store the vertex data of the sprite (basically a quad).
@@ -119,7 +118,7 @@ declare class SpriteMesh extends PIXI.Container {
119
118
  protected _tintRGB: number;
120
119
 
121
120
  /**
122
- * An instance of a texture uvs used for padded SpriteMesh.
121
+ * An instance of a texture uvs used for padded `SpriteMesh`.
123
122
  * Instanced only when padding becomes non-zero.
124
123
  * @defaultValue `null`
125
124
  */
@@ -160,7 +159,10 @@ declare class SpriteMesh extends PIXI.Container {
160
159
  */
161
160
  get padding(): number;
162
161
 
163
- /** @throws If `value < 0` */
162
+ /**
163
+ * @remarks
164
+ * @throws If `value < 0`
165
+ */
164
166
  set padding(value);
165
167
 
166
168
  /**
@@ -175,7 +177,7 @@ declare class SpriteMesh extends PIXI.Container {
175
177
 
176
178
  /**
177
179
  * The blend mode applied to the SpriteMesh.
178
- * @defaultValue `PIXI.BLEND_MODES.NORMAL`
180
+ * @defaultValue {@linkcode PIXI.BLEND_MODES.NORMAL}
179
181
  */
180
182
  set blendMode(value: PIXI.BLEND_MODES);
181
183
 
@@ -185,7 +187,7 @@ declare class SpriteMesh extends PIXI.Container {
185
187
  * If true PixiJS will Math.round() x/y values when rendering, stopping pixel interpolation.
186
188
  * Advantages can include sharper image quality (like text) and faster rendering on canvas.
187
189
  * The main disadvantage is movement of objects may appear less smooth.
188
- * To set the global default, change PIXI.settings.ROUND_PIXELS
190
+ * To set the global default, change {@linkcode PIXI.settings.ROUND_PIXELS}
189
191
  * @defaultValue `PIXI.settings.ROUND_PIXELS`
190
192
  */
191
193
  set roundPixels(value: boolean);
@@ -195,18 +197,19 @@ declare class SpriteMesh extends PIXI.Container {
195
197
  /**
196
198
  * Used to force an alpha mode on this sprite mesh.
197
199
  * If this property is non null, this value will replace the texture alphaMode when computing color channels.
198
- * Affects how tint, worldAlpha and alpha are computed each others.
200
+ * Affects how `tint`, `worldAlpha` and `alpha` are computed each others.
199
201
  */
200
202
  get alphaMode(): PIXI.ALPHA_MODES;
201
203
 
202
204
  set alphaMode(mode);
203
205
 
204
206
  /**
205
- * Returns the SpriteMesh associated batch plugin. By default the returned plugin is that of the associated shader.
206
- * If a plugin is forced, it will returns the forced plugin.
207
- * @defaultValue `this._shader.pluginName`
207
+ * Returns the {@linkcode SpriteMesh} associated batch plugin. By default the returned plugin is that of the associated shader.
208
+ * If a plugin is forced, it will returns the forced plugin. A null value means that this `SpriteMesh` has no associated
209
+ * plugin.
210
+ * @defaultValue {@linkcode BaseSamplerShader.pluginName | this._shader.pluginName}
208
211
  */
209
- get pluginName(): string;
212
+ get pluginName(): string | null;
210
213
 
211
214
  set pluginName(name);
212
215
 
@@ -222,7 +225,7 @@ declare class SpriteMesh extends PIXI.Container {
222
225
  set texture(texture);
223
226
 
224
227
  /**
225
- * The anchor sets the origin point of the sprite. The default value is taken from the {@linkcode PIXI.Texture}
228
+ * The anchor sets the origin point of the sprite. The default value is taken from the texture
226
229
  * and passed to the constructor.
227
230
  *
228
231
  * The default is `(0,0)`, this means the sprite's origin is the top left.
@@ -241,7 +244,7 @@ declare class SpriteMesh extends PIXI.Container {
241
244
  /**
242
245
  * The tint applied to the sprite. This is a hex value.
243
246
  *
244
- * A value of 0xFFFFFF will remove any tint effect.
247
+ * A value of `0xFFFFFF` will remove any tint effect.
245
248
  * @defaultValue `0xFFFFFF`
246
249
  */
247
250
  get tint(): number;
@@ -249,10 +252,9 @@ declare class SpriteMesh extends PIXI.Container {
249
252
  set tint(tint);
250
253
 
251
254
  /**
252
- * The HTML source element for this SpriteMesh texture.
253
- * @privateRemarks This could possibly be `PIXI.ImageSource | null`, but the below is Foundry's typing, which I think is accurate in practice
255
+ * The HTML source element for this `SpriteMesh` texture.
254
256
  */
255
- get sourceElement(): HTMLImageElement | HTMLVideoElement | null;
257
+ get sourceElement(): PIXI.ImageSource | null;
256
258
 
257
259
  /**
258
260
  * Is this SpriteMesh rendering a video texture?
@@ -270,7 +272,7 @@ declare class SpriteMesh extends PIXI.Container {
270
272
  protected _onAnchorUpdate(): void;
271
273
 
272
274
  /**
273
- * Update uvs and push vertices and uv buffers on GPU if necessary.
275
+ * Update `uvs` and push `vertices` and uv buffers on GPU if necessary.
274
276
  */
275
277
  updateUvs(): void;
276
278
 
@@ -283,29 +285,33 @@ declare class SpriteMesh extends PIXI.Container {
283
285
  override updateTransform(): void;
284
286
 
285
287
  /**
286
- * Calculates the worldTransform * vertices, store it in vertexData
288
+ * Calculates the `worldTransform * vertices`, store it in `vertexData`
287
289
  */
288
290
  calculateVertices(): void;
289
291
 
290
292
  /**
291
- * Calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData.
293
+ * Calculates `worldTransform * vertices` for a non texture with a trim. store it in `vertexTrimmedData`.
292
294
  *
293
295
  * This is used to ensure that the true width and height of a trimmed texture is respected.
294
296
  */
295
297
  calculateTrimmedVertices(): void;
296
298
 
297
- override _render(renderer: PIXI.Renderer): void;
299
+ protected override _render(renderer: PIXI.Renderer): void;
298
300
 
299
301
  /**
300
302
  * Update the batch data object.
301
303
  */
302
304
  protected _updateBatchData(): void;
303
305
 
304
- override _calculateBounds(): void;
306
+ protected override _calculateBounds(): void;
305
307
 
306
308
  override getLocalBounds(rect: PIXI.Rectangle): PIXI.Rectangle;
307
309
 
308
- /** @privateRemarks Foundry still marks this `@override` from when this class used to extend `PIXI.Mesh` */
310
+ /**
311
+ * Check to see if a point is contained within this SpriteMesh Quad.
312
+ * @param point - Point to check if it's contained.
313
+ * @returns `true` if the point is contained within geometry.
314
+ */
309
315
  containsPoint(point: PIXI.IPointData): boolean;
310
316
 
311
317
  override destroy(options?: PIXI.IDestroyOptions | boolean): void;
@@ -322,6 +328,8 @@ declare class SpriteMesh extends PIXI.Container {
322
328
  textureOptions?: PIXI.IBaseTextureOptions,
323
329
  shaderClass?: BaseSamplerShader.AnyConstructor,
324
330
  ): SpriteMesh;
331
+
332
+ #SpriteMesh: true;
325
333
  }
326
334
 
327
335
  declare namespace SpriteMesh {
@@ -53,7 +53,7 @@ declare class CanvasDepthMask extends CachedContainer {
53
53
  /**
54
54
  * Clear the depth mask.
55
55
  */
56
- clear(): void;
56
+ override clear(): this;
57
57
  }
58
58
 
59
59
  declare namespace CanvasDepthMask {
@@ -46,7 +46,7 @@ declare class CanvasOcclusionMask extends CachedContainer {
46
46
  /**
47
47
  * Clear the occlusion mask.
48
48
  */
49
- clear(): void;
49
+ override clear(): this;
50
50
 
51
51
  /**
52
52
  * Map an elevation to a value in the range [0, 1] with 8-bit precision.
@@ -1,7 +1,39 @@
1
+ import type { PIXI } from "#configuration";
1
2
  import type { Identity } from "#utils";
2
3
  import type { CanvasTransformMixin } from "./primary-canvas-object.d.mts";
3
4
 
5
+ /**
6
+ * Primary canvas container are reserved for advanced usage.
7
+ * They allow to group PrimarySpriteMesh in a single Container.
8
+ * The container elevation is replacing individual sprite elevation.
9
+ * @remarks This class is not used for anything by core as of 13.346
10
+ */
4
11
  declare class PrimaryCanvasContainer extends CanvasTransformMixin(PIXI.Container) {
12
+ /**
13
+ * A key which resolves ties amongst objects at the same elevation within the same layer.
14
+ */
15
+ get sort(): number;
16
+
17
+ set sort(value);
18
+
19
+ /**
20
+ * The elevation of this container.
21
+ */
22
+ get elevation(): number;
23
+
24
+ set elevation(value);
25
+
26
+ /**
27
+ * To know if this container has at least one children that should render its depth.
28
+ */
29
+ get shouldRenderDepth(): boolean;
30
+
31
+ override sortChildren(): void;
32
+
33
+ override updateCanvasTransform(): void;
34
+
35
+ renderDepthData(renderer: PIXI.Renderer): void;
36
+
5
37
  #PrimaryCanvasContainer: true;
6
38
  }
7
39
 
@@ -1,28 +1,26 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
2
  import type { FixedInstanceType, Mixin } from "#utils";
3
3
  import type Document from "#common/abstract/document.d.mts";
4
- import type { CanvasGroupMixin } from "#client/canvas/groups/_module.d.mts";
5
- import type { PlaceableObject } from "#client/canvas/placeables/_module.d.mts";
4
+ import type { CanvasGroupMixin, PrimaryCanvasGroup } from "#client/canvas/groups/_module.d.mts";
5
+ import type { placeables, primary } from "#client/canvas/_module.d.mts";
6
6
 
7
7
  declare class PrimaryCanvasObject {
8
8
  /** @privateRemarks All mixin classes should accept anything for its constructor. */
9
9
  constructor(...args: any[]);
10
10
 
11
- /**
12
- * @defaultValue `true`
13
- * @privateRemarks Actually an override of the property on `PIXI.DisplayObject`
14
- */
15
- cullable: boolean;
16
-
17
11
  /**
18
12
  * An optional reference to the object that owns this PCO.
19
13
  * This property does not affect the behavior of the PCO itself.
20
14
  * @defaultValue `null`
21
- * @privateRemarks Foundry types as `*`, but in practice, it will only ever be a `Drawing` (via `PrimaryGraphics`),
22
- * or a `Token`, `Tile`, or the `PrimaryCanvasGroup` (via `PrimarySpriteMesh`), or its default value `null`
15
+ * @remarks Foundry types as `*`, but in core usage, it is only ever:
16
+ * - {@linkcode placeables.Drawing | Drawing} ({@linkcode PrimaryCanvasGroup.addDrawing | PrimaryCanvasGroup#addDrawing} creates a {@linkcode primary.PrimaryGraphics | PrimaryGraphics})
17
+ * - {@linkcode placeables.Token | Token} (`Token##handleTransitionChanges` and {@linkcode PrimaryCanvasGroup.addToken | PrimaryCanvasGroup#addToken} create {@linkcode primary.PrimarySpriteMesh | PrimarySpriteMesh}es)
18
+ * - {@linkcode placeables.Tile | Tile} ({@linkcode PrimaryCanvasGroup.addTile | PrimaryCanvasGroup#addTile} creates a `PrimarySpriteMesh`)
19
+ * - {@linkcode placeables.Wall | Wall} ({@linkcode placeables.Wall.createDoorMeshes | Wall#createDoorMeshes} creates various {@linkcode foundry.canvas.containers.DoorMesh | DoorMesh}es)
20
+ * - {@linkcode PrimaryCanvasGroup} (`PrimaryCanvasGroup##drawBackground` and `##drawForeground` create `PrimarySpriteMesh`es)
21
+ * - `null`, its default
23
22
  */
24
- // TODO: (esheyw) Revisit the "any canvas group" type when groups are done
25
- object: PlaceableObject.Any | CanvasGroupMixin.AnyMixed | null;
23
+ object: PrimaryCanvasObjectMixin.OwningObject | null;
26
24
 
27
25
  /**
28
26
  * The elevation of this object.
@@ -56,20 +54,21 @@ declare class PrimaryCanvasObject {
56
54
  /**
57
55
  * Event fired when this display object is added to a parent.
58
56
  * @param parent - The new parent container.
59
- * @throws If `parent` is not `=== canvas.primary`
57
+ * @remarks Foundry types this as taking a {@linkcode PIXI.Container} but then is more specific internally
58
+ * @throws Unless `parent` is either `=== canvas.primary` or a {@linkcode foundry.canvas.primary.PrimaryCanvasContainer | PrimaryCanvasContainer}
60
59
  */
61
- protected _onAdded(parent: PIXI.Container): void;
60
+ protected _onAdded(parent: PrimaryCanvasObjectMixin.Parent): void;
62
61
 
63
62
  /**
64
63
  * Event fired when this display object is removed from its parent.
65
64
  * @param parent - Parent from which the PCO is removed.
66
65
  */
67
- protected _onRemoved(parent: PIXI.Container): void;
66
+ protected _onRemoved(parent: PrimaryCanvasObjectMixin.Parent): void;
68
67
 
69
- /** @see {@link CanvasTransformMixinClass.updateCanvasTransform | `CanvasTransformMixinClass#updateCanvasTransform`} */
68
+ /** @remarks See {@linkcode CanvasTransformMixinClass.updateCanvasTransform | CanvasTransformMixinClass#updateCanvasTransform} */
70
69
  updateCanvasTransform(): void;
71
70
 
72
- /** @see {@link CanvasTransformMixinClass._onCanvasBoundsUpdate | `CanvasTransformMixinClass#_onCanvasBoundsUpdate`} */
71
+ /** @remarks See {@linkcode CanvasTransformMixinClass._onCanvasBoundsUpdate | CanvasTransformMixinClass#_onCanvasBoundsUpdate} */
73
72
  protected _onCanvasBoundsUpdate(): void;
74
73
 
75
74
  /**
@@ -88,26 +87,20 @@ declare class PrimaryCanvasObject {
88
87
  renderDepthData(renderer: PIXI.Renderer): void;
89
88
 
90
89
  /**
91
- * @deprecated since v11, will be removed in v13
92
- * @remarks `"PrimaryCanvasObject#renderOcclusion is deprecated in favor of PrimaryCanvasObject#renderDepthData"`
93
- */
94
- renderOcclusion(renderer: PIXI.Renderer): void;
95
-
96
- /**
97
- * @deprecated since v12, will be removed in v14
98
- * @remarks `"PrimaryCanvasObject#document is deprecated."`
90
+ * @deprecated "`PrimaryCanvasObject#document` is deprecated." (since v12, until v14)
99
91
  */
100
- get document(): Document.Any | null;
92
+ get document(): placeables.PlaceableObject.AnyCanvasDocument | null;
101
93
 
102
94
  /**
103
- * @deprecated since v12, will be removed in v14
104
- * @remarks `"PrimaryCanvasObject#updateBounds is deprecated and has no effect."`
95
+ * @deprecated "`PrimaryCanvasObject#updateBounds` is deprecated and has no effect." (since v12, until v14)
105
96
  */
106
97
  updateBounds(): void;
98
+
99
+ #PrimaryCanvasObject: true;
107
100
  }
108
101
 
109
102
  declare class CanvasTransformMixinClass {
110
- /** @privateRemarks All mixin classses should accept anything for its constructor. */
103
+ /** @privateRemarks All mixin classes should accept anything for its constructor. */
111
104
  constructor(...args: any[]);
112
105
 
113
106
  /**
@@ -117,7 +110,8 @@ declare class CanvasTransformMixinClass {
117
110
 
118
111
  /**
119
112
  * The update ID of canvas transform matrix.
120
- * @privateRemarks Foundry marked `@internal`, technically accessed externally via `this.parent._convasTranformID` in `updateCanvasTransform`
113
+ * @internal
114
+ * @remarks Accessed externally via `this.parent._canvasTransformID` in {@linkcode updateCanvasTransform}
121
115
  */
122
116
  protected _canvasTransformID: number;
123
117
 
@@ -165,10 +159,9 @@ declare class CanvasTransformMixinClass {
165
159
  }
166
160
 
167
161
  /**
168
- * A mixin which decorates a DisplayObject with additional properties expected for rendering in the PrimaryCanvasGroup.
169
- * @param DisplayObject - The parent DisplayObject class being mixed
170
- * @returns A DisplayObject subclass mixed with PrimaryCanvasObject features
171
- * @privateRemarks Despite naming the argument "DisplayObject", it's typed as only taking `PIXI.Container`s, which matches core's usage
162
+ * A mixin which decorates a {@linkcode PIXI.DisplayObject | DisplayObject} with additional properties expected for rendering in the {@linkcode PrimaryCanvasGroup}.
163
+ * @param DisplayObject - The parent `DisplayObject` class being mixed
164
+ * @privateRemarks Despite naming the argument `DisplayObject`, it's typed as only taking `PIXI.Container`s, which matches core's usage
172
165
  */
173
166
  declare function PrimaryCanvasObjectMixin<BaseClass extends PrimaryCanvasObjectMixin.BaseClass>(
174
167
  DisplayObject: BaseClass,
@@ -180,13 +173,21 @@ declare namespace PrimaryCanvasObjectMixin {
180
173
  interface AnyMixed extends FixedInstanceType<AnyMixedConstructor> {}
181
174
 
182
175
  type BaseClass = PIXI.Container.AnyConstructor;
176
+
177
+ /**
178
+ * @remarks {@linkcode PrimaryCanvasObject._onAdded | PrimaryCanvasObject#_onAdded} throws if not passed a either {@linkcode PrimaryCanvasContainer}
179
+ * or whatever {@linkcode canvas.primary} currently is, which presumably will be a {@linkcode PrimaryCanvasGroup}
180
+ */
181
+ type Parent = PrimaryCanvasGroup.Any | primary.PrimaryCanvasContainer.Any;
182
+
183
+ /** @remarks See {@linkcode PrimaryCanvasObject.object | PrimaryCanvasObject#object} remarks */
184
+ type OwningObject = placeables.PlaceableObject.Any | CanvasGroupMixin.AnyMixed;
183
185
  }
184
186
 
185
187
  /**
186
- * A mixin which decorates a DisplayObject with additional properties for canvas transforms and bounds.
187
- * @param DisplayObject - The parent DisplayObject class being mixed
188
- * @returns A DisplayObject subclass mixed with CanvasTransformMixin features
189
- * @privateRemarks Despite naming the argument "DisplayObject", it's typed as only taking `PIXI.Container`s, which matches core's usage
188
+ * A mixin which decorates a {@linkcode PIXI.DisplayObject | DisplayObject} with additional properties for canvas transforms and bounds.
189
+ * @param DisplayObject - The parent `DisplayObject` class being mixed
190
+ * @privateRemarks Despite naming the argument `DisplayObject`, it's typed as only taking `PIXI.Container`s, which matches core's usage
190
191
  */
191
192
  declare function CanvasTransformMixin<BaseClass extends CanvasTransformMixin.BaseClass>(
192
193
  DisplayObject: BaseClass,
@@ -1,26 +1,27 @@
1
- import type { Identity, NullishProps } from "#utils";
1
+ import type { Identity, InexactPartial } from "#utils";
2
2
  import type { PrimaryCanvasObjectMixin } from "./_module.d.mts";
3
3
  import type { PlaceableObject } from "#client/canvas/placeables/_module.d.mts";
4
4
 
5
5
  /**
6
6
  * A basic PCO which is handling drawings of any shape.
7
7
  */
8
- declare class PrimaryGraphics extends PrimaryCanvasObjectMixin(PIXI.Graphics) {
8
+ declare class PrimaryGraphics extends PrimaryCanvasObjectMixin(PIXI.smooth.SmoothGraphics) {
9
9
  /**
10
10
  * @param options - A config object
11
+ * @remarks Passing a {@linkcode PIXI.smooth.SmoothGraphicsGeometry} instead of an `options` should be supported here,
12
+ * but has been disabled due to a core bug: {@link https://github.com/foundryvtt/foundryvtt/issues/13170}
13
+ *
14
+ * If you need to pass a specific geometry instead of using a default `new SmoothGraphicsGeometry`, pass it as `options.geometry`.
11
15
  */
12
- constructor(
13
- /**
14
- * @remarks Passing `null`, or an object where the `geometry` property is either missing or nullish, will result in an effective default of `new PIXI.GraphicsGeometry()`
15
- */
16
- options?: PIXI.GraphicsGeometry | PrimaryGraphics.ConstructorOptions | null,
17
- );
16
+ constructor(options?: PrimaryGraphics.ConstructorOptions);
18
17
 
19
- override _calculateCanvasBounds(): void;
18
+ protected override _calculateCanvasBounds(): void;
20
19
 
21
20
  override updateCanvasTransform(): void;
22
21
 
23
22
  override containsCanvasPoint(point: PIXI.IPointData): boolean;
23
+
24
+ #PrimaryGraphics: true;
24
25
  }
25
26
 
26
27
  declare namespace PrimaryGraphics {
@@ -28,28 +29,31 @@ declare namespace PrimaryGraphics {
28
29
  interface AnyConstructor extends Identity<typeof AnyPrimaryGraphics> {}
29
30
 
30
31
  /** @internal */
31
- type _ConstructorOptions = NullishProps<{
32
+ type _ConstructorOptions = InexactPartial<{
32
33
  /**
33
34
  * A geometry passed to the graphics.
34
- * @defaultValue `new PIXI.GraphicsGeometry()`
35
- * @remarks Default via calling `super(geometry)` with a falsey value
35
+ * @defaultValue {@linkcode PIXI.smooth.SmoothGraphicsGeometry | new PIXI.smooth.SmoothGraphicsGeometry()}
36
+ * @remarks Default applied in the {@linkcode PIXI.smooth.SmoothGraphics} constructor.
37
+ *
38
+ * @privateRemarks Foundry types this incorrectly because they didn't update it when they switched base classes:
39
+ * {@link https://github.com/foundryvtt/foundryvtt/issues/13170}
36
40
  */
37
- geometry: PIXI.GraphicsGeometry;
41
+ geometry: PIXI.smooth.SmoothGraphicsGeometry;
38
42
 
39
43
  /**
40
44
  * The name of the PCO.
41
45
  * @defaultValue `null`
42
- * @remarks Default via `?? null` in function body
43
46
  */
44
- name: string;
47
+ name: string | null;
45
48
 
46
49
  /**
47
50
  * Any object that owns this PCO.
48
51
  * @defaultValue `null`
49
- * @remarks Default via `?? null` in function body
50
- * @privateRemarks Foundry types as `*`, but the only place they use this class is for `Drawing`s
52
+ * @remarks Foundry types as `*`, but the only place this class sees core use it's in {@linkcode PrimaryCanvasGroup.addDrawing | PrimaryCanvasGroup#addDrawing}
53
+ *
54
+ * See {@linkcode PrimaryCanvasObjectMixin.AnyMixed.object | PrimaryCanvasObject#object}
51
55
  */
52
- object: PlaceableObject.Any;
56
+ object: PlaceableObject.Any | null;
53
57
  }>;
54
58
 
55
59
  interface ConstructorOptions extends _ConstructorOptions {}
@@ -1,4 +1,4 @@
1
- import type { FixedInstanceType, Mixin, NullishProps } from "#utils";
1
+ import type { FixedInstanceType, InexactPartial, Mixin } from "#utils";
2
2
  import type { PrimaryCanvasObjectMixin } from "./_module.d.mts";
3
3
  import type { Token } from "#client/canvas/placeables/_module.d.mts";
4
4
 
@@ -21,7 +21,7 @@ declare class PrimaryOccludableObject {
21
21
 
22
22
  /**
23
23
  * The occlusion mode of this occludable object.
24
- * @defaultValue `CONST.OCCLUSION_MODES.NONE`
24
+ * @defaultValue {@linkcode CONST.OCCLUSION_MODES.NONE}
25
25
  */
26
26
  occlusionMode: CONST.OCCLUSION_MODES;
27
27
 
@@ -39,7 +39,6 @@ declare class PrimaryOccludableObject {
39
39
 
40
40
  /**
41
41
  * Fade this object on hover?
42
- * @defaultValue `true`
43
42
  */
44
43
  get hoverFade(): boolean;
45
44
 
@@ -55,9 +54,11 @@ declare class PrimaryOccludableObject {
55
54
  * vision: 0.0
56
55
  * }
57
56
  * ```
58
- * @privateRemarks Foundry marked `@internal`
57
+ * @internal
58
+ * @remarks Accessed externally in {@linkcode foundry.canvas.rendering.shaders.DepthSamplerShader._preRender | DepthSamplerShader#_preRender}
59
+ * and {@linkcode foundry.canvas.rendering.shaders.OccludableSamplerShader._preRender | OccludableSamplerShader#_preRender}
59
60
  */
60
- _occlusionState: PrimaryOccludableObjectMixin.OcclusionState;
61
+ protected _occlusionState: PrimaryOccludableObjectMixin.OcclusionState;
61
62
 
62
63
  /**
63
64
  * The state of hover-fading.
@@ -66,21 +67,24 @@ declare class PrimaryOccludableObject {
66
67
  * {
67
68
  * hovered: false,
68
69
  * hoveredTime: 0,
70
+ * _hoveredTime: 0,
69
71
  * faded: false,
70
72
  * fading: false,
71
73
  * fadingTime: 0,
72
74
  * occlusion: 0.0
73
75
  * }
74
76
  * ```
75
- * @privateRemarks Foundry marked `@internal`
77
+ * @internal
78
+ * @remarks Properties accessed and set remotely in {@linkcode foundry.canvas.groups.PrimaryCanvasGroup._onMouseMove | PrimaryCanvasGroup#_onMouseMove}
79
+ * and `##updateHoveredObjects`
76
80
  */
77
- _hoverFadeState: PrimaryOccludableObjectMixin.HoverFadeState;
81
+ protected _hoverFadeState: PrimaryOccludableObjectMixin.HoverFadeState;
78
82
 
79
83
  /**
80
84
  * Get the blocking option bitmask value.
81
- * @privateRemarks Foundry marked `@internal`
85
+ * @internal
82
86
  */
83
- get _restrictionState(): number;
87
+ protected get _restrictionState(): number;
84
88
 
85
89
  /**
86
90
  * Is this object blocking light?
@@ -106,13 +110,19 @@ declare class PrimaryOccludableObject {
106
110
  * change PCO appearance.
107
111
  * Uses a 50ms debounce threshold.
108
112
  * Objects which are in the hovered state remain occluded until their hovered state ends.
109
- * @remarks Actually the return value of an arrow function passed to `foundry.utils.debounce` with a timeout of 50ms
113
+ * @remarks Actually the return value of an arrow function passed to {@linkcode foundry.utils.debounce} with a timeout of 50ms
110
114
  */
111
115
  debounceSetOcclusion: (occluded: boolean) => boolean;
112
116
 
117
+ /**
118
+ * @remarks Actually an override of {@linkcode foundry.canvas.primary.CanvasTransformMixin.AnyMixed.updateCanvasTransform | CanvasTransformMixin#updateCanvasTransform}
119
+ */
113
120
  updateCanvasTransform(): void;
114
121
 
115
- _shouldRenderDepth(): boolean;
122
+ /**
123
+ * @remarks Actually an override of {@linkcode foundry.canvas.primary.PrimaryCanvasObjectMixin.AnyMixed._shouldRenderDepth | PrimaryCanvasObjectMixin#_shouldRenderDepth}
124
+ */
125
+ protected _shouldRenderDepth(): boolean;
116
126
 
117
127
  /**
118
128
  * Test whether a specific Token occludes this PCO.
@@ -124,28 +134,24 @@ declare class PrimaryOccludableObject {
124
134
  testOcclusion(token: Token.Implementation, options?: PrimaryOccludableObjectMixin.TestOcclusionOptions): boolean;
125
135
 
126
136
  /**
127
- * @deprecated since v12, will be removed in v14
128
- * @remarks "`#roof` is deprecated in favor of more granular options: `#restrictsLight` and `#restrictsWeather`"
137
+ * @deprecated "`#roof` is deprecated in favor of more granular options: {@linkcode PrimaryOccludableObject.restrictsLight | #restrictsLight}
138
+ * and {@linkcode PrimaryOccludableObject.restrictsWeather | #restrictsWeather}" (since v12, until v14)
129
139
  */
130
140
  get roof(): boolean;
131
141
 
132
142
  /**
133
- * @deprecated since v12, until v14
134
- * @remarks "#roof is deprecated in favor of more granular options: #restrictsLight and #restrictsWeather"
143
+ * @deprecated "`#roof` is deprecated in favor of more granular options: {@linkcode PrimaryOccludableObject.restrictsLight | #restrictsLight}
144
+ * and {@linkcode PrimaryOccludableObject.restrictsWeather | #restrictsWeather}" (since v12, until v14)
135
145
  */
136
146
  set roof(enabled);
137
147
 
138
148
  /**
139
149
  * @deprecated since v12, will be removed in v14
140
- * @remarks "#containsPixel is deprecated. Use #containsCanvasPoint instead."
150
+ * @remarks "`#containsPixel` is deprecated. Use {@linkcode PrimaryOccludableObject.containsCanvasPoint | #containsCanvasPoint} instead."
141
151
  */
142
152
  containsPixel(x: number, y: number, alphaThreshold?: number): boolean;
143
153
 
144
- /**
145
- * @deprecated since v11, will be removed in v13
146
- * @remarks "PrimaryCanvasObject#renderOcclusion is deprecated in favor of PrimaryCanvasObject#renderDepth"
147
- */
148
- renderOcclusion(renderer: PIXI.Renderer): void;
154
+ #PrimaryOccludableObject: true;
149
155
  }
150
156
 
151
157
  declare function PrimaryOccludableObjectMixin<BaseClass extends PrimaryOccludableObjectMixin.BaseClass>(
@@ -159,10 +165,10 @@ declare namespace PrimaryOccludableObjectMixin {
159
165
  type BaseClass = PIXI.Container.AnyConstructor;
160
166
 
161
167
  /** @internal */
162
- type _TestOcclusionOptions = NullishProps<{
168
+ type _TestOcclusionOptions = InexactPartial<{
163
169
  /**
164
170
  * Test corners of the hit-box in addition to the token center?
165
- * @defaultValue `0`
171
+ * @defaultValue `true`
166
172
  */
167
173
  corners: boolean;
168
174
  }>;
@@ -182,22 +188,46 @@ declare namespace PrimaryOccludableObjectMixin {
182
188
  }
183
189
 
184
190
  interface HoverFadeState {
185
- /** The hovered state */
191
+ /**
192
+ * The hovered state
193
+ * @defaultValue `false`
194
+ */
186
195
  hovered: boolean;
187
196
 
188
- /** The last time when a mouse event was hovering this object */
197
+ /**
198
+ * The last time when a mouse event was hovering this object
199
+ * @defaultValue `0`
200
+ */
189
201
  hoveredTime: number;
190
202
 
191
- /** The faded state */
203
+ /**
204
+ * @defaultValue `0`
205
+ * @remarks Gets set to the previous `hoveredTime` in {@linkcode foundry.canvas.groups.PrimaryCanvasGroup._onMouseMove | PrimaryCanvasGroup#_onMouseMove}
206
+ */
207
+ _hoveredTime: number;
208
+
209
+ /**
210
+ * The faded state
211
+ * @defaultValue `false`
212
+ */
192
213
  faded: boolean;
193
214
 
194
- /** The fading state */
215
+ /**
216
+ * The fading state
217
+ * @defaultValue `false`
218
+ */
195
219
  fading: boolean;
196
220
 
197
- /** The time the fade animation started */
221
+ /**
222
+ * The time the fade animation started
223
+ * @defaultValue `0`
224
+ */
198
225
  fadingTime: number;
199
226
 
200
- /** The amount of occlusion */
227
+ /**
228
+ * The amount of occlusion
229
+ * @defaultValue `0`
230
+ */
201
231
  occlusion: number;
202
232
  }
203
233
  }