pixi-solid 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -1
- package/dist/pixi-application.js +22 -1
- package/dist/pixi-application.js.map +1 -1
- package/dist/pixi-components.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/pixi-application.d.ts +20 -0
- package/dist/types/pixi-components.d.ts +16 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PixiApplication, TickerProvider, usePixiApp, useTick, useTicker } from "./pixi-application.js";
|
|
1
|
+
import { PixiApplication, TickerProvider, useDelay, usePixiApp, useTick, useTicker } from "./pixi-application.js";
|
|
2
2
|
import { PixiCanvas } from "./pixi-canvas.js";
|
|
3
3
|
import { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, MeshSimple, NineSliceSprite, ParticleContainer, PerspectiveMesh, RenderContainer, RenderLayer, Sprite, Text, TilingSprite } from "./pixi-components.js";
|
|
4
4
|
import { PIXI_EVENT_NAMES, PIXI_SOLID_EVENT_HANDLER_NAMES } from "./pixi-events.js";
|
|
@@ -27,6 +27,7 @@ export {
|
|
|
27
27
|
Text,
|
|
28
28
|
TickerProvider,
|
|
29
29
|
TilingSprite,
|
|
30
|
+
useDelay,
|
|
30
31
|
usePixiApp,
|
|
31
32
|
useResize,
|
|
32
33
|
useTick,
|
package/dist/pixi-application.js
CHANGED
|
@@ -11,7 +11,7 @@ const usePixiApp = () => {
|
|
|
11
11
|
return app;
|
|
12
12
|
};
|
|
13
13
|
const PixiApplication = (props) => {
|
|
14
|
-
const [
|
|
14
|
+
const [, initialisationProps] = splitProps(props, ["ref", "children"]);
|
|
15
15
|
const [appResource] = createResource(async () => {
|
|
16
16
|
const app = new Application();
|
|
17
17
|
await app.init({
|
|
@@ -85,9 +85,30 @@ const useTick = (tickerCallback) => {
|
|
|
85
85
|
ticker.remove(tickerCallback);
|
|
86
86
|
});
|
|
87
87
|
};
|
|
88
|
+
const useDelay = async (delayMs, callback) => {
|
|
89
|
+
const ticker = useContext(TickerContext);
|
|
90
|
+
if (!ticker) {
|
|
91
|
+
throw new Error("useDelay must be used within a PixiApplication or a TickerProvider");
|
|
92
|
+
}
|
|
93
|
+
let timeDelayed = 0;
|
|
94
|
+
let resolvePromise;
|
|
95
|
+
const promise = new Promise((resolve) => {
|
|
96
|
+
resolvePromise = resolve;
|
|
97
|
+
});
|
|
98
|
+
const internalCallback = () => {
|
|
99
|
+
timeDelayed += ticker.deltaMS;
|
|
100
|
+
if (timeDelayed < delayMs) return;
|
|
101
|
+
callback?.();
|
|
102
|
+
resolvePromise();
|
|
103
|
+
};
|
|
104
|
+
ticker.add(internalCallback);
|
|
105
|
+
await promise;
|
|
106
|
+
ticker.remove(internalCallback);
|
|
107
|
+
};
|
|
88
108
|
export {
|
|
89
109
|
PixiApplication,
|
|
90
110
|
TickerProvider,
|
|
111
|
+
useDelay,
|
|
91
112
|
usePixiApp,
|
|
92
113
|
useTick,
|
|
93
114
|
useTicker
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pixi-application.js","sources":["../src/pixi-application.tsx"],"sourcesContent":["import type { ApplicationOptions, Ticker, TickerCallback } from \"pixi.js\";\nimport { Application } from \"pixi.js\";\nimport type { JSX, ParentProps, Ref } from \"solid-js\";\nimport { createContext, createEffect, createResource, onCleanup, Show, splitProps, useContext } from \"solid-js\";\n\nconst PixiAppContext = createContext<Application>();\nconst TickerContext = createContext<Ticker>();\n\n/**\n * A custom SolidJS hook to access the root PIXI.Application instance.\n * This hook must be called from a component that is a descendant of `PixiApplication`.\n *\n * @returns The PIXI.Application instance provided by the `PixiApplication` component.\n * @throws Will throw an error if used outside of a `PixiApplication` context provider.\n */\nexport const usePixiApp = () => {\n const app = useContext(PixiAppContext);\n if (!app) {\n throw new Error(\"usePixiApp must be used within a PixiApplication\");\n }\n return app;\n};\n\n/**\n * Props for the `PixiApplication` component. It extends the PIXI.ApplicationOptions\n * to allow passing configuration directly to the Pixi.js Application constructor,\n * but omits properties that are handled by the component itself.\n */\nexport type PixiApplicationProps = Partial<Omit<ApplicationOptions, \"children\" | \"resizeTo\">> & {\n ref?: Ref<Application>;\n children?: JSX.Element;\n};\n\n/**\n * A SolidJS component that creates and manages a PIXI.Application instance.\n * It provides the application instance through context to be used by child components\n * and custom hooks like `usePixiApp`, `useTick`, and `useTicker`.\n *\n * This component should only be used once in your application.\n *\n * @param props The properties to configure the Pixi.js Application.\n *\n */\nexport const PixiApplication = (props: PixiApplicationProps) => {\n const [
|
|
1
|
+
{"version":3,"file":"pixi-application.js","sources":["../src/pixi-application.tsx"],"sourcesContent":["import type { ApplicationOptions, Ticker, TickerCallback } from \"pixi.js\";\nimport { Application } from \"pixi.js\";\nimport type { JSX, ParentProps, Ref } from \"solid-js\";\nimport { createContext, createEffect, createResource, onCleanup, Show, splitProps, useContext } from \"solid-js\";\n\nconst PixiAppContext = createContext<Application>();\nconst TickerContext = createContext<Ticker>();\n\n/**\n * A custom SolidJS hook to access the root PIXI.Application instance.\n * This hook must be called from a component that is a descendant of `PixiApplication`.\n *\n * @returns The PIXI.Application instance provided by the `PixiApplication` component.\n * @throws Will throw an error if used outside of a `PixiApplication` context provider.\n */\nexport const usePixiApp = () => {\n const app = useContext(PixiAppContext);\n if (!app) {\n throw new Error(\"usePixiApp must be used within a PixiApplication\");\n }\n return app;\n};\n\n/**\n * Props for the `PixiApplication` component. It extends the PIXI.ApplicationOptions\n * to allow passing configuration directly to the Pixi.js Application constructor,\n * but omits properties that are handled by the component itself.\n */\nexport type PixiApplicationProps = Partial<Omit<ApplicationOptions, \"children\" | \"resizeTo\">> & {\n ref?: Ref<Application>;\n children?: JSX.Element;\n};\n\n/**\n * A SolidJS component that creates and manages a PIXI.Application instance.\n * It provides the application instance through context to be used by child components\n * and custom hooks like `usePixiApp`, `useTick`, and `useTicker`.\n *\n * This component should only be used once in your application.\n *\n * @param props The properties to configure the Pixi.js Application.\n *\n */\nexport const PixiApplication = (props: PixiApplicationProps) => {\n const [, initialisationProps] = splitProps(props, [\"ref\", \"children\"]);\n\n // TODO: Split props into initialisation props and runtime props\n\n const [appResource] = createResource(async () => {\n const app = new Application();\n await app.init({\n autoDensity: true,\n resolution: Math.min(window.devicePixelRatio, 2),\n sharedTicker: true,\n ...initialisationProps,\n });\n\n return app;\n });\n\n createEffect(() => {\n const app = appResource();\n if (app) {\n if (props.ref) {\n // Solid converts the ref prop to a callback function\n (props.ref as unknown as (arg: any) => void)(app);\n }\n\n // TODO: Go through the other props that can be set at runtime and apply them here\n // e.g. backgroundColor => app.renderer.backgroundColor, etc.\n\n app.ticker.autoStart = false;\n app.ticker.start();\n\n onCleanup(() => {\n app.destroy(true, { children: true });\n });\n }\n });\n\n return (\n <Show when={appResource()}>\n {(app) => (\n <PixiAppContext.Provider value={app()}>\n <TickerContext.Provider value={app().ticker}>{props.children}</TickerContext.Provider>\n </PixiAppContext.Provider>\n )}\n </Show>\n );\n};\n\nexport type TickerProviderProps = ParentProps<{ ticker: Ticker }>;\n\n/**\n * This is only required if you want a ticker without the Application.\n * It provides context for the `useTick` and `useTicker` hooks so we can run tests that use them without having to instantate a Pixi Application.\n *\n * You need to pass in the ticker instance you want to use so it can be manually controled form the outside for testing.\n */\nexport const TickerProvider = (props: TickerProviderProps) => {\n return <TickerContext.Provider value={props.ticker}>{props.children}</TickerContext.Provider>;\n};\n\n/**\n * useTicker\n *\n * A custom SolidJS hook that provides access to the PIXI.Application's shared Ticker instance.\n * This hook must be called from a component that is a descendant of `PixiApplication`.\n * Or a descendant of `TickerProvider` if being used for testing without an application.\n *\n * @returns The PIXI.Ticker instance from the application context.\n * @throws Will throw an error if used outside of a `PixiApplication` or `TickerProvider` context.\n */\nexport const useTicker = (): Ticker => {\n const ticker = useContext(TickerContext);\n if (!ticker) {\n throw new Error(\"useTicker must be used within a PixiApplication or a TickerProvider\");\n }\n return ticker;\n};\n\n/**\n * useTick\n *\n * A custom SolidJS hook that registers a callback function to be executed on every frame\n * of the PIXI.Application's ticker. The callback is automatically removed when the\n * component or hook's owning computation is cleaned up.\n *\n * This hook must be called from a component that is a descendant of `PixiApplication`.\n * Or a descendant of `TickerProvider` if being used for testing without an application.\n *\n * @param tickerCallback - The function to call on each ticker update. It receives\n * the `PIXI.Ticker` instance as its argument.\n *\n */\nexport const useTick = (tickerCallback: TickerCallback<Ticker>): void => {\n const ticker = useContext(TickerContext);\n\n if (!ticker) {\n throw new Error(\"useTick must be used within a PixiApplication or a TickerProvider\");\n }\n\n ticker.add(tickerCallback);\n onCleanup(() => {\n ticker.remove(tickerCallback);\n });\n};\n\n/**\n * Delay until a given number of milliseconds has passed on the application ticker.\n *\n * It is guaranteed to be in sync with the ticker and uses accumulated deltaMs not an external time measurement.\n *\n * Simply await for it to resolve if in an async context or pass in a callback function.\n * It's not recommended to use both techniques at once.\n *\n * @param delayMs - Number of milliseconds to wait (measured in the ticker's time units).\n *\n * @param callback - Optional callback function that will fire when the delayMs time has passed.\n *\n * @returns A Promise that resolves once the ticker's time has advanced by `delayMs`.\n *\n * @throws {Error} If called outside of a `PixiApplication` or `TickerProvider` context.\n *\n * @note It will not resolve or fire the callback if the ticker is paused or stopped.\n *\n */\nexport const useDelay = async (delayMs: number, callback?: () => void): Promise<void> => {\n const ticker = useContext(TickerContext);\n\n if (!ticker) {\n throw new Error(\"useDelay must be used within a PixiApplication or a TickerProvider\");\n }\n\n let timeDelayed = 0;\n\n let resolvePromise: (value: void | PromiseLike<void>) => void;\n\n const promise = new Promise<void>((resolve) => {\n resolvePromise = resolve;\n });\n\n const internalCallback = () => {\n timeDelayed += ticker.deltaMS;\n if (timeDelayed < delayMs) return;\n callback?.();\n resolvePromise();\n };\n\n ticker.add(internalCallback);\n\n await promise;\n\n ticker.remove(internalCallback);\n};\n"],"names":["PixiAppContext","createContext","TickerContext","usePixiApp","app","useContext","Error","PixiApplication","props","initialisationProps","splitProps","appResource","createResource","Application","init","autoDensity","resolution","Math","min","window","devicePixelRatio","sharedTicker","createEffect","ref","ticker","autoStart","start","onCleanup","destroy","children","_$createComponent","Show","when","Provider","value","TickerProvider","useTicker","useTick","tickerCallback","add","remove","useDelay","delayMs","callback","timeDelayed","resolvePromise","promise","Promise","resolve","internalCallback","deltaMS"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pixi-components.js","sources":["../src/pixi-components.tsx"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport {\n AnimatedSprite as PixiAnimatedSprite,\n BitmapText as PixiBitmapText,\n Container as PixiContainer,\n Graphics as PixiGraphics,\n HTMLText as PixiHTMLText,\n MeshPlane as PixiMeshPlane,\n MeshRope as PixiMeshRope,\n MeshSimple as PixiMeshSimple,\n NineSliceSprite as PixiNineSliceSprite,\n ParticleContainer as PixiParticleContainer,\n PerspectiveMesh as PixiPerspectiveMesh,\n RenderContainer as PixiRenderContainer,\n RenderLayer as PixiRenderLayer,\n Sprite as PixiSprite,\n Text as PixiText,\n TilingSprite as PixiTilingSprite,\n} from \"pixi.js\";\nimport type { JSX, Ref } from \"solid-js\";\nimport { createRenderEffect, on, splitProps } from \"solid-js\";\nimport type { PixiEventHandlerMap } from \"./pixi-events\";\n\nimport { PIXI_SOLID_EVENT_HANDLER_NAMES } from \"./pixi-events\";\nimport { insert, setProp } from \"./renderer\";\n\n/**\n * Prop definition for components that CAN have children\n */\nexport type ContainerProps<Component> = PixiEventHandlerMap & {\n ref?: Ref<Component>;\n as?: Component;\n children?: JSX.Element;\n};\n\n/**\n * Prop definition for components that CANNOT have children\n */\nexport type LeafProps<Component> = Omit<ContainerProps<Component>, \"children\">;\n\n// Keys that are specific to Solid components and not Pixi props\nexport const SOLID_PROP_KEYS = [\"ref\", \"as\", \"children\"] as const;\n\n/**\n * Apply's the props to a Pixi instance with subsriptions to maintain reactivity.\n *\n * @param instance The Pixi instance we want to apply props to.\n * @param props The props object.\n * @param defer Defers the createRenderEffect so the props aren't set on the first run.\n * This is useful because setting initialisation props can have unintended side effects.\n * Notibly in AnimatedSprite, if we set the textures roperty after instantiation it will stop the instance from playing.\n */\nexport const applyProps = <InstanceType extends PixiContainer, OptionsType extends ContainerProps<InstanceType>>(\n instance: InstanceType,\n props: OptionsType,\n defer?: boolean\n) => {\n for (const key in props) {\n if (key === \"as\") continue;\n\n if (key === \"ref\") {\n createRenderEffect(() => {\n // Solid converts the ref prop to a callback function\n (props[key] as unknown as (arg: any) => void)(instance);\n });\n } else if (key === \"children\") {\n if (!(\"addChild\" in instance)) {\n throw new Error(`Cannot set children on non-container instance.`);\n }\n createRenderEffect(() => {\n insert(instance, () => props.children);\n });\n } else if (defer) {\n createRenderEffect(\n on(\n () => props[key as keyof typeof props],\n () => {\n setProp(instance, key, props[key as keyof typeof props]);\n },\n { defer }\n )\n );\n } else {\n createRenderEffect(() => {\n setProp(instance, key, props[key as keyof typeof props]);\n });\n }\n }\n};\n\nconst createContainerComponent = <InstanceType extends PixiContainer, OptionsType extends object>(\n PixiClass: new (props: OptionsType) => InstanceType\n) => {\n return (props: Omit<OptionsType, \"children\"> & ContainerProps<InstanceType>): JSX.Element => {\n const [runtimeProps, initialisationProps] = splitProps(props, [\n ...SOLID_PROP_KEYS,\n ...PIXI_SOLID_EVENT_HANDLER_NAMES,\n ]);\n\n const instance = props.as || new PixiClass(initialisationProps as any);\n\n applyProps(instance, initialisationProps, true);\n applyProps(instance, runtimeProps);\n\n return instance as unknown as JSX.Element;\n };\n};\n\nconst createLeafComponent = <InstanceType extends PixiContainer, OptionsType extends object>(\n PixiClass: new (props: OptionsType) => InstanceType\n) => {\n return (props: Omit<OptionsType, \"children\"> & LeafProps<InstanceType>): JSX.Element => {\n return createContainerComponent<PixiContainer, OptionsType>(PixiClass)(props as any);\n };\n};\n\n/**\n * A SolidJS component that renders a `PIXI.AnimatedSprite`.\n */\nexport const AnimatedSprite = createLeafComponent<PixiAnimatedSprite, Pixi.AnimatedSpriteOptions>(PixiAnimatedSprite);\n/**\n * A SolidJS component that renders a `PIXI.BitmapText`.\n */\nexport const BitmapText = createLeafComponent<PixiBitmapText, ConstructorParameters<typeof PixiBitmapText>>(\n PixiBitmapText\n);\n/**\n * A SolidJS component that renders a `PIXI.Container`.\n */\nexport const Container = createContainerComponent<PixiContainer, Pixi.ContainerOptions>(PixiContainer);\n/**\n * A SolidJS component that renders a `PIXI.Graphics`.\n * Use a ref to access the underlying graphics instance and draw with it.\n */\nexport const Graphics = createLeafComponent<PixiGraphics, Pixi.GraphicsOptions>(PixiGraphics);\n/**\n * A SolidJS component that renders a `PIXI.HTMLText`.\n */\nexport const HTMLText = createLeafComponent<PixiHTMLText, Pixi.HTMLTextOptions>(PixiHTMLText);\n\n/**\n * A SolidJS component that renders a `PIXI.MeshPlane`.\n */\nexport const MeshPlane = createLeafComponent<PixiMeshPlane, Pixi.MeshPlaneOptions>(PixiMeshPlane);\n\n/**\n * A SolidJS component that renders a `PIXI.MeshRope`.\n */\nexport const MeshRope = createLeafComponent<PixiMeshRope, Pixi.MeshRopeOptions>(PixiMeshRope);\n\n/**\n * A SolidJS component that renders a `PIXI.MeshSimple`.\n */\nexport const MeshSimple = createLeafComponent<PixiMeshSimple, Pixi.SimpleMeshOptions>(PixiMeshSimple);\n\n/**\n * A SolidJS component that renders a `PIXI.NineSliceSprite`.\n */\nexport const NineSliceSprite = createLeafComponent<PixiNineSliceSprite, Pixi.NineSliceSpriteOptions>(\n PixiNineSliceSprite\n);\n\n/**\n * A SolidJS component that renders a `PIXI.ParticleContainer`.\n *\n * Particles should be added and removed from this component imperatively. Please see the docs for a reference example.\n */\nexport const ParticleContainer = createLeafComponent<PixiParticleContainer, Pixi.ParticleContainerOptions>(\n PixiParticleContainer\n);\n\n/**\n * A SolidJS component that renders a `PIXI.PerspectiveMesh`.\n */\nexport const PerspectiveMesh = createLeafComponent<PixiPerspectiveMesh, Pixi.PerspectivePlaneOptions>(\n PixiPerspectiveMesh\n);\n\n/**\n * A SolidJS component that renders a `PIXI.RenderContainer`.\n */\nexport const RenderContainer = createContainerComponent<PixiRenderContainer, Pixi.RenderContainerOptions>(\n PixiRenderContainer\n);\n\n/**\n * A SolidJS component that renders a `PIXI.RenderLayer`.\n */\nexport const RenderLayer = createContainerComponent<PixiRenderLayer, Pixi.RenderLayerOptions>(PixiRenderLayer);\n\n/**\n * A SolidJS component that renders a `PIXI.Sprite`.\n */\nexport const Sprite = createLeafComponent<PixiSprite, Pixi.SpriteOptions>(PixiSprite);\n/**\n * A SolidJS component that renders a `PIXI.Text`.\n */\nexport const Text = createLeafComponent<PixiText, Pixi.CanvasTextOptions>(PixiText);\n\n/**\n * A SolidJS component that renders a `PIXI.TilingSprite`.\n */\nexport const TilingSprite = createLeafComponent<PixiTilingSprite, Pixi.TilingSpriteOptions>(PixiTilingSprite);\n\n// export const MeshGeometry = createLeafComponent<PixiMeshGeometry, Pixi.MeshGeometryOptions>(PixiMeshGeometry);\n\n// export const NineSliceGeometry = createLeafComponent<PixiNineSliceGeometry, Pixi.NineSliceGeometryOptions>(\n// PixiNineSliceGeometry\n// );\n\n// export const Particle = createLeafComponent<PixiParticle, Pixi.ParticleOptions>(PixiParticle);\n\n// export const PerspectivePlaneGeometry = createLeafComponent<\n// PixiPerspectivePlaneGeometry,\n// Pixi.PerspectivePlaneGeometryOptions\n// >(PixiPerspectivePlaneGeometry);\n\n// export const PlaneGeometry = createLeafComponent<PixiPlaneGeometry, Pixi.PlaneGeometryOptions>(PixiPlaneGeometry);\n\n// export const RopeGeometry = createLeafComponent<PixiRopeGeometry, Pixi.RopeGeometryOptions>(PixiRopeGeometry);\n\n// TODO: Do we need a component for the Culler. It needs to interact with the stage directly.\n// export const Culler = createLeafComponent<PixiCuller, Pixi.Culler>(PixiCuller);\n"],"names":["SOLID_PROP_KEYS","applyProps","instance","props","defer","key","createRenderEffect","Error","insert","children","on","setProp","createContainerComponent","PixiClass","runtimeProps","initialisationProps","splitProps","PIXI_SOLID_EVENT_HANDLER_NAMES","as","createLeafComponent","AnimatedSprite","PixiAnimatedSprite","BitmapText","PixiBitmapText","Container","PixiContainer","Graphics","PixiGraphics","HTMLText","PixiHTMLText","MeshPlane","PixiMeshPlane","MeshRope","PixiMeshRope","MeshSimple","PixiMeshSimple","NineSliceSprite","PixiNineSliceSprite","ParticleContainer","PixiParticleContainer","PerspectiveMesh","PixiPerspectiveMesh","RenderContainer","PixiRenderContainer","RenderLayer","PixiRenderLayer","Sprite","PixiSprite","Text","PixiText","TilingSprite","PixiTilingSprite"],"mappings":";;;;AAyCO,MAAMA,kBAAkB,CAAC,OAAO,MAAM,UAAU;AAWhD,MAAMC,aAAa,CACxBC,UACAC,OACAC,UACG;AACH,aAAWC,OAAOF,OAAO;AACvB,QAAIE,QAAQ,KAAM;AAElB,QAAIA,QAAQ,OAAO;AACjBC,yBAAmB,MAAM;AAEtBH,cAAME,GAAG,EAAoCH,QAAQ;AAAA,MACxD,CAAC;AAAA,IACH,WAAWG,QAAQ,YAAY;AAC7B,UAAI,EAAE,cAAcH,WAAW;AAC7B,cAAM,IAAIK,MAAM,gDAAgD;AAAA,MAClE;AACAD,yBAAmB,MAAM;AACvBE,eAAON,UAAU,MAAMC,MAAMM,QAAQ;AAAA,MACvC,CAAC;AAAA,IACH,WAAWL,OAAO;AAChBE,yBACEI,GACE,MAAMP,MAAME,GAAyB,GACrC,MAAM;AACJM,gBAAQT,UAAUG,KAAKF,MAAME,GAAyB,CAAC;AAAA,MACzD,GACA;AAAA,QAAED;AAAAA,MAAAA,CACJ,CACF;AAAA,IACF,OAAO;AACLE,yBAAmB,MAAM;AACvBK,gBAAQT,UAAUG,KAAKF,MAAME,GAAyB,CAAC;AAAA,MACzD,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEA,MAAMO,2BAA2B,CAC/BC,cACG;AACH,SAAO,CAACV,UAAqF;AAC3F,UAAM,CAACW,cAAcC,mBAAmB,IAAIC,WAAWb,OAAO,CAC5D,GAAGH,iBACH,GAAGiB,8BAA8B,CAClC;AAED,UAAMf,WAAWC,MAAMe,MAAM,IAAIL,UAAUE,mBAA0B;AAErEd,eAAWC,UAAUa,qBAAqB,IAAI;AAC9Cd,eAAWC,UAAUY,YAAY;AAEjC,WAAOZ;AAAAA,EACT;AACF;AAEA,MAAMiB,sBAAsB,CAC1BN,cACG;AACH,SAAO,CAACV,UAAgF;AACtF,WAAOS,yBAAqDC,SAAS,EAAEV,KAAY;AAAA,EACrF;AACF;AAKO,MAAMiB,iBAAiBD,oBAAoEE,gBAAkB;AAI7G,MAAMC,aAAaH,oBACxBI,YACF;AAIO,MAAMC,YAAYZ,yBAA+Da,WAAa;AAK9F,MAAMC,WAAWP,oBAAwDQ,UAAY;AAIrF,MAAMC,WAAWT,oBAAwDU,UAAY;AAKrF,MAAMC,YAAYX,oBAA0DY,WAAa;AAKzF,MAAMC,WAAWb,oBAAwDc,UAAY;AAKrF,MAAMC,aAAaf,oBAA4DgB,YAAc;AAK7F,MAAMC,kBAAkBjB,oBAC7BkB,iBACF;AAOO,MAAMC,oBAAoBnB,oBAC/BoB,mBACF;AAKO,MAAMC,kBAAkBrB,oBAC7BsB,iBACF;AAKO,MAAMC,kBAAkB9B,yBAC7B+B,iBACF;AAKO,MAAMC,cAAchC,yBAAmEiC,aAAe;AAKtG,MAAMC,SAAS3B,oBAAoD4B,QAAU;AAI7E,MAAMC,OAAO7B,oBAAsD8B,MAAQ;AAK3E,MAAMC,eAAe/B,oBAAgEgC,cAAgB;"}
|
|
1
|
+
{"version":3,"file":"pixi-components.js","sources":["../src/pixi-components.tsx"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport {\n AnimatedSprite as PixiAnimatedSprite,\n BitmapText as PixiBitmapText,\n Container as PixiContainer,\n Graphics as PixiGraphics,\n HTMLText as PixiHTMLText,\n MeshPlane as PixiMeshPlane,\n MeshRope as PixiMeshRope,\n MeshSimple as PixiMeshSimple,\n NineSliceSprite as PixiNineSliceSprite,\n ParticleContainer as PixiParticleContainer,\n PerspectiveMesh as PixiPerspectiveMesh,\n RenderContainer as PixiRenderContainer,\n RenderLayer as PixiRenderLayer,\n Sprite as PixiSprite,\n Text as PixiText,\n TilingSprite as PixiTilingSprite,\n} from \"pixi.js\";\nimport type { JSX, Ref } from \"solid-js\";\nimport { createRenderEffect, on, splitProps } from \"solid-js\";\nimport type { PixiEventHandlerMap } from \"./pixi-events\";\n\nimport { PIXI_SOLID_EVENT_HANDLER_NAMES } from \"./pixi-events\";\nimport { insert, setProp } from \"./renderer\";\n\n/**\n * Prop definition for components that CAN have children\n */\nexport type ContainerProps<Component> = PixiEventHandlerMap & {\n ref?: Ref<Component>;\n as?: Component;\n children?: JSX.Element;\n};\n\n/**\n * Prop definition for components that CANNOT have children\n */\nexport type LeafProps<Component> = Omit<ContainerProps<Component>, \"children\">;\n\n// Keys that are specific to Solid components and not Pixi props\nexport const SOLID_PROP_KEYS = [\"ref\", \"as\", \"children\"] as const;\n\n/**\n * Apply's the props to a Pixi instance with subsriptions to maintain reactivity.\n *\n * @param instance The Pixi instance we want to apply props to.\n * @param props The props object.\n * @param defer Defers the createRenderEffect so the props aren't set on the first run.\n * This is useful because setting initialisation props can have unintended side effects.\n * Notibly in AnimatedSprite, if we set the textures roperty after instantiation it will stop the instance from playing.\n */\nexport const applyProps = <InstanceType extends PixiContainer, OptionsType extends ContainerProps<InstanceType>>(\n instance: InstanceType,\n props: OptionsType,\n defer?: boolean\n) => {\n for (const key in props) {\n if (key === \"as\") continue;\n\n if (key === \"ref\") {\n createRenderEffect(() => {\n // Solid converts the ref prop to a callback function\n (props[key] as unknown as (arg: any) => void)(instance);\n });\n } else if (key === \"children\") {\n if (!(\"addChild\" in instance)) {\n throw new Error(`Cannot set children on non-container instance.`);\n }\n createRenderEffect(() => {\n insert(instance, () => props.children);\n });\n } else if (defer) {\n createRenderEffect(\n on(\n () => props[key as keyof typeof props],\n () => {\n setProp(instance, key, props[key as keyof typeof props]);\n },\n { defer }\n )\n );\n } else {\n createRenderEffect(() => {\n setProp(instance, key, props[key as keyof typeof props]);\n });\n }\n }\n};\n\nconst createContainerComponent = <InstanceType extends PixiContainer, OptionsType extends object>(\n PixiClass: new (props: OptionsType) => InstanceType\n) => {\n return (props: Omit<OptionsType, \"children\"> & ContainerProps<InstanceType>): InstanceType & JSX.Element => {\n const [runtimeProps, initialisationProps] = splitProps(props, [\n ...SOLID_PROP_KEYS,\n ...PIXI_SOLID_EVENT_HANDLER_NAMES,\n ]);\n\n const instance = props.as || new PixiClass(initialisationProps as any);\n\n applyProps(instance, initialisationProps, true);\n applyProps(instance, runtimeProps);\n\n return instance as InstanceType & JSX.Element;\n };\n};\n\nconst createLeafComponent = <InstanceType extends PixiContainer, OptionsType extends object>(\n PixiClass: new (props: OptionsType) => InstanceType\n) => {\n return (props: Omit<OptionsType, \"children\"> & LeafProps<InstanceType>): InstanceType & JSX.Element => {\n return createContainerComponent<InstanceType, OptionsType>(PixiClass)(props);\n };\n};\n\n/**\n * A SolidJS component that renders a `PIXI.AnimatedSprite`.\n */\nexport const AnimatedSprite = createLeafComponent<PixiAnimatedSprite, Pixi.AnimatedSpriteOptions>(PixiAnimatedSprite);\n/**\n * A SolidJS component that renders a `PIXI.BitmapText`.\n */\nexport const BitmapText = createLeafComponent<PixiBitmapText, ConstructorParameters<typeof PixiBitmapText>>(\n PixiBitmapText\n);\n/**\n * A SolidJS component that renders a `PIXI.Container`.\n */\nexport const Container = createContainerComponent<PixiContainer, Pixi.ContainerOptions>(PixiContainer);\n/**\n * A SolidJS component that renders a `PIXI.Graphics`.\n * Use a ref to access the underlying graphics instance and draw with it.\n */\nexport const Graphics = createLeafComponent<PixiGraphics, Pixi.GraphicsOptions>(PixiGraphics);\n/**\n * A SolidJS component that renders a `PIXI.HTMLText`.\n */\nexport const HTMLText = createLeafComponent<PixiHTMLText, Pixi.HTMLTextOptions>(PixiHTMLText);\n\n/**\n * A SolidJS component that renders a `PIXI.MeshPlane`.\n */\nexport const MeshPlane = createLeafComponent<PixiMeshPlane, Pixi.MeshPlaneOptions>(PixiMeshPlane);\n\n/**\n * A SolidJS component that renders a `PIXI.MeshRope`.\n */\nexport const MeshRope = createLeafComponent<PixiMeshRope, Pixi.MeshRopeOptions>(PixiMeshRope);\n\n/**\n * A SolidJS component that renders a `PIXI.MeshSimple`.\n */\nexport const MeshSimple = createLeafComponent<PixiMeshSimple, Pixi.SimpleMeshOptions>(PixiMeshSimple);\n\n/**\n * A SolidJS component that renders a `PIXI.NineSliceSprite`.\n */\nexport const NineSliceSprite = createLeafComponent<PixiNineSliceSprite, Pixi.NineSliceSpriteOptions>(\n PixiNineSliceSprite\n);\n\n/**\n * A SolidJS component that renders a `PIXI.ParticleContainer`.\n *\n * Particles should be added and removed from this component imperatively. Please see the docs for a reference example.\n */\nexport const ParticleContainer = createLeafComponent<PixiParticleContainer, Pixi.ParticleContainerOptions>(\n PixiParticleContainer\n);\n\n/**\n * A SolidJS component that renders a `PIXI.PerspectiveMesh`.\n */\nexport const PerspectiveMesh = createLeafComponent<PixiPerspectiveMesh, Pixi.PerspectivePlaneOptions>(\n PixiPerspectiveMesh\n);\n\n/**\n * A SolidJS component that renders a `PIXI.RenderContainer`.\n */\nexport const RenderContainer = createContainerComponent<PixiRenderContainer, Pixi.RenderContainerOptions>(\n PixiRenderContainer\n);\n\n/**\n * A SolidJS component that renders a `PIXI.RenderLayer`.\n */\nexport const RenderLayer = createContainerComponent<PixiRenderLayer, Pixi.RenderLayerOptions>(PixiRenderLayer);\n\n/**\n * A SolidJS component that renders a `PIXI.Sprite`.\n */\nexport const Sprite = createLeafComponent<PixiSprite, Pixi.SpriteOptions>(PixiSprite);\n/**\n * A SolidJS component that renders a `PIXI.Text`.\n */\nexport const Text = createLeafComponent<PixiText, Pixi.CanvasTextOptions>(PixiText);\n\n/**\n * A SolidJS component that renders a `PIXI.TilingSprite`.\n */\nexport const TilingSprite = createLeafComponent<PixiTilingSprite, Pixi.TilingSpriteOptions>(PixiTilingSprite);\n\n// export const MeshGeometry = createLeafComponent<PixiMeshGeometry, Pixi.MeshGeometryOptions>(PixiMeshGeometry);\n\n// export const NineSliceGeometry = createLeafComponent<PixiNineSliceGeometry, Pixi.NineSliceGeometryOptions>(\n// PixiNineSliceGeometry\n// );\n\n// export const Particle = createLeafComponent<PixiParticle, Pixi.ParticleOptions>(PixiParticle);\n\n// export const PerspectivePlaneGeometry = createLeafComponent<\n// PixiPerspectivePlaneGeometry,\n// Pixi.PerspectivePlaneGeometryOptions\n// >(PixiPerspectivePlaneGeometry);\n\n// export const PlaneGeometry = createLeafComponent<PixiPlaneGeometry, Pixi.PlaneGeometryOptions>(PixiPlaneGeometry);\n\n// export const RopeGeometry = createLeafComponent<PixiRopeGeometry, Pixi.RopeGeometryOptions>(PixiRopeGeometry);\n\n// TODO: Do we need a component for the Culler. It needs to interact with the stage directly.\n// export const Culler = createLeafComponent<PixiCuller, Pixi.Culler>(PixiCuller);\n"],"names":["SOLID_PROP_KEYS","applyProps","instance","props","defer","key","createRenderEffect","Error","insert","children","on","setProp","createContainerComponent","PixiClass","runtimeProps","initialisationProps","splitProps","PIXI_SOLID_EVENT_HANDLER_NAMES","as","createLeafComponent","AnimatedSprite","PixiAnimatedSprite","BitmapText","PixiBitmapText","Container","PixiContainer","Graphics","PixiGraphics","HTMLText","PixiHTMLText","MeshPlane","PixiMeshPlane","MeshRope","PixiMeshRope","MeshSimple","PixiMeshSimple","NineSliceSprite","PixiNineSliceSprite","ParticleContainer","PixiParticleContainer","PerspectiveMesh","PixiPerspectiveMesh","RenderContainer","PixiRenderContainer","RenderLayer","PixiRenderLayer","Sprite","PixiSprite","Text","PixiText","TilingSprite","PixiTilingSprite"],"mappings":";;;;AAyCO,MAAMA,kBAAkB,CAAC,OAAO,MAAM,UAAU;AAWhD,MAAMC,aAAa,CACxBC,UACAC,OACAC,UACG;AACH,aAAWC,OAAOF,OAAO;AACvB,QAAIE,QAAQ,KAAM;AAElB,QAAIA,QAAQ,OAAO;AACjBC,yBAAmB,MAAM;AAEtBH,cAAME,GAAG,EAAoCH,QAAQ;AAAA,MACxD,CAAC;AAAA,IACH,WAAWG,QAAQ,YAAY;AAC7B,UAAI,EAAE,cAAcH,WAAW;AAC7B,cAAM,IAAIK,MAAM,gDAAgD;AAAA,MAClE;AACAD,yBAAmB,MAAM;AACvBE,eAAON,UAAU,MAAMC,MAAMM,QAAQ;AAAA,MACvC,CAAC;AAAA,IACH,WAAWL,OAAO;AAChBE,yBACEI,GACE,MAAMP,MAAME,GAAyB,GACrC,MAAM;AACJM,gBAAQT,UAAUG,KAAKF,MAAME,GAAyB,CAAC;AAAA,MACzD,GACA;AAAA,QAAED;AAAAA,MAAAA,CACJ,CACF;AAAA,IACF,OAAO;AACLE,yBAAmB,MAAM;AACvBK,gBAAQT,UAAUG,KAAKF,MAAME,GAAyB,CAAC;AAAA,MACzD,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEA,MAAMO,2BAA2B,CAC/BC,cACG;AACH,SAAO,CAACV,UAAoG;AAC1G,UAAM,CAACW,cAAcC,mBAAmB,IAAIC,WAAWb,OAAO,CAC5D,GAAGH,iBACH,GAAGiB,8BAA8B,CAClC;AAED,UAAMf,WAAWC,MAAMe,MAAM,IAAIL,UAAUE,mBAA0B;AAErEd,eAAWC,UAAUa,qBAAqB,IAAI;AAC9Cd,eAAWC,UAAUY,YAAY;AAEjC,WAAOZ;AAAAA,EACT;AACF;AAEA,MAAMiB,sBAAsB,CAC1BN,cACG;AACH,SAAO,CAACV,UAA+F;AACrG,WAAOS,yBAAoDC,SAAS,EAAEV,KAAK;AAAA,EAC7E;AACF;AAKO,MAAMiB,iBAAiBD,oBAAoEE,gBAAkB;AAI7G,MAAMC,aAAaH,oBACxBI,YACF;AAIO,MAAMC,YAAYZ,yBAA+Da,WAAa;AAK9F,MAAMC,WAAWP,oBAAwDQ,UAAY;AAIrF,MAAMC,WAAWT,oBAAwDU,UAAY;AAKrF,MAAMC,YAAYX,oBAA0DY,WAAa;AAKzF,MAAMC,WAAWb,oBAAwDc,UAAY;AAKrF,MAAMC,aAAaf,oBAA4DgB,YAAc;AAK7F,MAAMC,kBAAkBjB,oBAC7BkB,iBACF;AAOO,MAAMC,oBAAoBnB,oBAC/BoB,mBACF;AAKO,MAAMC,kBAAkBrB,oBAC7BsB,iBACF;AAKO,MAAMC,kBAAkB9B,yBAC7B+B,iBACF;AAKO,MAAMC,cAAchC,yBAAmEiC,aAAe;AAKtG,MAAMC,SAAS3B,oBAAoD4B,QAAU;AAI7E,MAAMC,OAAO7B,oBAAsD8B,MAAQ;AAK3E,MAAMC,eAAe/B,oBAAgEgC,cAAgB;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { PixiApplicationProps } from "./pixi-application";
|
|
2
|
-
export { PixiApplication, TickerProvider, usePixiApp, useTick, useTicker, } from "./pixi-application";
|
|
2
|
+
export { PixiApplication, TickerProvider, useDelay, usePixiApp, useTick, useTicker, } from "./pixi-application";
|
|
3
3
|
export { PixiCanvas } from "./pixi-canvas";
|
|
4
4
|
export type { ContainerProps, LeafProps } from "./pixi-components";
|
|
5
5
|
export { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, MeshSimple, NineSliceSprite, ParticleContainer, PerspectiveMesh, RenderContainer, RenderLayer, Sprite, Text, TilingSprite, } from "./pixi-components";
|
|
@@ -65,3 +65,23 @@ export declare const useTicker: () => Ticker;
|
|
|
65
65
|
*
|
|
66
66
|
*/
|
|
67
67
|
export declare const useTick: (tickerCallback: TickerCallback<Ticker>) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Delay until a given number of milliseconds has passed on the application ticker.
|
|
70
|
+
*
|
|
71
|
+
* It is guaranteed to be in sync with the ticker and uses accumulated deltaMs not an external time measurement.
|
|
72
|
+
*
|
|
73
|
+
* Simply await for it to resolve if in an async context or pass in a callback function.
|
|
74
|
+
* It's not recommended to use both techniques at once.
|
|
75
|
+
*
|
|
76
|
+
* @param delayMs - Number of milliseconds to wait (measured in the ticker's time units).
|
|
77
|
+
*
|
|
78
|
+
* @param callback - Optional callback function that will fire when the delayMs time has passed.
|
|
79
|
+
*
|
|
80
|
+
* @returns A Promise that resolves once the ticker's time has advanced by `delayMs`.
|
|
81
|
+
*
|
|
82
|
+
* @throws {Error} If called outside of a `PixiApplication` or `TickerProvider` context.
|
|
83
|
+
*
|
|
84
|
+
* @note It will not resolve or fire the callback if the ticker is paused or stopped.
|
|
85
|
+
*
|
|
86
|
+
*/
|
|
87
|
+
export declare const useDelay: (delayMs: number, callback?: () => void) => Promise<void>;
|
|
@@ -28,11 +28,11 @@ export declare const applyProps: <InstanceType extends PixiContainer, OptionsTyp
|
|
|
28
28
|
/**
|
|
29
29
|
* A SolidJS component that renders a `PIXI.AnimatedSprite`.
|
|
30
30
|
*/
|
|
31
|
-
export declare const AnimatedSprite: (props: Omit<Pixi.AnimatedSpriteOptions, "children"> & LeafProps<Pixi.AnimatedSprite>) => JSX.Element;
|
|
31
|
+
export declare const AnimatedSprite: (props: Omit<Pixi.AnimatedSpriteOptions, "children"> & LeafProps<Pixi.AnimatedSprite>) => Pixi.AnimatedSprite & JSX.Element;
|
|
32
32
|
/**
|
|
33
33
|
* A SolidJS component that renders a `PIXI.BitmapText`.
|
|
34
34
|
*/
|
|
35
|
-
export declare const BitmapText: (props: Omit<[text?: Pixi.TextString | undefined, options?: Partial<Pixi.TextStyle> | undefined], "children"> & LeafProps<Pixi.BitmapText>) => JSX.Element;
|
|
35
|
+
export declare const BitmapText: (props: Omit<[text?: Pixi.TextString | undefined, options?: Partial<Pixi.TextStyle> | undefined], "children"> & LeafProps<Pixi.BitmapText>) => Pixi.BitmapText & JSX.Element;
|
|
36
36
|
/**
|
|
37
37
|
* A SolidJS component that renders a `PIXI.Container`.
|
|
38
38
|
*/
|
|
@@ -40,42 +40,42 @@ export declare const Container: (props: Omit<Pixi.ContainerOptions<Pixi.Containe
|
|
|
40
40
|
ref?: Ref<Pixi.Container<Pixi.ContainerChild>> | undefined;
|
|
41
41
|
as?: Pixi.Container<Pixi.ContainerChild> | undefined;
|
|
42
42
|
children?: JSX.Element;
|
|
43
|
-
}) => JSX.Element;
|
|
43
|
+
}) => Pixi.Container<Pixi.ContainerChild> & JSX.Element;
|
|
44
44
|
/**
|
|
45
45
|
* A SolidJS component that renders a `PIXI.Graphics`.
|
|
46
46
|
* Use a ref to access the underlying graphics instance and draw with it.
|
|
47
47
|
*/
|
|
48
|
-
export declare const Graphics: (props: Omit<Pixi.GraphicsOptions, "children"> & LeafProps<Pixi.Graphics>) => JSX.Element;
|
|
48
|
+
export declare const Graphics: (props: Omit<Pixi.GraphicsOptions, "children"> & LeafProps<Pixi.Graphics>) => Pixi.Graphics & JSX.Element;
|
|
49
49
|
/**
|
|
50
50
|
* A SolidJS component that renders a `PIXI.HTMLText`.
|
|
51
51
|
*/
|
|
52
|
-
export declare const HTMLText: (props: Omit<Pixi.HTMLTextOptions, "children"> & LeafProps<Pixi.HTMLText>) => JSX.Element;
|
|
52
|
+
export declare const HTMLText: (props: Omit<Pixi.HTMLTextOptions, "children"> & LeafProps<Pixi.HTMLText>) => Pixi.HTMLText & JSX.Element;
|
|
53
53
|
/**
|
|
54
54
|
* A SolidJS component that renders a `PIXI.MeshPlane`.
|
|
55
55
|
*/
|
|
56
|
-
export declare const MeshPlane: (props: Omit<Pixi.MeshPlaneOptions, "children"> & LeafProps<Pixi.MeshPlane>) => JSX.Element;
|
|
56
|
+
export declare const MeshPlane: (props: Omit<Pixi.MeshPlaneOptions, "children"> & LeafProps<Pixi.MeshPlane>) => Pixi.MeshPlane & JSX.Element;
|
|
57
57
|
/**
|
|
58
58
|
* A SolidJS component that renders a `PIXI.MeshRope`.
|
|
59
59
|
*/
|
|
60
|
-
export declare const MeshRope: (props: Omit<Pixi.MeshRopeOptions, "children"> & LeafProps<Pixi.MeshRope>) => JSX.Element;
|
|
60
|
+
export declare const MeshRope: (props: Omit<Pixi.MeshRopeOptions, "children"> & LeafProps<Pixi.MeshRope>) => Pixi.MeshRope & JSX.Element;
|
|
61
61
|
/**
|
|
62
62
|
* A SolidJS component that renders a `PIXI.MeshSimple`.
|
|
63
63
|
*/
|
|
64
|
-
export declare const MeshSimple: (props: Omit<Pixi.SimpleMeshOptions, "children"> & LeafProps<Pixi.MeshSimple>) => JSX.Element;
|
|
64
|
+
export declare const MeshSimple: (props: Omit<Pixi.SimpleMeshOptions, "children"> & LeafProps<Pixi.MeshSimple>) => Pixi.MeshSimple & JSX.Element;
|
|
65
65
|
/**
|
|
66
66
|
* A SolidJS component that renders a `PIXI.NineSliceSprite`.
|
|
67
67
|
*/
|
|
68
|
-
export declare const NineSliceSprite: (props: Omit<Pixi.NineSliceSpriteOptions, "children"> & LeafProps<Pixi.NineSliceSprite>) => JSX.Element;
|
|
68
|
+
export declare const NineSliceSprite: (props: Omit<Pixi.NineSliceSpriteOptions, "children"> & LeafProps<Pixi.NineSliceSprite>) => Pixi.NineSliceSprite & JSX.Element;
|
|
69
69
|
/**
|
|
70
70
|
* A SolidJS component that renders a `PIXI.ParticleContainer`.
|
|
71
71
|
*
|
|
72
72
|
* Particles should be added and removed from this component imperatively. Please see the docs for a reference example.
|
|
73
73
|
*/
|
|
74
|
-
export declare const ParticleContainer: (props: Omit<Pixi.ParticleContainerOptions, "children"> & LeafProps<Pixi.ParticleContainer>) => JSX.Element;
|
|
74
|
+
export declare const ParticleContainer: (props: Omit<Pixi.ParticleContainerOptions, "children"> & LeafProps<Pixi.ParticleContainer>) => Pixi.ParticleContainer & JSX.Element;
|
|
75
75
|
/**
|
|
76
76
|
* A SolidJS component that renders a `PIXI.PerspectiveMesh`.
|
|
77
77
|
*/
|
|
78
|
-
export declare const PerspectiveMesh: (props: Omit<Pixi.PerspectivePlaneOptions, "children"> & LeafProps<Pixi.PerspectiveMesh>) => JSX.Element;
|
|
78
|
+
export declare const PerspectiveMesh: (props: Omit<Pixi.PerspectivePlaneOptions, "children"> & LeafProps<Pixi.PerspectiveMesh>) => Pixi.PerspectiveMesh & JSX.Element;
|
|
79
79
|
/**
|
|
80
80
|
* A SolidJS component that renders a `PIXI.RenderContainer`.
|
|
81
81
|
*/
|
|
@@ -83,7 +83,7 @@ export declare const RenderContainer: (props: Omit<Pixi.RenderContainerOptions,
|
|
|
83
83
|
ref?: Ref<Pixi.RenderContainer> | undefined;
|
|
84
84
|
as?: Pixi.RenderContainer | undefined;
|
|
85
85
|
children?: JSX.Element;
|
|
86
|
-
}) => JSX.Element;
|
|
86
|
+
}) => Pixi.RenderContainer & JSX.Element;
|
|
87
87
|
/**
|
|
88
88
|
* A SolidJS component that renders a `PIXI.RenderLayer`.
|
|
89
89
|
*/
|
|
@@ -91,16 +91,16 @@ export declare const RenderLayer: (props: Omit<Pixi.RenderLayerOptions, "childre
|
|
|
91
91
|
ref?: Ref<Pixi.RenderLayer> | undefined;
|
|
92
92
|
as?: Pixi.RenderLayer | undefined;
|
|
93
93
|
children?: JSX.Element;
|
|
94
|
-
}) => JSX.Element;
|
|
94
|
+
}) => Pixi.RenderLayer & JSX.Element;
|
|
95
95
|
/**
|
|
96
96
|
* A SolidJS component that renders a `PIXI.Sprite`.
|
|
97
97
|
*/
|
|
98
|
-
export declare const Sprite: (props: Omit<Pixi.SpriteOptions, "children"> & LeafProps<Pixi.Sprite>) => JSX.Element;
|
|
98
|
+
export declare const Sprite: (props: Omit<Pixi.SpriteOptions, "children"> & LeafProps<Pixi.Sprite>) => Pixi.Sprite & JSX.Element;
|
|
99
99
|
/**
|
|
100
100
|
* A SolidJS component that renders a `PIXI.Text`.
|
|
101
101
|
*/
|
|
102
|
-
export declare const Text: (props: Omit<Pixi.CanvasTextOptions, "children"> & LeafProps<Pixi.Text>) => JSX.Element;
|
|
102
|
+
export declare const Text: (props: Omit<Pixi.CanvasTextOptions, "children"> & LeafProps<Pixi.Text>) => Pixi.Text & JSX.Element;
|
|
103
103
|
/**
|
|
104
104
|
* A SolidJS component that renders a `PIXI.TilingSprite`.
|
|
105
105
|
*/
|
|
106
|
-
export declare const TilingSprite: (props: Omit<Pixi.TilingSpriteOptions, "children"> & LeafProps<Pixi.TilingSprite>) => JSX.Element;
|
|
106
|
+
export declare const TilingSprite: (props: Omit<Pixi.TilingSpriteOptions, "children"> & LeafProps<Pixi.TilingSprite>) => Pixi.TilingSprite & JSX.Element;
|