@league-of-foundry-developers/foundry-vtt-types 13.346.0-beta.20250718083253 → 13.346.0-beta.20250719181625

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 (41) hide show
  1. package/package.json +1 -1
  2. package/src/foundry/client/canvas/containers/advanced/cached-container.d.mts +15 -15
  3. package/src/foundry/client/canvas/containers/advanced/full-canvas-mixin.d.mts +2 -2
  4. package/src/foundry/client/canvas/containers/elements/control-icon.d.mts +12 -32
  5. package/src/foundry/client/canvas/containers/elements/cursor.d.mts +14 -1
  6. package/src/foundry/client/canvas/containers/elements/door-control.d.mts +2 -2
  7. package/src/foundry/client/canvas/containers/elements/door-mesh.d.mts +215 -3
  8. package/src/foundry/client/canvas/containers/elements/grid-highlight.d.mts +3 -3
  9. package/src/foundry/client/canvas/containers/elements/grid-mesh.d.mts +4 -4
  10. package/src/foundry/client/canvas/containers/elements/particles/leaves.d.mts +7 -6
  11. package/src/foundry/client/canvas/containers/elements/particles/particle-effect.d.mts +4 -5
  12. package/src/foundry/client/canvas/containers/elements/point-source-mesh.d.mts +18 -23
  13. package/src/foundry/client/canvas/containers/elements/precise-text.d.mts +9 -10
  14. package/src/foundry/client/canvas/containers/elements/quad-mesh.d.mts +1 -2
  15. package/src/foundry/client/canvas/containers/elements/resize-handle.d.mts +37 -11
  16. package/src/foundry/client/canvas/containers/elements/sprite-mesh.d.mts +34 -26
  17. package/src/foundry/client/canvas/layers/masks/depth.d.mts +1 -1
  18. package/src/foundry/client/canvas/layers/masks/occlusion.d.mts +1 -1
  19. package/src/foundry/client/canvas/primary/primary-canvas-container.d.mts +32 -0
  20. package/src/foundry/client/canvas/primary/primary-canvas-object.d.mts +39 -38
  21. package/src/foundry/client/canvas/primary/primary-graphics.d.mts +22 -18
  22. package/src/foundry/client/canvas/primary/primary-occludable-object.d.mts +59 -29
  23. package/src/foundry/client/canvas/primary/primary-particle-effect.d.mts +51 -0
  24. package/src/foundry/client/canvas/primary/primary-sprite-mesh.d.mts +72 -66
  25. package/src/foundry/client/config.d.mts +444 -311
  26. package/src/foundry/client/documents/collections/actors.d.mts +2 -2
  27. package/src/foundry/client/documents/collections/card-stacks.d.mts +2 -2
  28. package/src/foundry/client/documents/collections/chat-messages.d.mts +2 -2
  29. package/src/foundry/client/documents/collections/combat-encounters.d.mts +2 -2
  30. package/src/foundry/client/documents/collections/fog-explorations.d.mts +2 -2
  31. package/src/foundry/client/documents/collections/folders.d.mts +2 -2
  32. package/src/foundry/client/documents/collections/items.d.mts +2 -2
  33. package/src/foundry/client/documents/collections/journal.d.mts +2 -2
  34. package/src/foundry/client/documents/collections/macros.d.mts +2 -2
  35. package/src/foundry/client/documents/collections/playlists.d.mts +2 -2
  36. package/src/foundry/client/documents/collections/roll-tables.d.mts +2 -2
  37. package/src/foundry/client/documents/collections/scenes.d.mts +2 -2
  38. package/src/foundry/client/documents/collections/users.d.mts +2 -2
  39. package/src/foundry/client/documents/collections/world-settings.d.mts +2 -2
  40. package/src/foundry/client/documents/wall.d.mts +13 -2
  41. package/src/foundry/common/abstract/document.d.mts +22 -12
@@ -2,7 +2,7 @@ import type { Identity } from "#utils";
2
2
  import type { AdaptiveLightingShader } from "#client/canvas/rendering/shaders/_module.d.mts";
3
3
 
4
4
  /**
5
- * Extension of a PIXI.Mesh, with the capabilities to provide a snapshot of the framebuffer.
5
+ * Extension of a PIXI.Mesh for PointEffectSources.
6
6
  * @remarks Foundry only uses this with `AdaptiveLightingShader` subclasses, thus the type param default
7
7
  */
8
8
  declare class PointSourceMesh<Shader extends PIXI.Shader = AdaptiveLightingShader> extends PIXI.Mesh<Shader> {
@@ -12,40 +12,36 @@ declare class PointSourceMesh<Shader extends PIXI.Shader = AdaptiveLightingShade
12
12
  constructor(geometry: PIXI.Geometry, shader: Shader, state?: PIXI.State, drawMode?: PIXI.DRAW_MODES);
13
13
 
14
14
  /**
15
- * To store the previous blend mode of the last renderer PointSourceMesh.
16
- * @privateRemarks Despite being `protected`, this is accessed externally in `CanvasIlluminationEffects#render`
15
+ * @deprecated Removed without replacement in v13 (this warning will be removed in v14)
17
16
  */
18
- protected static _priorBlendMode: PIXI.BLEND_MODES | undefined;
17
+ protected static _priorBlendMode: never;
19
18
 
20
- /**
21
- * The current texture used by the mesh.
22
- * @privateRemarks Despite being `protected`, this is accessed externally in `CanvasIlluminationEffects#render`
23
- */
24
- protected static _currentTexture: PIXI.Texture | undefined;
19
+ protected static _currentTexture: never;
25
20
 
26
21
  /**
27
- * The transform world ID of the bounds.
28
- * @defaultValue `-1`
22
+ * @deprecated Made hard private in v13 (this warning will be removed in v14)
29
23
  */
30
- _worldID: number;
24
+ _worldID: never;
31
25
 
32
26
  /**
33
- * The geometry update ID of the bounds.
34
- * @defaultValue `-1`
27
+ * @deprecated Made hard private in v13 (this warning will be removed in v14)
35
28
  */
36
- _updateID: number;
29
+ _updateID: never;
37
30
 
38
31
  override get geometry(): PIXI.Geometry;
39
32
 
40
- set geometry(value: PIXI.Geometry);
33
+ override set geometry(value: PIXI.Geometry);
41
34
 
42
- /** @throws You can't add children to a PointSourceMesh. */
35
+ /** @throws You can't add children to a {@linkcode PointSourceMesh}. */
43
36
  override addChild(): never;
44
37
 
45
- /** @throws You can't add children to a PointSourceMesh. */
38
+ /** @throws You can't add children to a {@linkcode PointSourceMesh}. */
46
39
  override addChildAt(): never;
47
40
 
48
- protected override _render(renderer: PIXI.Renderer): void;
41
+ /**
42
+ * @deprecated Removed without replacement in v13 (this warning will be removed in v14)
43
+ */
44
+ protected override _render(renderer: never): never;
49
45
 
50
46
  override calculateBounds(): void;
51
47
 
@@ -53,12 +49,11 @@ declare class PointSourceMesh<Shader extends PIXI.Shader = AdaptiveLightingShade
53
49
 
54
50
  /** The local bounds need to be drawn from the underlying geometry. */
55
51
  override getLocalBounds(
56
- /**
57
- * @defaultValue `new PIXI.Rectangle()`
58
- * @remarks Default provided by `??=` in function body. `null` would be allowable here but breaks inheritance
59
- */
52
+ /** @defaultValue `new PIXI.Rectangle()` */
60
53
  rect?: PIXI.Rectangle,
61
54
  ): PIXI.Rectangle;
55
+
56
+ #PointSourceMesh: true;
62
57
  }
63
58
 
64
59
  declare namespace PointSourceMesh {
@@ -1,4 +1,4 @@
1
- import type { Identity, InexactPartial, NullishProps } from "#utils";
1
+ import type { Identity, InexactPartial } from "#utils";
2
2
 
3
3
  /**
4
4
  * An extension of the default PIXI.Text object which forces double resolution.
@@ -15,7 +15,7 @@ declare class PreciseText extends PIXI.Text {
15
15
 
16
16
  /**
17
17
  * Prepare a TextStyle object which merges the canvas defaults with user-provided options
18
- * @param anchor - A text anchor point from CONST.TEXT_ANCHOR_POINTS
18
+ * @param anchor - A text anchor point from {@linkcode CONST.TEXT_ANCHOR_POINTS}
19
19
  * @param options - Additional options merged with the default TextStyle
20
20
  * @returns The prepared TextStyle
21
21
  */
@@ -27,16 +27,15 @@ declare namespace PreciseText {
27
27
  interface AnyConstructor extends Identity<typeof AnyPreciseText> {}
28
28
 
29
29
  /** @internal */
30
- type _GetTextStyleOptions = NullishProps<{
30
+ type _GetTextStyleOptions = InexactPartial<{
31
31
  /**
32
- * A text anchor point from CONST.TEXT_ANCHOR_POINTS
33
- * @remarks Only checked againt `.RIGHT` and `.LEFT`, and only if an `align` key is omitted
32
+ * A text anchor point from {@linkcode CONST.TEXT_ANCHOR_POINTS}
33
+ * @remarks Only checked against `.RIGHT` and `.LEFT`, and only if an `align` key is omitted
34
34
  */
35
- anchor: foundry.CONST.TEXT_ANCHOR_POINTS;
36
- }> &
37
- // Can't be NullishProps because keys are only checked for `!== undefined` in PIXI
38
- InexactPartial<PIXI.ITextStyle>;
39
- interface GetTextStyleOptions extends _GetTextStyleOptions {}
35
+ anchor: CONST.TEXT_ANCHOR_POINTS;
36
+ }>;
37
+
38
+ interface GetTextStyleOptions extends _GetTextStyleOptions, InexactPartial<PIXI.ITextStyle> {}
40
39
  }
41
40
 
42
41
  export default PreciseText;
@@ -4,7 +4,6 @@ import type { AbstractBaseShader } from "#client/canvas/rendering/shaders/_modul
4
4
  /**
5
5
  * A basic rectangular mesh with a shader only. Does not natively handle textures (but a bound shader can).
6
6
  * Bounds calculations are simplified and the geometry does not need to handle texture coords.
7
- * @privateRemarks Ideally the `shaderClass` passed to the constructor and `get shader()` could be synced up, but `setShaderClass` removes that option
8
7
  */
9
8
  declare class QuadMesh extends PIXI.Container {
10
9
  /**
@@ -26,7 +25,7 @@ declare class QuadMesh extends PIXI.Container {
26
25
 
27
26
  /**
28
27
  * Initialize shader based on the shader class type.
29
- * @param shaderClass - Shader class used. Must inherit from AbstractBaseShader.
28
+ * @param shaderClass - Shader class used. Must inherit from {@linkcode AbstractBaseShader}.
30
29
  */
31
30
  setShaderClass(shaderClass: AbstractBaseShader.AnyConstructor): void;
32
31
 
@@ -1,9 +1,13 @@
1
- import type { Identity, NullishProps } from "#utils";
1
+ import type { Identity, InexactPartial } from "#utils";
2
2
  import type { Canvas } from "#client/canvas/_module.d.mts";
3
3
 
4
- declare class ResizeHandle extends PIXI.Graphics {
4
+ /**
5
+ * A class based on PIXI.Graphics, that allows to create a resize handle in the desired area.
6
+ */
7
+ declare class ResizeHandle extends PIXI.smooth.SmoothGraphics {
5
8
  /**
6
- * @param handlers - (default: `{}`)
9
+ * @param offset - A two-element array [xFactor, yFactor] which defines the normalized position of this handle relative to the bounding box.
10
+ * @param handlers - An object of optional handler functions.
7
11
  */
8
12
  constructor(offset: ResizeHandle.Offsets, handlers?: ResizeHandle.Handlers);
9
13
 
@@ -17,18 +21,30 @@ declare class ResizeHandle extends PIXI.Graphics {
17
21
  */
18
22
  active: boolean;
19
23
 
24
+ /**
25
+ * Refresh the position and hit area of this handle based on the provided bounding box.
26
+ * @param bounds - The bounding box in which this handle operates.
27
+ */
20
28
  refresh(bounds: Canvas.Rectangle): void;
21
29
 
22
30
  /**
23
- * @param aspectRatio - (default: `null`)
31
+ * Compute updated dimensions for an object being resized, respecting optional constraints.
32
+ * @param current - The current geometric state of the object
33
+ * @param origin - The original position and dimensions used for reference
34
+ * @param destination - The mouse (or pointer) destination coordinates.
35
+ * @param options - Additional options.
36
+ * @returns An object containing the adjusted `{x, y, width, height}`.
24
37
  */
25
38
  updateDimensions(
26
39
  current: Canvas.Rectangle,
27
40
  origin: Canvas.Rectangle,
28
- destination: Canvas.Rectangle,
41
+ destination: ResizeHandle.Destination,
29
42
  options?: ResizeHandle.UpdateDimensionsOptions,
30
43
  ): Canvas.Rectangle;
31
44
 
45
+ /**
46
+ * Activate listeners for pointer events, enabling hover and mouse-down behavior on the resize handle.
47
+ */
32
48
  activateListeners(): void;
33
49
 
34
50
  /**
@@ -44,7 +60,7 @@ declare class ResizeHandle extends PIXI.Graphics {
44
60
  protected _onHoverOut(event: PIXI.FederatedEvent<PointerEvent>): void;
45
61
 
46
62
  /**
47
- * When we start a drag event - create a preview copy of the Tile for re-positioning
63
+ * When we start a drag event - create a preview copy of the `Tile` for re-positioning
48
64
  * @param event - The mousedown event
49
65
  */
50
66
  protected _onMouseDown(event: PIXI.FederatedEvent<PointerEvent>): void;
@@ -57,20 +73,30 @@ declare namespace ResizeHandle {
57
73
  type Offsets = [widthOffset: number, heightOffset: number];
58
74
 
59
75
  /** @internal */
60
- type _Handlers = NullishProps<{
61
- canDrag: () => boolean | null | void;
76
+ type _Handlers = InexactPartial<{
77
+ /** A function determining if this handle can initiate a drag. */
78
+ canDrag: () => boolean;
62
79
  }>;
63
80
 
64
81
  interface Handlers extends _Handlers {}
65
82
 
83
+ /** @privateRemarks {@linkcode ResizeHandle.updateDimensions | #updateDimensions} is too cool to just use a Point */
84
+ interface Destination {
85
+ /** The x-coordinate where the pointer was released. */
86
+ x: number;
87
+
88
+ /** The y-coordinate where the pointer was released. */
89
+ y: number;
90
+ }
91
+
66
92
  /** @internal */
67
- type _UpdateDimensionsOptions = NullishProps<{
93
+ type _UpdateDimensionsOptions = InexactPartial<{
68
94
  /**
69
- * Constrain the aspect ratio
95
+ * If provided, a numeric aspect ratio to maintain (width/height).
70
96
  * @defaultValue `null`
71
97
  * @remarks If truthy, will enforce the passed ratio, landscape if `width >= height`, portrait otherwise
72
98
  */
73
- aspectRatio: number;
99
+ aspectRatio: number | null;
74
100
  }>;
75
101
 
76
102
  interface UpdateDimensionsOptions extends _UpdateDimensionsOptions {}
@@ -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,