pixi-solid 0.0.8 → 0.0.10
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-events.js +31 -1
- package/dist/pixi-events.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/pixi-events.d.ts +4 -4
- package/dist/types/use-resize.d.ts +9 -0
- package/dist/use-resize.js +27 -0
- package/dist/use-resize.js.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { PixiCanvas } from "./pixi-canvas.js";
|
|
|
3
3
|
import { PIXI_EVENT_NAMES } from "./pixi-events.js";
|
|
4
4
|
import { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, MeshSimple, NineSliceSprite, ParticleContainer, PerspectiveMesh, RenderContainer, RenderLayer, Sprite, Text, TilingSprite } from "./pixi-components.js";
|
|
5
5
|
import { PixiStage } from "./pixi-stage.js";
|
|
6
|
+
import { useResize } from "./use-resize.js";
|
|
6
7
|
import { useTick, useTicker } from "./use-ticker.js";
|
|
7
8
|
|
|
8
|
-
export { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, MeshSimple, NineSliceSprite, PIXI_EVENT_NAMES, ParticleContainer, PerspectiveMesh, PixiApplication, PixiCanvas, PixiStage, RenderContainer, RenderLayer, Sprite, Text, TilingSprite, usePixiApp, useTick, useTicker };
|
|
9
|
+
export { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, MeshSimple, NineSliceSprite, PIXI_EVENT_NAMES, ParticleContainer, PerspectiveMesh, PixiApplication, PixiCanvas, PixiStage, RenderContainer, RenderLayer, Sprite, Text, TilingSprite, usePixiApp, useResize, useTick, useTicker };
|
package/dist/pixi-events.js
CHANGED
|
@@ -32,7 +32,37 @@ const PIXI_EVENT_NAMES = [
|
|
|
32
32
|
"wheel",
|
|
33
33
|
"globalmousemove",
|
|
34
34
|
"globalpointermove",
|
|
35
|
-
"globaltouchmove"
|
|
35
|
+
"globaltouchmove",
|
|
36
|
+
"clickcapture",
|
|
37
|
+
"mousedowncapture",
|
|
38
|
+
"mouseentercapture",
|
|
39
|
+
"mouseleavecapture",
|
|
40
|
+
"mousemovecapture",
|
|
41
|
+
"mouseoutcapture",
|
|
42
|
+
"mouseovercapture",
|
|
43
|
+
"mouseupcapture",
|
|
44
|
+
"mouseupoutsidecapture",
|
|
45
|
+
"pointercancelcapture",
|
|
46
|
+
"pointerdowncapture",
|
|
47
|
+
"pointerentercapture",
|
|
48
|
+
"pointerleavecapture",
|
|
49
|
+
"pointermovecapture",
|
|
50
|
+
"pointeroutcapture",
|
|
51
|
+
"pointerovercapture",
|
|
52
|
+
"pointertapcapture",
|
|
53
|
+
"pointerupcapture",
|
|
54
|
+
"pointerupoutsidecapture",
|
|
55
|
+
"rightclickcapture",
|
|
56
|
+
"rightdowncapture",
|
|
57
|
+
"rightupcapture",
|
|
58
|
+
"rightupoutsidecapture",
|
|
59
|
+
"tapcapture",
|
|
60
|
+
"touchcancelcapture",
|
|
61
|
+
"touchendcapture",
|
|
62
|
+
"touchendoutsidecapture",
|
|
63
|
+
"touchmovecapture",
|
|
64
|
+
"touchstartcapture",
|
|
65
|
+
"wheelcapture"
|
|
36
66
|
];
|
|
37
67
|
const PIXI_EVENT_HANDLER_NAMES = PIXI_EVENT_NAMES.map((eventName) => `on${eventName}`);
|
|
38
68
|
const PIXI_EVENT_HANDLER_NAME_SET = new Set(PIXI_EVENT_HANDLER_NAMES);
|
package/dist/pixi-events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pixi-events.js","names":["PIXI_EVENT_NAMES: (keyof
|
|
1
|
+
{"version":3,"file":"pixi-events.js","names":["PIXI_EVENT_NAMES: (keyof FederatedEventEmitterTypes)[]","PIXI_EVENT_HANDLER_NAME_SET: Readonly<Set<(typeof PIXI_EVENT_HANDLER_NAMES)[number]>>","allEventsAreHandled: AllEventsAreHandled"],"sources":["../src/pixi-events.ts"],"sourcesContent":["import type { FederatedEventEmitterTypes } from \"pixi.js\";\n\nexport const PIXI_EVENT_NAMES: (keyof FederatedEventEmitterTypes)[] = [\n \"click\",\n \"mousedown\",\n \"mouseenter\",\n \"mouseleave\",\n \"mousemove\",\n \"mouseout\",\n \"mouseover\",\n \"mouseup\",\n \"mouseupoutside\",\n \"pointercancel\",\n \"pointerdown\",\n \"pointerenter\",\n \"pointerleave\",\n \"pointermove\",\n \"pointerout\",\n \"pointerover\",\n \"pointertap\",\n \"pointerup\",\n \"pointerupoutside\",\n \"rightclick\",\n \"rightdown\",\n \"rightup\",\n \"rightupoutside\",\n \"tap\",\n \"touchcancel\",\n \"touchend\",\n \"touchendoutside\",\n \"touchmove\",\n \"touchstart\",\n \"wheel\",\n \"globalmousemove\",\n \"globalpointermove\",\n \"globaltouchmove\",\n \"clickcapture\",\n \"mousedowncapture\",\n \"mouseentercapture\",\n \"mouseleavecapture\",\n \"mousemovecapture\",\n \"mouseoutcapture\",\n \"mouseovercapture\",\n \"mouseupcapture\",\n \"mouseupoutsidecapture\",\n \"pointercancelcapture\",\n \"pointerdowncapture\",\n \"pointerentercapture\",\n \"pointerleavecapture\",\n \"pointermovecapture\",\n \"pointeroutcapture\",\n \"pointerovercapture\",\n \"pointertapcapture\",\n \"pointerupcapture\",\n \"pointerupoutsidecapture\",\n \"rightclickcapture\",\n \"rightdowncapture\",\n \"rightupcapture\",\n \"rightupoutsidecapture\",\n \"tapcapture\",\n \"touchcancelcapture\",\n \"touchendcapture\",\n \"touchendoutsidecapture\",\n \"touchmovecapture\",\n \"touchstartcapture\",\n \"wheelcapture\",\n] as const;\n\nexport const PIXI_EVENT_HANDLER_NAMES = PIXI_EVENT_NAMES.map(\n (eventName) => `on${eventName}` as const,\n);\n\nexport type PixiEventHandlerMap = {\n [K in (typeof PIXI_EVENT_NAMES)[number] as `on${K}`]?:\n | null\n | ((...args: FederatedEventEmitterTypes[K]) => void);\n};\n\nexport const PIXI_EVENT_HANDLER_NAME_SET: Readonly<Set<(typeof PIXI_EVENT_HANDLER_NAMES)[number]>> =\n new Set(PIXI_EVENT_HANDLER_NAMES);\n\n/**\n * This is a type-safe check that ensures `PIXI_EVENT_NAMES` includes every key from Pixi's `AllFederatedEventMap` type.\n * It will cause a build error if any event names are missing.\n */\ntype MissingKeys = Exclude<keyof FederatedEventEmitterTypes, (typeof PIXI_EVENT_NAMES)[number]>;\ntype AllEventsAreHandled = MissingKeys extends never\n ? true\n : `Error: Missing event keys: ${MissingKeys}`;\nconst allEventsAreHandled: AllEventsAreHandled = true;\nvoid allEventsAreHandled;\n"],"mappings":";AAEA,MAAaA,mBAAyD;CACpE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,2BAA2B,iBAAiB,KACtD,cAAc,KAAK,YACrB;AAQD,MAAaC,8BACX,IAAI,IAAI,yBAAyB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export type { PixiEventHandlerMap } from "./pixi-events";
|
|
|
7
7
|
export { PIXI_EVENT_NAMES } from "./pixi-events";
|
|
8
8
|
export type { PixiStageProps } from "./pixi-stage";
|
|
9
9
|
export { PixiStage } from "./pixi-stage";
|
|
10
|
+
export { useResize } from "./use-resize";
|
|
10
11
|
export { useTick, useTicker } from "./use-ticker";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const PIXI_EVENT_NAMES: (keyof
|
|
3
|
-
export declare const PIXI_EVENT_HANDLER_NAMES: ("onclick" | "onmousedown" | "onmouseenter" | "onmouseleave" | "onmousemove" | "onmouseout" | "onmouseover" | "onmouseup" | "onmouseupoutside" | "onpointercancel" | "onpointerdown" | "onpointerenter" | "onpointerleave" | "onpointermove" | "onpointerout" | "onpointerover" | "onpointertap" | "onpointerup" | "onpointerupoutside" | "onrightclick" | "onrightdown" | "onrightup" | "onrightupoutside" | "ontap" | "ontouchcancel" | "ontouchend" | "ontouchendoutside" | "ontouchmove" | "ontouchstart" | "onwheel" | "onglobalmousemove" | "onglobalpointermove" | "onglobaltouchmove")[];
|
|
1
|
+
import type { FederatedEventEmitterTypes } from "pixi.js";
|
|
2
|
+
export declare const PIXI_EVENT_NAMES: (keyof FederatedEventEmitterTypes)[];
|
|
3
|
+
export declare const PIXI_EVENT_HANDLER_NAMES: ("onclick" | "onmousedown" | "onmouseenter" | "onmouseleave" | "onmousemove" | "onmouseout" | "onmouseover" | "onmouseup" | "onmouseupoutside" | "onpointercancel" | "onpointerdown" | "onpointerenter" | "onpointerleave" | "onpointermove" | "onpointerout" | "onpointerover" | "onpointertap" | "onpointerup" | "onpointerupoutside" | "onrightclick" | "onrightdown" | "onrightup" | "onrightupoutside" | "ontap" | "ontouchcancel" | "ontouchend" | "ontouchendoutside" | "ontouchmove" | "ontouchstart" | "onwheel" | "onglobalmousemove" | "onglobalpointermove" | "onglobaltouchmove" | "onclickcapture" | "onmousedowncapture" | "onmouseentercapture" | "onmouseleavecapture" | "onmousemovecapture" | "onmouseoutcapture" | "onmouseovercapture" | "onmouseupcapture" | "onmouseupoutsidecapture" | "onpointercancelcapture" | "onpointerdowncapture" | "onpointerentercapture" | "onpointerleavecapture" | "onpointermovecapture" | "onpointeroutcapture" | "onpointerovercapture" | "onpointertapcapture" | "onpointerupcapture" | "onpointerupoutsidecapture" | "onrightclickcapture" | "onrightdowncapture" | "onrightupcapture" | "onrightupoutsidecapture" | "ontapcapture" | "ontouchcancelcapture" | "ontouchendcapture" | "ontouchendoutsidecapture" | "ontouchmovecapture" | "ontouchstartcapture" | "onwheelcapture")[];
|
|
4
4
|
export type PixiEventHandlerMap = {
|
|
5
|
-
[K in (typeof PIXI_EVENT_NAMES)[number] as `on${K}`]?: (
|
|
5
|
+
[K in (typeof PIXI_EVENT_NAMES)[number] as `on${K}`]?: null | ((...args: FederatedEventEmitterTypes[K]) => void);
|
|
6
6
|
};
|
|
7
7
|
export declare const PIXI_EVENT_HANDLER_NAME_SET: Readonly<Set<(typeof PIXI_EVENT_HANDLER_NAMES)[number]>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as Pixi from "pixi.js";
|
|
2
|
+
/**
|
|
3
|
+
* A SolidJS hook that runs a callback function whenever the PixiJS renderer is resized.
|
|
4
|
+
*
|
|
5
|
+
* @param resizeCallback A callback function that receives the updated screen dimensions as a `Pixi.Rectangle` object. This function will be called immediately upon hook initialization and then on every subsequent resize event.
|
|
6
|
+
*
|
|
7
|
+
* Because we listen for the renderer's "resize" event, this hook will work correctly whether the window is resized or just the DOM element the PixiCanvas is inside changes size.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useResize: (resizeCallback: (screen: Pixi.Rectangle) => void) => void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { usePixiApp } from "./pixi-application.js";
|
|
2
|
+
import { onCleanup } from "solid-js";
|
|
3
|
+
|
|
4
|
+
//#region src/use-resize.ts
|
|
5
|
+
/**
|
|
6
|
+
* A SolidJS hook that runs a callback function whenever the PixiJS renderer is resized.
|
|
7
|
+
*
|
|
8
|
+
* @param resizeCallback A callback function that receives the updated screen dimensions as a `Pixi.Rectangle` object. This function will be called immediately upon hook initialization and then on every subsequent resize event.
|
|
9
|
+
*
|
|
10
|
+
* Because we listen for the renderer's "resize" event, this hook will work correctly whether the window is resized or just the DOM element the PixiCanvas is inside changes size.
|
|
11
|
+
*/
|
|
12
|
+
const useResize = (resizeCallback) => {
|
|
13
|
+
const app = usePixiApp();
|
|
14
|
+
app.renderer.screen.fit;
|
|
15
|
+
const handleResize = () => {
|
|
16
|
+
resizeCallback(app.renderer.screen);
|
|
17
|
+
};
|
|
18
|
+
handleResize();
|
|
19
|
+
app.renderer.addListener("resize", handleResize);
|
|
20
|
+
onCleanup(() => {
|
|
21
|
+
app.renderer.removeListener("resize", handleResize);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { useResize };
|
|
27
|
+
//# sourceMappingURL=use-resize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-resize.js","names":[],"sources":["../src/use-resize.ts"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport { onCleanup } from \"solid-js\";\nimport { usePixiApp } from \"./pixi-application\";\n\n/**\n * A SolidJS hook that runs a callback function whenever the PixiJS renderer is resized.\n *\n * @param resizeCallback A callback function that receives the updated screen dimensions as a `Pixi.Rectangle` object. This function will be called immediately upon hook initialization and then on every subsequent resize event.\n *\n * Because we listen for the renderer's \"resize\" event, this hook will work correctly whether the window is resized or just the DOM element the PixiCanvas is inside changes size.\n */\nexport const useResize = (resizeCallback: (screen: Pixi.Rectangle) => void): void => {\n const app = usePixiApp();\n\n app.renderer.screen.fit;\n\n const handleResize = () => {\n resizeCallback(app.renderer.screen);\n };\n\n // Call once to initialise\n handleResize();\n\n app.renderer.addListener(\"resize\", handleResize);\n\n onCleanup(() => {\n app.renderer.removeListener(\"resize\", handleResize);\n });\n};\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,aAAa,mBAA2D;CACnF,MAAM,MAAM,YAAY;AAExB,KAAI,SAAS,OAAO;CAEpB,MAAM,qBAAqB;AACzB,iBAAe,IAAI,SAAS,OAAO;;AAIrC,eAAc;AAEd,KAAI,SAAS,YAAY,UAAU,aAAa;AAEhD,iBAAgB;AACd,MAAI,SAAS,eAAe,UAAU,aAAa;GACnD"}
|