pixi-solid 0.1.18 → 0.1.20

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 (53) hide show
  1. package/README.md +39 -16
  2. package/dist/components/bind-props/bind-children.js +43 -60
  3. package/dist/components/bind-props/bind-children.js.map +1 -1
  4. package/dist/components/bind-props/bind-props.js +81 -79
  5. package/dist/components/bind-props/bind-props.js.map +1 -1
  6. package/dist/components/bind-props/event-names.js +70 -77
  7. package/dist/components/bind-props/event-names.js.map +1 -1
  8. package/dist/components/bind-props/is-event-property.js +6 -5
  9. package/dist/components/bind-props/is-event-property.js.map +1 -1
  10. package/dist/components/bind-props/point-property-names.js +47 -51
  11. package/dist/components/bind-props/point-property-names.js.map +1 -1
  12. package/dist/components/bind-props/set-point-property.js +17 -21
  13. package/dist/components/bind-props/set-point-property.js.map +1 -1
  14. package/dist/components/component-factories.js +90 -102
  15. package/dist/components/component-factories.js.map +1 -1
  16. package/dist/components/components.js +77 -35
  17. package/dist/components/components.js.map +1 -1
  18. package/dist/delay.js +71 -51
  19. package/dist/delay.js.map +1 -1
  20. package/dist/index.js +6 -33
  21. package/dist/on-resize.js +38 -22
  22. package/dist/on-resize.js.map +1 -1
  23. package/dist/on-tick.js +29 -17
  24. package/dist/on-tick.js.map +1 -1
  25. package/dist/pixi-application/context.js +7 -7
  26. package/dist/pixi-application/context.js.map +1 -1
  27. package/dist/pixi-application/get-pixi-app.js +16 -11
  28. package/dist/pixi-application/get-pixi-app.js.map +1 -1
  29. package/dist/pixi-application/get-ticker.js +20 -11
  30. package/dist/pixi-application/get-ticker.js.map +1 -1
  31. package/dist/pixi-application/pixi-application-provider.js +75 -62
  32. package/dist/pixi-application/pixi-application-provider.js.map +1 -1
  33. package/dist/pixi-application/pixi-application.js +19 -18
  34. package/dist/pixi-application/pixi-application.js.map +1 -1
  35. package/dist/pixi-canvas.js +98 -98
  36. package/dist/pixi-canvas.js.map +1 -1
  37. package/dist/types/components/components.d.ts +1 -1
  38. package/dist/types/testing/index.d.ts +7 -7
  39. package/dist/types/testing/index.test.d.ts +1 -0
  40. package/dist/use-pixi-screen/pixi-screen-store.js +38 -37
  41. package/dist/use-pixi-screen/pixi-screen-store.js.map +1 -1
  42. package/dist/use-pixi-screen/use-pixi-screen.js +19 -11
  43. package/dist/use-pixi-screen/use-pixi-screen.js.map +1 -1
  44. package/dist/utils/index.js +1 -6
  45. package/dist/utils/object-fit.js +51 -46
  46. package/dist/utils/object-fit.js.map +1 -1
  47. package/dist/utils/smooth-damp.js +57 -53
  48. package/dist/utils/smooth-damp.js.map +1 -1
  49. package/dist/utils/spring.js +42 -33
  50. package/dist/utils/spring.js.map +1 -1
  51. package/package.json +3 -3
  52. package/dist/index.js.map +0 -1
  53. package/dist/utils/index.js.map +0 -1
package/README.md CHANGED
@@ -14,11 +14,7 @@ A custom renderer for [PixiJS](https://pixijs.com/) that lets you build your sce
14
14
  - 💫 Useful helper utilities included.
15
15
  - 🤩 Full Typescript support for type safety and auto completion.
16
16
 
17
- Take a look at the [docs site 🧑‍💻](https://lukecarlthompson.github.io/pixi-solid/) for more information.
18
-
19
- ---
20
-
21
- ### Install
17
+ ## Install
22
18
 
23
19
  ```bash
24
20
  npm i pixi-solid pixi.js solid-js
@@ -28,33 +24,60 @@ Peer dependencies of
28
24
 
29
25
  ```json
30
26
  {
31
- "pixi.js": "^8.14.3",
32
- "solid-js": "^1.9.10"
27
+ "pixi.js": ">=8.14.3 <9",
28
+ "solid-js": ">=1.9.10 <2"
33
29
  }
34
30
  ```
35
31
 
36
- ---
32
+ ## Basic usage
33
+
34
+ ```tsx
35
+ import { PixiCanvas, Sprite } from "pixi-solid";
36
+ import { createSignal } from "solid-js";
37
+ import { Texture } from "pixi.js";
38
+
39
+ export const DemoApp = () => {
40
+ const [scale, setScale] = createSignal(10);
41
+
42
+ const handleSpriteTap = () => {
43
+ setScale((currentScale) => currentScale + 1);
44
+ };
45
+
46
+ return (
47
+ <PixiCanvas style={{ width: "100%", height: "100vh" }}>
48
+ <Sprite
49
+ texture={Texture.WHITE}
50
+ scale={scale()}
51
+ onpointertap={handleSpriteTap}
52
+ tint="#ff0000"
53
+ />
54
+ </PixiCanvas>
55
+ );
56
+ };
57
+ ```
58
+
59
+ ## Documentation and examples
60
+
61
+ Check out the [documentation site 🧑‍💻](https://lukecarlthompson.github.io/pixi-solid/) for more comprehensive information and live examples.
37
62
 
38
- ### Why combine SolidJS with PixiJS?
63
+ ## Why combine SolidJS with PixiJS?
39
64
 
40
- - **Declarative PixiJS scene graph**: Using SolidJS's JSX templating means we get declarative control over the scene graph. No longer necessary to imperatively add and remove children.
65
+ - **Declarative PixiJS scene graph**: Using SolidJS's JSX templating means we get declarative control over the scene graph. For improved separation of concerns, simpler views and more scalable projects.
41
66
 
42
- - **Lifecycle hooks in our PixiJS components**: SolidJS rendering PixiJS components means we can take advantage of the built in lifecycle methods in SolidJS `onMount` and `onCleanup` as well as few extra custom hooks so we can automatically subscribe and unsubscribe from the ticker.
67
+ - **SolidJS hooks in our PixiJS components**: SolidJS rendering PixiJS components means we can take advantage of the built in lifecycle methods in SolidJS `onMount`, `onCleanup` as well as extra custom hooks for responsive behaviour and ticker subscriptions.
43
68
 
44
- - **Shared State and Reactivity**: Pixi Solid leverages SolidJS's reactivity system to automatically update PixiJS components when SolidJS signals or stores change. So your HTML and PixiJS graphics can stay in sync effortlessly.
69
+ - **Shared State and Reactivity**: HTML and PixiJS graphics can stay in sync effortlessly because they can subscribe to the same state.
45
70
 
46
- - **Combine the best of both worlds**: Pixi Solid makes it easy to use HTML elements alongside a PixiJS canvas, allowing you to create rich user interfaces that combine the strengths of both technologies.
71
+ - **Combine the best of both worlds**: Pixi Solid makes it easy to use HTML elements alongside or on top of a PixiJS canvas, allowing you to create rich user interfaces that combine the strengths of both technologies.
47
72
 
48
73
  - **Composability**: Pixi Solid components can be easily composed together to create complex scenes and animations out of reusable components.
49
74
 
50
75
  - **SolidJS is a thin wrapper**: While Pixi Solid provides a nice abstraction over PixiJS it provides access to all the properties and events of PixiJS objects.
51
76
 
52
- - **SolidJS is really fast**: SolidJs is on of the fastest front-end frameworks out there so the overhead is very minimal.
77
+ - **SolidJS is really fast**: SolidJS is one of the fastest front-end frameworks out there so the overhead is very minimal.
53
78
 
54
79
  - **SolidJS is fully featured**: It has stores, signals, suspense, error boundaries, resource fetching and more. It's a great feature set for simple or complex applications and you won't have to reach for other libraries to manage templating or state.
55
80
 
56
- ---
57
-
58
81
  ## Contributing
59
82
 
60
83
  Contributions are welcome! This project is still in its early stages, so feel free to open an issue to report a bug, suggest a feature, or submit a pull request.
@@ -1,64 +1,47 @@
1
1
  import { children, createRenderEffect } from "solid-js";
2
- class InvalidChildTypeError extends Error {
3
- constructor(cause) {
4
- super(
5
- "Invalid pixi-solid child type. Children must be pixi-solid or PixiJS element. Did you accidentally pass an invalid child to a pixi-solid parent?",
6
- { cause }
7
- );
8
- this.name = "InvalidChildTypeError";
9
- }
10
- }
11
- const bindChildrenToContainer = (parent, children$1) => {
12
- const resolvedChildren = children(() => children$1);
13
- const canAddChild = "addChildAt" in parent;
14
- if (!canAddChild) {
15
- throw new Error("Parent does not support children.");
16
- }
17
- createRenderEffect(() => {
18
- const nextChildren = resolvedChildren.toArray().filter(Boolean);
19
- try {
20
- for (let i = 0; i < nextChildren.length; i += 1) {
21
- parent.addChildAt(nextChildren[i], i);
22
- }
23
- } catch (error) {
24
- if (error instanceof Error) {
25
- console.error("Invalid children", nextChildren);
26
- throw new InvalidChildTypeError(error);
27
- } else {
28
- throw error;
29
- }
30
- }
31
- });
2
+ //#region src/components/bind-props/bind-children.ts
3
+ var InvalidChildTypeError = class extends Error {
4
+ constructor(cause) {
5
+ super("Invalid pixi-solid child type. Children must be pixi-solid or PixiJS element. Did you accidentally pass an invalid child to a pixi-solid parent?", { cause });
6
+ this.name = "InvalidChildTypeError";
7
+ }
32
8
  };
33
- const bindChildrenToRenderLayer = (parent, children$1) => {
34
- const resolvedChildren = children(() => children$1);
35
- createRenderEffect((prevChildren) => {
36
- const nextChildren = resolvedChildren.toArray().filter(Boolean);
37
- try {
38
- if (prevChildren) {
39
- for (let i = 0; i < prevChildren.length; i += 1) {
40
- const child = prevChildren[i];
41
- if (nextChildren.includes(child)) continue;
42
- parent.detach(child);
43
- }
44
- }
45
- for (let i = 0; i < nextChildren.length; i += 1) {
46
- parent.attach(nextChildren[i]);
47
- }
48
- } catch (error) {
49
- if (error instanceof Error) {
50
- console.error("Invalid children", nextChildren);
51
- throw new InvalidChildTypeError(error);
52
- } else {
53
- throw error;
54
- }
55
- }
56
- return nextChildren;
57
- });
9
+ var bindChildrenToContainer = (parent, children$1) => {
10
+ const resolvedChildren = children(() => children$1);
11
+ if (!("addChildAt" in parent)) throw new Error("Parent does not support children.");
12
+ createRenderEffect(() => {
13
+ const nextChildren = resolvedChildren.toArray().filter(Boolean);
14
+ try {
15
+ for (let i = 0; i < nextChildren.length; i += 1) parent.addChildAt(nextChildren[i], i);
16
+ } catch (error) {
17
+ if (error instanceof Error) {
18
+ console.error("Invalid children", nextChildren);
19
+ throw new InvalidChildTypeError(error);
20
+ } else throw error;
21
+ }
22
+ });
58
23
  };
59
- export {
60
- InvalidChildTypeError,
61
- bindChildrenToContainer,
62
- bindChildrenToRenderLayer
24
+ var bindChildrenToRenderLayer = (parent, children$2) => {
25
+ const resolvedChildren = children(() => children$2);
26
+ createRenderEffect((prevChildren) => {
27
+ const nextChildren = resolvedChildren.toArray().filter(Boolean);
28
+ try {
29
+ if (prevChildren) for (let i = 0; i < prevChildren.length; i += 1) {
30
+ const child = prevChildren[i];
31
+ if (nextChildren.includes(child)) continue;
32
+ parent.detach(child);
33
+ }
34
+ for (let i = 0; i < nextChildren.length; i += 1) parent.attach(nextChildren[i]);
35
+ } catch (error) {
36
+ if (error instanceof Error) {
37
+ console.error("Invalid children", nextChildren);
38
+ throw new InvalidChildTypeError(error);
39
+ } else throw error;
40
+ }
41
+ return nextChildren;
42
+ });
63
43
  };
64
- //# sourceMappingURL=bind-children.js.map
44
+ //#endregion
45
+ export { bindChildrenToContainer, bindChildrenToRenderLayer };
46
+
47
+ //# sourceMappingURL=bind-children.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bind-children.js","sources":["../../../src/components/bind-props/bind-children.ts"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport { children as resolveChildren, createRenderEffect } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\n\nexport class InvalidChildTypeError extends Error {\n constructor(cause: Error) {\n super(\n \"Invalid pixi-solid child type. Children must be pixi-solid or PixiJS element. Did you accidentally pass an invalid child to a pixi-solid parent?\",\n { cause },\n );\n this.name = \"InvalidChildTypeError\";\n }\n}\n\nexport const bindChildrenToContainer = (parent: Pixi.Container, children?: JSX.Element): void => {\n const resolvedChildren = resolveChildren(() => children);\n\n const canAddChild = \"addChildAt\" in parent;\n\n if (!canAddChild) {\n throw new Error(\"Parent does not support children.\");\n }\n\n createRenderEffect(() => {\n const nextChildren = resolvedChildren.toArray().filter(Boolean) as unknown as Pixi.Container[];\n\n try {\n for (let i = 0; i < nextChildren.length; i += 1) {\n parent.addChildAt(nextChildren[i], i);\n }\n } catch (error) {\n if (error instanceof Error) {\n console.error(\"Invalid children\", nextChildren);\n throw new InvalidChildTypeError(error);\n } else {\n throw error;\n }\n }\n });\n};\n\nexport const bindChildrenToRenderLayer = (\n parent: Pixi.RenderLayer,\n children?: JSX.Element,\n): void => {\n const resolvedChildren = resolveChildren(() => children);\n\n createRenderEffect((prevChildren: Pixi.Container[] | undefined) => {\n const nextChildren = resolvedChildren.toArray().filter(Boolean) as unknown as Pixi.Container[];\n\n try {\n if (prevChildren) {\n for (let i = 0; i < prevChildren.length; i += 1) {\n const child = prevChildren[i];\n if (nextChildren.includes(child)) continue;\n\n parent.detach(child);\n }\n }\n\n for (let i = 0; i < nextChildren.length; i += 1) {\n parent.attach(nextChildren[i]);\n }\n } catch (error) {\n if (error instanceof Error) {\n console.error(\"Invalid children\", nextChildren);\n throw new InvalidChildTypeError(error);\n } else {\n throw error;\n }\n }\n\n return nextChildren;\n });\n};\n"],"names":["children","resolveChildren"],"mappings":";AAIO,MAAM,8BAA8B,MAAM;AAAA,EAC/C,YAAY,OAAc;AACxB;AAAA,MACE;AAAA,MACA,EAAE,MAAA;AAAA,IAAM;AAEV,SAAK,OAAO;AAAA,EACd;AACF;AAEO,MAAM,0BAA0B,CAAC,QAAwBA,eAAiC;AAC/F,QAAM,mBAAmBC,SAAgB,MAAMD,UAAQ;AAEvD,QAAM,cAAc,gBAAgB;AAEpC,MAAI,CAAC,aAAa;AAChB,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACrD;AAEA,qBAAmB,MAAM;AACvB,UAAM,eAAe,iBAAiB,QAAA,EAAU,OAAO,OAAO;AAE9D,QAAI;AACF,eAAS,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK,GAAG;AAC/C,eAAO,WAAW,aAAa,CAAC,GAAG,CAAC;AAAA,MACtC;AAAA,IACF,SAAS,OAAO;AACd,UAAI,iBAAiB,OAAO;AAC1B,gBAAQ,MAAM,oBAAoB,YAAY;AAC9C,cAAM,IAAI,sBAAsB,KAAK;AAAA,MACvC,OAAO;AACL,cAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEO,MAAM,4BAA4B,CACvC,QACAA,eACS;AACT,QAAM,mBAAmBC,SAAgB,MAAMD,UAAQ;AAEvD,qBAAmB,CAAC,iBAA+C;AACjE,UAAM,eAAe,iBAAiB,QAAA,EAAU,OAAO,OAAO;AAE9D,QAAI;AACF,UAAI,cAAc;AAChB,iBAAS,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK,GAAG;AAC/C,gBAAM,QAAQ,aAAa,CAAC;AAC5B,cAAI,aAAa,SAAS,KAAK,EAAG;AAElC,iBAAO,OAAO,KAAK;AAAA,QACrB;AAAA,MACF;AAEA,eAAS,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK,GAAG;AAC/C,eAAO,OAAO,aAAa,CAAC,CAAC;AAAA,MAC/B;AAAA,IACF,SAAS,OAAO;AACd,UAAI,iBAAiB,OAAO;AAC1B,gBAAQ,MAAM,oBAAoB,YAAY;AAC9C,cAAM,IAAI,sBAAsB,KAAK;AAAA,MACvC,OAAO;AACL,cAAM;AAAA,MACR;AAAA,IACF;AAEA,WAAO;AAAA,EACT,CAAC;AACH;"}
1
+ {"version":3,"file":"bind-children.js","names":[],"sources":["../../../src/components/bind-props/bind-children.ts"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport { children as resolveChildren, createRenderEffect } from \"solid-js\";\nimport type { JSX } from \"solid-js\";\n\nexport class InvalidChildTypeError extends Error {\n constructor(cause: Error) {\n super(\n \"Invalid pixi-solid child type. Children must be pixi-solid or PixiJS element. Did you accidentally pass an invalid child to a pixi-solid parent?\",\n { cause },\n );\n this.name = \"InvalidChildTypeError\";\n }\n}\n\nexport const bindChildrenToContainer = (parent: Pixi.Container, children?: JSX.Element): void => {\n const resolvedChildren = resolveChildren(() => children);\n\n const canAddChild = \"addChildAt\" in parent;\n\n if (!canAddChild) {\n throw new Error(\"Parent does not support children.\");\n }\n\n createRenderEffect(() => {\n const nextChildren = resolvedChildren.toArray().filter(Boolean) as unknown as Pixi.Container[];\n\n try {\n for (let i = 0; i < nextChildren.length; i += 1) {\n parent.addChildAt(nextChildren[i], i);\n }\n } catch (error) {\n if (error instanceof Error) {\n console.error(\"Invalid children\", nextChildren);\n throw new InvalidChildTypeError(error);\n } else {\n throw error;\n }\n }\n });\n};\n\nexport const bindChildrenToRenderLayer = (\n parent: Pixi.RenderLayer,\n children?: JSX.Element,\n): void => {\n const resolvedChildren = resolveChildren(() => children);\n\n createRenderEffect((prevChildren: Pixi.Container[] | undefined) => {\n const nextChildren = resolvedChildren.toArray().filter(Boolean) as unknown as Pixi.Container[];\n\n try {\n if (prevChildren) {\n for (let i = 0; i < prevChildren.length; i += 1) {\n const child = prevChildren[i];\n if (nextChildren.includes(child)) continue;\n\n parent.detach(child);\n }\n }\n\n for (let i = 0; i < nextChildren.length; i += 1) {\n parent.attach(nextChildren[i]);\n }\n } catch (error) {\n if (error instanceof Error) {\n console.error(\"Invalid children\", nextChildren);\n throw new InvalidChildTypeError(error);\n } else {\n throw error;\n }\n }\n\n return nextChildren;\n });\n};\n"],"mappings":";;AAIA,IAAa,wBAAb,cAA2C,MAAM;CAC/C,YAAY,OAAc;AACxB,QACE,oJACA,EAAE,OAAO,CACV;AACD,OAAK,OAAO;;;AAIhB,IAAa,2BAA2B,QAAwB,eAAiC;CAC/F,MAAM,mBAAmB,eAAsB,WAAS;AAIxD,KAAI,EAFgB,gBAAgB,QAGlC,OAAM,IAAI,MAAM,oCAAoC;AAGtD,0BAAyB;EACvB,MAAM,eAAe,iBAAiB,SAAS,CAAC,OAAO,QAAQ;AAE/D,MAAI;AACF,QAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK,EAC5C,QAAO,WAAW,aAAa,IAAI,EAAE;WAEhC,OAAO;AACd,OAAI,iBAAiB,OAAO;AAC1B,YAAQ,MAAM,oBAAoB,aAAa;AAC/C,UAAM,IAAI,sBAAsB,MAAM;SAEtC,OAAM;;GAGV;;AAGJ,IAAa,6BACX,QACA,eACS;CACT,MAAM,mBAAmB,eAAsB,WAAS;AAExD,qBAAoB,iBAA+C;EACjE,MAAM,eAAe,iBAAiB,SAAS,CAAC,OAAO,QAAQ;AAE/D,MAAI;AACF,OAAI,aACF,MAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK,GAAG;IAC/C,MAAM,QAAQ,aAAa;AAC3B,QAAI,aAAa,SAAS,MAAM,CAAE;AAElC,WAAO,OAAO,MAAM;;AAIxB,QAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK,EAC5C,QAAO,OAAO,aAAa,GAAG;WAEzB,OAAO;AACd,OAAI,iBAAiB,OAAO;AAC1B,YAAQ,MAAM,oBAAoB,aAAa;AAC/C,UAAM,IAAI,sBAAsB,MAAM;SAEtC,OAAM;;AAIV,SAAO;GACP"}
@@ -1,82 +1,84 @@
1
- import { createRenderEffect, on, onCleanup } from "solid-js";
2
- import { bindChildrenToRenderLayer, bindChildrenToContainer } from "./bind-children.js";
1
+ import { bindChildrenToContainer, bindChildrenToRenderLayer } from "./bind-children.js";
3
2
  import { isEventProperty } from "./is-event-property.js";
4
- import { isPointProperty, setPointProperty, isPointAxisProperty, setPointAxisProperty } from "./set-point-property.js";
5
- const bindRuntimeProps = (instance, props) => {
6
- createRenderEffect(() => {
7
- for (const key in props) {
8
- if (key === "as") continue;
9
- if (key === "ref") {
10
- props[key](instance);
11
- continue;
12
- } else if (key === "children") {
13
- if ("attach" in instance && "detach" in instance) {
14
- bindChildrenToRenderLayer(instance, props.children);
15
- } else {
16
- bindChildrenToContainer(instance, props.children);
17
- }
18
- continue;
19
- }
20
- if (isPointProperty(key)) {
21
- createRenderEffect(() => setPointProperty(instance, key, props[key]));
22
- continue;
23
- }
24
- if (isPointAxisProperty(key)) {
25
- createRenderEffect(() => setPointAxisProperty(instance, key, props[key]));
26
- continue;
27
- }
28
- if (isEventProperty(key)) {
29
- createRenderEffect(() => {
30
- const eventName = key.slice(2);
31
- const eventHandler = props[key];
32
- if (eventHandler) {
33
- instance.on(eventName, eventHandler);
34
- onCleanup(() => {
35
- instance.off(eventName, eventHandler);
36
- });
37
- }
38
- });
39
- continue;
40
- }
41
- if (key in instance) {
42
- createRenderEffect(() => instance[key] = props[key]);
43
- continue;
44
- }
45
- }
46
- });
47
- };
48
- const bindInitialisationProps = (instance, props) => {
49
- createRenderEffect((defer) => {
50
- for (const key in props) {
51
- if (isPointProperty(key)) {
52
- createRenderEffect(
53
- on(
54
- () => props[key],
55
- () => {
56
- return setPointProperty(instance, key, props[key]);
57
- },
58
- { defer }
59
- )
60
- );
61
- continue;
62
- }
63
- if (key in instance) {
64
- createRenderEffect(
65
- on(
66
- () => props[key],
67
- () => {
68
- instance[key] = props[key];
69
- },
70
- { defer }
71
- )
72
- );
73
- }
74
- }
75
- return false;
76
- }, true);
3
+ import { isPointAxisProperty, isPointProperty, setPointAxisProperty, setPointProperty } from "./set-point-property.js";
4
+ import { createRenderEffect, on, onCleanup } from "solid-js";
5
+ //#region src/components/bind-props/bind-props.ts
6
+ /**
7
+ * Binds the props to a Pixi instance with subscriptions to maintain reactivity.
8
+ *
9
+ * This is specifically for the runtime props that can't be set at initialisation. These props will be set on the Pixi instance immediately after it is created but before rendering.
10
+ *
11
+ * @param instance The Pixi instance we want to bind the props to.
12
+ * @param props The props object.
13
+ */
14
+ var bindRuntimeProps = (instance, props) => {
15
+ createRenderEffect(() => {
16
+ for (const key in props) {
17
+ if (key === "as") continue;
18
+ if (key === "ref") {
19
+ props[key](instance);
20
+ continue;
21
+ } else if (key === "children") {
22
+ if ("attach" in instance && "detach" in instance) bindChildrenToRenderLayer(instance, props.children);
23
+ else bindChildrenToContainer(instance, props.children);
24
+ continue;
25
+ }
26
+ if (isPointProperty(key)) {
27
+ createRenderEffect(() => setPointProperty(instance, key, props[key]));
28
+ continue;
29
+ }
30
+ if (isPointAxisProperty(key)) {
31
+ createRenderEffect(() => setPointAxisProperty(instance, key, props[key]));
32
+ continue;
33
+ }
34
+ if (isEventProperty(key)) {
35
+ createRenderEffect(() => {
36
+ const eventName = key.slice(2);
37
+ const eventHandler = props[key];
38
+ if (eventHandler) {
39
+ instance.on(eventName, eventHandler);
40
+ onCleanup(() => {
41
+ instance.off(eventName, eventHandler);
42
+ });
43
+ }
44
+ });
45
+ continue;
46
+ }
47
+ if (key in instance) {
48
+ createRenderEffect(() => instance[key] = props[key]);
49
+ continue;
50
+ }
51
+ }
52
+ });
77
53
  };
78
- export {
79
- bindInitialisationProps,
80
- bindRuntimeProps
54
+ /**
55
+ * Binds the props to a Pixi instance with subscriptions to maintain reactivity.
56
+ *
57
+ * This is specifically for the initialisation props that can be set at the time of instance creation. These props will be passed into the Pixi class during instantiation but won't be set on the instance until they are changed again. This is to avoid side effects that can be caused by setting certain props after the instance is created, such as the AnimatedSprite's `textures` prop which stops the animation if it was already instantiated with `autoplay: true`.
58
+ *
59
+ * @param instance The Pixi instance we want to bind the props to.
60
+ * @param props The props object.
61
+ */
62
+ var bindInitialisationProps = (instance, props) => {
63
+ createRenderEffect((defer) => {
64
+ for (const key in props) {
65
+ if (isPointProperty(key)) {
66
+ createRenderEffect(on(() => props[key], () => {
67
+ return setPointProperty(instance, key, props[key]);
68
+ }, { defer }));
69
+ continue;
70
+ }
71
+ if (key in instance) createRenderEffect(on(() => props[key], () => {
72
+ instance[key] = props[key];
73
+ }, { defer }));
74
+ }
75
+ return false;
76
+ }, true);
77
+ /**
78
+ * Do not throw an error here for invalid prop names because there are some initialisation props that are not available as public properties. We want to allow users to pass these props but not try to set them on the instance.
79
+ */
81
80
  };
82
- //# sourceMappingURL=bind-props.js.map
81
+ //#endregion
82
+ export { bindInitialisationProps, bindRuntimeProps };
83
+
84
+ //# sourceMappingURL=bind-props.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bind-props.js","sources":["../../../src/components/bind-props/bind-props.ts"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport { createRenderEffect, onCleanup, on } from \"solid-js\";\n\nimport type { ContainerProps } from \"../component-factories\";\n\nimport { bindChildrenToContainer, bindChildrenToRenderLayer } from \"./bind-children\";\nimport { isEventProperty } from \"./is-event-property\";\nimport {\n isPointProperty,\n setPointProperty,\n isPointAxisProperty,\n setPointAxisProperty,\n} from \"./set-point-property\";\n\n/**\n * Binds the props to a Pixi instance with subscriptions to maintain reactivity.\n *\n * This is specifically for the runtime props that can't be set at initialisation. These props will be set on the Pixi instance immediately after it is created but before rendering.\n *\n * @param instance The Pixi instance we want to bind the props to.\n * @param props The props object.\n */\nexport const bindRuntimeProps = <\n InstanceType extends Pixi.Container,\n OptionsType extends ContainerProps<InstanceType>,\n>(\n instance: InstanceType,\n props: OptionsType,\n): void => {\n createRenderEffect(() => {\n for (const key in props) {\n if (key === \"as\") continue;\n\n if (key === \"ref\") {\n (props[key] as unknown as (arg: any) => void)(instance);\n\n continue;\n } else if (key === \"children\") {\n if (\"attach\" in instance && \"detach\" in instance) {\n bindChildrenToRenderLayer(instance as unknown as Pixi.RenderLayer, props.children);\n } else {\n bindChildrenToContainer(instance, props.children);\n }\n\n continue;\n }\n\n if (isPointProperty(key)) {\n createRenderEffect(() => setPointProperty(instance, key, props[key]));\n\n continue;\n }\n\n if (isPointAxisProperty(key)) {\n createRenderEffect(() => setPointAxisProperty(instance, key, props[key]));\n continue;\n }\n\n if (isEventProperty(key)) {\n createRenderEffect(() => {\n const eventName = key.slice(2);\n const eventHandler = props[key];\n\n if (eventHandler) {\n instance.on(eventName, eventHandler as any);\n onCleanup(() => {\n instance.off(eventName, eventHandler as any);\n });\n }\n });\n\n continue;\n }\n\n if (key in instance) {\n createRenderEffect(() => ((instance as any)[key] = props[key]));\n continue;\n }\n }\n });\n};\n\n/**\n * Binds the props to a Pixi instance with subscriptions to maintain reactivity.\n *\n * This is specifically for the initialisation props that can be set at the time of instance creation. These props will be passed into the Pixi class during instantiation but won't be set on the instance until they are changed again. This is to avoid side effects that can be caused by setting certain props after the instance is created, such as the AnimatedSprite's `textures` prop which stops the animation if it was already instantiated with `autoplay: true`.\n *\n * @param instance The Pixi instance we want to bind the props to.\n * @param props The props object.\n */\nexport const bindInitialisationProps = <\n InstanceType extends Pixi.Container,\n OptionsType extends ContainerProps<InstanceType>,\n>(\n instance: InstanceType,\n props: OptionsType,\n): void => {\n createRenderEffect<boolean>((defer) => {\n for (const key in props) {\n if (isPointProperty(key)) {\n createRenderEffect(\n on(\n () => props[key],\n () => {\n return setPointProperty(instance, key, props[key]);\n },\n { defer },\n ),\n );\n\n continue;\n }\n\n if (key in instance) {\n createRenderEffect(\n on(\n () => props[key],\n () => {\n (instance as any)[key] = props[key];\n },\n { defer },\n ),\n );\n }\n }\n\n return false;\n }, true);\n\n /**\n * Do not throw an error here for invalid prop names because there are some initialisation props that are not available as public properties. We want to allow users to pass these props but not try to set them on the instance.\n */\n};\n"],"names":[],"mappings":";;;;AAsBO,MAAM,mBAAmB,CAI9B,UACA,UACS;AACT,qBAAmB,MAAM;AACvB,eAAW,OAAO,OAAO;AACvB,UAAI,QAAQ,KAAM;AAElB,UAAI,QAAQ,OAAO;AAChB,cAAM,GAAG,EAAoC,QAAQ;AAEtD;AAAA,MACF,WAAW,QAAQ,YAAY;AAC7B,YAAI,YAAY,YAAY,YAAY,UAAU;AAChD,oCAA0B,UAAyC,MAAM,QAAQ;AAAA,QACnF,OAAO;AACL,kCAAwB,UAAU,MAAM,QAAQ;AAAA,QAClD;AAEA;AAAA,MACF;AAEA,UAAI,gBAAgB,GAAG,GAAG;AACxB,2BAAmB,MAAM,iBAAiB,UAAU,KAAK,MAAM,GAAG,CAAC,CAAC;AAEpE;AAAA,MACF;AAEA,UAAI,oBAAoB,GAAG,GAAG;AAC5B,2BAAmB,MAAM,qBAAqB,UAAU,KAAK,MAAM,GAAG,CAAC,CAAC;AACxE;AAAA,MACF;AAEA,UAAI,gBAAgB,GAAG,GAAG;AACxB,2BAAmB,MAAM;AACvB,gBAAM,YAAY,IAAI,MAAM,CAAC;AAC7B,gBAAM,eAAe,MAAM,GAAG;AAE9B,cAAI,cAAc;AAChB,qBAAS,GAAG,WAAW,YAAmB;AAC1C,sBAAU,MAAM;AACd,uBAAS,IAAI,WAAW,YAAmB;AAAA,YAC7C,CAAC;AAAA,UACH;AAAA,QACF,CAAC;AAED;AAAA,MACF;AAEA,UAAI,OAAO,UAAU;AACnB,2BAAmB,MAAQ,SAAiB,GAAG,IAAI,MAAM,GAAG,CAAE;AAC9D;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAUO,MAAM,0BAA0B,CAIrC,UACA,UACS;AACT,qBAA4B,CAAC,UAAU;AACrC,eAAW,OAAO,OAAO;AACvB,UAAI,gBAAgB,GAAG,GAAG;AACxB;AAAA,UACE;AAAA,YACE,MAAM,MAAM,GAAG;AAAA,YACf,MAAM;AACJ,qBAAO,iBAAiB,UAAU,KAAK,MAAM,GAAG,CAAC;AAAA,YACnD;AAAA,YACA,EAAE,MAAA;AAAA,UAAM;AAAA,QACV;AAGF;AAAA,MACF;AAEA,UAAI,OAAO,UAAU;AACnB;AAAA,UACE;AAAA,YACE,MAAM,MAAM,GAAG;AAAA,YACf,MAAM;AACH,uBAAiB,GAAG,IAAI,MAAM,GAAG;AAAA,YACpC;AAAA,YACA,EAAE,MAAA;AAAA,UAAM;AAAA,QACV;AAAA,MAEJ;AAAA,IACF;AAEA,WAAO;AAAA,EACT,GAAG,IAAI;AAKT;"}
1
+ {"version":3,"file":"bind-props.js","names":[],"sources":["../../../src/components/bind-props/bind-props.ts"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport { createRenderEffect, onCleanup, on } from \"solid-js\";\n\nimport type { ContainerProps } from \"../component-factories\";\n\nimport { bindChildrenToContainer, bindChildrenToRenderLayer } from \"./bind-children\";\nimport { isEventProperty } from \"./is-event-property\";\nimport {\n isPointProperty,\n setPointProperty,\n isPointAxisProperty,\n setPointAxisProperty,\n} from \"./set-point-property\";\n\n/**\n * Binds the props to a Pixi instance with subscriptions to maintain reactivity.\n *\n * This is specifically for the runtime props that can't be set at initialisation. These props will be set on the Pixi instance immediately after it is created but before rendering.\n *\n * @param instance The Pixi instance we want to bind the props to.\n * @param props The props object.\n */\nexport const bindRuntimeProps = <\n InstanceType extends Pixi.Container,\n OptionsType extends ContainerProps<InstanceType>,\n>(\n instance: InstanceType,\n props: OptionsType,\n): void => {\n createRenderEffect(() => {\n for (const key in props) {\n if (key === \"as\") continue;\n\n if (key === \"ref\") {\n (props[key] as unknown as (arg: any) => void)(instance);\n\n continue;\n } else if (key === \"children\") {\n if (\"attach\" in instance && \"detach\" in instance) {\n bindChildrenToRenderLayer(instance as unknown as Pixi.RenderLayer, props.children);\n } else {\n bindChildrenToContainer(instance, props.children);\n }\n\n continue;\n }\n\n if (isPointProperty(key)) {\n createRenderEffect(() => setPointProperty(instance, key, props[key]));\n\n continue;\n }\n\n if (isPointAxisProperty(key)) {\n createRenderEffect(() => setPointAxisProperty(instance, key, props[key]));\n continue;\n }\n\n if (isEventProperty(key)) {\n createRenderEffect(() => {\n const eventName = key.slice(2);\n const eventHandler = props[key];\n\n if (eventHandler) {\n instance.on(eventName, eventHandler as any);\n onCleanup(() => {\n instance.off(eventName, eventHandler as any);\n });\n }\n });\n\n continue;\n }\n\n if (key in instance) {\n createRenderEffect(() => ((instance as any)[key] = props[key]));\n continue;\n }\n }\n });\n};\n\n/**\n * Binds the props to a Pixi instance with subscriptions to maintain reactivity.\n *\n * This is specifically for the initialisation props that can be set at the time of instance creation. These props will be passed into the Pixi class during instantiation but won't be set on the instance until they are changed again. This is to avoid side effects that can be caused by setting certain props after the instance is created, such as the AnimatedSprite's `textures` prop which stops the animation if it was already instantiated with `autoplay: true`.\n *\n * @param instance The Pixi instance we want to bind the props to.\n * @param props The props object.\n */\nexport const bindInitialisationProps = <\n InstanceType extends Pixi.Container,\n OptionsType extends ContainerProps<InstanceType>,\n>(\n instance: InstanceType,\n props: OptionsType,\n): void => {\n createRenderEffect<boolean>((defer) => {\n for (const key in props) {\n if (isPointProperty(key)) {\n createRenderEffect(\n on(\n () => props[key],\n () => {\n return setPointProperty(instance, key, props[key]);\n },\n { defer },\n ),\n );\n\n continue;\n }\n\n if (key in instance) {\n createRenderEffect(\n on(\n () => props[key],\n () => {\n (instance as any)[key] = props[key];\n },\n { defer },\n ),\n );\n }\n }\n\n return false;\n }, true);\n\n /**\n * Do not throw an error here for invalid prop names because there are some initialisation props that are not available as public properties. We want to allow users to pass these props but not try to set them on the instance.\n */\n};\n"],"mappings":";;;;;;;;;;;;;AAsBA,IAAa,oBAIX,UACA,UACS;AACT,0BAAyB;AACvB,OAAK,MAAM,OAAO,OAAO;AACvB,OAAI,QAAQ,KAAM;AAElB,OAAI,QAAQ,OAAO;AAChB,UAAM,KAAuC,SAAS;AAEvD;cACS,QAAQ,YAAY;AAC7B,QAAI,YAAY,YAAY,YAAY,SACtC,2BAA0B,UAAyC,MAAM,SAAS;QAElF,yBAAwB,UAAU,MAAM,SAAS;AAGnD;;AAGF,OAAI,gBAAgB,IAAI,EAAE;AACxB,6BAAyB,iBAAiB,UAAU,KAAK,MAAM,KAAK,CAAC;AAErE;;AAGF,OAAI,oBAAoB,IAAI,EAAE;AAC5B,6BAAyB,qBAAqB,UAAU,KAAK,MAAM,KAAK,CAAC;AACzE;;AAGF,OAAI,gBAAgB,IAAI,EAAE;AACxB,6BAAyB;KACvB,MAAM,YAAY,IAAI,MAAM,EAAE;KAC9B,MAAM,eAAe,MAAM;AAE3B,SAAI,cAAc;AAChB,eAAS,GAAG,WAAW,aAAoB;AAC3C,sBAAgB;AACd,gBAAS,IAAI,WAAW,aAAoB;QAC5C;;MAEJ;AAEF;;AAGF,OAAI,OAAO,UAAU;AACnB,6BAA0B,SAAkB,OAAO,MAAM,KAAM;AAC/D;;;GAGJ;;;;;;;;;;AAWJ,IAAa,2BAIX,UACA,UACS;AACT,qBAA6B,UAAU;AACrC,OAAK,MAAM,OAAO,OAAO;AACvB,OAAI,gBAAgB,IAAI,EAAE;AACxB,uBACE,SACQ,MAAM,YACN;AACJ,YAAO,iBAAiB,UAAU,KAAK,MAAM,KAAK;OAEpD,EAAE,OAAO,CACV,CACF;AAED;;AAGF,OAAI,OAAO,SACT,oBACE,SACQ,MAAM,YACN;AACH,aAAiB,OAAO,MAAM;MAEjC,EAAE,OAAO,CACV,CACF;;AAIL,SAAO;IACN,KAAK"}
@@ -1,77 +1,70 @@
1
- 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
- "clickcapture",
36
- "mousedowncapture",
37
- "mouseentercapture",
38
- "mouseleavecapture",
39
- "mousemovecapture",
40
- "mouseoutcapture",
41
- "mouseovercapture",
42
- "mouseupcapture",
43
- "mouseupoutsidecapture",
44
- "pointercancelcapture",
45
- "pointerdowncapture",
46
- "pointerentercapture",
47
- "pointerleavecapture",
48
- "pointermovecapture",
49
- "pointeroutcapture",
50
- "pointerovercapture",
51
- "pointertapcapture",
52
- "pointerupcapture",
53
- "pointerupoutsidecapture",
54
- "rightclickcapture",
55
- "rightdowncapture",
56
- "rightupcapture",
57
- "rightupoutsidecapture",
58
- "tapcapture",
59
- "touchcancelcapture",
60
- "touchendcapture",
61
- "touchendoutsidecapture",
62
- "touchmovecapture",
63
- "touchstartcapture",
64
- "wheelcapture"
65
- ];
66
- const PIXI_SOLID_EVENT_HANDLER_NAMES = PIXI_EVENT_NAMES.map(
67
- (eventName) => `on${eventName}`
68
- );
69
- const PIXI_SOLID_EVENT_HANDLER_NAME_SET = new Set(
70
- PIXI_SOLID_EVENT_HANDLER_NAMES
71
- );
72
- export {
73
- PIXI_EVENT_NAMES,
74
- PIXI_SOLID_EVENT_HANDLER_NAMES,
75
- PIXI_SOLID_EVENT_HANDLER_NAME_SET
76
- };
77
- //# sourceMappingURL=event-names.js.map
1
+ var PIXI_SOLID_EVENT_HANDLER_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
+ "clickcapture",
36
+ "mousedowncapture",
37
+ "mouseentercapture",
38
+ "mouseleavecapture",
39
+ "mousemovecapture",
40
+ "mouseoutcapture",
41
+ "mouseovercapture",
42
+ "mouseupcapture",
43
+ "mouseupoutsidecapture",
44
+ "pointercancelcapture",
45
+ "pointerdowncapture",
46
+ "pointerentercapture",
47
+ "pointerleavecapture",
48
+ "pointermovecapture",
49
+ "pointeroutcapture",
50
+ "pointerovercapture",
51
+ "pointertapcapture",
52
+ "pointerupcapture",
53
+ "pointerupoutsidecapture",
54
+ "rightclickcapture",
55
+ "rightdowncapture",
56
+ "rightupcapture",
57
+ "rightupoutsidecapture",
58
+ "tapcapture",
59
+ "touchcancelcapture",
60
+ "touchendcapture",
61
+ "touchendoutsidecapture",
62
+ "touchmovecapture",
63
+ "touchstartcapture",
64
+ "wheelcapture"
65
+ ].map((eventName) => `on${eventName}`);
66
+ var PIXI_SOLID_EVENT_HANDLER_NAME_SET = new Set(PIXI_SOLID_EVENT_HANDLER_NAMES);
67
+ //#endregion
68
+ export { PIXI_SOLID_EVENT_HANDLER_NAMES, PIXI_SOLID_EVENT_HANDLER_NAME_SET };
69
+
70
+ //# sourceMappingURL=event-names.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-names.js","sources":["../../../src/components/bind-props/event-names.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_SOLID_EVENT_HANDLER_NAMES = PIXI_EVENT_NAMES.map(\n (eventName) => `on${eventName}` as const,\n);\n\nexport type PixiSolidEventHandlerName = (typeof PIXI_SOLID_EVENT_HANDLER_NAMES)[number];\n\nexport type PixiSolidEventHandlerMap = {\n [K in (typeof PIXI_EVENT_NAMES)[number] as `on${K}`]?:\n | null\n | ((...args: FederatedEventEmitterTypes[K]) => void);\n};\n\nexport const PIXI_SOLID_EVENT_HANDLER_NAME_SET: Set<string> = new Set(\n PIXI_SOLID_EVENT_HANDLER_NAMES,\n);\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"],"names":[],"mappings":"AAEO,MAAM,mBAAyD;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,iCAAiC,iBAAiB;AAAA,EAC7D,CAAC,cAAc,KAAK,SAAS;AAC/B;AAUO,MAAM,oCAAiD,IAAI;AAAA,EAChE;AACF;"}
1
+ {"version":3,"file":"event-names.js","names":[],"sources":["../../../src/components/bind-props/event-names.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_SOLID_EVENT_HANDLER_NAMES = PIXI_EVENT_NAMES.map(\n (eventName) => `on${eventName}` as const,\n);\n\nexport type PixiSolidEventHandlerName = (typeof PIXI_SOLID_EVENT_HANDLER_NAMES)[number];\n\nexport type PixiSolidEventHandlerMap = {\n [K in (typeof PIXI_EVENT_NAMES)[number] as `on${K}`]?:\n | null\n | ((...args: FederatedEventEmitterTypes[K]) => void);\n};\n\nexport const PIXI_SOLID_EVENT_HANDLER_NAME_SET: Set<string> = new Set(\n PIXI_SOLID_EVENT_HANDLER_NAMES,\n);\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":"AAoEA,IAAa,iCAAiC;CAjE5C;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;CAG4C,CAAiB,KAC5D,cAAc,KAAK,YACrB;AAUD,IAAa,oCAAiD,IAAI,IAChE,+BACD"}
@@ -1,6 +1,7 @@
1
1
  import { PIXI_SOLID_EVENT_HANDLER_NAME_SET } from "./event-names.js";
2
- const isEventProperty = (name) => PIXI_SOLID_EVENT_HANDLER_NAME_SET.has(name);
3
- export {
4
- isEventProperty
5
- };
6
- //# sourceMappingURL=is-event-property.js.map
2
+ //#region src/components/bind-props/is-event-property.ts
3
+ var isEventProperty = (name) => PIXI_SOLID_EVENT_HANDLER_NAME_SET.has(name);
4
+ //#endregion
5
+ export { isEventProperty };
6
+
7
+ //# sourceMappingURL=is-event-property.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-event-property.js","sources":["../../../src/components/bind-props/is-event-property.ts"],"sourcesContent":["import type { PixiSolidEventHandlerName } from \"./event-names\";\nimport { PIXI_SOLID_EVENT_HANDLER_NAME_SET } from \"./event-names\";\n\nexport const isEventProperty = (name: string): name is PixiSolidEventHandlerName =>\n PIXI_SOLID_EVENT_HANDLER_NAME_SET.has(name);\n"],"names":[],"mappings":";AAGO,MAAM,kBAAkB,CAAC,SAC9B,kCAAkC,IAAI,IAAI;"}
1
+ {"version":3,"file":"is-event-property.js","names":[],"sources":["../../../src/components/bind-props/is-event-property.ts"],"sourcesContent":["import type { PixiSolidEventHandlerName } from \"./event-names\";\nimport { PIXI_SOLID_EVENT_HANDLER_NAME_SET } from \"./event-names\";\n\nexport const isEventProperty = (name: string): name is PixiSolidEventHandlerName =>\n PIXI_SOLID_EVENT_HANDLER_NAME_SET.has(name);\n"],"mappings":";;AAGA,IAAa,mBAAmB,SAC9B,kCAAkC,IAAI,KAAK"}