pixi-solid 0.1.13 → 0.1.15

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.
@@ -1,14 +1,13 @@
1
+ const COMMON_POINT_PROP_NAMES = ["position", "scale", "pivot", "skew"];
2
+ const ANCHOR_POINT_PROP_NAMES = ["anchor"];
3
+ const TILING_POINT_PROP_NAMES = ["tilePosition", "tileScale"];
1
4
  const POINT_PROP_NAMES = [
2
- "position",
3
- "scale",
4
- "pivot",
5
- "skew",
6
- "anchor",
7
- "tilePosition",
8
- "tileScale"
5
+ ...COMMON_POINT_PROP_NAMES,
6
+ ...ANCHOR_POINT_PROP_NAMES,
7
+ ...TILING_POINT_PROP_NAMES
9
8
  ];
10
9
  const POINT_PROP_NAMES_SET = new Set(POINT_PROP_NAMES);
11
- const POINT_PROP_AXIS_NAMES = [
10
+ const COMMON_POINT_PROP_AXIS_NAMES = [
12
11
  "positionX",
13
12
  "positionY",
14
13
  "scaleX",
@@ -16,14 +15,20 @@ const POINT_PROP_AXIS_NAMES = [
16
15
  "pivotX",
17
16
  "pivotY",
18
17
  "skewX",
19
- "skewY",
20
- "anchorX",
21
- "anchorY",
18
+ "skewY"
19
+ ];
20
+ const ANCHOR_POINT_PROP_AXIS_NAMES = ["anchorX", "anchorY"];
21
+ const TILING_POINT_PROP_AXIS_NAMES = [
22
22
  "tilePositionX",
23
23
  "tilePositionY",
24
24
  "tileScaleX",
25
25
  "tileScaleY"
26
26
  ];
27
+ const POINT_PROP_AXIS_NAMES = [
28
+ ...COMMON_POINT_PROP_AXIS_NAMES,
29
+ ...ANCHOR_POINT_PROP_AXIS_NAMES,
30
+ ...TILING_POINT_PROP_AXIS_NAMES
31
+ ];
27
32
  const POINT_PROP_AXIS_NAMES_SET = new Set(POINT_PROP_AXIS_NAMES);
28
33
  /* @__PURE__ */ new Set([
29
34
  ...POINT_PROP_NAMES_SET,
@@ -36,10 +41,16 @@ const POINT_PROP_AXIS_MAP = POINT_PROP_AXIS_NAMES.reduce((map, name) => {
36
41
  return map;
37
42
  }, /* @__PURE__ */ new Map());
38
43
  export {
44
+ ANCHOR_POINT_PROP_AXIS_NAMES,
45
+ ANCHOR_POINT_PROP_NAMES,
46
+ COMMON_POINT_PROP_AXIS_NAMES,
47
+ COMMON_POINT_PROP_NAMES,
39
48
  POINT_PROP_AXIS_MAP,
40
49
  POINT_PROP_AXIS_NAMES,
41
50
  POINT_PROP_AXIS_NAMES_SET,
42
51
  POINT_PROP_NAMES,
43
- POINT_PROP_NAMES_SET
52
+ POINT_PROP_NAMES_SET,
53
+ TILING_POINT_PROP_AXIS_NAMES,
54
+ TILING_POINT_PROP_NAMES
44
55
  };
45
56
  //# sourceMappingURL=point-property-names.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"point-property-names.js","sources":["../../../src/components/bind-props/point-property-names.ts"],"sourcesContent":["export const POINT_PROP_NAMES = [\n \"position\",\n \"scale\",\n \"pivot\",\n \"skew\",\n \"anchor\",\n \"tilePosition\",\n \"tileScale\",\n] as const;\n\nexport type PointPropName = (typeof POINT_PROP_NAMES)[number];\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\nexport const POINT_PROP_AXIS_MAP = POINT_PROP_AXIS_NAMES.reduce((map, name) => {\n const axisName = name[name.length - 1].toLowerCase() as \"x\" | \"y\";\n const propertyName = name.slice(0, -1);\n map.set(name, { propertyName, axisName });\n return map;\n}, new Map<string, { propertyName: string; axisName: \"x\" | \"y\" }>());\n"],"names":[],"mappings":"AAAO,MAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,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;oBAE1B,IAAI;AAAA,EAC3D,GAAG;AAAA,EACH,GAAG;AACL,CAAC;AAEM,MAAM,sBAAsB,sBAAsB,OAAO,CAAC,KAAK,SAAS;AAC7E,QAAM,WAAW,KAAK,KAAK,SAAS,CAAC,EAAE,YAAA;AACvC,QAAM,eAAe,KAAK,MAAM,GAAG,EAAE;AACrC,MAAI,IAAI,MAAM,EAAE,cAAc,UAAU;AACxC,SAAO;AACT,GAAG,oBAAI,KAA4D;"}
1
+ {"version":3,"file":"point-property-names.js","sources":["../../../src/components/bind-props/point-property-names.ts"],"sourcesContent":["// Common point properties available on all Container-based components\nexport const COMMON_POINT_PROP_NAMES = [\"position\", \"scale\", \"pivot\", \"skew\"] as const;\n\nexport type CommonPointPropName = (typeof COMMON_POINT_PROP_NAMES)[number];\n\n// Anchor properties only available on Sprite-like components (Sprite, Text, etc.)\nexport const ANCHOR_POINT_PROP_NAMES = [\"anchor\"] as const;\n\nexport type AnchorPointPropName = (typeof ANCHOR_POINT_PROP_NAMES)[number];\n\n// Tiling properties only available on TilingSprite\nexport const TILING_POINT_PROP_NAMES = [\"tilePosition\", \"tileScale\"] as const;\n\nexport type TilingPointPropName = (typeof TILING_POINT_PROP_NAMES)[number];\n\n// All point properties (for runtime checking)\nexport const POINT_PROP_NAMES = [\n ...COMMON_POINT_PROP_NAMES,\n ...ANCHOR_POINT_PROP_NAMES,\n ...TILING_POINT_PROP_NAMES,\n] as const;\n\nexport type PointPropName = (typeof POINT_PROP_NAMES)[number];\n\nexport const POINT_PROP_NAMES_SET: Set<string> = new Set(POINT_PROP_NAMES);\n\n// Common axis properties available on all Container-based components\nexport const COMMON_POINT_PROP_AXIS_NAMES = [\n \"positionX\",\n \"positionY\",\n \"scaleX\",\n \"scaleY\",\n \"pivotX\",\n \"pivotY\",\n \"skewX\",\n \"skewY\",\n] as const;\n\nexport type CommonPointAxisPropName = (typeof COMMON_POINT_PROP_AXIS_NAMES)[number];\n\n// Anchor axis properties only available on Sprite-like components\nexport const ANCHOR_POINT_PROP_AXIS_NAMES = [\"anchorX\", \"anchorY\"] as const;\n\nexport type AnchorPointAxisPropName = (typeof ANCHOR_POINT_PROP_AXIS_NAMES)[number];\n\n// Tiling axis properties only available on TilingSprite\nexport const TILING_POINT_PROP_AXIS_NAMES = [\n \"tilePositionX\",\n \"tilePositionY\",\n \"tileScaleX\",\n \"tileScaleY\",\n] as const;\n\nexport type TilingPointAxisPropName = (typeof TILING_POINT_PROP_AXIS_NAMES)[number];\n\n// All axis properties (for runtime checking)\nexport const POINT_PROP_AXIS_NAMES = [\n ...COMMON_POINT_PROP_AXIS_NAMES,\n ...ANCHOR_POINT_PROP_AXIS_NAMES,\n ...TILING_POINT_PROP_AXIS_NAMES,\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\nexport const POINT_PROP_AXIS_MAP = POINT_PROP_AXIS_NAMES.reduce((map, name) => {\n const axisName = name[name.length - 1].toLowerCase() as \"x\" | \"y\";\n const propertyName = name.slice(0, -1);\n map.set(name, { propertyName, axisName });\n return map;\n}, new Map<string, { propertyName: string; axisName: \"x\" | \"y\" }>());\n"],"names":[],"mappings":"AACO,MAAM,0BAA0B,CAAC,YAAY,SAAS,SAAS,MAAM;AAKrE,MAAM,0BAA0B,CAAC,QAAQ;AAKzC,MAAM,0BAA0B,CAAC,gBAAgB,WAAW;AAK5D,MAAM,mBAAmB;AAAA,EAC9B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAIO,MAAM,uBAAoC,IAAI,IAAI,gBAAgB;AAGlE,MAAM,+BAA+B;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,MAAM,+BAA+B,CAAC,WAAW,SAAS;AAK1D,MAAM,+BAA+B;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,MAAM,wBAAwB;AAAA,EACnC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAIO,MAAM,4BAAyC,IAAI,IAAI,qBAAqB;oBAE1B,IAAI;AAAA,EAC3D,GAAG;AAAA,EACH,GAAG;AACL,CAAC;AAEM,MAAM,sBAAsB,sBAAsB,OAAO,CAAC,KAAK,SAAS;AAC7E,QAAM,WAAW,KAAK,KAAK,SAAS,CAAC,EAAE,YAAA;AACvC,QAAM,eAAe,KAAK,MAAM,GAAG,EAAE;AACrC,MAAI,IAAI,MAAM,EAAE,cAAc,UAAU;AACxC,SAAO;AACT,GAAG,oBAAI,KAA4D;"}
@@ -1,15 +1,31 @@
1
1
  import { splitProps, onCleanup } from "solid-js";
2
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";
3
+ import { COMMON_POINT_PROP_AXIS_NAMES, ANCHOR_POINT_PROP_AXIS_NAMES, TILING_POINT_PROP_AXIS_NAMES } from "./bind-props/point-property-names.js";
4
4
  import { bindInitialisationProps, bindRuntimeProps } from "./bind-props/bind-props.js";
5
5
  const SOLID_PROP_KEYS = ["ref", "as", "children"];
6
+ const CONTAINER_RUNTIME_KEYS = [
7
+ ...SOLID_PROP_KEYS,
8
+ ...PIXI_SOLID_EVENT_HANDLER_NAMES,
9
+ ...COMMON_POINT_PROP_AXIS_NAMES
10
+ ];
11
+ const SPRITE_RUNTIME_KEYS = [
12
+ "ref",
13
+ "as",
14
+ ...PIXI_SOLID_EVENT_HANDLER_NAMES,
15
+ ...COMMON_POINT_PROP_AXIS_NAMES,
16
+ ...ANCHOR_POINT_PROP_AXIS_NAMES
17
+ ];
18
+ const TILING_SPRITE_RUNTIME_KEYS = [
19
+ "ref",
20
+ "as",
21
+ ...PIXI_SOLID_EVENT_HANDLER_NAMES,
22
+ ...COMMON_POINT_PROP_AXIS_NAMES,
23
+ ...ANCHOR_POINT_PROP_AXIS_NAMES,
24
+ ...TILING_POINT_PROP_AXIS_NAMES
25
+ ];
6
26
  const createContainerComponent = (PixiClass) => {
7
27
  return (props) => {
8
- const [runtimeProps, initialisationProps] = splitProps(props, [
9
- ...SOLID_PROP_KEYS,
10
- ...PIXI_SOLID_EVENT_HANDLER_NAMES,
11
- ...POINT_PROP_AXIS_NAMES
12
- ]);
28
+ const [runtimeProps, initialisationProps] = splitProps(props, CONTAINER_RUNTIME_KEYS);
13
29
  const instance = props.as || new PixiClass(initialisationProps);
14
30
  bindInitialisationProps(instance, initialisationProps);
15
31
  bindRuntimeProps(instance, runtimeProps);
@@ -28,9 +44,43 @@ const createLeafComponent = (PixiClass) => {
28
44
  return createContainerComponent(PixiClass)(props);
29
45
  };
30
46
  };
47
+ const createSpriteComponent = (PixiClass) => {
48
+ return (props) => {
49
+ const [runtimeProps, initialisationProps] = splitProps(props, SPRITE_RUNTIME_KEYS);
50
+ const instance = props.as || new PixiClass(initialisationProps);
51
+ bindInitialisationProps(instance, initialisationProps);
52
+ bindRuntimeProps(instance, runtimeProps);
53
+ onCleanup(() => {
54
+ if ("attach" in instance) {
55
+ instance.destroy({ children: false });
56
+ } else {
57
+ instance.destroy({ children: true });
58
+ }
59
+ });
60
+ return instance;
61
+ };
62
+ };
63
+ const createTilingSpriteComponent = (PixiClass) => {
64
+ return (props) => {
65
+ const [runtimeProps, initialisationProps] = splitProps(props, TILING_SPRITE_RUNTIME_KEYS);
66
+ const instance = props.as || new PixiClass(initialisationProps);
67
+ bindInitialisationProps(instance, initialisationProps);
68
+ bindRuntimeProps(instance, runtimeProps);
69
+ onCleanup(() => {
70
+ if ("attach" in instance) {
71
+ instance.destroy({ children: false });
72
+ } else {
73
+ instance.destroy({ children: true });
74
+ }
75
+ });
76
+ return instance;
77
+ };
78
+ };
31
79
  export {
32
80
  SOLID_PROP_KEYS,
33
81
  createContainerComponent,
34
- createLeafComponent
82
+ createLeafComponent,
83
+ createSpriteComponent,
84
+ createTilingSpriteComponent
35
85
  };
36
86
  //# sourceMappingURL=component-factories.js.map
@@ -1 +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, onCleanup } from \"solid-js\";\n\nimport { bindInitialisationProps, bindRuntimeProps } from \"./bind-props\";\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\";\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 bindInitialisationProps(instance, initialisationProps);\n bindRuntimeProps(instance, runtimeProps);\n\n onCleanup(() => {\n if (\"attach\" in instance) {\n // Means it's a render layer so we don't want to destroy children as they are managed elsewhere in the tree.\n instance.destroy({ children: false });\n } else {\n instance.destroy({ children: true });\n }\n });\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":";;;;AA+CO,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,4BAAwB,UAAU,mBAAmB;AACrD,qBAAiB,UAAU,YAAY;AAEvC,cAAU,MAAM;AACd,UAAI,YAAY,UAAU;AAExB,iBAAS,QAAQ,EAAE,UAAU,MAAA,CAAO;AAAA,MACtC,OAAO;AACL,iBAAS,QAAQ,EAAE,UAAU,KAAA,CAAM;AAAA,MACrC;AAAA,IACF,CAAC;AAED,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
+ {"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, onCleanup } from \"solid-js\";\n\nimport { bindInitialisationProps, bindRuntimeProps } from \"./bind-props\";\nimport type { PixiEventHandlerMap } from \"./bind-props/event-names\";\nimport { PIXI_SOLID_EVENT_HANDLER_NAMES } from \"./bind-props/event-names\";\nimport type {\n CommonPointAxisPropName,\n AnchorPointAxisPropName,\n TilingPointAxisPropName,\n} from \"./bind-props/point-property-names\";\nimport {\n COMMON_POINT_PROP_AXIS_NAMES,\n ANCHOR_POINT_PROP_AXIS_NAMES,\n TILING_POINT_PROP_AXIS_NAMES,\n} from \"./bind-props/point-property-names\";\n\n/**\n * Common point axis properties available on all Container-based components\n */\nexport type CommonPointAxisProps = Partial<Record<CommonPointAxisPropName, number>>;\n\n/**\n * Anchor point axis properties available on Sprite-like components\n */\nexport type AnchorPointAxisProps = Partial<Record<AnchorPointAxisPropName, number>>;\n\n/**\n * Tiling point axis properties available on TilingSprite\n */\nexport type TilingPointAxisProps = Partial<Record<TilingPointAxisPropName, number>>;\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 & CommonPointAxisProps & Omit<ComponentOptions, \"children\">;\n\n/**\n * Prop definition for basic Container components (position, scale, pivot, skew only)\n */\nexport type ContainerProps<Component> = PixiEventHandlerMap &\n CommonPointAxisProps & {\n ref?: Ref<Component>;\n as?: Component;\n children?: JSX.Element;\n };\n\n/**\n * Prop definition for components that cannot have children\n */\nexport type LeafProps<Component> = Omit<ContainerProps<Component>, \"children\">;\n\n/**\n * Prop definition for Sprite-like components (includes anchor properties)\n */\nexport type SpriteProps<Component> = PixiEventHandlerMap &\n CommonPointAxisProps &\n AnchorPointAxisProps & {\n ref?: Ref<Component>;\n as?: Component;\n };\n\n/**\n * Prop definition for TilingSprite (includes anchor and tiling properties)\n */\nexport type TilingSpriteProps<Component> = PixiEventHandlerMap &\n CommonPointAxisProps &\n AnchorPointAxisProps &\n TilingPointAxisProps & {\n ref?: Ref<Component>;\n as?: Component;\n };\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// Combined keys for splitting props\nconst CONTAINER_RUNTIME_KEYS = [\n ...SOLID_PROP_KEYS,\n ...PIXI_SOLID_EVENT_HANDLER_NAMES,\n ...COMMON_POINT_PROP_AXIS_NAMES,\n] as const;\n\n// Sprite components don't accept \"children\" since they can't have children\nconst SPRITE_RUNTIME_KEYS = [\n \"ref\",\n \"as\",\n ...PIXI_SOLID_EVENT_HANDLER_NAMES,\n ...COMMON_POINT_PROP_AXIS_NAMES,\n ...ANCHOR_POINT_PROP_AXIS_NAMES,\n] as const;\n\nconst TILING_SPRITE_RUNTIME_KEYS = [\n \"ref\",\n \"as\",\n ...PIXI_SOLID_EVENT_HANDLER_NAMES,\n ...COMMON_POINT_PROP_AXIS_NAMES,\n ...ANCHOR_POINT_PROP_AXIS_NAMES,\n ...TILING_POINT_PROP_AXIS_NAMES,\n] 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, CONTAINER_RUNTIME_KEYS);\n\n const instance = props.as || new PixiClass(initialisationProps as any);\n\n bindInitialisationProps(instance, initialisationProps);\n bindRuntimeProps(instance, runtimeProps);\n\n onCleanup(() => {\n if (\"attach\" in instance) {\n // Means it's a render layer so we don't want to destroy children as they are managed elsewhere in the tree.\n instance.destroy({ children: false });\n } else {\n instance.destroy({ children: true });\n }\n });\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 createSpriteComponent = <\n InstanceType extends Pixi.Container,\n OptionsType extends object,\n>(\n PixiClass: new (props: OptionsType) => InstanceType,\n) => {\n return (\n props: Omit<OptionsType, \"children\"> & SpriteProps<InstanceType>,\n ): InstanceType & JSX.Element => {\n const [runtimeProps, initialisationProps] = splitProps(props, SPRITE_RUNTIME_KEYS);\n\n const instance = props.as || new PixiClass(initialisationProps as any);\n\n bindInitialisationProps(instance, initialisationProps);\n bindRuntimeProps(instance, runtimeProps);\n\n onCleanup(() => {\n if (\"attach\" in instance) {\n // Means it's a render layer so we don't want to destroy children as they are managed elsewhere in the tree.\n instance.destroy({ children: false });\n } else {\n instance.destroy({ children: true });\n }\n });\n\n return instance as InstanceType & JSX.Element;\n };\n};\n\nexport const createTilingSpriteComponent = <\n InstanceType extends Pixi.Container,\n OptionsType extends object,\n>(\n PixiClass: new (props: OptionsType) => InstanceType,\n) => {\n return (\n props: Omit<OptionsType, \"children\"> & TilingSpriteProps<InstanceType>,\n ): InstanceType & JSX.Element => {\n const [runtimeProps, initialisationProps] = splitProps(props, TILING_SPRITE_RUNTIME_KEYS);\n\n const instance = props.as || new PixiClass(initialisationProps as any);\n\n bindInitialisationProps(instance, initialisationProps);\n bindRuntimeProps(instance, runtimeProps);\n\n onCleanup(() => {\n if (\"attach\" in instance) {\n // Means it's a render layer so we don't want to destroy children as they are managed elsewhere in the tree.\n instance.destroy({ children: false });\n } else {\n instance.destroy({ children: true });\n }\n });\n\n return instance as InstanceType & JSX.Element;\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":";;;;AAyFO,MAAM,kBAAkB,CAAC,OAAO,MAAM,UAAU;AAGvD,MAAM,yBAAyB;AAAA,EAC7B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,6BAA6B;AAAA,EACjC;AAAA,EACA;AAAA,EACA,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,2BAA2B,CAItC,cAGkC;AAClC,SAAO,CAAC,UAAsC;AAC5C,UAAM,CAAC,cAAc,mBAAmB,IAAI,WAAW,OAAO,sBAAsB;AAEpF,UAAM,WAAW,MAAM,MAAM,IAAI,UAAU,mBAA0B;AAErE,4BAAwB,UAAU,mBAAmB;AACrD,qBAAiB,UAAU,YAAY;AAEvC,cAAU,MAAM;AACd,UAAI,YAAY,UAAU;AAExB,iBAAS,QAAQ,EAAE,UAAU,MAAA,CAAO;AAAA,MACtC,OAAO;AACL,iBAAS,QAAQ,EAAE,UAAU,KAAA,CAAM;AAAA,MACrC;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AACF;AAEO,MAAM,sBAAsB,CAIjC,cACG;AACH,SAAO,CACL,UAC+B;AAC/B,WAAO,yBAAoD,SAAS,EAAE,KAAK;AAAA,EAC7E;AACF;AAEO,MAAM,wBAAwB,CAInC,cACG;AACH,SAAO,CACL,UAC+B;AAC/B,UAAM,CAAC,cAAc,mBAAmB,IAAI,WAAW,OAAO,mBAAmB;AAEjF,UAAM,WAAW,MAAM,MAAM,IAAI,UAAU,mBAA0B;AAErE,4BAAwB,UAAU,mBAAmB;AACrD,qBAAiB,UAAU,YAAY;AAEvC,cAAU,MAAM;AACd,UAAI,YAAY,UAAU;AAExB,iBAAS,QAAQ,EAAE,UAAU,MAAA,CAAO;AAAA,MACtC,OAAO;AACL,iBAAS,QAAQ,EAAE,UAAU,KAAA,CAAM;AAAA,MACrC;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AACF;AAEO,MAAM,8BAA8B,CAIzC,cACG;AACH,SAAO,CACL,UAC+B;AAC/B,UAAM,CAAC,cAAc,mBAAmB,IAAI,WAAW,OAAO,0BAA0B;AAExF,UAAM,WAAW,MAAM,MAAM,IAAI,UAAU,mBAA0B;AAErE,4BAAwB,UAAU,mBAAmB;AACrD,qBAAiB,UAAU,YAAY;AAEvC,cAAU,MAAM;AACd,UAAI,YAAY,UAAU;AAExB,iBAAS,QAAQ,EAAE,UAAU,MAAA,CAAO;AAAA,MACtC,OAAO;AACL,iBAAS,QAAQ,EAAE,UAAU,KAAA,CAAM;AAAA,MACrC;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AACF;"}
@@ -1,20 +1,20 @@
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-factories.js";
3
- const AnimatedSprite = createLeafComponent(AnimatedSprite$1);
4
- const BitmapText = createLeafComponent(BitmapText$1);
1
+ import { BitmapText as BitmapText$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, RenderContainer as RenderContainer$1, RenderLayer as RenderLayer$1, Sprite as Sprite$1, Text as Text$1, AnimatedSprite as AnimatedSprite$1, Container as Container$1, Graphics as Graphics$1, TilingSprite as TilingSprite$1 } from "pixi.js";
2
+ import { createSpriteComponent, createContainerComponent, createLeafComponent, createTilingSpriteComponent } from "./component-factories.js";
3
+ const AnimatedSprite = createSpriteComponent(AnimatedSprite$1);
4
+ const BitmapText = createSpriteComponent(BitmapText$1);
5
5
  const Container = createContainerComponent(Container$1);
6
6
  const Graphics = createLeafComponent(Graphics$1);
7
- const HTMLText = createLeafComponent(HTMLText$1);
8
- const MeshPlane = createLeafComponent(MeshPlane$1);
9
- const MeshRope = createLeafComponent(MeshRope$1);
10
- const NineSliceSprite = createLeafComponent(NineSliceSprite$1);
7
+ const HTMLText = createSpriteComponent(HTMLText$1);
8
+ const MeshPlane = createSpriteComponent(MeshPlane$1);
9
+ const MeshRope = createSpriteComponent(MeshRope$1);
10
+ const NineSliceSprite = createSpriteComponent(NineSliceSprite$1);
11
11
  const ParticleContainer = createLeafComponent(ParticleContainer$1);
12
- const PerspectiveMesh = createLeafComponent(PerspectiveMesh$1);
12
+ const PerspectiveMesh = createSpriteComponent(PerspectiveMesh$1);
13
13
  const RenderContainer = createContainerComponent(RenderContainer$1);
14
14
  const RenderLayer = createContainerComponent(RenderLayer$1);
15
- const Sprite = createLeafComponent(Sprite$1);
16
- const Text = createLeafComponent(Text$1);
17
- const TilingSprite = createLeafComponent(TilingSprite$1);
15
+ const Sprite = createSpriteComponent(Sprite$1);
16
+ const Text = createSpriteComponent(Text$1);
17
+ const TilingSprite = createTilingSpriteComponent(TilingSprite$1);
18
18
  export {
19
19
  AnimatedSprite,
20
20
  BitmapText,
@@ -1 +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\";\n\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":";;AAwBO,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;"}
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\";\n\nimport {\n createContainerComponent,\n createLeafComponent,\n createSpriteComponent,\n createTilingSpriteComponent,\n} from \"./component-factories\";\n\n/**\n * A SolidJS component that renders a `PIXI.AnimatedSprite`.\n */\nexport const AnimatedSprite = createSpriteComponent<PixiAnimatedSprite, Pixi.AnimatedSpriteOptions>(\n PixiAnimatedSprite,\n);\n/**\n * A SolidJS component that renders a `PIXI.BitmapText`.\n */\nexport const BitmapText = createSpriteComponent<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 = createSpriteComponent<PixiHTMLText, Pixi.HTMLTextOptions>(PixiHTMLText);\n\n/**\n * A SolidJS component that renders a `PIXI.MeshPlane`.\n */\nexport const MeshPlane = createSpriteComponent<PixiMeshPlane, Pixi.MeshPlaneOptions>(PixiMeshPlane);\n\n/**\n * A SolidJS component that renders a `PIXI.MeshRope`.\n */\nexport const MeshRope = createSpriteComponent<PixiMeshRope, Pixi.MeshRopeOptions>(PixiMeshRope);\n\n/**\n * A SolidJS component that renders a `PIXI.NineSliceSprite`.\n */\nexport const NineSliceSprite = createSpriteComponent<\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 = createSpriteComponent<\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 = createSpriteComponent<PixiSprite, Pixi.SpriteOptions>(PixiSprite);\n/**\n * A SolidJS component that renders a `PIXI.Text`.\n */\nexport const Text = createSpriteComponent<PixiText, Pixi.CanvasTextOptions>(PixiText);\n\n/**\n * A SolidJS component that renders a `PIXI.TilingSprite`.\n */\nexport const TilingSprite = createTilingSpriteComponent<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","createSpriteComponent","PixiAnimatedSprite","BitmapText","PixiBitmapText","Container","createContainerComponent","PixiContainer","Graphics","createLeafComponent","PixiGraphics","HTMLText","PixiHTMLText","MeshPlane","PixiMeshPlane","MeshRope","PixiMeshRope","NineSliceSprite","PixiNineSliceSprite","ParticleContainer","PixiParticleContainer","PerspectiveMesh","PixiPerspectiveMesh","RenderContainer","PixiRenderContainer","RenderLayer","PixiRenderLayer","Sprite","PixiSprite","Text","PixiText","TilingSprite","createTilingSpriteComponent","PixiTilingSprite"],"mappings":";;AA6BO,MAAMA,iBAAiBC,sBAC5BC,gBACF;AAIO,MAAMC,aAAaF,sBAAwDG,YAAc;AAIzF,MAAMC,YAAYC,yBACvBC,WACF;AAKO,MAAMC,WAAWC,oBAAwDC,UAAY;AAIrF,MAAMC,WAAWV,sBAA0DW,UAAY;AAKvF,MAAMC,YAAYZ,sBAA4Da,WAAa;AAK3F,MAAMC,WAAWd,sBAA0De,UAAY;AAKvF,MAAMC,kBAAkBhB,sBAG7BiB,iBAAmB;AAOd,MAAMC,oBAAoBV,oBAG/BW,mBAAqB;AAKhB,MAAMC,kBAAkBpB,sBAG7BqB,iBAAmB;AAKd,MAAMC,kBAAkBjB,yBAG7BkB,iBAAmB;AAKd,MAAMC,cAAcnB,yBACzBoB,aACF;AAKO,MAAMC,SAAS1B,sBAAsD2B,QAAU;AAI/E,MAAMC,OAAO5B,sBAAwD6B,MAAQ;AAK7E,MAAMC,eAAeC,4BAC1BC,cACF;"}
package/dist/index.js CHANGED
@@ -2,11 +2,11 @@ import { onResize } from "./on-resize.js";
2
2
  import { onTick } from "./on-tick.js";
3
3
  import { createAsyncDelay, delay } from "./delay.js";
4
4
  import { PixiCanvas } from "./pixi-canvas.js";
5
- import { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, NineSliceSprite, ParticleContainer, PerspectiveMesh, RenderContainer, RenderLayer, Sprite, Text, TilingSprite } from "./components/components.js";
6
5
  import { PIXI_EVENT_NAMES, PIXI_SOLID_EVENT_HANDLER_NAMES } from "./components/bind-props/event-names.js";
7
6
  import { getPixiApp } from "./pixi-application/get-pixi-app.js";
8
7
  import { getTicker } from "./pixi-application/get-ticker.js";
9
8
  import { PixiApplicationProvider, TickerProvider } from "./pixi-application/pixi-application-provider.js";
9
+ import { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, NineSliceSprite, ParticleContainer, PerspectiveMesh, RenderContainer, RenderLayer, Sprite, Text, TilingSprite } from "./components/components.js";
10
10
  import { usePixiScreen } from "./use-pixi-screen/use-pixi-screen.js";
11
11
  export {
12
12
  AnimatedSprite,
package/dist/on-tick.js CHANGED
@@ -1,15 +1,16 @@
1
+ import { UPDATE_PRIORITY } from "pixi.js";
1
2
  import { useContext, onCleanup } from "solid-js";
2
3
  import { TickerContext } from "./pixi-application/context.js";
3
- const onTick = (tickerCallback) => {
4
+ const onTick = (tickerCallback, priority = UPDATE_PRIORITY.NORMAL) => {
4
5
  const ticker = useContext(TickerContext);
5
6
  if (!ticker) {
6
7
  throw new Error(
7
8
  "onTick must be used within a PixiApplicationProvider, PixiCanvas or a TickerProvider"
8
9
  );
9
10
  }
10
- ticker.add(tickerCallback);
11
+ ticker.add(tickerCallback, ticker, priority);
11
12
  onCleanup(() => {
12
- ticker.remove(tickerCallback);
13
+ ticker.remove(tickerCallback, ticker);
13
14
  });
14
15
  };
15
16
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"on-tick.js","sources":["../src/on-tick.ts"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport { onCleanup, useContext } from \"solid-js\";\n\nimport { TickerContext } from \"./pixi-application\";\n\n/**\n * onTick\n *\n * A custom SolidJS hook that registers a callback function to be executed on every frame\n * of the PIXI.Application's ticker. The callback is automatically removed when the\n * component or hook's owning computation is cleaned up.\n *\n * This hook must be called from a component that is a descendant of `PixiCanvas`,\n * `PixiApplicationProvider`, or `TickerProvider`.\n *\n * @param tickerCallback - The function to call on each ticker update. It receives\n * the `Pixi.Ticker` instance as its argument.\n *\n */\nexport const onTick = (tickerCallback: Pixi.TickerCallback<Pixi.Ticker>): void => {\n const ticker = useContext(TickerContext);\n\n if (!ticker) {\n throw new Error(\n \"onTick must be used within a PixiApplicationProvider, PixiCanvas or a TickerProvider\",\n );\n }\n\n ticker.add(tickerCallback);\n\n onCleanup(() => {\n ticker.remove(tickerCallback);\n });\n};\n"],"names":[],"mappings":";;AAmBO,MAAM,SAAS,CAAC,mBAA2D;AAChF,QAAM,SAAS,WAAW,aAAa;AAEvC,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAO,IAAI,cAAc;AAEzB,YAAU,MAAM;AACd,WAAO,OAAO,cAAc;AAAA,EAC9B,CAAC;AACH;"}
1
+ {"version":3,"file":"on-tick.js","sources":["../src/on-tick.ts"],"sourcesContent":["import type * as Pixi from \"pixi.js\";\nimport { UPDATE_PRIORITY } from \"pixi.js\";\nimport { onCleanup, useContext } from \"solid-js\";\n\nimport { TickerContext } from \"./pixi-application\";\n\n/**\n * onTick\n *\n * A custom SolidJS hook that registers a callback function to be executed on every frame\n * of the PIXI.Application's ticker. The callback is automatically removed when the\n * component or hook's owning computation is cleaned up.\n *\n * This hook must be called from a component that is a descendant of `PixiCanvas`,\n * `PixiApplicationProvider`, or `TickerProvider`.\n *\n * @param tickerCallback - The function to call on each ticker update. It receives\n * the `Pixi.Ticker` instance as its argument.\n * @param priority - An optional priority level for the ticker callback.\n *\n */\nexport const onTick = (\n tickerCallback: Pixi.TickerCallback<Pixi.Ticker>,\n priority: Pixi.UPDATE_PRIORITY = UPDATE_PRIORITY.NORMAL,\n): void => {\n const ticker = useContext(TickerContext);\n\n if (!ticker) {\n throw new Error(\n \"onTick must be used within a PixiApplicationProvider, PixiCanvas or a TickerProvider\",\n );\n }\n\n ticker.add(tickerCallback, ticker, priority);\n\n onCleanup(() => {\n ticker.remove(tickerCallback, ticker);\n });\n};\n"],"names":[],"mappings":";;;AAqBO,MAAM,SAAS,CACpB,gBACA,WAAiC,gBAAgB,WACxC;AACT,QAAM,SAAS,WAAW,aAAa;AAEvC,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAEA,SAAO,IAAI,gBAAgB,QAAQ,QAAQ;AAE3C,YAAU,MAAM;AACd,WAAO,OAAO,gBAAgB,MAAM;AAAA,EACtC,CAAC;AACH;"}
@@ -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\";\n\nimport { createPixiScreenStore } from \"../use-pixi-screen/pixi-screen-store\";\n\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): JSX.Element => {\n let externallyProvidedApp: Pixi.Application | undefined = props.existingApp;\n\n const [appResource] = createResource(async () => {\n if (externallyProvidedApp) {\n return externallyProvidedApp;\n }\n\n const existingContext = useContext(PixiAppContext);\n if (existingContext?.app) {\n externallyProvidedApp = existingContext.app;\n return existingContext.app;\n }\n\n const [, initialisationProps] = splitProps(props, [\"children\", \"existingApp\"]);\n return await createPixiApplication(initialisationProps);\n });\n\n onCleanup(() => {\n // Only destory the app if it was created here.\n if (externallyProvidedApp) return;\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): JSX.Element => {\n return <TickerContext.Provider value={props.ticker}>{props.children}</TickerContext.Provider>;\n};\n"],"names":["PixiApplicationProvider","props","externallyProvidedApp","existingApp","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":";;;;;AA+BO,MAAMA,0BAA0BA,CAACC,UAA6C;AACnF,MAAIC,wBAAsDD,MAAME;AAEhE,QAAM,CAACC,WAAW,IAAIC,eAAe,YAAY;AAC/C,QAAIH,uBAAuB;AACzB,aAAOA;AAAAA,IACT;AAEA,UAAMI,kBAAkBC,WAAWC,cAAc;AACjD,QAAIF,iBAAiBG,KAAK;AACxBP,8BAAwBI,gBAAgBG;AACxC,aAAOH,gBAAgBG;AAAAA,IACzB;AAEA,UAAM,CAAA,EAAGC,mBAAmB,IAAIC,WAAWV,OAAO,CAAC,YAAY,aAAa,CAAC;AAC7E,WAAO,MAAMW,sBAAsBF,mBAAmB;AAAA,EACxD,CAAC;AAEDG,YAAU,MAAM;AAEd,QAAIX,sBAAuB;AAC3BE,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,qBAAGd,MAAMc;AAAAA,YAAQ;AAAA,UAAA,CAAA;AAAA,QAAA;AAAA,MAAA,CAAA;AAAA,IAGlE;AAAA,EAAA,CAAC;AAGP;AAUO,MAAMY,iBAAiBA,CAAC1B,UAA4C;AACzE,SAAAe,gBAAQS,cAAcF,UAAQ;AAAA,IAAA,IAACC,QAAK;AAAA,aAAEvB,MAAMyB;AAAAA,IAAM;AAAA,IAAA,IAAAX,WAAA;AAAA,aAAGd,MAAMc;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\";\n\nimport { createPixiScreenStore } from \"../use-pixi-screen/pixi-screen-store\";\n\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): JSX.Element => {\n let externallyProvidedApp: Pixi.Application | undefined = props.existingApp;\n\n const [appResource] = createResource(async () => {\n if (externallyProvidedApp) {\n return externallyProvidedApp;\n }\n\n const existingContext = useContext(PixiAppContext);\n if (existingContext?.app) {\n externallyProvidedApp = existingContext.app;\n return existingContext.app;\n }\n\n const [, initialisationProps] = splitProps(props, [\"children\", \"existingApp\"]);\n return await createPixiApplication(initialisationProps);\n });\n\n onCleanup(() => {\n // Only destory the app if it was created here.\n if (externallyProvidedApp) return;\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.\n * For applications that want to use multiple tickers or 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): JSX.Element => {\n return <TickerContext.Provider value={props.ticker}>{props.children}</TickerContext.Provider>;\n};\n"],"names":["PixiApplicationProvider","props","externallyProvidedApp","existingApp","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":";;;;;AA+BO,MAAMA,0BAA0BA,CAACC,UAA6C;AACnF,MAAIC,wBAAsDD,MAAME;AAEhE,QAAM,CAACC,WAAW,IAAIC,eAAe,YAAY;AAC/C,QAAIH,uBAAuB;AACzB,aAAOA;AAAAA,IACT;AAEA,UAAMI,kBAAkBC,WAAWC,cAAc;AACjD,QAAIF,iBAAiBG,KAAK;AACxBP,8BAAwBI,gBAAgBG;AACxC,aAAOH,gBAAgBG;AAAAA,IACzB;AAEA,UAAM,CAAA,EAAGC,mBAAmB,IAAIC,WAAWV,OAAO,CAAC,YAAY,aAAa,CAAC;AAC7E,WAAO,MAAMW,sBAAsBF,mBAAmB;AAAA,EACxD,CAAC;AAEDG,YAAU,MAAM;AAEd,QAAIX,sBAAuB;AAC3BE,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,qBAAGd,MAAMc;AAAAA,YAAQ;AAAA,UAAA,CAAA;AAAA,QAAA;AAAA,MAAA,CAAA;AAAA,IAGlE;AAAA,EAAA,CAAC;AAGP;AAWO,MAAMY,iBAAiBA,CAAC1B,UAA4C;AACzE,SAAAe,gBAAQS,cAAcF,UAAQ;AAAA,IAAA,IAACC,QAAK;AAAA,aAAEvB,MAAMyB;AAAAA,IAAM;AAAA,IAAA,IAAAX,WAAA;AAAA,aAAGd,MAAMc;AAAAA,IAAQ;AAAA,EAAA,CAAA;AACrE;"}
@@ -1,4 +1,4 @@
1
1
  export { bindRuntimeProps, bindInitialisationProps } from "./bind-props";
2
2
  export type { PixiEventHandlerMap } from "./event-names";
3
- export type { PointAxisPropName } from "./point-property-names";
3
+ export type { PointAxisPropName, CommonPointAxisPropName, AnchorPointAxisPropName, TilingPointAxisPropName, } from "./point-property-names";
4
4
  export { PIXI_EVENT_NAMES, PIXI_SOLID_EVENT_HANDLER_NAMES } from "./event-names";
@@ -1,6 +1,18 @@
1
+ export declare const COMMON_POINT_PROP_NAMES: readonly ["position", "scale", "pivot", "skew"];
2
+ export type CommonPointPropName = (typeof COMMON_POINT_PROP_NAMES)[number];
3
+ export declare const ANCHOR_POINT_PROP_NAMES: readonly ["anchor"];
4
+ export type AnchorPointPropName = (typeof ANCHOR_POINT_PROP_NAMES)[number];
5
+ export declare const TILING_POINT_PROP_NAMES: readonly ["tilePosition", "tileScale"];
6
+ export type TilingPointPropName = (typeof TILING_POINT_PROP_NAMES)[number];
1
7
  export declare const POINT_PROP_NAMES: readonly ["position", "scale", "pivot", "skew", "anchor", "tilePosition", "tileScale"];
2
8
  export type PointPropName = (typeof POINT_PROP_NAMES)[number];
3
9
  export declare const POINT_PROP_NAMES_SET: Set<string>;
10
+ export declare const COMMON_POINT_PROP_AXIS_NAMES: readonly ["positionX", "positionY", "scaleX", "scaleY", "pivotX", "pivotY", "skewX", "skewY"];
11
+ export type CommonPointAxisPropName = (typeof COMMON_POINT_PROP_AXIS_NAMES)[number];
12
+ export declare const ANCHOR_POINT_PROP_AXIS_NAMES: readonly ["anchorX", "anchorY"];
13
+ export type AnchorPointAxisPropName = (typeof ANCHOR_POINT_PROP_AXIS_NAMES)[number];
14
+ export declare const TILING_POINT_PROP_AXIS_NAMES: readonly ["tilePositionX", "tilePositionY", "tileScaleX", "tileScaleY"];
15
+ export type TilingPointAxisPropName = (typeof TILING_POINT_PROP_AXIS_NAMES)[number];
4
16
  export declare const POINT_PROP_AXIS_NAMES: readonly ["positionX", "positionY", "scaleX", "scaleY", "pivotX", "pivotY", "skewX", "skewY", "anchorX", "anchorY", "tilePositionX", "tilePositionY", "tileScaleX", "tileScaleY"];
5
17
  export type PointAxisPropName = (typeof POINT_PROP_AXIS_NAMES)[number];
6
18
  export declare const POINT_PROP_AXIS_NAMES_SET: Set<string>;
@@ -1,7 +1,19 @@
1
1
  import type * as Pixi from "pixi.js";
2
2
  import type { JSX, Ref } from "solid-js";
3
3
  import type { PixiEventHandlerMap } from "./bind-props/event-names";
4
- import type { PointAxisPropName } from "./bind-props/point-property-names";
4
+ import type { CommonPointAxisPropName, AnchorPointAxisPropName, TilingPointAxisPropName } from "./bind-props/point-property-names";
5
+ /**
6
+ * Common point axis properties available on all Container-based components
7
+ */
8
+ export type CommonPointAxisProps = Partial<Record<CommonPointAxisPropName, number>>;
9
+ /**
10
+ * Anchor point axis properties available on Sprite-like components
11
+ */
12
+ export type AnchorPointAxisProps = Partial<Record<AnchorPointAxisPropName, number>>;
13
+ /**
14
+ * Tiling point axis properties available on TilingSprite
15
+ */
16
+ export type TilingPointAxisProps = Partial<Record<TilingPointAxisPropName, number>>;
5
17
  /**
6
18
  * 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
19
  *
@@ -9,20 +21,33 @@ import type { PointAxisPropName } from "./bind-props/point-property-names";
9
21
  *
10
22
  * @example PixiComponentProps<Pixi.SpriteOptions>.
11
23
  */
12
- export type PixiComponentProps<ComponentOptions extends Pixi.ContainerOptions = Pixi.ContainerOptions> = PixiEventHandlerMap & PointAxisProps & Omit<ComponentOptions, "children">;
24
+ export type PixiComponentProps<ComponentOptions extends Pixi.ContainerOptions = Pixi.ContainerOptions> = PixiEventHandlerMap & CommonPointAxisProps & Omit<ComponentOptions, "children">;
13
25
  /**
14
- * Prop definition for components that CAN have children
26
+ * Prop definition for basic Container components (position, scale, pivot, skew only)
15
27
  */
16
- export type ContainerProps<Component> = PixiEventHandlerMap & PointAxisProps & {
28
+ export type ContainerProps<Component> = PixiEventHandlerMap & CommonPointAxisProps & {
17
29
  ref?: Ref<Component>;
18
30
  as?: Component;
19
31
  children?: JSX.Element;
20
32
  };
21
- export type PointAxisProps = Partial<Record<PointAxisPropName, number>>;
22
33
  /**
23
- * Prop definition for components that CANNOT have children
34
+ * Prop definition for components that cannot have children
24
35
  */
25
36
  export type LeafProps<Component> = Omit<ContainerProps<Component>, "children">;
37
+ /**
38
+ * Prop definition for Sprite-like components (includes anchor properties)
39
+ */
40
+ export type SpriteProps<Component> = PixiEventHandlerMap & CommonPointAxisProps & AnchorPointAxisProps & {
41
+ ref?: Ref<Component>;
42
+ as?: Component;
43
+ };
44
+ /**
45
+ * Prop definition for TilingSprite (includes anchor and tiling properties)
46
+ */
47
+ export type TilingSpriteProps<Component> = PixiEventHandlerMap & CommonPointAxisProps & AnchorPointAxisProps & TilingPointAxisProps & {
48
+ ref?: Ref<Component>;
49
+ as?: Component;
50
+ };
26
51
  /**
27
52
  * Prop definition for filter components
28
53
  */
@@ -33,4 +58,6 @@ export type FilterProps<Component> = {
33
58
  export declare const SOLID_PROP_KEYS: readonly ["ref", "as", "children"];
34
59
  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);
35
60
  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;
61
+ export declare const createSpriteComponent: <InstanceType extends Pixi.Container, OptionsType extends object>(PixiClass: new (props: OptionsType) => InstanceType) => (props: Omit<OptionsType, "children"> & SpriteProps<InstanceType>) => InstanceType & JSX.Element;
62
+ export declare const createTilingSpriteComponent: <InstanceType extends Pixi.Container, OptionsType extends object>(PixiClass: new (props: OptionsType) => InstanceType) => (props: Omit<OptionsType, "children"> & TilingSpriteProps<InstanceType>) => InstanceType & JSX.Element;
36
63
  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,21 @@ 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-factories").LeafProps<Pixi.AnimatedSprite>) => Pixi.AnimatedSprite & import("solid-js").JSX.Element;
5
+ export declare const AnimatedSprite: (props: Omit<Pixi.AnimatedSpriteOptions, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY", number>> & Partial<Record<"anchorX" | "anchorY", number>> & {
6
+ ref?: import("solid-js").Ref<Pixi.AnimatedSprite> | undefined;
7
+ as?: Pixi.AnimatedSprite | undefined;
8
+ }) => Pixi.AnimatedSprite & import("solid-js").JSX.Element;
6
9
  /**
7
10
  * A SolidJS component that renders a `PIXI.BitmapText`.
8
11
  */
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;
12
+ export declare const BitmapText: (props: Omit<Pixi.TextOptions<Pixi.TextStyle, Pixi.TextStyleOptions>, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY", number>> & Partial<Record<"anchorX" | "anchorY", number>> & {
13
+ ref?: import("solid-js").Ref<Pixi.BitmapText> | undefined;
14
+ as?: Pixi.BitmapText | undefined;
15
+ }) => Pixi.BitmapText & import("solid-js").JSX.Element;
10
16
  /**
11
17
  * A SolidJS component that renders a `PIXI.Container`.
12
18
  */
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>> & {
19
+ 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", number>> & {
14
20
  ref?: import("solid-js").Ref<Pixi.Container<Pixi.ContainerChild>> | undefined;
15
21
  as?: Pixi.Container<Pixi.ContainerChild> | undefined;
16
22
  children?: import("solid-js").JSX.Element;
@@ -23,19 +29,31 @@ export declare const Graphics: (props: Omit<Pixi.GraphicsOptions, "children"> &
23
29
  /**
24
30
  * A SolidJS component that renders a `PIXI.HTMLText`.
25
31
  */
26
- export declare const HTMLText: (props: Omit<Pixi.HTMLTextOptions, "children"> & import("./component-factories").LeafProps<Pixi.HTMLText>) => Pixi.HTMLText & import("solid-js").JSX.Element;
32
+ export declare const HTMLText: (props: Omit<Pixi.HTMLTextOptions, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY", number>> & Partial<Record<"anchorX" | "anchorY", number>> & {
33
+ ref?: import("solid-js").Ref<Pixi.HTMLText> | undefined;
34
+ as?: Pixi.HTMLText | undefined;
35
+ }) => Pixi.HTMLText & import("solid-js").JSX.Element;
27
36
  /**
28
37
  * A SolidJS component that renders a `PIXI.MeshPlane`.
29
38
  */
30
- export declare const MeshPlane: (props: Omit<Pixi.MeshPlaneOptions, "children"> & import("./component-factories").LeafProps<Pixi.MeshPlane>) => Pixi.MeshPlane & import("solid-js").JSX.Element;
39
+ export declare const MeshPlane: (props: Omit<Pixi.MeshPlaneOptions, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY", number>> & Partial<Record<"anchorX" | "anchorY", number>> & {
40
+ ref?: import("solid-js").Ref<Pixi.MeshPlane> | undefined;
41
+ as?: Pixi.MeshPlane | undefined;
42
+ }) => Pixi.MeshPlane & import("solid-js").JSX.Element;
31
43
  /**
32
44
  * A SolidJS component that renders a `PIXI.MeshRope`.
33
45
  */
34
- export declare const MeshRope: (props: Omit<Pixi.MeshRopeOptions, "children"> & import("./component-factories").LeafProps<Pixi.MeshRope>) => Pixi.MeshRope & import("solid-js").JSX.Element;
46
+ export declare const MeshRope: (props: Omit<Pixi.MeshRopeOptions, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY", number>> & Partial<Record<"anchorX" | "anchorY", number>> & {
47
+ ref?: import("solid-js").Ref<Pixi.MeshRope> | undefined;
48
+ as?: Pixi.MeshRope | undefined;
49
+ }) => Pixi.MeshRope & import("solid-js").JSX.Element;
35
50
  /**
36
51
  * A SolidJS component that renders a `PIXI.NineSliceSprite`.
37
52
  */
38
- export declare const NineSliceSprite: (props: Omit<Pixi.NineSliceSpriteOptions, "children"> & import("./component-factories").LeafProps<Pixi.NineSliceSprite>) => Pixi.NineSliceSprite & import("solid-js").JSX.Element;
53
+ export declare const NineSliceSprite: (props: Omit<Pixi.NineSliceSpriteOptions, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY", number>> & Partial<Record<"anchorX" | "anchorY", number>> & {
54
+ ref?: import("solid-js").Ref<Pixi.NineSliceSprite> | undefined;
55
+ as?: Pixi.NineSliceSprite | undefined;
56
+ }) => Pixi.NineSliceSprite & import("solid-js").JSX.Element;
39
57
  /**
40
58
  * A SolidJS component that renders a `PIXI.ParticleContainer`.
41
59
  *
@@ -45,11 +63,14 @@ export declare const ParticleContainer: (props: Omit<Pixi.ParticleContainerOptio
45
63
  /**
46
64
  * A SolidJS component that renders a `PIXI.PerspectiveMesh`.
47
65
  */
48
- export declare const PerspectiveMesh: (props: Omit<Pixi.PerspectivePlaneOptions, "children"> & import("./component-factories").LeafProps<Pixi.PerspectiveMesh>) => Pixi.PerspectiveMesh & import("solid-js").JSX.Element;
66
+ export declare const PerspectiveMesh: (props: Omit<Pixi.PerspectivePlaneOptions, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY", number>> & Partial<Record<"anchorX" | "anchorY", number>> & {
67
+ ref?: import("solid-js").Ref<Pixi.PerspectiveMesh> | undefined;
68
+ as?: Pixi.PerspectiveMesh | undefined;
69
+ }) => Pixi.PerspectiveMesh & import("solid-js").JSX.Element;
49
70
  /**
50
71
  * A SolidJS component that renders a `PIXI.RenderContainer`.
51
72
  */
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>> & {
73
+ export declare const RenderContainer: (props: Omit<Pixi.RenderContainerOptions, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY", number>> & {
53
74
  ref?: import("solid-js").Ref<Pixi.RenderContainer> | undefined;
54
75
  as?: Pixi.RenderContainer | undefined;
55
76
  children?: import("solid-js").JSX.Element;
@@ -57,7 +78,7 @@ export declare const RenderContainer: (props: Omit<Pixi.RenderContainerOptions,
57
78
  /**
58
79
  * A SolidJS component that renders a `PIXI.RenderLayer`.
59
80
  */
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>> & {
81
+ export declare const RenderLayer: (props: Omit<Pixi.RenderLayerOptions, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY", number>> & {
61
82
  ref?: import("solid-js").Ref<Pixi.RenderLayer> | undefined;
62
83
  as?: Pixi.RenderLayer | undefined;
63
84
  children?: import("solid-js").JSX.Element;
@@ -65,12 +86,21 @@ export declare const RenderLayer: (props: Omit<Pixi.RenderLayerOptions, "childre
65
86
  /**
66
87
  * A SolidJS component that renders a `PIXI.Sprite`.
67
88
  */
68
- export declare const Sprite: (props: Omit<Pixi.SpriteOptions, "children"> & import("./component-factories").LeafProps<Pixi.Sprite>) => Pixi.Sprite & import("solid-js").JSX.Element;
89
+ export declare const Sprite: (props: Omit<Pixi.SpriteOptions, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY", number>> & Partial<Record<"anchorX" | "anchorY", number>> & {
90
+ ref?: import("solid-js").Ref<Pixi.Sprite> | undefined;
91
+ as?: Pixi.Sprite | undefined;
92
+ }) => Pixi.Sprite & import("solid-js").JSX.Element;
69
93
  /**
70
94
  * A SolidJS component that renders a `PIXI.Text`.
71
95
  */
72
- export declare const Text: (props: Omit<Pixi.CanvasTextOptions, "children"> & import("./component-factories").LeafProps<Pixi.Text>) => Pixi.Text & import("solid-js").JSX.Element;
96
+ export declare const Text: (props: Omit<Pixi.CanvasTextOptions, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY", number>> & Partial<Record<"anchorX" | "anchorY", number>> & {
97
+ ref?: import("solid-js").Ref<Pixi.Text> | undefined;
98
+ as?: Pixi.Text | undefined;
99
+ }) => Pixi.Text & import("solid-js").JSX.Element;
73
100
  /**
74
101
  * A SolidJS component that renders a `PIXI.TilingSprite`.
75
102
  */
76
- export declare const TilingSprite: (props: Omit<Pixi.TilingSpriteOptions, "children"> & import("./component-factories").LeafProps<Pixi.TilingSprite>) => Pixi.TilingSprite & import("solid-js").JSX.Element;
103
+ export declare const TilingSprite: (props: Omit<Pixi.TilingSpriteOptions, "children"> & import("./bind-props").PixiEventHandlerMap & Partial<Record<"positionX" | "positionY" | "scaleX" | "scaleY" | "pivotX" | "pivotY" | "skewX" | "skewY", number>> & Partial<Record<"anchorX" | "anchorY", number>> & Partial<Record<"tilePositionX" | "tilePositionY" | "tileScaleX" | "tileScaleY", number>> & {
104
+ ref?: import("solid-js").Ref<Pixi.TilingSprite> | undefined;
105
+ as?: Pixi.TilingSprite | undefined;
106
+ }) => Pixi.TilingSprite & import("solid-js").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  export { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, NineSliceSprite, ParticleContainer, PerspectiveMesh, Sprite, Text, RenderContainer, RenderLayer, TilingSprite, } from "./components";
2
2
  export { PIXI_EVENT_NAMES, PIXI_SOLID_EVENT_HANDLER_NAMES, bindRuntimeProps, bindInitialisationProps, } from "./bind-props";
3
- export type { PixiEventHandlerMap, PointAxisPropName } from "./bind-props";
4
- export type { ContainerProps, LeafProps, PixiComponentProps } from "./component-factories";
3
+ export type { PixiEventHandlerMap, PointAxisPropName, CommonPointAxisPropName, AnchorPointAxisPropName, TilingPointAxisPropName, } from "./bind-props";
4
+ export type { ContainerProps, LeafProps, SpriteProps, TilingSpriteProps, PixiComponentProps, CommonPointAxisProps, AnchorPointAxisProps, TilingPointAxisProps, } from "./component-factories";
5
+ export { createContainerComponent, createLeafComponent, createSpriteComponent, createTilingSpriteComponent, createFilterComponent, } from "./component-factories";
@@ -1,5 +1,4 @@
1
- export type { ContainerProps, LeafProps, PixiComponentProps } from "./components";
2
- export type { PixiEventHandlerMap } from "./components";
1
+ export type { ContainerProps, LeafProps, SpriteProps, TilingSpriteProps, PixiComponentProps, CommonPointAxisProps, AnchorPointAxisProps, TilingPointAxisProps, PixiEventHandlerMap, PointAxisPropName, CommonPointAxisPropName, AnchorPointAxisPropName, TilingPointAxisPropName, } from "./components";
3
2
  export { PIXI_EVENT_NAMES, PIXI_SOLID_EVENT_HANDLER_NAMES } from "./components";
4
3
  export { onResize } from "./on-resize";
5
4
  export { onTick } from "./on-tick";
@@ -8,7 +7,6 @@ export { getPixiApp, getTicker, PixiApplicationProvider, TickerProvider } from "
8
7
  export { createAsyncDelay, delay } from "./delay";
9
8
  export type { PixiCanvasProps } from "./pixi-canvas";
10
9
  export { PixiCanvas } from "./pixi-canvas";
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";
10
+ export { AnimatedSprite, BitmapText, Container, Graphics, HTMLText, MeshPlane, MeshRope, NineSliceSprite, ParticleContainer, PerspectiveMesh, RenderContainer, RenderLayer, Sprite, Text, TilingSprite, } from "./components";
13
11
  export { usePixiScreen } from "./use-pixi-screen";
14
12
  export type { PixiScreenDimensions } from "./use-pixi-screen";
@@ -11,6 +11,7 @@ import type * as Pixi from "pixi.js";
11
11
  *
12
12
  * @param tickerCallback - The function to call on each ticker update. It receives
13
13
  * the `Pixi.Ticker` instance as its argument.
14
+ * @param priority - An optional priority level for the ticker callback.
14
15
  *
15
16
  */
16
- export declare const onTick: (tickerCallback: Pixi.TickerCallback<Pixi.Ticker>) => void;
17
+ export declare const onTick: (tickerCallback: Pixi.TickerCallback<Pixi.Ticker>, priority?: Pixi.UPDATE_PRIORITY) => void;
@@ -24,7 +24,8 @@ export type TickerProviderProps = ParentProps<{
24
24
  ticker: Pixi.Ticker;
25
25
  }>;
26
26
  /**
27
- * 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.
27
+ * This is only required if you want a ticker without the Pixi Application.
28
+ * For applications that want to use multiple tickers or for testing a store that relies on the ticker related utilities.
28
29
  * It provides context for the `onTick`, `delay`, `createAsyncDelay` and `getTicker` utilities.
29
30
  *
30
31
  * 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixi-solid",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "private": false,
5
5
  "description": "A library to write PixiJS applications with SolidJS",
6
6
  "homepage": "https://lukecarlthompson.github.io/pixi-solid/",