Skip to content

Commit

Permalink
Merge pull request #519 from pixijs/518-bug-the-types-are-borked-in-b…
Browse files Browse the repository at this point in the history
…eta6

Fix the types
  • Loading branch information
trezy authored Aug 1, 2024
2 parents 4e71c18 + 5b1e15c commit 63dd479
Show file tree
Hide file tree
Showing 69 changed files with 199 additions and 199 deletions.
8 changes: 4 additions & 4 deletions src/components/Application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import {
useCallback,
useRef,
} from 'react';
import { createRoot } from '../core/createRoot.ts';
import { useIsomorphicLayoutEffect } from '../hooks/useIsomorphicLayoutEffect.ts';
import { createRoot } from '../core/createRoot';
import { useIsomorphicLayoutEffect } from '../hooks/useIsomorphicLayoutEffect';

import type { Application as PixiApplication } from 'pixi.js';
import type {
ForwardRefRenderFunction,
MutableRefObject,
} from 'react';
import type { ApplicationProps } from '../typedefs/ApplicationProps.ts';
import type { Root } from '../typedefs/Root.ts';
import type { ApplicationProps } from '../typedefs/ApplicationProps';
import type { Root } from '../typedefs/Root';

const originalDefaultTextStyle = { ...TextStyle.defaultTextStyle };

Expand Down
2 changes: 1 addition & 1 deletion src/components/Context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createContext } from 'react';

import type { ApplicationState } from '../typedefs/ApplicationState.ts';
import type { ApplicationState } from '../typedefs/ApplicationState';

export const Context = createContext<ApplicationState>({} as ApplicationState);

Expand Down
20 changes: 10 additions & 10 deletions src/core/createRoot.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { Application } from 'pixi.js';
import { createElement } from 'react';
import { ConcurrentRoot } from 'react-reconciler/constants.js';
import { ContextProvider } from '../components/Context.ts';
import { isReadOnlyProperty } from '../helpers/isReadOnlyProperty.ts';
import { log } from '../helpers/log.ts';
import { prepareInstance } from '../helpers/prepareInstance.ts';
import { reconciler } from './reconciler.ts';
import { roots } from './roots.ts';
import { ContextProvider } from '../components/Context';
import { isReadOnlyProperty } from '../helpers/isReadOnlyProperty';
import { log } from '../helpers/log';
import { prepareInstance } from '../helpers/prepareInstance';
import { reconciler } from './reconciler';
import { roots } from './roots';

import type { ApplicationOptions } from 'pixi.js';
import type { ReactNode } from 'react';
import type { ApplicationState } from '../typedefs/ApplicationState.ts';
import type { CreateRootOptions } from '../typedefs/CreateRootOptions.ts';
import type { HostConfig } from '../typedefs/HostConfig.ts';
import type { InternalState } from '../typedefs/InternalState.ts';
import type { ApplicationState } from '../typedefs/ApplicationState';
import type { CreateRootOptions } from '../typedefs/CreateRootOptions';
import type { HostConfig } from '../typedefs/HostConfig';
import type { InternalState } from '../typedefs/InternalState';

/** Creates a new root for a Pixi React app. */
export function createRoot(
Expand Down
56 changes: 28 additions & 28 deletions src/core/reconciler.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
/* eslint-disable no-empty-function */

import Reconciler from 'react-reconciler';
import { version } from '../../package.json' assert { type: 'json' };
import { afterActiveInstanceBlur } from '../helpers/afterActiveInstanceBlur.ts';
import { appendChild } from '../helpers/appendChild.ts';
import { beforeActiveInstanceBlur } from '../helpers/beforeActiveInstanceBlur.ts';
import { clearContainer } from '../helpers/clearContainer.ts';
import { commitUpdate } from '../helpers/commitUpdate.ts';
import { createInstance } from '../helpers/createInstance.ts';
import { createTextInstance } from '../helpers/createTextInstance.ts';
import { detachDeletedInstance } from '../helpers/detachDeletedInstance.ts';
import { finalizeInitialChildren } from '../helpers/finalizeInitialChildren.ts';
import { getChildHostContext } from '../helpers/getChildHostContext.ts';
import { getCurrentEventPriority } from '../helpers/getCurrentEventPriority.ts';
import { getInstanceFromNode } from '../helpers/getInstanceFromNode.ts';
import { getInstanceFromScope } from '../helpers/getInstanceFromScope.ts';
import { getPublicInstance } from '../helpers/getPublicInstance.ts';
import { getRootHostContext } from '../helpers/getRootHostContext.ts';
import { hideInstance } from '../helpers/hideInstance.ts';
import { insertBefore } from '../helpers/insertBefore.ts';
import { prepareForCommit } from '../helpers/prepareForCommit.ts';
import { preparePortalMount } from '../helpers/preparePortalMount.ts';
import { prepareScopeUpdate } from '../helpers/prepareScopeUpdate.ts';
import { prepareUpdate } from '../helpers/prepareUpdate.ts';
import { removeChild } from '../helpers/removeChild.ts';
import { resetAfterCommit } from '../helpers/resetAfterCommit.ts';
import { shouldSetTextContent } from '../helpers/shouldSetTextContent.ts';
import { unhideInstance } from '../helpers/unhideInstance.ts';
import packageData from '../../package.json' assert { type: 'json' };
import { afterActiveInstanceBlur } from '../helpers/afterActiveInstanceBlur';
import { appendChild } from '../helpers/appendChild';
import { beforeActiveInstanceBlur } from '../helpers/beforeActiveInstanceBlur';
import { clearContainer } from '../helpers/clearContainer';
import { commitUpdate } from '../helpers/commitUpdate';
import { createInstance } from '../helpers/createInstance';
import { createTextInstance } from '../helpers/createTextInstance';
import { detachDeletedInstance } from '../helpers/detachDeletedInstance';
import { finalizeInitialChildren } from '../helpers/finalizeInitialChildren';
import { getChildHostContext } from '../helpers/getChildHostContext';
import { getCurrentEventPriority } from '../helpers/getCurrentEventPriority';
import { getInstanceFromNode } from '../helpers/getInstanceFromNode';
import { getInstanceFromScope } from '../helpers/getInstanceFromScope';
import { getPublicInstance } from '../helpers/getPublicInstance';
import { getRootHostContext } from '../helpers/getRootHostContext';
import { hideInstance } from '../helpers/hideInstance';
import { insertBefore } from '../helpers/insertBefore';
import { prepareForCommit } from '../helpers/prepareForCommit';
import { preparePortalMount } from '../helpers/preparePortalMount';
import { prepareScopeUpdate } from '../helpers/prepareScopeUpdate';
import { prepareUpdate } from '../helpers/prepareUpdate';
import { removeChild } from '../helpers/removeChild';
import { resetAfterCommit } from '../helpers/resetAfterCommit';
import { shouldSetTextContent } from '../helpers/shouldSetTextContent';
import { unhideInstance } from '../helpers/unhideInstance';

import type { HostConfig } from '../typedefs/HostConfig.ts';
import type { HostConfig } from '../typedefs/HostConfig';

const reconcilerConfig: Reconciler.HostConfig<
HostConfig['type'],
Expand Down Expand Up @@ -89,7 +89,7 @@ const reconciler = Reconciler(reconcilerConfig);
reconciler.injectIntoDevTools({
bundleType: process.env.NODE_ENV === 'production' ? 0 : 1,
rendererPackageName: '@pixi/react',
version,
version: packageData.version,
});

export { reconciler };
2 changes: 1 addition & 1 deletion src/core/roots.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Root } from '../typedefs/Root.ts';
import type { Root } from '../typedefs/Root';

/** We store roots here since we can render to multiple canvases. */
export const roots: Map<HTMLElement, Root> = new Map();
4 changes: 2 additions & 2 deletions src/global.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { NamespacedPixiElements } from './typedefs/NamespacedPixiElements.ts';
import type { PixiElements } from './typedefs/PixiElements.ts';
import type { NamespacedPixiElements } from './typedefs/NamespacedPixiElements';
import type { PixiElements } from './typedefs/PixiElements';

declare global
{
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/afterActiveInstanceBlur.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { log } from './log.ts';
import { log } from './log';

/**
* No idea what this actually does. 🤷🏻‍♂️
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/appendChild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {
Container,
Filter,
} from 'pixi.js';
import { attach } from './attach.ts';
import { log } from './log.ts';
import { attach } from './attach';
import { log } from './log';

import type { HostConfig } from '../typedefs/HostConfig.ts';
import type { HostConfig } from '../typedefs/HostConfig';

/** Adds elements to our application. */
export function appendChild(
Expand Down
18 changes: 9 additions & 9 deletions src/helpers/applyProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ import {
import {
PixiToReactEventPropNames,
ReactToPixiEventPropNames,
} from '../constants/EventPropNames.ts';
} from '../constants/EventPropNames';
import {
isNull,
isUndefined,
} from './compare.ts';
import { diffProps } from './diffProps.ts';
import { isDiffSet } from './isDiffSet.ts';
import { isReadOnlyProperty } from './isReadOnlyProperty.ts';
import { log } from './log.ts';
} from './compare';
import { diffProps } from './diffProps';
import { isDiffSet } from './isDiffSet';
import { isReadOnlyProperty } from './isReadOnlyProperty';
import { log } from './log';

import type {
FederatedPointerEvent,
FederatedWheelEvent,
} from 'pixi.js';
import type { DiffSet } from '../typedefs/DiffSet.ts';
import type { HostConfig } from '../typedefs/HostConfig.ts';
import type { InstanceState } from '../typedefs/InstanceState.ts';
import type { DiffSet } from '../typedefs/DiffSet';
import type { HostConfig } from '../typedefs/HostConfig';
import type { InstanceState } from '../typedefs/InstanceState';

const DEFAULT = '__default';
const DEFAULTS_CONTAINERS = new Map();
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/attach.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Filter } from 'pixi.js';

import type { HostConfig } from '../typedefs/HostConfig.ts';
import type { HostConfig } from '../typedefs/HostConfig';

export function attach(
parentInstance: HostConfig['containerInstance'],
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/beforeActiveInstanceBlur.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { log } from './log.ts';
import { log } from './log';

/**
* No idea what this actually does. 🤷🏻‍♂️
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/catalogue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { HostConfig } from '../typedefs/HostConfig.ts';
import type { HostConfig } from '../typedefs/HostConfig';

export const catalogue: {
[name: string]: {
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/clearContainer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { log } from './log.ts';
import { log } from './log';

/** Mutate and remove all children from a container. */
export function clearContainer()
Expand Down
10 changes: 5 additions & 5 deletions src/helpers/commitUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { applyProps } from '../helpers/applyProps.ts';
import { log } from '../helpers/log.ts';
import { switchInstance } from './switchInstance.ts';
import { applyProps } from '../helpers/applyProps';
import { log } from '../helpers/log';
import { switchInstance } from './switchInstance';

import type { Fiber } from 'react-reconciler';
import type { HostConfig } from '../typedefs/HostConfig.ts';
import type { UpdatePayload } from '../typedefs/UpdatePayload.ts';
import type { HostConfig } from '../typedefs/HostConfig';
import type { UpdatePayload } from '../typedefs/UpdatePayload';

export function commitUpdate(
instance: HostConfig['instance'],
Expand Down
20 changes: 10 additions & 10 deletions src/helpers/createInstance.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { PixiReactIgnoredProps } from '../constants/PixiReactIgnoredProps.ts';
import { applyProps } from './applyProps.ts';
import { catalogue } from './catalogue.ts';
import { convertStringToPascalCase } from './convertStringToPascalCase.ts';
import { gentleCloneProps } from './gentleCloneProps.ts';
import { log } from './log.ts';
import { parseComponentType } from './parseComponentType.ts';
import { prepareInstance } from './prepareInstance.ts';

import type { HostConfig } from '../typedefs/HostConfig.ts';
import { PixiReactIgnoredProps } from '../constants/PixiReactIgnoredProps';
import { applyProps } from './applyProps';
import { catalogue } from './catalogue';
import { convertStringToPascalCase } from './convertStringToPascalCase';
import { gentleCloneProps } from './gentleCloneProps';
import { log } from './log';
import { parseComponentType } from './parseComponentType';
import { prepareInstance } from './prepareInstance';

import type { HostConfig } from '../typedefs/HostConfig';

export function createInstance(
type: HostConfig['type'],
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/createTextInstance.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { log } from './log.ts';
import { log } from './log';

import type { HostConfig } from '../typedefs/HostConfig.ts';
import type { HostConfig } from '../typedefs/HostConfig';

/** Always throws, because we don't support this (yet). */
export function createTextInstance(
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/detach.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Filter } from 'pixi.js';

import type { HostConfig } from '../typedefs/HostConfig.ts';
import type { HostConfig } from '../typedefs/HostConfig';

export function detach(
childInstance: HostConfig['instance'],
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/detachDeletedInstance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { log } from './log.ts';
import { log } from './log';

/** No idea what this actually does. 🤷🏻‍♂️ */
export function detachDeletedInstance()
Expand Down
10 changes: 5 additions & 5 deletions src/helpers/diffProps.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
PixiToReactEventPropNames,
ReactToPixiEventPropNames,
} from '../constants/EventPropNames.ts';
import { isEqual } from './compare.ts';
import { gentleCloneProps } from './gentleCloneProps.ts';
} from '../constants/EventPropNames';
import { isEqual } from './compare';
import { gentleCloneProps } from './gentleCloneProps';

import type { Change } from '../typedefs/Change.ts';
import type { HostConfig } from '../typedefs/HostConfig.ts';
import type { Change } from '../typedefs/Change';
import type { HostConfig } from '../typedefs/HostConfig';

const DEFAULT = '__default';

Expand Down
2 changes: 1 addition & 1 deletion src/helpers/extend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { catalogue } from './catalogue.ts';
import { catalogue } from './catalogue';

export function extend(objects: { [key: string]: new (...args: any) => any })
{
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/finalizeInitialChildren.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { log } from './log.ts';
import { log } from './log';

/** Applies final mutations during the render phase. */
export function finalizeInitialChildren()
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/gentleCloneProps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactIgnoredProps } from '../constants/ReactIgnoredProps.ts';
import { gentleClone } from './gentleClone.ts';
import { ReactIgnoredProps } from '../constants/ReactIgnoredProps';
import { gentleClone } from './gentleClone';

/** Clones a props object, excluding keys that are special to React and Pixi React. */
export function gentleCloneProps(
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/getChildHostContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { log } from './log.ts';
import { log } from './log';

export function getChildHostContext<T>(parentHostContext: T)
{
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/getCurrentEventPriority.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
DefaultEventPriority,
DiscreteEventPriority,
} from 'react-reconciler/constants.js';
import { log } from './log.ts';
import { log } from './log';

export function getCurrentEventPriority()
{
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/getInstanceFromNode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { log } from './log.ts';
import { log } from './log';

/** No idea what this actually does. 🤷🏻‍♂️ */
export function getInstanceFromNode()
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/getInstanceFromScope.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { log } from './log.ts';
import { log } from './log';

/** Always throws because we don't support this. */
export function getInstanceFromScope(scope: any)
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/getPublicInstance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { log } from './log.ts';
import { log } from './log';

export function getPublicInstance<T>(instance: T)
{
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/getRootHostContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { log } from './log.ts';
import { log } from './log';

/** Retrieves the host context from the root container. */
export function getRootHostContext()
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/hideInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
Filter,
} from 'pixi.js';

import type { HostConfig } from '../typedefs/HostConfig.ts';
import type { HostConfig } from '../typedefs/HostConfig';

export function hideInstance(
instance: HostConfig['instance']
Expand Down
10 changes: 5 additions & 5 deletions src/helpers/insertBefore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import {
Container,
Filter,
} from 'pixi.js';
import { attach } from './attach.ts';
import { detach } from './detach.ts';
import { invariant } from './invariant.ts';
import { log } from './log.ts';
import { attach } from './attach';
import { detach } from './detach';
import { invariant } from './invariant';
import { log } from './log';

import type { HostConfig } from '../typedefs/HostConfig.ts';
import type { HostConfig } from '../typedefs/HostConfig';

export function insertBefore(
parentInstance: HostConfig['containerInstance'],
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/isDiffSet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DiffSet } from '../typedefs/DiffSet.ts';
import type { DiffSet } from '../typedefs/DiffSet';

/** Whether the input is a diff set. */
export function isDiffSet(input: any): input is DiffSet
Expand Down
Loading

0 comments on commit 63dd479

Please sign in to comment.