From 3cf31d01fc27ec88205dbbba255031d0b8c79245 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 13 Nov 2023 12:14:59 -0800 Subject: [PATCH 01/75] VisionSource --- .../client/pixi/sources/vision-source.d.ts | 148 ++++++++++++++---- 1 file changed, 115 insertions(+), 33 deletions(-) diff --git a/src/foundry/client/pixi/sources/vision-source.d.ts b/src/foundry/client/pixi/sources/vision-source.d.ts index 7272da45b..46084fd52 100644 --- a/src/foundry/client/pixi/sources/vision-source.d.ts +++ b/src/foundry/client/pixi/sources/vision-source.d.ts @@ -1,4 +1,5 @@ import type { ConfiguredObjectClassForName } from "../../../../types/helperTypes"; +import type { VisionMode } from "../../config"; declare global { interface VisionSourceData extends Exclude { @@ -18,8 +19,14 @@ declare global { /** The allowed radius of bright vision or illumination */ bright: number; - /** The allowed radius of dim vision or illumination */ - dim: number; + /** The allowed radius of vision */ + radius: number; + + /** A secondary radius used for limited angles */ + externalRadius: number; + + /** Is this vision source a temporary preview? */ + isPreview: boolean; } /** @@ -29,52 +36,54 @@ declare global { /** @param object - The Token object that generates this vision source */ constructor(object: InstanceType>); - /** - * The current vision mesh for this source - * @defaultValue `this._createMesh(AdaptiveIlluminationShader)` - */ - illumination: PIXI.Mesh; + /** The current background mesh for this source */ + background: PIXI.Mesh | null; + + /** The current vision illumination mesh for this source */ + illumination: PIXI.Mesh | null; + + /** The current vision coloration mesh for this source */ + coloration: PIXI.Mesh | null; + + /** The vision mode linked to this VisionSource */ + visionMode: VisionMode | null; - static override sourceType: "vision"; + static override sourceType: "sight"; /** * Keys in the VisionSourceData structure which, when modified, change the appearance of the source - * @defaultValue `["dim", "bright"]` + * @defaultValue `["radius", "color", "attenuation", "brightness", "contrast", "saturation", "visionMode"]` * @internal */ protected static _appearanceKeys: string[]; + static override EDGE_OFFSET: -2; + /** * The object of data which configures how the source is rendered * @defaultValue `{}` */ data: Partial; - /** - * The ratio of dim:bright as part of the source radius - * @defaultValue `undefined` - */ - ratio: number | undefined; - - /** - * The rendered field-of-vision texture for the source for use within shaders. - * @defaultValue `undefined` - */ - fovTexture: PIXI.RenderTexture | undefined; + /** The constrained LOS polygon that is generated by the origin and radius of this source. */ + fov: PointSourcePolygon; /** * Track which uniforms need to be reset - * @defaultValue `{ illumination: true }` + * @defaultValue `{ background: false, illumination: false, coloration: false }` * @internal */ - protected _resetUniforms: { illumination: boolean }; + protected _resetUniforms: { background: boolean; illumination: boolean; coloration: boolean }; /** * To track if a source is temporarily shutdown to avoid glitches - * @defaultValue `{ illumination: false }` + * @defaultValue `{ background: false, illumination: false, coloration: false }` * @internal */ - protected _shutdown: { illumination: boolean }; + protected _shutdown: { background: boolean; illumination: boolean; coloration: boolean }; + + /** Is this VisionSource a temporary preview which should not produce fog exploration? */ + get isPreview(): boolean; /** * Initialize the source with provided object data. @@ -83,7 +92,23 @@ declare global { */ initialize(data?: Partial): this; - fov?: PIXI.Circle; + /** Responsible for assigning the Vision Mode and handling exceptions based on vision special status. */ + protected _initializeVisionMode(): void; + + /** If this vision source background is rendered into the lighting container. */ + get preferred(): boolean; + + /** {@inheritdoc} */ + override _getPolygonConfiguration(): PointSourcePolygonConfig; + + /** Create a restricted FOV polygon by limiting the radius of the unrestricted LOS polygon. */ + protected _createRestrictedPolygon(): PointSourcePolygon; + + /** + * Initialize the shaders used for this source, swapping to a different shader if the vision effect has changed. + * @internal + */ + protected _initializeShaders(): void; /** * Initialize the blend mode and vertical sorting of this source relative to others in the container. @@ -94,30 +119,87 @@ declare global { /** * Process new input data provided to the LightSource. * @param data - Initial data provided to the vision source - * @returns The changes compared to the prior data + * @returns The changes compared to the prior data * @internal */ protected _initializeData(data: Partial): Partial; + /** {@inheritdoc} */ + _createMeshes(): void; + + /** {@inheritdoc} */ + destroy(): void; + + /** {@inheritdoc} */ + refreshSource(): void; + + /** + * Render the containers used to represent this light source within the LightingLayer. + */ + drawMeshes(): VisionSource.LightContainer; + /** - * Draw the display of this source to remove darkness from the LightingLayer illumination container. - * @see LightSource#drawLight + * Draw the background mesh which provide special vision. * @returns The rendered light container */ - drawVision(): PIXI.Container | null; + drawBackground(): PIXI.Mesh | null; + + /** + * Draw the illumination mesh which provide vision. + * @returns The rendered light container + */ + drawVision(): PIXI.Mesh | null; + + /** + * Draw and return a container used to depict the visible color tint of the light source on the LightingLayer + * @returns An updated color container for the source + */ + drawColor(): PIXI.Mesh | null; + + /* -------------------------------------------- */ + /* Shader Management */ + /* -------------------------------------------- */ + + /** Update all layer uniforms. */ + protected _updateUniforms(): void; + + /** + * Update shader uniforms by providing data from this PointSource + * @internal + */ + protected _updateColorationUniforms(): void; /** - * Draw a Container used for exploring the FOV area of Token sight in the SightLayer + * Update shader uniforms by providing data from this PointSource + * @internal */ - drawSight(): PIXI.Container; + protected _updateIlluminationUniforms(): void; /** * Update shader uniforms by providing data from this PointSource + * @internal + */ + protected _updateBackgroundUniforms(): void; + + /** + * Update shader uniforms shared by all shader types * @param shader - The shader being updated * @internal */ - protected _updateIlluminationUniforms(shader: AdaptiveIlluminationShader): void; + _updateCommonUniforms(shader: AdaptiveVisionShader): void; + + /** + * Generic time animation with Vision Sources. + * @param dt - Delta time. + */ + animateTime(dt): void; + } +} - protected override _drawRenderTextureContainer(): PIXI.Container; +declare namespace VisionSource { + interface LightContainer { + background: PIXI.Mesh | null; + vision: PIXI.Mesh | null; + color: PIXI.Mesh | null; } } From 1602a1faad209418b08bcb215d1935a9d1ee23d6 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 13 Nov 2023 12:26:39 -0800 Subject: [PATCH 02/75] Import TODO --- src/foundry/client/pixi/sources/vision-source.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/foundry/client/pixi/sources/vision-source.d.ts b/src/foundry/client/pixi/sources/vision-source.d.ts index 46084fd52..c46447a16 100644 --- a/src/foundry/client/pixi/sources/vision-source.d.ts +++ b/src/foundry/client/pixi/sources/vision-source.d.ts @@ -1,5 +1,7 @@ import type { ConfiguredObjectClassForName } from "../../../../types/helperTypes"; import type { VisionMode } from "../../config"; +// TODO: After #2084 +// import type { AdaptiveVisionShader } from "../webgl/shaders/vision" declare global { interface VisionSourceData extends Exclude { From a135d27104227636b7ff503aaf2e659c9581d045 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 15 Nov 2023 09:08:03 -0800 Subject: [PATCH 03/75] PointSource updates --- .../client/pixi/sources/base-source.d.ts | 114 ++++++++++++++---- .../client/pixi/sources/vision-source.d.ts | 2 +- 2 files changed, 90 insertions(+), 26 deletions(-) diff --git a/src/foundry/client/pixi/sources/base-source.d.ts b/src/foundry/client/pixi/sources/base-source.d.ts index 8faf8b440..c6ddb6c2f 100644 --- a/src/foundry/client/pixi/sources/base-source.d.ts +++ b/src/foundry/client/pixi/sources/base-source.d.ts @@ -3,7 +3,7 @@ */ declare abstract class PointSource { /** - * @param object - The object responsible for the PointSource + * @param object - The PlaceableObject which is the origin of this PointSource. */ constructor(object: PlaceableObject); @@ -20,15 +20,16 @@ declare abstract class PointSource { static sourceType: string | undefined; /** - * The default Geometry stored in the GPU for all Point Source meshes. + * A flag for whether this source is currently rendered or not. + * @defaultValue `false` */ - static GEOMETRY: PIXI.Geometry; + active: boolean; /** - * A flag for whether this source is currently active (rendered) or not - * @defaultValue `false` + * The animation configuration applied to this source + * @defaultValue `{}` */ - active: boolean; + animation: PointSource.PointSourceAnimationConfiguration; /** * The object of data which configures how this source is rendered @@ -49,25 +50,38 @@ declare abstract class PointSource { los: PointSourcePolygon | undefined; /** - * A Graphics object with pre-computed geometry used for masking based on line-of-sight. - * @defaultValue `new PIXI.LegacyGraphics()` + * PIXI Geometry generated to draw meshes. + * @defaultValue `null` + * @internal */ - losMask: PIXI.Graphics; + _sourceGeometry: PIXI.Geometry | null; /** - * Is the angle of emission for this source limited? - * @defaultValue `false` + * A Graphics object with pre-computed geometry used for masking based on line-of-sight. + * @defaultValue `new PIXI.LegacyGraphics()` */ - limited: boolean; + losMask: PIXI.Graphics; /** - * Boolean flags which control whether certain behaviors of the source must be enforced + * Additional information which controls whether certain behaviors of the source must be enforced * @defaultValue `{}` */ protected _flags: { renderFOV?: boolean; } & Record; + /** + * To track meshes initialization + * @defaultValue `false` + */ + protected _meshesInit: boolean; + + /** + * The offset in pixels applied to create soft edges. + * @defaultValue `-8` + */ + static EDGE_OFFSET: number; + /** * The x-coordinate of the point source origin. */ @@ -84,7 +98,18 @@ declare abstract class PointSource { get sourceType(): (typeof PointSource)["sourceType"]; /** - * A point is contained with the area of the source if it is within both the FOV circle as well as the LOS polygon. + * The elevation of the object bound to this base source, if any. + * Returns the canvas primary background elevation otherwise. + */ + get elevation(): number; + + /** + * If the source is animated or not. + */ + get isAnimated(): boolean; + + /** + * A point is contained with the area of the source if it is within both the FOV circle and the LOS polygon. * @param point - The point to test * @returns Is the point contained */ @@ -100,10 +125,32 @@ declare abstract class PointSource { abstract initialize(data?: Partial): this; /** - * Get power of 2 size pertaining to base-source radius and performance modes - * @returns The computed power of 2 size + * Refresh the state and uniforms of the BaseSource + */ + abstract refreshSource(): void; + + /** + * Create or update the source geometry with a polygon shape + * Triangulate the form and create buffers + * @param polygon- The pixi polygon + */ + protected _updateLosGeometry(polygon: PIXI.Polygon): void; + + /** + * Configure the parameters of the polygon that is generated for this source. + */ + protected abstract _getPolygonConfiguration(): PointSourcePolygonConfig; + + /** + * Create the LOS polygon for this Light Source instance using provided parameters. */ - getPowerOf2Size(): number; + protected _createPolygon(): PointSourcePolygon | PIXI.Polygon; + + /** + * Create or update the source geometry and create meshes if necessary + * @param polygon - A pixi polygon + */ + protected _initializeMeshes(polygon: PIXI.Polygon): void; /** * Create a new Mesh for this source using a provided shader class @@ -112,6 +159,11 @@ declare abstract class PointSource { */ protected _createMesh(shaderCls: ConstructorOf): PIXI.Mesh; + /** + * Create all meshes needed with this PointSource + */ + abstract _createMeshes(): void; + /** * Update the position and size of the mesh each time it is drawn. * @param mesh - The Mesh being updated @@ -120,18 +172,30 @@ declare abstract class PointSource { protected _updateMesh(mesh: PIXI.Mesh): PIXI.Mesh; /** - * Render this source to a texture which can be used for masking and blurring. + * Animate the BaseSource, if an animation is enabled and if it currently has rendered containers. + * @param dt - Delta time. */ - protected _renderTexture(): PIXI.RenderTexture; - - /** - * Create a container that should be rendered to the fov texture for this source - * @returns The drawn container for the render texture - */ - protected _drawRenderTextureContainer(): PIXI.Container; + animate(dt: number): void; } declare namespace PointSource { + interface PointSourceAnimationConfiguration { + /** The human-readable (localized) label for the animation */ + label?: string; + /** The animation function that runs every frame */ + animation?: Function; + /** A custom illumination shader used by this animation */ + illuminationShader?: AdaptiveIlluminationShader; + /** A custom coloration shader used by this animation */ + colorationShader?: AdaptiveColorationShader; + /** A custom background shader used by this animation */ + backgroundShader?: AdaptiveBackgroundShader; + /** The animation seed */ + seed?: number; + /** The animation time */ + time?: number; + } + interface Data { /** The x-coordinate of the source location */ x?: number; diff --git a/src/foundry/client/pixi/sources/vision-source.d.ts b/src/foundry/client/pixi/sources/vision-source.d.ts index ef88c98ef..c13222c5b 100644 --- a/src/foundry/client/pixi/sources/vision-source.d.ts +++ b/src/foundry/client/pixi/sources/vision-source.d.ts @@ -195,7 +195,7 @@ declare global { * Generic time animation with Vision Sources. * @param dt - Delta time. */ - animateTime(dt): void; + animateTime(dt: number): void; } } From ed10bd1eb30abc946787c7ac93b6e639283278ee Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 15 Nov 2023 09:12:49 -0800 Subject: [PATCH 04/75] Deprecations --- src/foundry/client/pixi/sources/base-source.d.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/foundry/client/pixi/sources/base-source.d.ts b/src/foundry/client/pixi/sources/base-source.d.ts index c6ddb6c2f..cf403de28 100644 --- a/src/foundry/client/pixi/sources/base-source.d.ts +++ b/src/foundry/client/pixi/sources/base-source.d.ts @@ -176,6 +176,21 @@ declare abstract class PointSource { * @param dt - Delta time. */ animate(dt: number): void; + + /** + * Get power of 2 size pertaining to base-source radius and performance modes + * @returns The computed power of 2 size + * @deprecated since v10, will be removed in v11. + */ + getPowerOf2Size(): number; + + /** + * Is the angle of emission for this source limited? + * @defaultValue `false` + * @deprecated since v10, will be removed in v12 + * @remarks `PointSource#limited is deprecated in favor of PointSourcePolygon#isConstrained.` + */ + limited: boolean; } declare namespace PointSource { From 8dc378490d0f115c52928d1692a61952e66e861b Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 15 Nov 2023 14:37:50 -0800 Subject: [PATCH 05/75] LightSource and GlobalLightSource --- .../client/pixi/sources/light-source.d.ts | 224 ++++++++++-------- .../client/pixi/sources/vision-source.d.ts | 14 +- 2 files changed, 131 insertions(+), 107 deletions(-) diff --git a/src/foundry/client/pixi/sources/light-source.d.ts b/src/foundry/client/pixi/sources/light-source.d.ts index 11d3a483b..7164d6be4 100644 --- a/src/foundry/client/pixi/sources/light-source.d.ts +++ b/src/foundry/client/pixi/sources/light-source.d.ts @@ -1,5 +1,7 @@ import type { ConfiguredObjectClassForName } from "../../../../types/helperTypes"; +// TODO: Define in client/pixi/layers/effects/visibility.js +type CanvasVisibilityTest = unknown; declare global { /** @see {@link foundry.data.LightData} */ interface LightSourceData extends PointSource.Data { @@ -31,7 +33,7 @@ declare global { * An animation configuration for the source * @defaultValue `{ type: null }` */ - animation: LightAnimationConfiguration; + animation: PointSource.PointSourceAnimationConfiguration; /** * The angle of emission for this point source @@ -75,8 +77,8 @@ declare global { */ dim: number; - /** Fade the difference between bright, dim, and dark gradually? */ - gradual: boolean; + /** Strength of the attenuation between bright, dim, and dark */ + attenuation: number; /** * The luminosity applied in the shader @@ -109,72 +111,49 @@ declare global { seed: number; } - interface LightAnimationConfiguration { - /** The human-readable (localized) label for the animation */ - label: string; - - /** The animation function that runs every frame */ - animation: (this: LightSource, dt: number, animation: LightAnimationConfiguration) => void; - - /** A custom illumination shader used by this animation */ - illuminationShader: AdaptiveIlluminationShader; - - /** A custom coloration shader used by this animation */ - colorationShader: AdaptiveColorationShader; - - /** A custom background shader used by this animation */ - backgroundShader: AdaptiveBackgroundShader; - - /** The animation seed */ - seed?: number; - - /** The animation time */ - time?: number; - - /** @defaultValue `null` */ - type?: keyof typeof CONFIG.Canvas.lightAnimations | null; - } - /** * A specialized subclass of the PointSource abstraction which is used to control the rendering of light sources. */ class LightSource extends PointSource { /** @param object - The light-emitting object that generates this light source */ - constructor(object: InstanceType>); + constructor(object: InstanceType>); + + /** + * The object type for a Light Source. + * This is a Scene in the case of a global light source + * This is an AmbientLight placeable object when the source is provided by an AmbientLightDocument + * This is a Token placeable object when the source is provided by a TokenDocument + */ + object: InstanceType>; /** * The light or darkness container for this source - * @defaultValue `this._createMesh(AdaptiveBackgroundShader)` + * @defaultValue `null)` */ - background: PIXI.Mesh; + background: PIXI.Mesh | null; /** * The light or darkness container for this source - * @defaultValue `this._createMesh(AdaptiveIlluminationShader)` + * @defaultValue `null` */ - illumination: PIXI.Mesh; + illumination: PIXI.Mesh | null; /** * This visible color container for this source - * @defaultValue `this._createMesh(AdaptiveColorationShader)` + * @defaultValue `null` */ - coloration: PIXI.Mesh; + coloration: PIXI.Mesh | null; + /** {@inheritdoc} */ static override sourceType: "light"; - /** - * Strength of the blur for light source edges - * @defaultValue `3` - */ - static BLUR_STRENGTH: number; - /** * Keys in the LightSourceData structure which, when modified, change the appearance of the light * @internal * @defaultValue * ```javascript * [ - * "dim", "bright", "gradual", "alpha", "coloration", "color", + * "dim", "bright", "attenuation", "alpha", "coloration", "color", * "contrast", "saturation", "shadows", "luminosity" * ] * ``` @@ -182,16 +161,15 @@ declare global { protected static _appearanceKeys: string[]; /** - * The object of data which configures how the source is rendered - * @defaultValue `{}` + * The computed polygon which expresses the area of effect of this light source */ - data: Partial; + los: PointSourcePolygon | PIXI.Polygon; /** - * The animation configuration applied to this source + * The object of data which configures how the source is rendered * @defaultValue `{}` */ - animation: LightAnimationConfiguration; + data: Partial; /** * Internal flag for whether this is a darkness source @@ -199,12 +177,6 @@ declare global { */ isDarkness: boolean; - /** - * The rendered field-of-vision texture for the source for use within shaders. - * @defaultValue `undefined` - */ - fovTexture: PIXI.RenderTexture | undefined; - /** * To know if a light source is a preview or not. False by default. * @defaultValue `false` @@ -242,23 +214,40 @@ declare global { */ protected _shutdown: { illumination: boolean }; + /** To know if a light source is completely disabled. */ + get disabled(): boolean; + + override get isAnimated(): boolean; + /** * Initialize the source with provided object data. - * @param data - Initial data provided to the point source - * @returns A reference to the initialized source + * @param data - Initial data provided to the point source. + * @returns A reference to the initialized source. */ initialize(data?: Partial & { color?: string | number | null }): this; + protected override _getPolygonConfiguration(): PointSourcePolygonConfig; + + /** {@inheritdoc} */ + override _createMeshes(): void; + + /** {@inheritdoc} */ + destroy(): void; + /** * Initialize the PointSource with new input data * @param data - Initial data provided to the light source * @returns The changes compared to the prior data - * @internal */ protected _initializeData( data: Partial & { color?: string | number | null }, ): Partial; + /** + * Record internal status flags which modify how the light source is rendered + */ + protected _initializeFlags(): void; + /** * Initialize the shaders used for this source, swapping to a different shader if the animation has changed. * @internal @@ -271,6 +260,20 @@ declare global { */ protected _initializeBlending(): void; + override refreshSource(): void; + + /** + * Update the visible state of the component channels of this LightSource. + * @returns Is any channel of this light source active? + */ + updateVisibility(): boolean; + + /** + * Test whether this light source is currently suppressed? + * @internal + */ + protected _isSuppressed(): boolean; + /** * Render the containers used to represent this light source within the LightingLayer */ @@ -281,36 +284,37 @@ declare global { }; /** - * Draw the display of this source for background container. - * @returns The rendered light container + * Create a Mesh for the background component of this source which will be added to CanvasBackgroundEffects. + * @returns The background mesh for this LightSource, or null */ drawBackground(): PIXI.Container | null; /** - * Draw the display of this source for the darkness/light container of the SightLayer. - * @returns The rendered light container + * Create a Mesh for the illumination component of this source which will be added to CanvasIlluminationEffects. + * @returns The illumination mesh for this LightSource, or null */ drawLight(): PIXI.Container | null; /** - * Draw and return a container used to depict the visible color tint of the light source on the LightingLayer - * @returns An updated color container for the source + * Create a Mesh for the coloration component of this source which will be added to CanvasColorationEffects. + * @returns The coloration mesh for this LightSource, or null */ drawColor(): PIXI.Container | null; + /** Update all layer uniforms. */ + protected _updateUniforms(): void; + /** * Update shader uniforms by providing data from this PointSource - * @param shader - The shader being updated * @internal */ - protected _updateColorationUniforms(shader: AdaptiveColorationShader): void; + protected _updateColorationUniforms(): void; /** * Update shader uniforms by providing data from this PointSource - * @param shader - The shader being updated * @internal */ - protected _updateIlluminationUniforms(shader: AdaptiveIlluminationShader): void; + protected _updateIlluminationUniforms(): void; /** * Update shader uniforms by providing data from this PointSource @@ -337,12 +341,6 @@ declare global { */ protected _mapLuminosity(lum: number): number; - /** - * Animate the PointSource, if an animation is enabled and if it currently has rendered containers. - * @param dt - Delta time - */ - animate(dt: number): void; - /** * A torch animation where the luminosity and coloration decays each frame and is revitalized by flashes * @param dt - Delta time @@ -350,8 +348,35 @@ declare global { * (default: `5`) * @param intensity - The animation intensity, from 1 to 10 * (default: `5`) + * @param reverse - Reverse the animation direction + * (default: `false`) */ - animateTorch(dt: number, { speed, intensity }?: { speed: number; intensity: number }): void; + animateTorch( + dt: number, + { speed, intensity, reverse }?: { speed: number; intensity: number; reverse: boolean }, + ): void; + + /** + * An animation with flickering ratio and light intensity + * @param dt - Delta time + * @param speed - The animation speed, from 1 to 10 + * (default: 5) + * @param intensity - The animation intensity, from 1 to 10 + * (default: 5) + * @param amplification - Noise amplification (\>1) or dampening (\<1) + * (default: 1) + * @param reverse - Reverse the animation direction + * (default: false) + */ + animateFlickering( + dt: number, + { + speed, + intensity, + amplification, + reverse, + }?: { speed: number; intensity: number; amplification: number; reverse: boolean }, + ): void; /** * A basic "pulse" animation which expands and contracts. @@ -384,30 +409,33 @@ declare global { ): void; /** - * Evolve a value using a stochastic AR(1) process - * @param y - The current value - * @param phi - The decay rate of prior values - * (default: `0.5`) - * @param center - The stationary mean of the series - * (default: `0`) - * @param sigma - The volatility of the process - standard deviation of the error term - * (default: `0.1`) - * @param max - The maximum allowed outcome, or null - * (default: `null`) - * @param min - The minimum allowed outcome, or null - * (default: `null`) - * @returns The new value of the process - * @internal + * Test whether this LightSource provides visibility to see a certain target object. + * @param tests - The sequence of tests to perform + * @param object - The target object being tested + * @returns Is the target object visible to this source? */ - protected _ar1( - y: number, - { - phi, - center, - sigma, - max, - min, - }?: { phi?: number; center?: number; sigma?: number; max?: number | null; min?: number | null }, - ): number; + testVisibility({ tests, object }: { tests: CanvasVisibilityTest[]; object: PlaceableObject }): boolean; + + /** + * Can this LightSource theoretically detect a certain object based on its properties? + * This check should not consider the relative positions of either object, only their state. + * @param target - The target object being tested + * @returns Can the target object theoretically be detected by this vision source? + */ + _canDetectObject(target: PlaceableObject): boolean; + } + + /** + * A specialized subclass of the LightSource which is used to render global light source linked to the scene. + */ + class GlobalLightSource extends LightSource { + /** @defaultValue `Infinity` */ + override get elevation(): number; + + override _createPolygon(): PIXI.Polygon; + + protected override _initializeFlags(): void; + + protected override _isSuppressed(): boolean; } } diff --git a/src/foundry/client/pixi/sources/vision-source.d.ts b/src/foundry/client/pixi/sources/vision-source.d.ts index c13222c5b..6a5c2b8d0 100644 --- a/src/foundry/client/pixi/sources/vision-source.d.ts +++ b/src/foundry/client/pixi/sources/vision-source.d.ts @@ -139,7 +139,11 @@ declare global { /** * Render the containers used to represent this light source within the LightingLayer. */ - drawMeshes(): VisionSource.LightContainer; + drawMeshes(): { + background: ReturnType; + vision: ReturnType; + color: ReturnType; + }; /** * Draw the background mesh which provide special vision. @@ -198,11 +202,3 @@ declare global { animateTime(dt: number): void; } } - -declare namespace VisionSource { - interface LightContainer { - background: PIXI.Mesh | null; - vision: PIXI.Mesh | null; - color: PIXI.Mesh | null; - } -} From 127baec34dc46cea552a6a658067b2905e8c17c7 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 20 Nov 2023 11:06:02 -0800 Subject: [PATCH 06/75] PointSource to v11 --- .../client/pixi/sources/base-source.d.ts | 221 ++++++++---------- 1 file changed, 102 insertions(+), 119 deletions(-) diff --git a/src/foundry/client/pixi/sources/base-source.d.ts b/src/foundry/client/pixi/sources/base-source.d.ts index cf403de28..0b90ec161 100644 --- a/src/foundry/client/pixi/sources/base-source.d.ts +++ b/src/foundry/client/pixi/sources/base-source.d.ts @@ -1,16 +1,20 @@ /** - * A helper class used by the Sight Layer to represent a source of vision or illumination. + * An abstract base class which defines a framework for effect sources which originate radially from a specific point. + * This abstraction is used by the LightSource, VisionSource, SoundSource, and MovementSource subclasses. + * + * @example A standard PointSource lifecycle: + * ```js + * const source = new PointSource({object}); // Create the point source + * source.initialize(data); // Configure the point source with new data + * source.refresh(); // Refresh the point source + * source.destroy(); // Destroy the point source + * ``` */ declare abstract class PointSource { /** - * @param object - The PlaceableObject which is the origin of this PointSource. + * @param object - Some other object which is responsible for this source */ - constructor(object: PlaceableObject); - - /** - * The object responsible for this source. - */ - object: PlaceableObject; + constructor({ object }?: { object: PlaceableObject }); /** * The type of source represented by this data structure. @@ -20,67 +24,53 @@ declare abstract class PointSource { static sourceType: string | undefined; /** - * A flag for whether this source is currently rendered or not. - * @defaultValue `false` - */ - active: boolean; - - /** - * The animation configuration applied to this source - * @defaultValue `{}` + * Some other object which is responsible for this source. */ - animation: PointSource.PointSourceAnimationConfiguration; + object: PlaceableObject | null; /** * The object of data which configures how this source is rendered * @defaultValue `{}` */ - data: Partial; + data: Partial; - /** - * The maximum radius of emission for this source - * @defaultValue `0` - */ - radius: number; + /** The polygonal shape of the point source, generated from its origin, radius, and other data. */ + shape: PointSourcePolygon | PIXI.Polygon; /** - * The restricted line-of-sight polygon that is generated by the origin and radius of this source. - * @defaultValue `undefined` + * Additional information which controls whether certain behaviors of the source must be enforced + * @defaultValue `{}` */ - los: PointSourcePolygon | undefined; + protected _flags: { + renderFOV?: boolean; + } & Record; /** - * PIXI Geometry generated to draw meshes. - * @defaultValue `null` - * @internal + * Returns the update ID associated with this point source. + * The update ID is increased whenever the source is initialized. + * @defaultValue `0` */ - _sourceGeometry: PIXI.Geometry | null; + get updateId(): number; /** - * A Graphics object with pre-computed geometry used for masking based on line-of-sight. - * @defaultValue `new PIXI.LegacyGraphics()` + * Is this point source currently active? + * Returns false if the source is disabled, temporarily suppressed, or not initialized. + * @defaultValue `false` */ - losMask: PIXI.Graphics; + get active(): boolean; /** - * Additional information which controls whether certain behaviors of the source must be enforced - * @defaultValue `{}` + * Is this source currently disabled? + * Returns false if the source hasn't been initialized yet. + * @defaultValue `true` */ - protected _flags: { - renderFOV?: boolean; - } & Record; + get disabled(): boolean; /** - * To track meshes initialization + * Has this point source been initialized? * @defaultValue `false` */ - protected _meshesInit: boolean; - - /** - * The offset in pixels applied to create soft edges. - * @defaultValue `-8` - */ - static EDGE_OFFSET: number; + get initialized(): boolean; /** * The x-coordinate of the point source origin. @@ -93,132 +83,125 @@ declare abstract class PointSource { get y(): number | undefined; /** - * The type of source represented by this data structure. + * The elevation bound to this source. */ - get sourceType(): (typeof PointSource)["sourceType"]; + get elevation(): number; /** - * The elevation of the object bound to this base source, if any. - * Returns the canvas primary background elevation otherwise. + * A convenience reference to the radius of the source. + * @defaultValue `0` */ - get elevation(): number; + get radius(): number; /** - * If the source is animated or not. + * Initialize and configure the PointSource using provided data. + * @param data - Provided data for configuration + * @returns The configured source */ - get isAnimated(): boolean; + initialize(data?: Partial): this; /** - * A point is contained with the area of the source if it is within both the FOV circle and the LOS polygon. - * @param point - The point to test - * @returns Is the point contained + * Subclass specific data initialization steps. + * This method is responsible for populating the instance data object. + * @param data - Provided data for configuration */ - containsPoint(point: Point): boolean; + protected _initialize(data: Partial): void; /** - * Steps that must be performed when the base source is destroyed. + * Subclass specific configuration steps. Occurs after data initialization and shape computation. + * @param changes - The fields of data which changed during initialization */ - destroy(): void; + protected _configure(changes: Partial): void; - fovTexture?: PIXI.RenderTexture | undefined; - - abstract initialize(data?: Partial): this; + /** + * Refresh the state and uniforms of the PointSource. + */ + refresh(): void; /** - * Refresh the state and uniforms of the BaseSource + * Test whether this source should be active under current conditions? */ - abstract refreshSource(): void; + protected _isActive(): boolean; /** - * Create or update the source geometry with a polygon shape - * Triangulate the form and create buffers - * @param polygon- The pixi polygon + * Subclass-specific refresh steps. */ - protected _updateLosGeometry(polygon: PIXI.Polygon): void; + protected abstract _refresh(): void; /** - * Configure the parameters of the polygon that is generated for this source. + * Steps that must be performed when the base source is destroyed. */ - protected abstract _getPolygonConfiguration(): PointSourcePolygonConfig; + destroy(): void; /** - * Create the LOS polygon for this Light Source instance using provided parameters. + * Subclass specific destruction steps. */ - protected _createPolygon(): PointSourcePolygon | PIXI.Polygon; + protected abstract _destroy(): void; /** - * Create or update the source geometry and create meshes if necessary - * @param polygon - A pixi polygon + * Configure the parameters of the polygon that is generated for this source. */ - protected _initializeMeshes(polygon: PIXI.Polygon): void; + protected _getPolygonConfiguration(): PointSourcePolygonConfig; /** - * Create a new Mesh for this source using a provided shader class - * @param shaderCls - The subclass of AdaptiveLightingShader being used for this Mesh - * @returns The created Mesh + * Create the polygon shape for this source using configured data. */ - protected _createMesh(shaderCls: ConstructorOf): PIXI.Mesh; + protected _createPolygon(): PointSourcePolygon; /** - * Create all meshes needed with this PointSource + * The type of source represented by this data structure. + * @deprecated since v11, will be removed in v13. + * @remarks Use PointSource#constructor.sourceType instead. */ - abstract _createMeshes(): void; + get sourceType(): (typeof PointSource)["sourceType"]; /** - * Update the position and size of the mesh each time it is drawn. - * @param mesh - The Mesh being updated - * @returns The updated Mesh + * @deprecated since v11, will be removed in v13 + * @remarks The setter PointSource#radius is deprecated. + * @remarks The radius should not be set anywhere except in PointSource#_initialize. */ - protected _updateMesh(mesh: PIXI.Mesh): PIXI.Mesh; + set radius(radius); /** - * Animate the BaseSource, if an animation is enabled and if it currently has rendered containers. - * @param dt - Delta time. + * @deprecated since v11, will be removed in v13 + * @remarks PointSource#los is deprecated in favor of PointSource#shape. */ - animate(dt: number): void; + get los(): PointSourcePolygon | PIXI.Polygon; /** - * Get power of 2 size pertaining to base-source radius and performance modes - * @returns The computed power of 2 size - * @deprecated since v10, will be removed in v11. + * @deprecated since v11, will be removed in v13 + * @remarks PointSource#los is deprecated in favor of PointSource#shape. */ - getPowerOf2Size(): number; + set los(shape: PointSourcePolygon | PIXI.Polygon); /** - * Is the angle of emission for this source limited? - * @defaultValue `false` * @deprecated since v10, will be removed in v12 - * @remarks `PointSource#limited is deprecated in favor of PointSourcePolygon#isConstrained.` + * @remarks PointSource#refreshSource is deprecated in favor of PointSource#refresh. */ - limited: boolean; + refreshSource(): void; } declare namespace PointSource { - interface PointSourceAnimationConfiguration { - /** The human-readable (localized) label for the animation */ - label?: string; - /** The animation function that runs every frame */ - animation?: Function; - /** A custom illumination shader used by this animation */ - illuminationShader?: AdaptiveIlluminationShader; - /** A custom coloration shader used by this animation */ - colorationShader?: AdaptiveColorationShader; - /** A custom background shader used by this animation */ - backgroundShader?: AdaptiveBackgroundShader; - /** The animation seed */ - seed?: number; - /** The animation time */ - time?: number; - } - - interface Data { + interface PointSourceData { /** The x-coordinate of the source location */ - x?: number; - + x: number; /** The y-coordinate of the source location */ - y?: number; - + y: number; + /** The elevation of the point source */ + elevation: number; + /** An index for sorting the source relative to others at the same elevation */ + z: number | null; + /** The radius of the source */ + radius: number; + /** A secondary radius used for limited angles */ + externalRadius: number; + /** The angle of rotation for this point source */ + rotation: number; + /** The angle of emission for this point source */ + angle: number; /** Whether or not the source is constrained by walls */ - walls?: boolean; + walls: boolean; + /** Whether or not the source is disabled */ + disabled: boolean; } } From a5b1dea3d721301d6e60e8c27045fecfefb38a7a Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 20 Nov 2023 11:16:51 -0800 Subject: [PATCH 07/75] MovementSource --- src/foundry/client/pixi/sources/index.d.ts | 1 + src/foundry/client/pixi/sources/movement-source.d.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 src/foundry/client/pixi/sources/movement-source.d.ts diff --git a/src/foundry/client/pixi/sources/index.d.ts b/src/foundry/client/pixi/sources/index.d.ts index 8d58f6973..971f6da9d 100644 --- a/src/foundry/client/pixi/sources/index.d.ts +++ b/src/foundry/client/pixi/sources/index.d.ts @@ -1,4 +1,5 @@ import "./base-source"; import "./light-source"; +import "./movement-source"; import "./sound-source"; import "./vision-source"; diff --git a/src/foundry/client/pixi/sources/movement-source.d.ts b/src/foundry/client/pixi/sources/movement-source.d.ts new file mode 100644 index 000000000..a86999ce2 --- /dev/null +++ b/src/foundry/client/pixi/sources/movement-source.d.ts @@ -0,0 +1,10 @@ +declare class MovementSource extends PointSource { + /** @defaultValue `"move"` */ + static override sourceType: string | undefined; + + /** @remarks Not implemented */ + protected _refresh(): void; + + /** @remarks Not implemented */ + protected _destroy(): void; +} From d27762e13966be8b9659088ca657cb36f15c092b Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 20 Nov 2023 13:51:26 -0800 Subject: [PATCH 08/75] Rendered Source --- src/foundry/client/pixi/sources/index.d.ts | 1 + .../client/pixi/sources/movement-source.d.ts | 3 +- .../client/pixi/sources/rendered-source.d.ts | 210 ++++++++++++++++++ 3 files changed, 212 insertions(+), 2 deletions(-) create mode 100644 src/foundry/client/pixi/sources/rendered-source.d.ts diff --git a/src/foundry/client/pixi/sources/index.d.ts b/src/foundry/client/pixi/sources/index.d.ts index 971f6da9d..d4ba63cd7 100644 --- a/src/foundry/client/pixi/sources/index.d.ts +++ b/src/foundry/client/pixi/sources/index.d.ts @@ -1,5 +1,6 @@ import "./base-source"; import "./light-source"; import "./movement-source"; +import "./rendered-source"; import "./sound-source"; import "./vision-source"; diff --git a/src/foundry/client/pixi/sources/movement-source.d.ts b/src/foundry/client/pixi/sources/movement-source.d.ts index a86999ce2..28bc34cfc 100644 --- a/src/foundry/client/pixi/sources/movement-source.d.ts +++ b/src/foundry/client/pixi/sources/movement-source.d.ts @@ -1,6 +1,5 @@ declare class MovementSource extends PointSource { - /** @defaultValue `"move"` */ - static override sourceType: string | undefined; + static override sourceType: "move"; /** @remarks Not implemented */ protected _refresh(): void; diff --git a/src/foundry/client/pixi/sources/rendered-source.d.ts b/src/foundry/client/pixi/sources/rendered-source.d.ts new file mode 100644 index 000000000..fa76cee12 --- /dev/null +++ b/src/foundry/client/pixi/sources/rendered-source.d.ts @@ -0,0 +1,210 @@ +/** TODO: Declared in client/pixi/core/containers/point-source-mesh */ +type PointSourceMesh = unknown; + +declare namespace RenderedPointSource { + interface RenderedPointSourceData extends PointSource.PointSourceData { + /** A color applied to the rendered effect */ + color: number | null; + /** An integer seed to synchronize (or de-synchronize) animations */ + seed: number | null; + /** Is this source a temporary preview? */ + preview: boolean; + } + + type RenderedPointSourceAnimationConfig = { + /** The human-readable (localized) label for the animation */ + label?: string; + /** The animation function that runs every frame */ + animation?: Function; + /** A custom illumination shader used by this animation */ + illuminationShader?: AdaptiveIlluminationShader; + /** A custom coloration shader used by this animation */ + colorationShader?: AdaptiveColorationShader; + /** A custom background shader used by this animation */ + backgroundShader?: AdaptiveBackgroundShader; + /** The animation seed */ + seed?: number; + /** The animation time */ + time?: number; + }; + + type RenderedPointSourceLayer = { + /** Is this layer actively rendered? */ + active?: boolean; + /** Do uniforms need to be reset? */ + reset?: boolean; + /** Is this layer temporarily suppressed? */ + suppressed?: boolean; + /** The rendered mesh for this layer */ + mesh?: PointSourceMesh; + /** The shader instance used for the layer */ + shader?: AdaptiveLightingShader; + }; +} + +declare class RenderedPointSource extends PointSource { + /** + * Keys of the data object which require shaders to be re-initialized. + */ + protected static _initializeShaderKeys: string[]; + + /** + * Keys of the data object which require uniforms to be refreshed. + */ + protected static _refreshUniformsKeys: string[]; + + /** + * The offset in pixels applied to create soft edges. + * @defaultValue `-8` + */ + static EDGE_OFFSET: number; + + /** + * The animation configuration applied to this source + * @defaultValue `{}` + */ + animation: Partial; + + /** + * The object of data which configures how the source is rendered + */ + data: RenderedPointSource.RenderedPointSourceData; + + /** + * Track the status of rendering layers + */ + layers: { + background: RenderedPointSource.RenderedPointSourceLayer; + coloration: RenderedPointSource.RenderedPointSourceLayer; + illumination: RenderedPointSource.RenderedPointSourceLayer; + }; + + /** + * The color of the source as a RGB vector. + */ + colorRGB: [number, number, number] | null; + + /** + * A convenience accessor to the background layer mesh. + */ + get background(): PointSourceMesh; + + /** + * A convenience accessor to the coloration layer mesh. + */ + get coloration(): PointSourceMesh; + + /** + * A convenience accessor to the illumination layer mesh. + */ + get illumination(): PointSourceMesh; + + /** + * Is the rendered source animated? + */ + get isAnimated(): boolean; + + /** + * Has the rendered source at least one active layer? + */ + get hasActiveLayer(): boolean; + + /** + * Is this RenderedPointSource a temporary preview? + */ + get isPreview(): boolean; + + protected override _initialize(data: Partial): void; + + protected override _configure(changes: Partial): void; + + /** + * Decide whether to render soft edges with a blur. + */ + protected _configureSoftEdges(): void; + + /** + * Configure the derived color attributes and associated flag. + * @param color - The color to configure (usually a color coming for the rendered point source data) or null if no color is configured for this rendered source. + */ + protected _configureColorAttributes(color: number | null): void; + + /** + * Configure which shaders are used for each rendered layer. + * @internal + */ + protected _configureShaders(): { + background: AdaptiveLightingShader; + coloration: AdaptiveLightingShader; + illumination: AdaptiveLightingShader; + }; + + /** + * Specific configuration for a layer. + */ + protected _configureLayer(layer: RenderedPointSource.RenderedPointSourceLayer, layerId: string): void; + + /** + * Initialize the blend mode and vertical sorting of this source relative to others in the container. + */ + protected _initializeBlending(): void; + + /** + * Render the containers used to represent this light source within the LightingLayer + */ + drawMeshes(): { background: PIXI.Mesh; coloration: PIXI.Mesh; illumination: PIXI.Mesh }; + + override _refresh(): void; + + /** {@inheritDoc} */ + protected _isActive(): boolean; + + /** + * Update shader uniforms used for the background layer. + */ + protected _updateBackgroundUniforms(): void; + + /** + * Update shader uniforms used for the coloration layer. + */ + protected _updateColorationUniforms(): void; + + /** + * Update shader uniforms used for the illumination layer. + */ + _updateIlluminationUniforms(): void; + + protected override _destroy(): void; + + /** + * Animate the PointSource, if an animation is enabled and if it currently has rendered containers. + * @param dt - Delta time. + */ + animate(dt: number): ReturnType | undefined; + + /** + * Generic time-based animation used for Rendered Point Sources. + * @param dt - Delta time. + * @param speed - The animation speed, from 1 to 10 + * (default: 5) + * @param intensity - The animation intensity, from 1 to 10 + * (default: 5) + * @param reverse - Reverse the animation direction + * (default: false) + */ + animateTime(dt: number, { speed, intensity, reverse }: { speed: number; intensity: number; reverse: boolean }): void; + + /** + * @deprecated since v11, will be removed in v13. + * @remarks The RenderedPointSource#preview is deprecated. + * @remarks Use RenderedPointSource#isPreview instead. + */ + get preview(): boolean; + + /** + * @deprecated since v11, will be removed in v13. + * @remarks The RenderedPointSource#preview is deprecated. + * @remarks Set RenderedPointSourceData#preview as part of RenderedPointSourceData#initialize instead. + */ + set preview(preview); +} From 5b7169a64b99893f312ad87afb000f087ff8cf3b Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 20 Nov 2023 13:53:52 -0800 Subject: [PATCH 09/75] Any option --- src/foundry/client/pixi/sources/rendered-source.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/foundry/client/pixi/sources/rendered-source.d.ts b/src/foundry/client/pixi/sources/rendered-source.d.ts index fa76cee12..1df5312d9 100644 --- a/src/foundry/client/pixi/sources/rendered-source.d.ts +++ b/src/foundry/client/pixi/sources/rendered-source.d.ts @@ -179,8 +179,9 @@ declare class RenderedPointSource extends PointSource { /** * Animate the PointSource, if an animation is enabled and if it currently has rendered containers. * @param dt - Delta time. + * @remarks Returns `this.animation.call(this, dt, options)` */ - animate(dt: number): ReturnType | undefined; + animate(dt: number): any; /** * Generic time-based animation used for Rendered Point Sources. From f6351b4d8da2bb3c3593d5e8907fcaf5ee442d44 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 21 Nov 2023 08:27:02 -0800 Subject: [PATCH 10/75] LightSource --- .../client/pixi/sources/light-source.d.ts | 499 +++++------------- .../client/pixi/sources/rendered-source.d.ts | 6 +- 2 files changed, 144 insertions(+), 361 deletions(-) diff --git a/src/foundry/client/pixi/sources/light-source.d.ts b/src/foundry/client/pixi/sources/light-source.d.ts index 7164d6be4..53e5471e9 100644 --- a/src/foundry/client/pixi/sources/light-source.d.ts +++ b/src/foundry/client/pixi/sources/light-source.d.ts @@ -1,28 +1,7 @@ -import type { ConfiguredObjectClassForName } from "../../../../types/helperTypes"; - // TODO: Define in client/pixi/layers/effects/visibility.js type CanvasVisibilityTest = unknown; -declare global { - /** @see {@link foundry.data.LightData} */ - interface LightSourceData extends PointSource.Data { - /** @defaultValue `0` */ - x: number; - - /** @defaultValue `0` */ - y: number; - - /** - * An optional z-index sorting for the source - * @defaultValue `null` - */ - z: number | null; - - /** - * The angle of rotation for this point source - * @defaultValue `0` - */ - rotation: number; - +declare namespace LightSource { + interface LightSourceData extends RenderedPointSource.RenderedPointSourceData { /** * An opacity for the emitted light, if any * @defaultValue `0.5` @@ -31,15 +10,9 @@ declare global { /** * An animation configuration for the source - * @defaultValue `{ type: null }` - */ - animation: PointSource.PointSourceAnimationConfiguration; - - /** - * The angle of emission for this point source - * @defaultValue `360` + * @defaultValue `{}` */ - angle: number; + animation: RenderedPointSource.RenderedPointSourceAnimationConfig; /** * The allowed radius of bright vision or illumination @@ -47,12 +20,6 @@ declare global { */ bright: number; - /** - * A tint color for the emitted light, if any - * @defaultValue `null` - */ - color: number | null; - /** * The coloration technique applied in the shader * @defaultValue `1` @@ -61,381 +28,197 @@ declare global { /** * The amount of contrast this light applies to the background texture - * @defaultValue `0.0` + * @defaultValue `0` */ contrast: number; - /** - * A darkness range (min and max) for which the source should be active - * @defaultValue `{ min: 0, max: 1 }` - */ - darkness: { min: number; max: number }; - /** * The allowed radius of dim vision or illumination * @defaultValue `0` */ dim: number; - /** Strength of the attenuation between bright, dim, and dark */ + /** + * Strength of the attenuation between bright, dim, and dark + * @defaultValue `0.5` + */ attenuation: number; /** * The luminosity applied in the shader - * @defaultValue `0.0` + * @defaultValue `0.5` */ luminosity: number; /** * The amount of color saturation this light applies to the background texture - * @defaultValue `0.0` + * @defaultValue `0` */ saturation: number; /** * The depth of shadows this light applies to the background texture - * @defaultValue `0.0` + * @defaultValue `0` */ shadows: number; - /** @defaultValue `true` */ - walls: boolean; - /** * Whether or not this source provides a source of vision * @defaultValue `false` */ vision: boolean; - - /** An integer seed to synchronize (or de-synchronize) animations */ - seed: number; } +} + +/** + * A specialized subclass of the PointSource abstraction which is used to control the rendering of light sources. + */ +declare class LightSource extends RenderedPointSource { + /** {@inheritdoc} */ + static override sourceType: "light"; + + protected static _initializeShaderKeys: ["animation.type", "walls"]; + + static override _refreshUniformsKeys: [ + "dim", + "bright", + "attenuation", + "alpha", + "coloration", + "color", + "contrast", + "saturation", + "shadows", + "luminosity", + ]; /** - * A specialized subclass of the PointSource abstraction which is used to control the rendering of light sources. + * The object of data which configures how the source is rendered */ - class LightSource extends PointSource { - /** @param object - The light-emitting object that generates this light source */ - constructor(object: InstanceType>); - - /** - * The object type for a Light Source. - * This is a Scene in the case of a global light source - * This is an AmbientLight placeable object when the source is provided by an AmbientLightDocument - * This is a Token placeable object when the source is provided by a TokenDocument - */ - object: InstanceType>; - - /** - * The light or darkness container for this source - * @defaultValue `null)` - */ - background: PIXI.Mesh | null; - - /** - * The light or darkness container for this source - * @defaultValue `null` - */ - illumination: PIXI.Mesh | null; - - /** - * This visible color container for this source - * @defaultValue `null` - */ - coloration: PIXI.Mesh | null; - - /** {@inheritdoc} */ - static override sourceType: "light"; - - /** - * Keys in the LightSourceData structure which, when modified, change the appearance of the light - * @internal - * @defaultValue - * ```javascript - * [ - * "dim", "bright", "attenuation", "alpha", "coloration", "color", - * "contrast", "saturation", "shadows", "luminosity" - * ] - * ``` - */ - protected static _appearanceKeys: string[]; - - /** - * The computed polygon which expresses the area of effect of this light source - */ - los: PointSourcePolygon | PIXI.Polygon; - - /** - * The object of data which configures how the source is rendered - * @defaultValue `{}` - */ - data: Partial; - - /** - * Internal flag for whether this is a darkness source - * @defaultValue `false` - */ - isDarkness: boolean; - - /** - * To know if a light source is a preview or not. False by default. - * @defaultValue `false` - */ - preview: boolean; - - /** - * The ratio of dim:bright as part of the source radius - * @defaultValue `undefined` - */ - ratio: number | undefined; - - /** - * Track which uniforms need to be reset - * @internal - * @defaultValue - * ```javascript - * { - * background: true, - * illumination: true, - * coloration: true - * } - * ``` - */ - protected _resetUniforms: { - background: boolean; - illumination: boolean; - coloration: boolean; - }; - - /** - * To track if a source is temporarily shutdown to avoid glitches - * @defaultValue `{ illumination: false }` - * @internal - */ - protected _shutdown: { illumination: boolean }; - - /** To know if a light source is completely disabled. */ - get disabled(): boolean; - - override get isAnimated(): boolean; - - /** - * Initialize the source with provided object data. - * @param data - Initial data provided to the point source. - * @returns A reference to the initialized source. - */ - initialize(data?: Partial & { color?: string | number | null }): this; - - protected override _getPolygonConfiguration(): PointSourcePolygonConfig; - - /** {@inheritdoc} */ - override _createMeshes(): void; - - /** {@inheritdoc} */ - destroy(): void; - - /** - * Initialize the PointSource with new input data - * @param data - Initial data provided to the light source - * @returns The changes compared to the prior data - */ - protected _initializeData( - data: Partial & { color?: string | number | null }, - ): Partial; - - /** - * Record internal status flags which modify how the light source is rendered - */ - protected _initializeFlags(): void; + data: LightSource.LightSourceData; - /** - * Initialize the shaders used for this source, swapping to a different shader if the animation has changed. - * @internal - */ - protected _initializeShaders(): void; - - /** - * Initialize the blend mode and vertical sorting of this source relative to others in the container. - * @internal - */ - protected _initializeBlending(): void; - - override refreshSource(): void; - - /** - * Update the visible state of the component channels of this LightSource. - * @returns Is any channel of this light source active? - */ - updateVisibility(): boolean; + /** + * The ratio of dim:bright as part of the source radius + * @defaultValue `0` + */ + ratio: number; - /** - * Test whether this light source is currently suppressed? - * @internal - */ - protected _isSuppressed(): boolean; + /** + * Is this darkness? + */ + get isDarkness(): boolean; - /** - * Render the containers used to represent this light source within the LightingLayer - */ - drawMeshes(): { - background: ReturnType; - light: ReturnType; - color: ReturnType; - }; + protected _initialize(data: Partial): void; - /** - * Create a Mesh for the background component of this source which will be added to CanvasBackgroundEffects. - * @returns The background mesh for this LightSource, or null - */ - drawBackground(): PIXI.Container | null; + protected override _configure(changes: Partial): void; - /** - * Create a Mesh for the illumination component of this source which will be added to CanvasIlluminationEffects. - * @returns The illumination mesh for this LightSource, or null - */ - drawLight(): PIXI.Container | null; + protected override _getPolygonConfiguration(): PointSourcePolygonConfig; - /** - * Create a Mesh for the coloration component of this source which will be added to CanvasColorationEffects. - * @returns The coloration mesh for this LightSource, or null - */ - drawColor(): PIXI.Container | null; + protected override _initializeBlending(): void; - /** Update all layer uniforms. */ - protected _updateUniforms(): void; + protected override _updateColorationUniforms(): void; - /** - * Update shader uniforms by providing data from this PointSource - * @internal - */ - protected _updateColorationUniforms(): void; + protected override _updateIlluminationUniforms(): void; - /** - * Update shader uniforms by providing data from this PointSource - * @internal - */ - protected _updateIlluminationUniforms(): void; + protected override _updateBackgroundUniforms(): void; - /** - * Update shader uniforms by providing data from this PointSource - * @param shader - The shader being updated - * @internal - */ - protected _updateBackgroundUniforms(shader: AdaptiveBackgroundShader): void; - - /** - * Update shader uniforms shared by all shader types - * @param shader - The shader being updated - * @internal - */ - protected _updateCommonUniforms(shader: AdaptiveLightingShader): void; - - /** - * Map luminosity value to exposure value - * luminosity[-1 , 0 [ =\> Darkness =\> map to exposure ] 0, 1] - * luminosity[ 0 , 0.5[ =\> Light =\> map to exposure [-0.5, 0[ - * luminosity[ 0.5, 1 ] =\> Light =\> map to exposure [ 0, 1] - * @param lum - The luminosity value - * @returns The exposure value - * @internal - */ - protected _mapLuminosity(lum: number): number; - - /** - * A torch animation where the luminosity and coloration decays each frame and is revitalized by flashes - * @param dt - Delta time - * @param speed - The animation speed, from 1 to 10 - * (default: `5`) - * @param intensity - The animation intensity, from 1 to 10 - * (default: `5`) - * @param reverse - Reverse the animation direction - * (default: `false`) - */ - animateTorch( - dt: number, - { speed, intensity, reverse }?: { speed: number; intensity: number; reverse: boolean }, - ): void; + /** + * Update shader uniforms shared by all shader types + * @param shader - The shader being updated + */ + protected _updateCommonUniforms(shader: AdaptiveLightingShader): void; - /** - * An animation with flickering ratio and light intensity - * @param dt - Delta time - * @param speed - The animation speed, from 1 to 10 - * (default: 5) - * @param intensity - The animation intensity, from 1 to 10 - * (default: 5) - * @param amplification - Noise amplification (\>1) or dampening (\<1) - * (default: 1) - * @param reverse - Reverse the animation direction - * (default: false) - */ - animateFlickering( - dt: number, - { - speed, - intensity, - amplification, - reverse, - }?: { speed: number; intensity: number; amplification: number; reverse: boolean }, - ): void; + /** + * Map luminosity value to exposure value + * luminosity[-1 , 0 [ =\> Darkness =\> map to exposure ] 0, 1] + * luminosity[ 0 , 0.5[ =\> Light =\> map to exposure [-0.5, 0[ + * luminosity[ 0.5, 1 ] =\> Light =\> map to exposure [ 0, 1] + * @param lum - The luminosity value + * @returns The exposure value + * @internal + */ + protected _mapLuminosity(lum: number): number; - /** - * A basic "pulse" animation which expands and contracts. - * @param dt - Delta time - * @param speed - The animation speed, from 1 to 10 - * (default: `5`) - * @param intensity - The animation intensity, from 1 to 10 - * (default: `5`) - * @param reverse - Is the animation reversed? - * (default: `false`) - */ - animatePulse( - dt: number, - { speed, intensity, reverse }?: { speed?: number; intensity?: number; reverse?: boolean }, - ): void; + /** + * A torch animation where the luminosity and coloration decays each frame and is revitalized by flashes + * @param dt - Delta time + * @param speed - The animation speed, from 1 to 10 + * (default: `5`) + * @param intensity - The animation intensity, from 1 to 10 + * (default: `5`) + * @param reverse - Reverse the animation direction + * (default: `false`) + */ + animateTorch( + dt: number, + { speed, intensity, reverse }?: { speed: number; intensity: number; reverse: boolean }, + ): void; - /** - * Emanate waves of light from the source origin point - * @param dt - Delta time - * @param speed - The animation speed, from 1 to 10 - * (default: `5`) - * @param intensity - The animation intensity, from 1 to 10 - * (default: `5`) - * @param reverse - Is the animation reversed? - * (default: `false`) - */ - animateTime( - dt: number, - { speed, intensity, reverse }?: { speed?: number; intensity?: number; reverse?: boolean }, - ): void; + /** + * An animation with flickering ratio and light intensity + * @param dt - Delta time + * @param speed - The animation speed, from 1 to 10 + * (default: 5) + * @param intensity - The animation intensity, from 1 to 10 + * (default: 5) + * @param amplification - Noise amplification (\>1) or dampening (\<1) + * (default: 1) + * @param reverse - Reverse the animation direction + * (default: false) + */ + animateFlickering( + dt: number, + { + speed, + intensity, + amplification, + reverse, + }?: { speed: number; intensity: number; amplification: number; reverse: boolean }, + ): void; - /** - * Test whether this LightSource provides visibility to see a certain target object. - * @param tests - The sequence of tests to perform - * @param object - The target object being tested - * @returns Is the target object visible to this source? - */ - testVisibility({ tests, object }: { tests: CanvasVisibilityTest[]; object: PlaceableObject }): boolean; + /** + * A basic "pulse" animation which expands and contracts. + * @param dt - Delta time + * @param speed - The animation speed, from 1 to 10 + * (default: `5`) + * @param intensity - The animation intensity, from 1 to 10 + * (default: `5`) + * @param reverse - Is the animation reversed? + * (default: `false`) + */ + animatePulse( + dt: number, + { speed, intensity, reverse }?: { speed?: number; intensity?: number; reverse?: boolean }, + ): void; - /** - * Can this LightSource theoretically detect a certain object based on its properties? - * This check should not consider the relative positions of either object, only their state. - * @param target - The target object being tested - * @returns Can the target object theoretically be detected by this vision source? - */ - _canDetectObject(target: PlaceableObject): boolean; - } + /** + * Test whether this LightSource provides visibility to see a certain target object. + * @param tests - The sequence of tests to perform + * @param object - The target object being tested + * @returns Is the target object visible to this source? + */ + testVisibility({ tests, object }: { tests: CanvasVisibilityTest[]; object: PlaceableObject }): boolean; /** - * A specialized subclass of the LightSource which is used to render global light source linked to the scene. + * Can this LightSource theoretically detect a certain object based on its properties? + * This check should not consider the relative positions of either object, only their state. + * @param target - The target object being tested + * @returns Can the target object theoretically be detected by this vision source? */ - class GlobalLightSource extends LightSource { - /** @defaultValue `Infinity` */ - override get elevation(): number; + _canDetectObject(target: PlaceableObject): boolean; +} - override _createPolygon(): PIXI.Polygon; +/** + * A specialized subclass of the LightSource which is used to render global light source linked to the scene. + */ +declare class GlobalLightSource extends LightSource { + //@ts-expect-error Typing issue on Foundry's end + override _createPolygon(): PIXI.Polygon; - protected override _initializeFlags(): void; + protected override _configureSoftEdges(): void; - protected override _isSuppressed(): boolean; - } + /** + * @remarks Sets attenuation to 0 + */ + protected override _initialize(data: Partial): void; } diff --git a/src/foundry/client/pixi/sources/rendered-source.d.ts b/src/foundry/client/pixi/sources/rendered-source.d.ts index 1df5312d9..8c73dbd06 100644 --- a/src/foundry/client/pixi/sources/rendered-source.d.ts +++ b/src/foundry/client/pixi/sources/rendered-source.d.ts @@ -15,7 +15,7 @@ declare namespace RenderedPointSource { /** The human-readable (localized) label for the animation */ label?: string; /** The animation function that runs every frame */ - animation?: Function; + animation?: (dt: number, options: Partial) => any; /** A custom illumination shader used by this animation */ illuminationShader?: AdaptiveIlluminationShader; /** A custom coloration shader used by this animation */ @@ -172,7 +172,7 @@ declare class RenderedPointSource extends PointSource { /** * Update shader uniforms used for the illumination layer. */ - _updateIlluminationUniforms(): void; + protected _updateIlluminationUniforms(): void; protected override _destroy(): void; @@ -181,7 +181,7 @@ declare class RenderedPointSource extends PointSource { * @param dt - Delta time. * @remarks Returns `this.animation.call(this, dt, options)` */ - animate(dt: number): any; + animate(dt: number): ReturnType>; /** * Generic time-based animation used for Rendered Point Sources. From 5875d6801d4a908c918928317a1d229391ff5d0d Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 21 Nov 2023 09:20:32 -0800 Subject: [PATCH 11/75] Vision Source --- .../client/pixi/sources/vision-source.d.ts | 227 +++++++----------- 1 file changed, 89 insertions(+), 138 deletions(-) diff --git a/src/foundry/client/pixi/sources/vision-source.d.ts b/src/foundry/client/pixi/sources/vision-source.d.ts index 6a5c2b8d0..7d5036915 100644 --- a/src/foundry/client/pixi/sources/vision-source.d.ts +++ b/src/foundry/client/pixi/sources/vision-source.d.ts @@ -1,204 +1,155 @@ -import type { ConfiguredObjectClassForName } from "../../../../types/helperTypes"; -import type { VisionMode } from "../../config"; -// TODO: After #2084 -// import type { AdaptiveVisionShader } from "../webgl/shaders/vision" -type AdaptiveVisionShader = unknown; - -declare global { - interface VisionSourceData extends Exclude { - x: number; - - y: number; - - /** An optional z-index sorting for the source */ - z: number; +export {}; - /** The angle of rotation for this point source */ - rotation: number; +// TODO: Define in client/pixi/perception/vision-mode +type VisionMode = unknown; - /** The angle of emission for this point source */ - angle: number; - - /** The allowed radius of bright vision or illumination */ - bright: number; - - /** The allowed radius of vision */ - radius: number; - - /** A secondary radius used for limited angles */ - externalRadius: number; - - /** Is this vision source a temporary preview? */ - isPreview: boolean; - } +// TODO: Define in client/pixi/webgl/shaders/effects/vision +type AdaptiveVisionShader = unknown; +declare global { /** * A specialized subclass of the PointSource abstraction which is used to control the rendering of vision sources. */ - class VisionSource extends PointSource { - /** @param object - The Token object that generates this vision source */ - constructor(object: InstanceType>); - - /** The current background mesh for this source */ - background: PIXI.Mesh | null; - - /** The current vision illumination mesh for this source */ - illumination: PIXI.Mesh | null; - - /** The current vision coloration mesh for this source */ - coloration: PIXI.Mesh | null; - - /** The vision mode linked to this VisionSource */ - visionMode: VisionMode | null; - + class VisionSource extends RenderedPointSource { static override sourceType: "sight"; - /** - * Keys in the VisionSourceData structure which, when modified, change the appearance of the source - * @defaultValue `["radius", "color", "attenuation", "brightness", "contrast", "saturation", "visionMode"]` - * @internal - */ - protected static _appearanceKeys: string[]; + static override _refreshUniformsKeys: [ + "radius", + "color", + "attenuation", + "brightness", + "contrast", + "saturation", + "visionMode", + ]; static override EDGE_OFFSET: -2; /** * The object of data which configures how the source is rendered - * @defaultValue `{}` */ - data: Partial; + data: VisionSourceData; - /** The constrained LOS polygon that is generated by the origin and radius of this source. */ - fov: PointSourcePolygon; + /** + * The vision mode linked to this VisionSource + * @defaultValue `null` + */ + visionMode: VisionMode | null; /** - * Track which uniforms need to be reset - * @defaultValue `{ background: false, illumination: false, coloration: false }` + * The vision mode activation flag for handlers + * @defaultValue `false` * @internal */ - protected _resetUniforms: { background: boolean; illumination: boolean; coloration: boolean }; + protected _visionModeActivated: boolean; /** - * To track if a source is temporarily shutdown to avoid glitches - * @defaultValue `{ background: false, illumination: false, coloration: false }` - * @internal + * The unconstrained LOS polygon. */ - protected _shutdown: { background: boolean; illumination: boolean; coloration: boolean }; + // @ts-expect-error Getter this is overriding will be replaced in v13 + los: PointSourcePolygon; - /** Is this VisionSource a temporary preview which should not produce fog exploration? */ - get isPreview(): boolean; + /** The constrained LOS polygon that is generated by the origin and radius of this source. */ + get fov(): PointSourcePolygon | PIXI.Polygon; /** - * Initialize the source with provided object data. - * @param data - Initial data provided to the point source - * @returns A reference to the initialized source + * If this vision source background is rendered into the lighting container. */ - initialize(data?: Partial): this; + get preferred(): boolean; + + override get isAnimated(): boolean; + + protected override _initialize(data: Partial): void; + + protected override _configure(changes: Partial): void; + + protected override _configureLayer(layer: RenderedPointSource.RenderedPointSourceLayer, layerId: string): void; /** Responsible for assigning the Vision Mode and handling exceptions based on vision special status. */ protected _initializeVisionMode(): void; - /** If this vision source background is rendered into the lighting container. */ - get preferred(): boolean; - /** {@inheritdoc} */ override _getPolygonConfiguration(): PointSourcePolygonConfig; /** Create a restricted FOV polygon by limiting the radius of the unrestricted LOS polygon. */ protected _createRestrictedPolygon(): PointSourcePolygon; - /** - * Initialize the shaders used for this source, swapping to a different shader if the vision effect has changed. - * @internal - */ - protected _initializeShaders(): void; - - /** - * Initialize the blend mode and vertical sorting of this source relative to others in the container. - * @internal - */ - protected _initializeBlending(): void; + protected override _configureShaders(): { + background: AdaptiveLightingShader; + coloration: AdaptiveLightingShader; + illumination: AdaptiveLightingShader; + }; /** - * Process new input data provided to the LightSource. - * @param data - Initial data provided to the vision source - * @returns The changes compared to the prior data - * @internal + * Update shader uniforms by providing data from this VisionSource */ - protected _initializeData(data: Partial): Partial; - - /** {@inheritdoc} */ - _createMeshes(): void; - - /** {@inheritdoc} */ - destroy(): void; - - /** {@inheritdoc} */ - refreshSource(): void; + protected _updateColorationUniforms(): void; /** - * Render the containers used to represent this light source within the LightingLayer. + * Update shader uniforms by providing data from this VisionSource */ - drawMeshes(): { - background: ReturnType; - vision: ReturnType; - color: ReturnType; - }; + protected _updateIlluminationUniforms(): void; /** - * Draw the background mesh which provide special vision. - * @returns The rendered light container + * Update shader uniforms by providing data from this VisionSource */ - drawBackground(): PIXI.Mesh | null; + protected _updateBackgroundUniforms(): void; /** - * Draw the illumination mesh which provide vision. - * @returns The rendered light container + * Update shader uniforms shared by all shader types + * @param shader - The shader being updated + * @internal */ - drawVision(): PIXI.Mesh | null; + _updateCommonUniforms(shader: AdaptiveVisionShader): void; /** - * Draw and return a container used to depict the visible color tint of the light source on the LightingLayer - * @returns An updated color container for the source + * TODO: Replace any with the type inherited from _configureLayer + * const vmUniforms = this.visionMode.vision[layerId].uniforms; + * layer.vmUniforms = Object.entries(vmUniforms); */ - drawColor(): PIXI.Mesh | null; - - /* -------------------------------------------- */ - /* Shader Management */ - /* -------------------------------------------- */ - - /** Update all layer uniforms. */ - protected _updateUniforms(): void; /** - * Update shader uniforms by providing data from this PointSource + * Update layer uniforms according to vision mode uniforms, if any. + * @param shader - The shader being updated. + * @param vmUniforms - The targeted layer. * @internal */ - protected _updateColorationUniforms(): void; + _updateVisionModeUniforms( + shader: AdaptiveVisionShader, + vmUniforms: Array }>>, + ): void; + } + interface VisionSourceData extends RenderedPointSource.RenderedPointSourceData { /** - * Update shader uniforms by providing data from this PointSource - * @internal + * The amount of contrast + * @defaultValue `0` */ - protected _updateIlluminationUniforms(): void; - + contrast: number; /** - * Update shader uniforms by providing data from this PointSource - * @internal + * Strength of the attenuation between bright, dim, and dark + * @defaultValue `0.5` */ - protected _updateBackgroundUniforms(): void; - + attenuation: number; /** - * Update shader uniforms shared by all shader types - * @param shader - The shader being updated - * @internal + * The amount of color saturation + * @defaultValue `0` */ - _updateCommonUniforms(shader: AdaptiveVisionShader): void; - + saturation: number; /** - * Generic time animation with Vision Sources. - * @param dt - Delta time. + * The vision brightness. + * @defaultValue `0` */ - animateTime(dt: number): void; + brightness: number; + /** + * The vision mode. + * @defaultValue `"basic"` + * */ + visionMode: string; + /** + * Is this vision source blinded? + * @defaultValue `false` + * */ + blinded: boolean; } } From 1128df19b311a144890fc12cf8ab185f6c376812 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 21 Nov 2023 09:27:32 -0800 Subject: [PATCH 12/75] Declaration Rework --- .../client/pixi/sources/base-source.d.ts | 368 ++++++++-------- .../client/pixi/sources/light-source.d.ts | 267 ++++++------ .../client/pixi/sources/movement-source.d.ts | 16 +- .../client/pixi/sources/rendered-source.d.ts | 404 +++++++++--------- .../client/pixi/sources/vision-source.d.ts | 2 +- 5 files changed, 536 insertions(+), 521 deletions(-) diff --git a/src/foundry/client/pixi/sources/base-source.d.ts b/src/foundry/client/pixi/sources/base-source.d.ts index 0b90ec161..c9e6d09df 100644 --- a/src/foundry/client/pixi/sources/base-source.d.ts +++ b/src/foundry/client/pixi/sources/base-source.d.ts @@ -1,187 +1,189 @@ -/** - * An abstract base class which defines a framework for effect sources which originate radially from a specific point. - * This abstraction is used by the LightSource, VisionSource, SoundSource, and MovementSource subclasses. - * - * @example A standard PointSource lifecycle: - * ```js - * const source = new PointSource({object}); // Create the point source - * source.initialize(data); // Configure the point source with new data - * source.refresh(); // Refresh the point source - * source.destroy(); // Destroy the point source - * ``` - */ -declare abstract class PointSource { - /** - * @param object - Some other object which is responsible for this source - */ - constructor({ object }?: { object: PlaceableObject }); - - /** - * The type of source represented by this data structure. - * Each subclass must implement this attribute. - * @remarks This is undefined in PointSource. - */ - static sourceType: string | undefined; - - /** - * Some other object which is responsible for this source. - */ - object: PlaceableObject | null; - - /** - * The object of data which configures how this source is rendered - * @defaultValue `{}` - */ - data: Partial; - - /** The polygonal shape of the point source, generated from its origin, radius, and other data. */ - shape: PointSourcePolygon | PIXI.Polygon; - - /** - * Additional information which controls whether certain behaviors of the source must be enforced - * @defaultValue `{}` - */ - protected _flags: { - renderFOV?: boolean; - } & Record; - - /** - * Returns the update ID associated with this point source. - * The update ID is increased whenever the source is initialized. - * @defaultValue `0` - */ - get updateId(): number; - - /** - * Is this point source currently active? - * Returns false if the source is disabled, temporarily suppressed, or not initialized. - * @defaultValue `false` - */ - get active(): boolean; - - /** - * Is this source currently disabled? - * Returns false if the source hasn't been initialized yet. - * @defaultValue `true` - */ - get disabled(): boolean; - - /** - * Has this point source been initialized? - * @defaultValue `false` - */ - get initialized(): boolean; - - /** - * The x-coordinate of the point source origin. - */ - get x(): number | undefined; - - /** - * The y-coordinate of the point source origin. - */ - get y(): number | undefined; - - /** - * The elevation bound to this source. - */ - get elevation(): number; - - /** - * A convenience reference to the radius of the source. - * @defaultValue `0` - */ - get radius(): number; - - /** - * Initialize and configure the PointSource using provided data. - * @param data - Provided data for configuration - * @returns The configured source - */ - initialize(data?: Partial): this; - - /** - * Subclass specific data initialization steps. - * This method is responsible for populating the instance data object. - * @param data - Provided data for configuration - */ - protected _initialize(data: Partial): void; - - /** - * Subclass specific configuration steps. Occurs after data initialization and shape computation. - * @param changes - The fields of data which changed during initialization - */ - protected _configure(changes: Partial): void; - - /** - * Refresh the state and uniforms of the PointSource. - */ - refresh(): void; - - /** - * Test whether this source should be active under current conditions? - */ - protected _isActive(): boolean; - - /** - * Subclass-specific refresh steps. - */ - protected abstract _refresh(): void; - - /** - * Steps that must be performed when the base source is destroyed. - */ - destroy(): void; - - /** - * Subclass specific destruction steps. - */ - protected abstract _destroy(): void; - - /** - * Configure the parameters of the polygon that is generated for this source. - */ - protected _getPolygonConfiguration(): PointSourcePolygonConfig; - - /** - * Create the polygon shape for this source using configured data. - */ - protected _createPolygon(): PointSourcePolygon; - - /** - * The type of source represented by this data structure. - * @deprecated since v11, will be removed in v13. - * @remarks Use PointSource#constructor.sourceType instead. - */ - get sourceType(): (typeof PointSource)["sourceType"]; - - /** - * @deprecated since v11, will be removed in v13 - * @remarks The setter PointSource#radius is deprecated. - * @remarks The radius should not be set anywhere except in PointSource#_initialize. - */ - set radius(radius); - - /** - * @deprecated since v11, will be removed in v13 - * @remarks PointSource#los is deprecated in favor of PointSource#shape. - */ - get los(): PointSourcePolygon | PIXI.Polygon; - - /** - * @deprecated since v11, will be removed in v13 - * @remarks PointSource#los is deprecated in favor of PointSource#shape. - */ - set los(shape: PointSourcePolygon | PIXI.Polygon); - - /** - * @deprecated since v10, will be removed in v12 - * @remarks PointSource#refreshSource is deprecated in favor of PointSource#refresh. - */ - refreshSource(): void; -} +export {}; + +declare global { + /** + * An abstract base class which defines a framework for effect sources which originate radially from a specific point. + * This abstraction is used by the LightSource, VisionSource, SoundSource, and MovementSource subclasses. + * + * @example A standard PointSource lifecycle: + * ```js + * const source = new PointSource({object}); // Create the point source + * source.initialize(data); // Configure the point source with new data + * source.refresh(); // Refresh the point source + * source.destroy(); // Destroy the point source + * ``` + */ + abstract class PointSource { + /** + * @param object - Some other object which is responsible for this source + */ + constructor({ object }?: { object: PlaceableObject }); + + /** + * The type of source represented by this data structure. + * Each subclass must implement this attribute. + * @remarks This is undefined in PointSource. + */ + static sourceType: string | undefined; + + /** + * Some other object which is responsible for this source. + */ + object: PlaceableObject | null; + + /** + * The object of data which configures how this source is rendered + * @defaultValue `{}` + */ + data: Partial; + + /** The polygonal shape of the point source, generated from its origin, radius, and other data. */ + shape: PointSourcePolygon | PIXI.Polygon; + + /** + * Additional information which controls whether certain behaviors of the source must be enforced + * @defaultValue `{}` + */ + protected _flags: { + renderFOV?: boolean; + } & Record; + + /** + * Returns the update ID associated with this point source. + * The update ID is increased whenever the source is initialized. + * @defaultValue `0` + */ + get updateId(): number; + + /** + * Is this point source currently active? + * Returns false if the source is disabled, temporarily suppressed, or not initialized. + * @defaultValue `false` + */ + get active(): boolean; + + /** + * Is this source currently disabled? + * Returns false if the source hasn't been initialized yet. + * @defaultValue `true` + */ + get disabled(): boolean; + + /** + * Has this point source been initialized? + * @defaultValue `false` + */ + get initialized(): boolean; + + /** + * The x-coordinate of the point source origin. + */ + get x(): number | undefined; + + /** + * The y-coordinate of the point source origin. + */ + get y(): number | undefined; + + /** + * The elevation bound to this source. + */ + get elevation(): number; + + /** + * A convenience reference to the radius of the source. + * @defaultValue `0` + */ + get radius(): number; + + /** + * Initialize and configure the PointSource using provided data. + * @param data - Provided data for configuration + * @returns The configured source + */ + initialize(data?: Partial): this; + + /** + * Subclass specific data initialization steps. + * This method is responsible for populating the instance data object. + * @param data - Provided data for configuration + */ + protected _initialize(data: Partial): void; + + /** + * Subclass specific configuration steps. Occurs after data initialization and shape computation. + * @param changes - The fields of data which changed during initialization + */ + protected _configure(changes: Partial): void; + + /** + * Refresh the state and uniforms of the PointSource. + */ + refresh(): void; + + /** + * Test whether this source should be active under current conditions? + */ + protected _isActive(): boolean; + + /** + * Subclass-specific refresh steps. + */ + protected abstract _refresh(): void; + + /** + * Steps that must be performed when the base source is destroyed. + */ + destroy(): void; + + /** + * Subclass specific destruction steps. + */ + protected abstract _destroy(): void; + + /** + * Configure the parameters of the polygon that is generated for this source. + */ + protected _getPolygonConfiguration(): PointSourcePolygonConfig; + + /** + * Create the polygon shape for this source using configured data. + */ + protected _createPolygon(): PointSourcePolygon; + + /** + * The type of source represented by this data structure. + * @deprecated since v11, will be removed in v13. + * @remarks Use PointSource#constructor.sourceType instead. + */ + get sourceType(): (typeof PointSource)["sourceType"]; + + /** + * @deprecated since v11, will be removed in v13 + * @remarks The setter PointSource#radius is deprecated. + * @remarks The radius should not be set anywhere except in PointSource#_initialize. + */ + set radius(radius); + + /** + * @deprecated since v11, will be removed in v13 + * @remarks PointSource#los is deprecated in favor of PointSource#shape. + */ + get los(): PointSourcePolygon | PIXI.Polygon; + + /** + * @deprecated since v11, will be removed in v13 + * @remarks PointSource#los is deprecated in favor of PointSource#shape. + */ + set los(shape: PointSourcePolygon | PIXI.Polygon); + + /** + * @deprecated since v10, will be removed in v12 + * @remarks PointSource#refreshSource is deprecated in favor of PointSource#refresh. + */ + refreshSource(): void; + } -declare namespace PointSource { interface PointSourceData { /** The x-coordinate of the source location */ x: number; diff --git a/src/foundry/client/pixi/sources/light-source.d.ts b/src/foundry/client/pixi/sources/light-source.d.ts index 53e5471e9..b70a6355c 100644 --- a/src/foundry/client/pixi/sources/light-source.d.ts +++ b/src/foundry/client/pixi/sources/light-source.d.ts @@ -1,7 +1,10 @@ +export {}; + // TODO: Define in client/pixi/layers/effects/visibility.js type CanvasVisibilityTest = unknown; -declare namespace LightSource { - interface LightSourceData extends RenderedPointSource.RenderedPointSourceData { + +declare global { + interface LightSourceData extends RenderedPointSourceData { /** * An opacity for the emitted light, if any * @defaultValue `0.5` @@ -68,157 +71,157 @@ declare namespace LightSource { */ vision: boolean; } -} - -/** - * A specialized subclass of the PointSource abstraction which is used to control the rendering of light sources. - */ -declare class LightSource extends RenderedPointSource { - /** {@inheritdoc} */ - static override sourceType: "light"; - - protected static _initializeShaderKeys: ["animation.type", "walls"]; - - static override _refreshUniformsKeys: [ - "dim", - "bright", - "attenuation", - "alpha", - "coloration", - "color", - "contrast", - "saturation", - "shadows", - "luminosity", - ]; - - /** - * The object of data which configures how the source is rendered - */ - data: LightSource.LightSourceData; /** - * The ratio of dim:bright as part of the source radius - * @defaultValue `0` + * A specialized subclass of the PointSource abstraction which is used to control the rendering of light sources. */ - ratio: number; + class LightSource extends RenderedPointSource { + /** {@inheritdoc} */ + static override sourceType: "light"; + + protected static _initializeShaderKeys: ["animation.type", "walls"]; + + static override _refreshUniformsKeys: [ + "dim", + "bright", + "attenuation", + "alpha", + "coloration", + "color", + "contrast", + "saturation", + "shadows", + "luminosity", + ]; - /** - * Is this darkness? - */ - get isDarkness(): boolean; + /** + * The object of data which configures how the source is rendered + */ + data: LightSourceData; - protected _initialize(data: Partial): void; + /** + * The ratio of dim:bright as part of the source radius + * @defaultValue `0` + */ + ratio: number; - protected override _configure(changes: Partial): void; + /** + * Is this darkness? + */ + get isDarkness(): boolean; - protected override _getPolygonConfiguration(): PointSourcePolygonConfig; + protected _initialize(data: Partial): void; - protected override _initializeBlending(): void; + protected override _configure(changes: Partial): void; - protected override _updateColorationUniforms(): void; + protected override _getPolygonConfiguration(): PointSourcePolygonConfig; - protected override _updateIlluminationUniforms(): void; + protected override _initializeBlending(): void; - protected override _updateBackgroundUniforms(): void; + protected override _updateColorationUniforms(): void; - /** - * Update shader uniforms shared by all shader types - * @param shader - The shader being updated - */ - protected _updateCommonUniforms(shader: AdaptiveLightingShader): void; + protected override _updateIlluminationUniforms(): void; - /** - * Map luminosity value to exposure value - * luminosity[-1 , 0 [ =\> Darkness =\> map to exposure ] 0, 1] - * luminosity[ 0 , 0.5[ =\> Light =\> map to exposure [-0.5, 0[ - * luminosity[ 0.5, 1 ] =\> Light =\> map to exposure [ 0, 1] - * @param lum - The luminosity value - * @returns The exposure value - * @internal - */ - protected _mapLuminosity(lum: number): number; + protected override _updateBackgroundUniforms(): void; - /** - * A torch animation where the luminosity and coloration decays each frame and is revitalized by flashes - * @param dt - Delta time - * @param speed - The animation speed, from 1 to 10 - * (default: `5`) - * @param intensity - The animation intensity, from 1 to 10 - * (default: `5`) - * @param reverse - Reverse the animation direction - * (default: `false`) - */ - animateTorch( - dt: number, - { speed, intensity, reverse }?: { speed: number; intensity: number; reverse: boolean }, - ): void; + /** + * Update shader uniforms shared by all shader types + * @param shader - The shader being updated + */ + protected _updateCommonUniforms(shader: AdaptiveLightingShader): void; - /** - * An animation with flickering ratio and light intensity - * @param dt - Delta time - * @param speed - The animation speed, from 1 to 10 - * (default: 5) - * @param intensity - The animation intensity, from 1 to 10 - * (default: 5) - * @param amplification - Noise amplification (\>1) or dampening (\<1) - * (default: 1) - * @param reverse - Reverse the animation direction - * (default: false) - */ - animateFlickering( - dt: number, - { - speed, - intensity, - amplification, - reverse, - }?: { speed: number; intensity: number; amplification: number; reverse: boolean }, - ): void; + /** + * Map luminosity value to exposure value + * luminosity[-1 , 0 [ =\> Darkness =\> map to exposure ] 0, 1] + * luminosity[ 0 , 0.5[ =\> Light =\> map to exposure [-0.5, 0[ + * luminosity[ 0.5, 1 ] =\> Light =\> map to exposure [ 0, 1] + * @param lum - The luminosity value + * @returns The exposure value + * @internal + */ + protected _mapLuminosity(lum: number): number; - /** - * A basic "pulse" animation which expands and contracts. - * @param dt - Delta time - * @param speed - The animation speed, from 1 to 10 - * (default: `5`) - * @param intensity - The animation intensity, from 1 to 10 - * (default: `5`) - * @param reverse - Is the animation reversed? - * (default: `false`) - */ - animatePulse( - dt: number, - { speed, intensity, reverse }?: { speed?: number; intensity?: number; reverse?: boolean }, - ): void; + /** + * A torch animation where the luminosity and coloration decays each frame and is revitalized by flashes + * @param dt - Delta time + * @param speed - The animation speed, from 1 to 10 + * (default: `5`) + * @param intensity - The animation intensity, from 1 to 10 + * (default: `5`) + * @param reverse - Reverse the animation direction + * (default: `false`) + */ + animateTorch( + dt: number, + { speed, intensity, reverse }?: { speed: number; intensity: number; reverse: boolean }, + ): void; - /** - * Test whether this LightSource provides visibility to see a certain target object. - * @param tests - The sequence of tests to perform - * @param object - The target object being tested - * @returns Is the target object visible to this source? - */ - testVisibility({ tests, object }: { tests: CanvasVisibilityTest[]; object: PlaceableObject }): boolean; + /** + * An animation with flickering ratio and light intensity + * @param dt - Delta time + * @param speed - The animation speed, from 1 to 10 + * (default: 5) + * @param intensity - The animation intensity, from 1 to 10 + * (default: 5) + * @param amplification - Noise amplification (\>1) or dampening (\<1) + * (default: 1) + * @param reverse - Reverse the animation direction + * (default: false) + */ + animateFlickering( + dt: number, + { + speed, + intensity, + amplification, + reverse, + }?: { speed: number; intensity: number; amplification: number; reverse: boolean }, + ): void; - /** - * Can this LightSource theoretically detect a certain object based on its properties? - * This check should not consider the relative positions of either object, only their state. - * @param target - The target object being tested - * @returns Can the target object theoretically be detected by this vision source? - */ - _canDetectObject(target: PlaceableObject): boolean; -} + /** + * A basic "pulse" animation which expands and contracts. + * @param dt - Delta time + * @param speed - The animation speed, from 1 to 10 + * (default: `5`) + * @param intensity - The animation intensity, from 1 to 10 + * (default: `5`) + * @param reverse - Is the animation reversed? + * (default: `false`) + */ + animatePulse( + dt: number, + { speed, intensity, reverse }?: { speed?: number; intensity?: number; reverse?: boolean }, + ): void; -/** - * A specialized subclass of the LightSource which is used to render global light source linked to the scene. - */ -declare class GlobalLightSource extends LightSource { - //@ts-expect-error Typing issue on Foundry's end - override _createPolygon(): PIXI.Polygon; + /** + * Test whether this LightSource provides visibility to see a certain target object. + * @param tests - The sequence of tests to perform + * @param object - The target object being tested + * @returns Is the target object visible to this source? + */ + testVisibility({ tests, object }: { tests: CanvasVisibilityTest[]; object: PlaceableObject }): boolean; - protected override _configureSoftEdges(): void; + /** + * Can this LightSource theoretically detect a certain object based on its properties? + * This check should not consider the relative positions of either object, only their state. + * @param target - The target object being tested + * @returns Can the target object theoretically be detected by this vision source? + */ + _canDetectObject(target: PlaceableObject): boolean; + } /** - * @remarks Sets attenuation to 0 + * A specialized subclass of the LightSource which is used to render global light source linked to the scene. */ - protected override _initialize(data: Partial): void; + class GlobalLightSource extends LightSource { + //@ts-expect-error Typing issue on Foundry's end + override _createPolygon(): PIXI.Polygon; + + protected override _configureSoftEdges(): void; + + /** + * @remarks Sets attenuation to 0 + */ + protected override _initialize(data: Partial): void; + } } diff --git a/src/foundry/client/pixi/sources/movement-source.d.ts b/src/foundry/client/pixi/sources/movement-source.d.ts index 28bc34cfc..b53a49a34 100644 --- a/src/foundry/client/pixi/sources/movement-source.d.ts +++ b/src/foundry/client/pixi/sources/movement-source.d.ts @@ -1,9 +1,13 @@ -declare class MovementSource extends PointSource { - static override sourceType: "move"; +export {}; - /** @remarks Not implemented */ - protected _refresh(): void; +declare global { + class MovementSource extends PointSource { + static override sourceType: "move"; - /** @remarks Not implemented */ - protected _destroy(): void; + /** @remarks Not implemented */ + protected _refresh(): void; + + /** @remarks Not implemented */ + protected _destroy(): void; + } } diff --git a/src/foundry/client/pixi/sources/rendered-source.d.ts b/src/foundry/client/pixi/sources/rendered-source.d.ts index 8c73dbd06..b4815aa57 100644 --- a/src/foundry/client/pixi/sources/rendered-source.d.ts +++ b/src/foundry/client/pixi/sources/rendered-source.d.ts @@ -1,8 +1,10 @@ +export {}; + /** TODO: Declared in client/pixi/core/containers/point-source-mesh */ type PointSourceMesh = unknown; -declare namespace RenderedPointSource { - interface RenderedPointSourceData extends PointSource.PointSourceData { +declare global { + interface RenderedPointSourceData extends PointSourceData { /** A color applied to the rendered effect */ color: number | null; /** An integer seed to synchronize (or de-synchronize) animations */ @@ -10,202 +12,206 @@ declare namespace RenderedPointSource { /** Is this source a temporary preview? */ preview: boolean; } + namespace RenderedPointSource { + type RenderedPointSourceAnimationConfig = { + /** The human-readable (localized) label for the animation */ + label?: string; + /** The animation function that runs every frame */ + animation?: (dt: number, options: Partial) => any; + /** A custom illumination shader used by this animation */ + illuminationShader?: AdaptiveIlluminationShader; + /** A custom coloration shader used by this animation */ + colorationShader?: AdaptiveColorationShader; + /** A custom background shader used by this animation */ + backgroundShader?: AdaptiveBackgroundShader; + /** The animation seed */ + seed?: number; + /** The animation time */ + time?: number; + }; + + type RenderedPointSourceLayer = { + /** Is this layer actively rendered? */ + active?: boolean; + /** Do uniforms need to be reset? */ + reset?: boolean; + /** Is this layer temporarily suppressed? */ + suppressed?: boolean; + /** The rendered mesh for this layer */ + mesh?: PointSourceMesh; + /** The shader instance used for the layer */ + shader?: AdaptiveLightingShader; + }; + } - type RenderedPointSourceAnimationConfig = { - /** The human-readable (localized) label for the animation */ - label?: string; - /** The animation function that runs every frame */ - animation?: (dt: number, options: Partial) => any; - /** A custom illumination shader used by this animation */ - illuminationShader?: AdaptiveIlluminationShader; - /** A custom coloration shader used by this animation */ - colorationShader?: AdaptiveColorationShader; - /** A custom background shader used by this animation */ - backgroundShader?: AdaptiveBackgroundShader; - /** The animation seed */ - seed?: number; - /** The animation time */ - time?: number; - }; - - type RenderedPointSourceLayer = { - /** Is this layer actively rendered? */ - active?: boolean; - /** Do uniforms need to be reset? */ - reset?: boolean; - /** Is this layer temporarily suppressed? */ - suppressed?: boolean; - /** The rendered mesh for this layer */ - mesh?: PointSourceMesh; - /** The shader instance used for the layer */ - shader?: AdaptiveLightingShader; - }; -} - -declare class RenderedPointSource extends PointSource { - /** - * Keys of the data object which require shaders to be re-initialized. - */ - protected static _initializeShaderKeys: string[]; - - /** - * Keys of the data object which require uniforms to be refreshed. - */ - protected static _refreshUniformsKeys: string[]; - - /** - * The offset in pixels applied to create soft edges. - * @defaultValue `-8` - */ - static EDGE_OFFSET: number; - - /** - * The animation configuration applied to this source - * @defaultValue `{}` - */ - animation: Partial; - - /** - * The object of data which configures how the source is rendered - */ - data: RenderedPointSource.RenderedPointSourceData; - - /** - * Track the status of rendering layers - */ - layers: { - background: RenderedPointSource.RenderedPointSourceLayer; - coloration: RenderedPointSource.RenderedPointSourceLayer; - illumination: RenderedPointSource.RenderedPointSourceLayer; - }; - - /** - * The color of the source as a RGB vector. - */ - colorRGB: [number, number, number] | null; - - /** - * A convenience accessor to the background layer mesh. - */ - get background(): PointSourceMesh; - - /** - * A convenience accessor to the coloration layer mesh. - */ - get coloration(): PointSourceMesh; - - /** - * A convenience accessor to the illumination layer mesh. - */ - get illumination(): PointSourceMesh; - - /** - * Is the rendered source animated? - */ - get isAnimated(): boolean; - - /** - * Has the rendered source at least one active layer? - */ - get hasActiveLayer(): boolean; - - /** - * Is this RenderedPointSource a temporary preview? - */ - get isPreview(): boolean; - - protected override _initialize(data: Partial): void; - - protected override _configure(changes: Partial): void; - - /** - * Decide whether to render soft edges with a blur. - */ - protected _configureSoftEdges(): void; - - /** - * Configure the derived color attributes and associated flag. - * @param color - The color to configure (usually a color coming for the rendered point source data) or null if no color is configured for this rendered source. - */ - protected _configureColorAttributes(color: number | null): void; - - /** - * Configure which shaders are used for each rendered layer. - * @internal - */ - protected _configureShaders(): { - background: AdaptiveLightingShader; - coloration: AdaptiveLightingShader; - illumination: AdaptiveLightingShader; - }; - - /** - * Specific configuration for a layer. - */ - protected _configureLayer(layer: RenderedPointSource.RenderedPointSourceLayer, layerId: string): void; - - /** - * Initialize the blend mode and vertical sorting of this source relative to others in the container. - */ - protected _initializeBlending(): void; - - /** - * Render the containers used to represent this light source within the LightingLayer - */ - drawMeshes(): { background: PIXI.Mesh; coloration: PIXI.Mesh; illumination: PIXI.Mesh }; - - override _refresh(): void; - - /** {@inheritDoc} */ - protected _isActive(): boolean; - - /** - * Update shader uniforms used for the background layer. - */ - protected _updateBackgroundUniforms(): void; - - /** - * Update shader uniforms used for the coloration layer. - */ - protected _updateColorationUniforms(): void; - - /** - * Update shader uniforms used for the illumination layer. - */ - protected _updateIlluminationUniforms(): void; - - protected override _destroy(): void; - - /** - * Animate the PointSource, if an animation is enabled and if it currently has rendered containers. - * @param dt - Delta time. - * @remarks Returns `this.animation.call(this, dt, options)` - */ - animate(dt: number): ReturnType>; - - /** - * Generic time-based animation used for Rendered Point Sources. - * @param dt - Delta time. - * @param speed - The animation speed, from 1 to 10 - * (default: 5) - * @param intensity - The animation intensity, from 1 to 10 - * (default: 5) - * @param reverse - Reverse the animation direction - * (default: false) - */ - animateTime(dt: number, { speed, intensity, reverse }: { speed: number; intensity: number; reverse: boolean }): void; - - /** - * @deprecated since v11, will be removed in v13. - * @remarks The RenderedPointSource#preview is deprecated. - * @remarks Use RenderedPointSource#isPreview instead. - */ - get preview(): boolean; - - /** - * @deprecated since v11, will be removed in v13. - * @remarks The RenderedPointSource#preview is deprecated. - * @remarks Set RenderedPointSourceData#preview as part of RenderedPointSourceData#initialize instead. - */ - set preview(preview); + class RenderedPointSource extends PointSource { + /** + * Keys of the data object which require shaders to be re-initialized. + */ + protected static _initializeShaderKeys: string[]; + + /** + * Keys of the data object which require uniforms to be refreshed. + */ + protected static _refreshUniformsKeys: string[]; + + /** + * The offset in pixels applied to create soft edges. + * @defaultValue `-8` + */ + static EDGE_OFFSET: number; + + /** + * The animation configuration applied to this source + * @defaultValue `{}` + */ + animation: Partial; + + /** + * The object of data which configures how the source is rendered + */ + data: RenderedPointSourceData; + + /** + * Track the status of rendering layers + */ + layers: { + background: RenderedPointSource.RenderedPointSourceLayer; + coloration: RenderedPointSource.RenderedPointSourceLayer; + illumination: RenderedPointSource.RenderedPointSourceLayer; + }; + + /** + * The color of the source as a RGB vector. + */ + colorRGB: [number, number, number] | null; + + /** + * A convenience accessor to the background layer mesh. + */ + get background(): PointSourceMesh; + + /** + * A convenience accessor to the coloration layer mesh. + */ + get coloration(): PointSourceMesh; + + /** + * A convenience accessor to the illumination layer mesh. + */ + get illumination(): PointSourceMesh; + + /** + * Is the rendered source animated? + */ + get isAnimated(): boolean; + + /** + * Has the rendered source at least one active layer? + */ + get hasActiveLayer(): boolean; + + /** + * Is this RenderedPointSource a temporary preview? + */ + get isPreview(): boolean; + + protected override _initialize(data: Partial): void; + + protected override _configure(changes: Partial): void; + + /** + * Decide whether to render soft edges with a blur. + */ + protected _configureSoftEdges(): void; + + /** + * Configure the derived color attributes and associated flag. + * @param color - The color to configure (usually a color coming for the rendered point source data) or null if no color is configured for this rendered source. + */ + protected _configureColorAttributes(color: number | null): void; + + /** + * Configure which shaders are used for each rendered layer. + * @internal + */ + protected _configureShaders(): { + background: AdaptiveLightingShader; + coloration: AdaptiveLightingShader; + illumination: AdaptiveLightingShader; + }; + + /** + * Specific configuration for a layer. + */ + protected _configureLayer(layer: RenderedPointSource.RenderedPointSourceLayer, layerId: string): void; + + /** + * Initialize the blend mode and vertical sorting of this source relative to others in the container. + */ + protected _initializeBlending(): void; + + /** + * Render the containers used to represent this light source within the LightingLayer + */ + drawMeshes(): { background: PIXI.Mesh; coloration: PIXI.Mesh; illumination: PIXI.Mesh }; + + override _refresh(): void; + + /** {@inheritDoc} */ + protected _isActive(): boolean; + + /** + * Update shader uniforms used for the background layer. + */ + protected _updateBackgroundUniforms(): void; + + /** + * Update shader uniforms used for the coloration layer. + */ + protected _updateColorationUniforms(): void; + + /** + * Update shader uniforms used for the illumination layer. + */ + protected _updateIlluminationUniforms(): void; + + protected override _destroy(): void; + + /** + * Animate the PointSource, if an animation is enabled and if it currently has rendered containers. + * @param dt - Delta time. + * @remarks Returns `this.animation.call(this, dt, options)` + */ + animate(dt: number): ReturnType>; + + /** + * Generic time-based animation used for Rendered Point Sources. + * @param dt - Delta time. + * @param speed - The animation speed, from 1 to 10 + * (default: 5) + * @param intensity - The animation intensity, from 1 to 10 + * (default: 5) + * @param reverse - Reverse the animation direction + * (default: false) + */ + animateTime( + dt: number, + { speed, intensity, reverse }: { speed: number; intensity: number; reverse: boolean }, + ): void; + + /** + * @deprecated since v11, will be removed in v13. + * @remarks The RenderedPointSource#preview is deprecated. + * @remarks Use RenderedPointSource#isPreview instead. + */ + get preview(): boolean; + + /** + * @deprecated since v11, will be removed in v13. + * @remarks The RenderedPointSource#preview is deprecated. + * @remarks Set RenderedPointSourceData#preview as part of RenderedPointSourceData#initialize instead. + */ + set preview(preview); + } } diff --git a/src/foundry/client/pixi/sources/vision-source.d.ts b/src/foundry/client/pixi/sources/vision-source.d.ts index 7d5036915..b2505d20a 100644 --- a/src/foundry/client/pixi/sources/vision-source.d.ts +++ b/src/foundry/client/pixi/sources/vision-source.d.ts @@ -120,7 +120,7 @@ declare global { ): void; } - interface VisionSourceData extends RenderedPointSource.RenderedPointSourceData { + interface VisionSourceData extends RenderedPointSourceData { /** * The amount of contrast * @defaultValue `0` From e14ef9d81da89a000836dfa37df399475052b243 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 21 Nov 2023 09:37:05 -0800 Subject: [PATCH 13/75] SoundSource --- .../client/pixi/sources/sound-source.d.ts | 39 +++---------------- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/src/foundry/client/pixi/sources/sound-source.d.ts b/src/foundry/client/pixi/sources/sound-source.d.ts index b9ef74d9a..0b35ba3ff 100644 --- a/src/foundry/client/pixi/sources/sound-source.d.ts +++ b/src/foundry/client/pixi/sources/sound-source.d.ts @@ -1,45 +1,18 @@ -import type { ConfiguredObjectClassForName } from "../../../../types/helperTypes"; +export {}; declare global { - interface SoundSourceData extends PointSource.Data { - x: number; - - y: number; - - /** The radius of the sound effect */ - radius: number; - - walls: boolean; - } - /** * A specialized subclass of the PointSource abstraction which is used to control the rendering of sound sources. */ class SoundSource extends PointSource { - /** @param object - The AmbientSound object that generates this sound source */ - constructor(object: InstanceType>); - static override sourceType: "sound"; - /** - * The object of data which configures how the source is rendered - * @defaultValue `{}` - */ - data: Partial; + protected override _getPolygonConfiguration(): PointSourcePolygonConfig; - /** - * Initialize the source with provided object data. - * @param data - Initial data provided to the point source - * @returns A reference to the initialized source - */ - initialize(data?: Partial): this; + /** @remarks Not implemented */ + protected _refresh(): void; - /** - * Process new input data provided to the SoundSource. - * @param data - Initial data provided to the sound source - * @returns The changes compared to the prior data - * @internal - */ - protected _initializeData(data: Partial): void; + /** @remarks Not implemented */ + protected _destroy(): void; } } From 7928b580a81d1cca07e4c5971ada1ff66b1a2788 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 21 Nov 2023 11:50:01 -0800 Subject: [PATCH 14/75] Polygon updates --- src/foundry/client/pixi/sources/base-source.d.ts | 5 ++++- src/foundry/client/pixi/sources/light-source.d.ts | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/foundry/client/pixi/sources/base-source.d.ts b/src/foundry/client/pixi/sources/base-source.d.ts index c9e6d09df..1db3552fd 100644 --- a/src/foundry/client/pixi/sources/base-source.d.ts +++ b/src/foundry/client/pixi/sources/base-source.d.ts @@ -148,8 +148,11 @@ declare global { /** * Create the polygon shape for this source using configured data. + * @remarks Listed return type is PointSourcePolygon + * @remarks Actual return: CONFIG.Canvas.polygonBackends[this.constructor.sourceType].create(...) + * It might be possible to derive the exact polygon type based on that. */ - protected _createPolygon(): PointSourcePolygon; + protected _createPolygon(): PIXI.Polygon; /** * The type of source represented by this data structure. diff --git a/src/foundry/client/pixi/sources/light-source.d.ts b/src/foundry/client/pixi/sources/light-source.d.ts index b70a6355c..7864516bb 100644 --- a/src/foundry/client/pixi/sources/light-source.d.ts +++ b/src/foundry/client/pixi/sources/light-source.d.ts @@ -214,7 +214,6 @@ declare global { * A specialized subclass of the LightSource which is used to render global light source linked to the scene. */ class GlobalLightSource extends LightSource { - //@ts-expect-error Typing issue on Foundry's end override _createPolygon(): PIXI.Polygon; protected override _configureSoftEdges(): void; From 8bfd6c5a93f6e9bb19a6b70a3ca8e13be75b8fdd Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 21 Nov 2023 11:56:58 -0800 Subject: [PATCH 15/75] Update Client/Pixi/Perception to v11.315 --- .../client/pixi/perception/color-manager.d.ts | 0 .../client/pixi/perception/detection-mode.d.ts | 0 src/foundry/client/pixi/perception/fog.d.ts | 0 src/foundry/client/pixi/perception/index.d.ts | 5 +++++ .../client/pixi/perception/vision-mode.d.ts | 18 ++++++++++++++++++ .../perception/weiler-atherton-clipping.d.ts | 0 6 files changed, 23 insertions(+) create mode 100644 src/foundry/client/pixi/perception/color-manager.d.ts create mode 100644 src/foundry/client/pixi/perception/detection-mode.d.ts create mode 100644 src/foundry/client/pixi/perception/fog.d.ts create mode 100644 src/foundry/client/pixi/perception/vision-mode.d.ts create mode 100644 src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts diff --git a/src/foundry/client/pixi/perception/color-manager.d.ts b/src/foundry/client/pixi/perception/color-manager.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/src/foundry/client/pixi/perception/detection-mode.d.ts b/src/foundry/client/pixi/perception/detection-mode.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/src/foundry/client/pixi/perception/fog.d.ts b/src/foundry/client/pixi/perception/fog.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/src/foundry/client/pixi/perception/index.d.ts b/src/foundry/client/pixi/perception/index.d.ts index e0a3fc40d..088d0134c 100644 --- a/src/foundry/client/pixi/perception/index.d.ts +++ b/src/foundry/client/pixi/perception/index.d.ts @@ -1,2 +1,7 @@ import "./clockwise-sweep"; +import "./color-manager"; +import "./detection-mode"; +import "./fog"; import "./perception-manager"; +import "./vision-mode"; +import "./weiler-atherton-clipping"; diff --git a/src/foundry/client/pixi/perception/vision-mode.d.ts b/src/foundry/client/pixi/perception/vision-mode.d.ts new file mode 100644 index 000000000..3944ee7f1 --- /dev/null +++ b/src/foundry/client/pixi/perception/vision-mode.d.ts @@ -0,0 +1,18 @@ +export {}; + +declare global { + class ShaderField extends foundry.data.fields.DataField { + /** + * @defaultValue + * ```typescript + * const defaults = super._defaults; + * defaults.nullable = true; + * defaults.initial = undefined; + * return defaults; + * ``` + */ + static override get _defaults(): Record; + } + + class VisionMode extends foundry.abstract.DataModel {} +} diff --git a/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts b/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts new file mode 100644 index 000000000..e69de29bb From 7d5269c728d64380a4ce1960f05e641f87777930 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 21 Nov 2023 12:58:57 -0800 Subject: [PATCH 16/75] Vision and Detection Mode --- .../pixi/perception/detection-mode.d.ts | 180 ++++++++++++++++++ .../client/pixi/perception/vision-mode.d.ts | 77 +++++++- 2 files changed, 256 insertions(+), 1 deletion(-) diff --git a/src/foundry/client/pixi/perception/detection-mode.d.ts b/src/foundry/client/pixi/perception/detection-mode.d.ts index e69de29bb..d2e4fcdca 100644 --- a/src/foundry/client/pixi/perception/detection-mode.d.ts +++ b/src/foundry/client/pixi/perception/detection-mode.d.ts @@ -0,0 +1,180 @@ +export {}; + +type TokenDetectionMode = unknown; +// TODO: Define in client/pixi/layers/effects/visibility.js +type CanvasVisibilityTest = unknown; +type CanvasVisibilityTestConfig = { + object: PlaceableObject; + tests: CanvasVisibilityTest[]; +}; + +declare global { + /** + * A Detection Mode which can be associated with any kind of sense/vision/perception. + * A token could have multiple detection modes. + */ + class DetectionMode extends foundry.abstract.DataModel { + /** {@inheritDoc} */ + static defineSchema(): any; + + /** + * Get the detection filter pertaining to this mode. + */ + static getDetectionFilter(): PIXI.Filter | undefined; + + /** + * An optional filter to apply on the target when it is detected with this mode. + */ + static _detectionFilter: PIXI.Filter | undefined; + + /** + * The type of the detection mode. If its sight based, sound based, etc. + * It is related to wall's WALL_RESTRICTION_TYPES + * @see CONST.WALL_RESTRICTION_TYPES + */ + static DETECTION_TYPES: { + /** Sight, and anything depending on light perception */ + SIGHT: 0; + /** What you can hear. Includes echolocation for bats per example */ + SOUND: 1; + /** This is mostly a sense for touch and vibration, like tremorsense, movement detection, etc. */ + MOVE: 2; + /** Can't fit in other types (smell, life sense, trans-dimensional sense, sense of humor...) */ + OTHER: 3; + }; + + /** + * The identifier of the basic sight detection mode. + */ + static BASIC_MODE_ID: "basicSight"; + + /** + * Test visibility of a target object or array of points for a specific vision source. + * @param visionSource - The vision source being tested + * @param mode - The detection mode configuration + * @param config - The visibility test configuration + * @returns Is the test target visible? + */ + testVisibility( + visionSource: VisionSource, + mode: TokenDetectionMode, + { object, tests }: CanvasVisibilityTestConfig, + ): boolean; + + /** + * Can this VisionSource theoretically detect a certain object based on its properties? + * This check should not consider the relative positions of either object, only their state. + * @param visionSource - The vision source being tested + * @param target - The target object being tested + * @returns Can the target object theoretically be detected by this vision source? + */ + protected _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; + + /** + * Evaluate a single test point to confirm whether it is visible. + * Standard detection rules require that the test point be both within LOS and within range. + * @param visionSource - The vision source being tested + * @param mode - The detection mode configuration + * @param target - The target object being tested + * @param test - The test case being evaluated + */ + protected _testPoint( + visionSource: VisionSource, + mode: TokenDetectionMode, + target: PlaceableObject, + test: CanvasVisibilityTest, + ): boolean; + + /** + * Test whether the line-of-sight requirement for detection is satisfied. + * Always true if the detection mode bypasses walls, otherwise the test point must be contained by the LOS polygon. + * The result of is cached for the vision source so that later checks for other detection modes do not repeat it. + * @param visionSource - The vision source being tested + * @param mode - The detection mode configuration + * @param target - The target object being tested + * @param test - The test case being evaluated + * @returns Is the LOS requirement satisfied for this test? + */ + protected _testLOS( + visionSource: VisionSource, + mode: TokenDetectionMode, + target: PlaceableObject, + test: CanvasVisibilityTest, + ): boolean; + + /** + * Test whether the target is within the vision angle. + * @param visionSource - The vision source being tested + * @param mode - The detection mode configuration + * @param target - The target object being tested + * @param test - The test case being evaluated + * @returns Is the point within the vision angle? + */ + protected _testAngle( + visionSource: VisionSource, + mode: TokenDetectionMode, + target: PlaceableObject, + test: CanvasVisibilityTest, + ): boolean; + + /** + * Verify that a target is in range of a source. + * @param visionSource - The vision source being tested + * @param mode - The detection mode configuration + * @param target - The target object being tested + * @param test - The test case being evaluated + * @returns Is the target within range? + */ + protected _testRange( + visionSource: VisionSource, + mode: TokenDetectionMode, + target: PlaceableObject, + test: CanvasVisibilityTest, + ): boolean; + } + + /** + * A special detection mode which models standard human vision. + * This mode is the default case which is tested first when evaluating visibility of objects. + * It is also a special case, in that it is the only detection mode which considers the area of distant light sources. + */ + class DetectionModeBasicSight extends DetectionMode { + override _testPoint( + visionSource: VisionSource, + mode: TokenDetectionMode, + target: PlaceableObject, + test: CanvasVisibilityTest, + ): boolean; + } + + /** + * Detection mode that see invisible creatures. + * This detection mode allows the source to: + * - See/Detect the invisible target as if visible. + * - The "See" version needs sight and is affected by blindness + */ + class DetectionModeInvisibility extends DetectionMode { + static override getDetectionFilter(): PIXI.Filter | undefined; + + protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; + } + + /** + * Detection mode that see creatures in contact with the ground. + */ + class DetectionModeTremor extends DetectionMode { + static override getDetectionFilter(): PIXI.Filter | undefined; + + protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; + } + + /** + * Detection mode that see ALL creatures (no blockers). + * If not constrained by walls, see everything within the range. + */ + class DetectionModeAll extends DetectionMode { + static override getDetectionFilter(): PIXI.Filter | undefined; + + protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; + } +} diff --git a/src/foundry/client/pixi/perception/vision-mode.d.ts b/src/foundry/client/pixi/perception/vision-mode.d.ts index 3944ee7f1..593c4e14f 100644 --- a/src/foundry/client/pixi/perception/vision-mode.d.ts +++ b/src/foundry/client/pixi/perception/vision-mode.d.ts @@ -12,7 +12,82 @@ declare global { * ``` */ static override get _defaults(): Record; + + /** @remarks "The value provided to a ShaderField must be an AbstractBaseShader subclass." */ + override _cast(value: any): AbstractBaseShader | Error; } - class VisionMode extends foundry.abstract.DataModel {} + /** + * A Vision Mode which can be selected for use by a Token. + * The selected Vision Mode alters the appearance of various aspects of the canvas while that Token is the POV. + */ + class VisionMode extends foundry.abstract.DataModel { + /** + * Construct a Vision Mode using provided configuration parameters and callback functions. + * @param data - Data which fulfills the model defined by the VisionMode schema. + * @param options - Additional options passed to the DataModel constructor. + */ + constructor(data: Partial, options?: object); + + /** {@inheritDoc} */ + static defineSchema(): any; + + /** The lighting illumination levels which are supported. */ + static LIGHTING_LEVELS: { + DARKNESS: -2; + HALFDARK: -1; + UNLIT: 0; + DIM: 1; + BRIGHT: 2; + BRIGHTEST: 3; + }; + + /** + * Flags for how each lighting channel should be rendered for the currently active vision modes: + * - Disabled: this lighting layer is not rendered, the shaders does not decide. + * - Enabled: this lighting layer is rendered normally, and the shaders can choose if they should be rendered or not. + * - Required: the lighting layer is rendered, the shaders does not decide. + */ + static LIGHTING_VISIBILITY: { + DISABLED: 0; + ENABLED: 1; + REQUIRED: 2; + }; + + /** + * A flag for whether this vision source is animated + * @defaultValue `false` + */ + animated: boolean; + + /** + * Special activation handling that could be implemented by VisionMode subclasses + * @param source - Activate this VisionMode for a specific source + */ + abstract _activate(source: VisionSource): void; + + /** + * Special deactivation handling that could be implemented by VisionMode subclasses + * @param source - Deactivate this VisionMode for a specific source + */ + abstract _deactivate(source: VisionSource): void; + + /** + * Special handling which is needed when this Vision Mode is activated for a VisionSource. + * @param source - Activate this VisionMode for a specific source + */ + activate(source: VisionSource): void; + + /** + * Special handling which is needed when this Vision Mode is deactivated for a VisionSource. + * @param source - Deactivate this VisionMode for a specific source + */ + deactivate(source: VisionSource): void; + + /** + * An animation function which runs every frame while this Vision Mode is active. + * @param dt - The deltaTime passed by the PIXI Ticker + */ + animate(dt: number): void; + } } From 6195024c401446eb319fe6abdcc0ca1b982b7a8d Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 21 Nov 2023 13:27:55 -0800 Subject: [PATCH 17/75] Color Manager --- .../client/pixi/perception/color-manager.d.ts | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/src/foundry/client/pixi/perception/color-manager.d.ts b/src/foundry/client/pixi/perception/color-manager.d.ts index e69de29bb..4736da39e 100644 --- a/src/foundry/client/pixi/perception/color-manager.d.ts +++ b/src/foundry/client/pixi/perception/color-manager.d.ts @@ -0,0 +1,96 @@ +export {}; + +// TODO: Define Color in common/utils/color.mjs +type Color = Number; +declare global { + /** + * A singleton class dedicated to manage the color spaces associated with the scene and the canvas. + */ + class CanvasColorManager { + /** + * Colors exposed by the manager. + */ + colors: { + darkness?: Color; + halfdark?: Color; + /** @defaultValue `0x909090` */ + background?: Color; + dim?: Color; + bright?: Color; + ambientBrightest?: Color; + ambientDaylight?: Color; + ambientDarkness?: Color; + sceneBackground?: Color; + /** @defaultValue `0x000000` */ + fogExplored?: Color; + /** @defaultValue `0x000000` */ + fogUnexplored?: Color; + }; + + /** + * Weights used by the manager to compute colors. + */ + weights: { + dark?: number; + halfdark?: number; + dim?: number; + bright?: number; + }; + + /** + * Fallback colors. + */ + static #fallbackColors: { + darknessColor: 0x242448; + daylightColor: 0xeeeeee; + brightestColor: 0xffffff; + backgroundColor: 0x909090; + fogUnexplored: 0x000000; + fogExplored: 0x000000; + }; + + /* -------------------------------------------- */ + + /** + * Returns the darkness penalty for the actual scene configuration. + */ + get darknessPenalty(): number; + + /* -------------------------------------------- */ + + /** + * Get the darkness level of this scene. + */ + get darknessLevel(): number; + + /* -------------------------------------------- */ + + /** + * Initialize color space pertaining to a specific scene. + * @param backgroundColor - The background canvas color + * @param brightestColor - The brightest ambient color + * @param darknessColor - The color of darkness + * @param darknessLevel - A preview darkness level + * @param daylightColor - The ambient daylight color + * @param fogExploredColor - The color applied to explored areas + * @param fogUnexploredColor - The color applied to unexplored areas + */ + initialize({ + backgroundColor, + brightestColor, + darknessColor, + darknessLevel, + daylightColor, + fogExploredColor, + fogUnexploredColor, + }?: { + backgroundColor: Color | number | string; + brightestColor: Color | number | string; + darknessColor: Color | number | string; + darknessLevel: number; + daylightColor: Color | number | string; + fogExploredColor: number; + fogUnexploredColor: number; + }): void; + } +} From 21288e3298eb2d758f53456987ed7f15adbf8997 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 21 Nov 2023 14:04:38 -0800 Subject: [PATCH 18/75] Fog --- src/foundry/client/pixi/perception/fog.d.ts | 104 ++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/src/foundry/client/pixi/perception/fog.d.ts b/src/foundry/client/pixi/perception/fog.d.ts index e69de29bb..3e30bcc03 100644 --- a/src/foundry/client/pixi/perception/fog.d.ts +++ b/src/foundry/client/pixi/perception/fog.d.ts @@ -0,0 +1,104 @@ +export {}; + +type SpriteMesh = unknown; +type FogTextureConfiguration = unknown; +declare global { + /** + * A fog of war management class which is the singleton canvas.fog instance. + */ + class FogManager { + /** + * The FogExploration document which applies to this canvas view + * @defaultValue `null` + */ + exploration: FogExploration | null; + + /** + * Define the number of fog refresh needed before the fog texture is extracted and pushed to the server. + */ + static COMMIT_THRESHOLD: 70; + + /** + * The exploration SpriteMesh which holds the fog exploration texture. + */ + get sprite(): SpriteMesh; + + /** + * The configured options used for the saved fog-of-war texture. + */ + get textureConfiguration(): FogTextureConfiguration; + + /** + * Does the currently viewed Scene support Token field of vision? + */ + get tokenVision(): boolean; + + /** + * Does the currently viewed Scene support fog of war exploration? + */ + get fogExploration(): boolean; + + /** + * Initialize fog of war - resetting it when switching scenes or re-drawing the canvas + */ + initialize(): Promise; + + /** + * Clear the fog and reinitialize properties (commit and save in non reset mode) + */ + clear(): Promise; + + /** + * Once a new Fog of War location is explored, composite the explored container with the current staging sprite. + * Once the number of refresh is \> to the commit threshold, save the fog texture to the database. + */ + commit(): void; + + /** + * Load existing fog of war data from local storage and populate the initial exploration sprite + */ + load(): Promise; + + /** + * Dispatch a request to reset the fog of war exploration status for all users within this Scene. + * Once the server has deleted existing FogExploration documents, the _onReset handler will re-draw the canvas. + */ + reset(): Promise; + + /** + * Request a fog of war save operation. + * Note: if a save operation is pending, we're waiting for its conclusion. + */ + save(): Promise; + + /** + * If fog of war data is reset from the server, deactivate the current fog and initialize the exploration. + * @internal + */ + _handleReset(): Promise; + + /** + * @deprecated since v11, will be removed in v13 + * @remarks pending is deprecated and redirected to the exploration container + */ + get pending(): unknown; + + /** + * @deprecated since v11, will be removed in v13 + * @remarks revealed is deprecated and redirected to the exploration container + */ + get revealed(): unknown; + + /** + * @deprecated since v11, will be removed in v13 + * @remarks update is obsolete and always returns true. The fog exploration does not record position anymore. + */ + update(source: any, force: boolean): true; + + /** + * @deprecated since v11, will be removed in v13 + * @remarks resolution is deprecated and redirected to CanvasVisibility#textureConfiguration + */ + get resolution(): unknown; + } +} From 821f01e580af0efa1c016cae1385f24a1b70ff35 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 21 Nov 2023 14:37:22 -0800 Subject: [PATCH 19/75] Perception Manager --- .../pixi/perception/perception-manager.d.ts | 209 ++++++++++-------- 1 file changed, 118 insertions(+), 91 deletions(-) diff --git a/src/foundry/client/pixi/perception/perception-manager.d.ts b/src/foundry/client/pixi/perception/perception-manager.d.ts index 2e5b92557..83cd39d2c 100644 --- a/src/foundry/client/pixi/perception/perception-manager.d.ts +++ b/src/foundry/client/pixi/perception/perception-manager.d.ts @@ -1,107 +1,134 @@ -/** - * A helper class which manages the refresh workflow for perception layers on the canvas. - * This controls the logic which batches multiple requested updates to minimize the amount of work required. - * A singleton instance is available as canvas#perception. - * @see Canvas#perception - */ -declare class PerceptionManager { - constructor(); +export {}; - /** - * The number of milliseconds by which to throttle non-immediate refreshes - */ - protected _throttleMS: number | undefined; - - /** - * An internal tracker for the last time that a perception refresh was executed - */ - protected _refreshTime: number | undefined; - - /** - * An internal tracker for the window timeout that applies a debounce to the refresh - */ - protected _timeout: number | undefined; - - /** - * Cache a reference to the canvas scene to avoid attempting scheduled refreshes after the scene is changed - */ - protected _scene: string | undefined; +/** RenderFlags and RenderFlagObject are defined in client/pixi/core/interaction/render-flags */ +type RenderFlags = Set; +interface RenderFlagObject {} +declare global { + interface PerceptionManagerFlags extends RenderFlagObject { + /** Re-initialize the entire lighting configuration */ + initializeLighting: boolean; + /** Refresh the rendered appearance of lighting */ + refreshLighting: boolean; + /** Update the configuration of light sources */ + refreshLightSources: boolean; + /** Re-initialize the entire vision configuration */ + initializeVision: boolean; + /** Update the configuration of vision sources */ + refreshVisionSources: boolean; + /** Refresh the rendered appearance of vision */ + refreshVision: boolean; + /** Re-initialize the entire ambient sound configuration */ + initializeSounds: boolean; + /** Refresh the audio state of ambient sounds */ + refreshSounds: boolean; + /** Apply a fade duration to sound refresh workflow */ + soundFadeDuration: boolean; + /** Refresh the visual appearance of tiles */ + refreshTiles: boolean; + /** Refresh the contents of the PrimaryCanvasGroup mesh */ + refreshPrimary: boolean; + } /** - * The default values of update parameters. - * When a refresh occurs, the staged parameters are reset to these initial values. + * A helper class which manages the refresh workflow for perception layers on the canvas. + * This controls the logic which batches multiple requested updates to minimize the amount of work required. + * A singleton instance is available as canvas#perception. + * @see Canvas#perception */ - static DEFAULTS: PerceptionManager.Options; + class PerceptionManager implements RenderFlagObject { + static RENDER_FLAGS: { + initializeLighting: { propagate: ["refreshLighting", "refreshVision"] }; + refreshLighting: { propagate: ["refreshLightSources"] }; + refreshLightSources: {}; + refreshVisionSources: {}; + refreshPrimary: {}; + initializeVision: { + propagate: ["refreshVision", "refreshTiles", "refreshLighting", "refreshLightSources", "refreshPrimary"]; + }; + refreshVision: { propagate: ["refreshVisionSources"] }; + initializeSounds: { propagate: ["refreshSounds"] }; + refreshSounds: {}; + refreshTiles: { propagate: ["refreshLightSources", "refreshVisionSources"] }; + soundFadeDuration: {}; + identifyInteriorWalls: { propagate: ["initializeLighting", "initializeVision"] }; + forceUpdateFog: { propagate: ["refreshVision"] }; + }; - /** - * The configured parameters for the next refresh. - */ - params: PerceptionManager.Options; + static RENDER_FLAG_PRIORITY: "PERCEPTION"; - /** - * Cancel any pending perception refresh. - */ - cancel(): void; + applyRenderFlags(): void; - /** - * Schedule a perception update with requested parameters. - * @param options - (default: `{}`) - */ - schedule(options?: DeepPartial): void; + /** + * A shim mapping which supports backwards compatibility for old-style (V9 and before) perception manager flags. + */ + static COMPATIBILITY_MAPPING: { + "lighting.initialize": "initializeLighting"; + "lighting.refresh": "refreshLighting"; + "sight.initialize": "initializeVision"; + "sight.refresh": "refreshVision"; + "sounds.initialize": "initializeSounds"; + "sounds.refresh": "refreshSounds"; + "sounds.fade": "soundFadeDuration"; + "foreground.refresh": "refreshTiles"; + }; - /** - * Perform an immediate perception update. - * @param options - (default: `{}`) - */ - update(options?: DeepPartial): void; + /** + * Update perception manager flags which configure which behaviors occur on the next frame render. + * @param flags - Flag values (true) to assign where the keys belong to PerceptionManager.FLAGS + * @param v2 - Opt-in to passing v2 flags, otherwise a backwards compatibility shim will be applied + * (default: `true`) + */ + update(flags: Partial, v2?: boolean): void; - /** - * A helper function to perform an immediate initialization plus incremental refresh. - */ - initialize(): ReturnType; + /** + * A helper function to perform an immediate initialization plus incremental refresh. + */ + initialize(): ReturnType; - /** - * A helper function to perform an incremental refresh only. - */ - refresh(): ReturnType; + /** + * A helper function to perform an incremental refresh only. + */ + refresh(): ReturnType; - /** - * Set option flags which configure the next perception update - */ - protected _set(options: DeepPartial): void; + /** + * @deprecated since v10, will be removed in v12 + * @remarks PerceptionManager#cancel is renamed to PerceptionManager#deactivate + */ + cancel(): void; - /** - * Perform the perception update workflow - * @param immediate - Perform the workflow immediately, otherwise it is throttled - * (default: `false`) - */ - protected _update(immediate?: boolean): void; + /** + * @deprecated since v10, will be removed in v12 + * @remarks PerceptionManager#schedule is replaced by PerceptionManager#update + */ + schedule(options?: DeepPartial): void; - /** - * Reset the values of a pending refresh back to their default states. - */ - protected _reset(): void; -} + /** + * @deprecated since v11 + * @remarks forceUpdateFog flag is now obsolete and has no replacement. The fog is now always updated when the visibility is refreshed + */ + static forceUpdateFog(): void; + } -declare namespace PerceptionManager { - interface Options { - lighting: { - initialize: boolean; - refresh: boolean; - }; - sight: { - initialize: boolean; - refresh: boolean; - skipUpdateFog: boolean; - forceUpdateFog: boolean; - }; - sounds: { - initialize: boolean; - refresh: boolean; - fade: boolean; - }; - foreground: { - refresh: boolean; - }; + namespace PerceptionManager { + interface Options { + lighting: { + initialize: boolean; + refresh: boolean; + }; + sight: { + initialize: boolean; + refresh: boolean; + skipUpdateFog: boolean; + forceUpdateFog: boolean; + }; + sounds: { + initialize: boolean; + refresh: boolean; + fade: boolean; + }; + foreground: { + refresh: boolean; + }; + } } } From a2a86d93be0f03192e90df375bbe44adcd2b1189 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 21 Nov 2023 15:03:05 -0800 Subject: [PATCH 20/75] WeilerAthertonClipper --- .../perception/weiler-atherton-clipping.d.ts | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts b/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts index e69de29bb..881bc9cb5 100644 --- a/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts +++ b/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts @@ -0,0 +1,133 @@ +export {}; + +declare global { + /** + * An implementation of the Weiler Atherton algorithm for clipping polygons. + * This currently only handles combinations that will not result in any holes. + * Support may be added for holes in the future. + * + * This algorithm is faster than the Clipper library for this task because it relies on the unique properties of the + * circle, ellipse, or convex simple clip object. + * It is also more precise in that it uses the actual intersection points between the circle/ellipse and polygon, + * instead of relying on the polygon approximation of the circle/ellipse to find the intersection points. + * + * For more explanation of the underlying algorithm, see: + * https://en.wikipedia.org/wiki/Weiler%E2%80%93Atherton_clipping_algorithm + * https://www.geeksforgeeks.org/weiler-atherton-polygon-clipping-algorithm + * https://h-educate.in/weiler-atherton-polygon-clipping-algorithm/ + */ + class WeilerAthertonClipper { + /** + * Construct a WeilerAthertonClipper instance used to perform the calculation. + * @param polygon - Polygon to clip + * @param clipObject - Object used to clip the polygon + * @param clipType - Type of clip to use + * @param clipOpts - Object passed to the clippingObject methods toPolygon and pointsBetween + */ + constructor(polygon: PIXI.Polygon, clipObject: PIXI.Rectangle | PIXI.Circle, clipType: number, clipOpts: object); + + /** + * The supported clip types. + * Values are equivalent to those in ClipperLib.ClipType. + * @readOnly + */ + static CLIP_TYPES: { + INTERSECT: 0; + UNION: 1; + }; + + /** + * The supported intersection types. + * @readOnly + */ + static INTERSECTION_TYPES: { + OUT_IN: -1; + IN_OUT: 1; + TANGENT: 0; + }; + + polygon: PIXI.Polygon; + + clipObject: PIXI.Rectangle | PIXI.Circle; + + /** + * Configuration settings + * @param clipType - One of CLIP_TYPES + * @param clipOpts - Object passed to the clippingObject methods + * toPolygon and pointsBetween + * @defaultValue `{}` + */ + config: { + clipType?: WeilerAthertonClipper["CLIP_TYPES"]; + clipOpts?: Record; + }; + + /** + * Union a polygon and clipObject using the Weiler Atherton algorithm. + * @param polygon - Polygon to clip + * @param clipObject - Object to clip against the polygon + * @param clipOpts - Options passed to the clipping object + * methods toPolygon and pointsBetween + */ + static union( + polygon: PIXI.Polygon, + clipObject: PIXI.Rectangle | PIXI.Circle, + clipOpts: Record, + ): PIXI.Polygon[]; + + /** + * Intersect a polygon and clipObject using the Weiler Atherton algorithm. + * @param polygon - Polygon to clip + * @param clipObject - Object to clip against the polygon + * @param clipOpts - Options passed to the clipping object + * methods toPolygon and pointsBetween + */ + static intersect( + polygon: PIXI.Polygon, + clipObject: PIXI.Rectangle | PIXI.Circle, + clipOpts: Record, + ): PIXI.Polygon[]; + + /** + * Clip a given clipObject using the Weiler-Atherton algorithm. + * + * At the moment, this will return a single PIXI.Polygon in the array unless clipType is a union and the polygon + * and clipObject do not overlap, in which case the [polygon, clipObject.toPolygon()] array will be returned. + * If this algorithm is expanded in the future to handle holes, an array of polygons may be returned. + * + * @param polygon - Polygon to clip + * @param clipObject - Object to clip against the polygon + * @param clipType - One of CLIP_TYPES + * @param canMutate - If the WeilerAtherton constructor could mutate or not the subject polygon points + * @param clipOpts - Options passed to the WeilerAthertonClipper constructor + * @returns Array of polygons and clipObjects + */ + static combine( + polygon: PIXI.Polygon, + clipObject: PIXI.Rectangle | PIXI.Circle, + { + clipType, + canMutate, + ...clipOpts + }?: { clipType: WeilerAthertonClipper["CLIP_TYPE"]; canMutate: boolean; clipOpts: Record }, + ): PIXI.Polygon[]; + + /** + * Test if one shape envelops the other. Assumes the shapes do not intersect. + * 1. Polygon is contained within the clip object. Union: clip object; Intersect: polygon + * 2. Clip object is contained with polygon. Union: polygon; Intersect: clip object + * 3. Polygon and clip object are outside one another. Union: both; Intersect: null + * @param polygon - Polygon to clip + * @param clipObject - Object to clip against the polygon + * @param clipType - One of CLIP_TYPES + * @param clipOpts - Clip options which are forwarded to toPolygon methods + * @returns Returns the polygon, the clipObject.toPolygon(), both, or neither. + */ + static testForEnvelopment( + polygon: PIXI.Polygon, + clipObject: PIXI.Rectangle | PIXI.Circle, + clipType: WeilerAthertonClipper["CLIP_TYPE"], + clipOpts: Record, + ): PIXI.Polygon[]; + } +} From dc8877c896c3c61f9e973eeaad2fc5df9af84ff8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Nov 2023 02:01:16 +0000 Subject: [PATCH 21/75] Bump @types/showdown from 2.0.5 to 2.0.6 Bumps [@types/showdown](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/showdown) from 2.0.5 to 2.0.6. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/showdown) --- updated-dependencies: - dependency-name: "@types/showdown" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6074a039b..e17acb424 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2375,9 +2375,9 @@ "dev": true }, "node_modules/@types/showdown": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@types/showdown/-/showdown-2.0.5.tgz", - "integrity": "sha512-fpzpGeXq69n032uOYFEmctcaWftPw4ZZ4saxMaIi6k+aZrTVjME1bT6xWp2JNUJiAM587FGuwW7jMqYixWzgVw==" + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/showdown/-/showdown-2.0.6.tgz", + "integrity": "sha512-pTvD/0CIeqe4x23+YJWlX2gArHa8G0J0Oh6GKaVXV7TAeickpkkZiNOgFcFcmLQ5lB/K0qBJL1FtRYltBfbGCQ==" }, "node_modules/@types/simple-peer": { "version": "9.11.8", From 79332e231560551ab6d5243ee9a50e6f8176d2f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Nov 2023 02:01:22 +0000 Subject: [PATCH 22/75] Bump @types/jquery from 3.5.28 to 3.5.29 Bumps [@types/jquery](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jquery) from 3.5.28 to 3.5.29. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jquery) --- updated-dependencies: - dependency-name: "@types/jquery" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6074a039b..8dc11882f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2347,9 +2347,9 @@ "peer": true }, "node_modules/@types/jquery": { - "version": "3.5.28", - "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.28.tgz", - "integrity": "sha512-2o/vlzaDXiGWFrHz/PhX88cy68UDc8NBBT9i1nU+EtRkKgRxMWLTlUkEJb+MRfhIw6wKK8RDmfoEXClH2PsIyA==", + "version": "3.5.29", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.29.tgz", + "integrity": "sha512-oXQQC9X9MOPRrMhPHHOsXqeQDnWeCDT3PelUIg/Oy8FAbzSZtFHRjc7IpbfFVmpLtJ+UOoywpRsuO5Jxjybyeg==", "dependencies": { "@types/sizzle": "*" } From a5dc6a38971b96bcc036b182fc0744468bc401ea Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 22 Nov 2023 08:08:45 -0800 Subject: [PATCH 23/75] Resolved Clip Types --- .../pixi/perception/weiler-atherton-clipping.d.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts b/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts index 881bc9cb5..fd3fd2206 100644 --- a/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts +++ b/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts @@ -29,12 +29,11 @@ declare global { /** * The supported clip types. * Values are equivalent to those in ClipperLib.ClipType. - * @readOnly */ - static CLIP_TYPES: { + static CLIP_TYPES: Readonly<{ INTERSECT: 0; UNION: 1; - }; + }>; /** * The supported intersection types. @@ -58,7 +57,7 @@ declare global { * @defaultValue `{}` */ config: { - clipType?: WeilerAthertonClipper["CLIP_TYPES"]; + clipType?: typeof WeilerAthertonClipper.CLIP_TYPES; clipOpts?: Record; }; @@ -109,7 +108,7 @@ declare global { clipType, canMutate, ...clipOpts - }?: { clipType: WeilerAthertonClipper["CLIP_TYPE"]; canMutate: boolean; clipOpts: Record }, + }?: { clipType: typeof WeilerAthertonClipper.CLIP_TYPES; canMutate: boolean; clipOpts: Record }, ): PIXI.Polygon[]; /** @@ -126,7 +125,7 @@ declare global { static testForEnvelopment( polygon: PIXI.Polygon, clipObject: PIXI.Rectangle | PIXI.Circle, - clipType: WeilerAthertonClipper["CLIP_TYPE"], + clipType: typeof WeilerAthertonClipper.CLIP_TYPES, clipOpts: Record, ): PIXI.Polygon[]; } From 4cf39b2d0ca513f63d5c14b6b4a89a1be2a2c937 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 22 Nov 2023 09:16:23 -0800 Subject: [PATCH 24/75] Clockwise Sweep & other updates --- .../pixi/perception/clockwise-sweep.d.ts | 303 ++---------------- .../pixi/perception/perception-manager.d.ts | 6 +- .../perception/weiler-atherton-clipping.d.ts | 4 +- 3 files changed, 33 insertions(+), 280 deletions(-) diff --git a/src/foundry/client/pixi/perception/clockwise-sweep.d.ts b/src/foundry/client/pixi/perception/clockwise-sweep.d.ts index 989a6793a..2915f398f 100644 --- a/src/foundry/client/pixi/perception/clockwise-sweep.d.ts +++ b/src/foundry/client/pixi/perception/clockwise-sweep.d.ts @@ -5,71 +5,6 @@ declare global { type EdgeSet = Set; - interface ClockwiseSweepPolygonConfig extends PointSourcePolygonConfig { - /** @defaultValue `canvas.dimensions.maxR` */ - radius?: number; - - /** @defaultValue `360` */ - angle?: number; - - /** @defaultValue `0` */ - rotation?: number; - - /** - * The desired density of padding rays, a number per PI - * @defaultValue `12` - */ - density?: number; - - /** - * The minimum angle of emission - * @defaultValue `config.hasLimitedAngle ? Math.normalizeRadians(Math.toRadians(config.rotation + 90 - (config.angle / 2))) : -Math.PI` - */ - aMin?: number; - - /** - * The maximum angle of emission - * @defaultValue `config.hasLimitedAngle ? config.aMin + Math.toRadians(config.angle) : Math.PI` - */ - aMax?: number; - - /** - * The minimum ray of emission - * @defaultValue `Ray.fromAngle(origin.x, origin.y, config.aMin, config.radius)` - */ - rMin?: PolygonRay; - - /** - * The maximum ray of emission - * @defaultValue `config.hasLimitedAngle && Ray.fromAngle(origin.x, origin.y, config.aMax, config.radius)` - */ - rMax?: PolygonRay; - - /** - * Does this polygon have a limited radius? - * @defaultValue `config.radius > 0` - */ - hasLimitedRadius?: boolean; - - /** - * Does this polygon have a limited angle? - * @defaultValue `config.angle !== 0` - */ - hasLimitedAngle?: boolean; - - /** - * The squared radius of the polygon, for faster computation later - * @defaultValue `Math.pow(config.radius, 2)` - */ - radius2?: number; - - /** - * A small epsilon used for avoiding floating point precision issues - * @defaultValue `0.5 / config.radius` - */ - radiusE?: number; - } - interface PolygonRay extends Ray { result: CollisionResult; } @@ -80,14 +15,6 @@ declare global { * This algorithm was created with valuable contributions from https://github.com/caewok */ class ClockwiseSweepPolygon extends PointSourcePolygon { - /** - * The configuration of this polygon. - */ - config: - | ClockwiseSweepPolygonConfig - | ClockwiseSweepPolygon.InitializedConfig - | ClockwiseSweepPolygon.LimitedAngleConfig; - /** * A mapping of vertices which define potential collision points */ @@ -103,31 +30,16 @@ declare global { */ rays: PolygonRay[]; - static benchmark( - iterations: number, - ...args: Parameters<(typeof ClockwiseSweepPolygon)["create"]> - ): ReturnType; - - static create( - origin: Point, - config: Parameters[1], - ): ReturnType; - /** * @param origin - The provided polygon origin * @param config - The provided configuration object */ - override initialize(origin: Point, config: ClockwiseSweepPolygon.InitConfig): void; + override initialize(origin: Point, config: PointSourcePolygonConfig): void; - protected override _compute(): void; + /** {@inheritDoc} */ + clone(): ClockwiseSweepPolygon; - /** - * Round vertices of a ray segment - * @param ray - The provided ray - * @returns The ray with rounded vertices - * @internal - */ - protected _roundRayVertices(ray: PolygonRay): PolygonRay; + protected override _compute(): void; /** * Translate walls and other obstacles into edges which limit visibility @@ -187,220 +99,61 @@ declare global { protected _sortVertices(): PolygonVertex[]; /** - * Test whether a target vertex is behind some closer active edge - * @param ray - The ray being evaluated + * Test whether a target vertex is behind some closer active edge. + * If the vertex is to the left of the edge, is must be behind the edge relative to origin. + * If the vertex is collinear with the edge, it should be considered "behind" and ignored. + * We know edge.A is ccw to edge.B because of the logic in _identifyVertices. * @param vertex - The target vertex * @param activeEdges - The set of active edges * @returns Is the target vertex behind some closer edge? * @internal */ protected _isVertexBehindActiveEdges( - ray: PolygonRay, vertex: PolygonVertex, activeEdges: EdgeSet, ): { isBehind: boolean; wasLimited: boolean }; /** - * Determine the final result of a candidate ray. - * @param ray - The candidate ray being tested - * @param vertex - The target vertex - * @param result - The result being prepared - * @param activeEdges - The set of active edges + * Determine the result for the sweep at a given vertex + * @param vertex - The target vertex + * @param activeEdges - The set of active edges + * @param hasCollinear - Are there collinear vertices behind the target vertex? * @internal */ - protected _determineRayResult( - ray: PolygonRay, - vertex: PolygonVertex, - result: CollisionResult, - activeEdges: EdgeSet, - ): void; + protected _determineSweepResult(vertex: PolygonVertex, activeEdges: EdgeSet, hasCollinear: boolean): void; /** - * Jump to a new closest active edge. - * In this case, our target vertex will be the primary collision. - * We may have a secondary collision if other active edges exist or if the vertex is prior to the ray endpoint. - * @internal + * Switch to a new active edge. + * Moving from the origin, a collision that first blocks a side must be stored as a polygon point. + * Subsequent collisions blocking that side are ignored. Once both sides are blocked, we are done. * - * @param ray - The ray being emitted - * @param result - The pending collision result - * @param activeEdges - The set of currently active edges - * @param isBinding - Is the target vertex a binding collision point? - * @param secondaryBefore - Whether to add secondary collision points before ("unshift") or after ("push") - * (default: `true`) - */ - protected _beginNewEdge( - ray: PolygonRay, - result: CollisionResult, - activeEdges: EdgeSet, - isBinding: boolean, - secondaryBefore?: boolean, - ): void; - - /** - * If the target vertex is connected to a currently active edge, we are terminating that edge. - * We know the target vertex is not behind another edge, so the target is our initial collision. - * There may be a second collision afterwards if no connected walls continue clockwise. - * @internal + * Collisions that limit a side will block if that side was previously limited. * - * @param ray - The ray being emitted - * @param result - The pending collision result - * @param activeEdges - The set of currently active edges - * @param isBinding - Is the target vertex a binding collision point? - */ - protected _completeCurrentEdge( - ray: PolygonRay, - result: CollisionResult, - activeEdges: EdgeSet, - isBinding: boolean, - ): void; - - /** - * Augment a CollisionResult with an additional secondary collision. - * Require secondary collisions to be a greater distance than the target vertex. - * @param ray - The ray being evaluated - * @param result - The collision result - * @param edges - The subset of active edges which are candidates for collision - * @internal - */ - protected _getSecondaryCollisions(ray: PolygonRay, result: CollisionResult, edges: EdgeSet): PolygonVertex[]; - - /** - * Identify collision points for a required terminal ray. + * If neither side is blocked and the ray internally collides with a non-limited edge, n skip without adding polygon + * endpoints. Sight is unaffected before this edge, and the internal collision can be ignored. * @internal * - * @param ray - The ray being emitted * @param result - The pending collision result * @param activeEdges - The set of currently active edges */ - protected _findRequiredCollision(ray: PolygonRay, result: CollisionResult, activeEdges: EdgeSet): void; + _switchEdge(result: CollisionResult, activeEdges: EdgeSet): void; /** * Identify the collision points between an emitted Ray and a set of active edges. - * @param ray - The candidate ray to test - * @param activeEdges - The set of active edges + * @param ray - The candidate ray to test + * @param internalEdges - The set of edges to check for collisions against the ray * @returns A sorted array of collision points * @internal */ - protected _getRayCollisions( - ray: PolygonRay, - activeEdges: EdgeSet, - { - minimumDistance, - }?: { - /** - * Require collisions to exceed some minimum distance - * @defaultValue `0` - */ - minimumDistance?: number; - }, - ): PolygonVertex[]; - - /** - * Update the set of active edges given the result of an emitted ray. - * @param result - The collision result - * @param activeEdges - The set of currently active edges - * @internal - */ - protected _updateActiveEdges(result: CollisionResult, activeEdges: EdgeSet): void; + protected _getInternalEdgeCollisions(ray: PolygonRay, internalEdges: EdgeSet): PolygonVertex[]; /** - * Construct the polygon from ray collision points - * @internal + * @deprecated since v10, will be removed in v12 + * @remarks ClockwiseSweepPolygon.getRayCollisions has been renamed to ClockwiseSweepPolygon.testCollision */ - protected _constructPolygonPoints(): void; - - /** - * Add additional points to limited-radius polygons to approximate the curvature of a circle - * @param r0 - The prior ray that collided with some vertex - * @param r1 - The next ray that collides with some vertex - * @internal - */ - protected _getPaddingPoints(r0: PolygonRay, r1: PolygonRay): Point[]; - - /** - * Test whether a wall should be included in the computed polygon for a given origin and type - * @param wall - The Wall being considered - * @param origin - The origin point for the ray or polygon - * @param type - The type of perception or movement restriction being imposed - * @returns Should the wall be included? - * - */ - static testWallInclusion( - wall: ConfiguredObjectClassForName<"Wall">, - origin: Point, - type: foundry.CONST.WALL_RESTRICTION_TYPES, - ): boolean; - - /** - * Test whether a vertex lies between two boundary rays - * @param vertex - The target vertex - * @param rMin - The counter-clockwise bounding ray - * @param rMax - The clockwise bounding ray - * @param angle - The angle being tested, in degrees - * @returns Is the vertex between the two rays? - */ - static pointBetweenRays(vertex: PolygonVertex, rMin: PolygonRay, rMax: PolygonRay, angle: number): boolean; - - override visualize(): void; - - /** - * Check whether a given ray intersects with walls. - * @param ray - The Ray being tested - * @param options - Options which customize how collision is tested - * @returns Whether any collision occurred if mode is "any" - * An array of collisions, if mode is "all" - * The closest collision, if mode is "closest" - */ - static getRayCollisions( + static getRayCollisions( ray: PolygonRay, - options?: { - /** - * Which collision type to check, a value in CONST.WALL_RESTRICTION_TYPES - * @defaultValue `"move"` - */ - type?: foundry.CONST.WALL_RESTRICTION_TYPES; - - /** - * Which type of collisions are returned: any, closest, all - * @defaultValue `"all"` - */ - mode?: Mode; - - /** - * Visualize some debugging data to help understand the collision test - * @defaultValue `false` - */ - debug?: boolean; - }, - ): Mode extends "any" ? boolean : Mode extends "closest" ? PolygonVertex : PolygonVertex[]; - - /** - * Visualize the polygon, displaying its computed area, rays, and collision points - * @internal - */ - protected static _visualizeCollision(ray: PolygonRay, edges: EdgeSet, collisions: PolygonVertex[]): void; - } - - namespace ClockwiseSweepPolygon { - type InitConfig = Partial>; - - interface InitializedConfig extends ClockwiseSweepPolygonConfig { - hasLimitedRadius: boolean; - radius: number; - radius2: number; - radiusE: number; - aMin: number; - aMax: number; - angle: number; - rotation: number; - hasLimitedAngle: boolean; - density: number; - rMin: PolygonRay; - } - - interface LimitedAngleConfig extends InitializedConfig { - hasLimitedAngle: true; - rMax: PolygonRay; - } + config: PointSourcePolygonConfig, + ): boolean | PolygonVertex | PolygonVertex[] | null; } } diff --git a/src/foundry/client/pixi/perception/perception-manager.d.ts b/src/foundry/client/pixi/perception/perception-manager.d.ts index 83cd39d2c..b8a0ca3bd 100644 --- a/src/foundry/client/pixi/perception/perception-manager.d.ts +++ b/src/foundry/client/pixi/perception/perception-manager.d.ts @@ -2,9 +2,9 @@ export {}; /** RenderFlags and RenderFlagObject are defined in client/pixi/core/interaction/render-flags */ type RenderFlags = Set; -interface RenderFlagObject {} +declare class RenderFlagObject {} declare global { - interface PerceptionManagerFlags extends RenderFlagObject { + interface PerceptionManagerFlags extends RenderFlags { /** Re-initialize the entire lighting configuration */ initializeLighting: boolean; /** Refresh the rendered appearance of lighting */ @@ -35,7 +35,7 @@ declare global { * A singleton instance is available as canvas#perception. * @see Canvas#perception */ - class PerceptionManager implements RenderFlagObject { + class PerceptionManager extends RenderFlagObject { static RENDER_FLAGS: { initializeLighting: { propagate: ["refreshLighting", "refreshVision"] }; refreshLighting: { propagate: ["refreshLightSources"] }; diff --git a/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts b/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts index fd3fd2206..78a86cfd6 100644 --- a/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts +++ b/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts @@ -39,11 +39,11 @@ declare global { * The supported intersection types. * @readOnly */ - static INTERSECTION_TYPES: { + static INTERSECTION_TYPES: Readonly<{ OUT_IN: -1; IN_OUT: 1; TANGENT: 0; - }; + }>; polygon: PIXI.Polygon; From 3d8ad8d0015f3e0758ceb6775bc49e9a980133c3 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 22 Nov 2023 09:17:35 -0800 Subject: [PATCH 25/75] Made VisionMode abstract --- src/foundry/client/pixi/perception/vision-mode.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/foundry/client/pixi/perception/vision-mode.d.ts b/src/foundry/client/pixi/perception/vision-mode.d.ts index 593c4e14f..681442554 100644 --- a/src/foundry/client/pixi/perception/vision-mode.d.ts +++ b/src/foundry/client/pixi/perception/vision-mode.d.ts @@ -21,7 +21,7 @@ declare global { * A Vision Mode which can be selected for use by a Token. * The selected Vision Mode alters the appearance of various aspects of the canvas while that Token is the POV. */ - class VisionMode extends foundry.abstract.DataModel { + abstract class VisionMode extends foundry.abstract.DataModel { /** * Construct a Vision Mode using provided configuration parameters and callback functions. * @param data - Data which fulfills the model defined by the VisionMode schema. From a1aa524b37a699d3a7fa4075bd710b9405222ea9 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 22 Nov 2023 09:22:20 -0800 Subject: [PATCH 26/75] Type checking fixes --- .../client/pixi/perception/detection-mode.d.ts | 7 +++++++ .../client/pixi/perception/vision-mode.d.ts | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/foundry/client/pixi/perception/detection-mode.d.ts b/src/foundry/client/pixi/perception/detection-mode.d.ts index d2e4fcdca..89a8491ad 100644 --- a/src/foundry/client/pixi/perception/detection-mode.d.ts +++ b/src/foundry/client/pixi/perception/detection-mode.d.ts @@ -8,6 +8,13 @@ type CanvasVisibilityTestConfig = { tests: CanvasVisibilityTest[]; }; +// TODO: Remove after foundry.abstract.DataModel is defined +declare namespace foundry { + namespace abstract { + class DataModel {} + } +} + declare global { /** * A Detection Mode which can be associated with any kind of sense/vision/perception. diff --git a/src/foundry/client/pixi/perception/vision-mode.d.ts b/src/foundry/client/pixi/perception/vision-mode.d.ts index 681442554..ab89773bc 100644 --- a/src/foundry/client/pixi/perception/vision-mode.d.ts +++ b/src/foundry/client/pixi/perception/vision-mode.d.ts @@ -1,5 +1,21 @@ export {}; +// TODO: Remove after DataField && DataModel are implemented +declare namespace foundry { + namespace data { + namespace fields { + class DataField { + static get _defaults(): Record; + + _cast(value: any): any; + } + } + } + namespace abstract { + class DataModel {} + } +} + declare global { class ShaderField extends foundry.data.fields.DataField { /** From 104c9d8888774728dce8e71f919c6c34ad3fbadf Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 22 Nov 2023 10:04:28 -0800 Subject: [PATCH 27/75] Fixed Linting Errors --- src/foundry/common/abstract/data.mjs.d.ts | 4 +-- src/foundry/common/data/fields.mjs.d.ts | 4 +-- src/foundry/common/types.mjs.d.ts | 12 ++++----- src/foundry/common/utils/helpers.mjs.d.ts | 30 +++++++++++------------ src/types/helperTypes.d.ts | 16 ++++++------ src/types/utils.d.ts | 20 +++++++-------- 6 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/foundry/common/abstract/data.mjs.d.ts b/src/foundry/common/abstract/data.mjs.d.ts index 495c96dde..9dfdd6436 100644 --- a/src/foundry/common/abstract/data.mjs.d.ts +++ b/src/foundry/common/abstract/data.mjs.d.ts @@ -137,8 +137,8 @@ declare abstract class DocumentData< ): ConcreteDocumentField extends { default?: undefined } ? undefined : ConcreteDocumentField extends { default: (data?: object) => infer V } - ? V - : ConcreteDocumentField["default"]; + ? V + : ConcreteDocumentField["default"]; /** * Initialize the instance by copying data from the source object to instance attributes. diff --git a/src/foundry/common/data/fields.mjs.d.ts b/src/foundry/common/data/fields.mjs.d.ts index 033d3e13a..10bf95e5b 100644 --- a/src/foundry/common/data/fields.mjs.d.ts +++ b/src/foundry/common/data/fields.mjs.d.ts @@ -430,8 +430,8 @@ interface ForeignDocumentField extends Do } ? true : T extends { nullable: false } - ? false - : boolean; + ? false + : boolean; default: T extends { default: infer U; } diff --git a/src/foundry/common/types.mjs.d.ts b/src/foundry/common/types.mjs.d.ts index 15a544283..20f66948c 100644 --- a/src/foundry/common/types.mjs.d.ts +++ b/src/foundry/common/types.mjs.d.ts @@ -148,12 +148,12 @@ interface SettingConfig { type?: T extends string ? typeof String : T extends number - ? typeof Number - : T extends boolean - ? typeof Boolean - : T extends Array - ? typeof Array - : ConstructorOf; + ? typeof Number + : T extends boolean + ? typeof Boolean + : T extends Array + ? typeof Array + : ConstructorOf; /** For string Types, defines the allowable values */ choices?: (T extends number | string ? Record : never) | undefined; diff --git a/src/foundry/common/utils/helpers.mjs.d.ts b/src/foundry/common/utils/helpers.mjs.d.ts index 3479c85e9..5295e6098 100644 --- a/src/foundry/common/utils/helpers.mjs.d.ts +++ b/src/foundry/common/utils/helpers.mjs.d.ts @@ -340,19 +340,19 @@ type RemoveDeletingObjectKeys = M["performDelet type MergeObjectProperty = T extends Array ? U : T extends Record - ? U extends Record - ? M extends { recursive: false } - ? U - : Result< - T, - U, - Omit & { - insertKeys: M["insertValues"]; - performDeletions: M["performDeletions"] extends true ? true : false; - } - > - : U - : U; + ? U extends Record + ? M extends { recursive: false } + ? U + : Result< + T, + U, + Omit & { + insertKeys: M["insertValues"]; + performDeletions: M["performDeletions"] extends true ? true : false; + } + > + : U + : U; type UpdateKeys = M extends { overwrite: false } ? T : { [K in keyof T]: K extends keyof U ? MergeObjectProperty : T[K] }; @@ -369,8 +369,8 @@ type Result = UpdateInsert< type WithWidenedArrayTypes = T extends Array ? Array : T extends Record - ? { [K in keyof T]: WithWidenedArrayTypes } - : T; + ? { [K in keyof T]: WithWidenedArrayTypes } + : T; /** * Update a source object by replacing its keys and values with those from a target object. diff --git a/src/types/helperTypes.d.ts b/src/types/helperTypes.d.ts index e475bf3d1..f02d71490 100644 --- a/src/types/helperTypes.d.ts +++ b/src/types/helperTypes.d.ts @@ -10,16 +10,16 @@ export type PropertiesDataType | AnyDocumentData> = > ? U : T extends Document - ? PropertiesDataType - : never; + ? PropertiesDataType + : never; type PropertyTypeToSourceType = T extends EmbeddedCollection ? SourceDataType>[] : T extends Array - ? Array> - : T extends AnyDocumentData - ? SourceDataType - : T; + ? Array> + : T extends AnyDocumentData + ? SourceDataType + : T; export type PropertiesToSource = { [Key in keyof T]: PropertyTypeToSourceType; @@ -34,8 +34,8 @@ type SourceDataType | AnyDocumentData> = T extends > ? U : T extends Document - ? SourceDataType - : never; + ? SourceDataType + : never; /** * Returns the type of the constructor data for the given {@link DocumentData}. diff --git a/src/types/utils.d.ts b/src/types/utils.d.ts index 8cc4b5286..1fce65af3 100644 --- a/src/types/utils.d.ts +++ b/src/types/utils.d.ts @@ -107,16 +107,16 @@ type Merge = T extends object ? U extends Array | ReadonlyArray ? U : U extends object - ? { - [Key in keyof T | keyof U]: Key extends keyof T - ? Key extends keyof U - ? Merge - : T[Key] - : Key extends keyof U - ? U[Key] - : never; - } - : U + ? { + [Key in keyof T | keyof U]: Key extends keyof T + ? Key extends keyof U + ? Merge + : T[Key] + : Key extends keyof U + ? U[Key] + : never; + } + : U : U; /** From 622e7a0aa5e8bf541269157d19ebb68d30e3c01d Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 22 Nov 2023 11:18:09 -0800 Subject: [PATCH 28/75] PointSourcePolygon updates --- .../pixi/core/shapes/source-polygon.d.ts | 170 +++++++++++++++--- 1 file changed, 142 insertions(+), 28 deletions(-) diff --git a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts index 0fb387dcb..282c0891b 100644 --- a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts +++ b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts @@ -14,20 +14,53 @@ interface PointSourcePolygonConfig { /** The direction of facing, required if the angle is limited */ rotation?: number; + /** Customize how wall direction of one-way walls is applied */ + wallDirectionMode?: number; + + /** Compute the polygon with threshold wall constraints applied */ + useThreshold?: boolean; + /** Display debugging visualization and logging for the polygon */ debug?: boolean; - /** Is this polygon constrained by any walls? */ - walls?: boolean; - /** The object (if any) that spawned this polygon. */ source?: PointSource; + + /** Limiting polygon boundary shapes */ + boundaryShapes?: Array; + + /** Does this polygon use the Scene inner or outer bounding rectangle */ + useInnerBounds?: Readonly; + + /** Does this polygon have a limited radius? */ + hasLimitedRadius?: Readonly; + + /** Does this polygon have a limited angle? */ + hasLimitedAngle?: Readonly; + + /** The computed bounding box for the polygon */ + boundingBox?: Readonly; } /** * An extension of the default PIXI.Polygon which is used to represent the line of sight for a point source. */ declare abstract class PointSourcePolygon extends PIXI.Polygon { + /** + * Customize how wall direction of one-way walls is applied + */ + static WALL_DIRECTION_MODES: Readonly<{ + NORMAL: 0; + REVERSED: 1; + BOTH: 2; + }>; + + /** + * The rectangular bounds of this polygon + * @defaultValue `new PIXI.Rectangle(0, 0, 0, 0)` + */ + bounds: PIXI.Rectangle; + /** * The origin point of the source polygon. */ @@ -40,27 +73,20 @@ declare abstract class PointSourcePolygon extends PIXI.Polygon { config: PointSourcePolygonConfig; /** - * A cached array of SightRay objects used to compute the polygon. - * @defaultValue `[]` - * @remarks This is documented as `SightRay[]` but that's only correct for the {@link RadialSweepPolygon} + * An indicator for whether this polygon is constrained by some boundary shape? */ - rays: Ray[]; - - /** - * Compute the rectangular bounds for the Polygon. - * @param points - The initially provided array of coordinates - * @returns The computed Rectangular bounds - */ - protected _getBounds(points: number[]): PIXI.Rectangle; + get isConstrained(): boolean; /** * Benchmark the performance of polygon computation for this source * @param iterations - The number of test iterations to perform - * @param args - Arguments passed to the compute method + * @param origin - The origin point to benchmark + * @param config - The polygon configuration to benchmark */ static benchmark( iterations: number, - ...args: Parameters<(typeof PointSourcePolygon)["create"]> + origin: Point, + config: PointSourcePolygonConfig, ): ReturnType; /** @@ -73,7 +99,14 @@ declare abstract class PointSourcePolygon extends PIXI.Polygon { static create( origin: Point, config?: Parameters[1] | undefined, - ): ReturnType; + ): ReturnType; + + /** + * Create a clone of this polygon. + * This overrides the default PIXI.Polygon#clone behavior. + * @returns A cloned instance + */ + override clone(): PointSourcePolygon; /** * Compute the polygon using the origin and configuration options. @@ -93,18 +126,99 @@ declare abstract class PointSourcePolygon extends PIXI.Polygon { */ initialize(origin: Point, config: PointSourcePolygonConfig): void; + /** + * Get the super-set of walls which could potentially apply to this polygon. + * Define a custom collision test used by the Quadtree to obtain candidate Walls. + */ + protected _getWalls(): Set; + + /** + * Test whether a wall should be included in the computed polygon for a given origin and type + * @param wall - The Wall being considered + * @param bounds - The overall bounding box + * @returns Should the wall be included? + */ + protected _testWallInclusion(wall: Wall, bounds: PIXI.Rectangle): boolean; + + /** + * Compute the aggregate bounding box which is the intersection of all boundary shapes. + * Round and pad the resulting rectangle by 1 pixel to ensure it always contains the origin. + */ + protected _defineBoundingBox(): PIXI.Rectangle; + + /** + * Apply a constraining boundary shape to an existing PointSourcePolygon. + * Return a new instance of the polygon with the constraint applied. + * The new instance is only a "shallow clone", as it shares references to component properties with the original. + * @param constraint - The constraining boundary shape + * @param intersectionOptions - Options passed to the shape intersection method + * @returns A new constrained polygon + */ + applyConstraint( + constraint: PIXI.Circle | PIXI.Rectangle | PIXI.Polygon, + intersectionOptions?: Record, + ): PointSourcePolygon; + + /** {@inheritDoc} */ + contains(x: number, y: number): boolean; + + /** + * Constrain polygon points by applying boundary shapes. + */ + protected _constrainBoundaryShapes(): void; + + /** + * Test whether a Ray between the origin and destination points would collide with a boundary of this Polygon. + * A valid wall restriction type is compulsory and must be passed into the config options. + * @param origin - An origin point + * @param destination - A destination point + * @param config - The configuration that defines a certain Polygon type + * @param mode - The collision mode to test: "any", "all", or "closest" + * (default: "all") + * @returns The collision result depends on the mode of the test: + * * any: returns a boolean for whether any collision occurred + * * all: returns a sorted array of PolygonVertex instances + * * closest: returns a PolygonVertex instance or null + */ + static testCollision( + origin: Point, + destination: Point, + { mode, ...config }: { mode?: string; config: PointSourcePolygonConfig }, + ): boolean | PolygonVertex | PolygonVertex[] | null; + + /** + * Determine the set of collisions which occurs for a Ray. + * @param ray - The Ray to test + * @param mode - The collision mode being tested + * @returns The collision test result + */ + protected abstract _testCollision(ray: Ray, mode: string): boolean | PolygonVertex | PolygonVertex[] | null; + /** * Visualize the polygon, displaying its computed area, rays, and collision points + * @returns The rendered debugging shape */ - visualize(): void; -} + visualize(): PIXI.Graphics | undefined; -/** - * Compare sight performance between different algorithms - * @param n - The number of iterations - * @param args - Arguments passed to the polygon compute function - */ -declare function benchmarkSight( - n: number, - ...args: Parameters<(typeof ClockwiseSweepPolygon)["benchmark"]> -): Promise; + /** + * Determine if the shape is a complete circle. + * The config object must have an angle and a radius properties. + */ + isCompleteCircle(): boolean; + + /** + * Augment a PointSourcePolygon by adding additional coverage for shapes permitted by threshold walls. + * @param polygon - The computed polygon + * @returns The augmented polygon + */ + static applyThresholdAttenuation(polygon: PointSourcePolygon): PointSourcePolygon; + + /** + * @deprecated since v11, will be removed in v13 + * @remarks You are referencing PointSourcePolygon#rays which is no longer a required property of that interface. + * If your subclass uses the rays property it should be explicitly defined by the subclass which requires it. + */ + get rays(): Ray[]; + + set rays(rays); +} From dcda6bfad6b8d17286fd4493d28f37c386de6553 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 22 Nov 2023 13:43:24 -0800 Subject: [PATCH 29/75] PIXI.Polygon Extensions --- .../client/pixi/extensions/polygon.d.ts | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 src/foundry/client/pixi/extensions/polygon.d.ts diff --git a/src/foundry/client/pixi/extensions/polygon.d.ts b/src/foundry/client/pixi/extensions/polygon.d.ts new file mode 100644 index 000000000..0abb5dc0b --- /dev/null +++ b/src/foundry/client/pixi/extensions/polygon.d.ts @@ -0,0 +1,150 @@ +export {}; + +declare global { + namespace PIXI { + interface Polygon { + /** + * Test whether the polygon is has a positive signed area. + * Using a y-down axis orientation, this means that the polygon is "clockwise". + */ + get isPositive(): boolean; + + /** + * @remarks Non enumerable + */ + _isPositive?: boolean; + + /** + * Clear the cached signed orientation. + */ + clearCache(): void; + + /** + * Compute the signed area of polygon using an approach similar to ClipperLib.Clipper.Area. + * The math behind this is based on the Shoelace formula. https://en.wikipedia.org/wiki/Shoelace_formula. + * The area is positive if the orientation of the polygon is positive. + * @returns The signed area of the polygon + */ + signedArea(): number; + + /** + * Reverse the order of the polygon points in-place, replacing the points array into the polygon. + * Note: references to the old points array will not be affected. + * @returns This polygon with its orientation reversed + */ + reverseOrientation(): PIXI.Polygon; + + /** + * Add a de-duplicated point to the Polygon. + * @param point - The point to add to the Polygon + * @returns A reference to the polygon for method chaining + */ + addPoint(point: Point): this; + + /** + * Return the bounding box for a PIXI.Polygon. + * The bounding rectangle is normalized such that the width and height are non-negative. + * @returns The bounding PIXI.Rectangle + */ + getBounds(): PIXI.Rectangle; + + /** + * Construct a PIXI.Polygon instance from an array of clipper points [\{X,Y\}, ...]. + * @param points - An array of points returned by clipper + * @param options - Options which affect how canvas points are generated + * @param scalingFactor - + * @returns The resulting PIXI.Polygon + */ + fromClipperPoints( + points: ClipperPoint[], + options?: { + /** + * A scaling factor used to preserve floating point precision + * (default: `1`) + */ + scalingFactor: number; + }, + ): PIXI.Polygon; + + /** + * Convert a PIXI.Polygon into an array of clipper points [\{X,Y\}, ...]. + * Note that clipper points must be rounded to integers. + * In order to preserve some amount of floating point precision, an optional scaling factor may be provided. + * @param options - Options which affect how clipper points are generated + * @returns An array of points to be used by clipper + */ + toClipperPoints(options?: { + /** A scaling factor used to preserve floating point precision + * (default: `1`) */ + scalingFactor: number; + }): ClipperPoint[]; + + /** + * Determine whether the PIXI.Polygon is closed, defined by having the same starting and ending point. + */ + get isClosed(): boolean; + + /** + * Intersect this PIXI.Polygon with another PIXI.Polygon using the clipper library. + * @param other - Another PIXI.Polygon + * @param options - Options which configure how the intersection is computed + * @returns The intersected polygon or null if no solution was present + */ + intersectPolygon( + other: PIXI.Polygon, + options: { + /** The clipper clip type */ + clipType?: number; + /** A scaling factor passed to Polygon#toClipperPoints to preserve precision */ + scalingFactor?: number; + }, + ): PIXI.Polygon | null; + + /** + * Intersect this PIXI.Polygon with an array of ClipperPoints. + * @param clipperPoints - Array of clipper points generated by PIXI.Polygon.toClipperPoints() + * @param options - Options which configure how the intersection is computed + */ + intersectClipper( + clipperPoints: ClipperPoint[], + options?: { + /** The clipper clip type */ + clipType?: number; + /** A scaling factor passed to Polygon#toClipperPoints to preserve precision */ + scalingFactor?: number; + }, + ): ClipperPoint[]; + + /** + * Intersect this PIXI.Polygon with a PIXI.Circle. + * For now, convert the circle to a Polygon approximation and use intersectPolygon. + * In the future we may replace this with more specialized logic which uses the line-circle intersection formula. + * @param circle - A PIXI.Circle + * @param options - Options which configure how the intersection is computed + * @returns The intersected polygon + */ + intersectCircle( + circle: PIXI.Circle, + options?: { + /** The number of points which defines the density of approximation */ + density: number; + }, + ): PIXI.Polygon; + + /** + * Intersect this PIXI.Polygon with a PIXI.Rectangle. + * For now, convert the rectangle to a Polygon and use intersectPolygon. + * In the future we may replace this with more specialized logic which uses the line-line intersection formula. + * @param rect - A PIXI.Rectangle + * @param options - Options which configure how the intersection is computed + * @returns The intersected polygon + */ + intersectRectangle(rect: PIXI.Rectangle, options?: Record): PIXI.Polygon; + } + } + + type ClipperPoint = { + X: number; + Y: number; + }; +} From ca16d6d5afcdc4616b67452577c8b93ee84cf0b4 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 22 Nov 2023 14:12:01 -0800 Subject: [PATCH 30/75] PIXI.Circle --- .../client/pixi/extensions/circle.d.ts | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 src/foundry/client/pixi/extensions/circle.d.ts diff --git a/src/foundry/client/pixi/extensions/circle.d.ts b/src/foundry/client/pixi/extensions/circle.d.ts new file mode 100644 index 000000000..d5c01fb7c --- /dev/null +++ b/src/foundry/client/pixi/extensions/circle.d.ts @@ -0,0 +1,129 @@ +export {}; + +declare global { + namespace PIXI { + interface Circle { + /** + * Determine the center of the circle. + * Trivial, but used to match center method for other shapes. + */ + get circle(): Point; + + /** + * Determine if a point is on or nearly on this circle. + * @param point - Point to test + * @param epsilon - Tolerated margin of error + * (default: `1e-08`) + * @returns Is the point on the circle within the allowed tolerance? + */ + pointIsOn(point: Point, epsilon: number): boolean; + + /** + * Get all intersection points on this circle for a segment A|B + * Intersections are sorted from A to B. + * @param a - The first endpoint on segment A|B + * @param b - The second endpoint on segment A|B + * @returns Points where the segment A|B intersects the circle + */ + segmentIntersections(a: Point, b: Point): Point[]; + + /** + * Calculate an x,y point on this circle's circumference given an angle + * 0: due east + * π / 2: due south + * π or -π: due west + * -π/2: due north + * @param angle - Angle of the point, in radians + * @returns The point on the circle at the given angle + */ + pointAtAngle(angle: number): Point; + + /** + * Get all the points for a polygon approximation of this circle between two points. + * The two points can be anywhere in 2d space. The intersection of this circle with the line from this circle center + * to the point will be used as the start or end point, respectively. + * This is used to draw the portion of the circle (the arc) between two intersection points on this circle. + * @param a - Point in 2d space representing the start point + * @param b - Point in 2d space representing the end point + * @param options - Options passed on to the pointsForArc method + * @returns An array of points arranged clockwise from start to end + */ + pointsBetween(a: Point, b: Point, options?: Record): Point[]; + + /** + * Get the points that would approximate a circular arc along this circle, given a starting and ending angle. + * Points returned are clockwise. If from and to are the same, a full circle will be returned. + * @param fromAngle - Starting angle, in radians. π is due north, π/2 is due east + * @param toAngle - Ending angle, in radians + * @param options - Options which affect how the circle is converted + * @returns An array of points along the requested arc + */ + pointsForArc( + fromAngle: number, + toAngle: number, + options?: { + /** The number of points which defines the density of approximation */ + density: number; + /** Whether to include points at the circle where the arc starts and ends */ + includeEndpoints: boolean; + }, + ): Point[]; + + /** + * Approximate this PIXI.Circle as a PIXI.Polygon + * @param options - Options forwarded on to the pointsForArc method + * @returns The Circle expressed as a PIXI.Polygon + */ + toPolygon(options?: Record): PIXI.Polygon; + + /** + * The recommended vertex density for the regular polygon approximation of a circle of a given radius. + * Small radius circles have fewer vertices. The returned value will be rounded up to the nearest integer. + * See the formula described at: + * https://math.stackexchange.com/questions/4132060/compute-number-of-regular-polgy-sides-to-approximate-circle-to-defined-precision + * @param radius - Circle radius + * @param epsilon - The maximum tolerable distance between an approximated line segment and the true radius. + * A larger epsilon results in fewer points for a given radius. + * @returns The number of points for the approximated polygon + */ + approximateVertexDensity(radius: number, epsilon?: number): number; + + /** + * Intersect this PIXI.Circle with a PIXI.Polygon. + * @param polygon - A PIXI.Polygon + * @param options - Options which configure how the intersection is computed + * @returns The intersected polygon + */ + intersectPolygon( + polygon: PIXI.Polygon, + options?: { + /** The number of points which defines the density of approximation */ + density: number; + /** The clipper clip type */ + clipType: number; + /** + * Use the Weiler-Atherton algorithm. Otherwise, use Clipper. + * (default: `true`) + * */ + weilerAtherton: boolean; + }, + ): PIXI.Polygon; + + /** + * Intersect this PIXI.Circle with an array of ClipperPoints. + * Convert the circle to a Polygon approximation and use intersectPolygon. + * In the future we may replace this with more specialized logic which uses the line-circle intersection formula. + * @param clipperPoints - Array of ClipperPoints generated by PIXI.Polygon.toClipperPoints() + * @param options - Options which configure how the intersection is computed + * @returns The intersected polygon + */ + intersectClipper( + clipperPoints: ClipperPoint[], + options?: { + /** The number of points which defines the density of approximation */ + density: number; + }, + ): PIXI.Polygon; + } + } +} From 73f1ea74af04cd0541c274f15bc18768bcbd2093 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 22 Nov 2023 14:37:36 -0800 Subject: [PATCH 31/75] Adjusted Options Typing --- .../client/pixi/sources/base-source.d.ts | 8 +- .../client/pixi/sources/light-source.d.ts | 101 ++++++++++++------ .../client/pixi/sources/rendered-source.d.ts | 27 +++-- .../client/pixi/sources/sound-source.d.ts | 2 +- 4 files changed, 92 insertions(+), 46 deletions(-) diff --git a/src/foundry/client/pixi/sources/base-source.d.ts b/src/foundry/client/pixi/sources/base-source.d.ts index 1db3552fd..b8b6efd16 100644 --- a/src/foundry/client/pixi/sources/base-source.d.ts +++ b/src/foundry/client/pixi/sources/base-source.d.ts @@ -14,10 +14,10 @@ declare global { * ``` */ abstract class PointSource { - /** - * @param object - Some other object which is responsible for this source - */ - constructor({ object }?: { object: PlaceableObject }); + constructor(options?: { + /** Some other object which is responsible for this source */ + object: PlaceableObject; + }); /** * The type of source represented by this data structure. diff --git a/src/foundry/client/pixi/sources/light-source.d.ts b/src/foundry/client/pixi/sources/light-source.d.ts index 7864516bb..a851bbae9 100644 --- a/src/foundry/client/pixi/sources/light-source.d.ts +++ b/src/foundry/client/pixi/sources/light-source.d.ts @@ -143,63 +143,98 @@ declare global { /** * A torch animation where the luminosity and coloration decays each frame and is revitalized by flashes - * @param dt - Delta time - * @param speed - The animation speed, from 1 to 10 - * (default: `5`) - * @param intensity - The animation intensity, from 1 to 10 - * (default: `5`) - * @param reverse - Reverse the animation direction - * (default: `false`) + * @param dt - Delta time + * @param options - Additional options which modify the flame animation */ animateTorch( dt: number, - { speed, intensity, reverse }?: { speed: number; intensity: number; reverse: boolean }, + options?: { + /** + * The animation speed, from 1 to 10 + * (default: `5`) + */ + speed: number; + /** + * The animation intensity, from 1 to 10 + * (default: `5`) + */ + intensity: number; + /** + * Reverse the animation direction + * (default: `false`) + */ + reverse: boolean; + }, ): void; /** * An animation with flickering ratio and light intensity - * @param dt - Delta time - * @param speed - The animation speed, from 1 to 10 - * (default: 5) - * @param intensity - The animation intensity, from 1 to 10 - * (default: 5) - * @param amplification - Noise amplification (\>1) or dampening (\<1) - * (default: 1) - * @param reverse - Reverse the animation direction - * (default: false) + * @param dt - Delta time + * @param options - Additional options which modify the flame animation */ animateFlickering( dt: number, - { - speed, - intensity, - amplification, - reverse, - }?: { speed: number; intensity: number; amplification: number; reverse: boolean }, + options?: { + /** + * The animation speed, from 1 to 10 + * (default: `5`) + */ + speed: number; + /** + * The animation intensity, from 1 to 10 + * (default: `5`) + */ + intensity: number; + /** + * Noise amplification (\>1) or dampening (\<1) + * (default: 1) + */ + amplification: number; + /** + * Reverse the animation direction + * (default: `false`) + */ + reverse: boolean; + }, ): void; /** * A basic "pulse" animation which expands and contracts. * @param dt - Delta time - * @param speed - The animation speed, from 1 to 10 - * (default: `5`) - * @param intensity - The animation intensity, from 1 to 10 - * (default: `5`) - * @param reverse - Is the animation reversed? - * (default: `false`) + * @param options - Additional options which modify the flame animation */ animatePulse( dt: number, - { speed, intensity, reverse }?: { speed?: number; intensity?: number; reverse?: boolean }, + options?: { + /** + * The animation speed, from 1 to 10 + * (default: `5`) + */ + speed: number; + /** + * The animation intensity, from 1 to 10 + * (default: `5`) + */ + intensity: number; + /** + * Reverse the animation direction + * (default: `false`) + */ + reverse: boolean; + }, ): void; /** * Test whether this LightSource provides visibility to see a certain target object. - * @param tests - The sequence of tests to perform - * @param object - The target object being tested + * @param config - The visibility test configuration * @returns Is the target object visible to this source? */ - testVisibility({ tests, object }: { tests: CanvasVisibilityTest[]; object: PlaceableObject }): boolean; + testVisibility(config: { + /** The sequence of tests to perform */ + tests: CanvasVisibilityTest[]; + /** The target object being tested */ + object: PlaceableObject; + }): boolean; /** * Can this LightSource theoretically detect a certain object based on its properties? diff --git a/src/foundry/client/pixi/sources/rendered-source.d.ts b/src/foundry/client/pixi/sources/rendered-source.d.ts index b4815aa57..2e25ceaa7 100644 --- a/src/foundry/client/pixi/sources/rendered-source.d.ts +++ b/src/foundry/client/pixi/sources/rendered-source.d.ts @@ -187,17 +187,28 @@ declare global { /** * Generic time-based animation used for Rendered Point Sources. - * @param dt - Delta time. - * @param speed - The animation speed, from 1 to 10 - * (default: 5) - * @param intensity - The animation intensity, from 1 to 10 - * (default: 5) - * @param reverse - Reverse the animation direction - * (default: false) + * @param dt - Delta time. + * @param options - Options which affect the time animation */ animateTime( dt: number, - { speed, intensity, reverse }: { speed: number; intensity: number; reverse: boolean }, + options?: { + /** + * The animation speed, from 1 to 10 + * (default: `5`) + */ + speed: number; + /** + * The animation intensity, from 1 to 10 + * (default: `5`) + */ + intensity: number; + /** + * Reverse the animation direction + * (default: `false`) + */ + reverse: boolean; + }, ): void; /** diff --git a/src/foundry/client/pixi/sources/sound-source.d.ts b/src/foundry/client/pixi/sources/sound-source.d.ts index 0b35ba3ff..7afea2cce 100644 --- a/src/foundry/client/pixi/sources/sound-source.d.ts +++ b/src/foundry/client/pixi/sources/sound-source.d.ts @@ -7,7 +7,7 @@ declare global { class SoundSource extends PointSource { static override sourceType: "sound"; - protected override _getPolygonConfiguration(): PointSourcePolygonConfig; + protected override _getPolygonConfiguration(): PointSourcePolygonConfig & { useThreshold: true }; /** @remarks Not implemented */ protected _refresh(): void; From 61c1ebb56e93752cd4c4adad751cad8894fa0e7f Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 22 Nov 2023 14:42:58 -0800 Subject: [PATCH 32/75] Adjusted parameters --- .../client/pixi/core/shapes/source-polygon.d.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts index 282c0891b..3a0735311 100644 --- a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts +++ b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts @@ -183,7 +183,18 @@ declare abstract class PointSourcePolygon extends PIXI.Polygon { static testCollision( origin: Point, destination: Point, - { mode, ...config }: { mode?: string; config: PointSourcePolygonConfig }, + { + mode, + ...config + }: { + /** + * The collision mode to test: "any", "all", or "closest" + * (default: "all") + */ + mode?: string; + /** The configuration that defines a certain Polygon type */ + config: PointSourcePolygonConfig; + }, ): boolean | PolygonVertex | PolygonVertex[] | null; /** From 778de2470af15f6e432059389efc6797e2aca70c Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 22 Nov 2023 15:01:54 -0800 Subject: [PATCH 33/75] PIXI.Rectangle --- .../client/pixi/extensions/rectangle.d.ts | 218 ++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 src/foundry/client/pixi/extensions/rectangle.d.ts diff --git a/src/foundry/client/pixi/extensions/rectangle.d.ts b/src/foundry/client/pixi/extensions/rectangle.d.ts new file mode 100644 index 000000000..58e6bea6f --- /dev/null +++ b/src/foundry/client/pixi/extensions/rectangle.d.ts @@ -0,0 +1,218 @@ +export {}; + +declare global { + namespace PIXI { + interface Rectangle { + /** + * Bit code labels splitting a rectangle into zones, based on the Cohen-Sutherland algorithm. + * See https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm + * left central right + * top 1001 1000 1010 + * central 0001 0000 0010 + * bottom 0101 0100 0110 + */ + CS_ZONES: { + INSIDE: 0x0000; + LEFT: 0x0001; + RIGHT: 0x0010; + TOP: 0x1000; + BOTTOM: 0x0100; + TOPLEFT: 0x1001; + TOPRIGHT: 0x1010; + BOTTOMRIGHT: 0x0110; + BOTTOMLEFT: 0x0101; + }; + + /** + * Calculate center of this rectangle. + */ + get center(): Point; + + /** + * Return the bounding box for a PIXI.Rectangle. + * The bounding rectangle is normalized such that the width and height are non-negative. + */ + getBounds(): PIXI.Rectangle; + + /** + * Determine if a point is on or nearly on this rectangle. + * @param p - Point to test + * @returns Is the point on the rectangle boundary? + */ + pointIsOn(p: Point): boolean; + + /** + * Calculate the rectangle Zone for a given point located around, on, or in the rectangle. + * See https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm + * This differs from _getZone in how points on the edge are treated: they are not considered inside. + * @param point - A point to test for location relative to the rectangle + * @returns Which edge zone does the point belong to? + */ + _getEdgeZone(point: Point): PIXI.Rectangle["CS_ZONES"]; + + /** + * Get all the points (corners) for a polygon approximation of a rectangle between two points on the rectangle. + * The two points can be anywhere in 2d space on or outside the rectangle. + * The starting and ending side are based on the zone of the corresponding a and b points. + * (See PIXI.Rectangle.CS_ZONES.) + * This is the rectangular version of PIXI.Circle.prototype.pointsBetween, and is similarly used + * to draw the portion of the shape between two intersection points on that shape. + * @param a - A point on or outside the rectangle, representing the starting position. + * @param b - A point on or outside the rectangle, representing the starting position. + * @returns Points returned are clockwise from start to end. + */ + pointsBetween(a: Point, b: Point): Point[]; + + /** + * Get all intersection points for a segment A|B + * Intersections are sorted from A to B. + * @param a - Endpoint A of the segment + * @param b - Endpoint B of the segment + * @returns Array of intersections or empty if no intersection. + * If A|B is parallel to an edge of this rectangle, returns the two furthest points on + * the segment A|B that are on the edge. + */ + segmentIntersections(a: Point, b: Point): Point[]; + + /** + * Compute the intersection of this Rectangle with some other Rectangle. + * @param other - Some other rectangle which intersects this one + * @returns The intersected rectangle + */ + intersection(other: PIXI.Rectangle): PIXI.Rectangle; + + /** + * Convert this PIXI.Rectangle into a PIXI.Polygon + * @returns The Rectangle expressed as a PIXI.Polygon + */ + toPolygon(): PIXI.Rectangle; + + /** + * Get the left edge of this rectangle. + * The returned edge endpoints are oriented clockwise around the rectangle. + */ + get leftEdge(): { + A: Point; + B: Point; + }; + + /** + * Get the right edge of this rectangle. + * The returned edge endpoints are oriented clockwise around the rectangle. + */ + get rightEdge(): { + A: Point; + B: Point; + }; + + /** + * Get the top edge of this rectangle. + * The returned edge endpoints are oriented clockwise around the rectangle. + */ + get topEdge(): { + A: Point; + B: Point; + }; + + /** + * Get the bottom edge of this rectangle. + * The returned edge endpoints are oriented clockwise around the rectangle. + */ + get bottomEdge(): { + A: Point; + B: Point; + }; + + /** + * Calculate the rectangle Zone for a given point located around or in the rectangle. + * https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm + * + * @param p - Point to test for location relative to the rectangle + */ + _getZone(p: Point): PIXI.Rectangle["CS_ZONES"]; + + /** + * Test whether a line segment AB intersects this rectangle. + * @param a - The first endpoint of segment AB + * @param b - The second endpoint of segment AB + * @param options - Options affecting the intersect test. + * @returns True if intersects. + */ + lineSegmentIntersects( + a: Point, + b: Point, + options?: { + /** If true, a line contained within the rectangle will return true */ + inside?: boolean; + }, + ): boolean; + + /** + * Intersect this PIXI.Rectangle with a PIXI.Polygon. + * @param polygon - A PIXI.Polygon + * @param options - Options which configure how the intersection is computed + * @returns The intersected polygon + */ + intersectPolygon( + polygon: PIXI.Polygon, + options?: { + /** The number of points which defines the density of approximation */ + density: number; + /** The clipper clip type */ + clipType: number; + /** + * Use the Weiler-Atherton algorithm. Otherwise, use Clipper. + * (default: `true`) + * */ + weilerAtherton: boolean; + }, + ): PIXI.Polygon | null; + + /** + * Intersect this PIXI.Rectangle with an array of ClipperPoints. Currently, uses the clipper library. + * In the future we may replace this with more specialized logic which uses the line-line intersection formula. + * @param clipperPoints - Array of ClipperPoints generated by PIXI.Polygon.toClipperPoints() + * @param options - Options which configure how the intersection is computed + * @returns The intersected polygon + */ + intersectClipper( + clipperPoints: ClipperPoint[], + options?: { + /** The number of points which defines the density of approximation */ + density: number; + }, + ): PIXI.Polygon | null; + + /** + * Determine whether some other Rectangle overlaps with this one. + * This check differs from the parent class Rectangle#intersects test because it is true for adjacency (zero area). + * @param other - Some other rectangle against which to compare + * @returns Do the rectangles overlap? + */ + overlaps(other: PIXI.Rectangle): boolean; + + /** + * Normalize the width and height of the rectangle in-place, enforcing that those dimensions be positive. + */ + normalize(): PIXI.Rectangle; + + /** + * Generate a new rectangle by rotating this one clockwise about its center by a certain number of radians + * @param radians - The angle of rotation + * @returns A new rotated rectangle + */ + rotate(radians: number): PIXI.Rectangle; + + /** + * Create normalized rectangular bounds given a rectangle shape and an angle of central rotation. + * @param x - The top-left x-coordinate of the un-rotated rectangle + * @param y - The top-left y-coordinate of the un-rotated rectangle + * @param width - The width of the un-rotated rectangle + * @param height - The height of the un-rotated rectangle + * @param radians - The angle of rotation about the center + * @returns The constructed rotated rectangle bounds + */ + fromRotation(x: number, y: number, width: number, height: number, radians: number): PIXI.Rectangle; + } + } +} From db0fe9e0914f5fc9bc39ac781336e01b9eb732a3 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 22 Nov 2023 15:02:24 -0800 Subject: [PATCH 34/75] Index --- src/foundry/client/pixi/extensions/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/foundry/client/pixi/extensions/index.d.ts diff --git a/src/foundry/client/pixi/extensions/index.d.ts b/src/foundry/client/pixi/extensions/index.d.ts new file mode 100644 index 000000000..e3f32251f --- /dev/null +++ b/src/foundry/client/pixi/extensions/index.d.ts @@ -0,0 +1,3 @@ +import "./circle"; +import "./polygon"; +import "./rectangle"; From f280e9456be1e274ce245772995fcaf809b2865e Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Fri, 24 Nov 2023 08:00:30 -0800 Subject: [PATCH 35/75] Adjusted Vision.fov typing --- src/foundry/client/pixi/placeable.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/foundry/client/pixi/placeable.d.ts b/src/foundry/client/pixi/placeable.d.ts index a84cd5bd6..00a3c05c8 100644 --- a/src/foundry/client/pixi/placeable.d.ts +++ b/src/foundry/client/pixi/placeable.d.ts @@ -372,10 +372,10 @@ declare global { interface Vision { /** - * @remarks - * This is required but has been set to optional because of PointSource + * @remarks Documentation says PIXI.Circle, but determined by Atropos to be out of date. + * Likely to be removed in future version as it's no longer used generally. */ - fov?: PIXI.Circle | undefined; + fov?: PIXI.Polygon | undefined; /** * @remarks From 19488cebaf5145f202cac53405118e3fe53f7621 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Fri, 24 Nov 2023 08:22:33 -0800 Subject: [PATCH 36/75] Clockwise Sweep Fixes --- .../pixi/perception/clockwise-sweep.d.ts | 53 +++++++++++-------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/src/foundry/client/pixi/perception/clockwise-sweep.d.ts b/src/foundry/client/pixi/perception/clockwise-sweep.d.ts index 2915f398f..89c37868e 100644 --- a/src/foundry/client/pixi/perception/clockwise-sweep.d.ts +++ b/src/foundry/client/pixi/perception/clockwise-sweep.d.ts @@ -1,4 +1,4 @@ -import type { ConfiguredObjectClassForName } from "../../../../types/helperTypes"; +export {}; declare global { type VertexMap = Map; @@ -28,12 +28,10 @@ declare global { /** * A collection of rays which are fired at vertices */ + //@ts-expect-error Getter/setter routine is deprecated functionality as of v11, removed in v13 rays: PolygonRay[]; - /** - * @param origin - The provided polygon origin - * @param config - The provided configuration object - */ + /** {@inheritdoc} */ override initialize(origin: Point, config: PointSourcePolygonConfig): void; /** {@inheritDoc} */ @@ -47,24 +45,6 @@ declare global { */ protected _identifyEdges(): void; - /** - * Get the super-set of walls which could potentially apply to this polygon. - * @internal - */ - protected _getWalls(): ConfiguredObjectClassForName<"Wall">[]; - - /** - * Restrict the set of candidate edges to those which appear within the limited angle of emission. - * @internal - */ - protected _restrictEdgesByAngle(): void; - - /** - * Process the candidate edges to further constrain them using a circular radius of effect. - * @internal - */ - protected _constrainEdgesByRadius(): void; - /** * Consolidate all vertices from identified edges and register them as part of the vertex mapping. * @internal @@ -84,6 +64,15 @@ declare global { */ protected _executeSweep(): void; + /** + * Update active edges at a given vertex + * Must delete first, in case the edge is in both sets. + * @param vertex - The current vertex + * @param activeEdges - A set of currently active edges + * @internal + */ + protected _updateActiveEdges(vertex: PolygonVertex, activeEdges: EdgeSet): void; + /** * Determine the initial set of active edges as those which intersect with the initial ray * @returns A set of initially active edges @@ -155,5 +144,23 @@ declare global { ray: PolygonRay, config: PointSourcePolygonConfig, ): boolean | PolygonVertex | PolygonVertex[] | null; + + /** + * Determine the set of collisions which occurs for a Ray. + * @param ray - The Ray to test + * @param mode - The collision mode being tested + * @returns The collision test result + */ + protected override _testCollision(ray: Ray, mode: string): boolean | PolygonVertex | PolygonVertex[] | null; + + override visualize(): PIXI.Graphics | undefined; + + /** + * Visualize the polygon, displaying its computed area, rays, and collision points + * @param ray - No comments + * @param collisions - No comments + * @internal + */ + protected _visualizeCollision(ray: Ray, collisions: PolygonVertex[]): void; } } From 55f23e54ba428da2dd79c8c3ac133df8234d21cd Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Fri, 24 Nov 2023 10:13:37 -0800 Subject: [PATCH 37/75] Test updates --- .../pixi/core/shapes/source-polygon.d.ts | 2 +- .../pixi/perception/clockwise-sweep.test-d.ts | 48 +++++-------------- 2 files changed, 14 insertions(+), 36 deletions(-) diff --git a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts index 3a0735311..e3b800163 100644 --- a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts +++ b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts @@ -193,7 +193,7 @@ declare abstract class PointSourcePolygon extends PIXI.Polygon { */ mode?: string; /** The configuration that defines a certain Polygon type */ - config: PointSourcePolygonConfig; + config?: PointSourcePolygonConfig; }, ): boolean | PolygonVertex | PolygonVertex[] | null; diff --git a/tests/foundry/client/pixi/perception/clockwise-sweep.test-d.ts b/tests/foundry/client/pixi/perception/clockwise-sweep.test-d.ts index 0b7cb653e..def48c82c 100644 --- a/tests/foundry/client/pixi/perception/clockwise-sweep.test-d.ts +++ b/tests/foundry/client/pixi/perception/clockwise-sweep.test-d.ts @@ -1,38 +1,16 @@ +import { Point } from "pixi.js"; import { expectTypeOf } from "vitest"; -const someRay = new Ray({ x: 0, y: 0 }, { x: 0, y: 0 }); -const somePolygonRay: PolygonRay = someRay as PolygonRay; -somePolygonRay.result = new CollisionResult(); +const pointA = new Point(0, 0); +const pointB = new Point(0, 0); +// Genuinely confused what's going on here +// without this I get 'Arguments for the rest parameter 'MISMATCH' were not provided.'; possible bug in vitest? +const testResult = {} as never; -expectTypeOf(ClockwiseSweepPolygon.getRayCollisions(somePolygonRay, { mode: "any" })).toEqualTypeOf(); -expectTypeOf( - ClockwiseSweepPolygon.getRayCollisions(somePolygonRay, { mode: "closest" }), -).toEqualTypeOf(); -expectTypeOf(ClockwiseSweepPolygon.getRayCollisions(somePolygonRay, { mode: "all" })).toEqualTypeOf(); - -declare const initializedConfig: ClockwiseSweepPolygon.InitializedConfig; -expectTypeOf(initializedConfig.hasLimitedRadius).toEqualTypeOf(); -expectTypeOf(initializedConfig.radius).toEqualTypeOf(); -expectTypeOf(initializedConfig.radius2).toEqualTypeOf(); -expectTypeOf(initializedConfig.radiusE).toEqualTypeOf(); -expectTypeOf(initializedConfig.aMin).toEqualTypeOf(); -expectTypeOf(initializedConfig.aMax).toEqualTypeOf(); -expectTypeOf(initializedConfig.angle).toEqualTypeOf(); -expectTypeOf(initializedConfig.rotation).toEqualTypeOf(); -expectTypeOf(initializedConfig.hasLimitedAngle).toEqualTypeOf(); -expectTypeOf(initializedConfig.density).toEqualTypeOf(); -expectTypeOf(initializedConfig.rMax).toEqualTypeOf(); -expectTypeOf(initializedConfig.rMin).toEqualTypeOf(); -declare const limitedAngleConfig: ClockwiseSweepPolygon.LimitedAngleConfig; -expectTypeOf(limitedAngleConfig.hasLimitedRadius).toEqualTypeOf(); -expectTypeOf(limitedAngleConfig.radius).toEqualTypeOf(); -expectTypeOf(limitedAngleConfig.radius2).toEqualTypeOf(); -expectTypeOf(limitedAngleConfig.radiusE).toEqualTypeOf(); -expectTypeOf(limitedAngleConfig.aMin).toEqualTypeOf(); -expectTypeOf(limitedAngleConfig.aMax).toEqualTypeOf(); -expectTypeOf(limitedAngleConfig.angle).toEqualTypeOf(); -expectTypeOf(limitedAngleConfig.rotation).toEqualTypeOf(); -expectTypeOf(limitedAngleConfig.hasLimitedAngle).toEqualTypeOf(); -expectTypeOf(limitedAngleConfig.density).toEqualTypeOf(); -expectTypeOf(limitedAngleConfig.rMax).toEqualTypeOf(); -expectTypeOf(limitedAngleConfig.rMin).toEqualTypeOf(); +expectTypeOf(ClockwiseSweepPolygon.testCollision(pointA, pointB, { mode: "any" })).toEqualTypeOf(testResult); +expectTypeOf(ClockwiseSweepPolygon.testCollision(pointA, pointB, { mode: "closest" })).toEqualTypeOf( + testResult, +); +expectTypeOf(ClockwiseSweepPolygon.testCollision(pointA, pointB, { mode: "all" })).toEqualTypeOf( + testResult, +); From fecf5b3ab1fc3f07fca1734621fe0b772dee00f7 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Fri, 24 Nov 2023 11:49:01 -0800 Subject: [PATCH 38/75] Test Fixes, Type Problems --- .../client/pixi/core/interaction/index.d.ts | 1 + .../pixi/core/interaction/render-flags.d.ts | 102 ++++++++++++++++++ .../pixi/perception/perception-manager.d.ts | 10 +- .../perception/perception-manager.test-d.ts | 48 +++++---- 4 files changed, 132 insertions(+), 29 deletions(-) create mode 100644 src/foundry/client/pixi/core/interaction/render-flags.d.ts diff --git a/src/foundry/client/pixi/core/interaction/index.d.ts b/src/foundry/client/pixi/core/interaction/index.d.ts index 3a9972403..7f1d24c26 100644 --- a/src/foundry/client/pixi/core/interaction/index.d.ts +++ b/src/foundry/client/pixi/core/interaction/index.d.ts @@ -2,5 +2,6 @@ import "./canvas-animation"; import "./control-icon"; import "./mouse-handler"; import "./ping"; +import "./render-flags"; import "./resize-handle"; import "./targets"; diff --git a/src/foundry/client/pixi/core/interaction/render-flags.d.ts b/src/foundry/client/pixi/core/interaction/render-flags.d.ts new file mode 100644 index 000000000..be5ef2570 --- /dev/null +++ b/src/foundry/client/pixi/core/interaction/render-flags.d.ts @@ -0,0 +1,102 @@ +export {}; + +declare global { + /** @remarks Values are marked as optional here based on use, foundry docs incomplete */ + type RenderFlag = { + /** Activating this flag also sets these flags to true */ + propagate?: string[]; + /** Activating this flag resets these flags to false */ + reset?: string[]; + }; + + /** + * A data structure for tracking a set of boolean status flags. + * This is a restricted set which can only accept flag values which are pre-defined. + */ + class RenderFlags extends Set { + /** + * @param flags - An object which defines the flags which are supported for tracking + * @param config - Optional configuration + */ + constructor( + flags: Record, + config?: { + /** The object which owns this RenderFlags instance */ + object?: RenderFlagObject; + /** + * The ticker priority at which these render flags are handled + * (default: `PIXI.UPDATE_PRIORITY.OBJECTS`) + */ + priority?: number; + }, + ); + + /** + * {@inheritDoc} + * @returns The flags which were previously set that have been cleared. + */ + clear(): Record; + + /** + * Allow for handling one single flag at a time. + * This function returns whether the flag needs to be handled and removes it from the pending set. + * @param flag - No comment + */ + handle(flag: string): boolean; + + /** + * Activate certain flags, also toggling propagation and reset behaviors + * @param changes - No comment + */ + set(changes: Record): void; + } + + /** + * Add RenderFlags functionality to some other object. + * This mixin standardizes the interface for such functionality. + * @remarks Actually a function `RenderFlagsMixin(Base)` + * @param Base - The base class being mixed + * @returns The mixed class definition + */ + class RenderFlagObject extends PIXI.DisplayObject { + constructor(...args: any[]); + + /** + * Configure the render flags used for this class. + * @defaultValue + * ```ts + * { + * object: this, + * priority: this.constructor.RENDER_FLAG_PRIORITY + * } + * ``` + */ + static RENDER_FLAGS: Record; + + /** + * The ticker priority when RenderFlags of this class are handled. + * Valid values are OBJECTS or PERCEPTION. + * @defaultValue "OBJECTS" + */ + static RENDER_FLAG_PRIORITY: "OBJECTS" | "PERCEPTION"; + + /** + * Status flags which are applied at render-time to update the PlaceableObject. + * If an object defines RenderFlags, it should at least include flags for "redraw" and "refresh". + */ + renderFlags: RenderFlags; + + /** + * Apply any current render flags, clearing the renderFlags set. + * Subclasses should override this method to define behavior. + */ + applyRenderFlags(): void; + } + + function RenderFlagsMixin( + Base: BaseClass, + ): Pick & + typeof RenderFlagObject & { + new (...args: ConstructorParameters): InstanceType & RenderFlagObject; + }; +} diff --git a/src/foundry/client/pixi/perception/perception-manager.d.ts b/src/foundry/client/pixi/perception/perception-manager.d.ts index b8a0ca3bd..eb9c71d82 100644 --- a/src/foundry/client/pixi/perception/perception-manager.d.ts +++ b/src/foundry/client/pixi/perception/perception-manager.d.ts @@ -1,8 +1,5 @@ export {}; -/** RenderFlags and RenderFlagObject are defined in client/pixi/core/interaction/render-flags */ -type RenderFlags = Set; -declare class RenderFlagObject {} declare global { interface PerceptionManagerFlags extends RenderFlags { /** Re-initialize the entire lighting configuration */ @@ -35,7 +32,7 @@ declare global { * A singleton instance is available as canvas#perception. * @see Canvas#perception */ - class PerceptionManager extends RenderFlagObject { + class PerceptionManager extends RenderFlagsMixin(Object) { static RENDER_FLAGS: { initializeLighting: { propagate: ["refreshLighting", "refreshVision"] }; refreshLighting: { propagate: ["refreshLightSources"] }; @@ -78,7 +75,7 @@ declare global { * @param v2 - Opt-in to passing v2 flags, otherwise a backwards compatibility shim will be applied * (default: `true`) */ - update(flags: Partial, v2?: boolean): void; + update(flags: Partial, v2?: boolean): void; /** * A helper function to perform an immediate initialization plus incremental refresh. @@ -92,7 +89,8 @@ declare global { /** * @deprecated since v10, will be removed in v12 - * @remarks PerceptionManager#cancel is renamed to PerceptionManager#deactivate + * @remarks "PerceptionManager#cancel is renamed to PerceptionManager#deactivate" + * @remarks PerceptionManager#deactivate does not actually exist as of v11 */ cancel(): void; diff --git a/tests/foundry/client/pixi/perception/perception-manager.test-d.ts b/tests/foundry/client/pixi/perception/perception-manager.test-d.ts index 9dfcdab2b..16e2b7220 100644 --- a/tests/foundry/client/pixi/perception/perception-manager.test-d.ts +++ b/tests/foundry/client/pixi/perception/perception-manager.test-d.ts @@ -2,43 +2,45 @@ import { expectTypeOf } from "vitest"; const manager = new PerceptionManager(); -expectTypeOf(manager.params).toEqualTypeOf(); - -expectTypeOf(manager.cancel()).toEqualTypeOf(); - -expectTypeOf(manager.schedule()).toEqualTypeOf(); -expectTypeOf(manager.schedule({})).toEqualTypeOf(); +expectTypeOf(manager.update({})).toEqualTypeOf(); expectTypeOf( - manager.schedule({ - lighting: { initialize: true }, - sight: { initialize: false }, - sounds: { initialize: false }, + manager.update({ + initializeLighting: true, + initializeVision: false, + initializeSounds: false, }), ).toEqualTypeOf(); expectTypeOf( - manager.schedule({ - lighting: { initialize: true, refresh: true }, - sight: { initialize: false, refresh: true, skipUpdateFog: true, forceUpdateFog: true }, - sounds: { initialize: false, refresh: false, fade: true }, - foreground: { refresh: true }, + manager.update({ + initializeLighting: true, + refreshLighting: true, + initializeVision: false, + refreshVision: true, + initializeSounds: false, + refreshSounds: false, + soundFadeDuration: true, + refreshTiles: true, }), ).toEqualTypeOf(); -expectTypeOf(manager.update()).toEqualTypeOf(); expectTypeOf(manager.update({})).toEqualTypeOf(); expectTypeOf( manager.update({ - lighting: { initialize: true }, - sight: { initialize: false }, - sounds: { initialize: false }, + initializeLighting: true, + initializeVision: true, + initializeSounds: true, }), ).toEqualTypeOf(); expectTypeOf( manager.update({ - lighting: { initialize: true, refresh: true }, - sight: { initialize: false, refresh: true, skipUpdateFog: true, forceUpdateFog: true }, - sounds: { initialize: false, refresh: false, fade: true }, - foreground: { refresh: true }, + initializeLighting: true, + refreshLighting: true, + initializeVision: false, + refreshVision: true, + initializeSounds: false, + refreshSounds: false, + soundFadeDuration: true, + refreshTiles: true, }), ).toEqualTypeOf(); From 957cf606b7161eeed77c8efe54a4145fdf0cf75f Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Fri, 24 Nov 2023 13:45:35 -0800 Subject: [PATCH 39/75] pixi/core/interaction --- .../core/interaction/canvas-animation.d.ts | 3 + .../pixi/core/interaction/control-icon.d.ts | 27 ++- .../pixi/core/interaction/mouse-handler.d.ts | 202 ++++++------------ .../pixi/core/interaction/render-flags.d.ts | 2 +- .../pixi/perception/perception-manager.d.ts | 1 + 5 files changed, 97 insertions(+), 138 deletions(-) diff --git a/src/foundry/client/pixi/core/interaction/canvas-animation.d.ts b/src/foundry/client/pixi/core/interaction/canvas-animation.d.ts index e55bc9031..deec5f7e2 100644 --- a/src/foundry/client/pixi/core/interaction/canvas-animation.d.ts +++ b/src/foundry/client/pixi/core/interaction/canvas-animation.d.ts @@ -19,6 +19,9 @@ declare global { /** The amount of the total delta which has been animated */ done?: number; + + /** Is this a color animation that applies to RGB channels */ + color?: boolean; } interface CanvasAnimationOptions { diff --git a/src/foundry/client/pixi/core/interaction/control-icon.d.ts b/src/foundry/client/pixi/core/interaction/control-icon.d.ts index b154a4879..cc34bc9c9 100644 --- a/src/foundry/client/pixi/core/interaction/control-icon.d.ts +++ b/src/foundry/client/pixi/core/interaction/control-icon.d.ts @@ -33,9 +33,9 @@ declare class ControlIcon extends PIXI.Container { tintColor: number | null; /** - * @defaultValue `true` + * @defaultValue `static` */ - interactive: boolean; + eventMode: string; /** * @defaultValue `false` @@ -48,11 +48,28 @@ declare class ControlIcon extends PIXI.Container { icon: PIXI.Sprite; + /** + * @defaultValue `border.visible = false` + */ border: PIXI.Graphics; + /** + * Initial drawing of the ControlIcon + */ draw(): Promise; - protected _onHoverIn(event: PIXI.InteractionEvent): void; - - protected _onHoverOut(event: PIXI.InteractionEvent): void; + /** + * Incremental refresh for ControlIcon appearance. + */ + refresh({ + visible, + iconColor, + borderColor, + borderVisible, + }?: { + visible?: boolean; + iconColor?: number; + borderColor?: number; + borderVisible?: boolean; + }): this; } diff --git a/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts b/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts index a7e33bac5..f7ea4c18c 100644 --- a/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts +++ b/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts @@ -1,3 +1,8 @@ +declare namespace PIXI { + // TODO: Update the PIXI dependency + interface FederatedEvent {} +} + /** * Handle mouse interaction events for a Canvas object. * There are three phases of events: hover, click, and drag @@ -21,9 +26,9 @@ * Drag and Drop * _handleMouseMove * action: dragLeftStart - * action: dragLeftMove * action: dragRightStart * action: dragLeftMove + * action: dragRightMove * _handleMouseUp * action: dragLeftDrop * action: dragRightDrop @@ -81,12 +86,7 @@ declare class MouseInteractionManager void - > - >; + interactionData: Partial>; /** * The drag handling time @@ -94,13 +94,6 @@ declare class MouseInteractionManager; /** - * Handle the conclusion of a drag workflow, placing all dragged objects back on the layer - * @internal + * A public method to handle directly an event into this manager, according to its type. + * Note: drag events are not handled. + * @param event - No comment + * @returns Has the event been processed? */ - protected _handleDragDrop(event: PIXI.InteractionEvent): void; + handleEvent(event: PIXI.FederatedEvent): boolean; /** - * Handle the cancellation of a drag workflow, resetting back to the original state - * @internal + * A public method to cancel a current interaction workflow from this manager. + * @param event - The event that initiates the cancellation */ - protected _handleDragCancel(event: MouseEvent): void; + cancel(event: PIXI.FederatedEvent): void; /** - * A public method to cancel a current interaction workflow from this manager. - * @param event - The event that initiates the cancellation + * Reset the mouse manager. + * @param options - No comment */ - cancel(event: Event): void; + reset(options?: { + /** Reset the interaction data? */ + interactionData: boolean; + /** Reset the state? */ + state: boolean; + }): void; } declare namespace MouseInteractionManager { + /** + * Enumerate the states of handle outcome. + */ + type HANDLER_OUTCOME = { + /** -2: SKIPPED - the handler has been skipped by previous logic */ + SKIPPED: -2; + /** -1: DISALLOWED - the handler has dissallowed further process */ + DISALLOWED: -1; + /** 1: REFUSED - the handler callback has been processed and is refusing further process */ + REFUSED: 1; + /** 2: ACCEPTED - the handler callback has been processed and is accepting further process */ + ACCEPTED: 2; + }; + type PermissionAction = | "clickLeft" | "clickLeft2" @@ -311,10 +252,7 @@ declare namespace MouseInteractionManager { type Action = PermissionAction | "dragLeftCancel" | "dragRightCancel"; interface Options { - /** - * @remarks If set, this must be the name of a property of the object that is a {@link PIXI.Container}. - */ - target?: string | null; + target?: PIXI.DisplayObject; dragResistance?: number; } diff --git a/src/foundry/client/pixi/core/interaction/render-flags.d.ts b/src/foundry/client/pixi/core/interaction/render-flags.d.ts index be5ef2570..923b12000 100644 --- a/src/foundry/client/pixi/core/interaction/render-flags.d.ts +++ b/src/foundry/client/pixi/core/interaction/render-flags.d.ts @@ -93,7 +93,7 @@ declare global { applyRenderFlags(): void; } - function RenderFlagsMixin( + function RenderFlagsMixin any>( Base: BaseClass, ): Pick & typeof RenderFlagObject & { diff --git a/src/foundry/client/pixi/perception/perception-manager.d.ts b/src/foundry/client/pixi/perception/perception-manager.d.ts index eb9c71d82..7171bb5b6 100644 --- a/src/foundry/client/pixi/perception/perception-manager.d.ts +++ b/src/foundry/client/pixi/perception/perception-manager.d.ts @@ -108,6 +108,7 @@ declare global { } namespace PerceptionManager { + /** @deprecated Old flag structure */ interface Options { lighting: { initialize: boolean; From 718090a1a0113f7aa6705a463738ff782be43aca Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Fri, 24 Nov 2023 14:16:27 -0800 Subject: [PATCH 40/75] Finishing client/pixi/core/interaction --- .../client/pixi/core/interaction/ping.d.ts | 27 +++++++++++++++++++ .../pixi/core/interaction/resize-handle.d.ts | 6 ++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/foundry/client/pixi/core/interaction/ping.d.ts b/src/foundry/client/pixi/core/interaction/ping.d.ts index 916887437..054486b27 100644 --- a/src/foundry/client/pixi/core/interaction/ping.d.ts +++ b/src/foundry/client/pixi/core/interaction/ping.d.ts @@ -25,4 +25,31 @@ declare global { */ name?: string; } + + /** + * A class to manage a user ping on the canvas. + */ + class Ping extends PIXI.Container { + /** + * @param origin - The canvas co-ordinates of the origin of the ping. + * @param options - Additional options to configure the ping animation. + */ + constructor(origin: PIXI.Point, options?: PingOptions); + + /** {@inheritdoc} */ + destroy(options?: Record): void; + + /** + * Start the ping animation. + * @returns Returns true if the animation ran to completion, false otherwise. + */ + animate(): Promise; + + /** + * On each tick, advance the animation. + * @param dt - The number of ms that elapsed since the previous frame. + * @param animation - The animation state. + */ + protected _animateFrame(dt: number, animation: CanvasAnimationData): void; + } } diff --git a/src/foundry/client/pixi/core/interaction/resize-handle.d.ts b/src/foundry/client/pixi/core/interaction/resize-handle.d.ts index 767b9c48f..b4e0fb922 100644 --- a/src/foundry/client/pixi/core/interaction/resize-handle.d.ts +++ b/src/foundry/client/pixi/core/interaction/resize-handle.d.ts @@ -32,17 +32,17 @@ declare class ResizeHandle extends PIXI.Graphics { * Handle mouse-over event on a control handle * @param event - The mouseover event */ - protected _onHoverIn(event: PIXI.InteractionEvent): void; + protected _onHoverIn(event: PIXI.FederatedEvent): void; /** * Handle mouse-out event on a control handle * @param event - The mouseout event */ - protected _onHoverOut(event: PIXI.InteractionEvent): void; + protected _onHoverOut(event: PIXI.FederatedEvent): void; /** * When we start a drag event - create a preview copy of the Tile for re-positioning * @param event - The mousedown event */ - protected _onMouseDown(event: PIXI.InteractionEvent): void; + protected _onMouseDown(event: PIXI.FederatedEvent): void; } From e0f40c4f53ada6eb934d10ec5605d9410d3a53c0 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Fri, 24 Nov 2023 15:15:37 -0800 Subject: [PATCH 41/75] Pings --- .../client/pixi/core/interaction/index.d.ts | 1 + .../client/pixi/core/interaction/ping.d.ts | 7 ++ .../pixi/core/interaction/pings/chevron.d.ts | 73 +++++++++++++ .../pixi/core/interaction/pings/index.d.ts | 2 + .../pixi/core/interaction/pings/pulse.d.ts | 102 ++++++++++++++++++ 5 files changed, 185 insertions(+) create mode 100644 src/foundry/client/pixi/core/interaction/pings/chevron.d.ts create mode 100644 src/foundry/client/pixi/core/interaction/pings/index.d.ts create mode 100644 src/foundry/client/pixi/core/interaction/pings/pulse.d.ts diff --git a/src/foundry/client/pixi/core/interaction/index.d.ts b/src/foundry/client/pixi/core/interaction/index.d.ts index 7f1d24c26..49f9aec2a 100644 --- a/src/foundry/client/pixi/core/interaction/index.d.ts +++ b/src/foundry/client/pixi/core/interaction/index.d.ts @@ -1,3 +1,4 @@ +import "./pings"; import "./canvas-animation"; import "./control-icon"; import "./mouse-handler"; diff --git a/src/foundry/client/pixi/core/interaction/ping.d.ts b/src/foundry/client/pixi/core/interaction/ping.d.ts index 054486b27..aacb65b5d 100644 --- a/src/foundry/client/pixi/core/interaction/ping.d.ts +++ b/src/foundry/client/pixi/core/interaction/ping.d.ts @@ -1,5 +1,8 @@ export {}; +// TODO: Remove once color export is fixed +type Color = number; + declare global { interface PingOptions { /** @@ -36,6 +39,10 @@ declare global { */ constructor(origin: PIXI.Point, options?: PingOptions); + options: PingOptions; + + _color: Color | number; + /** {@inheritdoc} */ destroy(options?: Record): void; diff --git a/src/foundry/client/pixi/core/interaction/pings/chevron.d.ts b/src/foundry/client/pixi/core/interaction/pings/chevron.d.ts new file mode 100644 index 000000000..8010106be --- /dev/null +++ b/src/foundry/client/pixi/core/interaction/pings/chevron.d.ts @@ -0,0 +1,73 @@ +export {}; + +declare global { + /** + * A type of ping that points to a specific location. + */ + class ChevronPing extends Ping { + /** + * @param origin - The canvas co-ordinates of the origin of the ping. + * @param options - Additional options to configure the ping animation. + * (default: `{duration: 900, size: 128, color: "#ff6400"}`) + */ + constructor(origin: PIXI.Point, options?: PingOptions); + + /** @defaultValue (this.options.size / 2) * .75 */ + _r: number; + + /** + * The inner ring is 3/4s the size of the outer. + * @defaultValue this._r * .75 + */ + _rInner: number; + + /** + * The animation is split into three stages. First, the chevron fades in and moves downwards, then the rings fade + * in, then everything fades out as the chevron moves back up. + * Store the 1/4 time slice. + * @defaultValue this.options.duration * .25 + */ + _t14: number; + + /** + * Store the 1/2 time slice. + * @defaultValue this.options.duration * .5 + */ + _t12: number; + + /** + * Store the 3/4s time slice. + * @defaultValue this._t14 * 3 + */ + _t34: number; + + /** + * The path to the chevron texture. + * @internal + */ + protected static _CHEVRON_PATH: "icons/pings/chevron.webp"; + + /** {@inheritdoc} */ + override animate(): Promise; + + /** {@inheritdoc} */ + override _animateFrame(dt: number, animation: CanvasAnimationData): void; + /** + * Draw the outer and inner rings. + * @param a - The alpha. + * @internal + */ + protected _drawRings(a: number): void; + + /** + * Load the chevron texture. + * @internal + */ + protected _loadChevron(): Promise; + /** + * Draw the two rings that are used as part of the ping animation. + * @internal + */ + protected _createRings(): PIXI.Graphics[]; + } +} diff --git a/src/foundry/client/pixi/core/interaction/pings/index.d.ts b/src/foundry/client/pixi/core/interaction/pings/index.d.ts new file mode 100644 index 000000000..65c6ac729 --- /dev/null +++ b/src/foundry/client/pixi/core/interaction/pings/index.d.ts @@ -0,0 +1,2 @@ +import "./chevron"; +import "./pulse"; diff --git a/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts b/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts new file mode 100644 index 000000000..4b3777339 --- /dev/null +++ b/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts @@ -0,0 +1,102 @@ +export {}; + +// TODO: Remove once color export is fixed +type Color = number; + +declare global { + interface PulsePingOptions extends PingOptions { + /** + * The number of rings used in the animation. + * (default: `3`) + */ + rings?: number; + /** + * The alternate color that the rings begin at. Use white for a 'flashing' effect. + * (default: `#ffffff`) + */ + color2?: string; + } + + /** + * A type of ping that produces a pulsing animation. + */ + class PulsePing extends Ping { + /** + * @param origin - The canvas co-ordinates of the origin of the ping. + * @param options - Additional options to configure the ping animation. + */ + constructor(origin: PIXI.Point, options?: PulsePingOptions); + + _color2: Color | number; + + /** + * The radius is half the diameter. + * @defaultValue this.options.size / 2 + */ + _r: number; + + /** + * This is the radius that the rings initially begin at. It's set to 1/5th of the maximum radius. + * @defaultValue this._r / 5 + */ + _r0: number; + + /** + * Initialize some time slice variables that will be used to control the animation. + * + * The animation for each ring can be separated into two consecutive stages. + * Stage 1: Fade in a white ring with radius r0. + * Stage 2: Expand radius outward. While the radius is expanding outward, we have two additional, consecutive + * animations: + * Stage 2.1: Transition color from white to the configured color. + * Stage 2.2: Fade out. + * 1/5th of the animation time is allocated to Stage 1. 4/5ths are allocated to Stage 2. Of those 4/5ths, 2/5ths + * are allocated to Stage 2.1, and 2/5ths are allocated to Stage 2.2. + * @internal + */ + protected _computeTimeSlices(): void; + + /** {@inheritdoc} */ + override animate(): Promise; + + /** {@inheritdoc} */ + override _animateFrame(dt: number, animation: CanvasAnimationData): void; + + /** + * Transition linearly from one color to another. + * @param from - The color to transition from. + * @param to - The color to transition to. + * @param duration - The length of the transition in milliseconds. + * @param t - The current time along the duration. + * @returns The incremental color between from and to. + * @internal + */ + protected _colorTransition(from: Color, to: Color, duration: number, t: number): number; + + /** + * Draw the shape for this ping. + * @param g - The graphics object to draw to. + * @param color - The color of the shape. + * @param alpha - The alpha of the shape. + * @param size - The size of the shape to draw. + */ + protected _drawShape(g: PIXI.Graphics, color: number, alph: number, size: number): void; + } + + /** + * A type of ping that produces an arrow pointing in a given direction. + */ + class ArrowPing extends PulsePing { + /** + * @param origin - The canvas co-ordinates of the origin of the ping. This becomes the arrow's tip. + * @param options - Additional options to configure the ping animation. + */ + constructor( + origin: PIXI.Point, + options: PulsePingOptions & { + /** The angle of the arrow in radians. */ + rotation: number; + }, + ); + } +} From 5c8d021b7c4ce96b4900fc6fb1a20d16147c2aec Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Fri, 24 Nov 2023 15:20:24 -0800 Subject: [PATCH 42/75] AlertPing --- .../pixi/core/interaction/pings/pulse.d.ts | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts b/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts index 4b3777339..073ede241 100644 --- a/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts +++ b/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts @@ -90,13 +90,33 @@ declare global { /** * @param origin - The canvas co-ordinates of the origin of the ping. This becomes the arrow's tip. * @param options - Additional options to configure the ping animation. + * @param rotation - The angle of the arrow in radians. */ constructor( origin: PIXI.Point, options: PulsePingOptions & { - /** The angle of the arrow in radians. */ + /** + * The angle of the arrow in radians. + * (default: `0`) + */ rotation: number; }, ); + + /** {@inheritdoc} */ + protected override _drawShape(g: PIXI.Graphics, color: number, alph: number, size: number): void; + } + /** + * A type of ping that produces a pulse warning sign animation. + */ + class AlertPing extends PulsePing { + /** + * @param origin - The canvas co-ordinates of the origin of the ping. + * @param options - Additional options to configure the ping animation. + */ + constructor(origin: PIXI.Point, options: PulsePingOptions); + + /** {@inheritdoc} */ + protected override _drawShape(g: PIXI.Graphics, color: number, alph: number, size: number): void; } } From 58323709a82a1630e9f856492d100b413932eb5a Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Fri, 24 Nov 2023 17:14:10 -0800 Subject: [PATCH 43/75] Fixed Typing --- src/foundry/client/pixi/core/interaction/render-flags.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/foundry/client/pixi/core/interaction/render-flags.d.ts b/src/foundry/client/pixi/core/interaction/render-flags.d.ts index 923b12000..a63a6be03 100644 --- a/src/foundry/client/pixi/core/interaction/render-flags.d.ts +++ b/src/foundry/client/pixi/core/interaction/render-flags.d.ts @@ -97,6 +97,8 @@ declare global { Base: BaseClass, ): Pick & typeof RenderFlagObject & { - new (...args: ConstructorParameters): InstanceType & RenderFlagObject; + new ( + ...args: ConstructorParameters + ): InstanceType & RenderFlagObject; }; } From 02c9d577b755c0e02a390fb25d94e8e64d7c5688 Mon Sep 17 00:00:00 2001 From: Joseph Date: Mon, 27 Nov 2023 08:24:16 -0800 Subject: [PATCH 44/75] Update src/foundry/client/pixi/core/interaction/control-icon.d.ts Co-authored-by: LukeAbby <109059814+LukeAbby@users.noreply.github.com> --- src/foundry/client/pixi/core/interaction/control-icon.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/foundry/client/pixi/core/interaction/control-icon.d.ts b/src/foundry/client/pixi/core/interaction/control-icon.d.ts index cc34bc9c9..006139c31 100644 --- a/src/foundry/client/pixi/core/interaction/control-icon.d.ts +++ b/src/foundry/client/pixi/core/interaction/control-icon.d.ts @@ -49,7 +49,8 @@ declare class ControlIcon extends PIXI.Container { icon: PIXI.Sprite; /** - * @defaultValue `border.visible = false` + * @defaultValue + * The `visible` property is true. */ border: PIXI.Graphics; From dff3ce185f4092386697b61cec597aa37adbef45 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 27 Nov 2023 14:44:18 -0800 Subject: [PATCH 45/75] Updated imports, made requested adjustments --- index.d.ts | 1 - package-lock.json | 2266 ++++------------- package.json | 28 +- src/foundry/client/config.d.ts | 1 - .../pixi/core/interaction/mouse-handler.d.ts | 9 +- .../pixi/core/interaction/pings/chevron.d.ts | 12 +- .../pixi/core/interaction/pings/pulse.d.ts | 5 +- .../pixi/core/interaction/render-flags.d.ts | 2 +- .../pixi/core/shapes/source-polygon.d.ts | 11 +- .../client/pixi/extensions/circle.d.ts | 27 +- .../client/pixi/extensions/rectangle.d.ts | 2 + .../client/pixi/perception/color-manager.d.ts | 51 +- .../pixi/perception/detection-mode.d.ts | 17 +- .../pixi/perception/perception-manager.d.ts | 18 +- .../perception/weiler-atherton-clipping.d.ts | 5 +- src/foundry/client/pixi/placeable.d.ts | 20 +- .../client/pixi/sources/base-source.d.ts | 9 + .../client/pixi/sources/rendered-source.d.ts | 11 + .../client/pixi/sources/sound-source.d.ts | 4 +- src/types/augments/index.d.ts | 1 + src/types/augments/pixiGlobal.d.ts | 8 + .../pixi/perception/clockwise-sweep.test-d.ts | 13 +- tsconfig.json | 1 + 23 files changed, 578 insertions(+), 1944 deletions(-) create mode 100644 src/types/augments/pixiGlobal.d.ts diff --git a/index.d.ts b/index.d.ts index cd910c006..ba58578cd 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,3 @@ -import "pixi.js"; import "handlebars"; import "jquery"; import "showdown"; diff --git a/package-lock.json b/package-lock.json index 3969d7861..043a3fc25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,25 +9,29 @@ "version": "9.269.0", "license": "MIT", "dependencies": { - "@pixi/graphics-smooth": "^0.0.30", - "@pixi/particle-emitter": "^5.0.7", + "@pixi/graphics-smooth": "^1.1.0", + "@pixi/particle-emitter": "^5.0.8", "@types/jquery": "~3.5.22", "@types/showdown": "~2.0.2", "@types/simple-peer": "~9.11.1", "@types/youtube": "~0.0.48", "handlebars": "^4.7.7", - "pixi.js": "^5.3.11", + "pixi.js": "^7.2.4", "prosemirror-collab": "^1.3.0", - "prosemirror-commands": "^1.3.0", + "prosemirror-commands": "^1.5.1", + "prosemirror-dropcursor": "^1.8.0", + "prosemirror-gapcursor": "^1.3.1", + "prosemirror-history": "^1.3.0", "prosemirror-inputrules": "^1.2.0", - "prosemirror-keymap": "^1.2.0", - "prosemirror-model": "^1.18.1", - "prosemirror-schema-list": "^1.2.1", - "prosemirror-state": "^1.4.1", - "prosemirror-transform": "^1.7.0", - "prosemirror-view": "^1.27.2", - "socket.io-client": "^4.5.1", - "tinymce": "^6.7.0" + "prosemirror-keymap": "^1.2.1", + "prosemirror-model": "^1.19.0", + "prosemirror-schema-list": "^1.2.2", + "prosemirror-state": "^1.4.2", + "prosemirror-tables": "^1.3.2", + "prosemirror-transform": "^1.7.1", + "prosemirror-view": "^1.30.2", + "socket.io-client": "^4.6.1", + "tinymce": "^6.7.1" }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^6.7.4", @@ -556,1726 +560,147 @@ "node": ">= 8" } }, - "node_modules/@pixi/accessibility": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/accessibility/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/accessibility/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/accessibility/node_modules/@pixi/display": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/accessibility/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/accessibility/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/accessibility/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/accessibility/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/accessibility/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/app": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12" - } - }, - "node_modules/@pixi/app/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/app/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/app/node_modules/@pixi/display": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/app/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/app/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/app/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/app/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/app/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/constants": { - "version": "6.5.10", - "license": "MIT", - "peer": true - }, - "node_modules/@pixi/core": { - "version": "6.5.10", - "license": "MIT", - "peer": true, - "dependencies": { - "@types/offscreencanvas": "^2019.6.4" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - }, - "peerDependencies": { - "@pixi/constants": "6.5.10", - "@pixi/extensions": "6.5.10", - "@pixi/math": "6.5.10", - "@pixi/runner": "6.5.10", - "@pixi/settings": "6.5.10", - "@pixi/ticker": "6.5.10", - "@pixi/utils": "6.5.10" - } - }, - "node_modules/@pixi/display": { - "version": "6.5.10", - "license": "MIT", - "peer": true, - "peerDependencies": { - "@pixi/constants": "6.5.10", - "@pixi/math": "6.5.10", - "@pixi/settings": "6.5.10", - "@pixi/utils": "6.5.10" - } - }, - "node_modules/@pixi/extensions": { - "version": "6.5.10", - "license": "MIT", - "peer": true - }, - "node_modules/@pixi/extract": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/extract/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/extract/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/extract/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/extract/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/extract/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/extract/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/extract/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/filter-alpha": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12" - } - }, - "node_modules/@pixi/filter-alpha/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-alpha/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/filter-alpha/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-alpha/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-alpha/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/filter-alpha/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/filter-alpha/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/filter-blur": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12", - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/filter-blur/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-blur/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/filter-blur/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-blur/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-blur/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/filter-blur/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/filter-blur/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/filter-color-matrix": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12" - } - }, - "node_modules/@pixi/filter-color-matrix/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-color-matrix/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/filter-color-matrix/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-color-matrix/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-color-matrix/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/filter-color-matrix/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/filter-color-matrix/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/filter-displacement": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12", - "@pixi/math": "5.3.12" - } - }, - "node_modules/@pixi/filter-displacement/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-displacement/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/filter-displacement/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-displacement/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-displacement/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/filter-displacement/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/filter-displacement/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/filter-fxaa": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12" - } - }, - "node_modules/@pixi/filter-fxaa/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-fxaa/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/filter-fxaa/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-fxaa/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-fxaa/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/filter-fxaa/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/filter-fxaa/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/filter-noise": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12" - } - }, - "node_modules/@pixi/filter-noise/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-noise/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/filter-noise/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-noise/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/filter-noise/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/filter-noise/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/filter-noise/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/graphics": { - "version": "6.5.10", - "license": "MIT", - "peer": true, - "peerDependencies": { - "@pixi/constants": "6.5.10", - "@pixi/core": "6.5.10", - "@pixi/display": "6.5.10", - "@pixi/math": "6.5.10", - "@pixi/sprite": "6.5.10", - "@pixi/utils": "6.5.10" - } - }, - "node_modules/@pixi/graphics-smooth": { - "version": "0.0.30", - "license": "MIT", - "peerDependencies": { - "@pixi/constants": "^6.0.4", - "@pixi/core": "^6.0.4", - "@pixi/display": "^6.0.4", - "@pixi/graphics": "^6.0.4", - "@pixi/math": "^6.0.4", - "@pixi/utils": "^6.0.4" - } - }, - "node_modules/@pixi/interaction": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/interaction/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/interaction/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/interaction/node_modules/@pixi/display": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/interaction/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/interaction/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/interaction/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/interaction/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/interaction/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/loaders": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12", - "@pixi/utils": "5.3.12", - "resource-loader": "^3.0.1" - } - }, - "node_modules/@pixi/loaders/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/loaders/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/loaders/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/loaders/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/loaders/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/loaders/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/loaders/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/math": { - "version": "6.5.10", - "license": "MIT", - "peer": true - }, - "node_modules/@pixi/mesh": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/mesh-extras": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/core": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/mesh": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/mesh-extras/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/mesh-extras/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/mesh-extras/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/mesh-extras/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/mesh-extras/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/mesh-extras/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/mesh-extras/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/mesh/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/mesh/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/mesh/node_modules/@pixi/display": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/mesh/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/mesh/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/mesh/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/mesh/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/mesh/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/mixin-cache-as-bitmap": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/sprite": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/mixin-cache-as-bitmap/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/mixin-cache-as-bitmap/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/mixin-cache-as-bitmap/node_modules/@pixi/display": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/mixin-cache-as-bitmap/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/mixin-cache-as-bitmap/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/mixin-cache-as-bitmap/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/mixin-cache-as-bitmap/node_modules/@pixi/sprite": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/mixin-cache-as-bitmap/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/mixin-cache-as-bitmap/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/mixin-get-child-by-name": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/display": "5.3.12" - } - }, - "node_modules/@pixi/mixin-get-child-by-name/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/mixin-get-child-by-name/node_modules/@pixi/display": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/mixin-get-child-by-name/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/mixin-get-child-by-name/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/mixin-get-child-by-name/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/mixin-get-global-position": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/display": "5.3.12", - "@pixi/math": "5.3.12" - } - }, - "node_modules/@pixi/mixin-get-global-position/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/mixin-get-global-position/node_modules/@pixi/display": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/mixin-get-global-position/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/mixin-get-global-position/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/mixin-get-global-position/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/particle-emitter": { - "version": "5.0.8", - "license": "MIT", - "peerDependencies": { - "@pixi/constants": ">=6.0.4 <8.0.0", - "@pixi/core": ">=6.0.4 <8.0.0", - "@pixi/display": ">=6.0.4 <8.0.0", - "@pixi/math": ">=6.0.4 <8.0.0", - "@pixi/sprite": ">=6.0.4 <8.0.0", - "@pixi/ticker": ">=6.0.4 <8.0.0" - }, - "workspaces": { - "packages": [ - "./", - "test/pixi-v6-iife", - "test/pixi-v6-module" - ] - } - }, - "node_modules/@pixi/particles": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/particles/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/particles/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/particles/node_modules/@pixi/display": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/particles/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/particles/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/particles/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/particles/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/particles/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/polyfill": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "es6-promise-polyfill": "^1.2.0", - "object-assign": "^4.1.1" - } - }, - "node_modules/@pixi/prepare": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/graphics": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/text": "5.3.12", - "@pixi/ticker": "5.3.12" - } - }, - "node_modules/@pixi/prepare/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/prepare/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/prepare/node_modules/@pixi/display": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/prepare/node_modules/@pixi/graphics": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/sprite": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/prepare/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/prepare/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/prepare/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/prepare/node_modules/@pixi/sprite": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/prepare/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/prepare/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/runner": { - "version": "6.5.10", - "license": "MIT", - "peer": true - }, - "node_modules/@pixi/settings": { - "version": "6.5.10", - "license": "MIT", - "peer": true, - "peerDependencies": { - "@pixi/constants": "6.5.10" - } - }, - "node_modules/@pixi/sprite": { - "version": "6.5.10", - "license": "MIT", - "peer": true, - "peerDependencies": { - "@pixi/constants": "6.5.10", - "@pixi/core": "6.5.10", - "@pixi/display": "6.5.10", - "@pixi/math": "6.5.10", - "@pixi/settings": "6.5.10", - "@pixi/utils": "6.5.10" - } - }, - "node_modules/@pixi/sprite-animated": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12", - "@pixi/sprite": "5.3.12", - "@pixi/ticker": "5.3.12" - } - }, - "node_modules/@pixi/sprite-animated/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/sprite-animated/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/sprite-animated/node_modules/@pixi/display": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/sprite-animated/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/sprite-animated/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/sprite-animated/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/sprite-animated/node_modules/@pixi/sprite": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/sprite-animated/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/sprite-animated/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/sprite-tiling": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/sprite": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/sprite-tiling/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/sprite-tiling/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/sprite-tiling/node_modules/@pixi/display": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/sprite-tiling/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/sprite-tiling/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/sprite-tiling/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/sprite-tiling/node_modules/@pixi/sprite": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/sprite-tiling/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/sprite-tiling/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/spritesheet": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12", - "@pixi/loaders": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/spritesheet/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/spritesheet/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/spritesheet/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/spritesheet/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/spritesheet/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } - }, - "node_modules/@pixi/spritesheet/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/spritesheet/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" - } - }, - "node_modules/@pixi/text": { - "version": "5.3.12", - "license": "MIT", + "node_modules/@pixi/color": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/color/-/color-7.3.2.tgz", + "integrity": "sha512-jur5PvdOtUBEUTjmPudW5qdQq6yYGlVGsi3HyhasJw14bN+GKJwiCKgIsyrsiNL5HBUXmje4ICwQohf6BqKqxA==", "dependencies": { - "@pixi/core": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/sprite": "5.3.12", - "@pixi/utils": "5.3.12" + "@pixi/colord": "^2.9.6" } }, - "node_modules/@pixi/text-bitmap": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/loaders": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/mesh": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/text": "5.3.12", - "@pixi/utils": "5.3.12" - } + "node_modules/@pixi/colord": { + "version": "2.9.6", + "resolved": "https://registry.npmjs.org/@pixi/colord/-/colord-2.9.6.tgz", + "integrity": "sha512-nezytU2pw587fQstUu1AsJZDVEynjskwOL+kibwcdxsMBFqPsFFNA7xl0ii/gXuDi6M0xj3mfRJj8pBSc2jCfA==" }, - "node_modules/@pixi/text-bitmap/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" + "node_modules/@pixi/constants": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-7.3.2.tgz", + "integrity": "sha512-Q8W3ncsFxmfgC5EtokpG92qJZabd+Dl+pbQAdHwiPY3v+8UNq77u4VN2qtl1Z04864hCcg7AStIYEDrzqTLF6Q==" }, - "node_modules/@pixi/text-bitmap/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" + "node_modules/@pixi/core": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-7.3.2.tgz", + "integrity": "sha512-Pta3ee8MtJ3yKxGXzglBWgwbEOKMB6Eth+FpLTjL0rgxiqTB550YX6jsNEQQAzcGjCBlO3rC/IF57UZ2go/X6w==", + "dependencies": { + "@pixi/color": "7.3.2", + "@pixi/constants": "7.3.2", + "@pixi/extensions": "7.3.2", + "@pixi/math": "7.3.2", + "@pixi/runner": "7.3.2", + "@pixi/settings": "7.3.2", + "@pixi/ticker": "7.3.2", + "@pixi/utils": "7.3.2", + "@types/offscreencanvas": "^2019.6.4" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/pixijs" } }, - "node_modules/@pixi/text-bitmap/node_modules/@pixi/display": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" + "node_modules/@pixi/display": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-7.3.2.tgz", + "integrity": "sha512-cY5AnZ3TWt5GYGx4e5AQ2/2U9kP+RorBg/O30amJ+8e9bFk9rS8cjh/DDq/hc4lql96BkXAInTl40eHnAML5lQ==", + "peerDependencies": { + "@pixi/core": "7.3.2" } }, - "node_modules/@pixi/text-bitmap/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/text-bitmap/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/text-bitmap/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" - } + "node_modules/@pixi/extensions": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/extensions/-/extensions-7.3.2.tgz", + "integrity": "sha512-Qw84ADfvmVu4Mwj+zTik/IEEK9lWS5n4trbrpQCcEZ+Mb8oRAXWvKz199mi1s7+LaZXDqeCY1yr2PHQaFf1KBA==" }, - "node_modules/@pixi/text-bitmap/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" + "node_modules/@pixi/graphics": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/graphics/-/graphics-7.3.2.tgz", + "integrity": "sha512-PhU6j1yub4tH/s+/gqByzgZ3mLv1mfb6iGXbquycg3+WypcxHZn0opFtI/axsazaQ9SEaWxw1m3i40WG5ANH5g==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/display": "7.3.2", + "@pixi/sprite": "7.3.2" } }, - "node_modules/@pixi/text-bitmap/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" + "node_modules/@pixi/graphics-smooth": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@pixi/graphics-smooth/-/graphics-smooth-1.1.0.tgz", + "integrity": "sha512-jU6zFb+I3me6Z28qz7QOKPPBBUu1fafrlXSHBAidZZNl/PAr6mwygBZ+cFHrA2JHscUPRY60+H2EzJ+aiOHm7A==", + "peerDependencies": { + "@pixi/core": "^7.2.0", + "@pixi/display": "^7.2.0", + "@pixi/graphics": "^7.2.0" } }, - "node_modules/@pixi/text/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" + "node_modules/@pixi/math": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-7.3.2.tgz", + "integrity": "sha512-dutoZ0IVJ5ME7UtYNo2szu4D7qsgtJB7e3ylujBVu7BOP2e710BVtFwFSFV768N14h9H5roGnuzVoDiJac2u+w==" }, - "node_modules/@pixi/text/node_modules/@pixi/core": { - "version": "5.3.12", + "node_modules/@pixi/particle-emitter": { + "version": "5.0.8", "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" + "peerDependencies": { + "@pixi/constants": ">=6.0.4 <8.0.0", + "@pixi/core": ">=6.0.4 <8.0.0", + "@pixi/display": ">=6.0.4 <8.0.0", + "@pixi/math": ">=6.0.4 <8.0.0", + "@pixi/sprite": ">=6.0.4 <8.0.0", + "@pixi/ticker": ">=6.0.4 <8.0.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" - } - }, - "node_modules/@pixi/text/node_modules/@pixi/display": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" + "workspaces": { + "packages": [ + "./", + "test/pixi-v6-iife", + "test/pixi-v6-module" + ] } }, - "node_modules/@pixi/text/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" - }, - "node_modules/@pixi/text/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" + "node_modules/@pixi/runner": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/runner/-/runner-7.3.2.tgz", + "integrity": "sha512-maKotoKJCQiQGBJwfM+iYdQKjrPN/Tn9+72F4WIf706zp/5vKoxW688Rsktg5BX4Mcn7ZkZvcJYTxj2Mv87lFA==" }, - "node_modules/@pixi/text/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", + "node_modules/@pixi/settings": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/settings/-/settings-7.3.2.tgz", + "integrity": "sha512-vtxzuARDTbFe0fRYSqB53B+mPpX7v+QjjnCUmVMVvZiWr3QcngMWVml6c6dQDln7IakWoKZRrNG4FpggvDgLVg==", "dependencies": { + "@pixi/constants": "7.3.2", + "@types/css-font-loading-module": "^0.0.7", "ismobilejs": "^1.1.0" } }, - "node_modules/@pixi/text/node_modules/@pixi/sprite": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" - } - }, - "node_modules/@pixi/text/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" - } - }, - "node_modules/@pixi/text/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" + "node_modules/@pixi/sprite": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/sprite/-/sprite-7.3.2.tgz", + "integrity": "sha512-IpWTKXExJNXVcY7ITopJ+JW48DahdbCo/81D2IYzBImq3jyiJM2Km5EoJgvAM5ZQ3Ev3KPPIBzYLD+HoPWcxdw==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/display": "7.3.2" } }, "node_modules/@pixi/ticker": { - "version": "6.5.10", - "license": "MIT", - "peer": true, - "peerDependencies": { - "@pixi/extensions": "6.5.10", - "@pixi/settings": "6.5.10" + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/ticker/-/ticker-7.3.2.tgz", + "integrity": "sha512-5kIPhBeXwDJohCzKzJJ6T7f1oAGbHAgeiwOjlTO+9lNXUX8ZPj0407V3syuF+64kFqJzIBCznBRpI+fmT4c9SA==", + "dependencies": { + "@pixi/extensions": "7.3.2", + "@pixi/settings": "7.3.2", + "@pixi/utils": "7.3.2" } }, "node_modules/@pixi/utils": { - "version": "6.5.10", - "license": "MIT", - "peer": true, + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/utils/-/utils-7.3.2.tgz", + "integrity": "sha512-KhNvj9YcY7Zi2dTKZgDpx8C6OxKKR541vwtG6JgdBZZYDeMBOIghN2Vi5zn4diW5BhDfHBmdSJ1wZXEtE2MDwg==", "dependencies": { + "@pixi/color": "7.3.2", + "@pixi/constants": "7.3.2", + "@pixi/settings": "7.3.2", "@types/earcut": "^2.1.0", "earcut": "^2.2.4", - "eventemitter3": "^3.1.0", + "eventemitter3": "^4.0.0", "url": "^0.11.0" - }, - "peerDependencies": { - "@pixi/constants": "6.5.10", - "@pixi/settings": "6.5.10" } }, "node_modules/@pkgr/utils": { @@ -2322,10 +747,14 @@ "@types/chai": "*" } }, + "node_modules/@types/css-font-loading-module": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/@types/css-font-loading-module/-/css-font-loading-module-0.0.7.tgz", + "integrity": "sha512-nl09VhutdjINdWyXxHWN/w9zlNCfr60JUqJbd24YXUuCwgeL0TpFSdElCwb6cxfB6ybE19Gjj4g0jsgkXxKv1Q==" + }, "node_modules/@types/earcut": { "version": "2.1.2", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@types/eslint": { "version": "8.44.3", @@ -2365,8 +794,7 @@ }, "node_modules/@types/offscreencanvas": { "version": "2019.7.1", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@types/semver": { "version": "7.5.6", @@ -3170,10 +1598,6 @@ "node": ">=10.0.0" } }, - "node_modules/es6-promise-polyfill": { - "version": "1.2.0", - "license": "MIT" - }, "node_modules/esbuild": { "version": "0.18.20", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", @@ -3408,8 +1832,9 @@ } }, "node_modules/eventemitter3": { - "version": "3.1.2", - "license": "MIT" + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" }, "node_modules/execa": { "version": "7.2.0", @@ -3933,7 +2358,8 @@ }, "node_modules/ismobilejs": { "version": "1.1.1", - "license": "MIT" + "resolved": "https://registry.npmjs.org/ismobilejs/-/ismobilejs-1.1.1.tgz", + "integrity": "sha512-VaFW53yt8QO61k2WJui0dHf4SlL8lxBofUuUmwBo0ljPk0Drz2TiuDW4jo3wDcv41qy/SxrJ+VAzJ/qYqsmzRw==" }, "node_modules/jju": { "version": "1.4.0", @@ -4263,10 +2689,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/mini-signals": { - "version": "1.2.0", - "license": "MIT" - }, "node_modules/minimatch": { "version": "3.1.2", "dev": true, @@ -4353,13 +2775,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/object-assign": { - "version": "4.1.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/object-inspect": { "version": "1.12.3", "license": "MIT", @@ -4466,13 +2881,6 @@ "node": ">=6" } }, - "node_modules/parse-uri": { - "version": "1.0.8", - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/path-exists": { "version": "4.0.0", "dev": true, @@ -4553,133 +2961,275 @@ } }, "node_modules/pixi.js": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/accessibility": "5.3.12", - "@pixi/app": "5.3.12", - "@pixi/constants": "5.3.12", - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/extract": "5.3.12", - "@pixi/filter-alpha": "5.3.12", - "@pixi/filter-blur": "5.3.12", - "@pixi/filter-color-matrix": "5.3.12", - "@pixi/filter-displacement": "5.3.12", - "@pixi/filter-fxaa": "5.3.12", - "@pixi/filter-noise": "5.3.12", - "@pixi/graphics": "5.3.12", - "@pixi/interaction": "5.3.12", - "@pixi/loaders": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/mesh": "5.3.12", - "@pixi/mesh-extras": "5.3.12", - "@pixi/mixin-cache-as-bitmap": "5.3.12", - "@pixi/mixin-get-child-by-name": "5.3.12", - "@pixi/mixin-get-global-position": "5.3.12", - "@pixi/particles": "5.3.12", - "@pixi/polyfill": "5.3.12", - "@pixi/prepare": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/sprite": "5.3.12", - "@pixi/sprite-animated": "5.3.12", - "@pixi/sprite-tiling": "5.3.12", - "@pixi/spritesheet": "5.3.12", - "@pixi/text": "5.3.12", - "@pixi/text-bitmap": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/pixi.js/-/pixi.js-7.3.2.tgz", + "integrity": "sha512-GJickUrT3UcBInGT1CU6cv2oktCdocE5QM74CD3t+weiJPPWIzleNlp7zrBR5QIDdU6bEO8CUgUXH2Y9QvlCMw==", + "dependencies": { + "@pixi/accessibility": "7.3.2", + "@pixi/app": "7.3.2", + "@pixi/assets": "7.3.2", + "@pixi/compressed-textures": "7.3.2", + "@pixi/core": "7.3.2", + "@pixi/display": "7.3.2", + "@pixi/events": "7.3.2", + "@pixi/extensions": "7.3.2", + "@pixi/extract": "7.3.2", + "@pixi/filter-alpha": "7.3.2", + "@pixi/filter-blur": "7.3.2", + "@pixi/filter-color-matrix": "7.3.2", + "@pixi/filter-displacement": "7.3.2", + "@pixi/filter-fxaa": "7.3.2", + "@pixi/filter-noise": "7.3.2", + "@pixi/graphics": "7.3.2", + "@pixi/mesh": "7.3.2", + "@pixi/mesh-extras": "7.3.2", + "@pixi/mixin-cache-as-bitmap": "7.3.2", + "@pixi/mixin-get-child-by-name": "7.3.2", + "@pixi/mixin-get-global-position": "7.3.2", + "@pixi/particle-container": "7.3.2", + "@pixi/prepare": "7.3.2", + "@pixi/sprite": "7.3.2", + "@pixi/sprite-animated": "7.3.2", + "@pixi/sprite-tiling": "7.3.2", + "@pixi/spritesheet": "7.3.2", + "@pixi/text": "7.3.2", + "@pixi/text-bitmap": "7.3.2", + "@pixi/text-html": "7.3.2" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/pixijs" } }, - "node_modules/pixi.js/node_modules/@pixi/constants": { - "version": "5.3.12", - "license": "MIT" + "node_modules/pixi.js/node_modules/@pixi/accessibility": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/accessibility/-/accessibility-7.3.2.tgz", + "integrity": "sha512-MdkU22HTauRvq9cMeWZIQGaDDa86sr+m12rKNdLV+FaDQgP/AhP+qCVpK7IKeJa9BrWGXaYMw/vueij7HkyDSA==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/display": "7.3.2", + "@pixi/events": "7.3.2" + } }, - "node_modules/pixi.js/node_modules/@pixi/core": { - "version": "5.3.12", - "license": "MIT", + "node_modules/pixi.js/node_modules/@pixi/app": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/app/-/app-7.3.2.tgz", + "integrity": "sha512-3YRFSMvAxDebAz3/JJv+2jzbPkT8cHC0IHmmLRN8krDL1pZV+YjMLgMwN/Oeyv5TSbwNqnrF5su5whNkRaxeZQ==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/display": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/assets": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/assets/-/assets-7.3.2.tgz", + "integrity": "sha512-yteq6ptAxA09EcwU9D9hl7qr5yWIqy+c2PsXkTDkc76vTAwIamLY3KxLq2aR5y1U4L4O6aHFJd26uNhHcuTPmw==", "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/runner": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/ticker": "5.3.12", - "@pixi/utils": "5.3.12" + "@types/css-font-loading-module": "^0.0.7" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/pixijs" + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/utils": "7.3.2" } }, - "node_modules/pixi.js/node_modules/@pixi/display": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" + "node_modules/pixi.js/node_modules/@pixi/compressed-textures": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/compressed-textures/-/compressed-textures-7.3.2.tgz", + "integrity": "sha512-J3ENMHDPQO6CJRei55gqI0WmiZJIK6SgsW5AEkShT0aAe5miEBSomv70pXw/58ru+4/Hx8cXjamsGt4aQB2D0Q==", + "peerDependencies": { + "@pixi/assets": "7.3.2", + "@pixi/core": "7.3.2" } }, - "node_modules/pixi.js/node_modules/@pixi/graphics": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/sprite": "5.3.12", - "@pixi/utils": "5.3.12" + "node_modules/pixi.js/node_modules/@pixi/events": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/events/-/events-7.3.2.tgz", + "integrity": "sha512-Moca9epu8jk1wIQCdVYjhz2pD9Ol21m50wvWUKvpgt9yM/AjkCLSDt8HO/PmTpavDrkhx5pVVWeDDA6FyUNaGA==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/display": "7.3.2" } }, - "node_modules/pixi.js/node_modules/@pixi/math": { - "version": "5.3.12", - "license": "MIT" + "node_modules/pixi.js/node_modules/@pixi/extract": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/extract/-/extract-7.3.2.tgz", + "integrity": "sha512-KsoflvQZV/XD8A8xbtRnmI4reYekbI4MOi7ilwQe5tMz6O1mO7IzrSukxkSMD02f6SpbAqbi7a1EayTjvY0ECQ==", + "peerDependencies": { + "@pixi/core": "7.3.2" + } }, - "node_modules/pixi.js/node_modules/@pixi/runner": { - "version": "5.3.12", - "license": "MIT" + "node_modules/pixi.js/node_modules/@pixi/filter-alpha": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/filter-alpha/-/filter-alpha-7.3.2.tgz", + "integrity": "sha512-nZMdn310wH5ZK1slwv3X4qT8eLoAGO7SgYGCy5IsMtpCtNObzE9XA4tAfhXrjihyzPS9KvszgAbnv1Qpfh0/uw==", + "peerDependencies": { + "@pixi/core": "7.3.2" + } }, - "node_modules/pixi.js/node_modules/@pixi/settings": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "ismobilejs": "^1.1.0" + "node_modules/pixi.js/node_modules/@pixi/filter-blur": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/filter-blur/-/filter-blur-7.3.2.tgz", + "integrity": "sha512-unu3zhwHMhN+iAe7Td2rK40i2UJ2GOhzWK+6jcU3ZkMOsFCT5kgBoMRTejeQVcvCs6GoYK8imbkE7mXt05Vj6A==", + "peerDependencies": { + "@pixi/core": "7.3.2" } }, - "node_modules/pixi.js/node_modules/@pixi/sprite": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/core": "5.3.12", - "@pixi/display": "5.3.12", - "@pixi/math": "5.3.12", - "@pixi/settings": "5.3.12", - "@pixi/utils": "5.3.12" + "node_modules/pixi.js/node_modules/@pixi/filter-color-matrix": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/filter-color-matrix/-/filter-color-matrix-7.3.2.tgz", + "integrity": "sha512-rbyjes/9SMoV9jjPiK0sLMkmLfN8D17GoTJIfq/KLv1x9646W5fL2QSKkN04UkZ+020ndWvIOxK1S97tvRyCfg==", + "peerDependencies": { + "@pixi/core": "7.3.2" } }, - "node_modules/pixi.js/node_modules/@pixi/ticker": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/settings": "5.3.12" + "node_modules/pixi.js/node_modules/@pixi/filter-displacement": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/filter-displacement/-/filter-displacement-7.3.2.tgz", + "integrity": "sha512-ZHl7Sfb8JYd9Z6j96OHCC0NhMKhhXJRE5AbkSDohjEMVCK1BV5rDGAHV8WVt/2MJ/j83CXUpydzyMhdM4lMchg==", + "peerDependencies": { + "@pixi/core": "7.3.2" } }, - "node_modules/pixi.js/node_modules/@pixi/utils": { - "version": "5.3.12", - "license": "MIT", - "dependencies": { - "@pixi/constants": "5.3.12", - "@pixi/settings": "5.3.12", - "earcut": "^2.1.5", - "eventemitter3": "^3.1.0", - "url": "^0.11.0" + "node_modules/pixi.js/node_modules/@pixi/filter-fxaa": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/filter-fxaa/-/filter-fxaa-7.3.2.tgz", + "integrity": "sha512-9brtlxDnQTZk2XiFBKdBK9e+8CX9LdxxcL7LRpjEyiHuAPvTlQgu9B85LrJ4GzWKqJJKaIIZBzhIoiCLUnfeXg==", + "peerDependencies": { + "@pixi/core": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/filter-noise": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/filter-noise/-/filter-noise-7.3.2.tgz", + "integrity": "sha512-F8GQQ20n7tCjThX6GCXckiXz2YffOCxicTJ0oat9aVDZh+sVsAxYX0aKSdHh0hhv18F0yuc6tPsSL5DYb63xFg==", + "peerDependencies": { + "@pixi/core": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/mesh": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/mesh/-/mesh-7.3.2.tgz", + "integrity": "sha512-LFkt7ELYXQLgbgHpjl68j6JD5ejUwma8zoPn2gqSBbY+6pK/phjvV1Wkh76muF46VvNulgXF0+qLIDdCsfrDaA==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/display": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/mesh-extras": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/mesh-extras/-/mesh-extras-7.3.2.tgz", + "integrity": "sha512-s/tg9TsTZZxLEdCDKWnBChDGkc041HCTP7ykJv4fEROzb9B0lskULYyvv+/YNNKa2Ugb9WnkMknpOdOXCpjyyg==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/mesh": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/mixin-cache-as-bitmap": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/mixin-cache-as-bitmap/-/mixin-cache-as-bitmap-7.3.2.tgz", + "integrity": "sha512-bZRlyUN5+9kCUjn67V0IFtYIrbmx9Vs4sMOmXyrX3Q4B4gPLE46IzZz3v0IVaTjp32udlQztfJalIaWbuqgb3A==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/display": "7.3.2", + "@pixi/sprite": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/mixin-get-child-by-name": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/mixin-get-child-by-name/-/mixin-get-child-by-name-7.3.2.tgz", + "integrity": "sha512-mbUi3WxXrkViH7qOgjk4fu2BN36NwNb7u+Fy1J5dS8Bntj57ZVKmEV9PbUy0zYjXE8rVmeAvSu/2kbn5n9UutQ==", + "peerDependencies": { + "@pixi/display": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/mixin-get-global-position": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/mixin-get-global-position/-/mixin-get-global-position-7.3.2.tgz", + "integrity": "sha512-1nhWbBgmw6rK7yQJxzeI9yjKYYEkM5i3pee8qVu4YWo3b1xWVQA7osQG7aGM/4qywDkXaA1ZvciA5hfg6f4Q5Q==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/display": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/particle-container": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/particle-container/-/particle-container-7.3.2.tgz", + "integrity": "sha512-JYc4j4z97KmxyLp+1Lg0SNi8hy6RxcBBNQGk+CSLNXeDWxx3hykT5gj/ORX1eXyzHh1ZCG1XzeVS9Yr8QhlFHA==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/display": "7.3.2", + "@pixi/sprite": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/prepare": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/prepare/-/prepare-7.3.2.tgz", + "integrity": "sha512-aLPAXSYLUhMwxzJtn9m0TSZe+dQlZCt09QNBqYbSi8LZId54QMDyvfBb4zBOJZrD2xAZgYL5RIJuKHwZtFX6lQ==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/display": "7.3.2", + "@pixi/graphics": "7.3.2", + "@pixi/text": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/sprite-animated": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/sprite-animated/-/sprite-animated-7.3.2.tgz", + "integrity": "sha512-j9pyUe4cefxE9wecNfbWQyL5fBQKvCGYaOA0DE1X46ukBHrIuhA8u3jg2X3N3r4IcbVvxpWFYDrDsWXWeiBmSw==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/sprite": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/sprite-tiling": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/sprite-tiling/-/sprite-tiling-7.3.2.tgz", + "integrity": "sha512-tWVVb/rMIx5AczfUrVxa0dZaIufP5C0IOL7IGfFUDQqDu5JSAUC0mwLe4F12jAXBVsqYhCGYx5bIHbPiI5vcSQ==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/display": "7.3.2", + "@pixi/sprite": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/spritesheet": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/spritesheet/-/spritesheet-7.3.2.tgz", + "integrity": "sha512-UkwqrPYDqrEdK5ub9qn/9VBvt5caA8ffV5iYR6ssCvrpaQovBKmS+b5pr/BYf8xNTExDpR3OmPIo8iDEYWWLuw==", + "peerDependencies": { + "@pixi/assets": "7.3.2", + "@pixi/core": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/text": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/text/-/text-7.3.2.tgz", + "integrity": "sha512-LdtNj+K5tPB/0UcDcO52M/C7xhwFTGFhtdF42fPhRuJawM23M3zm1Y8PapXv+mury+IxCHT1w30YlAi0qTVpKQ==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/sprite": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/text-bitmap": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/text-bitmap/-/text-bitmap-7.3.2.tgz", + "integrity": "sha512-p8KLgtZSPowWU/Zj+GVtfsUT8uGYo4TtKKYbLoWuxkRA5Pc1+4C9/rV/EOSFfoZIdW5C+iFg5VxRgBllUQf+aA==", + "peerDependencies": { + "@pixi/assets": "7.3.2", + "@pixi/core": "7.3.2", + "@pixi/display": "7.3.2", + "@pixi/mesh": "7.3.2", + "@pixi/text": "7.3.2" + } + }, + "node_modules/pixi.js/node_modules/@pixi/text-html": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@pixi/text-html/-/text-html-7.3.2.tgz", + "integrity": "sha512-IYhBWEPOvqUtlHkS5/c1Hseuricj5jrrGd21ivcvHmcnK/x2m+CRGvvzeBp1mqoYBnDbQVrD2wSXSe4Dv9tEJA==", + "peerDependencies": { + "@pixi/core": "7.3.2", + "@pixi/display": "7.3.2", + "@pixi/sprite": "7.3.2", + "@pixi/text": "7.3.2" } }, "node_modules/pkg-types": { @@ -4797,6 +3347,38 @@ "prosemirror-transform": "^1.0.0" } }, + "node_modules/prosemirror-dropcursor": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/prosemirror-dropcursor/-/prosemirror-dropcursor-1.8.1.tgz", + "integrity": "sha512-M30WJdJZLyXHi3N8vxN6Zh5O8ZBbQCz0gURTfPmTIBNQ5pxrdU7A58QkNqfa98YEjSAL1HUyyU34f6Pm5xBSGw==", + "dependencies": { + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.1.0", + "prosemirror-view": "^1.1.0" + } + }, + "node_modules/prosemirror-gapcursor": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/prosemirror-gapcursor/-/prosemirror-gapcursor-1.3.2.tgz", + "integrity": "sha512-wtjswVBd2vaQRrnYZaBCbyDqr232Ed4p2QPtRIUK5FuqHYKGWkEwl08oQM4Tw7DOR0FsasARV5uJFvMZWxdNxQ==", + "dependencies": { + "prosemirror-keymap": "^1.0.0", + "prosemirror-model": "^1.0.0", + "prosemirror-state": "^1.0.0", + "prosemirror-view": "^1.0.0" + } + }, + "node_modules/prosemirror-history": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/prosemirror-history/-/prosemirror-history-1.3.2.tgz", + "integrity": "sha512-/zm0XoU/N/+u7i5zepjmZAEnpvjDtzoPWW6VmKptcAnPadN/SStsBjMImdCEbb3seiNTpveziPTIrXQbHLtU1g==", + "dependencies": { + "prosemirror-state": "^1.2.2", + "prosemirror-transform": "^1.0.0", + "prosemirror-view": "^1.31.0", + "rope-sequence": "^1.3.0" + } + }, "node_modules/prosemirror-inputrules": { "version": "1.2.1", "license": "MIT", @@ -4838,6 +3420,18 @@ "prosemirror-view": "^1.27.0" } }, + "node_modules/prosemirror-tables": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/prosemirror-tables/-/prosemirror-tables-1.3.4.tgz", + "integrity": "sha512-z6uLSQ1BLC3rgbGwZmpfb+xkdvD7W/UOsURDfognZFYaTtc0gsk7u/t71Yijp2eLflVpffMk6X0u0+u+MMDvIw==", + "dependencies": { + "prosemirror-keymap": "^1.1.2", + "prosemirror-model": "^1.8.1", + "prosemirror-state": "^1.3.1", + "prosemirror-transform": "^1.2.1", + "prosemirror-view": "^1.13.3" + } + }, "node_modules/prosemirror-transform": { "version": "1.8.0", "license": "MIT", @@ -4921,14 +3515,6 @@ "node": ">=4" } }, - "node_modules/resource-loader": { - "version": "3.0.1", - "license": "MIT", - "dependencies": { - "mini-signals": "^1.2.0", - "parse-uri": "^1.0.0" - } - }, "node_modules/restore-cursor": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", @@ -5014,6 +3600,11 @@ "fsevents": "~2.3.2" } }, + "node_modules/rope-sequence": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.4.tgz", + "integrity": "sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ==" + }, "node_modules/run-applescript": { "version": "5.0.0", "dev": true, @@ -5412,8 +4003,9 @@ "dev": true }, "node_modules/tinymce": { - "version": "6.7.0", - "license": "MIT" + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/tinymce/-/tinymce-6.8.0.tgz", + "integrity": "sha512-WSQlyfW8aPkOVMmmHmSVeA5Dq4JuUZjTB+PmePJ27oQ+ruv3Zn4KSTsvSnDUrHlqygjDvRidrCB/m5nTWCC2nA==" }, "node_modules/tinypool": { "version": "0.7.0", diff --git a/package.json b/package.json index e246dd854..9a0f7f260 100644 --- a/package.json +++ b/package.json @@ -56,25 +56,29 @@ "typscript" ], "dependencies": { - "@pixi/graphics-smooth": "^0.0.30", - "@pixi/particle-emitter": "^5.0.7", + "@pixi/graphics-smooth": "^1.1.0", + "@pixi/particle-emitter": "^5.0.8", "@types/jquery": "~3.5.22", "@types/showdown": "~2.0.2", "@types/simple-peer": "~9.11.1", "@types/youtube": "~0.0.48", "handlebars": "^4.7.7", - "pixi.js": "^5.3.11", + "pixi.js": "^7.2.4", "prosemirror-collab": "^1.3.0", - "prosemirror-commands": "^1.3.0", + "prosemirror-commands": "^1.5.1", + "prosemirror-dropcursor": "^1.8.0", + "prosemirror-gapcursor": "^1.3.1", + "prosemirror-history": "^1.3.0", "prosemirror-inputrules": "^1.2.0", - "prosemirror-keymap": "^1.2.0", - "prosemirror-model": "^1.18.1", - "prosemirror-schema-list": "^1.2.1", - "prosemirror-state": "^1.4.1", - "prosemirror-transform": "^1.7.0", - "prosemirror-view": "^1.27.2", - "socket.io-client": "^4.5.1", - "tinymce": "^6.7.0" + "prosemirror-keymap": "^1.2.1", + "prosemirror-model": "^1.19.0", + "prosemirror-schema-list": "^1.2.2", + "prosemirror-state": "^1.4.2", + "prosemirror-tables": "^1.3.2", + "prosemirror-transform": "^1.7.1", + "prosemirror-view": "^1.30.2", + "socket.io-client": "^4.6.1", + "tinymce": "^6.7.1" }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^6.7.4", diff --git a/src/foundry/client/config.d.ts b/src/foundry/client/config.d.ts index 37de6da81..3755115ff 100644 --- a/src/foundry/client/config.d.ts +++ b/src/foundry/client/config.d.ts @@ -3,7 +3,6 @@ import type { StatusEffect } from "./data/documents/token"; import * as CONST from "../common/constants.mjs"; // FIXME: Replace with imports for for the right things or remove when implemented -type VisionMode = unknown; type DetectInvisibilityVisionMode = VisionMode; type TremorSenseVisionMode = VisionMode; type DataModel = unknown; diff --git a/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts b/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts index f7ea4c18c..cd6ac8aa9 100644 --- a/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts +++ b/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts @@ -1,8 +1,3 @@ -declare namespace PIXI { - // TODO: Update the PIXI dependency - interface FederatedEvent {} -} - /** * Handle mouse interaction events for a Canvas object. * There are three phases of events: hover, click, and drag @@ -62,14 +57,14 @@ declare class MouseInteractionManager boolean) | boolean + ((user: Game["user"], event: PIXI.FederatedEvent) => boolean) | boolean > >; /** * @defaultValue `{}` */ - callbacks: Partial void) | null>>; + callbacks: Partial void) | null>>; /** * @defaultValue `{}` diff --git a/src/foundry/client/pixi/core/interaction/pings/chevron.d.ts b/src/foundry/client/pixi/core/interaction/pings/chevron.d.ts index 8010106be..42fc6ef20 100644 --- a/src/foundry/client/pixi/core/interaction/pings/chevron.d.ts +++ b/src/foundry/client/pixi/core/interaction/pings/chevron.d.ts @@ -12,12 +12,12 @@ declare global { */ constructor(origin: PIXI.Point, options?: PingOptions); - /** @defaultValue (this.options.size / 2) * .75 */ + /** @defaultValue `(this.options.size / 2) * .75` */ _r: number; /** * The inner ring is 3/4s the size of the outer. - * @defaultValue this._r * .75 + * @defaultValue `this._r * .75` */ _rInner: number; @@ -25,19 +25,19 @@ declare global { * The animation is split into three stages. First, the chevron fades in and moves downwards, then the rings fade * in, then everything fades out as the chevron moves back up. * Store the 1/4 time slice. - * @defaultValue this.options.duration * .25 + * @defaultValue `this.options.duration * .25` */ _t14: number; /** * Store the 1/2 time slice. - * @defaultValue this.options.duration * .5 + * @defaultValue `this.options.duration * .5` */ _t12: number; /** * Store the 3/4s time slice. - * @defaultValue this._t14 * 3 + * @defaultValue `this._t14 * 3` */ _t34: number; @@ -52,6 +52,7 @@ declare global { /** {@inheritdoc} */ override _animateFrame(dt: number, animation: CanvasAnimationData): void; + /** * Draw the outer and inner rings. * @param a - The alpha. @@ -64,6 +65,7 @@ declare global { * @internal */ protected _loadChevron(): Promise; + /** * Draw the two rings that are used as part of the ping animation. * @internal diff --git a/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts b/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts index 073ede241..106cf4d68 100644 --- a/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts +++ b/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts @@ -10,6 +10,7 @@ declare global { * (default: `3`) */ rings?: number; + /** * The alternate color that the rings begin at. Use white for a 'flashing' effect. * (default: `#ffffff`) @@ -31,13 +32,13 @@ declare global { /** * The radius is half the diameter. - * @defaultValue this.options.size / 2 + * @defaultValue `this.options.size / 2` */ _r: number; /** * This is the radius that the rings initially begin at. It's set to 1/5th of the maximum radius. - * @defaultValue this._r / 5 + * @defaultValue `this._r / 5` */ _r0: number; diff --git a/src/foundry/client/pixi/core/interaction/render-flags.d.ts b/src/foundry/client/pixi/core/interaction/render-flags.d.ts index a63a6be03..3c69ded1d 100644 --- a/src/foundry/client/pixi/core/interaction/render-flags.d.ts +++ b/src/foundry/client/pixi/core/interaction/render-flags.d.ts @@ -1,7 +1,7 @@ export {}; declare global { - /** @remarks Values are marked as optional here based on use, foundry docs incomplete */ + /** @privateRemarks Values are marked as optional here based on use, foundry docs incomplete */ type RenderFlag = { /** Activating this flag also sets these flags to true */ propagate?: string[]; diff --git a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts index e3b800163..37bf82602 100644 --- a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts +++ b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts @@ -30,16 +30,16 @@ interface PointSourcePolygonConfig { boundaryShapes?: Array; /** Does this polygon use the Scene inner or outer bounding rectangle */ - useInnerBounds?: Readonly; + readonly useInnerBounds?: boolean; /** Does this polygon have a limited radius? */ - hasLimitedRadius?: Readonly; + readonly hasLimitedRadius?: boolean; /** Does this polygon have a limited angle? */ - hasLimitedAngle?: Readonly; + readonly hasLimitedAngle?: boolean; /** The computed bounding box for the polygon */ - boundingBox?: Readonly; + readonly boundingBox?: PIXI.Rectangle; } /** @@ -49,7 +49,7 @@ declare abstract class PointSourcePolygon extends PIXI.Polygon { /** * Customize how wall direction of one-way walls is applied */ - static WALL_DIRECTION_MODES: Readonly<{ + static readonly WALL_DIRECTION_MODES: Readonly<{ NORMAL: 0; REVERSED: 1; BOTH: 2; @@ -192,6 +192,7 @@ declare abstract class PointSourcePolygon extends PIXI.Polygon { * (default: "all") */ mode?: string; + /** The configuration that defines a certain Polygon type */ config?: PointSourcePolygonConfig; }, diff --git a/src/foundry/client/pixi/extensions/circle.d.ts b/src/foundry/client/pixi/extensions/circle.d.ts index d5c01fb7c..ded1af985 100644 --- a/src/foundry/client/pixi/extensions/circle.d.ts +++ b/src/foundry/client/pixi/extensions/circle.d.ts @@ -48,7 +48,7 @@ declare global { * @param options - Options passed on to the pointsForArc method * @returns An array of points arranged clockwise from start to end */ - pointsBetween(a: Point, b: Point, options?: Record): Point[]; + pointsBetween(a: Point, b: Point, options?: Circle.PointsForArcOptions): Point[]; /** * Get the points that would approximate a circular arc along this circle, given a starting and ending angle. @@ -58,23 +58,14 @@ declare global { * @param options - Options which affect how the circle is converted * @returns An array of points along the requested arc */ - pointsForArc( - fromAngle: number, - toAngle: number, - options?: { - /** The number of points which defines the density of approximation */ - density: number; - /** Whether to include points at the circle where the arc starts and ends */ - includeEndpoints: boolean; - }, - ): Point[]; + pointsForArc(fromAngle: number, toAngle: number, options?: Circle.PointsForArcOptions): Point[]; /** * Approximate this PIXI.Circle as a PIXI.Polygon * @param options - Options forwarded on to the pointsForArc method * @returns The Circle expressed as a PIXI.Polygon */ - toPolygon(options?: Record): PIXI.Polygon; + toPolygon(options?: Circle.PointsForArcOptions): PIXI.Polygon; /** * The recommended vertex density for the regular polygon approximation of a circle of a given radius. @@ -99,8 +90,10 @@ declare global { options?: { /** The number of points which defines the density of approximation */ density: number; + /** The clipper clip type */ clipType: number; + /** * Use the Weiler-Atherton algorithm. Otherwise, use Clipper. * (default: `true`) @@ -125,5 +118,15 @@ declare global { }, ): PIXI.Polygon; } + + namespace Circle { + type PointsForArcOptions = { + /** The number of points which defines the density of approximation */ + density: number; + + /** Whether to include points at the circle where the arc starts and ends */ + includeEndpoints: boolean; + }; + } } } diff --git a/src/foundry/client/pixi/extensions/rectangle.d.ts b/src/foundry/client/pixi/extensions/rectangle.d.ts index 58e6bea6f..54dfa57ca 100644 --- a/src/foundry/client/pixi/extensions/rectangle.d.ts +++ b/src/foundry/client/pixi/extensions/rectangle.d.ts @@ -158,8 +158,10 @@ declare global { options?: { /** The number of points which defines the density of approximation */ density: number; + /** The clipper clip type */ clipType: number; + /** * Use the Weiler-Atherton algorithm. Otherwise, use Clipper. * (default: `true`) diff --git a/src/foundry/client/pixi/perception/color-manager.d.ts b/src/foundry/client/pixi/perception/color-manager.d.ts index 4736da39e..d7366598c 100644 --- a/src/foundry/client/pixi/perception/color-manager.d.ts +++ b/src/foundry/client/pixi/perception/color-manager.d.ts @@ -49,48 +49,41 @@ declare global { fogExplored: 0x000000; }; - /* -------------------------------------------- */ - /** * Returns the darkness penalty for the actual scene configuration. */ get darknessPenalty(): number; - /* -------------------------------------------- */ - /** * Get the darkness level of this scene. */ get darknessLevel(): number; - /* -------------------------------------------- */ - /** * Initialize color space pertaining to a specific scene. - * @param backgroundColor - The background canvas color - * @param brightestColor - The brightest ambient color - * @param darknessColor - The color of darkness - * @param darknessLevel - A preview darkness level - * @param daylightColor - The ambient daylight color - * @param fogExploredColor - The color applied to explored areas - * @param fogUnexploredColor - The color applied to unexplored areas + * @param colors - No comment */ - initialize({ - backgroundColor, - brightestColor, - darknessColor, - darknessLevel, - daylightColor, - fogExploredColor, - fogUnexploredColor, - }?: { - backgroundColor: Color | number | string; - brightestColor: Color | number | string; - darknessColor: Color | number | string; - darknessLevel: number; - daylightColor: Color | number | string; - fogExploredColor: number; - fogUnexploredColor: number; + initialize(colors?: { + /** The background canvas color */ + backgroundColor?: Color | number | string; + + /** The brightest ambient color */ + brightestColor?: Color | number | string; + + /** The color of darkness */ + darknessColor?: Color | number | string; + + /** A preview darkness level */ + darknessLevel?: number; + + /** The ambient daylight color */ + daylightColor?: Color | number | string; + + /** The color applied to explored areas */ + fogExploredColor?: number; + + /** The color applied to unexplored areas */ + fogUnexploredColor?: number; }): void; } } diff --git a/src/foundry/client/pixi/perception/detection-mode.d.ts b/src/foundry/client/pixi/perception/detection-mode.d.ts index 89a8491ad..b4d4c7e7d 100644 --- a/src/foundry/client/pixi/perception/detection-mode.d.ts +++ b/src/foundry/client/pixi/perception/detection-mode.d.ts @@ -1,8 +1,19 @@ export {}; -type TokenDetectionMode = unknown; -// TODO: Define in client/pixi/layers/effects/visibility.js -type CanvasVisibilityTest = unknown; +// TODO: Move to common/documents/token +type TokenDetectionMode = { + /** The id of the detection mode, a key from CONFIG.Canvas.detectionModes */ + id: string; + /** Whether or not this detection mode is presently enabled */ + enabled: boolean; + /** The maximum range in distance units at which this mode can detect targets */ + range: number; +}; +// TODO: Move to client/pixi/layers/effects/visibility.js +type CanvasVisibilityTest = { + point: PIXI.Point; + los: Map; +}; type CanvasVisibilityTestConfig = { object: PlaceableObject; tests: CanvasVisibilityTest[]; diff --git a/src/foundry/client/pixi/perception/perception-manager.d.ts b/src/foundry/client/pixi/perception/perception-manager.d.ts index 7171bb5b6..a5f566d73 100644 --- a/src/foundry/client/pixi/perception/perception-manager.d.ts +++ b/src/foundry/client/pixi/perception/perception-manager.d.ts @@ -4,24 +4,34 @@ declare global { interface PerceptionManagerFlags extends RenderFlags { /** Re-initialize the entire lighting configuration */ initializeLighting: boolean; + /** Refresh the rendered appearance of lighting */ refreshLighting: boolean; + /** Update the configuration of light sources */ refreshLightSources: boolean; + /** Re-initialize the entire vision configuration */ initializeVision: boolean; + /** Update the configuration of vision sources */ refreshVisionSources: boolean; + /** Refresh the rendered appearance of vision */ refreshVision: boolean; + /** Re-initialize the entire ambient sound configuration */ initializeSounds: boolean; + /** Refresh the audio state of ambient sounds */ refreshSounds: boolean; + /** Apply a fade duration to sound refresh workflow */ soundFadeDuration: boolean; + /** Refresh the visual appearance of tiles */ refreshTiles: boolean; + /** Refresh the contents of the PrimaryCanvasGroup mesh */ refreshPrimary: boolean; } @@ -36,9 +46,9 @@ declare global { static RENDER_FLAGS: { initializeLighting: { propagate: ["refreshLighting", "refreshVision"] }; refreshLighting: { propagate: ["refreshLightSources"] }; - refreshLightSources: {}; - refreshVisionSources: {}; - refreshPrimary: {}; + refreshLightSources: Record; + refreshVisionSources: Record; + refreshPrimary: Record; initializeVision: { propagate: ["refreshVision", "refreshTiles", "refreshLighting", "refreshLightSources", "refreshPrimary"]; }; @@ -89,7 +99,7 @@ declare global { /** * @deprecated since v10, will be removed in v12 - * @remarks "PerceptionManager#cancel is renamed to PerceptionManager#deactivate" + * @remarks PerceptionManager#cancel is renamed to PerceptionManager#deactivate * @remarks PerceptionManager#deactivate does not actually exist as of v11 */ cancel(): void; diff --git a/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts b/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts index 78a86cfd6..72e33e4b5 100644 --- a/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts +++ b/src/foundry/client/pixi/perception/weiler-atherton-clipping.d.ts @@ -30,16 +30,15 @@ declare global { * The supported clip types. * Values are equivalent to those in ClipperLib.ClipType. */ - static CLIP_TYPES: Readonly<{ + static readonly CLIP_TYPES: Readonly<{ INTERSECT: 0; UNION: 1; }>; /** * The supported intersection types. - * @readOnly */ - static INTERSECTION_TYPES: Readonly<{ + static readonly INTERSECTION_TYPES: Readonly<{ OUT_IN: -1; IN_OUT: 1; TANGENT: 0; diff --git a/src/foundry/client/pixi/placeable.d.ts b/src/foundry/client/pixi/placeable.d.ts index 00a3c05c8..c2f4349d3 100644 --- a/src/foundry/client/pixi/placeable.d.ts +++ b/src/foundry/client/pixi/placeable.d.ts @@ -291,62 +291,62 @@ declare global { * @param options - Options which customize event handling * (default: `{}`) */ - protected _onHoverIn(event: PIXI.InteractionEvent, options?: HoverInOptions): false | void; + protected _onHoverIn(event: PIXI.FederatedEvent, options?: HoverInOptions): false | void; /** * Actions that should be taken for this Placeable Object when a mouseout event occurs * @param event - The triggering canvas interaction event */ - protected _onHoverOut(event: PIXI.InteractionEvent): false | void; + protected _onHoverOut(event: PIXI.FederatedEvent): false | void; /** * Callback actions which occur on a single left-click event to assume control of the object * @see MouseInteractionManager#_handleClickLeft * @param event - The triggering canvas interaction event */ - protected _onClickLeft(event: PIXI.InteractionEvent): boolean | void; + protected _onClickLeft(event: PIXI.FederatedEvent): boolean | void; /** * Callback actions which occur on a double left-click event to activate * @see MouseInteractionManager#_handleClickLeft2 * @param event - The triggering canvas interaction event */ - protected _onClickLeft2(event: PIXI.InteractionEvent): void; + protected _onClickLeft2(event: PIXI.FederatedEvent): void; /** * Callback actions which occur on a single right-click event to configure properties of the object * @see MouseInteractionManager#_handleClickRight * @param event - The triggering canvas interaction event */ - protected _onClickRight(event: PIXI.InteractionEvent): void; + protected _onClickRight(event: PIXI.FederatedEvent): void; /** * Callback actions which occur on a double right-click event to configure properties of the object * @see MouseInteractionManager#_handleClickRight2 * @param event - The triggering canvas interaction event */ - protected _onClickRight2(event: PIXI.InteractionEvent): void; + protected _onClickRight2(event: PIXI.FederatedEvent): void; /** * Callback actions which occur when a mouse-drag action is first begun. * @see MouseInteractionManager#_handleDragStart * @param event - The triggering canvas interaction event */ - protected _onDragLeftStart(event: PIXI.InteractionEvent): void; + protected _onDragLeftStart(event: PIXI.FederatedEvent): void; /** * Callback actions which occur on a mouse-move operation. * @see MouseInteractionManager#_handleDragMove * @param event - The triggering canvas interaction event */ - protected _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected _onDragLeftMove(event: PIXI.FederatedEvent): void; /** * Callback actions which occur on a mouse-move operation. * @see MouseInteractionManager#_handleDragDrop * @param event - The triggering canvas interaction event */ - protected _onDragLeftDrop(event: PIXI.InteractionEvent): unknown; + protected _onDragLeftDrop(event: PIXI.FederatedEvent): unknown; /** * Callback actions which occur on a mouse-move operation. @@ -372,7 +372,7 @@ declare global { interface Vision { /** - * @remarks Documentation says PIXI.Circle, but determined by Atropos to be out of date. + * @privateRemarks Documentation says PIXI.Circle, but determined by Atropos to be out of date. * Likely to be removed in future version as it's no longer used generally. */ fov?: PIXI.Polygon | undefined; diff --git a/src/foundry/client/pixi/sources/base-source.d.ts b/src/foundry/client/pixi/sources/base-source.d.ts index b8b6efd16..ba2cb8ab0 100644 --- a/src/foundry/client/pixi/sources/base-source.d.ts +++ b/src/foundry/client/pixi/sources/base-source.d.ts @@ -190,22 +190,31 @@ declare global { interface PointSourceData { /** The x-coordinate of the source location */ x: number; + /** The y-coordinate of the source location */ y: number; + /** The elevation of the point source */ elevation: number; + /** An index for sorting the source relative to others at the same elevation */ z: number | null; + /** The radius of the source */ radius: number; + /** A secondary radius used for limited angles */ externalRadius: number; + /** The angle of rotation for this point source */ rotation: number; + /** The angle of emission for this point source */ angle: number; + /** Whether or not the source is constrained by walls */ walls: boolean; + /** Whether or not the source is disabled */ disabled: boolean; } diff --git a/src/foundry/client/pixi/sources/rendered-source.d.ts b/src/foundry/client/pixi/sources/rendered-source.d.ts index 2e25ceaa7..375adb901 100644 --- a/src/foundry/client/pixi/sources/rendered-source.d.ts +++ b/src/foundry/client/pixi/sources/rendered-source.d.ts @@ -7,25 +7,34 @@ declare global { interface RenderedPointSourceData extends PointSourceData { /** A color applied to the rendered effect */ color: number | null; + /** An integer seed to synchronize (or de-synchronize) animations */ seed: number | null; + /** Is this source a temporary preview? */ preview: boolean; } + namespace RenderedPointSource { type RenderedPointSourceAnimationConfig = { /** The human-readable (localized) label for the animation */ label?: string; + /** The animation function that runs every frame */ animation?: (dt: number, options: Partial) => any; + /** A custom illumination shader used by this animation */ illuminationShader?: AdaptiveIlluminationShader; + /** A custom coloration shader used by this animation */ colorationShader?: AdaptiveColorationShader; + /** A custom background shader used by this animation */ backgroundShader?: AdaptiveBackgroundShader; + /** The animation seed */ seed?: number; + /** The animation time */ time?: number; }; @@ -198,11 +207,13 @@ declare global { * (default: `5`) */ speed: number; + /** * The animation intensity, from 1 to 10 * (default: `5`) */ intensity: number; + /** * Reverse the animation direction * (default: `false`) diff --git a/src/foundry/client/pixi/sources/sound-source.d.ts b/src/foundry/client/pixi/sources/sound-source.d.ts index 7afea2cce..76ba4ff0f 100644 --- a/src/foundry/client/pixi/sources/sound-source.d.ts +++ b/src/foundry/client/pixi/sources/sound-source.d.ts @@ -9,10 +9,10 @@ declare global { protected override _getPolygonConfiguration(): PointSourcePolygonConfig & { useThreshold: true }; - /** @remarks Not implemented */ + /** @remarks A no-op */ protected _refresh(): void; - /** @remarks Not implemented */ + /** @remarks A no-op */ protected _destroy(): void; } } diff --git a/src/types/augments/index.d.ts b/src/types/augments/index.d.ts index ae8d8e9f2..f83ca434a 100644 --- a/src/types/augments/index.d.ts +++ b/src/types/augments/index.d.ts @@ -1,3 +1,4 @@ +import "./pixiGlobal"; import "./pixiGraphics"; import "./pixiGraphicsSmooth"; import "./pixiLegacyGraphics"; diff --git a/src/types/augments/pixiGlobal.d.ts b/src/types/augments/pixiGlobal.d.ts new file mode 100644 index 000000000..d0483c5a5 --- /dev/null +++ b/src/types/augments/pixiGlobal.d.ts @@ -0,0 +1,8 @@ +import * as PIXI from "pixi.js"; + +/** + * Added with the update of PIXI to 7.2.4 + * Necessary to maintain handling of PIXI in the global namespace + */ +export = PIXI; +export as namespace PIXI; diff --git a/tests/foundry/client/pixi/perception/clockwise-sweep.test-d.ts b/tests/foundry/client/pixi/perception/clockwise-sweep.test-d.ts index def48c82c..766123dc2 100644 --- a/tests/foundry/client/pixi/perception/clockwise-sweep.test-d.ts +++ b/tests/foundry/client/pixi/perception/clockwise-sweep.test-d.ts @@ -3,14 +3,7 @@ import { expectTypeOf } from "vitest"; const pointA = new Point(0, 0); const pointB = new Point(0, 0); -// Genuinely confused what's going on here -// without this I get 'Arguments for the rest parameter 'MISMATCH' were not provided.'; possible bug in vitest? -const testResult = {} as never; -expectTypeOf(ClockwiseSweepPolygon.testCollision(pointA, pointB, { mode: "any" })).toEqualTypeOf(testResult); -expectTypeOf(ClockwiseSweepPolygon.testCollision(pointA, pointB, { mode: "closest" })).toEqualTypeOf( - testResult, -); -expectTypeOf(ClockwiseSweepPolygon.testCollision(pointA, pointB, { mode: "all" })).toEqualTypeOf( - testResult, -); +expectTypeOf(ClockwiseSweepPolygon.testCollision(pointA, pointB, { mode: "any" })).toEqualTypeOf(); +expectTypeOf(ClockwiseSweepPolygon.testCollision(pointA, pointB, { mode: "closest" })).toEqualTypeOf(); +expectTypeOf(ClockwiseSweepPolygon.testCollision(pointA, pointB, { mode: "all" })).toEqualTypeOf(); diff --git a/tsconfig.json b/tsconfig.json index 6944ee671..a047bb7c7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,7 @@ "exactOptionalPropertyTypes": true, "lib": ["DOM", "ES2020"], "moduleResolution": "Node", + "esModuleInterop": true, "noEmit": true, "strict": true, "target": "ES2020", From bc372d7954e7a52faa5101f3f213fa2edf7bd64f Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 27 Nov 2023 15:00:31 -0800 Subject: [PATCH 46/75] More Touch-ups --- .../client/pixi/core/interaction/mouse-handler.d.ts | 7 ++++++- src/foundry/client/pixi/core/interaction/pings/pulse.d.ts | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts b/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts index cd6ac8aa9..528a99264 100644 --- a/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts +++ b/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts @@ -81,7 +81,11 @@ declare class MouseInteractionManager>; + interactionData: { + origin?: PIXI.Point; + destination?: PIXI.Point; + object?: Object; + } & Partial>; /** * The drag handling time @@ -210,6 +214,7 @@ declare class MouseInteractionManager Date: Tue, 28 Nov 2023 01:20:35 +0000 Subject: [PATCH 47/75] Bump @typescript-eslint/eslint-plugin from 6.12.0 to 6.13.0 Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.12.0 to 6.13.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.13.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 214 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 196 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3969d7861..7f636efd2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2397,16 +2397,16 @@ "integrity": "sha512-d4GpH4uPYp9W07kc487tiq6V/EUHl18vZWFMbQoe4Sk9LXEWzFi/BMf9x7TI4m7/j7gU3KeX8H6M8aPBgykeLw==" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.12.0.tgz", - "integrity": "sha512-XOpZ3IyJUIV1b15M7HVOpgQxPPF7lGXgsfcEIu3yDxFPaf/xZKt7s9QO/pbk7vpWQyVulpJbu4E5LwpZiQo4kA==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.13.0.tgz", + "integrity": "sha512-HTvbSd0JceI2GW5DHS3R9zbarOqjkM9XDR7zL8eCsBUO/eSiHcoNE7kSL5sjGXmVa9fjH5LCfHDXNnH4QLp7tQ==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.12.0", - "@typescript-eslint/type-utils": "6.12.0", - "@typescript-eslint/utils": "6.12.0", - "@typescript-eslint/visitor-keys": "6.12.0", + "@typescript-eslint/scope-manager": "6.13.0", + "@typescript-eslint/type-utils": "6.13.0", + "@typescript-eslint/utils": "6.13.0", + "@typescript-eslint/visitor-keys": "6.13.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -2431,6 +2431,53 @@ } } }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.0.tgz", + "integrity": "sha512-2x0K2/CujsokIv+LN2T0l5FVDMtsCjkUyYtlcY4xxnxLAW+x41LXr16duoicHpGtLhmtN7kqvuFJ3zbz00Ikhw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.13.0", + "@typescript-eslint/visitor-keys": "6.13.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.0.tgz", + "integrity": "sha512-oXg7DFxx/GmTrKXKKLSoR2rwiutOC7jCQ5nDH5p5VS6cmHE1TcPTaYQ0VPSSUvj7BnNqCgQ/NXcTBxn59pfPTQ==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.0.tgz", + "integrity": "sha512-UQklteCEMCRoq/1UhKFZsHv5E4dN1wQSzJoxTfABasWk1HgJRdg1xNUve/Kv/Sdymt4x+iEzpESOqRFlQr/9Aw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.13.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typescript-eslint/parser": { "version": "6.12.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.12.0.tgz", @@ -2477,13 +2524,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.12.0.tgz", - "integrity": "sha512-WWmRXxhm1X8Wlquj+MhsAG4dU/Blvf1xDgGaYCzfvStP2NwPQh6KBvCDbiOEvaE0filhranjIlK/2fSTVwtBng==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.13.0.tgz", + "integrity": "sha512-YHufAmZd/yP2XdoD3YeFEjq+/Tl+myhzv+GJHSOz+ro/NFGS84mIIuLU3pVwUcauSmwlCrVXbBclkn1HfjY0qQ==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.12.0", - "@typescript-eslint/utils": "6.12.0", + "@typescript-eslint/typescript-estree": "6.13.0", + "@typescript-eslint/utils": "6.13.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -2503,6 +2550,63 @@ } } }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.0.tgz", + "integrity": "sha512-oXg7DFxx/GmTrKXKKLSoR2rwiutOC7jCQ5nDH5p5VS6cmHE1TcPTaYQ0VPSSUvj7BnNqCgQ/NXcTBxn59pfPTQ==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.0.tgz", + "integrity": "sha512-IT4O/YKJDoiy/mPEDsfOfp+473A9GVqXlBKckfrAOuVbTqM8xbc0LuqyFCcgeFWpqu3WjQexolgqN2CuWBYbog==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.13.0", + "@typescript-eslint/visitor-keys": "6.13.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.0.tgz", + "integrity": "sha512-UQklteCEMCRoq/1UhKFZsHv5E4dN1wQSzJoxTfABasWk1HgJRdg1xNUve/Kv/Sdymt4x+iEzpESOqRFlQr/9Aw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.13.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typescript-eslint/types": { "version": "6.12.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.12.0.tgz", @@ -2544,17 +2648,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.12.0.tgz", - "integrity": "sha512-LywPm8h3tGEbgfyjYnu3dauZ0U7R60m+miXgKcZS8c7QALO9uWJdvNoP+duKTk2XMWc7/Q3d/QiCuLN9X6SWyQ==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.13.0.tgz", + "integrity": "sha512-V+txaxARI8yznDkcQ6FNRXxG+T37qT3+2NsDTZ/nKLxv6VfGrRhTnuvxPUxpVuWWr+eVeIxU53PioOXbz8ratQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.12.0", - "@typescript-eslint/types": "6.12.0", - "@typescript-eslint/typescript-estree": "6.12.0", + "@typescript-eslint/scope-manager": "6.13.0", + "@typescript-eslint/types": "6.13.0", + "@typescript-eslint/typescript-estree": "6.13.0", "semver": "^7.5.4" }, "engines": { @@ -2568,6 +2672,80 @@ "eslint": "^7.0.0 || ^8.0.0" } }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.0.tgz", + "integrity": "sha512-2x0K2/CujsokIv+LN2T0l5FVDMtsCjkUyYtlcY4xxnxLAW+x41LXr16duoicHpGtLhmtN7kqvuFJ3zbz00Ikhw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.13.0", + "@typescript-eslint/visitor-keys": "6.13.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.0.tgz", + "integrity": "sha512-oXg7DFxx/GmTrKXKKLSoR2rwiutOC7jCQ5nDH5p5VS6cmHE1TcPTaYQ0VPSSUvj7BnNqCgQ/NXcTBxn59pfPTQ==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.0.tgz", + "integrity": "sha512-IT4O/YKJDoiy/mPEDsfOfp+473A9GVqXlBKckfrAOuVbTqM8xbc0LuqyFCcgeFWpqu3WjQexolgqN2CuWBYbog==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.13.0", + "@typescript-eslint/visitor-keys": "6.13.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.0.tgz", + "integrity": "sha512-UQklteCEMCRoq/1UhKFZsHv5E4dN1wQSzJoxTfABasWk1HgJRdg1xNUve/Kv/Sdymt4x+iEzpESOqRFlQr/9Aw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.13.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typescript-eslint/visitor-keys": { "version": "6.12.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.12.0.tgz", From 1334ae0096ef793d521ccd4b4454d6a7e167bc37 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Nov 2023 01:20:57 +0000 Subject: [PATCH 48/75] Bump @typescript-eslint/parser from 6.12.0 to 6.13.0 Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.12.0 to 6.13.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.13.0/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 88 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 81 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3969d7861..28800ecd1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2432,15 +2432,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.12.0.tgz", - "integrity": "sha512-s8/jNFPKPNRmXEnNXfuo1gemBdVmpQsK1pcu+QIvuNJuhFzGrpD7WjOcvDc/+uEdfzSYpNu7U/+MmbScjoQ6vg==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.13.0.tgz", + "integrity": "sha512-VpG+M7GNhHLI/aTDctqAV0XbzB16vf+qDX9DXuMZSe/0bahzDA9AKZB15NDbd+D9M4cDsJvfkbGOA7qiZ/bWJw==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.12.0", - "@typescript-eslint/types": "6.12.0", - "@typescript-eslint/typescript-estree": "6.12.0", - "@typescript-eslint/visitor-keys": "6.12.0", + "@typescript-eslint/scope-manager": "6.13.0", + "@typescript-eslint/types": "6.13.0", + "@typescript-eslint/typescript-estree": "6.13.0", + "@typescript-eslint/visitor-keys": "6.13.0", "debug": "^4.3.4" }, "engines": { @@ -2459,6 +2459,80 @@ } } }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.0.tgz", + "integrity": "sha512-2x0K2/CujsokIv+LN2T0l5FVDMtsCjkUyYtlcY4xxnxLAW+x41LXr16duoicHpGtLhmtN7kqvuFJ3zbz00Ikhw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.13.0", + "@typescript-eslint/visitor-keys": "6.13.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.0.tgz", + "integrity": "sha512-oXg7DFxx/GmTrKXKKLSoR2rwiutOC7jCQ5nDH5p5VS6cmHE1TcPTaYQ0VPSSUvj7BnNqCgQ/NXcTBxn59pfPTQ==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.0.tgz", + "integrity": "sha512-IT4O/YKJDoiy/mPEDsfOfp+473A9GVqXlBKckfrAOuVbTqM8xbc0LuqyFCcgeFWpqu3WjQexolgqN2CuWBYbog==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.13.0", + "@typescript-eslint/visitor-keys": "6.13.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.0.tgz", + "integrity": "sha512-UQklteCEMCRoq/1UhKFZsHv5E4dN1wQSzJoxTfABasWk1HgJRdg1xNUve/Kv/Sdymt4x+iEzpESOqRFlQr/9Aw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.13.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typescript-eslint/scope-manager": { "version": "6.12.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.12.0.tgz", From 0b8a71a4c021870b14ed6b823e050843cba96075 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Nov 2023 12:15:49 +0000 Subject: [PATCH 49/75] Bump @typescript-eslint/parser from 6.13.0 to 6.13.1 Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.13.0 to 6.13.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.13.1/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 122 +++++++++------------------------------------- 1 file changed, 24 insertions(+), 98 deletions(-) diff --git a/package-lock.json b/package-lock.json index 52e3b0a1f..cd5f3c667 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2479,15 +2479,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.13.0.tgz", - "integrity": "sha512-VpG+M7GNhHLI/aTDctqAV0XbzB16vf+qDX9DXuMZSe/0bahzDA9AKZB15NDbd+D9M4cDsJvfkbGOA7qiZ/bWJw==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.13.1.tgz", + "integrity": "sha512-fs2XOhWCzRhqMmQf0eicLa/CWSaYss2feXsy7xBD/pLyWke/jCIVc2s1ikEAtSW7ina1HNhv7kONoEfVNEcdDQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.13.0", - "@typescript-eslint/types": "6.13.0", - "@typescript-eslint/typescript-estree": "6.13.0", - "@typescript-eslint/visitor-keys": "6.13.0", + "@typescript-eslint/scope-manager": "6.13.1", + "@typescript-eslint/types": "6.13.1", + "@typescript-eslint/typescript-estree": "6.13.1", + "@typescript-eslint/visitor-keys": "6.13.1", "debug": "^4.3.4" }, "engines": { @@ -2506,88 +2506,14 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.0.tgz", - "integrity": "sha512-2x0K2/CujsokIv+LN2T0l5FVDMtsCjkUyYtlcY4xxnxLAW+x41LXr16duoicHpGtLhmtN7kqvuFJ3zbz00Ikhw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.13.0", - "@typescript-eslint/visitor-keys": "6.13.0" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.0.tgz", - "integrity": "sha512-oXg7DFxx/GmTrKXKKLSoR2rwiutOC7jCQ5nDH5p5VS6cmHE1TcPTaYQ0VPSSUvj7BnNqCgQ/NXcTBxn59pfPTQ==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.0.tgz", - "integrity": "sha512-IT4O/YKJDoiy/mPEDsfOfp+473A9GVqXlBKckfrAOuVbTqM8xbc0LuqyFCcgeFWpqu3WjQexolgqN2CuWBYbog==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.13.0", - "@typescript-eslint/visitor-keys": "6.13.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.0.tgz", - "integrity": "sha512-UQklteCEMCRoq/1UhKFZsHv5E4dN1wQSzJoxTfABasWk1HgJRdg1xNUve/Kv/Sdymt4x+iEzpESOqRFlQr/9Aw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.13.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.12.0.tgz", - "integrity": "sha512-5gUvjg+XdSj8pcetdL9eXJzQNTl3RD7LgUiYTl8Aabdi8hFkaGSYnaS6BLc0BGNaDH+tVzVwmKtWvu0jLgWVbw==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.1.tgz", + "integrity": "sha512-BW0kJ7ceiKi56GbT2KKzZzN+nDxzQK2DS6x0PiSMPjciPgd/JRQGMibyaN2cPt2cAvuoH0oNvn2fwonHI+4QUQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.12.0", - "@typescript-eslint/visitor-keys": "6.12.0" + "@typescript-eslint/types": "6.13.1", + "@typescript-eslint/visitor-keys": "6.13.1" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2682,9 +2608,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.12.0.tgz", - "integrity": "sha512-MA16p/+WxM5JG/F3RTpRIcuOghWO30//VEOvzubM8zuOOBYXsP+IfjoCXXiIfy2Ta8FRh9+IO9QLlaFQUU+10Q==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.1.tgz", + "integrity": "sha512-gjeEskSmiEKKFIbnhDXUyiqVma1gRCQNbVZ1C8q7Zjcxh3WZMbzWVfGE9rHfWd1msQtPS0BVD9Jz9jded44eKg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2695,13 +2621,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.12.0.tgz", - "integrity": "sha512-vw9E2P9+3UUWzhgjyyVczLWxZ3GuQNT7QpnIY3o5OMeLO/c8oHljGc8ZpryBMIyympiAAaKgw9e5Hl9dCWFOYw==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.1.tgz", + "integrity": "sha512-sBLQsvOC0Q7LGcUHO5qpG1HxRgePbT6wwqOiGLpR8uOJvPJbfs0mW3jPA3ujsDvfiVwVlWUDESNXv44KtINkUQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.12.0", - "@typescript-eslint/visitor-keys": "6.12.0", + "@typescript-eslint/types": "6.13.1", + "@typescript-eslint/visitor-keys": "6.13.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -2821,12 +2747,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.12.0.tgz", - "integrity": "sha512-rg3BizTZHF1k3ipn8gfrzDXXSFKyOEB5zxYXInQ6z0hUvmQlhaZQzK+YmHmNViMA9HzW5Q9+bPPt90bU6GQwyw==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.1.tgz", + "integrity": "sha512-NDhQUy2tg6XGNBGDRm1XybOHSia8mcXmlbKWoQP+nm1BIIMxa55shyJfZkHpEBN62KNPLrocSM2PdPcaLgDKMQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/types": "6.13.1", "eslint-visitor-keys": "^3.4.1" }, "engines": { From ba98594a95017c0061707c7fcdb3a095b4cb2ac3 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 28 Nov 2023 08:28:06 -0800 Subject: [PATCH 50/75] Fixed testCollision return values --- .../pixi/core/interaction/render-flags.d.ts | 10 +- .../pixi/core/shapes/source-polygon.d.ts | 481 +++++++++--------- .../pixi/perception/clockwise-sweep.d.ts | 5 +- .../pixi/perception/clockwise-sweep.test-d.ts | 4 +- 4 files changed, 259 insertions(+), 241 deletions(-) diff --git a/src/foundry/client/pixi/core/interaction/render-flags.d.ts b/src/foundry/client/pixi/core/interaction/render-flags.d.ts index 3c69ded1d..ed9792803 100644 --- a/src/foundry/client/pixi/core/interaction/render-flags.d.ts +++ b/src/foundry/client/pixi/core/interaction/render-flags.d.ts @@ -23,11 +23,13 @@ declare global { config?: { /** The object which owns this RenderFlags instance */ object?: RenderFlagObject; + /** - * The ticker priority at which these render flags are handled - * (default: `PIXI.UPDATE_PRIORITY.OBJECTS`) + * The update priority when these render flags are applied. + * Valid options are OBJECTS or PERCEPTION. + * @defaultValue `PIXI.UPDATE_PRIORITY.OBJECTS` */ - priority?: number; + priority?: "OBJECT" | "PERCEPTION"; }, ); @@ -58,7 +60,7 @@ declare global { * @param Base - The base class being mixed * @returns The mixed class definition */ - class RenderFlagObject extends PIXI.DisplayObject { + class RenderFlagObject { constructor(...args: any[]); /** diff --git a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts index 37bf82602..f5413d75a 100644 --- a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts +++ b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts @@ -1,236 +1,247 @@ -interface PointSourcePolygonConfig { - /** The type of polygon being computed */ - type?: foundry.CONST.WALL_RESTRICTION_TYPES; - - /** The angle of emission, if limited */ - angle?: number; - - /** The desired density of padding rays, a number per PI */ - density?: number; - - /** A limited radius of the resulting polygon */ - radius?: number; - - /** The direction of facing, required if the angle is limited */ - rotation?: number; - - /** Customize how wall direction of one-way walls is applied */ - wallDirectionMode?: number; - - /** Compute the polygon with threshold wall constraints applied */ - useThreshold?: boolean; - - /** Display debugging visualization and logging for the polygon */ - debug?: boolean; - - /** The object (if any) that spawned this polygon. */ - source?: PointSource; - - /** Limiting polygon boundary shapes */ - boundaryShapes?: Array; - - /** Does this polygon use the Scene inner or outer bounding rectangle */ - readonly useInnerBounds?: boolean; - - /** Does this polygon have a limited radius? */ - readonly hasLimitedRadius?: boolean; - - /** Does this polygon have a limited angle? */ - readonly hasLimitedAngle?: boolean; - - /** The computed bounding box for the polygon */ - readonly boundingBox?: PIXI.Rectangle; -} - -/** - * An extension of the default PIXI.Polygon which is used to represent the line of sight for a point source. - */ -declare abstract class PointSourcePolygon extends PIXI.Polygon { - /** - * Customize how wall direction of one-way walls is applied - */ - static readonly WALL_DIRECTION_MODES: Readonly<{ - NORMAL: 0; - REVERSED: 1; - BOTH: 2; - }>; - - /** - * The rectangular bounds of this polygon - * @defaultValue `new PIXI.Rectangle(0, 0, 0, 0)` - */ - bounds: PIXI.Rectangle; - - /** - * The origin point of the source polygon. - */ - origin: Point; - - /** - * The configuration of this polygon. - * @defaultValue `{}` - */ - config: PointSourcePolygonConfig; - - /** - * An indicator for whether this polygon is constrained by some boundary shape? - */ - get isConstrained(): boolean; - - /** - * Benchmark the performance of polygon computation for this source - * @param iterations - The number of test iterations to perform - * @param origin - The origin point to benchmark - * @param config - The polygon configuration to benchmark - */ - static benchmark( - iterations: number, - origin: Point, - config: PointSourcePolygonConfig, - ): ReturnType; - - /** - * Compute the polygon given a point origin and radius - * @param origin - The origin source point - * @param config - Configuration options which customize the polygon computation - * (default: `{}`) - * @returns The computed polygon instance - */ - static create( - origin: Point, - config?: Parameters[1] | undefined, - ): ReturnType; - - /** - * Create a clone of this polygon. - * This overrides the default PIXI.Polygon#clone behavior. - * @returns A cloned instance - */ - override clone(): PointSourcePolygon; - - /** - * Compute the polygon using the origin and configuration options. - * @returns The computed polygon - */ - compute(): this; - - /** - * Perform the implementation-specific computation - */ - protected abstract _compute(): void; - - /** - * Customize the provided configuration object for this polygon type. - * @param origin - The provided polygon origin - * @param config - The provided configuration object - */ - initialize(origin: Point, config: PointSourcePolygonConfig): void; - - /** - * Get the super-set of walls which could potentially apply to this polygon. - * Define a custom collision test used by the Quadtree to obtain candidate Walls. - */ - protected _getWalls(): Set; - - /** - * Test whether a wall should be included in the computed polygon for a given origin and type - * @param wall - The Wall being considered - * @param bounds - The overall bounding box - * @returns Should the wall be included? - */ - protected _testWallInclusion(wall: Wall, bounds: PIXI.Rectangle): boolean; - - /** - * Compute the aggregate bounding box which is the intersection of all boundary shapes. - * Round and pad the resulting rectangle by 1 pixel to ensure it always contains the origin. - */ - protected _defineBoundingBox(): PIXI.Rectangle; - - /** - * Apply a constraining boundary shape to an existing PointSourcePolygon. - * Return a new instance of the polygon with the constraint applied. - * The new instance is only a "shallow clone", as it shares references to component properties with the original. - * @param constraint - The constraining boundary shape - * @param intersectionOptions - Options passed to the shape intersection method - * @returns A new constrained polygon - */ - applyConstraint( - constraint: PIXI.Circle | PIXI.Rectangle | PIXI.Polygon, - intersectionOptions?: Record, - ): PointSourcePolygon; - - /** {@inheritDoc} */ - contains(x: number, y: number): boolean; - - /** - * Constrain polygon points by applying boundary shapes. - */ - protected _constrainBoundaryShapes(): void; - - /** - * Test whether a Ray between the origin and destination points would collide with a boundary of this Polygon. - * A valid wall restriction type is compulsory and must be passed into the config options. - * @param origin - An origin point - * @param destination - A destination point - * @param config - The configuration that defines a certain Polygon type - * @param mode - The collision mode to test: "any", "all", or "closest" - * (default: "all") - * @returns The collision result depends on the mode of the test: - * * any: returns a boolean for whether any collision occurred - * * all: returns a sorted array of PolygonVertex instances - * * closest: returns a PolygonVertex instance or null - */ - static testCollision( - origin: Point, - destination: Point, - { - mode, - ...config - }: { - /** - * The collision mode to test: "any", "all", or "closest" - * (default: "all") - */ - mode?: string; - - /** The configuration that defines a certain Polygon type */ - config?: PointSourcePolygonConfig; - }, - ): boolean | PolygonVertex | PolygonVertex[] | null; - - /** - * Determine the set of collisions which occurs for a Ray. - * @param ray - The Ray to test - * @param mode - The collision mode being tested - * @returns The collision test result - */ - protected abstract _testCollision(ray: Ray, mode: string): boolean | PolygonVertex | PolygonVertex[] | null; - - /** - * Visualize the polygon, displaying its computed area, rays, and collision points - * @returns The rendered debugging shape - */ - visualize(): PIXI.Graphics | undefined; - - /** - * Determine if the shape is a complete circle. - * The config object must have an angle and a radius properties. - */ - isCompleteCircle(): boolean; - - /** - * Augment a PointSourcePolygon by adding additional coverage for shapes permitted by threshold walls. - * @param polygon - The computed polygon - * @returns The augmented polygon - */ - static applyThresholdAttenuation(polygon: PointSourcePolygon): PointSourcePolygon; - - /** - * @deprecated since v11, will be removed in v13 - * @remarks You are referencing PointSourcePolygon#rays which is no longer a required property of that interface. - * If your subclass uses the rays property it should be explicitly defined by the subclass which requires it. - */ - get rays(): Ray[]; - - set rays(rays); +export {}; + +declare global { + interface PointSourcePolygonConfig { + /** The type of polygon being computed */ + type?: foundry.CONST.WALL_RESTRICTION_TYPES; + + /** The angle of emission, if limited */ + angle?: number; + + /** The desired density of padding rays, a number per PI */ + density?: number; + + /** A limited radius of the resulting polygon */ + radius?: number; + + /** The direction of facing, required if the angle is limited */ + rotation?: number; + + /** Customize how wall direction of one-way walls is applied */ + wallDirectionMode?: number; + + /** Compute the polygon with threshold wall constraints applied */ + useThreshold?: boolean; + + /** Display debugging visualization and logging for the polygon */ + debug?: boolean; + + /** The object (if any) that spawned this polygon. */ + source?: PointSource; + + /** Limiting polygon boundary shapes */ + boundaryShapes?: Array; + + /** Does this polygon use the Scene inner or outer bounding rectangle */ + readonly useInnerBounds?: boolean; + + /** Does this polygon have a limited radius? */ + readonly hasLimitedRadius?: boolean; + + /** Does this polygon have a limited angle? */ + readonly hasLimitedAngle?: boolean; + + /** The computed bounding box for the polygon */ + readonly boundingBox?: PIXI.Rectangle; + } + + /** + * An extension of the default PIXI.Polygon which is used to represent the line of sight for a point source. + */ + abstract class PointSourcePolygon extends PIXI.Polygon { + /** + * Customize how wall direction of one-way walls is applied + */ + static readonly WALL_DIRECTION_MODES: Readonly<{ + NORMAL: 0; + REVERSED: 1; + BOTH: 2; + }>; + + /** + * The rectangular bounds of this polygon + * @defaultValue `new PIXI.Rectangle(0, 0, 0, 0)` + */ + bounds: PIXI.Rectangle; + + /** + * The origin point of the source polygon. + */ + origin: Point; + + /** + * The configuration of this polygon. + * @defaultValue `{}` + */ + config: PointSourcePolygonConfig; + + /** + * An indicator for whether this polygon is constrained by some boundary shape? + */ + get isConstrained(): boolean; + + /** + * Benchmark the performance of polygon computation for this source + * @param iterations - The number of test iterations to perform + * @param origin - The origin point to benchmark + * @param config - The polygon configuration to benchmark + */ + static benchmark( + iterations: number, + origin: Point, + config: PointSourcePolygonConfig, + ): ReturnType; + + /** + * Compute the polygon given a point origin and radius + * @param origin - The origin source point + * @param config - Configuration options which customize the polygon computation + * (default: `{}`) + * @returns The computed polygon instance + */ + static create( + origin: Point, + config?: Parameters[1] | undefined, + ): ReturnType; + + /** + * Create a clone of this polygon. + * This overrides the default PIXI.Polygon#clone behavior. + * @returns A cloned instance + */ + override clone(): PointSourcePolygon; + + /** + * Compute the polygon using the origin and configuration options. + * @returns The computed polygon + */ + compute(): this; + + /** + * Perform the implementation-specific computation + */ + protected abstract _compute(): void; + + /** + * Customize the provided configuration object for this polygon type. + * @param origin - The provided polygon origin + * @param config - The provided configuration object + */ + initialize(origin: Point, config: PointSourcePolygonConfig): void; + + /** + * Get the super-set of walls which could potentially apply to this polygon. + * Define a custom collision test used by the Quadtree to obtain candidate Walls. + */ + protected _getWalls(): Set; + + /** + * Test whether a wall should be included in the computed polygon for a given origin and type + * @param wall - The Wall being considered + * @param bounds - The overall bounding box + * @returns Should the wall be included? + */ + protected _testWallInclusion(wall: Wall, bounds: PIXI.Rectangle): boolean; + + /** + * Compute the aggregate bounding box which is the intersection of all boundary shapes. + * Round and pad the resulting rectangle by 1 pixel to ensure it always contains the origin. + */ + protected _defineBoundingBox(): PIXI.Rectangle; + + /** + * Apply a constraining boundary shape to an existing PointSourcePolygon. + * Return a new instance of the polygon with the constraint applied. + * The new instance is only a "shallow clone", as it shares references to component properties with the original. + * @param constraint - The constraining boundary shape + * @param intersectionOptions - Options passed to the shape intersection method + * @returns A new constrained polygon + */ + applyConstraint( + constraint: PIXI.Circle | PIXI.Rectangle | PIXI.Polygon, + intersectionOptions?: Record, + ): PointSourcePolygon; + + /** {@inheritDoc} */ + contains(x: number, y: number): boolean; + + /** + * Constrain polygon points by applying boundary shapes. + */ + protected _constrainBoundaryShapes(): void; + + /** + * Test whether a Ray between the origin and destination points would collide with a boundary of this Polygon. + * A valid wall restriction type is compulsory and must be passed into the config options. + * @param origin - An origin point + * @param destination - A destination point + * @param config - The configuration that defines a certain Polygon type + * @param mode - The collision mode to test: "any", "all", or "closest" + * (default: "all") + * @returns The collision result depends on the mode of the test: + * * any: returns a boolean for whether any collision occurred + * * all: returns a sorted array of PolygonVertex instances + * * closest: returns a PolygonVertex instance or null + */ + static testCollision( + origin: Point, + destination: Point, + { + mode, + ...config + }: { + /** + * The collision mode to test: "any", "all", or "closest" + * (default: "all") + */ + mode?: Mode; + + /** The configuration that defines a certain Polygon type */ + config?: PointSourcePolygonConfig; + }, + ): Mode extends "any" ? boolean : Mode extends "closest" ? PolygonVertex : PolygonVertex[] | null; + + /** + * Determine the set of collisions which occurs for a Ray. + * @param ray - The Ray to test + * @param mode - The collision mode being tested + * @returns The collision test result + */ + protected abstract _testCollision( + ray: Ray, + mode: Mode, + ): Mode extends "any" ? boolean : Mode extends "closest" ? PolygonVertex : PolygonVertex[] | null; + + /** + * Visualize the polygon, displaying its computed area, rays, and collision points + * @returns The rendered debugging shape + */ + visualize(): PIXI.Graphics | undefined; + + /** + * Determine if the shape is a complete circle. + * The config object must have an angle and a radius properties. + */ + isCompleteCircle(): boolean; + + /** + * Augment a PointSourcePolygon by adding additional coverage for shapes permitted by threshold walls. + * @param polygon - The computed polygon + * @returns The augmented polygon + */ + static applyThresholdAttenuation(polygon: PointSourcePolygon): PointSourcePolygon; + + /** + * @deprecated since v11, will be removed in v13 + * @remarks You are referencing PointSourcePolygon#rays which is no longer a required property of that interface. + * If your subclass uses the rays property it should be explicitly defined by the subclass which requires it. + */ + get rays(): Ray[]; + + set rays(rays); + } + + namespace PointSourcePolygon { + type CollisionModes = "any" | "all" | "closest"; + } } diff --git a/src/foundry/client/pixi/perception/clockwise-sweep.d.ts b/src/foundry/client/pixi/perception/clockwise-sweep.d.ts index 89c37868e..9f281ebc3 100644 --- a/src/foundry/client/pixi/perception/clockwise-sweep.d.ts +++ b/src/foundry/client/pixi/perception/clockwise-sweep.d.ts @@ -151,7 +151,10 @@ declare global { * @param mode - The collision mode being tested * @returns The collision test result */ - protected override _testCollision(ray: Ray, mode: string): boolean | PolygonVertex | PolygonVertex[] | null; + protected override _testCollision( + ray: Ray, + mode: Mode, + ): Mode extends "any" ? boolean : Mode extends "closest" ? PolygonVertex : PolygonVertex[] | null; override visualize(): PIXI.Graphics | undefined; diff --git a/tests/foundry/client/pixi/perception/clockwise-sweep.test-d.ts b/tests/foundry/client/pixi/perception/clockwise-sweep.test-d.ts index 766123dc2..434e5db25 100644 --- a/tests/foundry/client/pixi/perception/clockwise-sweep.test-d.ts +++ b/tests/foundry/client/pixi/perception/clockwise-sweep.test-d.ts @@ -6,4 +6,6 @@ const pointB = new Point(0, 0); expectTypeOf(ClockwiseSweepPolygon.testCollision(pointA, pointB, { mode: "any" })).toEqualTypeOf(); expectTypeOf(ClockwiseSweepPolygon.testCollision(pointA, pointB, { mode: "closest" })).toEqualTypeOf(); -expectTypeOf(ClockwiseSweepPolygon.testCollision(pointA, pointB, { mode: "all" })).toEqualTypeOf(); +expectTypeOf(ClockwiseSweepPolygon.testCollision(pointA, pointB, { mode: "all" })).toEqualTypeOf< + PolygonVertex[] | null +>(); From 7de42976cb39b32310c04020fbe1bc0e3883f2fb Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 28 Nov 2023 10:08:49 -0800 Subject: [PATCH 51/75] Graphics typefix --- src/foundry/client/pixi/core/interaction/control-icon.d.ts | 2 +- src/types/augments/pixiLegacyGraphics.d.ts | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/foundry/client/pixi/core/interaction/control-icon.d.ts b/src/foundry/client/pixi/core/interaction/control-icon.d.ts index 006139c31..0107956e3 100644 --- a/src/foundry/client/pixi/core/interaction/control-icon.d.ts +++ b/src/foundry/client/pixi/core/interaction/control-icon.d.ts @@ -35,7 +35,7 @@ declare class ControlIcon extends PIXI.Container { /** * @defaultValue `static` */ - eventMode: string; + eventMode: "static"; /** * @defaultValue `false` diff --git a/src/types/augments/pixiLegacyGraphics.d.ts b/src/types/augments/pixiLegacyGraphics.d.ts index 3c45b87ee..25ed23d5f 100644 --- a/src/types/augments/pixiLegacyGraphics.d.ts +++ b/src/types/augments/pixiLegacyGraphics.d.ts @@ -1,8 +1,7 @@ declare global { namespace PIXI { - export const LegacyGraphics: typeof PIXI.Graphics & { - nextRoundedRectBehavior: boolean; - }; + export const LegacyGraphics: typeof PIXI.Graphics; + export const Graphics: typeof PIXI.smooth.SmoothGraphics; } } From 628614d67c87aa9a877a977167e1b27d6c57e2fb Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 28 Nov 2023 10:10:45 -0800 Subject: [PATCH 52/75] Event changeout --- src/foundry/client/pixi/board.d.ts | 26 +++++++++---------- src/foundry/client/pixi/layers/controls.d.ts | 2 +- .../client/pixi/layers/controls/door.d.ts | 8 +++--- .../client/pixi/layers/controls/ruler.d.ts | 10 +++---- src/foundry/client/pixi/layers/drawings.d.ts | 12 ++++----- src/foundry/client/pixi/layers/lighting.d.ts | 4 +-- src/foundry/client/pixi/layers/map.d.ts | 6 ++--- src/foundry/client/pixi/layers/notes.d.ts | 2 +- src/foundry/client/pixi/layers/sounds.d.ts | 8 +++--- src/foundry/client/pixi/layers/templates.d.ts | 4 +-- src/foundry/client/pixi/layers/tokens.d.ts | 2 +- src/foundry/client/pixi/layers/walls.d.ts | 8 +++--- src/foundry/client/pixi/placeables.d.ts | 12 ++++----- .../client/pixi/placeables/drawing.d.ts | 22 ++++++++-------- src/foundry/client/pixi/placeables/light.d.ts | 6 ++--- src/foundry/client/pixi/placeables/note.d.ts | 6 ++--- src/foundry/client/pixi/placeables/sound.d.ts | 4 +-- src/foundry/client/pixi/placeables/tile.d.ts | 20 +++++++------- src/foundry/client/pixi/placeables/token.d.ts | 26 +++++++++---------- src/foundry/client/pixi/placeables/wall.d.ts | 18 ++++++------- 20 files changed, 103 insertions(+), 103 deletions(-) diff --git a/src/foundry/client/pixi/board.d.ts b/src/foundry/client/pixi/board.d.ts index 507b2a4c3..350c4a704 100644 --- a/src/foundry/client/pixi/board.d.ts +++ b/src/foundry/client/pixi/board.d.ts @@ -173,7 +173,7 @@ declare global { * A debounced function which tracks movements of the mouse on the game canvas. * @defaultValue `foundry.utils.debounce(this._onMouseMove.bind(this), this.#mouseMoveDebounceMS)` */ - #debounceMouseMove: (event: PIXI.InteractionEvent) => void; + #debounceMouseMove: (event: PIXI.FederatedEvent) => void; /** * The singleton PIXI.Application instance rendered on the Canvas. @@ -574,19 +574,19 @@ declare global { * Handle mouse movement on the game canvas. * This handler fires on both a throttle and a debounce, ensuring that the final update is always recorded. */ - protected _onMouseMove(event: PIXI.InteractionEvent): void; + protected _onMouseMove(event: PIXI.FederatedEvent): void; /** * Handle left mouse-click events occurring on the Canvas. * @see {@link MouseInteractionManager#_handleClickLeft} */ - protected _onClickLeft(event: PIXI.InteractionEvent): void; + protected _onClickLeft(event: PIXI.FederatedEvent): void; /** * Handle double left-click events occurring on the Canvas stage. * @see {@link MouseInteractionManager#_handleClickLeft2} */ - protected _onClickLeft2(event: PIXI.InteractionEvent): void; + protected _onClickLeft2(event: PIXI.FederatedEvent): void; /** * Handle long press events occurring on the Canvas. @@ -594,21 +594,21 @@ declare global { * @param event - The triggering canvas interaction event. * @param origin - The local canvas coordinates of the mousepress. */ - protected _onLongPress(event: PIXI.InteractionEvent, origin: PIXI.Point): void; + protected _onLongPress(event: PIXI.FederatedEvent, origin: PIXI.Point): void; /** * Handle the beginning of a left-mouse drag workflow on the Canvas stage or its active Layer. * @see {@link MouseInteractionManager#_handleDragStart} * @internal */ - protected _onDragLeftStart(event: PIXI.InteractionEvent): void; + protected _onDragLeftStart(event: PIXI.FederatedEvent): void; /** * Handle mouse movement events occurring on the Canvas. * @see {@link MouseInteractionManager#_handleDragMove} * @internal */ - protected _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected _onDragLeftMove(event: PIXI.FederatedEvent): void; /** * Handle the conclusion of a left-mouse drag workflow when the mouse button is released. @@ -616,7 +616,7 @@ declare global { * @internal */ protected _onDragLeftDrop( - event: PIXI.InteractionEvent, + event: PIXI.FederatedEvent, ): ReturnType["selectObjects"]> | ReturnType | void; /** @@ -630,31 +630,31 @@ declare global { * Handle right mouse-click events occurring on the Canvas stage or it's active layer * @see {@link MouseInteractionManager#_handleClickRight} */ - protected _onClickRight(event: PIXI.InteractionEvent): void; + protected _onClickRight(event: PIXI.FederatedEvent): void; /** * Handle double right-click events occurring on the Canvas. * @see {@link MouseInteractionManager#_handleClickRight} * @internal */ - protected _onClickRight2(event: PIXI.InteractionEvent): void; + protected _onClickRight2(event: PIXI.FederatedEvent): void; /** * Handle right-mouse drag events occurring on the Canvas. * @see {@link MouseInteractionManager#_handleDragMove} */ - protected _onDragRightMove(event: PIXI.InteractionEvent): void; + protected _onDragRightMove(event: PIXI.FederatedEvent): void; /** * Handle the conclusion of a right-mouse drag workflow the Canvas stage. * @see {@link MouseInteractionManager#_handleDragDrop} */ - protected _onDragRightDrop(event: PIXI.InteractionEvent): void; + protected _onDragRightDrop(event: PIXI.FederatedEvent): void; /** * Determine selection coordinate rectangle during a mouse-drag workflow */ - protected _onDragSelect(event: PIXI.InteractionEvent): void; + protected _onDragSelect(event: PIXI.FederatedEvent): void; /** * Pan the canvas view when the cursor position gets close to the edge of the frame diff --git a/src/foundry/client/pixi/layers/controls.d.ts b/src/foundry/client/pixi/layers/controls.d.ts index f1fa3b3bc..edc166818 100644 --- a/src/foundry/client/pixi/layers/controls.d.ts +++ b/src/foundry/client/pixi/layers/controls.d.ts @@ -111,7 +111,7 @@ declare global { /** * Handle mousemove events on the game canvas to broadcast activity of the user's cursor position */ - protected _onMoveCursor(event: PIXI.InteractionEvent): void; + protected _onMoveCursor(event: PIXI.FederatedEvent): void; /** * Create and draw the Cursor object for a given User diff --git a/src/foundry/client/pixi/layers/controls/door.d.ts b/src/foundry/client/pixi/layers/controls/door.d.ts index b590feb43..393560b52 100644 --- a/src/foundry/client/pixi/layers/controls/door.d.ts +++ b/src/foundry/client/pixi/layers/controls/door.d.ts @@ -38,13 +38,13 @@ declare global { * Handle mouse over events on a door control icon. * @param event - The originating interaction event */ - protected _onMouseOver(event: PIXI.InteractionEvent): false | void; + protected _onMouseOver(event: PIXI.FederatedEvent): false | void; /** * Handle mouse out events on a door control icon. * @param event - The originating interaction event */ - protected _onMouseOut(event: PIXI.InteractionEvent): false | void; + protected _onMouseOut(event: PIXI.FederatedEvent): false | void; /** * Handle left mouse down events on a door control icon. @@ -52,7 +52,7 @@ declare global { * @param event - The originating interaction event */ protected _onMouseDown( - event: PIXI.InteractionEvent, + event: PIXI.FederatedEvent, ): false | void | Promise> | undefined>; /** @@ -61,7 +61,7 @@ declare global { * @param event - The originating interaction event */ protected _onRightDown( - event: PIXI.InteractionEvent, + event: PIXI.FederatedEvent, ): void | Promise> | undefined>; } } diff --git a/src/foundry/client/pixi/layers/controls/ruler.d.ts b/src/foundry/client/pixi/layers/controls/ruler.d.ts index b7a02e429..31277cfbe 100644 --- a/src/foundry/client/pixi/layers/controls/ruler.d.ts +++ b/src/foundry/client/pixi/layers/controls/ruler.d.ts @@ -141,31 +141,31 @@ declare global { * Handle the beginning of a new Ruler measurement workflow * @see Canvas._onDragLeftStart */ - protected _onDragStart(event: PIXI.InteractionEvent): void; + protected _onDragStart(event: PIXI.FederatedEvent): void; /** * Handle left-click events on the Canvas during Ruler measurement. * @see Canvas._onClickLeft */ - protected _onClickLeft(event: PIXI.InteractionEvent): void; + protected _onClickLeft(event: PIXI.FederatedEvent): void; /** * Handle right-click events on the Canvas during Ruler measurement. * @see Canvas._onClickRight */ - protected _onClickRight(event: PIXI.InteractionEvent): boolean | void; + protected _onClickRight(event: PIXI.FederatedEvent): boolean | void; /** * Continue a Ruler measurement workflow for left-mouse movements on the Canvas. * @see Canvas._onDragLeftMove */ - protected _onMouseMove(event: PIXI.InteractionEvent): void; + protected _onMouseMove(event: PIXI.FederatedEvent): void; /** * Conclude a Ruler measurement workflow by releasing the left-mouse button. * @see Canvas._onDragLeftDrop */ - protected _onMouseUp(event: PIXI.InteractionEvent): void; + protected _onMouseUp(event: PIXI.FederatedEvent): void; /** * Handle the addition of a new waypoint in the Ruler measurement path diff --git a/src/foundry/client/pixi/layers/drawings.d.ts b/src/foundry/client/pixi/layers/drawings.d.ts index 9bc834b26..62e7898da 100644 --- a/src/foundry/client/pixi/layers/drawings.d.ts +++ b/src/foundry/client/pixi/layers/drawings.d.ts @@ -56,22 +56,22 @@ declare class DrawingsLayer extends PlaceablesLayer<"Drawing", DrawingsLayer.Lay */ _getNewDrawingData(origin: Point | {}): NewDrawingData; - protected override _onClickLeft(event: PIXI.InteractionEvent): void; + protected override _onClickLeft(event: PIXI.FederatedEvent): void; - protected override _onClickLeft2(event: PIXI.InteractionEvent): void | Promise; + protected override _onClickLeft2(event: PIXI.FederatedEvent): void | Promise; - protected override _onDragLeftStart(event: PIXI.InteractionEvent): ReturnType; + protected override _onDragLeftStart(event: PIXI.FederatedEvent): ReturnType; - protected override _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected override _onDragLeftMove(event: PIXI.FederatedEvent): void; /** * Handling of mouse-up events which conclude a new object creation after dragging */ - protected _onDragLeftDrop(event: PIXI.InteractionEvent): Promise; + protected _onDragLeftDrop(event: PIXI.FederatedEvent): Promise; protected override _onDragLeftCancel(event: PointerEvent): void; - protected override _onClickRight(event: PIXI.InteractionEvent): void; + protected override _onClickRight(event: PIXI.FederatedEvent): void; } declare namespace DrawingsLayer { diff --git a/src/foundry/client/pixi/layers/lighting.d.ts b/src/foundry/client/pixi/layers/lighting.d.ts index 8d08268d6..f503d8320 100644 --- a/src/foundry/client/pixi/layers/lighting.d.ts +++ b/src/foundry/client/pixi/layers/lighting.d.ts @@ -204,9 +204,9 @@ declare class LightingLayer extends PlaceablesLayer<"AmbientLight", LightingLaye */ protected _onDarknessChange(darkness: number, prior: number): void; - protected override _onDragLeftStart(event: PIXI.InteractionEvent): Promise; + protected override _onDragLeftStart(event: PIXI.FederatedEvent): Promise; - protected override _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected override _onDragLeftMove(event: PIXI.FederatedEvent): void; protected override _onDragLeftCancel(event: PointerEvent): void; diff --git a/src/foundry/client/pixi/layers/map.d.ts b/src/foundry/client/pixi/layers/map.d.ts index 46dc28e95..602555b6e 100644 --- a/src/foundry/client/pixi/layers/map.d.ts +++ b/src/foundry/client/pixi/layers/map.d.ts @@ -87,11 +87,11 @@ declare global { */ protected _drawBackground(): PIXI.Sprite | undefined; - protected _onDragLeftStart(event: PIXI.InteractionEvent): Promise; + protected _onDragLeftStart(event: PIXI.FederatedEvent): Promise; - protected _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected _onDragLeftMove(event: PIXI.FederatedEvent): void; - protected _onDragLeftDrop(event: PIXI.InteractionEvent): void; + protected _onDragLeftDrop(event: PIXI.FederatedEvent): void; protected _onDragLeftCancel(event: PointerEvent): void; diff --git a/src/foundry/client/pixi/layers/notes.d.ts b/src/foundry/client/pixi/layers/notes.d.ts index 7bdfc574f..666c2baae 100644 --- a/src/foundry/client/pixi/layers/notes.d.ts +++ b/src/foundry/client/pixi/layers/notes.d.ts @@ -40,7 +40,7 @@ declare global { static registerSettings(): void; /** @remarks this method seems to be unused, see https://gitlab.com/foundrynet/foundryvtt/-/issues/7004 */ - protected _onMouseDown(event: PIXI.InteractionEvent): void; + protected _onMouseDown(event: PIXI.FederatedEvent): void; /** * Handle JournalEntry document drop data diff --git a/src/foundry/client/pixi/layers/sounds.d.ts b/src/foundry/client/pixi/layers/sounds.d.ts index 49365770c..a8bf2cd7c 100644 --- a/src/foundry/client/pixi/layers/sounds.d.ts +++ b/src/foundry/client/pixi/layers/sounds.d.ts @@ -86,13 +86,13 @@ declare class SoundsLayer extends PlaceablesLayer<"AmbientSound", SoundsLayer.La * Handle mouse cursor movements which may cause ambient audio previews to occur * @param event - The initiating mouse move interaction event */ - protected _onMouseMove(event: PIXI.InteractionEvent): void; + protected _onMouseMove(event: PIXI.FederatedEvent): void; - protected override _onDragLeftStart(event: PIXI.InteractionEvent): ReturnType; + protected override _onDragLeftStart(event: PIXI.FederatedEvent): ReturnType; - protected override _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected override _onDragLeftMove(event: PIXI.FederatedEvent): void; - protected override _onDragLeftDrop(event: PIXI.InteractionEvent): void; + protected override _onDragLeftDrop(event: PIXI.FederatedEvent): void; protected override _onDragLeftCancel(event: PointerEvent): void; diff --git a/src/foundry/client/pixi/layers/templates.d.ts b/src/foundry/client/pixi/layers/templates.d.ts index f879290e8..41269fc06 100644 --- a/src/foundry/client/pixi/layers/templates.d.ts +++ b/src/foundry/client/pixi/layers/templates.d.ts @@ -33,9 +33,9 @@ declare class TemplateLayer extends PlaceablesLayer<"MeasuredTemplate", Template */ static registerSettings(): void; - protected override _onDragLeftStart(event: PIXI.InteractionEvent): Promise; + protected override _onDragLeftStart(event: PIXI.FederatedEvent): Promise; - protected override _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected override _onDragLeftMove(event: PIXI.FederatedEvent): void; protected override _onMouseWheel(event: WheelEvent): void | ReturnType; } diff --git a/src/foundry/client/pixi/layers/tokens.d.ts b/src/foundry/client/pixi/layers/tokens.d.ts index 20fb7ce6f..dd6c37824 100644 --- a/src/foundry/client/pixi/layers/tokens.d.ts +++ b/src/foundry/client/pixi/layers/tokens.d.ts @@ -148,7 +148,7 @@ declare global { data: TokenLayer.DropData, ): Promise>>; - protected override _onClickLeft(event: PIXI.InteractionEvent): void; + protected override _onClickLeft(event: PIXI.FederatedEvent): void; } namespace TokenLayer { diff --git a/src/foundry/client/pixi/layers/walls.d.ts b/src/foundry/client/pixi/layers/walls.d.ts index ad9108b07..4dfcf4b66 100644 --- a/src/foundry/client/pixi/layers/walls.d.ts +++ b/src/foundry/client/pixi/layers/walls.d.ts @@ -182,15 +182,15 @@ declare global { } | this["_cloneType"]; - protected override _onDragLeftStart(event: PIXI.InteractionEvent): void; + protected override _onDragLeftStart(event: PIXI.FederatedEvent): void; - protected override _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected override _onDragLeftMove(event: PIXI.FederatedEvent): void; - protected override _onDragLeftDrop(event: PIXI.InteractionEvent): void; + protected override _onDragLeftDrop(event: PIXI.FederatedEvent): void; protected override _onDragLeftCancel(event: PointerEvent): void; - protected override _onClickRight(event: PIXI.InteractionEvent): void; + protected override _onClickRight(event: PIXI.FederatedEvent): void; /** @deprecated since v9 */ computePolygon( diff --git a/src/foundry/client/pixi/placeables.d.ts b/src/foundry/client/pixi/placeables.d.ts index e0756ec1c..0427e5cdb 100644 --- a/src/foundry/client/pixi/placeables.d.ts +++ b/src/foundry/client/pixi/placeables.d.ts @@ -311,31 +311,31 @@ declare global { * Handle left mouse-click events which originate from the Canvas stage and are dispatched to this Layer. * @see {@link Canvas#_onClickLeft} */ - protected _onClickLeft(event: PIXI.InteractionEvent): void; + protected _onClickLeft(event: PIXI.FederatedEvent): void; /** * Handle double left-click events which originate from the Canvas stage and are dispatched to this Layer. * @see {@link Canvas#_onClickLeft2} */ - protected _onClickLeft2(event: PIXI.InteractionEvent): void; + protected _onClickLeft2(event: PIXI.FederatedEvent): void; /** * Start a left-click drag workflow originating from the Canvas stage. * @see {@link Canvas#_onDragLeftStart} */ - protected _onDragLeftStart(event: PIXI.InteractionEvent): void; + protected _onDragLeftStart(event: PIXI.FederatedEvent): void; /** * Continue a left-click drag workflow originating from the Canvas stage. * @see {@link Canvas#_onDragLeftMove} */ - protected _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected _onDragLeftMove(event: PIXI.FederatedEvent): void; /** * Conclude a left-click drag workflow originating from the Canvas stage. * @see {@link Canvas#_onDragLeftDrop} */ - protected _onDragLeftDrop(event: PIXI.InteractionEvent): void; + protected _onDragLeftDrop(event: PIXI.FederatedEvent): void; /** * Cancel a left-click drag workflow originating from the Canvas stage. @@ -347,7 +347,7 @@ declare global { * Handle right mouse-click events which originate from the Canvas stage and are dispatched to this Layer. * @see {@link Canvas#_onClickRight} */ - protected _onClickRight(event: PIXI.InteractionEvent): void; + protected _onClickRight(event: PIXI.FederatedEvent): void; /** * Handle mouse-wheel events at the PlaceableObjects layer level to rotate multiple objects at once. diff --git a/src/foundry/client/pixi/placeables/drawing.d.ts b/src/foundry/client/pixi/placeables/drawing.d.ts index 6dd595e26..f3edfcea4 100644 --- a/src/foundry/client/pixi/placeables/drawing.d.ts +++ b/src/foundry/client/pixi/placeables/drawing.d.ts @@ -203,13 +203,13 @@ declare global { * Handle mouse movement which modifies the dimensions of the drawn shape * @internal */ - protected _onMouseDraw(event: PIXI.InteractionEvent): void; + protected _onMouseDraw(event: PIXI.FederatedEvent): void; - protected override _onDragLeftStart(event: PIXI.InteractionEvent): void; + protected override _onDragLeftStart(event: PIXI.FederatedEvent): void; - protected override _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected override _onDragLeftMove(event: PIXI.FederatedEvent): void; - protected override _onDragLeftDrop(event: PIXI.InteractionEvent): Promise; + protected override _onDragLeftDrop(event: PIXI.FederatedEvent): Promise; protected override _onDragLeftCancel(event: MouseEvent): void; @@ -218,34 +218,34 @@ declare global { * @param event - The mouseover event * @internal */ - protected _onHandleHoverIn(event: PIXI.InteractionEvent): void; + protected _onHandleHoverIn(event: PIXI.FederatedEvent): void; /** * Handle mouse-out event on a control handle * @param event - The mouseout event * @internal */ - protected _onHandleHoverOut(event: PIXI.InteractionEvent): void; + protected _onHandleHoverOut(event: PIXI.FederatedEvent): void; /** * When we start a drag event - create a preview copy of the Tile for re-positioning * @param event - The mousedown event * @internal */ - protected _onHandleMouseDown(event: PIXI.InteractionEvent): void; + protected _onHandleMouseDown(event: PIXI.FederatedEvent): void; /** * Handle the beginning of a drag event on a resize handle * @internal */ - protected _onHandleDragStart(event: PIXI.InteractionEvent): void; + protected _onHandleDragStart(event: PIXI.FederatedEvent): void; /** * Handle mousemove while dragging a tile scale handler * @param event - The mousemove event * @internal */ - protected _onHandleDragMove(event: PIXI.InteractionEvent): void; + protected _onHandleDragMove(event: PIXI.FederatedEvent): void; /** * Handle mouseup after dragging a tile scale handler @@ -253,14 +253,14 @@ declare global { * @internal */ protected _onHandleDragDrop( - event: PIXI.InteractionEvent, + event: PIXI.FederatedEvent, ): ReturnType>["update"]>; /** * Handle cancellation of a drag event for one of the resizing handles * @internal */ - protected _onHandleDragCancel(event: PIXI.InteractionEvent): void; + protected _onHandleDragCancel(event: PIXI.FederatedEvent): void; /** * Apply a vectorized rescaling transformation for the drawing data diff --git a/src/foundry/client/pixi/placeables/light.d.ts b/src/foundry/client/pixi/placeables/light.d.ts index 63b8df495..8d7a2b5c0 100644 --- a/src/foundry/client/pixi/placeables/light.d.ts +++ b/src/foundry/client/pixi/placeables/light.d.ts @@ -99,11 +99,11 @@ declare global { protected override _canConfigure(user: InstanceType>, event?: any): boolean; - protected override _onClickRight(event: PIXI.InteractionEvent): Promise; + protected override _onClickRight(event: PIXI.FederatedEvent): Promise; - protected override _onDragLeftStart(event: PIXI.InteractionEvent): void; + protected override _onDragLeftStart(event: PIXI.FederatedEvent): void; - protected override _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected override _onDragLeftMove(event: PIXI.FederatedEvent): void; protected override _onDragLeftCancel(event: MouseEvent): void; } diff --git a/src/foundry/client/pixi/placeables/note.d.ts b/src/foundry/client/pixi/placeables/note.d.ts index fd85e7360..d6ad6e0d3 100644 --- a/src/foundry/client/pixi/placeables/note.d.ts +++ b/src/foundry/client/pixi/placeables/note.d.ts @@ -58,10 +58,10 @@ declare global { protected override _canView(user: InstanceType>): boolean; - protected override _onHoverIn(event: PIXI.InteractionEvent, options?: HoverInOptions): false | void; + protected override _onHoverIn(event: PIXI.FederatedEvent, options?: HoverInOptions): false | void; - protected override _onHoverOut(event: PIXI.InteractionEvent): false | void; + protected override _onHoverOut(event: PIXI.FederatedEvent): false | void; - protected override _onClickLeft2(event: PIXI.InteractionEvent): void; + protected override _onClickLeft2(event: PIXI.FederatedEvent): void; } } diff --git a/src/foundry/client/pixi/placeables/sound.d.ts b/src/foundry/client/pixi/placeables/sound.d.ts index bf26765d3..8700547df 100644 --- a/src/foundry/client/pixi/placeables/sound.d.ts +++ b/src/foundry/client/pixi/placeables/sound.d.ts @@ -100,9 +100,9 @@ declare global { protected override _canConfigure(user: InstanceType>, event?: any): boolean; - protected override _onClickRight(event: PIXI.InteractionEvent): void; + protected override _onClickRight(event: PIXI.FederatedEvent): void; - protected override _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected override _onDragLeftMove(event: PIXI.FederatedEvent): void; } namespace AmbientSound { diff --git a/src/foundry/client/pixi/placeables/tile.d.ts b/src/foundry/client/pixi/placeables/tile.d.ts index 626a5f694..e63aed23f 100644 --- a/src/foundry/client/pixi/placeables/tile.d.ts +++ b/src/foundry/client/pixi/placeables/tile.d.ts @@ -208,13 +208,13 @@ declare global { protected override _canConfigure(user: User, event?: any): boolean; - protected override _onClickLeft2(event: PIXI.InteractionEvent): void; + protected override _onClickLeft2(event: PIXI.FederatedEvent): void; - protected override _onDragLeftStart(event: PIXI.InteractionEvent): void; + protected override _onDragLeftStart(event: PIXI.FederatedEvent): void; - protected override _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected override _onDragLeftMove(event: PIXI.FederatedEvent): void; - protected override _onDragLeftDrop(event: PIXI.InteractionEvent): Promise; + protected override _onDragLeftDrop(event: PIXI.FederatedEvent): Promise; protected override _onDragLeftCancel(event: MouseEvent): void; @@ -222,37 +222,37 @@ declare global { * Handle mouse-over event on a control handle * @param event - The mouseover event */ - protected _onHandleHoverIn(event: PIXI.InteractionEvent): void; + protected _onHandleHoverIn(event: PIXI.FederatedEvent): void; /** * Handle mouse-out event on a control handle * @param event - The mouseout event */ - protected _onHandleHoverOut(event: PIXI.InteractionEvent): void; + protected _onHandleHoverOut(event: PIXI.FederatedEvent): void; /** * When we start a drag event - create a preview copy of the Tile for re-positioning * @param event - The mousedown event */ - protected _onHandleMouseDown(event: PIXI.InteractionEvent): void; + protected _onHandleMouseDown(event: PIXI.FederatedEvent): void; /** * Handle the beginning of a drag event on a resize handle * @param event - The mousedown event */ - protected _onHandleDragStart(event: PIXI.InteractionEvent): void; + protected _onHandleDragStart(event: PIXI.FederatedEvent): void; /** * Handle mousemove while dragging a tile scale handler * @param event - The mousemove event */ - protected _onHandleDragMove(event: PIXI.InteractionEvent): void; + protected _onHandleDragMove(event: PIXI.FederatedEvent): void; /** * Handle mouseup after dragging a tile scale handler * @param event - The mouseup event */ - protected _onHandleDragDrop(event: PIXI.InteractionEvent): Promise; + protected _onHandleDragDrop(event: PIXI.FederatedEvent): Promise; /** * Get resized Tile dimensions diff --git a/src/foundry/client/pixi/placeables/token.d.ts b/src/foundry/client/pixi/placeables/token.d.ts index b3ac59859..98fe26de0 100644 --- a/src/foundry/client/pixi/placeables/token.d.ts +++ b/src/foundry/client/pixi/placeables/token.d.ts @@ -523,47 +523,47 @@ declare global { protected override _canControl( user?: InstanceType>, - event?: PIXI.InteractionEvent, + event?: PIXI.FederatedEvent, ): boolean; protected override _canHUD( user: InstanceType>, - event?: PIXI.InteractionEvent, + event?: PIXI.FederatedEvent, ): boolean; protected override _canConfigure( user?: InstanceType>, - event?: PIXI.InteractionEvent, + event?: PIXI.FederatedEvent, ): true; protected override _canHover( user?: InstanceType>, - event?: PIXI.InteractionEvent, + event?: PIXI.FederatedEvent, ): true; protected override _canView( user?: InstanceType>, - event?: PIXI.InteractionEvent, + event?: PIXI.FederatedEvent, ): boolean; protected override _canDrag( user: InstanceType>, - event: PIXI.InteractionEvent, + event: PIXI.FederatedEvent, ): boolean; - protected override _onHoverIn(event: PIXI.InteractionEvent, options?: { hoverOutOthers?: boolean }): void; + protected override _onHoverIn(event: PIXI.FederatedEvent, options?: { hoverOutOthers?: boolean }): void; - protected override _onHoverOut(event: PIXI.InteractionEvent): false | void; + protected override _onHoverOut(event: PIXI.FederatedEvent): false | void; - protected override _onClickLeft(event: PIXI.InteractionEvent): void; + protected override _onClickLeft(event: PIXI.FederatedEvent): void; - protected override _onClickLeft2(event?: PIXI.InteractionEvent): void; + protected override _onClickLeft2(event?: PIXI.FederatedEvent): void; - protected override _onClickRight2(event: PIXI.InteractionEvent): void; + protected override _onClickRight2(event: PIXI.FederatedEvent): void; - protected override _onDragLeftDrop(event: PIXI.InteractionEvent): Promise; + protected override _onDragLeftDrop(event: PIXI.FederatedEvent): Promise; - protected override _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected override _onDragLeftMove(event: PIXI.FederatedEvent): void; protected override _onDragLeftCancel(event: MouseEvent): void; /** diff --git a/src/foundry/client/pixi/placeables/wall.d.ts b/src/foundry/client/pixi/placeables/wall.d.ts index 9aec76a92..d107dc256 100644 --- a/src/foundry/client/pixi/placeables/wall.d.ts +++ b/src/foundry/client/pixi/placeables/wall.d.ts @@ -241,27 +241,27 @@ declare global { protected override _canControl(user: InstanceType>, event?: any): boolean; - protected override _onHoverIn(event: PIXI.InteractionEvent, options?: HoverInOptions): false | void; + protected override _onHoverIn(event: PIXI.FederatedEvent, options?: HoverInOptions): false | void; - protected override _onHoverOut(event: PIXI.InteractionEvent): false | void; + protected override _onHoverOut(event: PIXI.FederatedEvent): false | void; /** * Handle mouse-hover events on the line segment itself, pulling the Wall to the front of the container stack * @internal */ - protected _onMouseOverLine(event: PIXI.InteractionEvent): void; + protected _onMouseOverLine(event: PIXI.FederatedEvent): void; - protected override _onClickLeft(event: PIXI.InteractionEvent): boolean; + protected override _onClickLeft(event: PIXI.FederatedEvent): boolean; - protected override _onClickLeft2(event: PIXI.InteractionEvent): void; + protected override _onClickLeft2(event: PIXI.FederatedEvent): void; - protected override _onClickRight2(event: PIXI.InteractionEvent): void; + protected override _onClickRight2(event: PIXI.FederatedEvent): void; - protected override _onDragLeftStart(event: PIXI.InteractionEvent): void; + protected override _onDragLeftStart(event: PIXI.FederatedEvent): void; - protected override _onDragLeftMove(event: PIXI.InteractionEvent): void; + protected override _onDragLeftMove(event: PIXI.FederatedEvent): void; - protected override _onDragLeftDrop(event: PIXI.InteractionEvent): Promise; + protected override _onDragLeftDrop(event: PIXI.FederatedEvent): Promise; } } From 462e7430e86b7f63c3d0fd39843ed2b8291931e8 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 28 Nov 2023 10:43:29 -0800 Subject: [PATCH 53/75] Temporary type fixing pending rewrites --- src/foundry/client/pixi/board.d.ts | 6 +++--- src/foundry/client/pixi/webgl/base.d.ts | 3 --- src/foundry/client/pixi/webgl/filters.d.ts | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/foundry/client/pixi/board.d.ts b/src/foundry/client/pixi/board.d.ts index 350c4a704..4bce96f75 100644 --- a/src/foundry/client/pixi/board.d.ts +++ b/src/foundry/client/pixi/board.d.ts @@ -84,7 +84,7 @@ declare global { * An set of blur filter instances which are modified by the zoom level and the "soft shadows" setting * @defaultValue `[]` */ - blurFilters: Set; + blurFilters: Set; /** * A reference to the MouseInteractionManager that is currently controlling pointer-based interaction, or null. @@ -519,14 +519,14 @@ declare global { * @param blurStrength - The desired blur strength to use for this filter * (default: `CONFIG.Canvas.blurStrength`) */ - createBlurFilter(blurStrength?: number): PIXI.filters.BlurFilter; + createBlurFilter(blurStrength?: number): PIXI.BlurFilter; /** * Add a filter to the blur filter list. The filter must have the blur property * @param filter - The Filter instance to add * @returns The added filter for method chaining */ - addBlurFilter(filter: PIXI.filters.BlurFilter): PIXI.filters.BlurFilter; + addBlurFilter(filter: PIXI.BlurFilter): PIXI.BlurFilter; /** * Update the blur strength depending on the scale of the canvas stage diff --git a/src/foundry/client/pixi/webgl/base.d.ts b/src/foundry/client/pixi/webgl/base.d.ts index 3250489c7..08f3035d4 100644 --- a/src/foundry/client/pixi/webgl/base.d.ts +++ b/src/foundry/client/pixi/webgl/base.d.ts @@ -2,9 +2,6 @@ * This class defines an interface which all shaders utilize */ declare abstract class AbstractBaseShader extends PIXI.Shader { - /** The current uniforms of the Shader */ - uniforms: AbstractBaseShader.Uniforms; - constructor(program: PIXI.Program, uniforms: AbstractBaseShader.Uniforms); /** diff --git a/src/foundry/client/pixi/webgl/filters.d.ts b/src/foundry/client/pixi/webgl/filters.d.ts index 0b12e6263..768ccf030 100644 --- a/src/foundry/client/pixi/webgl/filters.d.ts +++ b/src/foundry/client/pixi/webgl/filters.d.ts @@ -27,7 +27,7 @@ declare abstract class AbstractBaseMaskFilter extends PIXI.Filter { ): T; override apply( - filterManager: PIXI.systems.FilterSystem, + filterManager: PIXI.FilterSystem, input: PIXI.RenderTexture, output: PIXI.RenderTexture, clear: PIXI.CLEAR_MODES, @@ -86,13 +86,13 @@ declare abstract class AbstractFilter extends PIXI.Filter { /** * Always target the resolution of the render texture or renderer */ - // @ts-expect-error this is a property on PIXI.Filter get resolution(): number; set resolution(value: number); /** * Always target the MSAA level of the render texture or renderer */ + // @ts-expect-error this is a property on PIXI.Filter get multisample(): PIXI.MSAA_QUALITY; set multisample(value: PIXI.MSAA_QUALITY); } From 8e01244cb5dc7c112217c9b73c8d8e1067822c31 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Nov 2023 01:33:55 +0000 Subject: [PATCH 54/75] Bump @typescript-eslint/eslint-plugin from 6.13.0 to 6.13.1 Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.13.0 to 6.13.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.13.1/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 248 +++++++--------------------------------------- 1 file changed, 35 insertions(+), 213 deletions(-) diff --git a/package-lock.json b/package-lock.json index 52e3b0a1f..bf5fda29a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2397,16 +2397,16 @@ "integrity": "sha512-d4GpH4uPYp9W07kc487tiq6V/EUHl18vZWFMbQoe4Sk9LXEWzFi/BMf9x7TI4m7/j7gU3KeX8H6M8aPBgykeLw==" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.13.0.tgz", - "integrity": "sha512-HTvbSd0JceI2GW5DHS3R9zbarOqjkM9XDR7zL8eCsBUO/eSiHcoNE7kSL5sjGXmVa9fjH5LCfHDXNnH4QLp7tQ==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.13.1.tgz", + "integrity": "sha512-5bQDGkXaxD46bPvQt08BUz9YSaO4S0fB1LB5JHQuXTfkGPI3+UUeS387C/e9jRie5GqT8u5kFTrMvAjtX4O5kA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.13.0", - "@typescript-eslint/type-utils": "6.13.0", - "@typescript-eslint/utils": "6.13.0", - "@typescript-eslint/visitor-keys": "6.13.0", + "@typescript-eslint/scope-manager": "6.13.1", + "@typescript-eslint/type-utils": "6.13.1", + "@typescript-eslint/utils": "6.13.1", + "@typescript-eslint/visitor-keys": "6.13.1", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -2431,53 +2431,6 @@ } } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.0.tgz", - "integrity": "sha512-2x0K2/CujsokIv+LN2T0l5FVDMtsCjkUyYtlcY4xxnxLAW+x41LXr16duoicHpGtLhmtN7kqvuFJ3zbz00Ikhw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.13.0", - "@typescript-eslint/visitor-keys": "6.13.0" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.0.tgz", - "integrity": "sha512-oXg7DFxx/GmTrKXKKLSoR2rwiutOC7jCQ5nDH5p5VS6cmHE1TcPTaYQ0VPSSUvj7BnNqCgQ/NXcTBxn59pfPTQ==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.0.tgz", - "integrity": "sha512-UQklteCEMCRoq/1UhKFZsHv5E4dN1wQSzJoxTfABasWk1HgJRdg1xNUve/Kv/Sdymt4x+iEzpESOqRFlQr/9Aw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.13.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/parser": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.13.0.tgz", @@ -2581,13 +2534,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.12.0.tgz", - "integrity": "sha512-5gUvjg+XdSj8pcetdL9eXJzQNTl3RD7LgUiYTl8Aabdi8hFkaGSYnaS6BLc0BGNaDH+tVzVwmKtWvu0jLgWVbw==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.1.tgz", + "integrity": "sha512-BW0kJ7ceiKi56GbT2KKzZzN+nDxzQK2DS6x0PiSMPjciPgd/JRQGMibyaN2cPt2cAvuoH0oNvn2fwonHI+4QUQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.12.0", - "@typescript-eslint/visitor-keys": "6.12.0" + "@typescript-eslint/types": "6.13.1", + "@typescript-eslint/visitor-keys": "6.13.1" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2598,13 +2551,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.13.0.tgz", - "integrity": "sha512-YHufAmZd/yP2XdoD3YeFEjq+/Tl+myhzv+GJHSOz+ro/NFGS84mIIuLU3pVwUcauSmwlCrVXbBclkn1HfjY0qQ==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.13.1.tgz", + "integrity": "sha512-A2qPlgpxx2v//3meMqQyB1qqTg1h1dJvzca7TugM3Yc2USDY+fsRBiojAEo92HO7f5hW5mjAUF6qobOPzlBCBQ==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.13.0", - "@typescript-eslint/utils": "6.13.0", + "@typescript-eslint/typescript-estree": "6.13.1", + "@typescript-eslint/utils": "6.13.1", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -2624,67 +2577,10 @@ } } }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.0.tgz", - "integrity": "sha512-oXg7DFxx/GmTrKXKKLSoR2rwiutOC7jCQ5nDH5p5VS6cmHE1TcPTaYQ0VPSSUvj7BnNqCgQ/NXcTBxn59pfPTQ==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.0.tgz", - "integrity": "sha512-IT4O/YKJDoiy/mPEDsfOfp+473A9GVqXlBKckfrAOuVbTqM8xbc0LuqyFCcgeFWpqu3WjQexolgqN2CuWBYbog==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.13.0", - "@typescript-eslint/visitor-keys": "6.13.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.0.tgz", - "integrity": "sha512-UQklteCEMCRoq/1UhKFZsHv5E4dN1wQSzJoxTfABasWk1HgJRdg1xNUve/Kv/Sdymt4x+iEzpESOqRFlQr/9Aw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.13.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/types": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.12.0.tgz", - "integrity": "sha512-MA16p/+WxM5JG/F3RTpRIcuOghWO30//VEOvzubM8zuOOBYXsP+IfjoCXXiIfy2Ta8FRh9+IO9QLlaFQUU+10Q==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.1.tgz", + "integrity": "sha512-gjeEskSmiEKKFIbnhDXUyiqVma1gRCQNbVZ1C8q7Zjcxh3WZMbzWVfGE9rHfWd1msQtPS0BVD9Jz9jded44eKg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2695,13 +2591,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.12.0.tgz", - "integrity": "sha512-vw9E2P9+3UUWzhgjyyVczLWxZ3GuQNT7QpnIY3o5OMeLO/c8oHljGc8ZpryBMIyympiAAaKgw9e5Hl9dCWFOYw==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.1.tgz", + "integrity": "sha512-sBLQsvOC0Q7LGcUHO5qpG1HxRgePbT6wwqOiGLpR8uOJvPJbfs0mW3jPA3ujsDvfiVwVlWUDESNXv44KtINkUQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.12.0", - "@typescript-eslint/visitor-keys": "6.12.0", + "@typescript-eslint/types": "6.13.1", + "@typescript-eslint/visitor-keys": "6.13.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -2722,17 +2618,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.13.0.tgz", - "integrity": "sha512-V+txaxARI8yznDkcQ6FNRXxG+T37qT3+2NsDTZ/nKLxv6VfGrRhTnuvxPUxpVuWWr+eVeIxU53PioOXbz8ratQ==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.13.1.tgz", + "integrity": "sha512-ouPn/zVoan92JgAegesTXDB/oUp6BP1v8WpfYcqh649ejNc9Qv+B4FF2Ff626kO1xg0wWwwG48lAJ4JuesgdOw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.13.0", - "@typescript-eslint/types": "6.13.0", - "@typescript-eslint/typescript-estree": "6.13.0", + "@typescript-eslint/scope-manager": "6.13.1", + "@typescript-eslint/types": "6.13.1", + "@typescript-eslint/typescript-estree": "6.13.1", "semver": "^7.5.4" }, "engines": { @@ -2746,87 +2642,13 @@ "eslint": "^7.0.0 || ^8.0.0" } }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.0.tgz", - "integrity": "sha512-2x0K2/CujsokIv+LN2T0l5FVDMtsCjkUyYtlcY4xxnxLAW+x41LXr16duoicHpGtLhmtN7kqvuFJ3zbz00Ikhw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.13.0", - "@typescript-eslint/visitor-keys": "6.13.0" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.0.tgz", - "integrity": "sha512-oXg7DFxx/GmTrKXKKLSoR2rwiutOC7jCQ5nDH5p5VS6cmHE1TcPTaYQ0VPSSUvj7BnNqCgQ/NXcTBxn59pfPTQ==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.0.tgz", - "integrity": "sha512-IT4O/YKJDoiy/mPEDsfOfp+473A9GVqXlBKckfrAOuVbTqM8xbc0LuqyFCcgeFWpqu3WjQexolgqN2CuWBYbog==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.13.0", - "@typescript-eslint/visitor-keys": "6.13.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.0.tgz", - "integrity": "sha512-UQklteCEMCRoq/1UhKFZsHv5E4dN1wQSzJoxTfABasWk1HgJRdg1xNUve/Kv/Sdymt4x+iEzpESOqRFlQr/9Aw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.13.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.12.0.tgz", - "integrity": "sha512-rg3BizTZHF1k3ipn8gfrzDXXSFKyOEB5zxYXInQ6z0hUvmQlhaZQzK+YmHmNViMA9HzW5Q9+bPPt90bU6GQwyw==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.1.tgz", + "integrity": "sha512-NDhQUy2tg6XGNBGDRm1XybOHSia8mcXmlbKWoQP+nm1BIIMxa55shyJfZkHpEBN62KNPLrocSM2PdPcaLgDKMQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/types": "6.13.1", "eslint-visitor-keys": "^3.4.1" }, "engines": { From 1680b9ac6c1072d5d01e21103fe7ae1ba50fc25d Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 28 Nov 2023 18:22:18 -0800 Subject: [PATCH 55/75] Resolved dependency issue --- package-lock.json | 80 ++--------------------------------------------- package.json | 3 ++ 2 files changed, 6 insertions(+), 77 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6ff306217..3d8e76fdc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -748,9 +748,9 @@ } }, "node_modules/@types/css-font-loading-module": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/@types/css-font-loading-module/-/css-font-loading-module-0.0.7.tgz", - "integrity": "sha512-nl09VhutdjINdWyXxHWN/w9zlNCfr60JUqJbd24YXUuCwgeL0TpFSdElCwb6cxfB6ybE19Gjj4g0jsgkXxKv1Q==" + "version": "0.0.12", + "resolved": "https://registry.npmjs.org/@types/css-font-loading-module/-/css-font-loading-module-0.0.12.tgz", + "integrity": "sha512-x2tZZYkSxXqWvTDgveSynfjq/T2HyiZHXb00j/+gy19yp70PHCizM48XFdjBCWH7eHBD0R5i/pw9yMBP/BH5uA==" }, "node_modules/@types/earcut": { "version": "2.1.2", @@ -1008,23 +1008,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.12.0.tgz", - "integrity": "sha512-5gUvjg+XdSj8pcetdL9eXJzQNTl3RD7LgUiYTl8Aabdi8hFkaGSYnaS6BLc0BGNaDH+tVzVwmKtWvu0jLgWVbw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.12.0", - "@typescript-eslint/visitor-keys": "6.12.0" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/type-utils": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.13.0.tgz", @@ -1109,46 +1092,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/types": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.12.0.tgz", - "integrity": "sha512-MA16p/+WxM5JG/F3RTpRIcuOghWO30//VEOvzubM8zuOOBYXsP+IfjoCXXiIfy2Ta8FRh9+IO9QLlaFQUU+10Q==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.12.0.tgz", - "integrity": "sha512-vw9E2P9+3UUWzhgjyyVczLWxZ3GuQNT7QpnIY3o5OMeLO/c8oHljGc8ZpryBMIyympiAAaKgw9e5Hl9dCWFOYw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.12.0", - "@typescript-eslint/visitor-keys": "6.12.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/@typescript-eslint/utils": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.13.0.tgz", @@ -1248,23 +1191,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.12.0.tgz", - "integrity": "sha512-rg3BizTZHF1k3ipn8gfrzDXXSFKyOEB5zxYXInQ6z0hUvmQlhaZQzK+YmHmNViMA9HzW5Q9+bPPt90bU6GQwyw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.12.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", diff --git a/package.json b/package.json index 9a0f7f260..a04795dff 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,9 @@ "typescript": "~5.3", "vitest": "^0.34.6" }, + "overrides": { + "@types/css-font-loading-module": "^0.0.12s" + }, "husky": { "hooks": { "pre-commit": "lint-staged" From 55b663e6b8255a75cd97baaeaeac486d5a8b0152 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 28 Nov 2023 18:52:37 -0800 Subject: [PATCH 56/75] Adjusted Graphics to v11 --- src/foundry/client/pixi/layers/grid/highlight.d.ts | 7 ++++++- src/types/augments/pixiGraphics.d.ts | 9 --------- src/types/augments/pixiGraphicsSmooth.d.ts | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) delete mode 100644 src/types/augments/pixiGraphics.d.ts diff --git a/src/foundry/client/pixi/layers/grid/highlight.d.ts b/src/foundry/client/pixi/layers/grid/highlight.d.ts index d976f46e3..2a8bc6c95 100644 --- a/src/foundry/client/pixi/layers/grid/highlight.d.ts +++ b/src/foundry/client/pixi/layers/grid/highlight.d.ts @@ -24,5 +24,10 @@ declare class GridHighlight extends PIXI.Graphics { override clear(): this; - override destroy(...args: Parameters): void; + /** + * @privateRemarks The parameter should be PIXI.Graphics["destroy"] + * or something to that effect since this is inheriting from that + * but I'm not sure why the reference isn't working + */ + override destroy(...args: Parameters): void; } diff --git a/src/types/augments/pixiGraphics.d.ts b/src/types/augments/pixiGraphics.d.ts deleted file mode 100644 index 5c8d19dec..000000000 --- a/src/types/augments/pixiGraphics.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -declare global { - namespace PIXI { - interface Graphics { - nextRoundedRectBehavior: boolean; - } - } -} - -export {}; diff --git a/src/types/augments/pixiGraphicsSmooth.d.ts b/src/types/augments/pixiGraphicsSmooth.d.ts index 3103282bd..34d9d0c6a 100644 --- a/src/types/augments/pixiGraphicsSmooth.d.ts +++ b/src/types/augments/pixiGraphicsSmooth.d.ts @@ -2,6 +2,6 @@ import * as graphicsSmooth from "@pixi/graphics-smooth"; declare global { namespace PIXI { - export import smooth = graphicsSmooth; // eslint-disable-line @typescript-eslint/no-unused-vars + export import smooth = graphicsSmooth; } } From db0e892fe00e167b7994fe70e0aecc10fc55b006 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Tue, 28 Nov 2023 20:54:40 -0800 Subject: [PATCH 57/75] Fixed Graphics? --- src/foundry/client/pixi/layers/grid/highlight.d.ts | 7 +------ src/types/augments/pixiLegacyGraphics.d.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/foundry/client/pixi/layers/grid/highlight.d.ts b/src/foundry/client/pixi/layers/grid/highlight.d.ts index 2a8bc6c95..d976f46e3 100644 --- a/src/foundry/client/pixi/layers/grid/highlight.d.ts +++ b/src/foundry/client/pixi/layers/grid/highlight.d.ts @@ -24,10 +24,5 @@ declare class GridHighlight extends PIXI.Graphics { override clear(): this; - /** - * @privateRemarks The parameter should be PIXI.Graphics["destroy"] - * or something to that effect since this is inheriting from that - * but I'm not sure why the reference isn't working - */ - override destroy(...args: Parameters): void; + override destroy(...args: Parameters): void; } diff --git a/src/types/augments/pixiLegacyGraphics.d.ts b/src/types/augments/pixiLegacyGraphics.d.ts index 25ed23d5f..9d2d65cef 100644 --- a/src/types/augments/pixiLegacyGraphics.d.ts +++ b/src/types/augments/pixiLegacyGraphics.d.ts @@ -1,7 +1,11 @@ declare global { namespace PIXI { - export const LegacyGraphics: typeof PIXI.Graphics; - export const Graphics: typeof PIXI.smooth.SmoothGraphics; + /** + * @privateRemarks Unclear if this const isn't just pointing back to the freshly declared Graphics class + * Trying to replicate the handling in head.js + */ + export const LegacyGraphics: PIXI.Graphics; + export class Graphics extends PIXI.smooth.SmoothGraphics {} } } From 43ab978a7bc120506da37cd677f953fad89a05df Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Wed, 29 Nov 2023 09:19:39 -0800 Subject: [PATCH 58/75] Further review adjustments --- src/foundry/client/pixi/perception/detection-mode.d.ts | 1 + src/foundry/client/pixi/perception/vision-mode.d.ts | 3 ++- src/foundry/client/pixi/sources/rendered-source.d.ts | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/foundry/client/pixi/perception/detection-mode.d.ts b/src/foundry/client/pixi/perception/detection-mode.d.ts index b4d4c7e7d..9e884febd 100644 --- a/src/foundry/client/pixi/perception/detection-mode.d.ts +++ b/src/foundry/client/pixi/perception/detection-mode.d.ts @@ -20,6 +20,7 @@ type CanvasVisibilityTestConfig = { }; // TODO: Remove after foundry.abstract.DataModel is defined +// Currently that is in PR #2331 (branch v10/non-inferring-data-fields) declare namespace foundry { namespace abstract { class DataModel {} diff --git a/src/foundry/client/pixi/perception/vision-mode.d.ts b/src/foundry/client/pixi/perception/vision-mode.d.ts index ab89773bc..e02e88258 100644 --- a/src/foundry/client/pixi/perception/vision-mode.d.ts +++ b/src/foundry/client/pixi/perception/vision-mode.d.ts @@ -1,6 +1,7 @@ export {}; -// TODO: Remove after DataField && DataModel are implemented +// TODO: Remove after foundry.abstract.DataModel is defined +// Currently that is in PR #2331 (branch v10/non-inferring-data-fields declare namespace foundry { namespace data { namespace fields { diff --git a/src/foundry/client/pixi/sources/rendered-source.d.ts b/src/foundry/client/pixi/sources/rendered-source.d.ts index 375adb901..b8001647f 100644 --- a/src/foundry/client/pixi/sources/rendered-source.d.ts +++ b/src/foundry/client/pixi/sources/rendered-source.d.ts @@ -190,9 +190,9 @@ declare global { /** * Animate the PointSource, if an animation is enabled and if it currently has rendered containers. * @param dt - Delta time. - * @remarks Returns `this.animation.call(this, dt, options)` + * @remarks Returns `this.animation.animation.call(this, dt, options)` */ - animate(dt: number): ReturnType>; + animate(dt: number): ReturnType> | undefined; /** * Generic time-based animation used for Rendered Point Sources. From 92e8e72957d14887b25393414d5978c568e326e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 01:19:25 +0000 Subject: [PATCH 59/75] Bump eslint-config-prettier from 9.0.0 to 9.1.0 Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 9.0.0 to 9.1.0. - [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-config-prettier/compare/v9.0.0...v9.1.0) --- updated-dependencies: - dependency-name: eslint-config-prettier dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 850b82dd6..e50d0377c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3278,9 +3278,10 @@ } }, "node_modules/eslint-config-prettier": { - "version": "9.0.0", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", "dev": true, - "license": "MIT", "bin": { "eslint-config-prettier": "bin/cli.js" }, From f16af5675bc815d339af6057aacde7d30e972f09 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 01:20:16 +0000 Subject: [PATCH 60/75] Bump lint-staged from 15.1.0 to 15.2.0 Bumps [lint-staged](https://github.com/okonet/lint-staged) from 15.1.0 to 15.2.0. - [Release notes](https://github.com/okonet/lint-staged/releases) - [Changelog](https://github.com/lint-staged/lint-staged/blob/master/CHANGELOG.md) - [Commits](https://github.com/okonet/lint-staged/compare/v15.1.0...v15.2.0) --- updated-dependencies: - dependency-name: lint-staged dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 170 ++++++++++++++++++++++++++++++---------------- 1 file changed, 110 insertions(+), 60 deletions(-) diff --git a/package-lock.json b/package-lock.json index 850b82dd6..7e0a4492a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2732,27 +2732,27 @@ } }, "node_modules/ansi-escapes": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz", - "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-6.2.0.tgz", + "integrity": "sha512-kzRaCqXnpzWs+3z5ABPQiVke+iq0KXkHo8xiWV4RPTi5Yli0l97BEQuhXV1s7+aSU/fu1kUuxgS4MsQ0fRuygw==", "dev": true, "dependencies": { - "type-fest": "^1.0.2" + "type-fest": "^3.0.0" }, "engines": { - "node": ">=12" + "node": ">=14.16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/ansi-escapes/node_modules/type-fest": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", - "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz", + "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==", "dev": true, "engines": { - "node": ">=10" + "node": ">=14.16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -2966,16 +2966,16 @@ } }, "node_modules/cli-truncate": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", - "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz", + "integrity": "sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==", "dev": true, "dependencies": { "slice-ansi": "^5.0.0", - "string-width": "^5.0.0" + "string-width": "^7.0.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3140,16 +3140,10 @@ "version": "2.2.4", "license": "ISC" }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true - }, "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", + "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==", "dev": true }, "node_modules/engine.io-client": { @@ -3565,6 +3559,18 @@ "version": "1.1.1", "license": "MIT" }, + "node_modules/get-east-asian-width": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz", + "integrity": "sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/get-func-name": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", @@ -3994,25 +4000,26 @@ } }, "node_modules/lilconfig": { - "version": "2.1.0", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.0.0.tgz", + "integrity": "sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g==", "dev": true, - "license": "MIT", "engines": { - "node": ">=10" + "node": ">=14" } }, "node_modules/lint-staged": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.1.0.tgz", - "integrity": "sha512-ZPKXWHVlL7uwVpy8OZ7YQjYDAuO5X4kMh0XgZvPNxLcCCngd0PO5jKQyy3+s4TL2EnHoIXIzP1422f/l3nZKMw==", + "version": "15.2.0", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.0.tgz", + "integrity": "sha512-TFZzUEV00f+2YLaVPWBWGAMq7So6yQx+GG8YRMDeOEIf95Zn5RyiLMsEiX4KTNl9vq/w+NqRJkLA1kPIo15ufQ==", "dev": true, "dependencies": { "chalk": "5.3.0", "commander": "11.1.0", "debug": "4.3.4", "execa": "8.0.1", - "lilconfig": "2.1.0", - "listr2": "7.0.2", + "lilconfig": "3.0.0", + "listr2": "8.0.0", "micromatch": "4.0.5", "pidtree": "0.6.0", "string-argv": "0.3.2", @@ -4096,20 +4103,20 @@ } }, "node_modules/listr2": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-7.0.2.tgz", - "integrity": "sha512-rJysbR9GKIalhTbVL2tYbF2hVyDnrf7pFUZBwjPaMIdadYHmeT+EVi/Bu3qd7ETQPahTotg2WRCatXwRBW554g==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-8.0.0.tgz", + "integrity": "sha512-u8cusxAcyqAiQ2RhYvV7kRKNLgUvtObIbhOX2NCXqvp1UU32xIg5CT22ykS2TPKJXZWJwtK3IKLiqAGlGNE+Zg==", "dev": true, "dependencies": { - "cli-truncate": "^3.1.0", + "cli-truncate": "^4.0.0", "colorette": "^2.0.20", "eventemitter3": "^5.0.1", - "log-update": "^5.0.1", + "log-update": "^6.0.0", "rfdc": "^1.3.0", - "wrap-ansi": "^8.1.0" + "wrap-ansi": "^9.0.0" }, "engines": { - "node": ">=16.0.0" + "node": ">=18.0.0" } }, "node_modules/listr2/node_modules/eventemitter3": { @@ -4150,19 +4157,19 @@ "license": "MIT" }, "node_modules/log-update": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/log-update/-/log-update-5.0.1.tgz", - "integrity": "sha512-5UtUDQ/6edw4ofyljDNcOVJQ4c7OjDro4h3y8e1GQL5iYElYclVHJ3zeWchylvMaKnDbDilC8irOVyexnA/Slw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-6.0.0.tgz", + "integrity": "sha512-niTvB4gqvtof056rRIrTZvjNYE4rCUzO6X/X+kYjd7WFxXeJ0NwEFnRxX6ehkvv3jTwrXnNdtAak5XYZuIyPFw==", "dev": true, "dependencies": { - "ansi-escapes": "^5.0.0", + "ansi-escapes": "^6.2.0", "cli-cursor": "^4.0.0", - "slice-ansi": "^5.0.0", - "strip-ansi": "^7.0.1", - "wrap-ansi": "^8.0.1" + "slice-ansi": "^7.0.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -4180,6 +4187,49 @@ "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, + "node_modules/log-update/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/log-update/node_modules/is-fullwidth-code-point": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.0.0.tgz", + "integrity": "sha512-OVa3u9kkBbw7b8Xw5F9P+D/T9X+Z4+JruYVNapTjPYZYUznQ5YfWeFkOj606XYYW8yugTfC8Pj0hYqvi4ryAhA==", + "dev": true, + "dependencies": { + "get-east-asian-width": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/slice-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.0.tgz", + "integrity": "sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.2.1", + "is-fullwidth-code-point": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, "node_modules/log-update/node_modules/strip-ansi": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", @@ -5285,17 +5335,17 @@ } }, "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.0.0.tgz", + "integrity": "sha512-GPQHj7row82Hjo9hKZieKcHIhaAIKOJvFSIZXuCU9OASVZrMNUaZuz++SPVrBjnLsnk4k+z9f2EIypgxf2vNFw==", "dev": true, "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" }, "engines": { - "node": ">=12" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -5755,17 +5805,17 @@ "license": "MIT" }, "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz", + "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", "dev": true, "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" }, "engines": { - "node": ">=12" + "node": ">=18" }, "funding": { "url": "https://github.com/chalk/wrap-ansi?sponsor=1" From 72a44311d99dff445ad277998543176632bfacdc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 07:19:09 +0000 Subject: [PATCH 61/75] Bump eslint from 8.54.0 to 8.55.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.54.0 to 8.55.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.54.0...v8.55.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index e50d0377c..d343f6cc7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -427,9 +427,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz", - "integrity": "sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -450,9 +450,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.54.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.54.0.tgz", - "integrity": "sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==", + "version": "8.55.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.55.0.tgz", + "integrity": "sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -3223,15 +3223,15 @@ } }, "node_modules/eslint": { - "version": "8.54.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.54.0.tgz", - "integrity": "sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==", + "version": "8.55.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz", + "integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.3", - "@eslint/js": "8.54.0", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.55.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", From e2c791854582a466bc38badfad08de66eb5822d0 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Thu, 7 Dec 2023 13:32:46 -0800 Subject: [PATCH 62/75] Many fixes, including typing the light source --- README.md | 1 + src/foundry/client/core/hooks.d.ts | 2 +- .../pixi/core/interaction/control-icon.d.ts | 2 +- .../pixi/core/interaction/mouse-handler.d.ts | 7 +++--- .../pixi/core/interaction/pings/pulse.d.ts | 2 +- .../pixi/core/interaction/render-flags.d.ts | 10 +------- .../pixi/core/shapes/source-polygon.d.ts | 10 +++++++- src/foundry/client/pixi/layers/lighting.d.ts | 4 +-- .../pixi/perception/clockwise-sweep.d.ts | 2 -- .../client/pixi/perception/color-manager.d.ts | 1 - .../pixi/perception/detection-mode.d.ts | 22 ++++++++-------- .../client/pixi/perception/vision-mode.d.ts | 8 +++--- src/foundry/client/pixi/placeables/light.d.ts | 2 +- src/foundry/client/pixi/placeables/token.d.ts | 4 +-- .../client/pixi/sources/light-source.d.ts | 6 ++--- .../client/pixi/sources/rendered-source.d.ts | 25 +++++++++++-------- .../client/pixi/sources/vision-source.d.ts | 2 +- src/types/augments/pixiGlobal.d.ts | 3 +-- 18 files changed, 57 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index b858d7e78..d0eb67b93 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ Add foundry-vtt-types to your types section in your `tsconfig.json`: "compilerOptions": { "types": ["@league-of-foundry-developers/foundry-vtt-types"], "moduleResolution": "node", + "esModuleInterop": true, "strictNullChecks": true } } diff --git a/src/foundry/client/core/hooks.d.ts b/src/foundry/client/core/hooks.d.ts index ecd57b400..c34cc2455 100644 --- a/src/foundry/client/core/hooks.d.ts +++ b/src/foundry/client/core/hooks.d.ts @@ -444,7 +444,7 @@ declare global { * @remarks This is called by {@link Hooks.callAll}. * @see {@link LightSource#_initializeShaders} */ - initializeLightSourceShaders: (source: LightSource) => void; + initializeLightSourceShaders: (source: LightSource) => void; /** * A hook event that fires when the LightingLayer is refreshed. diff --git a/src/foundry/client/pixi/core/interaction/control-icon.d.ts b/src/foundry/client/pixi/core/interaction/control-icon.d.ts index 0107956e3..e14591c9a 100644 --- a/src/foundry/client/pixi/core/interaction/control-icon.d.ts +++ b/src/foundry/client/pixi/core/interaction/control-icon.d.ts @@ -35,7 +35,7 @@ declare class ControlIcon extends PIXI.Container { /** * @defaultValue `static` */ - eventMode: "static"; + eventMode: "none" | "passive" | "auto" | "static" | "dynamic"; /** * @defaultValue `false` diff --git a/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts b/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts index 528a99264..b9089630f 100644 --- a/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts +++ b/src/foundry/client/pixi/core/interaction/mouse-handler.d.ts @@ -84,7 +84,7 @@ declare class MouseInteractionManager; } & Partial>; /** @@ -196,7 +196,6 @@ declare class MouseInteractionManager): void; } @@ -65,13 +63,7 @@ declare global { /** * Configure the render flags used for this class. - * @defaultValue - * ```ts - * { - * object: this, - * priority: this.constructor.RENDER_FLAG_PRIORITY - * } - * ``` + * @defaultValue `{}` */ static RENDER_FLAGS: Record; diff --git a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts index f5413d75a..78d9f4241 100644 --- a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts +++ b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts @@ -199,7 +199,7 @@ declare global { /** The configuration that defines a certain Polygon type */ config?: PointSourcePolygonConfig; }, - ): Mode extends "any" ? boolean : Mode extends "closest" ? PolygonVertex : PolygonVertex[] | null; + ): PointSourcePolygon.TestCollision; /** * Determine the set of collisions which occurs for a Ray. @@ -243,5 +243,13 @@ declare global { namespace PointSourcePolygon { type CollisionModes = "any" | "all" | "closest"; + + type CollisionTypes = { + any: boolean; + closest: PolygonVertex; + all: PolygonVertex[] | null; + }; + + type TestCollision = CollisionTypes[Mode]; } } diff --git a/src/foundry/client/pixi/layers/lighting.d.ts b/src/foundry/client/pixi/layers/lighting.d.ts index f503d8320..ceb78ea78 100644 --- a/src/foundry/client/pixi/layers/lighting.d.ts +++ b/src/foundry/client/pixi/layers/lighting.d.ts @@ -20,7 +20,7 @@ declare class LightingLayer extends PlaceablesLayer<"AmbientLight", LightingLaye /** * A mapping of light sources which are active within the rendered Scene */ - sources: foundry.utils.Collection; + sources: foundry.utils.Collection>; /** * Increment this whenever lighting channels are re-configured. @@ -63,7 +63,7 @@ declare class LightingLayer extends PlaceablesLayer<"AmbientLight", LightingLaye * An array of light sources which are currently animated * @internal */ - protected _animatedSources: LightSource[]; + protected _animatedSources: LightSource[]; /** * A mapping of different light level channels diff --git a/src/foundry/client/pixi/perception/clockwise-sweep.d.ts b/src/foundry/client/pixi/perception/clockwise-sweep.d.ts index 9f281ebc3..7357f3162 100644 --- a/src/foundry/client/pixi/perception/clockwise-sweep.d.ts +++ b/src/foundry/client/pixi/perception/clockwise-sweep.d.ts @@ -160,8 +160,6 @@ declare global { /** * Visualize the polygon, displaying its computed area, rays, and collision points - * @param ray - No comments - * @param collisions - No comments * @internal */ protected _visualizeCollision(ray: Ray, collisions: PolygonVertex[]): void; diff --git a/src/foundry/client/pixi/perception/color-manager.d.ts b/src/foundry/client/pixi/perception/color-manager.d.ts index d7366598c..78b74307e 100644 --- a/src/foundry/client/pixi/perception/color-manager.d.ts +++ b/src/foundry/client/pixi/perception/color-manager.d.ts @@ -61,7 +61,6 @@ declare global { /** * Initialize color space pertaining to a specific scene. - * @param colors - No comment */ initialize(colors?: { /** The background canvas color */ diff --git a/src/foundry/client/pixi/perception/detection-mode.d.ts b/src/foundry/client/pixi/perception/detection-mode.d.ts index 9e884febd..bfe093b6e 100644 --- a/src/foundry/client/pixi/perception/detection-mode.d.ts +++ b/src/foundry/client/pixi/perception/detection-mode.d.ts @@ -12,7 +12,7 @@ type TokenDetectionMode = { // TODO: Move to client/pixi/layers/effects/visibility.js type CanvasVisibilityTest = { point: PIXI.Point; - los: Map; + los: Map, boolean>; }; type CanvasVisibilityTestConfig = { object: PlaceableObject; @@ -75,7 +75,7 @@ declare global { * @returns Is the test target visible? */ testVisibility( - visionSource: VisionSource, + visionSource: VisionSource, mode: TokenDetectionMode, { object, tests }: CanvasVisibilityTestConfig, ): boolean; @@ -87,7 +87,7 @@ declare global { * @param target - The target object being tested * @returns Can the target object theoretically be detected by this vision source? */ - protected _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; + protected _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; /** * Evaluate a single test point to confirm whether it is visible. @@ -98,7 +98,7 @@ declare global { * @param test - The test case being evaluated */ protected _testPoint( - visionSource: VisionSource, + visionSource: VisionSource, mode: TokenDetectionMode, target: PlaceableObject, test: CanvasVisibilityTest, @@ -115,7 +115,7 @@ declare global { * @returns Is the LOS requirement satisfied for this test? */ protected _testLOS( - visionSource: VisionSource, + visionSource: VisionSource, mode: TokenDetectionMode, target: PlaceableObject, test: CanvasVisibilityTest, @@ -130,7 +130,7 @@ declare global { * @returns Is the point within the vision angle? */ protected _testAngle( - visionSource: VisionSource, + visionSource: VisionSource, mode: TokenDetectionMode, target: PlaceableObject, test: CanvasVisibilityTest, @@ -145,7 +145,7 @@ declare global { * @returns Is the target within range? */ protected _testRange( - visionSource: VisionSource, + visionSource: VisionSource, mode: TokenDetectionMode, target: PlaceableObject, test: CanvasVisibilityTest, @@ -159,7 +159,7 @@ declare global { */ class DetectionModeBasicSight extends DetectionMode { override _testPoint( - visionSource: VisionSource, + visionSource: VisionSource, mode: TokenDetectionMode, target: PlaceableObject, test: CanvasVisibilityTest, @@ -175,7 +175,7 @@ declare global { class DetectionModeInvisibility extends DetectionMode { static override getDetectionFilter(): PIXI.Filter | undefined; - protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; + protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; } /** @@ -184,7 +184,7 @@ declare global { class DetectionModeTremor extends DetectionMode { static override getDetectionFilter(): PIXI.Filter | undefined; - protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; + protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; } /** @@ -194,6 +194,6 @@ declare global { class DetectionModeAll extends DetectionMode { static override getDetectionFilter(): PIXI.Filter | undefined; - protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; + protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; } } diff --git a/src/foundry/client/pixi/perception/vision-mode.d.ts b/src/foundry/client/pixi/perception/vision-mode.d.ts index e02e88258..db5dd0cbc 100644 --- a/src/foundry/client/pixi/perception/vision-mode.d.ts +++ b/src/foundry/client/pixi/perception/vision-mode.d.ts @@ -81,25 +81,25 @@ declare global { * Special activation handling that could be implemented by VisionMode subclasses * @param source - Activate this VisionMode for a specific source */ - abstract _activate(source: VisionSource): void; + abstract _activate(source: VisionSource): void; /** * Special deactivation handling that could be implemented by VisionMode subclasses * @param source - Deactivate this VisionMode for a specific source */ - abstract _deactivate(source: VisionSource): void; + abstract _deactivate(source: VisionSource): void; /** * Special handling which is needed when this Vision Mode is activated for a VisionSource. * @param source - Activate this VisionMode for a specific source */ - activate(source: VisionSource): void; + activate(source: VisionSource): void; /** * Special handling which is needed when this Vision Mode is deactivated for a VisionSource. * @param source - Deactivate this VisionMode for a specific source */ - deactivate(source: VisionSource): void; + deactivate(source: VisionSource): void; /** * An animation function which runs every frame while this Vision Mode is active. diff --git a/src/foundry/client/pixi/placeables/light.d.ts b/src/foundry/client/pixi/placeables/light.d.ts index 8d7a2b5c0..357c67f44 100644 --- a/src/foundry/client/pixi/placeables/light.d.ts +++ b/src/foundry/client/pixi/placeables/light.d.ts @@ -11,7 +11,7 @@ declare global { /** * A reference to the PointSource object which defines this light source area of effect */ - source: LightSource; + source: LightSource; /** * A reference to the ControlIcon used to configure this light diff --git a/src/foundry/client/pixi/placeables/token.d.ts b/src/foundry/client/pixi/placeables/token.d.ts index 98fe26de0..9722b22ca 100644 --- a/src/foundry/client/pixi/placeables/token.d.ts +++ b/src/foundry/client/pixi/placeables/token.d.ts @@ -36,12 +36,12 @@ declare global { /** * A reference to the VisionSource object which defines this vision source area of effect */ - vision: VisionSource; + vision: VisionSource; /** * A reference to the LightSource object which defines this light source area of effect */ - light: LightSource; + light: LightSource; /** * A linked ObjectHUD element which is synchronized with the location and visibility of this Token diff --git a/src/foundry/client/pixi/sources/light-source.d.ts b/src/foundry/client/pixi/sources/light-source.d.ts index a851bbae9..54d635d0d 100644 --- a/src/foundry/client/pixi/sources/light-source.d.ts +++ b/src/foundry/client/pixi/sources/light-source.d.ts @@ -15,7 +15,7 @@ declare global { * An animation configuration for the source * @defaultValue `{}` */ - animation: RenderedPointSource.RenderedPointSourceAnimationConfig; + animation: RenderedPointSource.RenderedPointSourceAnimationConfig; /** * The allowed radius of bright vision or illumination @@ -75,7 +75,7 @@ declare global { /** * A specialized subclass of the PointSource abstraction which is used to control the rendering of light sources. */ - class LightSource extends RenderedPointSource { + class LightSource extends RenderedPointSource { /** {@inheritdoc} */ static override sourceType: "light"; @@ -248,7 +248,7 @@ declare global { /** * A specialized subclass of the LightSource which is used to render global light source linked to the scene. */ - class GlobalLightSource extends LightSource { + class GlobalLightSource extends LightSource { override _createPolygon(): PIXI.Polygon; protected override _configureSoftEdges(): void; diff --git a/src/foundry/client/pixi/sources/rendered-source.d.ts b/src/foundry/client/pixi/sources/rendered-source.d.ts index b8001647f..8c044c1f5 100644 --- a/src/foundry/client/pixi/sources/rendered-source.d.ts +++ b/src/foundry/client/pixi/sources/rendered-source.d.ts @@ -16,28 +16,31 @@ declare global { } namespace RenderedPointSource { - type RenderedPointSourceAnimationConfig = { + type RenderedPointSourceAnimationConfig = InexactPartial<{ /** The human-readable (localized) label for the animation */ - label?: string; + label: string; /** The animation function that runs every frame */ - animation?: (dt: number, options: Partial) => any; + animation: ( + dt: number, + options: InexactPartial>, + ) => AnimationValue; /** A custom illumination shader used by this animation */ - illuminationShader?: AdaptiveIlluminationShader; + illuminationShader: AdaptiveIlluminationShader; /** A custom coloration shader used by this animation */ - colorationShader?: AdaptiveColorationShader; + colorationShader: AdaptiveColorationShader; /** A custom background shader used by this animation */ - backgroundShader?: AdaptiveBackgroundShader; + backgroundShader: AdaptiveBackgroundShader; /** The animation seed */ - seed?: number; + seed: number; /** The animation time */ - time?: number; - }; + time: number; + }>; type RenderedPointSourceLayer = { /** Is this layer actively rendered? */ @@ -53,7 +56,7 @@ declare global { }; } - class RenderedPointSource extends PointSource { + class RenderedPointSource extends PointSource { /** * Keys of the data object which require shaders to be re-initialized. */ @@ -74,7 +77,7 @@ declare global { * The animation configuration applied to this source * @defaultValue `{}` */ - animation: Partial; + animation: Partial>; /** * The object of data which configures how the source is rendered diff --git a/src/foundry/client/pixi/sources/vision-source.d.ts b/src/foundry/client/pixi/sources/vision-source.d.ts index b2505d20a..69f60790c 100644 --- a/src/foundry/client/pixi/sources/vision-source.d.ts +++ b/src/foundry/client/pixi/sources/vision-source.d.ts @@ -10,7 +10,7 @@ declare global { /** * A specialized subclass of the PointSource abstraction which is used to control the rendering of vision sources. */ - class VisionSource extends RenderedPointSource { + class VisionSource extends RenderedPointSource { static override sourceType: "sight"; static override _refreshUniformsKeys: [ diff --git a/src/types/augments/pixiGlobal.d.ts b/src/types/augments/pixiGlobal.d.ts index d0483c5a5..631717273 100644 --- a/src/types/augments/pixiGlobal.d.ts +++ b/src/types/augments/pixiGlobal.d.ts @@ -1,8 +1,7 @@ import * as PIXI from "pixi.js"; /** - * Added with the update of PIXI to 7.2.4 - * Necessary to maintain handling of PIXI in the global namespace + * Foundry exports PIXI into the global namespace */ export = PIXI; export as namespace PIXI; From 6ceef29f89889ba362157d132c2d860b9a7a931a Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Thu, 7 Dec 2023 15:01:52 -0800 Subject: [PATCH 63/75] Attempted Render Flag Type Specification --- .../pixi/core/interaction/render-flags.d.ts | 10 ++-- .../client/pixi/extensions/polygon.d.ts | 2 + .../client/pixi/perception/color-manager.d.ts | 2 +- .../pixi/perception/perception-manager.d.ts | 55 +++++++++++++------ .../client/pixi/perception/vision-mode.d.ts | 2 +- .../client/pixi/sources/rendered-source.d.ts | 4 +- 6 files changed, 50 insertions(+), 25 deletions(-) diff --git a/src/foundry/client/pixi/core/interaction/render-flags.d.ts b/src/foundry/client/pixi/core/interaction/render-flags.d.ts index f70f190a5..49c318979 100644 --- a/src/foundry/client/pixi/core/interaction/render-flags.d.ts +++ b/src/foundry/client/pixi/core/interaction/render-flags.d.ts @@ -2,11 +2,11 @@ export {}; declare global { /** @privateRemarks Values are marked as optional here based on use, foundry docs incomplete */ - type RenderFlag = { + type RenderFlag = { /** Activating this flag also sets these flags to true */ - propagate?: string[]; + propagate?: Array>; /** Activating this flag resets these flags to false */ - reset?: string[]; + reset?: Array>; }; /** @@ -19,7 +19,7 @@ declare global { * @param config - Optional configuration */ constructor( - flags: Record, + flags: Record>>, config?: { /** The object which owns this RenderFlags instance */ object?: RenderFlagObject; @@ -65,7 +65,7 @@ declare global { * Configure the render flags used for this class. * @defaultValue `{}` */ - static RENDER_FLAGS: Record; + static RENDER_FLAGS: Record>; /** * The ticker priority when RenderFlags of this class are handled. diff --git a/src/foundry/client/pixi/extensions/polygon.d.ts b/src/foundry/client/pixi/extensions/polygon.d.ts index 0abb5dc0b..34abfbf79 100644 --- a/src/foundry/client/pixi/extensions/polygon.d.ts +++ b/src/foundry/client/pixi/extensions/polygon.d.ts @@ -95,6 +95,7 @@ declare global { options: { /** The clipper clip type */ clipType?: number; + /** A scaling factor passed to Polygon#toClipperPoints to preserve precision */ scalingFactor?: number; }, @@ -110,6 +111,7 @@ declare global { options?: { /** The clipper clip type */ clipType?: number; + /** A scaling factor passed to Polygon#toClipperPoints to preserve precision */ scalingFactor?: number; }, diff --git a/src/foundry/client/pixi/perception/color-manager.d.ts b/src/foundry/client/pixi/perception/color-manager.d.ts index 78b74307e..d921519d5 100644 --- a/src/foundry/client/pixi/perception/color-manager.d.ts +++ b/src/foundry/client/pixi/perception/color-manager.d.ts @@ -1,7 +1,7 @@ export {}; // TODO: Define Color in common/utils/color.mjs -type Color = Number; +type Color = number; declare global { /** * A singleton class dedicated to manage the color spaces associated with the scene and the canvas. diff --git a/src/foundry/client/pixi/perception/perception-manager.d.ts b/src/foundry/client/pixi/perception/perception-manager.d.ts index a5f566d73..dd160f536 100644 --- a/src/foundry/client/pixi/perception/perception-manager.d.ts +++ b/src/foundry/client/pixi/perception/perception-manager.d.ts @@ -1,7 +1,7 @@ export {}; declare global { - interface PerceptionManagerFlags extends RenderFlags { + interface PerceptionManagerFlags { /** Re-initialize the entire lighting configuration */ initializeLighting: boolean; @@ -44,21 +44,44 @@ declare global { */ class PerceptionManager extends RenderFlagsMixin(Object) { static RENDER_FLAGS: { - initializeLighting: { propagate: ["refreshLighting", "refreshVision"] }; - refreshLighting: { propagate: ["refreshLightSources"] }; - refreshLightSources: Record; - refreshVisionSources: Record; - refreshPrimary: Record; - initializeVision: { - propagate: ["refreshVision", "refreshTiles", "refreshLighting", "refreshLightSources", "refreshPrimary"]; - }; - refreshVision: { propagate: ["refreshVisionSources"] }; - initializeSounds: { propagate: ["refreshSounds"] }; - refreshSounds: {}; - refreshTiles: { propagate: ["refreshLightSources", "refreshVisionSources"] }; - soundFadeDuration: {}; - identifyInteriorWalls: { propagate: ["initializeLighting", "initializeVision"] }; - forceUpdateFog: { propagate: ["refreshVision"] }; + /** @defaultValue `{propagate: ["refreshLighting", "refreshVision"]}` */ + initializeLighting: RenderFlag; + + /** @defaultValue `{propagate: ["refreshLightSources"]}` */ + refreshLighting: RenderFlag; + + /** @defaultValue `{}` */ + refreshLightSources: RenderFlag; + + /** @defaultValue `{}` */ + refreshVisionSources: RenderFlag; + + /** @defaultValue `{}` */ + refreshPrimary: RenderFlag; + + /** @defaultValue `{propagate: ["refreshVision", "refreshTiles", "refreshLighting", "refreshLightSources", "refreshPrimary"]}` */ + initializeVision: RenderFlag; + + /** @defaultValue `{propagate: ["refreshVisionSources"]}` */ + refreshVision: RenderFlag; + + /** @defaultValue `{propagate: ["refreshSounds"]}` */ + initializeSounds: RenderFlag; + + /** @defaultValue `{}` */ + refreshSounds: RenderFlag; + + /** @defaultValue `{propagate: ["refreshLightSources", "refreshVisionSources"]}` */ + refreshTiles: RenderFlag; + + /** @defaultValue `{}` */ + soundFadeDuration: RenderFlag; + + /** @defaultValue `{propagate: ["initializeLighting", "initializeVision"]}` */ + identifyInteriorWalls: RenderFlag; + + /** @defaultValue `{propagate: ["refreshVision"]}` */ + forceUpdateFog: RenderFlag; }; static RENDER_FLAG_PRIORITY: "PERCEPTION"; diff --git a/src/foundry/client/pixi/perception/vision-mode.d.ts b/src/foundry/client/pixi/perception/vision-mode.d.ts index db5dd0cbc..01bb297d9 100644 --- a/src/foundry/client/pixi/perception/vision-mode.d.ts +++ b/src/foundry/client/pixi/perception/vision-mode.d.ts @@ -30,7 +30,7 @@ declare global { */ static override get _defaults(): Record; - /** @remarks "The value provided to a ShaderField must be an AbstractBaseShader subclass." */ + /** @remarks The value provided to a ShaderField must be an AbstractBaseShader subclass. */ override _cast(value: any): AbstractBaseShader | Error; } diff --git a/src/foundry/client/pixi/sources/rendered-source.d.ts b/src/foundry/client/pixi/sources/rendered-source.d.ts index 8c044c1f5..e791b31ab 100644 --- a/src/foundry/client/pixi/sources/rendered-source.d.ts +++ b/src/foundry/client/pixi/sources/rendered-source.d.ts @@ -128,9 +128,9 @@ declare global { */ get isPreview(): boolean; - protected override _initialize(data: Partial): void; + protected override _initialize(data: InexactPartial): void; - protected override _configure(changes: Partial): void; + protected override _configure(changes: InexactPartial): void; /** * Decide whether to render soft edges with a blur. From 8df4c560e334f6e85768c4722399ddb1ef926938 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Fri, 8 Dec 2023 10:28:09 -0800 Subject: [PATCH 64/75] More PointSourcePolygon updates --- src/foundry/client/pixi/core/shapes/source-polygon.d.ts | 2 +- src/foundry/client/pixi/perception/clockwise-sweep.d.ts | 2 +- src/foundry/client/pixi/sources/movement-source.d.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts index 78d9f4241..277be2667 100644 --- a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts +++ b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts @@ -210,7 +210,7 @@ declare global { protected abstract _testCollision( ray: Ray, mode: Mode, - ): Mode extends "any" ? boolean : Mode extends "closest" ? PolygonVertex : PolygonVertex[] | null; + ): PointSourcePolygon.TestCollision; /** * Visualize the polygon, displaying its computed area, rays, and collision points diff --git a/src/foundry/client/pixi/perception/clockwise-sweep.d.ts b/src/foundry/client/pixi/perception/clockwise-sweep.d.ts index 7357f3162..e1c5023c5 100644 --- a/src/foundry/client/pixi/perception/clockwise-sweep.d.ts +++ b/src/foundry/client/pixi/perception/clockwise-sweep.d.ts @@ -154,7 +154,7 @@ declare global { protected override _testCollision( ray: Ray, mode: Mode, - ): Mode extends "any" ? boolean : Mode extends "closest" ? PolygonVertex : PolygonVertex[] | null; + ): PointSourcePolygon.TestCollision; override visualize(): PIXI.Graphics | undefined; diff --git a/src/foundry/client/pixi/sources/movement-source.d.ts b/src/foundry/client/pixi/sources/movement-source.d.ts index b53a49a34..e08db80ac 100644 --- a/src/foundry/client/pixi/sources/movement-source.d.ts +++ b/src/foundry/client/pixi/sources/movement-source.d.ts @@ -4,10 +4,10 @@ declare global { class MovementSource extends PointSource { static override sourceType: "move"; - /** @remarks Not implemented */ + /** @remarks A no-op */ protected _refresh(): void; - /** @remarks Not implemented */ + /** @remarks A no-op */ protected _destroy(): void; } } From 0b5087e661ac90e27d176a1503f627ee612d23f1 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Fri, 8 Dec 2023 10:46:00 -0800 Subject: [PATCH 65/75] More VisionMode updates --- src/foundry/client/pixi/sources/vision-source.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/foundry/client/pixi/sources/vision-source.d.ts b/src/foundry/client/pixi/sources/vision-source.d.ts index 69f60790c..08d448271 100644 --- a/src/foundry/client/pixi/sources/vision-source.d.ts +++ b/src/foundry/client/pixi/sources/vision-source.d.ts @@ -45,9 +45,9 @@ declare global { /** * The unconstrained LOS polygon. + * @privateRemarks This is actually a true property and the getter in PointSource will be deprecated in v13 */ - // @ts-expect-error Getter this is overriding will be replaced in v13 - los: PointSourcePolygon; + get los(): PointSourcePolygon; /** The constrained LOS polygon that is generated by the origin and radius of this source. */ get fov(): PointSourcePolygon | PIXI.Polygon; @@ -104,8 +104,10 @@ declare global { /** * TODO: Replace any with the type inherited from _configureLayer + * ``` * const vmUniforms = this.visionMode.vision[layerId].uniforms; * layer.vmUniforms = Object.entries(vmUniforms); + * ``` */ /** From 99748ff1c2a8bcf66b51c12b643ee1079a167f7d Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 18 Dec 2023 11:39:53 -0800 Subject: [PATCH 66/75] Added mixin type --- src/types/utils.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/types/utils.d.ts b/src/types/utils.d.ts index 1fce65af3..2cf33396f 100644 --- a/src/types/utils.d.ts +++ b/src/types/utils.d.ts @@ -141,3 +141,11 @@ type PropertyTypeOrFallback = Key extends keyof * Makes the given keys `K` of the type `T` required */ type RequiredProps = Required> & Omit; + +type Mixin< + MixinClass extends new (...args: any[]) => any, + BaseClass extends abstract new (...args: any[]) => any, +> = Pick & + Pick & { + new (...args: ConstructorParameters): InstanceType & InstanceType; + }; From 82f0b0fd1f3604e18f51c221e59a00ad15b14698 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 18 Dec 2023 11:55:02 -0800 Subject: [PATCH 67/75] Adjusted RenderFlagsMixin class --- .../pixi/core/interaction/render-flags.d.ts | 81 +++++++++---------- 1 file changed, 38 insertions(+), 43 deletions(-) diff --git a/src/foundry/client/pixi/core/interaction/render-flags.d.ts b/src/foundry/client/pixi/core/interaction/render-flags.d.ts index 49c318979..2d8181cf5 100644 --- a/src/foundry/client/pixi/core/interaction/render-flags.d.ts +++ b/src/foundry/client/pixi/core/interaction/render-flags.d.ts @@ -1,5 +1,41 @@ export {}; +/** + * Add RenderFlags functionality to some other object. + * This mixin standardizes the interface for such functionality. + * @remarks Actually a function `RenderFlagsMixin(Base)` + * @param Base - The base class being mixed + * @returns The mixed class definition + */ +declare class RenderFlagObject { + constructor(...args: any[]); + + /** + * Configure the render flags used for this class. + * @defaultValue `{}` + */ + static RENDER_FLAGS: Record>; + + /** + * The ticker priority when RenderFlags of this class are handled. + * Valid values are OBJECTS or PERCEPTION. + * @defaultValue "OBJECTS" + */ + static RENDER_FLAG_PRIORITY: "OBJECTS" | "PERCEPTION"; + + /** + * Status flags which are applied at render-time to update the PlaceableObject. + * If an object defines RenderFlags, it should at least include flags for "redraw" and "refresh". + */ + renderFlags: RenderFlags; + + /** + * Apply any current render flags, clearing the renderFlags set. + * Subclasses should override this method to define behavior. + */ + applyRenderFlags(): void; +} + declare global { /** @privateRemarks Values are marked as optional here based on use, foundry docs incomplete */ type RenderFlag = { @@ -51,48 +87,7 @@ declare global { set(changes: Record): void; } - /** - * Add RenderFlags functionality to some other object. - * This mixin standardizes the interface for such functionality. - * @remarks Actually a function `RenderFlagsMixin(Base)` - * @param Base - The base class being mixed - * @returns The mixed class definition - */ - class RenderFlagObject { - constructor(...args: any[]); - - /** - * Configure the render flags used for this class. - * @defaultValue `{}` - */ - static RENDER_FLAGS: Record>; - - /** - * The ticker priority when RenderFlags of this class are handled. - * Valid values are OBJECTS or PERCEPTION. - * @defaultValue "OBJECTS" - */ - static RENDER_FLAG_PRIORITY: "OBJECTS" | "PERCEPTION"; - - /** - * Status flags which are applied at render-time to update the PlaceableObject. - * If an object defines RenderFlags, it should at least include flags for "redraw" and "refresh". - */ - renderFlags: RenderFlags; - - /** - * Apply any current render flags, clearing the renderFlags set. - * Subclasses should override this method to define behavior. - */ - applyRenderFlags(): void; - } - - function RenderFlagsMixin any>( + function RenderFlagsMixin any>( Base: BaseClass, - ): Pick & - typeof RenderFlagObject & { - new ( - ...args: ConstructorParameters - ): InstanceType & RenderFlagObject; - }; + ): Mixin; } From 015aeaf7274ab04f20f42326938b77c916ba9e9c Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 18 Dec 2023 14:13:14 -0800 Subject: [PATCH 68/75] Removed generic animation return value --- src/foundry/client/pixi/sources/rendered-source.d.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/foundry/client/pixi/sources/rendered-source.d.ts b/src/foundry/client/pixi/sources/rendered-source.d.ts index e791b31ab..4a43226fc 100644 --- a/src/foundry/client/pixi/sources/rendered-source.d.ts +++ b/src/foundry/client/pixi/sources/rendered-source.d.ts @@ -16,15 +16,12 @@ declare global { } namespace RenderedPointSource { - type RenderedPointSourceAnimationConfig = InexactPartial<{ + type RenderedPointSourceAnimationConfig = InexactPartial<{ /** The human-readable (localized) label for the animation */ label: string; /** The animation function that runs every frame */ - animation: ( - dt: number, - options: InexactPartial>, - ) => AnimationValue; + animation: (dt: number, options: RenderedPointSourceAnimationConfig) => number; /** A custom illumination shader used by this animation */ illuminationShader: AdaptiveIlluminationShader; @@ -56,7 +53,7 @@ declare global { }; } - class RenderedPointSource extends PointSource { + class RenderedPointSource extends PointSource { /** * Keys of the data object which require shaders to be re-initialized. */ @@ -77,7 +74,7 @@ declare global { * The animation configuration applied to this source * @defaultValue `{}` */ - animation: Partial>; + animation: RenderedPointSource.RenderedPointSourceAnimationConfig; /** * The object of data which configures how the source is rendered From cbd99f70be45298515f5052ed384ca4734a32bdb Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 18 Dec 2023 14:32:50 -0800 Subject: [PATCH 69/75] Significant cleanup --- .../client/pixi/core/interaction/ping.d.ts | 1 - .../pixi/core/interaction/pings/chevron.d.ts | 2 -- .../pixi/core/interaction/pings/pulse.d.ts | 4 ---- .../pixi/core/interaction/render-flags.d.ts | 1 - .../pixi/core/shapes/source-polygon.d.ts | 1 - .../pixi/perception/clockwise-sweep.d.ts | 2 -- .../pixi/perception/detection-mode.d.ts | 23 +++++++++---------- .../client/pixi/perception/vision-mode.d.ts | 9 ++++---- .../client/pixi/sources/light-source.d.ts | 7 +++--- .../client/pixi/sources/rendered-source.d.ts | 1 - .../client/pixi/sources/vision-source.d.ts | 12 ++++------ 11 files changed, 22 insertions(+), 41 deletions(-) diff --git a/src/foundry/client/pixi/core/interaction/ping.d.ts b/src/foundry/client/pixi/core/interaction/ping.d.ts index aacb65b5d..14e002959 100644 --- a/src/foundry/client/pixi/core/interaction/ping.d.ts +++ b/src/foundry/client/pixi/core/interaction/ping.d.ts @@ -43,7 +43,6 @@ declare global { _color: Color | number; - /** {@inheritdoc} */ destroy(options?: Record): void; /** diff --git a/src/foundry/client/pixi/core/interaction/pings/chevron.d.ts b/src/foundry/client/pixi/core/interaction/pings/chevron.d.ts index 42fc6ef20..3e7c8ea84 100644 --- a/src/foundry/client/pixi/core/interaction/pings/chevron.d.ts +++ b/src/foundry/client/pixi/core/interaction/pings/chevron.d.ts @@ -47,10 +47,8 @@ declare global { */ protected static _CHEVRON_PATH: "icons/pings/chevron.webp"; - /** {@inheritdoc} */ override animate(): Promise; - /** {@inheritdoc} */ override _animateFrame(dt: number, animation: CanvasAnimationData): void; /** diff --git a/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts b/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts index 5cc238214..d64a8b08b 100644 --- a/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts +++ b/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts @@ -56,10 +56,8 @@ declare global { */ protected _computeTimeSlices(): void; - /** {@inheritdoc} */ override animate(): Promise; - /** {@inheritdoc} */ override _animateFrame(dt: number, animation: CanvasAnimationData): void; /** @@ -102,7 +100,6 @@ declare global { }, ); - /** {@inheritdoc} */ protected override _drawShape(g: PIXI.Graphics, color: number, alph: number, size: number): void; } @@ -116,7 +113,6 @@ declare global { */ constructor(origin: PIXI.Point, options: PulsePingOptions); - /** {@inheritdoc} */ protected override _drawShape(g: PIXI.Graphics, color: number, alph: number, size: number): void; } } diff --git a/src/foundry/client/pixi/core/interaction/render-flags.d.ts b/src/foundry/client/pixi/core/interaction/render-flags.d.ts index 2d8181cf5..e0cb25561 100644 --- a/src/foundry/client/pixi/core/interaction/render-flags.d.ts +++ b/src/foundry/client/pixi/core/interaction/render-flags.d.ts @@ -70,7 +70,6 @@ declare global { ); /** - * {@inheritDoc} * @returns The flags which were previously set that have been cleared. */ clear(): Record; diff --git a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts index 277be2667..ac1ac9374 100644 --- a/src/foundry/client/pixi/core/shapes/source-polygon.d.ts +++ b/src/foundry/client/pixi/core/shapes/source-polygon.d.ts @@ -162,7 +162,6 @@ declare global { intersectionOptions?: Record, ): PointSourcePolygon; - /** {@inheritDoc} */ contains(x: number, y: number): boolean; /** diff --git a/src/foundry/client/pixi/perception/clockwise-sweep.d.ts b/src/foundry/client/pixi/perception/clockwise-sweep.d.ts index e1c5023c5..fa197e6fd 100644 --- a/src/foundry/client/pixi/perception/clockwise-sweep.d.ts +++ b/src/foundry/client/pixi/perception/clockwise-sweep.d.ts @@ -31,10 +31,8 @@ declare global { //@ts-expect-error Getter/setter routine is deprecated functionality as of v11, removed in v13 rays: PolygonRay[]; - /** {@inheritdoc} */ override initialize(origin: Point, config: PointSourcePolygonConfig): void; - /** {@inheritDoc} */ clone(): ClockwiseSweepPolygon; protected override _compute(): void; diff --git a/src/foundry/client/pixi/perception/detection-mode.d.ts b/src/foundry/client/pixi/perception/detection-mode.d.ts index bfe093b6e..ea29b521b 100644 --- a/src/foundry/client/pixi/perception/detection-mode.d.ts +++ b/src/foundry/client/pixi/perception/detection-mode.d.ts @@ -12,7 +12,7 @@ type TokenDetectionMode = { // TODO: Move to client/pixi/layers/effects/visibility.js type CanvasVisibilityTest = { point: PIXI.Point; - los: Map, boolean>; + los: Map; }; type CanvasVisibilityTestConfig = { object: PlaceableObject; @@ -33,7 +33,6 @@ declare global { * A token could have multiple detection modes. */ class DetectionMode extends foundry.abstract.DataModel { - /** {@inheritDoc} */ static defineSchema(): any; /** @@ -75,7 +74,7 @@ declare global { * @returns Is the test target visible? */ testVisibility( - visionSource: VisionSource, + visionSource: VisionSource, mode: TokenDetectionMode, { object, tests }: CanvasVisibilityTestConfig, ): boolean; @@ -87,7 +86,7 @@ declare global { * @param target - The target object being tested * @returns Can the target object theoretically be detected by this vision source? */ - protected _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; + protected _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; /** * Evaluate a single test point to confirm whether it is visible. @@ -98,7 +97,7 @@ declare global { * @param test - The test case being evaluated */ protected _testPoint( - visionSource: VisionSource, + visionSource: VisionSource, mode: TokenDetectionMode, target: PlaceableObject, test: CanvasVisibilityTest, @@ -115,7 +114,7 @@ declare global { * @returns Is the LOS requirement satisfied for this test? */ protected _testLOS( - visionSource: VisionSource, + visionSource: VisionSource, mode: TokenDetectionMode, target: PlaceableObject, test: CanvasVisibilityTest, @@ -130,7 +129,7 @@ declare global { * @returns Is the point within the vision angle? */ protected _testAngle( - visionSource: VisionSource, + visionSource: VisionSource, mode: TokenDetectionMode, target: PlaceableObject, test: CanvasVisibilityTest, @@ -145,7 +144,7 @@ declare global { * @returns Is the target within range? */ protected _testRange( - visionSource: VisionSource, + visionSource: VisionSource, mode: TokenDetectionMode, target: PlaceableObject, test: CanvasVisibilityTest, @@ -159,7 +158,7 @@ declare global { */ class DetectionModeBasicSight extends DetectionMode { override _testPoint( - visionSource: VisionSource, + visionSource: VisionSource, mode: TokenDetectionMode, target: PlaceableObject, test: CanvasVisibilityTest, @@ -175,7 +174,7 @@ declare global { class DetectionModeInvisibility extends DetectionMode { static override getDetectionFilter(): PIXI.Filter | undefined; - protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; + protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; } /** @@ -184,7 +183,7 @@ declare global { class DetectionModeTremor extends DetectionMode { static override getDetectionFilter(): PIXI.Filter | undefined; - protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; + protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; } /** @@ -194,6 +193,6 @@ declare global { class DetectionModeAll extends DetectionMode { static override getDetectionFilter(): PIXI.Filter | undefined; - protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; + protected override _canDetect(visionSource: VisionSource, target: PlaceableObject): boolean; } } diff --git a/src/foundry/client/pixi/perception/vision-mode.d.ts b/src/foundry/client/pixi/perception/vision-mode.d.ts index 01bb297d9..f2e0e8d54 100644 --- a/src/foundry/client/pixi/perception/vision-mode.d.ts +++ b/src/foundry/client/pixi/perception/vision-mode.d.ts @@ -46,7 +46,6 @@ declare global { */ constructor(data: Partial, options?: object); - /** {@inheritDoc} */ static defineSchema(): any; /** The lighting illumination levels which are supported. */ @@ -81,25 +80,25 @@ declare global { * Special activation handling that could be implemented by VisionMode subclasses * @param source - Activate this VisionMode for a specific source */ - abstract _activate(source: VisionSource): void; + abstract _activate(source: VisionSource): void; /** * Special deactivation handling that could be implemented by VisionMode subclasses * @param source - Deactivate this VisionMode for a specific source */ - abstract _deactivate(source: VisionSource): void; + abstract _deactivate(source: VisionSource): void; /** * Special handling which is needed when this Vision Mode is activated for a VisionSource. * @param source - Activate this VisionMode for a specific source */ - activate(source: VisionSource): void; + activate(source: VisionSource): void; /** * Special handling which is needed when this Vision Mode is deactivated for a VisionSource. * @param source - Deactivate this VisionMode for a specific source */ - deactivate(source: VisionSource): void; + deactivate(source: VisionSource): void; /** * An animation function which runs every frame while this Vision Mode is active. diff --git a/src/foundry/client/pixi/sources/light-source.d.ts b/src/foundry/client/pixi/sources/light-source.d.ts index 54d635d0d..fb6b17212 100644 --- a/src/foundry/client/pixi/sources/light-source.d.ts +++ b/src/foundry/client/pixi/sources/light-source.d.ts @@ -15,7 +15,7 @@ declare global { * An animation configuration for the source * @defaultValue `{}` */ - animation: RenderedPointSource.RenderedPointSourceAnimationConfig; + animation: RenderedPointSource.RenderedPointSourceAnimationConfig; /** * The allowed radius of bright vision or illumination @@ -75,8 +75,7 @@ declare global { /** * A specialized subclass of the PointSource abstraction which is used to control the rendering of light sources. */ - class LightSource extends RenderedPointSource { - /** {@inheritdoc} */ + class LightSource extends RenderedPointSource { static override sourceType: "light"; protected static _initializeShaderKeys: ["animation.type", "walls"]; @@ -248,7 +247,7 @@ declare global { /** * A specialized subclass of the LightSource which is used to render global light source linked to the scene. */ - class GlobalLightSource extends LightSource { + class GlobalLightSource extends LightSource { override _createPolygon(): PIXI.Polygon; protected override _configureSoftEdges(): void; diff --git a/src/foundry/client/pixi/sources/rendered-source.d.ts b/src/foundry/client/pixi/sources/rendered-source.d.ts index 4a43226fc..127b300a5 100644 --- a/src/foundry/client/pixi/sources/rendered-source.d.ts +++ b/src/foundry/client/pixi/sources/rendered-source.d.ts @@ -167,7 +167,6 @@ declare global { override _refresh(): void; - /** {@inheritDoc} */ protected _isActive(): boolean; /** diff --git a/src/foundry/client/pixi/sources/vision-source.d.ts b/src/foundry/client/pixi/sources/vision-source.d.ts index 08d448271..3211fb042 100644 --- a/src/foundry/client/pixi/sources/vision-source.d.ts +++ b/src/foundry/client/pixi/sources/vision-source.d.ts @@ -1,8 +1,5 @@ export {}; -// TODO: Define in client/pixi/perception/vision-mode -type VisionMode = unknown; - // TODO: Define in client/pixi/webgl/shaders/effects/vision type AdaptiveVisionShader = unknown; @@ -10,7 +7,7 @@ declare global { /** * A specialized subclass of the PointSource abstraction which is used to control the rendering of vision sources. */ - class VisionSource extends RenderedPointSource { + class VisionSource extends RenderedPointSource { static override sourceType: "sight"; static override _refreshUniformsKeys: [ @@ -68,7 +65,6 @@ declare global { /** Responsible for assigning the Vision Mode and handling exceptions based on vision special status. */ protected _initializeVisionMode(): void; - /** {@inheritdoc} */ override _getPolygonConfiguration(): PointSourcePolygonConfig; /** Create a restricted FOV polygon by limiting the radius of the unrestricted LOS polygon. */ @@ -103,8 +99,8 @@ declare global { _updateCommonUniforms(shader: AdaptiveVisionShader): void; /** - * TODO: Replace any with the type inherited from _configureLayer - * ``` + * TODO: Replace unknown with the type inherited from _configureLayer + * ```ts * const vmUniforms = this.visionMode.vision[layerId].uniforms; * layer.vmUniforms = Object.entries(vmUniforms); * ``` @@ -118,7 +114,7 @@ declare global { */ _updateVisionModeUniforms( shader: AdaptiveVisionShader, - vmUniforms: Array }>>, + vmUniforms: Array }>>, ): void; } From 4cb52cef15ca9458676b503dca5b3efc0f0a707b Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 18 Dec 2023 14:34:20 -0800 Subject: [PATCH 70/75] Removed remaining generic references --- src/foundry/client/core/hooks.d.ts | 2 +- src/foundry/client/pixi/layers/lighting.d.ts | 4 ++-- src/foundry/client/pixi/placeables/light.d.ts | 2 +- src/foundry/client/pixi/placeables/token.d.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/foundry/client/core/hooks.d.ts b/src/foundry/client/core/hooks.d.ts index c34cc2455..ecd57b400 100644 --- a/src/foundry/client/core/hooks.d.ts +++ b/src/foundry/client/core/hooks.d.ts @@ -444,7 +444,7 @@ declare global { * @remarks This is called by {@link Hooks.callAll}. * @see {@link LightSource#_initializeShaders} */ - initializeLightSourceShaders: (source: LightSource) => void; + initializeLightSourceShaders: (source: LightSource) => void; /** * A hook event that fires when the LightingLayer is refreshed. diff --git a/src/foundry/client/pixi/layers/lighting.d.ts b/src/foundry/client/pixi/layers/lighting.d.ts index ceb78ea78..f503d8320 100644 --- a/src/foundry/client/pixi/layers/lighting.d.ts +++ b/src/foundry/client/pixi/layers/lighting.d.ts @@ -20,7 +20,7 @@ declare class LightingLayer extends PlaceablesLayer<"AmbientLight", LightingLaye /** * A mapping of light sources which are active within the rendered Scene */ - sources: foundry.utils.Collection>; + sources: foundry.utils.Collection; /** * Increment this whenever lighting channels are re-configured. @@ -63,7 +63,7 @@ declare class LightingLayer extends PlaceablesLayer<"AmbientLight", LightingLaye * An array of light sources which are currently animated * @internal */ - protected _animatedSources: LightSource[]; + protected _animatedSources: LightSource[]; /** * A mapping of different light level channels diff --git a/src/foundry/client/pixi/placeables/light.d.ts b/src/foundry/client/pixi/placeables/light.d.ts index 357c67f44..8d7a2b5c0 100644 --- a/src/foundry/client/pixi/placeables/light.d.ts +++ b/src/foundry/client/pixi/placeables/light.d.ts @@ -11,7 +11,7 @@ declare global { /** * A reference to the PointSource object which defines this light source area of effect */ - source: LightSource; + source: LightSource; /** * A reference to the ControlIcon used to configure this light diff --git a/src/foundry/client/pixi/placeables/token.d.ts b/src/foundry/client/pixi/placeables/token.d.ts index 9722b22ca..98fe26de0 100644 --- a/src/foundry/client/pixi/placeables/token.d.ts +++ b/src/foundry/client/pixi/placeables/token.d.ts @@ -36,12 +36,12 @@ declare global { /** * A reference to the VisionSource object which defines this vision source area of effect */ - vision: VisionSource; + vision: VisionSource; /** * A reference to the LightSource object which defines this light source area of effect */ - light: LightSource; + light: LightSource; /** * A linked ObjectHUD element which is synchronized with the location and visibility of this Token From 0324870ca344096f80c9bbde832ed1de5754feca Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 18 Dec 2023 15:32:59 -0800 Subject: [PATCH 71/75] Updated typings on render flags, condensed PIXI --- .../pixi/core/interaction/render-flags.d.ts | 10 +++- src/types/augments/index.d.ts | 6 +- src/types/augments/pixi.d.ts | 60 +++++++++++++++++++ src/types/augments/pixiGlobal.d.ts | 7 --- src/types/augments/pixiGraphicsSmooth.d.ts | 7 --- src/types/augments/pixiLegacyGraphics.d.ts | 12 ---- src/types/augments/pixiParticleEmitter.d.ts | 7 --- 7 files changed, 69 insertions(+), 40 deletions(-) create mode 100644 src/types/augments/pixi.d.ts delete mode 100644 src/types/augments/pixiGlobal.d.ts delete mode 100644 src/types/augments/pixiGraphicsSmooth.d.ts delete mode 100644 src/types/augments/pixiLegacyGraphics.d.ts delete mode 100644 src/types/augments/pixiParticleEmitter.d.ts diff --git a/src/foundry/client/pixi/core/interaction/render-flags.d.ts b/src/foundry/client/pixi/core/interaction/render-flags.d.ts index e0cb25561..3c11c683c 100644 --- a/src/foundry/client/pixi/core/interaction/render-flags.d.ts +++ b/src/foundry/client/pixi/core/interaction/render-flags.d.ts @@ -49,7 +49,7 @@ declare global { * A data structure for tracking a set of boolean status flags. * This is a restricted set which can only accept flag values which are pre-defined. */ - class RenderFlags extends Set { + class RenderFlags extends Set { /** * @param flags - An object which defines the flags which are supported for tracking * @param config - Optional configuration @@ -65,10 +65,16 @@ declare global { * Valid options are OBJECTS or PERCEPTION. * @defaultValue `PIXI.UPDATE_PRIORITY.OBJECTS` */ - priority?: "OBJECT" | "PERCEPTION"; + priority?: PIXI.UPDATE_PRIORITY.OBJECTS | PIXI.UPDATE_PRIORITY.PERCEPTION; }, ); + readonly flags: Record>>; + + readonly object: RenderFlagObject; + + readonly priority: "OBJECT" | "PERCEPTION"; + /** * @returns The flags which were previously set that have been cleared. */ diff --git a/src/types/augments/index.d.ts b/src/types/augments/index.d.ts index f83ca434a..8d7314942 100644 --- a/src/types/augments/index.d.ts +++ b/src/types/augments/index.d.ts @@ -1,8 +1,4 @@ -import "./pixiGlobal"; -import "./pixiGraphics"; -import "./pixiGraphicsSmooth"; -import "./pixiLegacyGraphics"; -import "./pixiParticleEmitter"; +import "./pixi"; import "./simple-peer"; import "./socket.io-client"; import "./tinyMCE"; diff --git a/src/types/augments/pixi.d.ts b/src/types/augments/pixi.d.ts new file mode 100644 index 000000000..6a9752e1d --- /dev/null +++ b/src/types/augments/pixi.d.ts @@ -0,0 +1,60 @@ +import * as PIXI from "pixi.js"; +import * as pixiParticles from "@pixi/particle-emitter"; +import * as graphicsSmooth from "@pixi/graphics-smooth"; + +/** + * Foundry exports PIXI into the global namespace + */ +export = PIXI; +export as namespace PIXI; + +declare global { + namespace PIXI { + export import smooth = graphicsSmooth; + export import particles = pixiParticles; + + export const LegacyGraphics: typeof PIXI.Graphics; + export class Graphics extends PIXI.smooth.SmoothGraphics {} + + enum UPDATE_PRIORITY { + /** + * Highest priority used for interaction events in {@link PIXI.EventSystem} + * @defaultValue 50 + */ + INTERACTION = 50, + /** + * High priority updating, used by {@link PIXI.AnimatedSprite} + * @defaultValue 25 + */ + HIGH = 25, + + /** + * @remarks Foundry defined custom ticker priority + * Handled in Canvas##activateTicker + */ + OBJECTS = 23, + + /** + * @remarks Foundry defined custom ticker priority + * Handled in Canvas##activateTicker + */ + PERCEPTION = 2, + + /** + * defaultValue priority for ticker events, see {@link PIXI.Ticker#add}. + * @defaultValue 0 + */ + NORMAL = 0, + /** + * Low priority used for {@link PIXI.Application} rendering. + * @defaultValue -25 + */ + LOW = -25, + /** + * Lowest priority used for {@link PIXI.BasePrepare} utility. + * @defaultValue -50 + */ + UTILITY = -50, + } + } +} diff --git a/src/types/augments/pixiGlobal.d.ts b/src/types/augments/pixiGlobal.d.ts deleted file mode 100644 index 631717273..000000000 --- a/src/types/augments/pixiGlobal.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import * as PIXI from "pixi.js"; - -/** - * Foundry exports PIXI into the global namespace - */ -export = PIXI; -export as namespace PIXI; diff --git a/src/types/augments/pixiGraphicsSmooth.d.ts b/src/types/augments/pixiGraphicsSmooth.d.ts deleted file mode 100644 index 34d9d0c6a..000000000 --- a/src/types/augments/pixiGraphicsSmooth.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import * as graphicsSmooth from "@pixi/graphics-smooth"; - -declare global { - namespace PIXI { - export import smooth = graphicsSmooth; - } -} diff --git a/src/types/augments/pixiLegacyGraphics.d.ts b/src/types/augments/pixiLegacyGraphics.d.ts deleted file mode 100644 index 9d2d65cef..000000000 --- a/src/types/augments/pixiLegacyGraphics.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -declare global { - namespace PIXI { - /** - * @privateRemarks Unclear if this const isn't just pointing back to the freshly declared Graphics class - * Trying to replicate the handling in head.js - */ - export const LegacyGraphics: PIXI.Graphics; - export class Graphics extends PIXI.smooth.SmoothGraphics {} - } -} - -export {}; diff --git a/src/types/augments/pixiParticleEmitter.d.ts b/src/types/augments/pixiParticleEmitter.d.ts deleted file mode 100644 index c7e75ec96..000000000 --- a/src/types/augments/pixiParticleEmitter.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import * as pixiParticles from "@pixi/particle-emitter"; - -declare global { - namespace PIXI { - export import particles = pixiParticles; // eslint-disable-line @typescript-eslint/no-unused-vars - } -} From a0770399bc91354ee70d9966ac814f198d6be4d7 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 18 Dec 2023 15:34:29 -0800 Subject: [PATCH 72/75] Cleaned up return type --- src/foundry/client/pixi/sources/rendered-source.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/foundry/client/pixi/sources/rendered-source.d.ts b/src/foundry/client/pixi/sources/rendered-source.d.ts index 127b300a5..5e69b1fa5 100644 --- a/src/foundry/client/pixi/sources/rendered-source.d.ts +++ b/src/foundry/client/pixi/sources/rendered-source.d.ts @@ -191,7 +191,7 @@ declare global { * @param dt - Delta time. * @remarks Returns `this.animation.animation.call(this, dt, options)` */ - animate(dt: number): ReturnType> | undefined; + animate(dt: number): number | undefined; /** * Generic time-based animation used for Rendered Point Sources. From a8380aedfa7c726d506443f6728a336fd583de47 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 18 Dec 2023 15:44:58 -0800 Subject: [PATCH 73/75] Some Unknown removal --- src/foundry/client/pixi/core/interaction/ping.d.ts | 4 +++- src/foundry/client/pixi/core/interaction/pings/pulse.d.ts | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/foundry/client/pixi/core/interaction/ping.d.ts b/src/foundry/client/pixi/core/interaction/ping.d.ts index 14e002959..2ae6da47a 100644 --- a/src/foundry/client/pixi/core/interaction/ping.d.ts +++ b/src/foundry/client/pixi/core/interaction/ping.d.ts @@ -1,3 +1,5 @@ +import type { IDestroyOptions } from "pixi.js"; + export {}; // TODO: Remove once color export is fixed @@ -43,7 +45,7 @@ declare global { _color: Color | number; - destroy(options?: Record): void; + destroy(options?: IDestroyOptions | boolean): void; /** * Start the ping animation. diff --git a/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts b/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts index d64a8b08b..80ab060c5 100644 --- a/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts +++ b/src/foundry/client/pixi/core/interaction/pings/pulse.d.ts @@ -1,7 +1,6 @@ -export {}; +import Color from "../../../../../common/utils/color.mjs"; -// TODO: Remove once color export is fixed -type Color = number; +export {}; declare global { interface PulsePingOptions extends PingOptions { From 174bd207abd24e2701038c2d5779806f45bcbc50 Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 18 Dec 2023 16:16:10 -0800 Subject: [PATCH 74/75] Fixed Uniform typing --- src/foundry/client/pixi/sources/vision-source.d.ts | 2 +- tests/foundry/client/pixi/sources/Vision.test-d.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 tests/foundry/client/pixi/sources/Vision.test-d.ts diff --git a/src/foundry/client/pixi/sources/vision-source.d.ts b/src/foundry/client/pixi/sources/vision-source.d.ts index 3211fb042..d9ad3d465 100644 --- a/src/foundry/client/pixi/sources/vision-source.d.ts +++ b/src/foundry/client/pixi/sources/vision-source.d.ts @@ -114,7 +114,7 @@ declare global { */ _updateVisionModeUniforms( shader: AdaptiveVisionShader, - vmUniforms: Array }>>, + vmUniforms: Array<[uniform: string, value: AbstractBaseShader.UniformValue]>, ): void; } diff --git a/tests/foundry/client/pixi/sources/Vision.test-d.ts b/tests/foundry/client/pixi/sources/Vision.test-d.ts new file mode 100644 index 000000000..5eebac16f --- /dev/null +++ b/tests/foundry/client/pixi/sources/Vision.test-d.ts @@ -0,0 +1,3 @@ +const myVision = new VisionSource(); + +myVision._updateVisionModeUniforms({}, [["myUniform", 3]]); From 64f38ec300471408ab289c3d4893b012e81cb15b Mon Sep 17 00:00:00 2001 From: JPMeehan Date: Mon, 18 Dec 2023 16:17:09 -0800 Subject: [PATCH 75/75] Removed TODO --- src/foundry/client/pixi/sources/vision-source.d.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/foundry/client/pixi/sources/vision-source.d.ts b/src/foundry/client/pixi/sources/vision-source.d.ts index d9ad3d465..1dd839b48 100644 --- a/src/foundry/client/pixi/sources/vision-source.d.ts +++ b/src/foundry/client/pixi/sources/vision-source.d.ts @@ -98,14 +98,6 @@ declare global { */ _updateCommonUniforms(shader: AdaptiveVisionShader): void; - /** - * TODO: Replace unknown with the type inherited from _configureLayer - * ```ts - * const vmUniforms = this.visionMode.vision[layerId].uniforms; - * layer.vmUniforms = Object.entries(vmUniforms); - * ``` - */ - /** * Update layer uniforms according to vision mode uniforms, if any. * @param shader - The shader being updated.