pixi-solid 0.1.0 → 0.1.2

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 (47) hide show
  1. package/dist/components/bind-props/bind-children.js +45 -0
  2. package/dist/components/bind-props/bind-children.js.map +1 -0
  3. package/dist/components/bind-props/bind-props.js +37 -0
  4. package/dist/components/bind-props/bind-props.js.map +1 -0
  5. package/dist/components/bind-props/event-names.js.map +1 -0
  6. package/dist/components/bind-props/point-property-names.js.map +1 -0
  7. package/dist/components/bind-props/set-event-property.js.map +1 -0
  8. package/dist/components/bind-props/set-point-property.js.map +1 -0
  9. package/dist/components/bind-props/set-prop.js +20 -0
  10. package/dist/components/bind-props/set-prop.js.map +1 -0
  11. package/dist/components/component-factories.js +29 -0
  12. package/dist/components/component-factories.js.map +1 -0
  13. package/dist/{pixi-components.js → components/components.js} +2 -2
  14. package/dist/components/components.js.map +1 -0
  15. package/dist/index.js +3 -3
  16. package/dist/pixi-application/pixi-application-provider.js.map +1 -1
  17. package/dist/pixi-canvas.js +2 -2
  18. package/dist/pixi-canvas.js.map +1 -1
  19. package/dist/types/components/bind-props/bind-children.d.ts +4 -0
  20. package/dist/types/components/bind-props/bind-children.test.d.ts +1 -0
  21. package/dist/types/components/bind-props/bind-props.d.ts +12 -0
  22. package/dist/types/components/bind-props/bind-props.test.d.ts +1 -0
  23. package/dist/types/components/bind-props/index.d.ts +4 -0
  24. package/dist/types/components/bind-props/set-prop.d.ts +2 -0
  25. package/dist/types/{component-creation.d.ts → components/component-factories.d.ts} +3 -13
  26. package/dist/types/{pixi-components.d.ts → components/components.d.ts} +15 -15
  27. package/dist/types/components/index.d.ts +4 -0
  28. package/dist/types/index.d.ts +8 -8
  29. package/package.json +13 -13
  30. package/dist/component-creation.js +0 -57
  31. package/dist/component-creation.js.map +0 -1
  32. package/dist/event-names.js.map +0 -1
  33. package/dist/pixi-components.js.map +0 -1
  34. package/dist/point-property-names.js.map +0 -1
  35. package/dist/renderer.js +0 -96
  36. package/dist/renderer.js.map +0 -1
  37. package/dist/set-event-property.js.map +0 -1
  38. package/dist/set-point-property.js.map +0 -1
  39. package/dist/types/renderer.d.ts +0 -2
  40. /package/dist/{event-names.js → components/bind-props/event-names.js} +0 -0
  41. /package/dist/{point-property-names.js → components/bind-props/point-property-names.js} +0 -0
  42. /package/dist/{set-event-property.js → components/bind-props/set-event-property.js} +0 -0
  43. /package/dist/{set-point-property.js → components/bind-props/set-point-property.js} +0 -0
  44. /package/dist/types/{event-names.d.ts → components/bind-props/event-names.d.ts} +0 -0
  45. /package/dist/types/{point-property-names.d.ts → components/bind-props/point-property-names.d.ts} +0 -0
  46. /package/dist/types/{set-event-property.d.ts → components/bind-props/set-event-property.d.ts} +0 -0
  47. /package/dist/types/{set-point-property.d.ts → components/bind-props/set-point-property.d.ts} +0 -0
@@ -0,0 +1,45 @@
1
+ import { children, createRenderEffect } from "solid-js";
2
+ const bindChildrenToContainer = (parent, children$1) => {
3
+ const resolvedChildren = children(() => children$1);
4
+ const canAddChild = "addChildAt" in parent;
5
+ if (!canAddChild) {
6
+ throw new Error("Parent does not support children.");
7
+ }
8
+ createRenderEffect((prevChildren) => {
9
+ const nextChildren = resolvedChildren.toArray();
10
+ if (prevChildren) {
11
+ for (let i = 0; i < prevChildren.length; i += 1) {
12
+ const child = prevChildren[i];
13
+ if (nextChildren.includes(child)) continue;
14
+ parent.removeChild(child);
15
+ child.destroy({ children: true });
16
+ }
17
+ }
18
+ for (let i = 0; i < nextChildren.length; i += 1) {
19
+ parent.addChildAt(nextChildren[i], i);
20
+ }
21
+ return nextChildren;
22
+ });
23
+ };
24
+ const bindChildrenToRenderLayer = (parent, children$1) => {
25
+ const resolvedChildren = children(() => children$1);
26
+ createRenderEffect((prevChildren) => {
27
+ const nextChildren = resolvedChildren.toArray();
28
+ if (prevChildren) {
29
+ 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
+ }
35
+ for (let i = 0; i < nextChildren.length; i += 1) {
36
+ parent.attach(nextChildren[i]);
37
+ }
38
+ return nextChildren;
39
+ });
40
+ };
41
+ export {
42
+ bindChildrenToContainer,
43
+ bindChildrenToRenderLayer
44
+ };
45
+ //# sourceMappingURL=bind-children.js.map
@@ -0,0 +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 const bindChildrenToContainer = (parent: Pixi.Container, children?: JSX.Element) => {\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((prevChildren: Pixi.Container[] | undefined) => {\n const nextChildren = resolvedChildren.toArray() as unknown as Pixi.Container[];\n\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 parent.removeChild(child);\n child.destroy({ children: true });\n }\n }\n\n for (let i = 0; i < nextChildren.length; i += 1) {\n parent.addChildAt(nextChildren[i], i);\n }\n\n return nextChildren;\n });\n};\n\nexport const bindChildrenToRenderLayer = (parent: Pixi.RenderLayer, children?: JSX.Element) => {\n const resolvedChildren = resolveChildren(() => children);\n\n createRenderEffect((prevChildren: Pixi.Container[] | undefined) => {\n const nextChildren = resolvedChildren.toArray() as unknown as Pixi.Container[];\n\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\n return nextChildren;\n });\n};\n"],"names":["children","resolveChildren"],"mappings":";AAIO,MAAM,0BAA0B,CAAC,QAAwBA,eAA2B;AACzF,QAAM,mBAAmBC,SAAgB,MAAMD,UAAQ;AAEvD,QAAM,cAAc,gBAAgB;AAEpC,MAAI,CAAC,aAAa;AAChB,UAAM,IAAI,MAAM,mCAAmC;AAAA,EACrD;AAEA,qBAAmB,CAAC,iBAA+C;AACjE,UAAM,eAAe,iBAAiB,QAAA;AAEtC,QAAI,cAAc;AAChB,eAAS,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK,GAAG;AAC/C,cAAM,QAAQ,aAAa,CAAC;AAC5B,YAAI,aAAa,SAAS,KAAK,EAAG;AAClC,eAAO,YAAY,KAAK;AACxB,cAAM,QAAQ,EAAE,UAAU,KAAA,CAAM;AAAA,MAClC;AAAA,IACF;AAEA,aAAS,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK,GAAG;AAC/C,aAAO,WAAW,aAAa,CAAC,GAAG,CAAC;AAAA,IACtC;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAEO,MAAM,4BAA4B,CAAC,QAA0BA,eAA2B;AAC7F,QAAM,mBAAmBC,SAAgB,MAAMD,UAAQ;AAEvD,qBAAmB,CAAC,iBAA+C;AACjE,UAAM,eAAe,iBAAiB,QAAA;AAEtC,QAAI,cAAc;AAChB,eAAS,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK,GAAG;AAC/C,cAAM,QAAQ,aAAa,CAAC;AAC5B,YAAI,aAAa,SAAS,KAAK,EAAG;AAElC,eAAO,OAAO,KAAK;AAAA,MACrB;AAAA,IACF;AAEA,aAAS,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK,GAAG;AAC/C,aAAO,OAAO,aAAa,CAAC,CAAC;AAAA,IAC/B;AAEA,WAAO;AAAA,EACT,CAAC;AACH;"}
@@ -0,0 +1,37 @@
1
+ import { bindChildrenToRenderLayer, bindChildrenToContainer } from "./bind-children.js";
2
+ import { setProp } from "./set-prop.js";
3
+ import { createRenderEffect, on } from "solid-js";
4
+ const bindProps = (instance, props, defer) => {
5
+ for (const key in props) {
6
+ if (key === "as") continue;
7
+ if (key === "ref") {
8
+ props[key](instance);
9
+ } else if (key === "children") {
10
+ if ("attach" in instance && "detach" in instance) {
11
+ bindChildrenToRenderLayer(instance, props.children);
12
+ } else {
13
+ bindChildrenToContainer(instance, props.children);
14
+ }
15
+ continue;
16
+ }
17
+ if (defer) {
18
+ createRenderEffect(
19
+ on(
20
+ () => props[key],
21
+ (_input, _prevInput, prevValue) => {
22
+ return setProp(instance, key, props[key], prevValue);
23
+ },
24
+ { defer }
25
+ )
26
+ );
27
+ continue;
28
+ }
29
+ createRenderEffect(
30
+ (prevValue) => setProp(instance, key, props[key], prevValue)
31
+ );
32
+ }
33
+ };
34
+ export {
35
+ bindProps
36
+ };
37
+ //# sourceMappingURL=bind-props.js.map
@@ -0,0 +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 type { ContainerProps } from \"../component-factories\";\nimport { bindChildrenToContainer, bindChildrenToRenderLayer } from \"./bind-children\";\nimport { setProp } from \"./set-prop\";\nimport { createRenderEffect, on } from \"solid-js\";\n\n/**\n * Applies the props to a Pixi instance with subscriptions 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 * Notably in AnimatedSprite, if we set the textures property after instantiation it will stop the instance from playing.\n */\nexport const bindProps = <\n InstanceType extends Pixi.Container,\n OptionsType extends ContainerProps<InstanceType>,\n>(\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 (props[key] as unknown as (arg: any) => void)(instance);\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 continue;\n }\n\n if (defer) {\n createRenderEffect(\n on<OptionsType[keyof OptionsType], OptionsType[keyof OptionsType] | undefined>(\n () => props[key as keyof typeof props],\n (_input, _prevInput, prevValue) => {\n return setProp(instance, key, props[key as keyof typeof props], prevValue);\n },\n { defer },\n ),\n );\n continue;\n }\n\n createRenderEffect((prevValue) =>\n setProp(instance, key, props[key as keyof typeof props], prevValue),\n );\n }\n};\n"],"names":[],"mappings":";;;AAeO,MAAM,YAAY,CAIvB,UACA,OACA,UACG;AACH,aAAW,OAAO,OAAO;AACvB,QAAI,QAAQ,KAAM;AAElB,QAAI,QAAQ,OAAO;AAChB,YAAM,GAAG,EAAoC,QAAQ;AAAA,IACxD,WAAW,QAAQ,YAAY;AAC7B,UAAI,YAAY,YAAY,YAAY,UAAU;AAChD,kCAA0B,UAAyC,MAAM,QAAQ;AAAA,MACnF,OAAO;AACL,gCAAwB,UAAU,MAAM,QAAQ;AAAA,MAClD;AACA;AAAA,IACF;AAEA,QAAI,OAAO;AACT;AAAA,QACE;AAAA,UACE,MAAM,MAAM,GAAyB;AAAA,UACrC,CAAC,QAAQ,YAAY,cAAc;AACjC,mBAAO,QAAQ,UAAU,KAAK,MAAM,GAAyB,GAAG,SAAS;AAAA,UAC3E;AAAA,UACA,EAAE,MAAA;AAAA,QAAM;AAAA,MACV;AAEF;AAAA,IACF;AAEA;AAAA,MAAmB,CAAC,cAClB,QAAQ,UAAU,KAAK,MAAM,GAAyB,GAAG,SAAS;AAAA,IAAA;AAAA,EAEtE;AACF;"}
@@ -0,0 +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 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: Set<string> = new Set(PIXI_SOLID_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"],"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;AAQO,MAAM,8BAA2C,IAAI,IAAI,8BAA8B;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"point-property-names.js","sources":["../../../src/components/bind-props/point-property-names.ts"],"sourcesContent":["const POINT_PROP_NAMES = [\n \"position\",\n \"scale\",\n \"pivot\",\n \"skew\",\n \"anchor\",\n \"tilePosition\",\n \"tileScale\",\n] as const;\n\nexport const POINT_PROP_NAMES_SET: Set<string> = new Set(POINT_PROP_NAMES);\n\nexport const POINT_PROP_AXIS_NAMES = [\n \"positionX\",\n \"positionY\",\n \"scaleX\",\n \"scaleY\",\n \"pivotX\",\n \"pivotY\",\n \"skewX\",\n \"skewY\",\n \"anchorX\",\n \"anchorY\",\n \"tilePositionX\",\n \"tilePositionY\",\n \"tileScaleX\",\n \"tileScaleY\",\n] as const;\n\nexport type PointAxisPropName = (typeof POINT_PROP_AXIS_NAMES)[number];\n\nexport const POINT_PROP_AXIS_NAMES_SET: Set<string> = new Set(POINT_PROP_AXIS_NAMES);\n\nexport const ALL_VALID_PROP_NAMES_SET: Set<string> = new Set([\n ...POINT_PROP_NAMES_SET,\n ...POINT_PROP_AXIS_NAMES_SET,\n]);\n"],"names":[],"mappings":"AAAA,MAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,uBAAoC,IAAI,IAAI,gBAAgB;AAElE,MAAM,wBAAwB;AAAA,EACnC;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;AAIO,MAAM,4BAAyC,IAAI,IAAI,qBAAqB;AAE5E,MAAM,+CAA4C,IAAI;AAAA,EAC3D,GAAG;AAAA,EACH,GAAG;AACL,CAAC;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-event-property.js","sources":["../../../src/components/bind-props/set-event-property.ts"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport type { PIXI_EVENT_NAMES } from \"./event-names\";\nimport { PIXI_EVENT_HANDLER_NAME_SET } from \"./event-names\";\n\nexport const isEventProperty = (name: string): boolean => PIXI_EVENT_HANDLER_NAME_SET.has(name);\n\nexport const setEventProperty = (\n node: Pixi.Container,\n name: string,\n eventHandler: any,\n prevEventHandler?: any,\n): void => {\n // Remove the 'on' prefix to get the actual event name.\n const eventName = name.slice(2) as (typeof PIXI_EVENT_NAMES)[number];\n\n if (prevEventHandler) {\n node.removeEventListener(eventName, prevEventHandler);\n }\n node.addEventListener(eventName, eventHandler);\n};\n"],"names":[],"mappings":";AAIO,MAAM,kBAAkB,CAAC,SAA0B,4BAA4B,IAAI,IAAI;AAEvF,MAAM,mBAAmB,CAC9B,MACA,MACA,cACA,qBACS;AAET,QAAM,YAAY,KAAK,MAAM,CAAC;AAE9B,MAAI,kBAAkB;AACpB,SAAK,oBAAoB,WAAW,gBAAgB;AAAA,EACtD;AACA,OAAK,iBAAiB,WAAW,YAAY;AAC/C;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-point-property.js","sources":["../../../src/components/bind-props/set-point-property.ts"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport {\n ALL_VALID_PROP_NAMES_SET,\n POINT_PROP_AXIS_NAMES_SET,\n POINT_PROP_NAMES_SET,\n} from \"./point-property-names\";\n\nexport const isPointProperty = (propName: string): boolean =>\n ALL_VALID_PROP_NAMES_SET.has(propName);\n\nexport const setPointProperty = <T>(node: Pixi.Container, name: string, value: T): void => {\n if (typeof value === \"object\" && value !== null) {\n (node as any)[name].set((value as any).x, (value as any).y);\n return;\n }\n\n if (typeof value === \"number\") {\n if (POINT_PROP_NAMES_SET.has(name)) {\n (node as any)[name].set(value);\n } else if (POINT_PROP_AXIS_NAMES_SET.has(name)) {\n const axisName = name[name.length - 1].toLowerCase();\n const propertyName = name.slice(0, -1);\n (node as any)[propertyName][axisName] = value;\n }\n }\n};\n"],"names":[],"mappings":";AAOO,MAAM,kBAAkB,CAAC,aAC9B,yBAAyB,IAAI,QAAQ;AAEhC,MAAM,mBAAmB,CAAI,MAAsB,MAAc,UAAmB;AACzF,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC9C,SAAa,IAAI,EAAE,IAAK,MAAc,GAAI,MAAc,CAAC;AAC1D;AAAA,EACF;AAEA,MAAI,OAAO,UAAU,UAAU;AAC7B,QAAI,qBAAqB,IAAI,IAAI,GAAG;AACjC,WAAa,IAAI,EAAE,IAAI,KAAK;AAAA,IAC/B,WAAW,0BAA0B,IAAI,IAAI,GAAG;AAC9C,YAAM,WAAW,KAAK,KAAK,SAAS,CAAC,EAAE,YAAA;AACvC,YAAM,eAAe,KAAK,MAAM,GAAG,EAAE;AACpC,WAAa,YAAY,EAAE,QAAQ,IAAI;AAAA,IAC1C;AAAA,EACF;AACF;"}
@@ -0,0 +1,20 @@
1
+ import { isEventProperty, setEventProperty } from "./set-event-property.js";
2
+ import { isPointProperty, setPointProperty } from "./set-point-property.js";
3
+ const setProp = (instance, key, value, prevValue) => {
4
+ if (isPointProperty(key)) {
5
+ setPointProperty(instance, key, value);
6
+ return value;
7
+ }
8
+ if (key in instance) {
9
+ instance[key] = value;
10
+ return value;
11
+ }
12
+ if (isEventProperty(key)) {
13
+ setEventProperty(instance, key, value, prevValue);
14
+ return value;
15
+ }
16
+ };
17
+ export {
18
+ setProp
19
+ };
20
+ //# sourceMappingURL=set-prop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-prop.js","sources":["../../../src/components/bind-props/set-prop.ts"],"sourcesContent":["import { isEventProperty, setEventProperty } from \"./set-event-property\";\nimport { isPointProperty, setPointProperty } from \"./set-point-property\";\nimport type * as Pixi from \"pixi.js\";\n\nexport const setProp = <T = unknown>(\n instance: Pixi.Container,\n key: string,\n value: T,\n prevValue?: T,\n): T | undefined => {\n if (isPointProperty(key)) {\n setPointProperty(instance, key, value as number);\n return value;\n }\n\n if (key in instance) {\n (instance as any)[key] = value;\n return value;\n }\n\n if (isEventProperty(key)) {\n setEventProperty(instance, key, value, prevValue);\n return value;\n }\n};\n"],"names":[],"mappings":";;AAIO,MAAM,UAAU,CACrB,UACA,KACA,OACA,cACkB;AAClB,MAAI,gBAAgB,GAAG,GAAG;AACxB,qBAAiB,UAAU,KAAK,KAAe;AAC/C,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,UAAU;AAClB,aAAiB,GAAG,IAAI;AACzB,WAAO;AAAA,EACT;AAEA,MAAI,gBAAgB,GAAG,GAAG;AACxB,qBAAiB,UAAU,KAAK,OAAO,SAAS;AAChD,WAAO;AAAA,EACT;AACF;"}
@@ -0,0 +1,29 @@
1
+ import { splitProps } from "solid-js";
2
+ import { PIXI_SOLID_EVENT_HANDLER_NAMES } from "./bind-props/event-names.js";
3
+ import { POINT_PROP_AXIS_NAMES } from "./bind-props/point-property-names.js";
4
+ import { bindProps } from "./bind-props/bind-props.js";
5
+ const SOLID_PROP_KEYS = ["ref", "as", "children"];
6
+ const createContainerComponent = (PixiClass) => {
7
+ return (props) => {
8
+ const [runtimeProps, initialisationProps] = splitProps(props, [
9
+ ...SOLID_PROP_KEYS,
10
+ ...PIXI_SOLID_EVENT_HANDLER_NAMES,
11
+ ...POINT_PROP_AXIS_NAMES
12
+ ]);
13
+ const instance = props.as || new PixiClass(initialisationProps);
14
+ bindProps(instance, initialisationProps, true);
15
+ bindProps(instance, runtimeProps);
16
+ return instance;
17
+ };
18
+ };
19
+ const createLeafComponent = (PixiClass) => {
20
+ return (props) => {
21
+ return createContainerComponent(PixiClass)(props);
22
+ };
23
+ };
24
+ export {
25
+ SOLID_PROP_KEYS,
26
+ createContainerComponent,
27
+ createLeafComponent
28
+ };
29
+ //# sourceMappingURL=component-factories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-factories.js","sources":["../../src/components/component-factories.ts"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport type { JSX, Ref } from \"solid-js\";\nimport { createRenderEffect, on, splitProps } from \"solid-js\";\nimport type { PixiEventHandlerMap } from \"./bind-props/event-names\";\nimport { PIXI_SOLID_EVENT_HANDLER_NAMES } from \"./bind-props/event-names\";\nimport type { PointAxisPropName } from \"./bind-props/point-property-names\";\nimport { POINT_PROP_AXIS_NAMES } from \"./bind-props/point-property-names\";\nimport { bindProps } from \"./bind-props\";\n\n/**\n * This is a utility type useful for extending the props of custom components to allow props to be passed through to the underlying Pixi instance.\n *\n * If you don't require them all it's recommended to narrow the type by using Pick or Omit the props to only allow the ones you need.\n *\n * @example PixiComponentProps<Pixi.SpriteOptions>.\n */\nexport type PixiComponentProps<\n ComponentOptions extends Pixi.ContainerOptions = Pixi.ContainerOptions,\n> = PixiEventHandlerMap & PointAxisProps & Omit<ComponentOptions, \"children\">;\n\n/**\n * Prop definition for components that CAN have children\n */\nexport type ContainerProps<Component> = PixiEventHandlerMap &\n PointAxisProps & {\n ref?: Ref<Component>;\n as?: Component;\n children?: JSX.Element;\n };\n\nexport type PointAxisProps = Partial<Record<PointAxisPropName, number>>;\n\n/**\n * Prop definition for components that CANNOT have children\n */\nexport type LeafProps<Component> = Omit<ContainerProps<Component>, \"children\">;\n\n/**\n * Prop definition for filter components\n */\nexport type FilterProps<Component> = {\n ref?: Ref<Component>;\n as?: Component;\n};\n\n// Keys that are specific to Solid components and not Pixi props\nexport const SOLID_PROP_KEYS = [\"ref\", \"as\", \"children\"] as const;\n\nexport const createContainerComponent = <\n InstanceType extends Pixi.Container,\n OptionsType extends object,\n>(\n PixiClass: new (props: OptionsType) => InstanceType,\n): ((\n props: Omit<OptionsType, \"children\"> & ContainerProps<InstanceType>,\n) => InstanceType & JSX.Element) => {\n return (props): InstanceType & JSX.Element => {\n const [runtimeProps, initialisationProps] = splitProps(props, [\n ...SOLID_PROP_KEYS,\n ...PIXI_SOLID_EVENT_HANDLER_NAMES,\n ...POINT_PROP_AXIS_NAMES,\n ]);\n\n const instance = props.as || new PixiClass(initialisationProps as any);\n\n bindProps(instance, initialisationProps, true);\n bindProps(instance, runtimeProps);\n\n return instance as InstanceType & JSX.Element;\n };\n};\n\nexport const createLeafComponent = <\n InstanceType extends Pixi.Container,\n OptionsType extends object,\n>(\n PixiClass: new (props: OptionsType) => InstanceType,\n) => {\n return (\n props: Omit<OptionsType, \"children\"> & LeafProps<InstanceType>,\n ): InstanceType & JSX.Element => {\n return createContainerComponent<InstanceType, OptionsType>(PixiClass)(props);\n };\n};\n\nexport const createFilterComponent = <InstanceType extends Pixi.Filter, OptionsType extends object>(\n PixiClass: new (props: OptionsType) => InstanceType,\n) => {\n return (props: OptionsType & FilterProps<InstanceType>): InstanceType & JSX.Element => {\n const [runtimeProps, initialisationProps] = splitProps(props, [\"ref\", \"as\"]);\n\n const instance = props.as || new PixiClass(initialisationProps as any);\n\n for (const key in initialisationProps) {\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 throw new Error(`Cannot set children on non-container instance.`);\n } else {\n createRenderEffect(\n on(\n () => props[key as keyof typeof initialisationProps],\n () => {\n (instance as any)[key] = initialisationProps[key];\n },\n { defer: true },\n ),\n );\n }\n }\n\n for (const key in runtimeProps) {\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 }\n }\n\n return instance as InstanceType & JSX.Element;\n };\n};\n"],"names":[],"mappings":";;;;AA8CO,MAAM,kBAAkB,CAAC,OAAO,MAAM,UAAU;AAEhD,MAAM,2BAA2B,CAItC,cAGkC;AAClC,SAAO,CAAC,UAAsC;AAC5C,UAAM,CAAC,cAAc,mBAAmB,IAAI,WAAW,OAAO;AAAA,MAC5D,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,IAAA,CACJ;AAED,UAAM,WAAW,MAAM,MAAM,IAAI,UAAU,mBAA0B;AAErE,cAAU,UAAU,qBAAqB,IAAI;AAC7C,cAAU,UAAU,YAAY;AAEhC,WAAO;AAAA,EACT;AACF;AAEO,MAAM,sBAAsB,CAIjC,cACG;AACH,SAAO,CACL,UAC+B;AAC/B,WAAO,yBAAoD,SAAS,EAAE,KAAK;AAAA,EAC7E;AACF;"}
@@ -1,5 +1,5 @@
1
1
  import { RenderContainer as RenderContainer$1, RenderLayer as RenderLayer$1, AnimatedSprite as AnimatedSprite$1, BitmapText as BitmapText$1, Container as Container$1, Graphics as Graphics$1, HTMLText as HTMLText$1, MeshPlane as MeshPlane$1, MeshRope as MeshRope$1, NineSliceSprite as NineSliceSprite$1, ParticleContainer as ParticleContainer$1, PerspectiveMesh as PerspectiveMesh$1, Sprite as Sprite$1, Text as Text$1, TilingSprite as TilingSprite$1 } from "pixi.js";
2
- import { createLeafComponent, createContainerComponent } from "./component-creation.js";
2
+ import { createLeafComponent, createContainerComponent } from "./component-factories.js";
3
3
  const AnimatedSprite = createLeafComponent(AnimatedSprite$1);
4
4
  const BitmapText = createLeafComponent(BitmapText$1);
5
5
  const Container = createContainerComponent(Container$1);
@@ -32,4 +32,4 @@ export {
32
32
  Text,
33
33
  TilingSprite
34
34
  };
35
- //# sourceMappingURL=pixi-components.js.map
35
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.js","sources":["../../src/components/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 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 { createContainerComponent, createLeafComponent } from \"./component-factories\";\n\n/**\n * A SolidJS component that renders a `PIXI.AnimatedSprite`.\n */\nexport const AnimatedSprite = createLeafComponent<PixiAnimatedSprite, Pixi.AnimatedSpriteOptions>(\n PixiAnimatedSprite,\n);\n/**\n * A SolidJS component that renders a `PIXI.BitmapText`.\n */\nexport const BitmapText = createLeafComponent<PixiBitmapText, Pixi.TextOptions>(PixiBitmapText);\n/**\n * A SolidJS component that renders a `PIXI.Container`.\n */\nexport const Container = createContainerComponent<PixiContainer, Pixi.ContainerOptions>(\n PixiContainer,\n);\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.NineSliceSprite`.\n */\nexport const NineSliceSprite = createLeafComponent<\n PixiNineSliceSprite,\n Pixi.NineSliceSpriteOptions\n>(PixiNineSliceSprite);\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<\n PixiParticleContainer,\n Pixi.ParticleContainerOptions\n>(PixiParticleContainer);\n\n/**\n * A SolidJS component that renders a `PIXI.PerspectiveMesh`.\n */\nexport const PerspectiveMesh = createLeafComponent<\n PixiPerspectiveMesh,\n Pixi.PerspectivePlaneOptions\n>(PixiPerspectiveMesh);\n\n/**\n * A SolidJS component that renders a `PIXI.RenderContainer`.\n */\nexport const RenderContainer = createContainerComponent<\n PixiRenderContainer,\n Pixi.RenderContainerOptions\n>(PixiRenderContainer);\n\n/**\n * A SolidJS component that renders a `PIXI.RenderLayer`.\n */\nexport const RenderLayer = createContainerComponent<PixiRenderLayer, Pixi.RenderLayerOptions>(\n PixiRenderLayer,\n);\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>(\n PixiTilingSprite,\n);\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":["AnimatedSprite","createLeafComponent","PixiAnimatedSprite","BitmapText","PixiBitmapText","Container","createContainerComponent","PixiContainer","Graphics","PixiGraphics","HTMLText","PixiHTMLText","MeshPlane","PixiMeshPlane","MeshRope","PixiMeshRope","NineSliceSprite","PixiNineSliceSprite","ParticleContainer","PixiParticleContainer","PerspectiveMesh","PixiPerspectiveMesh","RenderContainer","PixiRenderContainer","RenderLayer","PixiRenderLayer","Sprite","PixiSprite","Text","PixiText","TilingSprite","PixiTilingSprite"],"mappings":";;AAuBO,MAAMA,iBAAiBC,oBAC5BC,gBACF;AAIO,MAAMC,aAAaF,oBAAsDG,YAAc;AAIvF,MAAMC,YAAYC,yBACvBC,WACF;AAKO,MAAMC,WAAWP,oBAAwDQ,UAAY;AAIrF,MAAMC,WAAWT,oBAAwDU,UAAY;AAKrF,MAAMC,YAAYX,oBAA0DY,WAAa;AAKzF,MAAMC,WAAWb,oBAAwDc,UAAY;AAKrF,MAAMC,kBAAkBf,oBAG7BgB,iBAAmB;AAOd,MAAMC,oBAAoBjB,oBAG/BkB,mBAAqB;AAKhB,MAAMC,kBAAkBnB,oBAG7BoB,iBAAmB;AAKd,MAAMC,kBAAkBhB,yBAG7BiB,iBAAmB;AAKd,MAAMC,cAAclB,yBACzBmB,aACF;AAKO,MAAMC,SAASzB,oBAAoD0B,QAAU;AAI7E,MAAMC,OAAO3B,oBAAsD4B,MAAQ;AAK3E,MAAMC,eAAe7B,oBAC1B8B,cACF;"}
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { createAsyncDelay, delay } from "./delay.js";
2
- import { PIXI_EVENT_NAMES, PIXI_SOLID_EVENT_HANDLER_NAMES } from "./event-names.js";
3
1
  import { onResize } from "./on-resize.js";
4
2
  import { onTick } from "./on-tick.js";
3
+ import { createAsyncDelay, delay } from "./delay.js";
5
4
  import { PixiCanvas } from "./pixi-canvas.js";
6
- import { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, NineSliceSprite, ParticleContainer, PerspectiveMesh, RenderContainer, RenderLayer, Sprite, Text, TilingSprite } from "./pixi-components.js";
5
+ import { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, NineSliceSprite, ParticleContainer, PerspectiveMesh, RenderContainer, RenderLayer, Sprite, Text, TilingSprite } from "./components/components.js";
6
+ import { PIXI_EVENT_NAMES, PIXI_SOLID_EVENT_HANDLER_NAMES } from "./components/bind-props/event-names.js";
7
7
  import { getPixiApp } from "./pixi-application/get-pixi-app.js";
8
8
  import { getTicker } from "./pixi-application/get-ticker.js";
9
9
  import { PixiApplicationProvider, TickerProvider } from "./pixi-application/pixi-application-provider.js";
@@ -1 +1 @@
1
- {"version":3,"file":"pixi-application-provider.js","sources":["../../src/pixi-application/pixi-application-provider.tsx"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport type { JSX, ParentProps } from \"solid-js\";\nimport { createResource, onCleanup, Show, splitProps, useContext } from \"solid-js\";\nimport { createPixiScreenStore } from \"../use-pixi-screen/pixi-screen-store\";\nimport { PixiAppContext, TickerContext } from \"./context\";\nimport { createPixiApplication } from \"./pixi-application\";\n\n/**\n * Props for the `PixiApplication` component. It extends the PIXI.ApplicationOptions\n * minus the `children` and `resizeTo` properties, which are handled by pixi-solid internally.\n * There is also an optional `existingApp` property to pass in an already created Pixi.Application instance, which will be used instead of creating a new one.\n */\nexport type PixiApplicationProps = Partial<Omit<Pixi.ApplicationOptions, \"children\" | \"resizeTo\">> & {\n children?: JSX.Element;\n existingApp?: Pixi.Application;\n};\n\n/**\n * A SolidJS component that creates a Pixi.Application instance and works as a context provider.\n * It provides the application instance through context to be used by child components\n * and custom hooks like `getPixiApp`, `onTick`, `getTicker` and `usePixiScreen`.\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 PixiApplicationProvider = (props: PixiApplicationProps) => {\n const [appResource] = createResource(async () => {\n const existingContext = useContext(PixiAppContext);\n if (existingContext?.app) {\n return existingContext.app;\n }\n const [, initialisationProps] = splitProps(props, [\"children\", \"existingApp\"]);\n return await createPixiApplication(initialisationProps);\n });\n\n onCleanup(() => {\n appResource()?.destroy(true, { children: true });\n });\n\n return (\n <Show when={appResource()}>\n {(app) => {\n const pixiScreenStore = createPixiScreenStore(app().renderer);\n const contextValue = {\n app: app(),\n pixiScreenStore,\n };\n\n return (\n <PixiAppContext.Provider value={contextValue}>\n <TickerContext.Provider value={app().ticker}>{props.children}</TickerContext.Provider>\n </PixiAppContext.Provider>\n );\n }}\n </Show>\n );\n};\n\nexport type TickerProviderProps = ParentProps<{ ticker: Pixi.Ticker }>;\n\n/**\n * This is only required if you want a ticker without the Pixi Application, usually for testing a store that relies on the ticker related utilities.\n * It provides context for the `onTick`, `delay`, `createAsyncDelay` and `getTicker` utilities.\n *\n * The ticker instance you want to use needs to be passed in as a prop so it can be manually controlled from the outside for testing.\n */\nexport const TickerProvider = (props: TickerProviderProps) => {\n return <TickerContext.Provider value={props.ticker}>{props.children}</TickerContext.Provider>;\n};\n"],"names":["PixiApplicationProvider","props","appResource","createResource","existingContext","useContext","PixiAppContext","app","initialisationProps","splitProps","createPixiApplication","onCleanup","destroy","children","_$createComponent","Show","when","pixiScreenStore","createPixiScreenStore","renderer","contextValue","Provider","value","TickerContext","ticker","TickerProvider"],"mappings":";;;;;AA2BO,MAAMA,0BAA0BA,CAACC,UAAgC;AACtE,QAAM,CAACC,WAAW,IAAIC,eAAe,YAAY;AAC/C,UAAMC,kBAAkBC,WAAWC,cAAc;AACjD,QAAIF,iBAAiBG,KAAK;AACxB,aAAOH,gBAAgBG;AAAAA,IACzB;AACA,UAAM,CAAA,EAAGC,mBAAmB,IAAIC,WAAWR,OAAO,CAAC,YAAY,aAAa,CAAC;AAC7E,WAAO,MAAMS,sBAAsBF,mBAAmB;AAAA,EACxD,CAAC;AAEDG,YAAU,MAAM;AACdT,gBAAAA,GAAeU,QAAQ,MAAM;AAAA,MAAEC,UAAU;AAAA,IAAA,CAAM;AAAA,EACjD,CAAC;AAED,SAAAC,gBACGC,MAAI;AAAA,IAAA,IAACC,OAAI;AAAA,aAAEd,YAAAA;AAAAA,IAAa;AAAA,IAAAW,UACrBN,CAAAA,QAAQ;AACR,YAAMU,kBAAkBC,sBAAsBX,IAAAA,EAAMY,QAAQ;AAC5D,YAAMC,eAAe;AAAA,QACnBb,KAAKA,IAAAA;AAAAA,QACLU;AAAAA,MAAAA;AAGF,aAAAH,gBACGR,eAAee,UAAQ;AAAA,QAACC,OAAOF;AAAAA,QAAY,IAAAP,WAAA;AAAA,iBAAAC,gBACzCS,cAAcF,UAAQ;AAAA,YAAA,IAACC,QAAK;AAAA,qBAAEf,MAAMiB;AAAAA,YAAM;AAAA,YAAA,IAAAX,WAAA;AAAA,qBAAGZ,MAAMY;AAAAA,YAAQ;AAAA,UAAA,CAAA;AAAA,QAAA;AAAA,MAAA,CAAA;AAAA,IAGlE;AAAA,EAAA,CAAC;AAGP;AAUO,MAAMY,iBAAiBA,CAACxB,UAA+B;AAC5D,SAAAa,gBAAQS,cAAcF,UAAQ;AAAA,IAAA,IAACC,QAAK;AAAA,aAAErB,MAAMuB;AAAAA,IAAM;AAAA,IAAA,IAAAX,WAAA;AAAA,aAAGZ,MAAMY;AAAAA,IAAQ;AAAA,EAAA,CAAA;AACrE;"}
1
+ {"version":3,"file":"pixi-application-provider.js","sources":["../../src/pixi-application/pixi-application-provider.tsx"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport type { JSX, ParentProps } from \"solid-js\";\nimport { createResource, onCleanup, Show, splitProps, useContext } from \"solid-js\";\nimport { createPixiScreenStore } from \"../use-pixi-screen/pixi-screen-store\";\nimport { PixiAppContext, TickerContext } from \"./context\";\nimport { createPixiApplication } from \"./pixi-application\";\n\n/**\n * Props for the `PixiApplication` component. It extends the PIXI.ApplicationOptions\n * minus the `children` and `resizeTo` properties, which are handled by pixi-solid internally.\n * There is also an optional `existingApp` property to pass in an already created Pixi.Application instance, which will be used instead of creating a new one.\n */\nexport type PixiApplicationProps = Partial<\n Omit<Pixi.ApplicationOptions, \"children\" | \"resizeTo\">\n> & {\n children?: JSX.Element;\n existingApp?: Pixi.Application;\n};\n\n/**\n * A SolidJS component that creates a Pixi.Application instance and works as a context provider.\n * It provides the application instance through context to be used by child components\n * and custom hooks like `getPixiApp`, `onTick`, `getTicker` and `usePixiScreen`.\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 PixiApplicationProvider = (props: PixiApplicationProps) => {\n const [appResource] = createResource(async () => {\n const existingContext = useContext(PixiAppContext);\n if (existingContext?.app) {\n return existingContext.app;\n }\n const [, initialisationProps] = splitProps(props, [\"children\", \"existingApp\"]);\n return await createPixiApplication(initialisationProps);\n });\n\n onCleanup(() => {\n appResource()?.destroy(true, { children: true });\n });\n\n return (\n <Show when={appResource()}>\n {(app) => {\n const pixiScreenStore = createPixiScreenStore(app().renderer);\n const contextValue = {\n app: app(),\n pixiScreenStore,\n };\n\n return (\n <PixiAppContext.Provider value={contextValue}>\n <TickerContext.Provider value={app().ticker}>{props.children}</TickerContext.Provider>\n </PixiAppContext.Provider>\n );\n }}\n </Show>\n );\n};\n\nexport type TickerProviderProps = ParentProps<{ ticker: Pixi.Ticker }>;\n\n/**\n * This is only required if you want a ticker without the Pixi Application, usually for testing a store that relies on the ticker related utilities.\n * It provides context for the `onTick`, `delay`, `createAsyncDelay` and `getTicker` utilities.\n *\n * The ticker instance you want to use needs to be passed in as a prop so it can be manually controlled from the outside for testing.\n */\nexport const TickerProvider = (props: TickerProviderProps) => {\n return <TickerContext.Provider value={props.ticker}>{props.children}</TickerContext.Provider>;\n};\n"],"names":["PixiApplicationProvider","props","appResource","createResource","existingContext","useContext","PixiAppContext","app","initialisationProps","splitProps","createPixiApplication","onCleanup","destroy","children","_$createComponent","Show","when","pixiScreenStore","createPixiScreenStore","renderer","contextValue","Provider","value","TickerContext","ticker","TickerProvider"],"mappings":";;;;;AA6BO,MAAMA,0BAA0BA,CAACC,UAAgC;AACtE,QAAM,CAACC,WAAW,IAAIC,eAAe,YAAY;AAC/C,UAAMC,kBAAkBC,WAAWC,cAAc;AACjD,QAAIF,iBAAiBG,KAAK;AACxB,aAAOH,gBAAgBG;AAAAA,IACzB;AACA,UAAM,CAAA,EAAGC,mBAAmB,IAAIC,WAAWR,OAAO,CAAC,YAAY,aAAa,CAAC;AAC7E,WAAO,MAAMS,sBAAsBF,mBAAmB;AAAA,EACxD,CAAC;AAEDG,YAAU,MAAM;AACdT,gBAAAA,GAAeU,QAAQ,MAAM;AAAA,MAAEC,UAAU;AAAA,IAAA,CAAM;AAAA,EACjD,CAAC;AAED,SAAAC,gBACGC,MAAI;AAAA,IAAA,IAACC,OAAI;AAAA,aAAEd,YAAAA;AAAAA,IAAa;AAAA,IAAAW,UACrBN,CAAAA,QAAQ;AACR,YAAMU,kBAAkBC,sBAAsBX,IAAAA,EAAMY,QAAQ;AAC5D,YAAMC,eAAe;AAAA,QACnBb,KAAKA,IAAAA;AAAAA,QACLU;AAAAA,MAAAA;AAGF,aAAAH,gBACGR,eAAee,UAAQ;AAAA,QAACC,OAAOF;AAAAA,QAAY,IAAAP,WAAA;AAAA,iBAAAC,gBACzCS,cAAcF,UAAQ;AAAA,YAAA,IAACC,QAAK;AAAA,qBAAEf,MAAMiB;AAAAA,YAAM;AAAA,YAAA,IAAAX,WAAA;AAAA,qBAAGZ,MAAMY;AAAAA,YAAQ;AAAA,UAAA,CAAA;AAAA,QAAA;AAAA,MAAA,CAAA;AAAA,IAGlE;AAAA,EAAA,CAAC;AAGP;AAUO,MAAMY,iBAAiBA,CAACxB,UAA+B;AAC5D,SAAAa,gBAAQS,cAAcF,UAAQ;AAAA,IAAA,IAACC,QAAK;AAAA,aAAErB,MAAMuB;AAAAA,IAAM;AAAA,IAAA,IAAAX,WAAA;AAAA,aAAGZ,MAAMY;AAAAA,IAAQ;AAAA,EAAA,CAAA;AACrE;"}
@@ -1,8 +1,8 @@
1
1
  import { createComponent, mergeProps, template, insert, effect, style, className, use } from "solid-js/web";
2
2
  import { splitProps, onMount, onCleanup } from "solid-js";
3
- import { applyProps } from "./component-creation.js";
4
3
  import { PixiApplicationProvider } from "./pixi-application/pixi-application-provider.js";
5
4
  import { getPixiApp } from "./pixi-application/get-pixi-app.js";
5
+ import { bindProps } from "./components/bind-props/bind-props.js";
6
6
  var _tmpl$ = /* @__PURE__ */ template(`<div style=position:relative>`);
7
7
  const InnerPixiCanvas = (props) => {
8
8
  let canvasWrapElement;
@@ -12,7 +12,7 @@ const InnerPixiCanvas = (props) => {
12
12
  } catch {
13
13
  throw new Error("InnerPixiCanvas must be used within a PixiApplicationProvider or a PixiCanvas");
14
14
  }
15
- applyProps(pixiApp.stage, props);
15
+ bindProps(pixiApp.stage, props);
16
16
  let previousResizeTo;
17
17
  let resizeObserver;
18
18
  onMount(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"pixi-canvas.js","sources":["../src/pixi-canvas.tsx"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport type { JSX } from \"solid-js\";\nimport { onCleanup, onMount, splitProps } from \"solid-js\";\nimport { applyProps } from \"./component-creation\";\nimport { getPixiApp, PixiApplicationProvider } from \"./pixi-application\";\n\nexport type PixiCanvasProps = {\n children: JSX.Element;\n style?: JSX.CSSProperties | undefined;\n class?: string;\n} & Partial<Omit<Pixi.ApplicationOptions, \"children\" | \"resizeTo\">>;\n\nconst InnerPixiCanvas = (props: Pick<PixiCanvasProps, \"children\" | \"style\" | \"class\">): JSX.Element => {\n let canvasWrapElement: HTMLDivElement | undefined;\n let pixiApp: Pixi.Application;\n\n try {\n pixiApp = getPixiApp();\n } catch {\n throw new Error(\"InnerPixiCanvas must be used within a PixiApplicationProvider or a PixiCanvas\");\n }\n\n applyProps(pixiApp.stage, props);\n\n let previousResizeTo: typeof pixiApp.resizeTo;\n let resizeObserver: ResizeObserver | undefined;\n\n onMount(() => {\n if (!canvasWrapElement) return;\n previousResizeTo = pixiApp.resizeTo;\n pixiApp.resizeTo = canvasWrapElement;\n pixiApp.queueResize();\n resizeObserver = new ResizeObserver(() => {\n pixiApp.queueResize();\n });\n resizeObserver.observe(canvasWrapElement);\n });\n\n onCleanup(() => {\n if (!canvasWrapElement) return;\n pixiApp.resizeTo = previousResizeTo;\n resizeObserver?.disconnect();\n resizeObserver = undefined;\n });\n\n return (\n <div\n ref={canvasWrapElement}\n style={{\n position: \"relative\",\n /* Disables the callout/menu on long-press */\n [\"-webkit-touch-callout\"]: \"none\",\n /* Disables text selection */\n [\"-webkit-user-select\"]: \"none\",\n [\"user-select\"]: \"none\",\n ...(typeof props.style === \"object\" ? props.style : {}),\n }}\n class={props.class}\n >\n {pixiApp.canvas}\n </div>\n );\n};\n\n/**\n * PixiCanvas\n *\n * A small wrapper that mounts the PIXI application's canvas element into the DOM\n * and automatically resizes it.\n *\n * - Works with or without a surrounding `PixiApplicationProvider` component.\n * - If used inside `PixiApplicationProvider`, it will use the provided context.\n * - If used standalone, it will create its own PixiApplication and provide context.\n * - Accepts pixi-solid components as children, which will be rendered inside the canvas.\n *\n * Props:\n * @param props.children - JSX content to render inside the canvas wrapper.\n * @param props.style - CSS styles to apply to the canvas wrapper.\n * @param props.class - CSS class to apply to the canvas wrapper.\n * @param props - Additional Pixi ApplicationOptions (except 'children' and 'resizeTo').\n */\n\nexport const PixiCanvas = (props: PixiCanvasProps): JSX.Element => {\n const [, applicationOptions] = splitProps(props, [\"children\", \"style\", \"class\"]);\n return (\n <PixiApplicationProvider {...applicationOptions}>\n <InnerPixiCanvas style={props.style} class={props.class}>\n {props.children}\n </InnerPixiCanvas>\n </PixiApplicationProvider>\n );\n};\n"],"names":["InnerPixiCanvas","props","canvasWrapElement","pixiApp","getPixiApp","Error","applyProps","stage","previousResizeTo","resizeObserver","onMount","resizeTo","queueResize","ResizeObserver","observe","onCleanup","disconnect","undefined","_el$","_tmpl$","_ref$","_$use","_$insert","canvas","_$effect","_p$","_v$","style","_v$2","class","e","_$style","t","_$className","PixiCanvas","applicationOptions","splitProps","_$createComponent","PixiApplicationProvider","_$mergeProps","children"],"mappings":";;;;;;AAYA,MAAMA,kBAAkBA,CAACC,UAA8E;AACrG,MAAIC;AACJ,MAAIC;AAEJ,MAAI;AACFA,cAAUC,WAAAA;AAAAA,EACZ,QAAQ;AACN,UAAM,IAAIC,MAAM,+EAA+E;AAAA,EACjG;AAEAC,aAAWH,QAAQI,OAAON,KAAK;AAE/B,MAAIO;AACJ,MAAIC;AAEJC,UAAQ,MAAM;AACZ,QAAI,CAACR,kBAAmB;AACxBM,uBAAmBL,QAAQQ;AAC3BR,YAAQQ,WAAWT;AACnBC,YAAQS,YAAAA;AACRH,qBAAiB,IAAII,eAAe,MAAM;AACxCV,cAAQS,YAAAA;AAAAA,IACV,CAAC;AACDH,mBAAeK,QAAQZ,iBAAiB;AAAA,EAC1C,CAAC;AAEDa,YAAU,MAAM;AACd,QAAI,CAACb,kBAAmB;AACxBC,YAAQQ,WAAWH;AACnBC,oBAAgBO,WAAAA;AAChBP,qBAAiBQ;AAAAA,EACnB,CAAC;AAED,UAAA,MAAA;AAAA,QAAAC,OAAAC,OAAAA;AAAA,QAAAC,QAESlB;AAAiB,WAAAkB,UAAA,aAAAC,IAAAD,OAAAF,IAAA,IAAjBhB,oBAAiBgB;AAAAI,WAAAJ,MAAA,MAYrBf,QAAQoB,MAAM;AAAAC,WAAAC,CAAAA,QAAA;AAAA,UAAAC,MAXR;AAAA;AAAA,QAGL,CAAC,uBAAuB,GAAG;AAAA;AAAA,QAE3B,CAAC,qBAAqB,GAAG;AAAA,QACzB,CAAC,aAAa,GAAG;AAAA,QACjB,GAAI,OAAOzB,MAAM0B,UAAU,WAAW1B,MAAM0B,QAAQ,CAAA;AAAA,MAAC,GACtDC,OACM3B,MAAM4B;AAAKJ,UAAAK,IAAAC,MAAAb,MAAAQ,KAAAD,IAAAK,CAAA;AAAAF,eAAAH,IAAAO,KAAAC,UAAAf,MAAAO,IAAAO,IAAAJ,IAAA;AAAA,aAAAH;AAAAA,IAAA,GAAA;AAAA,MAAAK,GAAAb;AAAAA,MAAAe,GAAAf;AAAAA,IAAAA,CAAA;AAAA,WAAAC;AAAAA,EAAA,GAAA;AAKxB;AAoBO,MAAMgB,aAAaA,CAACjC,UAAwC;AACjE,QAAM,CAAA,EAAGkC,kBAAkB,IAAIC,WAAWnC,OAAO,CAAC,YAAY,SAAS,OAAO,CAAC;AAC/E,SAAAoC,gBACGC,yBAAuBC,WAAKJ,oBAAkB;AAAA,IAAA,IAAAK,WAAA;AAAA,aAAAH,gBAC5CrC,iBAAe;AAAA,QAAA,IAAC2B,QAAK;AAAA,iBAAE1B,MAAM0B;AAAAA,QAAK;AAAA,QAAA,KAAA,OAAA,IAAA;AAAA,iBAAS1B,MAAM4B;AAAAA,QAAK;AAAA,QAAA,IAAAW,WAAA;AAAA,iBACpDvC,MAAMuC;AAAAA,QAAQ;AAAA,MAAA,CAAA;AAAA,IAAA;AAAA,EAAA,CAAA,CAAA;AAIvB;"}
1
+ {"version":3,"file":"pixi-canvas.js","sources":["../src/pixi-canvas.tsx"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport type { JSX } from \"solid-js\";\nimport { onCleanup, onMount, splitProps } from \"solid-js\";\nimport { bindProps } from \"./components/bind-props\";\nimport { getPixiApp, PixiApplicationProvider } from \"./pixi-application\";\n\nexport type PixiCanvasProps = {\n children: JSX.Element;\n style?: JSX.CSSProperties | undefined;\n class?: string;\n} & Partial<Omit<Pixi.ApplicationOptions, \"children\" | \"resizeTo\">>;\n\nconst InnerPixiCanvas = (\n props: Pick<PixiCanvasProps, \"children\" | \"style\" | \"class\">,\n): JSX.Element => {\n let canvasWrapElement: HTMLDivElement | undefined;\n let pixiApp: Pixi.Application;\n\n try {\n pixiApp = getPixiApp();\n } catch {\n throw new Error(\n \"InnerPixiCanvas must be used within a PixiApplicationProvider or a PixiCanvas\",\n );\n }\n\n bindProps(pixiApp.stage, props);\n\n let previousResizeTo: HTMLElement | Window;\n let resizeObserver: ResizeObserver | undefined;\n\n onMount(() => {\n if (!canvasWrapElement) return;\n previousResizeTo = pixiApp.resizeTo;\n pixiApp.resizeTo = canvasWrapElement;\n pixiApp.queueResize();\n resizeObserver = new ResizeObserver(() => {\n pixiApp.queueResize();\n });\n resizeObserver.observe(canvasWrapElement);\n });\n\n onCleanup(() => {\n if (!canvasWrapElement) return;\n pixiApp.resizeTo = previousResizeTo;\n resizeObserver?.disconnect();\n resizeObserver = undefined;\n });\n\n return (\n <div\n ref={canvasWrapElement}\n style={{\n position: \"relative\",\n /* Disables the callout/menu on long-press */\n [\"-webkit-touch-callout\"]: \"none\",\n /* Disables text selection */\n [\"-webkit-user-select\"]: \"none\",\n [\"user-select\"]: \"none\",\n ...(typeof props.style === \"object\" ? props.style : {}),\n }}\n class={props.class}\n >\n {pixiApp.canvas}\n </div>\n );\n};\n\n/**\n * PixiCanvas\n *\n * A small wrapper that mounts the PIXI application's canvas element into the DOM\n * and automatically resizes it.\n *\n * - Works with or without a surrounding `PixiApplicationProvider` component.\n * - If used inside `PixiApplicationProvider`, it will use the provided context.\n * - If used standalone, it will create its own PixiApplication and provide context.\n * - Accepts pixi-solid components as children, which will be rendered inside the canvas.\n *\n * Props:\n * @param props.children - JSX content to render inside the canvas wrapper.\n * @param props.style - CSS styles to apply to the canvas wrapper.\n * @param props.class - CSS class to apply to the canvas wrapper.\n * @param props - Additional Pixi ApplicationOptions (except 'children' and 'resizeTo').\n */\n\nexport const PixiCanvas = (props: PixiCanvasProps): JSX.Element => {\n const [, applicationOptions] = splitProps(props, [\"children\", \"style\", \"class\"]);\n return (\n <PixiApplicationProvider {...applicationOptions}>\n <InnerPixiCanvas style={props.style} class={props.class}>\n {props.children}\n </InnerPixiCanvas>\n </PixiApplicationProvider>\n );\n};\n"],"names":["InnerPixiCanvas","props","canvasWrapElement","pixiApp","getPixiApp","Error","bindProps","stage","previousResizeTo","resizeObserver","onMount","resizeTo","queueResize","ResizeObserver","observe","onCleanup","disconnect","undefined","_el$","_tmpl$","_ref$","_$use","_$insert","canvas","_$effect","_p$","_v$","style","_v$2","class","e","_$style","t","_$className","PixiCanvas","applicationOptions","splitProps","_$createComponent","PixiApplicationProvider","_$mergeProps","children"],"mappings":";;;;;;AAYA,MAAMA,kBAAkBA,CACtBC,UACgB;AAChB,MAAIC;AACJ,MAAIC;AAEJ,MAAI;AACFA,cAAUC,WAAAA;AAAAA,EACZ,QAAQ;AACN,UAAM,IAAIC,MACR,+EACF;AAAA,EACF;AAEAC,YAAUH,QAAQI,OAAON,KAAK;AAE9B,MAAIO;AACJ,MAAIC;AAEJC,UAAQ,MAAM;AACZ,QAAI,CAACR,kBAAmB;AACxBM,uBAAmBL,QAAQQ;AAC3BR,YAAQQ,WAAWT;AACnBC,YAAQS,YAAAA;AACRH,qBAAiB,IAAII,eAAe,MAAM;AACxCV,cAAQS,YAAAA;AAAAA,IACV,CAAC;AACDH,mBAAeK,QAAQZ,iBAAiB;AAAA,EAC1C,CAAC;AAEDa,YAAU,MAAM;AACd,QAAI,CAACb,kBAAmB;AACxBC,YAAQQ,WAAWH;AACnBC,oBAAgBO,WAAAA;AAChBP,qBAAiBQ;AAAAA,EACnB,CAAC;AAED,UAAA,MAAA;AAAA,QAAAC,OAAAC,OAAAA;AAAA,QAAAC,QAESlB;AAAiB,WAAAkB,UAAA,aAAAC,IAAAD,OAAAF,IAAA,IAAjBhB,oBAAiBgB;AAAAI,WAAAJ,MAAA,MAYrBf,QAAQoB,MAAM;AAAAC,WAAAC,CAAAA,QAAA;AAAA,UAAAC,MAXR;AAAA;AAAA,QAGL,CAAC,uBAAuB,GAAG;AAAA;AAAA,QAE3B,CAAC,qBAAqB,GAAG;AAAA,QACzB,CAAC,aAAa,GAAG;AAAA,QACjB,GAAI,OAAOzB,MAAM0B,UAAU,WAAW1B,MAAM0B,QAAQ,CAAA;AAAA,MAAC,GACtDC,OACM3B,MAAM4B;AAAKJ,UAAAK,IAAAC,MAAAb,MAAAQ,KAAAD,IAAAK,CAAA;AAAAF,eAAAH,IAAAO,KAAAC,UAAAf,MAAAO,IAAAO,IAAAJ,IAAA;AAAA,aAAAH;AAAAA,IAAA,GAAA;AAAA,MAAAK,GAAAb;AAAAA,MAAAe,GAAAf;AAAAA,IAAAA,CAAA;AAAA,WAAAC;AAAAA,EAAA,GAAA;AAKxB;AAoBO,MAAMgB,aAAaA,CAACjC,UAAwC;AACjE,QAAM,CAAA,EAAGkC,kBAAkB,IAAIC,WAAWnC,OAAO,CAAC,YAAY,SAAS,OAAO,CAAC;AAC/E,SAAAoC,gBACGC,yBAAuBC,WAAKJ,oBAAkB;AAAA,IAAA,IAAAK,WAAA;AAAA,aAAAH,gBAC5CrC,iBAAe;AAAA,QAAA,IAAC2B,QAAK;AAAA,iBAAE1B,MAAM0B;AAAAA,QAAK;AAAA,QAAA,KAAA,OAAA,IAAA;AAAA,iBAAS1B,MAAM4B;AAAAA,QAAK;AAAA,QAAA,IAAAW,WAAA;AAAA,iBACpDvC,MAAMuC;AAAAA,QAAQ;AAAA,MAAA,CAAA;AAAA,IAAA;AAAA,EAAA,CAAA,CAAA;AAIvB;"}
@@ -0,0 +1,4 @@
1
+ import type * as Pixi from "pixi.js";
2
+ import type { JSX } from "solid-js";
3
+ export declare const bindChildrenToContainer: (parent: Pixi.Container, children?: JSX.Element) => void;
4
+ export declare const bindChildrenToRenderLayer: (parent: Pixi.RenderLayer, children?: JSX.Element) => void;
@@ -0,0 +1,12 @@
1
+ import type * as Pixi from "pixi.js";
2
+ import type { ContainerProps } from "../component-factories";
3
+ /**
4
+ * Applies the props to a Pixi instance with subscriptions to maintain reactivity.
5
+ *
6
+ * @param instance The Pixi instance we want to apply props to.
7
+ * @param props The props object.
8
+ * @param defer Defers the createRenderEffect so the props aren't set on the first run.
9
+ * This is useful because setting initialisation props can have unintended side effects.
10
+ * Notably in AnimatedSprite, if we set the textures property after instantiation it will stop the instance from playing.
11
+ */
12
+ export declare const bindProps: <InstanceType extends Pixi.Container, OptionsType extends ContainerProps<InstanceType>>(instance: InstanceType, props: OptionsType, defer?: boolean) => void;
@@ -0,0 +1,4 @@
1
+ export { bindProps } from "./bind-props";
2
+ export type { PixiEventHandlerMap } from "./event-names";
3
+ export type { PointAxisPropName } from "./point-property-names";
4
+ export { PIXI_EVENT_NAMES, PIXI_SOLID_EVENT_HANDLER_NAMES } from "./event-names";
@@ -0,0 +1,2 @@
1
+ import type * as Pixi from "pixi.js";
2
+ export declare const setProp: <T = unknown>(instance: Pixi.Container, key: string, value: T, prevValue?: T) => T | undefined;
@@ -1,7 +1,7 @@
1
1
  import type * as Pixi from "pixi.js";
2
2
  import type { JSX, Ref } from "solid-js";
3
- import type { PixiEventHandlerMap } from "./event-names";
4
- import type { PointAxisPropName } from "./point-property-names";
3
+ import type { PixiEventHandlerMap } from "./bind-props/event-names";
4
+ import type { PointAxisPropName } from "./bind-props/point-property-names";
5
5
  /**
6
6
  * This is a utility type useful for extending the props of custom components to allow props to be passed through to the underlying Pixi instance.
7
7
  *
@@ -31,16 +31,6 @@ export type FilterProps<Component> = {
31
31
  as?: Component;
32
32
  };
33
33
  export declare const SOLID_PROP_KEYS: readonly ["ref", "as", "children"];
34
- /**
35
- * Apply's the props to a Pixi instance with subsriptions to maintain reactivity.
36
- *
37
- * @param instance The Pixi instance we want to apply props to.
38
- * @param props The props object.
39
- * @param defer Defers the createRenderEffect so the props aren't set on the first run.
40
- * This is useful because setting initialisation props can have unintended side effects.
41
- * Notibly in AnimatedSprite, if we set the textures roperty after instantiation it will stop the instance from playing.
42
- */
43
- export declare const applyProps: <InstanceType extends Pixi.Container, OptionsType extends ContainerProps<InstanceType>>(instance: InstanceType, props: OptionsType, defer?: boolean) => void;
44
- export declare const createContainerComponent: <InstanceType extends Pixi.Container, OptionsType extends object>(PixiClass: new (props: OptionsType) => InstanceType) => (props: Omit<OptionsType, "children"> & ContainerProps<InstanceType>) => InstanceType & JSX.Element;
34
+ export declare const createContainerComponent: <InstanceType extends Pixi.Container, OptionsType extends object>(PixiClass: new (props: OptionsType) => InstanceType) => ((props: Omit<OptionsType, "children"> & ContainerProps<InstanceType>) => InstanceType & JSX.Element);
45
35
  export declare const createLeafComponent: <InstanceType extends Pixi.Container, OptionsType extends object>(PixiClass: new (props: OptionsType) => InstanceType) => (props: Omit<OptionsType, "children"> & LeafProps<InstanceType>) => InstanceType & JSX.Element;
46
36
  export declare const createFilterComponent: <InstanceType extends Pixi.Filter, OptionsType extends object>(PixiClass: new (props: OptionsType) => InstanceType) => (props: OptionsType & FilterProps<InstanceType>) => InstanceType & JSX.Element;
@@ -2,15 +2,15 @@ import type * as Pixi from "pixi.js";
2
2
  /**
3
3
  * A SolidJS component that renders a `PIXI.AnimatedSprite`.
4
4
  */
5
- export declare const AnimatedSprite: (props: Omit<Pixi.AnimatedSpriteOptions, "children"> & import("./component-creation").LeafProps<Pixi.AnimatedSprite>) => Pixi.AnimatedSprite & import("solid-js").JSX.Element;
5
+ export declare const AnimatedSprite: (props: Omit<Pixi.AnimatedSpriteOptions, "children"> & import("./component-factories").LeafProps<Pixi.AnimatedSprite>) => Pixi.AnimatedSprite & import("solid-js").JSX.Element;
6
6
  /**
7
7
  * A SolidJS component that renders a `PIXI.BitmapText`.
8
8
  */
9
- export declare const BitmapText: (props: Omit<Pixi.TextOptions<Pixi.TextStyle, Pixi.TextStyleOptions>, "children"> & import("./component-creation").LeafProps<Pixi.BitmapText>) => Pixi.BitmapText & import("solid-js").JSX.Element;
9
+ export declare const BitmapText: (props: Omit<Pixi.TextOptions<Pixi.TextStyle, Pixi.TextStyleOptions>, "children"> & import("./component-factories").LeafProps<Pixi.BitmapText>) => Pixi.BitmapText & import("solid-js").JSX.Element;
10
10
  /**
11
11
  * A SolidJS component that renders a `PIXI.Container`.
12
12
  */
13
- export declare const Container: (props: Omit<Pixi.ContainerOptions<Pixi.ContainerChild>, "children"> & import("./event-names").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY" | "anchorX" | "anchorY" | "tilePositionX" | "tilePositionY" | "tileScaleX" | "tileScaleY", number>> & {
13
+ export declare const Container: (props: Omit<Pixi.ContainerOptions<Pixi.ContainerChild>, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY" | "anchorX" | "anchorY" | "tilePositionX" | "tilePositionY" | "tileScaleX" | "tileScaleY", number>> & {
14
14
  ref?: import("solid-js").Ref<Pixi.Container<Pixi.ContainerChild>> | undefined;
15
15
  as?: Pixi.Container<Pixi.ContainerChild> | undefined;
16
16
  children?: import("solid-js").JSX.Element;
@@ -19,37 +19,37 @@ export declare const Container: (props: Omit<Pixi.ContainerOptions<Pixi.Containe
19
19
  * A SolidJS component that renders a `PIXI.Graphics`.
20
20
  * Use a ref to access the underlying graphics instance and draw with it.
21
21
  */
22
- export declare const Graphics: (props: Omit<Pixi.GraphicsOptions, "children"> & import("./component-creation").LeafProps<Pixi.Graphics>) => Pixi.Graphics & import("solid-js").JSX.Element;
22
+ export declare const Graphics: (props: Omit<Pixi.GraphicsOptions, "children"> & import("./component-factories").LeafProps<Pixi.Graphics>) => Pixi.Graphics & import("solid-js").JSX.Element;
23
23
  /**
24
24
  * A SolidJS component that renders a `PIXI.HTMLText`.
25
25
  */
26
- export declare const HTMLText: (props: Omit<Pixi.HTMLTextOptions, "children"> & import("./component-creation").LeafProps<Pixi.HTMLText>) => Pixi.HTMLText & import("solid-js").JSX.Element;
26
+ export declare const HTMLText: (props: Omit<Pixi.HTMLTextOptions, "children"> & import("./component-factories").LeafProps<Pixi.HTMLText>) => Pixi.HTMLText & import("solid-js").JSX.Element;
27
27
  /**
28
28
  * A SolidJS component that renders a `PIXI.MeshPlane`.
29
29
  */
30
- export declare const MeshPlane: (props: Omit<Pixi.MeshPlaneOptions, "children"> & import("./component-creation").LeafProps<Pixi.MeshPlane>) => Pixi.MeshPlane & import("solid-js").JSX.Element;
30
+ export declare const MeshPlane: (props: Omit<Pixi.MeshPlaneOptions, "children"> & import("./component-factories").LeafProps<Pixi.MeshPlane>) => Pixi.MeshPlane & import("solid-js").JSX.Element;
31
31
  /**
32
32
  * A SolidJS component that renders a `PIXI.MeshRope`.
33
33
  */
34
- export declare const MeshRope: (props: Omit<Pixi.MeshRopeOptions, "children"> & import("./component-creation").LeafProps<Pixi.MeshRope>) => Pixi.MeshRope & import("solid-js").JSX.Element;
34
+ export declare const MeshRope: (props: Omit<Pixi.MeshRopeOptions, "children"> & import("./component-factories").LeafProps<Pixi.MeshRope>) => Pixi.MeshRope & import("solid-js").JSX.Element;
35
35
  /**
36
36
  * A SolidJS component that renders a `PIXI.NineSliceSprite`.
37
37
  */
38
- export declare const NineSliceSprite: (props: Omit<Pixi.NineSliceSpriteOptions, "children"> & import("./component-creation").LeafProps<Pixi.NineSliceSprite>) => Pixi.NineSliceSprite & import("solid-js").JSX.Element;
38
+ export declare const NineSliceSprite: (props: Omit<Pixi.NineSliceSpriteOptions, "children"> & import("./component-factories").LeafProps<Pixi.NineSliceSprite>) => Pixi.NineSliceSprite & import("solid-js").JSX.Element;
39
39
  /**
40
40
  * A SolidJS component that renders a `PIXI.ParticleContainer`.
41
41
  *
42
42
  * Particles should be added and removed from this component imperatively. Please see the docs for a reference example.
43
43
  */
44
- export declare const ParticleContainer: (props: Omit<Pixi.ParticleContainerOptions, "children"> & import("./component-creation").LeafProps<Pixi.ParticleContainer>) => Pixi.ParticleContainer & import("solid-js").JSX.Element;
44
+ export declare const ParticleContainer: (props: Omit<Pixi.ParticleContainerOptions, "children"> & import("./component-factories").LeafProps<Pixi.ParticleContainer>) => Pixi.ParticleContainer & import("solid-js").JSX.Element;
45
45
  /**
46
46
  * A SolidJS component that renders a `PIXI.PerspectiveMesh`.
47
47
  */
48
- export declare const PerspectiveMesh: (props: Omit<Pixi.PerspectivePlaneOptions, "children"> & import("./component-creation").LeafProps<Pixi.PerspectiveMesh>) => Pixi.PerspectiveMesh & import("solid-js").JSX.Element;
48
+ export declare const PerspectiveMesh: (props: Omit<Pixi.PerspectivePlaneOptions, "children"> & import("./component-factories").LeafProps<Pixi.PerspectiveMesh>) => Pixi.PerspectiveMesh & import("solid-js").JSX.Element;
49
49
  /**
50
50
  * A SolidJS component that renders a `PIXI.RenderContainer`.
51
51
  */
52
- export declare const RenderContainer: (props: Omit<Pixi.RenderContainerOptions, "children"> & import("./event-names").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY" | "anchorX" | "anchorY" | "tilePositionX" | "tilePositionY" | "tileScaleX" | "tileScaleY", number>> & {
52
+ export declare const RenderContainer: (props: Omit<Pixi.RenderContainerOptions, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY" | "anchorX" | "anchorY" | "tilePositionX" | "tilePositionY" | "tileScaleX" | "tileScaleY", number>> & {
53
53
  ref?: import("solid-js").Ref<Pixi.RenderContainer> | undefined;
54
54
  as?: Pixi.RenderContainer | undefined;
55
55
  children?: import("solid-js").JSX.Element;
@@ -57,7 +57,7 @@ export declare const RenderContainer: (props: Omit<Pixi.RenderContainerOptions,
57
57
  /**
58
58
  * A SolidJS component that renders a `PIXI.RenderLayer`.
59
59
  */
60
- export declare const RenderLayer: (props: Omit<Pixi.RenderLayerOptions, "children"> & import("./event-names").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY" | "anchorX" | "anchorY" | "tilePositionX" | "tilePositionY" | "tileScaleX" | "tileScaleY", number>> & {
60
+ export declare const RenderLayer: (props: Omit<Pixi.RenderLayerOptions, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY" | "anchorX" | "anchorY" | "tilePositionX" | "tilePositionY" | "tileScaleX" | "tileScaleY", number>> & {
61
61
  ref?: import("solid-js").Ref<Pixi.RenderLayer> | undefined;
62
62
  as?: Pixi.RenderLayer | undefined;
63
63
  children?: import("solid-js").JSX.Element;
@@ -65,12 +65,12 @@ export declare const RenderLayer: (props: Omit<Pixi.RenderLayerOptions, "childre
65
65
  /**
66
66
  * A SolidJS component that renders a `PIXI.Sprite`.
67
67
  */
68
- export declare const Sprite: (props: Omit<Pixi.SpriteOptions, "children"> & import("./component-creation").LeafProps<Pixi.Sprite>) => Pixi.Sprite & import("solid-js").JSX.Element;
68
+ export declare const Sprite: (props: Omit<Pixi.SpriteOptions, "children"> & import("./component-factories").LeafProps<Pixi.Sprite>) => Pixi.Sprite & import("solid-js").JSX.Element;
69
69
  /**
70
70
  * A SolidJS component that renders a `PIXI.Text`.
71
71
  */
72
- export declare const Text: (props: Omit<Pixi.CanvasTextOptions, "children"> & import("./component-creation").LeafProps<Pixi.Text>) => Pixi.Text & import("solid-js").JSX.Element;
72
+ export declare const Text: (props: Omit<Pixi.CanvasTextOptions, "children"> & import("./component-factories").LeafProps<Pixi.Text>) => Pixi.Text & import("solid-js").JSX.Element;
73
73
  /**
74
74
  * A SolidJS component that renders a `PIXI.TilingSprite`.
75
75
  */
76
- export declare const TilingSprite: (props: Omit<Pixi.TilingSpriteOptions, "children"> & import("./component-creation").LeafProps<Pixi.TilingSprite>) => Pixi.TilingSprite & import("solid-js").JSX.Element;
76
+ export declare const TilingSprite: (props: Omit<Pixi.TilingSpriteOptions, "children"> & import("./component-factories").LeafProps<Pixi.TilingSprite>) => Pixi.TilingSprite & import("solid-js").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, NineSliceSprite, ParticleContainer, PerspectiveMesh, Sprite, Text, RenderContainer, RenderLayer, TilingSprite, } from "./components";
2
+ export { PIXI_EVENT_NAMES, PIXI_SOLID_EVENT_HANDLER_NAMES } from "./bind-props";
3
+ export type { PixiEventHandlerMap, PointAxisPropName } from "./bind-props";
4
+ export type { ContainerProps, LeafProps, PixiComponentProps } from "./component-factories";
@@ -1,14 +1,14 @@
1
- export type { ContainerProps, LeafProps, PixiComponentProps } from "./component-creation";
2
- export { createAsyncDelay, delay } from "./delay";
3
- export type { PixiEventHandlerMap } from "./event-names";
4
- export { PIXI_EVENT_NAMES, PIXI_SOLID_EVENT_HANDLER_NAMES } from "./event-names";
1
+ export type { ContainerProps, LeafProps, PixiComponentProps } from "./components";
2
+ export type { PixiEventHandlerMap } from "./components";
3
+ export { PIXI_EVENT_NAMES, PIXI_SOLID_EVENT_HANDLER_NAMES } from "./components";
5
4
  export { onResize } from "./on-resize";
6
5
  export { onTick } from "./on-tick";
7
6
  export type { PixiApplicationProps } from "./pixi-application";
8
- export { getPixiApp, getTicker, PixiApplicationProvider, TickerProvider, } from "./pixi-application";
7
+ export { getPixiApp, getTicker, PixiApplicationProvider, TickerProvider } from "./pixi-application";
8
+ export { createAsyncDelay, delay } from "./delay";
9
9
  export type { PixiCanvasProps } from "./pixi-canvas";
10
10
  export { PixiCanvas } from "./pixi-canvas";
11
- export { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, NineSliceSprite, ParticleContainer, PerspectiveMesh, RenderContainer, RenderLayer, Sprite, Text, TilingSprite, } from "./pixi-components";
12
- export type { PointAxisPropName } from "./point-property-names";
11
+ export { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, NineSliceSprite, ParticleContainer, PerspectiveMesh, RenderContainer, RenderLayer, Sprite, Text, TilingSprite, } from "./components/components";
12
+ export type { PointAxisPropName } from "./components";
13
13
  export { usePixiScreen } from "./use-pixi-screen";
14
- export type { PixiScreenDimensions } from "./use-pixi-screen/pixi-screen-store";
14
+ export type { PixiScreenDimensions } from "./use-pixi-screen";
package/package.json CHANGED
@@ -1,32 +1,32 @@
1
1
  {
2
2
  "name": "pixi-solid",
3
+ "version": "0.1.2",
3
4
  "private": false,
4
- "version": "0.1.0",
5
5
  "description": "A library to write PixiJS applications with SolidJS",
6
- "author": "Luke Thompson",
7
- "license": "MIT",
8
6
  "homepage": "https://lukecarlthompson.github.io/pixi-solid/",
7
+ "license": "MIT",
8
+ "author": "Luke Thompson",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "https://github.com/LukeCarlThompson/pixi-solid"
12
12
  },
13
+ "files": [
14
+ "dist",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
13
18
  "type": "module",
14
19
  "sideEffects": false,
15
20
  "exports": {
16
21
  ".": {
17
- "import": "./dist/index.js",
18
- "types": "./dist/types/index.d.ts"
22
+ "types": "./dist/types/index.d.ts",
23
+ "import": "./dist/index.js"
19
24
  },
20
25
  "./utils": {
21
- "import": "./dist/utils/index.js",
22
- "types": "./dist/types/utils/index.d.ts"
26
+ "types": "./dist/types/utils/index.d.ts",
27
+ "import": "./dist/utils/index.js"
23
28
  }
24
29
  },
25
- "files": [
26
- "dist",
27
- "README.md",
28
- "LICENSE"
29
- ],
30
30
  "peerDependencies": {
31
31
  "pixi.js": "^8.14.3",
32
32
  "solid-js": "^1.9.10"
@@ -37,6 +37,6 @@
37
37
  "build": "vite build && tsc --project tsconfig.build.json --emitDeclarationOnly",
38
38
  "preview": "vite preview",
39
39
  "preinstall": "npx only-allow pnpm",
40
- "test": "echo \"A dummy test\""
40
+ "test": "vitest"
41
41
  }
42
42
  }
@@ -1,57 +0,0 @@
1
- import { splitProps, createRenderEffect, on } from "solid-js";
2
- import { PIXI_SOLID_EVENT_HANDLER_NAMES } from "./event-names.js";
3
- import { POINT_PROP_AXIS_NAMES } from "./point-property-names.js";
4
- import { insert, setProp } from "./renderer.js";
5
- const SOLID_PROP_KEYS = ["ref", "as", "children"];
6
- const applyProps = (instance, props, defer) => {
7
- for (const key in props) {
8
- if (key === "as") continue;
9
- if (key === "ref") {
10
- props[key](instance);
11
- } else if (key === "children") {
12
- if (!("addChild" in instance)) {
13
- throw new Error(`Cannot set children on non-container instance.`);
14
- }
15
- insert(instance, () => props.children);
16
- } else if (defer) {
17
- createRenderEffect(
18
- on(
19
- () => props[key],
20
- () => {
21
- setProp(instance, key, props[key]);
22
- },
23
- { defer }
24
- )
25
- );
26
- } else {
27
- createRenderEffect(() => {
28
- setProp(instance, key, props[key]);
29
- });
30
- }
31
- }
32
- };
33
- const createContainerComponent = (PixiClass) => {
34
- return (props) => {
35
- const [runtimeProps, initialisationProps] = splitProps(props, [
36
- ...SOLID_PROP_KEYS,
37
- ...PIXI_SOLID_EVENT_HANDLER_NAMES,
38
- ...POINT_PROP_AXIS_NAMES
39
- ]);
40
- const instance = props.as || new PixiClass(initialisationProps);
41
- applyProps(instance, initialisationProps, true);
42
- applyProps(instance, runtimeProps);
43
- return instance;
44
- };
45
- };
46
- const createLeafComponent = (PixiClass) => {
47
- return (props) => {
48
- return createContainerComponent(PixiClass)(props);
49
- };
50
- };
51
- export {
52
- SOLID_PROP_KEYS,
53
- applyProps,
54
- createContainerComponent,
55
- createLeafComponent
56
- };
57
- //# sourceMappingURL=component-creation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component-creation.js","sources":["../src/component-creation.ts"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport type { JSX, Ref } from \"solid-js\";\nimport { createRenderEffect, on, splitProps } from \"solid-js\";\nimport type { PixiEventHandlerMap } from \"./event-names\";\nimport { PIXI_SOLID_EVENT_HANDLER_NAMES } from \"./event-names\";\nimport type { PointAxisPropName } from \"./point-property-names\";\nimport { POINT_PROP_AXIS_NAMES } from \"./point-property-names\";\nimport { insert, setProp } from \"./renderer\";\n\n/**\n * This is a utility type useful for extending the props of custom components to allow props to be passed through to the underlying Pixi instance.\n *\n * If you don't require them all it's recommended to narrow the type by using Pick or Omit the props to only allow the ones you need.\n *\n * @example PixiComponentProps<Pixi.SpriteOptions>.\n */\nexport type PixiComponentProps<\n ComponentOptions extends Pixi.ContainerOptions = Pixi.ContainerOptions,\n> = PixiEventHandlerMap & PointAxisProps & Omit<ComponentOptions, \"children\">;\n\n/**\n * Prop definition for components that CAN have children\n */\nexport type ContainerProps<Component> = PixiEventHandlerMap &\n PointAxisProps & {\n ref?: Ref<Component>;\n as?: Component;\n children?: JSX.Element;\n };\n\nexport type PointAxisProps = Partial<Record<PointAxisPropName, number>>;\n\n/**\n * Prop definition for components that CANNOT have children\n */\nexport type LeafProps<Component> = Omit<ContainerProps<Component>, \"children\">;\n\n/**\n * Prop definition for filter components\n */\nexport type FilterProps<Component> = {\n ref?: Ref<Component>;\n as?: Component;\n};\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 = <\n InstanceType extends Pixi.Container,\n OptionsType extends ContainerProps<InstanceType>,\n>(\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 (props[key] as unknown as (arg: any) => void)(instance);\n } else if (key === \"children\") {\n if (!(\"addChild\" in instance)) {\n throw new Error(`Cannot set children on non-container instance.`);\n }\n insert(instance, () => props.children);\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\nexport const createContainerComponent = <\n InstanceType extends Pixi.Container,\n OptionsType extends object,\n>(\n PixiClass: new (props: OptionsType) => InstanceType,\n) => {\n return (\n props: Omit<OptionsType, \"children\"> & ContainerProps<InstanceType>,\n ): InstanceType & JSX.Element => {\n const [runtimeProps, initialisationProps] = splitProps(props, [\n ...SOLID_PROP_KEYS,\n ...PIXI_SOLID_EVENT_HANDLER_NAMES,\n ...POINT_PROP_AXIS_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\nexport const createLeafComponent = <\n InstanceType extends Pixi.Container,\n OptionsType extends object,\n>(\n PixiClass: new (props: OptionsType) => InstanceType,\n) => {\n return (\n props: Omit<OptionsType, \"children\"> & LeafProps<InstanceType>,\n ): InstanceType & JSX.Element => {\n return createContainerComponent<InstanceType, OptionsType>(PixiClass)(props);\n };\n};\n\nexport const createFilterComponent = <InstanceType extends Pixi.Filter, OptionsType extends object>(\n PixiClass: new (props: OptionsType) => InstanceType,\n) => {\n return (props: OptionsType & FilterProps<InstanceType>): InstanceType & JSX.Element => {\n const [runtimeProps, initialisationProps] = splitProps(props, [\"ref\", \"as\"]);\n\n const instance = props.as || new PixiClass(initialisationProps as any);\n\n for (const key in initialisationProps) {\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 throw new Error(`Cannot set children on non-container instance.`);\n } else {\n createRenderEffect(\n on(\n () => props[key as keyof typeof initialisationProps],\n () => {\n (instance as any)[key] = initialisationProps[key];\n },\n { defer: true },\n ),\n );\n }\n }\n\n for (const key in runtimeProps) {\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 }\n }\n\n return instance as InstanceType & JSX.Element;\n };\n};\n"],"names":[],"mappings":";;;;AA8CO,MAAM,kBAAkB,CAAC,OAAO,MAAM,UAAU;AAWhD,MAAM,aAAa,CAIxB,UACA,OACA,UACG;AACH,aAAW,OAAO,OAAO;AACvB,QAAI,QAAQ,KAAM;AAElB,QAAI,QAAQ,OAAO;AAChB,YAAM,GAAG,EAAoC,QAAQ;AAAA,IACxD,WAAW,QAAQ,YAAY;AAC7B,UAAI,EAAE,cAAc,WAAW;AAC7B,cAAM,IAAI,MAAM,gDAAgD;AAAA,MAClE;AACA,aAAO,UAAU,MAAM,MAAM,QAAQ;AAAA,IACvC,WAAW,OAAO;AAChB;AAAA,QACE;AAAA,UACE,MAAM,MAAM,GAAyB;AAAA,UACrC,MAAM;AACJ,oBAAQ,UAAU,KAAK,MAAM,GAAyB,CAAC;AAAA,UACzD;AAAA,UACA,EAAE,MAAA;AAAA,QAAM;AAAA,MACV;AAAA,IAEJ,OAAO;AACL,yBAAmB,MAAM;AACvB,gBAAQ,UAAU,KAAK,MAAM,GAAyB,CAAC;AAAA,MACzD,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,MAAM,2BAA2B,CAItC,cACG;AACH,SAAO,CACL,UAC+B;AAC/B,UAAM,CAAC,cAAc,mBAAmB,IAAI,WAAW,OAAO;AAAA,MAC5D,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,IAAA,CACJ;AAED,UAAM,WAAW,MAAM,MAAM,IAAI,UAAU,mBAA0B;AAErE,eAAW,UAAU,qBAAqB,IAAI;AAC9C,eAAW,UAAU,YAAY;AAEjC,WAAO;AAAA,EACT;AACF;AAEO,MAAM,sBAAsB,CAIjC,cACG;AACH,SAAO,CACL,UAC+B;AAC/B,WAAO,yBAAoD,SAAS,EAAE,KAAK;AAAA,EAC7E;AACF;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-names.js","sources":["../src/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 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: Set<string> = new Set(PIXI_SOLID_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"],"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;AAQO,MAAM,8BAA2C,IAAI,IAAI,8BAA8B;"}
@@ -1 +0,0 @@
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 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 { createContainerComponent, createLeafComponent } from \"./component-creation\";\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, Pixi.TextOptions>(PixiBitmapText);\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.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":["AnimatedSprite","createLeafComponent","PixiAnimatedSprite","BitmapText","PixiBitmapText","Container","createContainerComponent","PixiContainer","Graphics","PixiGraphics","HTMLText","PixiHTMLText","MeshPlane","PixiMeshPlane","MeshRope","PixiMeshRope","NineSliceSprite","PixiNineSliceSprite","ParticleContainer","PixiParticleContainer","PerspectiveMesh","PixiPerspectiveMesh","RenderContainer","PixiRenderContainer","RenderLayer","PixiRenderLayer","Sprite","PixiSprite","Text","PixiText","TilingSprite","PixiTilingSprite"],"mappings":";;AAuBO,MAAMA,iBAAiBC,oBAAoEC,gBAAkB;AAI7G,MAAMC,aAAaF,oBAAsDG,YAAc;AAIvF,MAAMC,YAAYC,yBAA+DC,WAAa;AAK9F,MAAMC,WAAWP,oBAAwDQ,UAAY;AAIrF,MAAMC,WAAWT,oBAAwDU,UAAY;AAKrF,MAAMC,YAAYX,oBAA0DY,WAAa;AAKzF,MAAMC,WAAWb,oBAAwDc,UAAY;AAKrF,MAAMC,kBAAkBf,oBAC7BgB,iBACF;AAOO,MAAMC,oBAAoBjB,oBAC/BkB,mBACF;AAKO,MAAMC,kBAAkBnB,oBAC7BoB,iBACF;AAKO,MAAMC,kBAAkBhB,yBAC7BiB,iBACF;AAKO,MAAMC,cAAclB,yBAAmEmB,aAAe;AAKtG,MAAMC,SAASzB,oBAAoD0B,QAAU;AAI7E,MAAMC,OAAO3B,oBAAsD4B,MAAQ;AAK3E,MAAMC,eAAe7B,oBAAgE8B,cAAgB;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"point-property-names.js","sources":["../src/point-property-names.ts"],"sourcesContent":["const POINT_PROP_NAMES = [\n \"position\",\n \"scale\",\n \"pivot\",\n \"skew\",\n \"anchor\",\n \"tilePosition\",\n \"tileScale\",\n] as const;\n\nexport const POINT_PROP_NAMES_SET: Set<string> = new Set(POINT_PROP_NAMES);\n\nexport const POINT_PROP_AXIS_NAMES = [\n \"positionX\",\n \"positionY\",\n \"scaleX\",\n \"scaleY\",\n \"pivotX\",\n \"pivotY\",\n \"skewX\",\n \"skewY\",\n \"anchorX\",\n \"anchorY\",\n \"tilePositionX\",\n \"tilePositionY\",\n \"tileScaleX\",\n \"tileScaleY\",\n] as const;\n\nexport type PointAxisPropName = (typeof POINT_PROP_AXIS_NAMES)[number];\n\nexport const POINT_PROP_AXIS_NAMES_SET: Set<string> = new Set(POINT_PROP_AXIS_NAMES);\n\nexport const ALL_VALID_PROP_NAMES_SET: Set<string> = new Set([\n ...POINT_PROP_NAMES_SET,\n ...POINT_PROP_AXIS_NAMES_SET,\n]);\n"],"names":[],"mappings":"AAAA,MAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,uBAAoC,IAAI,IAAI,gBAAgB;AAElE,MAAM,wBAAwB;AAAA,EACnC;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;AAIO,MAAM,4BAAyC,IAAI,IAAI,qBAAqB;AAE5E,MAAM,+CAA4C,IAAI;AAAA,EAC3D,GAAG;AAAA,EACH,GAAG;AACL,CAAC;"}
package/dist/renderer.js DELETED
@@ -1,96 +0,0 @@
1
- import { Text } from "pixi.js";
2
- import { createRenderer } from "solid-js/universal";
3
- import { isEventProperty, setEventProperty } from "./set-event-property.js";
4
- import { isPointProperty, setPointProperty } from "./set-point-property.js";
5
- const {
6
- effect,
7
- memo,
8
- createComponent,
9
- createElement,
10
- createTextNode,
11
- insertNode,
12
- insert,
13
- setProp,
14
- mergeProps,
15
- use,
16
- render,
17
- spread
18
- } = createRenderer({
19
- createElement(name) {
20
- throw new Error(`Cannot create element "${name}". Please import components directly from 'pixi-solid' and use them with a capital letter.`);
21
- },
22
- createTextNode(value) {
23
- return new Text({
24
- text: value
25
- });
26
- },
27
- replaceText(textNode, value) {
28
- textNode.text = value;
29
- },
30
- setProperty(node, name, value, prev) {
31
- if (isPointProperty(name)) {
32
- setPointProperty(node, name, value);
33
- return;
34
- }
35
- if (name in node) {
36
- node[name] = value;
37
- return;
38
- }
39
- if (isEventProperty(name)) {
40
- setEventProperty(node, name, value, prev);
41
- }
42
- },
43
- insertNode(parent, node, anchor) {
44
- if ("attach" in parent && typeof parent.attach === "function") {
45
- parent.attach(node);
46
- return;
47
- }
48
- if (!("addChildAt" in parent) || !("addChild" in parent) || typeof parent.addChild !== "function") {
49
- throw new Error("Parent does not support children.");
50
- }
51
- if (anchor) {
52
- parent.addChildAt(node, parent.children.indexOf(anchor));
53
- } else {
54
- parent.addChild(node);
55
- }
56
- },
57
- isTextNode(node) {
58
- return node instanceof Text;
59
- },
60
- removeNode(parent, node) {
61
- if ("detach" in parent && typeof parent.detach === "function") {
62
- parent.detach(node);
63
- return;
64
- }
65
- node.removeFromParent();
66
- node.destroy({
67
- children: true
68
- });
69
- },
70
- getParentNode(node) {
71
- return node?.parent ?? void 0;
72
- },
73
- getFirstChild(node) {
74
- return node.children?.[0];
75
- },
76
- getNextSibling(node) {
77
- if (!node.parent) return void 0;
78
- const index = node.parent.children.indexOf(node);
79
- return index > -1 ? node.parent.children[index + 1] : void 0;
80
- }
81
- });
82
- export {
83
- createComponent,
84
- createElement,
85
- createTextNode,
86
- effect,
87
- insert,
88
- insertNode,
89
- memo,
90
- mergeProps,
91
- render,
92
- setProp,
93
- spread,
94
- use
95
- };
96
- //# sourceMappingURL=renderer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderer.js","sources":["../src/renderer.tsx"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport { Text as PixiText } from \"pixi.js\";\nimport { createRenderer } from \"solid-js/universal\";\nimport { isEventProperty, setEventProperty } from \"./set-event-property\";\nimport { isPointProperty, setPointProperty } from \"./set-point-property\";\n\nexport const {\n effect,\n memo,\n createComponent,\n createElement,\n createTextNode,\n insertNode,\n insert,\n setProp,\n mergeProps,\n use,\n render,\n spread,\n} = createRenderer<Pixi.Container>({\n createElement(name: string) {\n // This function is for lowercase string tags like `<container />`.\n // To support tree-shaking, we require users to import components\n // directly and use them with an uppercase name like `<Container />`,\n // which does not call this function.\n throw new Error(\n `Cannot create element \"${name}\". Please import components directly from 'pixi-solid' and use them with a capital letter.`,\n );\n },\n createTextNode(value) {\n return new PixiText({ text: value });\n },\n replaceText(textNode: PixiText, value) {\n textNode.text = value;\n },\n setProperty(node, name, value, prev) {\n if (isPointProperty(name)) {\n setPointProperty(node, name, value);\n return;\n }\n\n if (name in node) {\n (node as any)[name] = value;\n return;\n }\n\n if (isEventProperty(name)) {\n setEventProperty(node, name, value, prev);\n }\n },\n insertNode(parent, node, anchor) {\n // RenderLayer uses `attach` instead of `addChild`.\n if (\"attach\" in parent && typeof parent.attach === \"function\") {\n parent.attach(node);\n // Note: `attach` does not support anchoring, so we ignore the anchor.\n return;\n }\n\n if (!(\"addChildAt\" in parent) || !(\"addChild\" in parent) || typeof parent.addChild !== \"function\") {\n throw new Error(\"Parent does not support children.\");\n }\n\n if (anchor) {\n parent.addChildAt(node, parent.children.indexOf(anchor));\n } else {\n parent.addChild(node);\n }\n },\n isTextNode(node) {\n return node instanceof PixiText;\n },\n removeNode(parent, node) {\n // RenderLayer uses `detach` instead of `removeChild`.\n if (\"detach\" in parent && typeof parent.detach === \"function\") {\n parent.detach(node);\n return;\n }\n\n node.removeFromParent();\n node.destroy({ children: true });\n },\n getParentNode(node) {\n return node?.parent ?? undefined;\n },\n getFirstChild(node) {\n return node.children?.[0];\n },\n getNextSibling(node) {\n if (!node.parent) return undefined;\n const index = node.parent.children.indexOf(node);\n // Return the next child if it exists, otherwise undefined.\n return index > -1 ? node.parent.children[index + 1] : undefined;\n },\n});\n"],"names":["effect","memo","createComponent","createElement","createTextNode","insertNode","insert","setProp","mergeProps","use","render","spread","createRenderer","name","Error","value","PixiText","text","replaceText","textNode","setProperty","node","prev","isPointProperty","setPointProperty","isEventProperty","setEventProperty","parent","anchor","attach","addChild","addChildAt","children","indexOf","isTextNode","removeNode","detach","removeFromParent","destroy","getParentNode","undefined","getFirstChild","getNextSibling","index"],"mappings":";;;;AAMO,MAAM;AAAA,EACXA;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AACF,IAAIC,eAA+B;AAAA,EACjCT,cAAcU,MAAc;AAK1B,UAAM,IAAIC,MACR,0BAA0BD,IAAI,4FAChC;AAAA,EACF;AAAA,EACAT,eAAeW,OAAO;AACpB,WAAO,IAAIC,KAAS;AAAA,MAAEC,MAAMF;AAAAA,IAAAA,CAAO;AAAA,EACrC;AAAA,EACAG,YAAYC,UAAoBJ,OAAO;AACrCI,aAASF,OAAOF;AAAAA,EAClB;AAAA,EACAK,YAAYC,MAAMR,MAAME,OAAOO,MAAM;AACnC,QAAIC,gBAAgBV,IAAI,GAAG;AACzBW,uBAAiBH,MAAMR,MAAME,KAAK;AAClC;AAAA,IACF;AAEA,QAAIF,QAAQQ,MAAM;AACfA,WAAaR,IAAI,IAAIE;AACtB;AAAA,IACF;AAEA,QAAIU,gBAAgBZ,IAAI,GAAG;AACzBa,uBAAiBL,MAAMR,MAAME,OAAOO,IAAI;AAAA,IAC1C;AAAA,EACF;AAAA,EACAjB,WAAWsB,QAAQN,MAAMO,QAAQ;AAE/B,QAAI,YAAYD,UAAU,OAAOA,OAAOE,WAAW,YAAY;AAC7DF,aAAOE,OAAOR,IAAI;AAElB;AAAA,IACF;AAEA,QAAI,EAAE,gBAAgBM,WAAW,EAAE,cAAcA,WAAW,OAAOA,OAAOG,aAAa,YAAY;AACjG,YAAM,IAAIhB,MAAM,mCAAmC;AAAA,IACrD;AAEA,QAAIc,QAAQ;AACVD,aAAOI,WAAWV,MAAMM,OAAOK,SAASC,QAAQL,MAAM,CAAC;AAAA,IACzD,OAAO;AACLD,aAAOG,SAAST,IAAI;AAAA,IACtB;AAAA,EACF;AAAA,EACAa,WAAWb,MAAM;AACf,WAAOA,gBAAgBL;AAAAA,EACzB;AAAA,EACAmB,WAAWR,QAAQN,MAAM;AAEvB,QAAI,YAAYM,UAAU,OAAOA,OAAOS,WAAW,YAAY;AAC7DT,aAAOS,OAAOf,IAAI;AAClB;AAAA,IACF;AAEAA,SAAKgB,iBAAAA;AACLhB,SAAKiB,QAAQ;AAAA,MAAEN,UAAU;AAAA,IAAA,CAAM;AAAA,EACjC;AAAA,EACAO,cAAclB,MAAM;AAClB,WAAOA,MAAMM,UAAUa;AAAAA,EACzB;AAAA,EACAC,cAAcpB,MAAM;AAClB,WAAOA,KAAKW,WAAW,CAAC;AAAA,EAC1B;AAAA,EACAU,eAAerB,MAAM;AACnB,QAAI,CAACA,KAAKM,OAAQ,QAAOa;AACzB,UAAMG,QAAQtB,KAAKM,OAAOK,SAASC,QAAQZ,IAAI;AAE/C,WAAOsB,QAAQ,KAAKtB,KAAKM,OAAOK,SAASW,QAAQ,CAAC,IAAIH;AAAAA,EACxD;AACF,CAAC;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"set-event-property.js","sources":["../src/set-event-property.ts"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport type { PIXI_EVENT_NAMES } from \"./event-names\";\nimport { PIXI_EVENT_HANDLER_NAME_SET } from \"./event-names\";\n\nexport const isEventProperty = (name: string): boolean => PIXI_EVENT_HANDLER_NAME_SET.has(name);\n\nexport const setEventProperty = (\n node: Pixi.Container,\n name: string,\n eventHandler: any,\n prevEventHandler?: any,\n): void => {\n // Remove the 'on' prefix to get the actual event name.\n const eventName = name.slice(2) as (typeof PIXI_EVENT_NAMES)[number];\n\n if (prevEventHandler) {\n node.removeEventListener(eventName, prevEventHandler);\n }\n node.addEventListener(eventName, eventHandler);\n};\n"],"names":[],"mappings":";AAIO,MAAM,kBAAkB,CAAC,SAA0B,4BAA4B,IAAI,IAAI;AAEvF,MAAM,mBAAmB,CAC9B,MACA,MACA,cACA,qBACS;AAET,QAAM,YAAY,KAAK,MAAM,CAAC;AAE9B,MAAI,kBAAkB;AACpB,SAAK,oBAAoB,WAAW,gBAAgB;AAAA,EACtD;AACA,OAAK,iBAAiB,WAAW,YAAY;AAC/C;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"set-point-property.js","sources":["../src/set-point-property.ts"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport {\n ALL_VALID_PROP_NAMES_SET,\n POINT_PROP_AXIS_NAMES_SET,\n POINT_PROP_NAMES_SET,\n} from \"./point-property-names\";\n\nexport const isPointProperty = (propName: string): boolean =>\n ALL_VALID_PROP_NAMES_SET.has(propName);\n\nexport const setPointProperty = <T>(node: Pixi.Container, name: string, value: T): void => {\n if (typeof value === \"object\" && value !== null) {\n (node as any)[name].set((value as any).x, (value as any).y);\n return;\n }\n\n if (typeof value === \"number\") {\n if (POINT_PROP_NAMES_SET.has(name)) {\n (node as any)[name].set(value);\n } else if (POINT_PROP_AXIS_NAMES_SET.has(name)) {\n const axisName = name[name.length - 1].toLowerCase();\n const propertyName = name.slice(0, -1);\n (node as any)[propertyName][axisName] = value;\n }\n }\n};\n"],"names":[],"mappings":";AAOO,MAAM,kBAAkB,CAAC,aAC9B,yBAAyB,IAAI,QAAQ;AAEhC,MAAM,mBAAmB,CAAI,MAAsB,MAAc,UAAmB;AACzF,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC9C,SAAa,IAAI,EAAE,IAAK,MAAc,GAAI,MAAc,CAAC;AAC1D;AAAA,EACF;AAEA,MAAI,OAAO,UAAU,UAAU;AAC7B,QAAI,qBAAqB,IAAI,IAAI,GAAG;AACjC,WAAa,IAAI,EAAE,IAAI,KAAK;AAAA,IAC/B,WAAW,0BAA0B,IAAI,IAAI,GAAG;AAC9C,YAAM,WAAW,KAAK,KAAK,SAAS,CAAC,EAAE,YAAA;AACvC,YAAM,eAAe,KAAK,MAAM,GAAG,EAAE;AACpC,WAAa,YAAY,EAAE,QAAQ,IAAI;AAAA,IAC1C;AAAA,EACF;AACF;"}
@@ -1,2 +0,0 @@
1
- import type * as Pixi from "pixi.js";
2
- export declare const effect: <T>(fn: (prev?: T) => T, init?: T) => void, memo: <T>(fn: () => T, equal: boolean) => () => T, createComponent: <T>(Comp: (props: T) => Pixi.Container<Pixi.ContainerChild>, props: T) => Pixi.Container<Pixi.ContainerChild>, createElement: (tag: string) => Pixi.Container<Pixi.ContainerChild>, createTextNode: (value: string) => Pixi.Container<Pixi.ContainerChild>, insertNode: (parent: Pixi.Container<Pixi.ContainerChild>, node: Pixi.Container<Pixi.ContainerChild>, anchor?: Pixi.Container<Pixi.ContainerChild> | undefined) => void, insert: <T>(parent: any, accessor: T | (() => T), marker?: any | null, initial?: any) => Pixi.Container<Pixi.ContainerChild>, setProp: <T>(node: Pixi.Container<Pixi.ContainerChild>, name: string, value: T, prev?: T | undefined) => T, mergeProps: (...sources: unknown[]) => unknown, use: <A, T>(fn: (element: Pixi.Container<Pixi.ContainerChild>, arg: A) => T, element: Pixi.Container<Pixi.ContainerChild>, arg: A) => T, render: (code: () => Pixi.Container<Pixi.ContainerChild>, node: Pixi.Container<Pixi.ContainerChild>) => () => void, spread: <T>(node: any, accessor: (() => T) | T, skipChildren?: boolean) => void;