pixi-solid 0.0.1

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.
Files changed (90) hide show
  1. package/LICENSE.txt +21 -0
  2. package/README.md +115 -0
  3. package/dist/examples/AnimatedSprite.example.jsx +17 -0
  4. package/dist/examples/AnimatedSprite.example.jsx.map +1 -0
  5. package/dist/examples/BitmapText.example.jsx +8 -0
  6. package/dist/examples/BitmapText.example.jsx.map +1 -0
  7. package/dist/examples/Container.example.jsx +8 -0
  8. package/dist/examples/Container.example.jsx.map +1 -0
  9. package/dist/examples/Graphics.example.jsx +7 -0
  10. package/dist/examples/Graphics.example.jsx.map +1 -0
  11. package/dist/examples/HTMLText.example.jsx +5 -0
  12. package/dist/examples/HTMLText.example.jsx.map +1 -0
  13. package/dist/examples/MeshPlane.example.jsx +6 -0
  14. package/dist/examples/MeshPlane.example.jsx.map +1 -0
  15. package/dist/examples/MeshRope.example.jsx +10 -0
  16. package/dist/examples/MeshRope.example.jsx.map +1 -0
  17. package/dist/examples/MeshSimple.example.jsx +9 -0
  18. package/dist/examples/MeshSimple.example.jsx.map +1 -0
  19. package/dist/examples/NineSliceSprite.example.jsx +7 -0
  20. package/dist/examples/NineSliceSprite.example.jsx.map +1 -0
  21. package/dist/examples/ParticleContainer.example.jsx +30 -0
  22. package/dist/examples/ParticleContainer.example.jsx.map +1 -0
  23. package/dist/examples/PerspectiveMesh.example.jsx +6 -0
  24. package/dist/examples/PerspectiveMesh.example.jsx.map +1 -0
  25. package/dist/examples/PixiApplication.example.jsx +12 -0
  26. package/dist/examples/PixiApplication.example.jsx.map +1 -0
  27. package/dist/examples/PixiCanvas.example.jsx +12 -0
  28. package/dist/examples/PixiCanvas.example.jsx.map +1 -0
  29. package/dist/examples/PixiStage.example.jsx +12 -0
  30. package/dist/examples/PixiStage.example.jsx.map +1 -0
  31. package/dist/examples/RenderContainer.example.jsx +8 -0
  32. package/dist/examples/RenderContainer.example.jsx.map +1 -0
  33. package/dist/examples/RenderLayer.example.jsx +10 -0
  34. package/dist/examples/RenderLayer.example.jsx.map +1 -0
  35. package/dist/examples/Sprite.example.jsx +6 -0
  36. package/dist/examples/Sprite.example.jsx.map +1 -0
  37. package/dist/examples/Text.example.jsx +9 -0
  38. package/dist/examples/Text.example.jsx.map +1 -0
  39. package/dist/examples/TilingSprite.example.jsx +6 -0
  40. package/dist/examples/TilingSprite.example.jsx.map +1 -0
  41. package/dist/examples/useTick.example.jsx +12 -0
  42. package/dist/examples/useTick.example.jsx.map +1 -0
  43. package/dist/examples/useTicker.example.jsx +8 -0
  44. package/dist/examples/useTicker.example.jsx.map +1 -0
  45. package/dist/index.js +7 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/pixi-application.jsx +86 -0
  48. package/dist/pixi-application.jsx.map +1 -0
  49. package/dist/pixi-canvas.jsx +65 -0
  50. package/dist/pixi-canvas.jsx.map +1 -0
  51. package/dist/pixi-components.jsx +214 -0
  52. package/dist/pixi-components.jsx.map +1 -0
  53. package/dist/pixi-events.js +40 -0
  54. package/dist/pixi-events.js.map +1 -0
  55. package/dist/pixi-stage.jsx +30 -0
  56. package/dist/pixi-stage.jsx.map +1 -0
  57. package/dist/renderer.jsx +74 -0
  58. package/dist/renderer.jsx.map +1 -0
  59. package/dist/types/examples/AnimatedSprite.example.d.ts +1 -0
  60. package/dist/types/examples/BitmapText.example.d.ts +1 -0
  61. package/dist/types/examples/Container.example.d.ts +1 -0
  62. package/dist/types/examples/Graphics.example.d.ts +1 -0
  63. package/dist/types/examples/HTMLText.example.d.ts +1 -0
  64. package/dist/types/examples/MeshPlane.example.d.ts +1 -0
  65. package/dist/types/examples/MeshRope.example.d.ts +1 -0
  66. package/dist/types/examples/MeshSimple.example.d.ts +1 -0
  67. package/dist/types/examples/NineSliceSprite.example.d.ts +1 -0
  68. package/dist/types/examples/ParticleContainer.example.d.ts +1 -0
  69. package/dist/types/examples/PerspectiveMesh.example.d.ts +1 -0
  70. package/dist/types/examples/PixiApplication.example.d.ts +1 -0
  71. package/dist/types/examples/PixiCanvas.example.d.ts +1 -0
  72. package/dist/types/examples/PixiStage.example.d.ts +1 -0
  73. package/dist/types/examples/RenderContainer.example.d.ts +1 -0
  74. package/dist/types/examples/RenderLayer.example.d.ts +1 -0
  75. package/dist/types/examples/Sprite.example.d.ts +1 -0
  76. package/dist/types/examples/Text.example.d.ts +1 -0
  77. package/dist/types/examples/TilingSprite.example.d.ts +1 -0
  78. package/dist/types/examples/useTick.example.d.ts +1 -0
  79. package/dist/types/examples/useTicker.example.d.ts +1 -0
  80. package/dist/types/index.d.ts +10 -0
  81. package/dist/types/pixi-application.d.ts +45 -0
  82. package/dist/types/pixi-canvas.d.ts +23 -0
  83. package/dist/types/pixi-components.d.ts +182 -0
  84. package/dist/types/pixi-events.d.ts +7 -0
  85. package/dist/types/pixi-stage.d.ts +25 -0
  86. package/dist/types/renderer.d.ts +2 -0
  87. package/dist/types/use-ticker.d.ts +31 -0
  88. package/dist/use-ticker.jsx +39 -0
  89. package/dist/use-ticker.jsx.map +1 -0
  90. package/package.json +50 -0
@@ -0,0 +1,65 @@
1
+ import { createRenderEffect, onCleanup, onMount } from "solid-js";
2
+ import { usePixiApp } from "./pixi-application";
3
+ /**
4
+ * PixiCanvas
5
+ *
6
+ * A small wrapper that mounts the PIXI application's canvas element into the DOM
7
+ * and automatically resizes it.
8
+ *
9
+ * - Requires a surrounding `PixiApplication` (accessed via `usePixiApp`).
10
+ * - Requires a `PixiStage` component as a child.
11
+ *
12
+ * Props:
13
+ * @param props.children - JSX content to render inside the canvas wrapper. Use
14
+ * `PixiStage` as the only child.
15
+ *
16
+ * **Example**
17
+ * {@includeCode ./examples/PixiCanvas.example.tsx}
18
+ *
19
+ */
20
+ export const PixiCanvas = (props) => {
21
+ let canvasWrapElement;
22
+ const pixiApp = usePixiApp();
23
+ pixiApp.canvas.style.display = "block";
24
+ pixiApp.canvas.style.position = "absolute";
25
+ pixiApp.canvas.style.top = "0";
26
+ pixiApp.canvas.style.left = "0";
27
+ pixiApp.canvas.style.width = "100%";
28
+ pixiApp.canvas.style.height = "100%";
29
+ createRenderEffect(() => {
30
+ if (props.children === undefined) {
31
+ throw new Error("PixiCanvas requires the `PixiStage` component to render.");
32
+ }
33
+ });
34
+ let previousResizeTo;
35
+ let resizeObserver;
36
+ onMount(() => {
37
+ if (!canvasWrapElement)
38
+ return;
39
+ previousResizeTo = pixiApp.resizeTo;
40
+ pixiApp.resizeTo = canvasWrapElement;
41
+ pixiApp.queueResize();
42
+ resizeObserver = new ResizeObserver(() => {
43
+ pixiApp.queueResize();
44
+ });
45
+ resizeObserver.observe(canvasWrapElement);
46
+ });
47
+ onCleanup(() => {
48
+ if (!canvasWrapElement)
49
+ return;
50
+ pixiApp.resizeTo = previousResizeTo;
51
+ resizeObserver?.disconnect();
52
+ resizeObserver = undefined;
53
+ });
54
+ return (<div ref={canvasWrapElement} style={{
55
+ ...{
56
+ position: "relative",
57
+ flex: 1,
58
+ display: "block",
59
+ },
60
+ ...(typeof props.style === "object" ? props.style : {}),
61
+ }} classList={{ [props.className || ""]: props.className !== undefined }}>
62
+ {pixiApp.canvas}
63
+ </div>);
64
+ };
65
+ //# sourceMappingURL=pixi-canvas.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixi-canvas.jsx","sourceRoot":"","sources":["../src/pixi-canvas.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAI1B,EAAe,EAAE;IAChB,IAAI,iBAA6C,CAAC;IAElD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IACvC,OAAO,CAA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G;gBACD,QAAQ,EAAE,UAAU;gBACpB,IAAI,EAAE,CAAC;gBACP,OAAO,EAAE,OAAO;aACjB;YACD,GAAG,CAAC,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;SACxD,CAAC,CACF,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC,CAEtE;MAAA,CAAC,OAAO,CAAC,MAAM,CACjB;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,214 @@
1
+ import { AnimatedSprite as PixiAnimatedSprite, BitmapText as PixiBitmapText, Container as PixiContainer, Graphics as PixiGraphics, HTMLText as PixiHTMLText, MeshPlane as PixiMeshPlane, MeshRope as PixiMeshRope, MeshSimple as PixiMeshSimple, NineSliceSprite as PixiNineSliceSprite, ParticleContainer as PixiParticleContainer, PerspectiveMesh as PixiPerspectiveMesh, RenderContainer as PixiRenderContainer, RenderLayer as PixiRenderLayer, Sprite as PixiSprite, Text as PixiText, TilingSprite as PixiTilingSprite, } from "pixi.js";
2
+ import { createRenderEffect, splitProps } from "solid-js";
3
+ import { PIXI_EVENT_HANDLER_NAMES } from "./pixi-events";
4
+ import { insert, setProp } from "./renderer";
5
+ // Keys that are specific to Solid components and not Pixi props
6
+ export const SOLID_PROP_KEYS = ["ref", "as", "children"];
7
+ /**
8
+ * Apply's the props to a Pixi instance with subsriptions to maintain reactivity.
9
+ *
10
+ * @param instance The Pixi instance we want to apply props to.
11
+ * @param props The props object.
12
+ */
13
+ export const applyProps = (instance, props) => {
14
+ for (const key in props) {
15
+ if (key === "as")
16
+ continue;
17
+ if (key === "ref") {
18
+ createRenderEffect(() => {
19
+ // Solid converts the ref prop to a callback function
20
+ props[key](instance);
21
+ });
22
+ }
23
+ else if (key === "children") {
24
+ if (!("addChild" in instance)) {
25
+ throw new Error(`Cannot set children on non-container instance.`);
26
+ }
27
+ createRenderEffect(() => {
28
+ insert(instance, () => props.children);
29
+ });
30
+ }
31
+ else {
32
+ createRenderEffect(() => {
33
+ setProp(instance, key, props[key]);
34
+ });
35
+ }
36
+ }
37
+ };
38
+ const createContainerComponent = (PixiClass) => {
39
+ return (props) => {
40
+ const [runtimeProps, initialisationProps] = splitProps(props, [
41
+ ...SOLID_PROP_KEYS,
42
+ ...PIXI_EVENT_HANDLER_NAMES,
43
+ ]);
44
+ const instance = props.as || new PixiClass(initialisationProps);
45
+ applyProps(instance, initialisationProps);
46
+ applyProps(instance, runtimeProps);
47
+ return instance;
48
+ };
49
+ };
50
+ const createLeafComponent = (PixiClass) => {
51
+ return (props) => {
52
+ return createContainerComponent(PixiClass)(props);
53
+ };
54
+ };
55
+ /**
56
+ * A SolidJS component that renders a PIXI.AnimatedSprite.
57
+ *
58
+ * **Example**
59
+ * {@includeCode ./examples/AnimatedSprite.example.tsx}
60
+ *
61
+ * {@link PixiAnimatedSprite}
62
+ *
63
+ */
64
+ export const AnimatedSprite = createLeafComponent(PixiAnimatedSprite);
65
+ /**
66
+ * A SolidJS component that renders a PIXI.BitmapText.
67
+ *
68
+ * **Example**
69
+ * {@includeCode ./examples/BitmapText.example.tsx}
70
+ *
71
+ * {@link PixiBitmapText}
72
+ *
73
+ */
74
+ export const BitmapText = createLeafComponent(PixiBitmapText);
75
+ /**
76
+ * A SolidJS component that renders a PIXI.Container.
77
+ *
78
+ * **Example**
79
+ * {@includeCode ./examples/Container.example.tsx}
80
+ *
81
+ */
82
+ export const Container = createContainerComponent(PixiContainer);
83
+ /**
84
+ * A SolidJS component that renders a PIXI.Graphics.
85
+ * Use a ref to access the underlying graphics instance and draw with it.
86
+ *
87
+ * **Example**
88
+ * {@includeCode ./examples/Graphics.example.tsx}
89
+ *
90
+ * {@link PixiGraphics}
91
+ */
92
+ export const Graphics = createLeafComponent(PixiGraphics);
93
+ /**
94
+ * A SolidJS component that renders a PIXI.HTMLText.
95
+ *
96
+ * **Example**
97
+ * {@includeCode ./examples/HTMLText.example.tsx}
98
+ *
99
+ * {@link PixiHTMLText}
100
+ */
101
+ export const HTMLText = createLeafComponent(PixiHTMLText);
102
+ /**
103
+ * A SolidJS component that renders a PIXI.MeshPlane.
104
+ *
105
+ * **Example**
106
+ * {@includeCode ./examples/MeshPlane.example.tsx}
107
+ *
108
+ * {@link PixiMeshPlane}
109
+ */
110
+ export const MeshPlane = createLeafComponent(PixiMeshPlane);
111
+ /**
112
+ * A SolidJS component that renders a PIXI.MeshRope.
113
+ *
114
+ * **Example**
115
+ * {@includeCode ./examples/MeshRope.example.tsx}
116
+ *
117
+ * {@link PixiMeshRope}
118
+ */
119
+ export const MeshRope = createLeafComponent(PixiMeshRope);
120
+ /**
121
+ * A SolidJS component that renders a PIXI.MeshSimple.
122
+ *
123
+ * **Example**
124
+ * {@includeCode ./examples/MeshSimple.example.tsx}
125
+ *
126
+ * {@link PixiMeshSimple}
127
+ */
128
+ export const MeshSimple = createLeafComponent(PixiMeshSimple);
129
+ /**
130
+ * A SolidJS component that renders a PIXI.NineSliceSprite.
131
+ *
132
+ * **Example**
133
+ * {@includeCode ./examples/NineSliceSprite.example.tsx}
134
+ *
135
+ * {@link PixiNineSliceSprite}
136
+ */
137
+ export const NineSliceSprite = createLeafComponent(PixiNineSliceSprite);
138
+ /**
139
+ * A SolidJS component that renders a PIXI.ParticleContainer.
140
+ *
141
+ * **Example**
142
+ * {@includeCode ./examples/ParticleContainer.example.tsx}
143
+ *
144
+ * {@link PixiParticleContainer}
145
+ */
146
+ export const ParticleContainer = createLeafComponent(PixiParticleContainer);
147
+ /**
148
+ * A SolidJS component that renders a PIXI.PerspectiveMesh.
149
+ *
150
+ * **Example**
151
+ * {@includeCode ./examples/PerspectiveMesh.example.tsx}
152
+ *
153
+ * {@link PixiPerspectiveMesh}
154
+ */
155
+ export const PerspectiveMesh = createLeafComponent(PixiPerspectiveMesh);
156
+ /**
157
+ * A SolidJS component that renders a PIXI.RenderContainer.
158
+ *
159
+ * **Example**
160
+ * {@includeCode ./examples/RenderContainer.example.tsx}
161
+ *
162
+ * {@link PixiRenderContainer}
163
+ */
164
+ export const RenderContainer = createContainerComponent(PixiRenderContainer);
165
+ /**
166
+ * A SolidJS component that renders a PIXI.RenderLayer.
167
+ *
168
+ * **Example**
169
+ * {@includeCode ./examples/RenderLayer.example.tsx}
170
+ *
171
+ * {@link PixiRenderLayer}
172
+ */
173
+ export const RenderLayer = createContainerComponent(PixiRenderLayer);
174
+ /**
175
+ * A SolidJS component that renders a PIXI.Sprite.
176
+ *
177
+ * **Example**
178
+ * {@includeCode ./examples/Sprite.example.tsx}
179
+ *
180
+ * {@link PixiSprite}
181
+ */
182
+ export const Sprite = createLeafComponent(PixiSprite);
183
+ /**
184
+ * A SolidJS component that renders a PIXI.Text.
185
+ *
186
+ * **Example**
187
+ * {@includeCode ./examples/Text.example.tsx}
188
+ *
189
+ * {@link PixiText}
190
+ */
191
+ export const Text = createLeafComponent(PixiText);
192
+ /**
193
+ * A SolidJS component that renders a PIXI.TilingSprite.
194
+ *
195
+ * **Example**
196
+ * {@includeCode ./examples/TilingSprite.example.tsx}
197
+ *
198
+ * {@link PixiTilingSprite}
199
+ */
200
+ export const TilingSprite = createLeafComponent(PixiTilingSprite);
201
+ // export const MeshGeometry = createLeafComponent<PixiMeshGeometry, Pixi.MeshGeometryOptions>(PixiMeshGeometry);
202
+ // export const NineSliceGeometry = createLeafComponent<PixiNineSliceGeometry, Pixi.NineSliceGeometryOptions>(
203
+ // PixiNineSliceGeometry
204
+ // );
205
+ // export const Particle = createLeafComponent<PixiParticle, Pixi.ParticleOptions>(PixiParticle);
206
+ // export const PerspectivePlaneGeometry = createLeafComponent<
207
+ // PixiPerspectivePlaneGeometry,
208
+ // Pixi.PerspectivePlaneGeometryOptions
209
+ // >(PixiPerspectivePlaneGeometry);
210
+ // export const PlaneGeometry = createLeafComponent<PixiPlaneGeometry, Pixi.PlaneGeometryOptions>(PixiPlaneGeometry);
211
+ // export const RopeGeometry = createLeafComponent<PixiRopeGeometry, Pixi.RopeGeometryOptions>(PixiRopeGeometry);
212
+ // TODO: Don't need a component for the Culler. It needs to interact with the stage directly.
213
+ // export const Culler = createLeafComponent<PixiCuller, Pixi.Culler>(PixiCuller);
214
+ //# sourceMappingURL=pixi-components.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixi-components.jsx","sourceRoot":"","sources":["../src/pixi-components.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,IAAI,kBAAkB,EACpC,UAAU,IAAI,cAAc,EAC5B,SAAS,IAAI,aAAa,EAC1B,QAAQ,IAAI,YAAY,EACxB,QAAQ,IAAI,YAAY,EACxB,SAAS,IAAI,aAAa,EAC1B,QAAQ,IAAI,YAAY,EACxB,UAAU,IAAI,cAAc,EAC5B,eAAe,IAAI,mBAAmB,EACtC,iBAAiB,IAAI,qBAAqB,EAC1C,eAAe,IAAI,mBAAmB,EACtC,eAAe,IAAI,mBAAmB,EACtC,WAAW,IAAI,eAAe,EAC9B,MAAM,IAAI,UAAU,EACpB,IAAI,IAAI,QAAQ,EAChB,YAAY,IAAI,gBAAgB,GACjC,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAgB7C,gEAAgE;AAChE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,CAAU,CAAC;AAElE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAIxB,QAAsB,EACtB,KAAkB,EAClB,EAAE;IACF,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,IAAI,GAAG,KAAK,I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;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,wBAAwB,CACjD,eAAe,CAChB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,mBAAmB,CAAiC,UAAU,CAAC,CAAC;AACtF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,mBAAmB,CAAmC,QAAQ,CAAC,CAAC;AAEpF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAC7C,gBAAgB,CACjB,CAAC;AAEF,iHAAiH;AACjH,8GAA8G;AAC9G,0BAA0B;AAC1B,KAAK;AAEL,iGAAiG;AACjG,+DAA+D;AAC/D,kCAAkC;AAClC,yCAAyC;AACzC,mCAAmC;AACnC,qHAAqH;AACrH,iHAAiH;AAEjH,6FAA6F;AAC7F,kFAAkF"}
@@ -0,0 +1,40 @@
1
+ export const PIXI_EVENT_NAMES = [
2
+ "click",
3
+ "mousedown",
4
+ "mouseenter",
5
+ "mouseleave",
6
+ "mousemove",
7
+ "mouseout",
8
+ "mouseover",
9
+ "mouseup",
10
+ "mouseupoutside",
11
+ "pointercancel",
12
+ "pointerdown",
13
+ "pointerenter",
14
+ "pointerleave",
15
+ "pointermove",
16
+ "pointerout",
17
+ "pointerover",
18
+ "pointertap",
19
+ "pointerup",
20
+ "pointerupoutside",
21
+ "rightclick",
22
+ "rightdown",
23
+ "rightup",
24
+ "rightupoutside",
25
+ "tap",
26
+ "touchcancel",
27
+ "touchend",
28
+ "touchendoutside",
29
+ "touchmove",
30
+ "touchstart",
31
+ "wheel",
32
+ "globalmousemove",
33
+ "globalpointermove",
34
+ "globaltouchmove",
35
+ ];
36
+ export const PIXI_EVENT_HANDLER_NAMES = PIXI_EVENT_NAMES.map((eventName) => `on${eventName}`);
37
+ export const PIXI_EVENT_HANDLER_NAME_SET = new Set(PIXI_EVENT_HANDLER_NAMES);
38
+ const allEventsAreHandled = true;
39
+ void allEventsAreHandled;
40
+ //# sourceMappingURL=pixi-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixi-events.js","sourceRoot":"","sources":["../src/pixi-events.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAmC;IAC9D,OAAO;IACP,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,UAAU;IACV,WAAW;IACX,SAAS;IACT,gBAAgB;IAChB,eAAe;IACf,aAAa;IACb,cAAc;IACd,cAAc;IACd,aAAa;IACb,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,WAAW;IACX,kBAAkB;IAClB,YAAY;IACZ,WAAW;IACX,SAAS;IACT,gBAAgB;IAChB,KAAK;IACL,aAAa;IACb,UAAU;IACV,iBAAiB;IACjB,WAAW;IACX,YAAY;IACZ,OAAO;IACP,iBAAiB;IACjB,mBAAmB;IACnB,iBAAiB;CACT,CAAC;AAEX,MAAM,CAAC,MAAM,wBAAwB,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,SAAS,EAAW,CAAC,CAAC;AAMvG,MAAM,CAAC,MAAM,2BAA2B,GAA6D,IAAI,GAAG,CAC1G,wBAAwB,CACzB,CAAC;AAQF,MAAM,mBAAmB,GAAwB,IAAI,CAAC;AACtD,KAAK,mBAAmB,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { createRenderEffect } from "solid-js";
2
+ import { usePixiApp } from "./pixi-application";
3
+ import { applyProps } from "./pixi-components";
4
+ import { insert } from "./renderer";
5
+ /**
6
+ * PixiStage
7
+ *
8
+ * The root container for rendering Pixi display objects. This component
9
+ * uses the application stage (`pixiApp.stage`) as the mount point and
10
+ * applies props and event handlers to it.
11
+ *
12
+ * Props:
13
+ * - `ref` (optional): receives the stage container reference.
14
+ * - Event handler props (e.g. `onpointerdown`) are forwarded to the stage.
15
+ * - Any other container options supported by Pixi may be passed.
16
+ *
17
+ * Children passed to `PixiStage` are inserted into the application stage.
18
+ *
19
+ * **Example**
20
+ * {@includeCode ./examples/PixiStage.example.tsx}
21
+ */
22
+ export const PixiStage = (props) => {
23
+ const pixiApp = usePixiApp();
24
+ applyProps(pixiApp.stage, props);
25
+ createRenderEffect(() => {
26
+ insert(pixiApp.stage, () => props.children);
27
+ });
28
+ return <>{pixiApp.stage}</>;
29
+ };
30
+ //# sourceMappingURL=pixi-stage.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixi-stage.jsx","sourceRoot":"","sources":["../src/pixi-stage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAQpC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAe,EAAE;IAC9D,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAEjC,kBAAkB,CAAC,GAAG,EAAE;QACtB,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;AAC9B,CAAC,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { Text as PixiText } from "pixi.js";
2
+ import { createRenderer } from "solid-js/universal";
3
+ import { PIXI_EVENT_HANDLER_NAME_SET } from "./pixi-events";
4
+ export const { effect, memo, createComponent, createElement, createTextNode, insertNode, insert, setProp, mergeProps, use, render, spread, } = createRenderer({
5
+ createElement(name) {
6
+ // This function is for lowercase string tags like `<container />`.
7
+ // To support tree-shaking, we require users to import components
8
+ // directly and use them with an uppercase name like `<Container />`,
9
+ // which does not call this function.
10
+ throw new Error(`Cannot create element "${name}". Please import components directly from 'pixi-solid' and use them with a capital letter.`);
11
+ },
12
+ createTextNode(value) {
13
+ return new PixiText({ text: value });
14
+ },
15
+ replaceText(textNode, value) {
16
+ textNode.text = value;
17
+ },
18
+ setProperty(node, name, value, prev) {
19
+ // Check for event listeners and handle them appropriately.
20
+ if (PIXI_EVENT_HANDLER_NAME_SET.has(name)) {
21
+ // Remove the 'on' prefix to get the actual event name.
22
+ const eventName = name.slice(2);
23
+ if (prev) {
24
+ node.removeEventListener(eventName, prev);
25
+ }
26
+ node.addEventListener(eventName, value);
27
+ return;
28
+ }
29
+ if (name in node) {
30
+ node[name] = value;
31
+ return;
32
+ }
33
+ },
34
+ insertNode(parent, node, anchor) {
35
+ // RenderLayer uses `attach` instead of `addChild`.
36
+ if ("attach" in parent && typeof parent.attach === "function") {
37
+ parent.attach(node);
38
+ // Note: `attach` does not support anchoring, so we ignore the anchor.
39
+ return;
40
+ }
41
+ if (!("addChildAt" in parent) ||
42
+ !("addChild" in parent) ||
43
+ typeof parent.addChild !== "function") {
44
+ throw new Error("Parent does not support children.");
45
+ }
46
+ if (anchor) {
47
+ parent.addChildAt(node, parent.children.indexOf(anchor));
48
+ }
49
+ else {
50
+ parent.addChild(node);
51
+ }
52
+ },
53
+ isTextNode(node) {
54
+ return node instanceof PixiText;
55
+ },
56
+ removeNode(_, node) {
57
+ node.removeFromParent();
58
+ node.destroy({ children: true });
59
+ },
60
+ getParentNode(node) {
61
+ return node?.parent ?? undefined;
62
+ },
63
+ getFirstChild(node) {
64
+ return node.children?.[0];
65
+ },
66
+ getNextSibling(node) {
67
+ if (!node.parent)
68
+ return undefined;
69
+ const index = node.parent.children.indexOf(node);
70
+ // Return the next child if it exists, otherwise undefined.
71
+ return index > -1 ? node.parent.children[index + 1] : undefined;
72
+ },
73
+ });
74
+ //# sourceMappingURL=renderer.jsx.map
@@ -0,0 +1 @@
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C;QACnC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACjD,2DAA2D;QAC3D,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAClE,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const MyAnimatedSpriteComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyBitmapTextComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyContainerComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyGraphicsComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyHTMLTextComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyMeshPlaneComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyMeshRopeComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyMeshSimpleComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyNineSliceSpriteComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyParticleContainerComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyPerspectiveMeshComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const PixiApplicationExample: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const PixiCanvasExample: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const PixiStageExample: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyRenderContainerComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyRenderLayerComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MySpriteComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyTextComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyTilingSpriteComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const UseTickExample: () => import("solid-js").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MyComponent: () => import("solid-js").JSX.Element;
@@ -0,0 +1,10 @@
1
+ export type { PixiApplicationProps } from "./pixi-application";
2
+ export { PixiApplication, usePixiApp } from "./pixi-application";
3
+ export { PixiCanvas } from "./pixi-canvas";
4
+ export type { ContainerProps, LeafProps } from "./pixi-components";
5
+ export { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, MeshSimple, NineSliceSprite, ParticleContainer, PerspectiveMesh, RenderContainer, RenderLayer, Sprite, Text, TilingSprite, } from "./pixi-components";
6
+ export type { PixiEventHandlerMap } from "./pixi-events";
7
+ export { PIXI_EVENT_NAMES } from "./pixi-events";
8
+ export type { PixiStageProps } from "./pixi-stage";
9
+ export { PixiStage } from "./pixi-stage";
10
+ export { useTick, useTicker } from "./use-ticker";
@@ -0,0 +1,45 @@
1
+ import type { ApplicationOptions, Container } from "pixi.js";
2
+ import { Application } from "pixi.js";
3
+ import type { JSX, Ref } from "solid-js";
4
+ /**
5
+ * A custom SolidJS hook to access the root PIXI.Application instance.
6
+ * This hook must be called from a component that is a descendant of `PixiApplication`.
7
+ *
8
+ * @returns The PIXI.Application instance provided by the `PixiApplication` component.
9
+ * @throws Will throw an error if used outside of a `PixiApplication` context provider.
10
+ * @example
11
+ * ```tsx
12
+ * const MyComponent = () => {
13
+ * const app = usePixiApp();
14
+ *
15
+ * createEffect(() => {
16
+ * console.log('App resolution:', app.renderer.resolution);
17
+ * });
18
+ *
19
+ * return <Sprite texture={Texture.WHITE} />;
20
+ * };
21
+ * ```
22
+ */
23
+ export declare const usePixiApp: () => Application<import("pixi.js").Renderer>;
24
+ /**
25
+ * Props for the `PixiApplication` component. It extends the PIXI.ApplicationOptions
26
+ * to allow passing configuration directly to the Pixi.js Application constructor,
27
+ * but omits properties that are handled by the component itself.
28
+ */
29
+ export type PixiApplicationProps = Partial<Omit<ApplicationOptions, "children" | "resizeTo" | "view">> & {
30
+ ref?: Ref<Container>;
31
+ children?: JSX.Element;
32
+ };
33
+ /**
34
+ * A SolidJS component that creates and manages a PIXI.Application instance.
35
+ * It provides the application instance through context to be used by child components
36
+ * and custom hooks like `usePixiApp`, `useTick`, and `useTicker`.
37
+ *
38
+ * This component should only be used once in your application.
39
+ *
40
+ * @param props The properties to configure the Pixi.js Application.
41
+ *
42
+ * **Example**
43
+ * {@includeCode ./examples/PixiApplication.example.tsx}
44
+ */
45
+ export declare const PixiApplication: (props: PixiApplicationProps) => JSX.Element;
@@ -0,0 +1,23 @@
1
+ import type { JSX } from "solid-js";
2
+ /**
3
+ * PixiCanvas
4
+ *
5
+ * A small wrapper that mounts the PIXI application's canvas element into the DOM
6
+ * and automatically resizes it.
7
+ *
8
+ * - Requires a surrounding `PixiApplication` (accessed via `usePixiApp`).
9
+ * - Requires a `PixiStage` component as a child.
10
+ *
11
+ * Props:
12
+ * @param props.children - JSX content to render inside the canvas wrapper. Use
13
+ * `PixiStage` as the only child.
14
+ *
15
+ * **Example**
16
+ * {@includeCode ./examples/PixiCanvas.example.tsx}
17
+ *
18
+ */
19
+ export declare const PixiCanvas: (props: {
20
+ children: JSX.Element;
21
+ style?: JSX.CSSProperties | undefined;
22
+ className?: string;
23
+ }) => JSX.Element;