Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Cleanup core dependencies #8926

Merged
merged 1 commit into from Dec 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions packages/accessibility/test/AccessibilityManager.tests.ts
@@ -1,8 +1,7 @@
import { AccessibilityManager } from '@pixi/accessibility';
import { CanvasRenderer } from '@pixi/canvas-renderer';
import { DisplayObject, Container } from '@pixi/display';
import { Renderer } from '@pixi/core';
import { isMobile } from '@pixi/utils';
import { Renderer, utils } from '@pixi/core';

describe('AccessibilityManager', () =>
{
Expand All @@ -29,17 +28,17 @@ describe('AccessibilityManager', () =>

it('should remove touch hook when destroyed', () =>
{
const phone = isMobile.phone;
const phone = utils.isMobile.phone;

isMobile.phone = true;
utils.isMobile.phone = true;
const manager = new AccessibilityManager(undefined);
const hookDiv = manager['_hookDiv'];

expect(hookDiv).toBeInstanceOf(HTMLElement);
expect(document.body.contains(hookDiv)).toBe(true);
manager.destroy();
expect(document.body.contains(hookDiv)).toBe(false);
isMobile.phone = phone;
utils.isMobile.phone = phone;
});

it('should activate when tab is pressed and deactivate when mouse moved', () =>
Expand Down
3 changes: 1 addition & 2 deletions packages/app/src/Application.ts
@@ -1,9 +1,8 @@
import { autoDetectRenderer, extensions, ExtensionType } from '@pixi/core';
import { Container } from '@pixi/display';

import type { Rectangle, IRendererOptionsAuto, IRenderer } from '@pixi/core';
import type { ICanvas, IRendererOptionsAuto, IRenderer, Rectangle } from '@pixi/core';
import type { IDestroyOptions } from '@pixi/display';
import type { ICanvas } from '@pixi/settings';

/**
* Any plugin that's usable for Application should contain these methods.
Expand Down
3 changes: 1 addition & 2 deletions packages/canvas-extract/src/CanvasExtract.ts
@@ -1,9 +1,8 @@
import { Rectangle, extensions, ExtensionType, RenderTexture, utils } from '@pixi/core';

import type { CanvasRenderer } from '@pixi/canvas-renderer';
import type { BaseRenderTexture, ExtensionMetadata, ISystem } from '@pixi/core';
import type { BaseRenderTexture, ExtensionMetadata, ICanvas, ISystem } from '@pixi/core';
import type { DisplayObject } from '@pixi/display';
import type { ICanvas } from '@pixi/settings';

const TEMP_RECT = new Rectangle();

Expand Down
3 changes: 1 addition & 2 deletions packages/canvas-prepare/src/CanvasPrepare.ts
@@ -1,10 +1,9 @@
import { settings, BaseTexture, extensions, ExtensionType } from '@pixi/core';
import { BasePrepare } from '@pixi/prepare';

import type { ExtensionMetadata, IRenderer, ISystem } from '@pixi/core';
import type { ExtensionMetadata, ICanvas, ICanvasRenderingContext2D, IRenderer, ISystem } from '@pixi/core';
import type { CanvasRenderer } from '@pixi/canvas-renderer';
import type { IDisplayObjectExtended } from '@pixi/prepare';
import type { ICanvas, ICanvasRenderingContext2D } from '@pixi/settings';

const CANVAS_START_SIZE = 16;

Expand Down
3 changes: 1 addition & 2 deletions packages/canvas-renderer/src/CanvasContextSystem.ts
@@ -1,8 +1,7 @@
import { BLEND_MODES, SCALE_MODES, settings, Matrix, extensions, ExtensionType } from '@pixi/core';
import { mapCanvasBlendModesToPixi } from './utils/mapCanvasBlendModesToPixi';

import type { ExtensionMetadata, ISystem } from '@pixi/core';
import type { ICanvasRenderingContext2D } from '@pixi/settings';
import type { ExtensionMetadata, ICanvasRenderingContext2D, ISystem } from '@pixi/core';
import type { CanvasRenderer } from './CanvasRenderer';

const tempMatrix = new Matrix();
Expand Down
26 changes: 14 additions & 12 deletions packages/canvas-renderer/src/CanvasRenderer.ts
Expand Up @@ -9,24 +9,26 @@ import {
import type {
BLEND_MODES,
RENDERER_TYPE,
Matrix,
Rectangle,
BackgroundSystem,
ExtensionMetadata,
GenerateTextureSystem,
ICanvas,
ICanvasRenderingContext2D,
IGenerateTextureOptions,
IRenderableObject,
IRenderer,
IRendererOptions,
IRendererPlugins,
IRendererRenderOptions,
RenderTexture,
IRenderableObject,
GenerateTextureSystem,
IRenderer,
BackgroundSystem,
ViewSystem,
Matrix,
PluginSystem,
StartupSystem,
Rectangle,
RenderTexture,
StartupOptions,
ExtensionMetadata,
IGenerateTextureOptions } from '@pixi/core';
StartupSystem,
ViewSystem,
} from '@pixi/core';
import type { DisplayObject } from '@pixi/display';
import type { ICanvas, ICanvasRenderingContext2D } from '@pixi/settings';
import type { CanvasContextSystem, SmoothingEnabledProperties } from './CanvasContextSystem';
import type { CanvasMaskSystem } from './CanvasMaskSystem';
import type { CanvasObjectRendererSystem } from './CanvasObjectRendererSystem';
Expand Down
3 changes: 1 addition & 2 deletions packages/canvas-renderer/src/canvasUtils.ts
@@ -1,8 +1,7 @@
import { settings, utils } from '@pixi/core';
import { canUseNewCanvasBlendModes } from './utils/canUseNewCanvasBlendModes';

import type { Texture } from '@pixi/core';
import type { ICanvas } from '@pixi/settings';
import type { ICanvas, Texture } from '@pixi/core';

/**
* Utility methods for Sprite/Texture tinting.
Expand Down
@@ -1,6 +1,6 @@
import { settings } from '@pixi/core';

import type { ICanvas } from '@pixi/settings';
import type { ICanvas } from '@pixi/core';

/**
* Creates a little colored canvas
Expand Down
3 changes: 1 addition & 2 deletions packages/events/src/EventSystem.ts
Expand Up @@ -4,9 +4,8 @@ import { FederatedPointerEvent } from './FederatedPointerEvent';
import { FederatedWheelEvent } from './FederatedWheelEvent';
import { extensions, ExtensionType } from '@pixi/core';

import type { IRenderableObject, ExtensionMetadata, IPointData } from '@pixi/core';
import type { ExtensionMetadata, ICanvas, IPointData, IRenderableObject } from '@pixi/core';
import type { DisplayObject } from '@pixi/display';
import type { ICanvas } from '@pixi/settings';

const MOUSE_POINTER_ID = 1;
const TOUCH_TO_POINTER: Record<string, string> = {
Expand Down
3 changes: 1 addition & 2 deletions packages/extract/src/Extract.ts
@@ -1,8 +1,7 @@
import { Rectangle, utils, extensions, ExtensionType, RenderTexture } from '@pixi/core';

import type { ISystem, ExtensionMetadata, Renderer } from '@pixi/core';
import type { ExtensionMetadata, ICanvas, ISystem, Renderer } from '@pixi/core';
import type { DisplayObject } from '@pixi/display';
import type { ICanvas } from '@pixi/settings';

const TEMP_RECT = new Rectangle();
const BYTES_PER_PIXEL = 4;
Expand Down
11 changes: 9 additions & 2 deletions packages/mixin-cache-as-bitmap/src/index.ts
Expand Up @@ -3,9 +3,16 @@ import { Texture, BaseTexture, RenderTexture, Matrix, utils, settings } from '@p
import { Sprite } from '@pixi/sprite';
import { DisplayObject } from '@pixi/display';

import type { Renderer, MaskData, IRenderer, IPointData, Rectangle, MSAA_QUALITY } from '@pixi/core';
import type {
MSAA_QUALITY,
ICanvasRenderingContext2D,
IPointData,
IRenderer,
MaskData,
Rectangle,
Renderer,
} from '@pixi/core';
import type { Container, IDestroyOptions } from '@pixi/display';
import type { ICanvasRenderingContext2D } from '@pixi/settings';

// Don't import CanvasRender to remove dependency on this optional package
// this type should satisify these requirements for cacheAsBitmap types
Expand Down
5 changes: 2 additions & 3 deletions packages/spritesheet/test/spritesheetAsset.tests.ts
@@ -1,8 +1,7 @@
import type { CacheParser } from '@pixi/assets';
import { Cache, loadJson, loadTextures } from '@pixi/assets';
import { Texture } from '@pixi/core';
import { Texture, utils } from '@pixi/core';
import { spritesheetAsset, Spritesheet } from '@pixi/spritesheet';
import { clearTextureCache } from '@pixi/utils';
import { Loader } from '../../assets/src/loader/Loader';

describe('spritesheetAsset', () =>
Expand Down Expand Up @@ -86,7 +85,7 @@ describe('spritesheetAsset', () =>
it('should not create multipack resources when related_multi_packs field is missing or the wrong type', async () =>
{
// clear the caches only to avoid cluttering the output
clearTextureCache();
utils.clearTextureCache();

const spritesheet = await loader.load(`${serverPath}building1-1.json`) as Spritesheet;
const spritesheet2 = await loader.load(`${serverPath}atlas-multipack-wrong-type.json`) as Spritesheet;
Expand Down
2 changes: 1 addition & 1 deletion packages/text-bitmap/src/utils/drawGlyph.ts
@@ -1,8 +1,8 @@
import { generateFillStyle } from './generateFillStyle';
import { utils } from '@pixi/core';

import type { ICanvas, ICanvasRenderingContext2D } from '@pixi/core';
import type { TextMetrics, TextStyle } from '@pixi/text';
import type { ICanvas, ICanvasRenderingContext2D } from '@pixi/settings';

// TODO: Prevent code duplication b/w drawGlyph & Text#updateText

Expand Down
2 changes: 1 addition & 1 deletion packages/text-bitmap/src/utils/generateFillStyle.ts
@@ -1,7 +1,7 @@
import { TEXT_GRADIENT } from '@pixi/text';

import type { ICanvas, ICanvasRenderingContext2D } from '@pixi/core';
import type { TextStyle, TextMetrics } from '@pixi/text';
import type { ICanvas, ICanvasRenderingContext2D } from '@pixi/settings';

// TODO: Prevent code duplication b/w generateFillStyle & Text#generateFillStyle

Expand Down
3 changes: 1 addition & 2 deletions tools/integration-tests/test/Bounds.tests.ts
@@ -1,7 +1,6 @@
import { BaseRenderTexture, Rectangle, RenderTexture, Texture } from '@pixi/core';
import { Container } from '@pixi/display';
import { RenderTexture, BaseRenderTexture, Texture } from '@pixi/core';
import { Sprite } from '@pixi/sprite';
import { Rectangle } from '@pixi/math';
import { Graphics } from '@pixi/graphics';
import { Text } from '@pixi/text';

Expand Down
3 changes: 1 addition & 2 deletions tools/integration-tests/test/Container.tests.ts
@@ -1,7 +1,6 @@
import { MaskData, Transform } from '@pixi/core';
import { Container } from '@pixi/display';
import { Graphics } from '@pixi/graphics';
import { Transform } from '@pixi/math';
import { MaskData } from '@pixi/core';

import '@pixi/canvas-display';

Expand Down