pixi-solid 0.0.7 → 0.0.9

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 +1 @@
1
- {"version":3,"file":"pixi-components.js","names":["Pixi","AnimatedSprite","PixiAnimatedSprite","BitmapText","PixiBitmapText","Container","PixiContainer","Graphics","PixiGraphics","HTMLText","PixiHTMLText","MeshPlane","PixiMeshPlane","MeshRope","PixiMeshRope","MeshSimple","PixiMeshSimple","NineSliceSprite","PixiNineSliceSprite","ParticleContainer","PixiParticleContainer","PerspectiveMesh","PixiPerspectiveMesh","RenderContainer","PixiRenderContainer","RenderLayer","PixiRenderLayer","Sprite","PixiSprite","Text","PixiText","TilingSprite","PixiTilingSprite","JSX","Ref","createRenderEffect","splitProps","PixiEventHandlerMap","PIXI_EVENT_HANDLER_NAMES","insert","setProp","ContainerProps","ref","Component","as","children","Element","LeafProps","Omit","SOLID_PROP_KEYS","const","applyProps","InstanceType","instance","props","OptionsType","key","arg","Error","createContainerComponent","PixiClass","runtimeProps","initialisationProps","createLeafComponent","AnimatedSpriteOptions","TextOptions","ContainerOptions","GraphicsOptions","HTMLTextOptions","MeshPlaneOptions","MeshRopeOptions","SimpleMeshOptions","NineSliceSpriteOptions","ParticleContainerOptions","PerspectivePlaneOptions","RenderContainerOptions","RenderLayerOptions","SpriteOptions","CanvasTextOptions","TilingSpriteOptions"],"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 MeshSimple as PixiMeshSimple,\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 type { JSX, Ref } from \"solid-js\";\nimport { createRenderEffect, splitProps } from \"solid-js\";\nimport type { PixiEventHandlerMap } from \"./pixi-events\";\n\nimport { PIXI_EVENT_HANDLER_NAMES } from \"./pixi-events\";\nimport { insert, setProp } from \"./renderer\";\n\n/**\n * Prop definition for components that CAN have children\n */\nexport type ContainerProps<Component> = PixiEventHandlerMap & {\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// 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 */\nexport const applyProps = <\n InstanceType extends PixiContainer,\n OptionsType extends ContainerProps<InstanceType>,\n>(\n instance: InstanceType,\n props: OptionsType,\n) => {\n for (const key in props) {\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 if (!(\"addChild\" in instance)) {\n throw new Error(`Cannot set children on non-container instance.`);\n }\n createRenderEffect(() => {\n insert(instance, () => props.children);\n });\n } else {\n createRenderEffect(() => {\n setProp(instance, key, props[key as keyof typeof props]);\n });\n }\n }\n};\n\nconst createContainerComponent = <InstanceType extends PixiContainer, OptionsType extends object>(\n PixiClass: new (props: OptionsType) => InstanceType,\n) => {\n return (props: Omit<OptionsType, \"children\"> & ContainerProps<InstanceType>): JSX.Element => {\n const [runtimeProps, initialisationProps] = splitProps(props, [\n ...SOLID_PROP_KEYS,\n ...PIXI_EVENT_HANDLER_NAMES,\n ]);\n\n const instance = props.as || new PixiClass(initialisationProps as any);\n\n applyProps(instance, initialisationProps);\n applyProps(instance, runtimeProps);\n\n return instance as unknown as JSX.Element;\n };\n};\n\nconst createLeafComponent = <InstanceType extends PixiContainer, OptionsType extends object>(\n PixiClass: new (props: OptionsType) => InstanceType,\n) => {\n return (props: Omit<OptionsType, \"children\"> & LeafProps<InstanceType>): JSX.Element => {\n return createContainerComponent<PixiContainer, OptionsType>(PixiClass)(props as any);\n };\n};\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.MeshSimple`.\n */\nexport const MeshSimple = createLeafComponent<PixiMeshSimple, Pixi.SimpleMeshOptions>(\n PixiMeshSimple,\n);\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// export const NineSliceGeometry = createLeafComponent<PixiNineSliceGeometry, Pixi.NineSliceGeometryOptions>(\n// PixiNineSliceGeometry\n// );\n\n// export const Particle = createLeafComponent<PixiParticle, Pixi.ParticleOptions>(PixiParticle);\n// export const PerspectivePlaneGeometry = createLeafComponent<\n// PixiPerspectivePlaneGeometry,\n// Pixi.PerspectivePlaneGeometryOptions\n// >(PixiPerspectivePlaneGeometry);\n// export const PlaneGeometry = createLeafComponent<PixiPlaneGeometry, Pixi.PlaneGeometryOptions>(PixiPlaneGeometry);\n// export const RopeGeometry = createLeafComponent<PixiRopeGeometry, Pixi.RopeGeometryOptions>(PixiRopeGeometry);\n\n// TODO: Don't need a component for the Culler. It needs to interact with the stage directly.\n// export const Culler = createLeafComponent<PixiCuller, Pixi.Culler>(PixiCuller);\n"],"mappings":";;;;;;AAyCA,MAAaiD,kBAAkB;CAAC;CAAO;CAAM;CAAW;;;;;;;AAQxD,MAAaE,cAIXE,UACAC,UACG;AACH,MAAK,MAAME,OAAOF,OAAO;AACvB,MAAIE,QAAQ,KAAM;AAElB,MAAIA,QAAQ,MACVrB,0BAAyB;AAEtBmB,SAAME,KAAuCH,SAAS;IACvD;WACOG,QAAQ,YAAY;AAC7B,OAAI,EAAE,cAAcH,UAClB,OAAM,IAAIK,MAAM,iDAAiD;AAEnEvB,4BAAyB;AACvBI,WAAOc,gBAAgBC,MAAMT,SAAS;KACtC;QAEFV,0BAAyB;AACvBK,WAAQa,UAAUG,KAAKF,MAAME,KAA2B;IACxD;;;AAKR,IAAMG,4BACJC,cACG;AACH,SAAQN,UAAqF;EAC3F,MAAM,CAACO,cAAcC,uBAAuB1B,WAAWkB,OAAO,CAC5D,GAAGL,iBACH,GAAGX,yBACJ,CAAC;EAEF,MAAMe,WAAWC,MAAMV,MAAM,IAAIgB,UAAUE,oBAA2B;AAEtEX,aAAWE,UAAUS,oBAAoB;AACzCX,aAAWE,UAAUQ,aAAa;AAElC,SAAOR;;;AAIX,IAAMU,uBACJH,cACG;AACH,SAAQN,UAAgF;AACtF,SAAOK,yBAAqDC,UAAU,CAACN,MAAa;;;;;;AAOxF,MAAarD,mBAAiB8D,oBAC5B7D,eACD;;;;AAID,MAAaC,eAAa4D,oBAAsD3D,WAAe;;;;AAI/F,MAAaC,cAAYsD,yBACvBrD,UACD;;;;;AAKD,MAAaC,aAAWwD,oBAAwDvD,SAAa;;;;AAI7F,MAAaC,aAAWsD,oBAAwDrD,SAAa;;;;AAK7F,MAAaC,cAAYoD,oBAA0DnD,UAAc;;;;AAKjG,MAAaC,aAAWkD,oBAAwDjD,SAAa;;;;AAK7F,MAAaC,eAAagD,oBACxB/C,WACD;;;;AAKD,MAAaC,oBAAkB8C,oBAG7B7C,gBAAoB;;;;;;AAOtB,MAAaC,sBAAoB4C,oBAG/B3C,kBAAsB;;;;AAKxB,MAAaC,oBAAkB0C,oBAG7BzC,gBAAoB;;;;AAKtB,MAAaC,oBAAkBoC,yBAG7BnC,gBAAoB;;;;AAKtB,MAAaC,gBAAckC,yBACzBjC,YACD;;;;AAKD,MAAaC,WAASoC,oBAAoDnC,OAAW;;;;AAIrF,MAAaC,SAAOkC,oBAAsDjC,KAAS;;;;AAKnF,MAAaC,iBAAegC,oBAC1B/B,aACD"}
1
+ {"version":3,"file":"pixi-components.js","names":["Pixi","AnimatedSprite","PixiAnimatedSprite","BitmapText","PixiBitmapText","Container","PixiContainer","Graphics","PixiGraphics","HTMLText","PixiHTMLText","MeshPlane","PixiMeshPlane","MeshRope","PixiMeshRope","MeshSimple","PixiMeshSimple","NineSliceSprite","PixiNineSliceSprite","ParticleContainer","PixiParticleContainer","PerspectiveMesh","PixiPerspectiveMesh","RenderContainer","PixiRenderContainer","RenderLayer","PixiRenderLayer","Sprite","PixiSprite","Text","PixiText","TilingSprite","PixiTilingSprite","JSX","Ref","createRenderEffect","splitProps","PixiEventHandlerMap","PIXI_EVENT_HANDLER_NAMES","insert","setProp","ContainerProps","ref","Component","as","children","Element","LeafProps","Omit","SOLID_PROP_KEYS","const","applyProps","InstanceType","instance","props","OptionsType","key","arg","Error","createContainerComponent","PixiClass","runtimeProps","initialisationProps","createLeafComponent","AnimatedSpriteOptions","ConstructorParameters","ContainerOptions","GraphicsOptions","HTMLTextOptions","MeshPlaneOptions","MeshRopeOptions","SimpleMeshOptions","NineSliceSpriteOptions","ParticleContainerOptions","PerspectivePlaneOptions","RenderContainerOptions","RenderLayerOptions","SpriteOptions","CanvasTextOptions","TilingSpriteOptions"],"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 MeshSimple as PixiMeshSimple,\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 type { JSX, Ref } from \"solid-js\";\nimport { createRenderEffect, splitProps } from \"solid-js\";\nimport type { PixiEventHandlerMap } from \"./pixi-events\";\n\nimport { PIXI_EVENT_HANDLER_NAMES } from \"./pixi-events\";\nimport { insert, setProp } from \"./renderer\";\n\n/**\n * Prop definition for components that CAN have children\n */\nexport type ContainerProps<Component> = PixiEventHandlerMap & {\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// 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 */\nexport const applyProps = <InstanceType extends PixiContainer, OptionsType extends ContainerProps<InstanceType>>(\n instance: InstanceType,\n props: OptionsType\n) => {\n for (const key in props) {\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 if (!(\"addChild\" in instance)) {\n throw new Error(`Cannot set children on non-container instance.`);\n }\n createRenderEffect(() => {\n insert(instance, () => props.children);\n });\n } else {\n createRenderEffect(() => {\n setProp(instance, key, props[key as keyof typeof props]);\n });\n }\n }\n};\n\nconst createContainerComponent = <InstanceType extends PixiContainer, OptionsType extends object>(\n PixiClass: new (props: OptionsType) => InstanceType\n) => {\n return (props: Omit<OptionsType, \"children\"> & ContainerProps<InstanceType>): JSX.Element => {\n const [runtimeProps, initialisationProps] = splitProps(props, [...SOLID_PROP_KEYS, ...PIXI_EVENT_HANDLER_NAMES]);\n\n const instance = props.as || new PixiClass(initialisationProps as any);\n\n applyProps(instance, initialisationProps);\n applyProps(instance, runtimeProps);\n\n return instance as unknown as JSX.Element;\n };\n};\n\nconst createLeafComponent = <InstanceType extends PixiContainer, OptionsType extends object>(\n PixiClass: new (props: OptionsType) => InstanceType\n) => {\n return (props: Omit<OptionsType, \"children\"> & LeafProps<InstanceType>): JSX.Element => {\n return createContainerComponent<PixiContainer, OptionsType>(PixiClass)(props as any);\n };\n};\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, ConstructorParameters<typeof PixiBitmapText>>(\n PixiBitmapText\n);\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.MeshSimple`.\n */\nexport const MeshSimple = createLeafComponent<PixiMeshSimple, Pixi.SimpleMeshOptions>(PixiMeshSimple);\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// export const NineSliceGeometry = createLeafComponent<PixiNineSliceGeometry, Pixi.NineSliceGeometryOptions>(\n// PixiNineSliceGeometry\n// );\n\n// export const Particle = createLeafComponent<PixiParticle, Pixi.ParticleOptions>(PixiParticle);\n// export const PerspectivePlaneGeometry = createLeafComponent<\n// PixiPerspectivePlaneGeometry,\n// Pixi.PerspectivePlaneGeometryOptions\n// >(PixiPerspectivePlaneGeometry);\n// export const PlaneGeometry = createLeafComponent<PixiPlaneGeometry, Pixi.PlaneGeometryOptions>(PixiPlaneGeometry);\n// export const RopeGeometry = createLeafComponent<PixiRopeGeometry, Pixi.RopeGeometryOptions>(PixiRopeGeometry);\n\n// TODO: Don't need a component for the Culler. It needs to interact with the stage directly.\n// export const Culler = createLeafComponent<PixiCuller, Pixi.Culler>(PixiCuller);\n"],"mappings":";;;;;;AAyCA,MAAaiD,kBAAkB;CAAC;CAAO;CAAM;CAAW;;;;;;;AAQxD,MAAaE,cACXE,UACAC,UACG;AACH,MAAK,MAAME,OAAOF,OAAO;AACvB,MAAIE,QAAQ,KAAM;AAElB,MAAIA,QAAQ,MACVrB,0BAAyB;AAEtBmB,SAAME,KAAuCH,SAAS;IACvD;WACOG,QAAQ,YAAY;AAC7B,OAAI,EAAE,cAAcH,UAClB,OAAM,IAAIK,MAAM,iDAAiD;AAEnEvB,4BAAyB;AACvBI,WAAOc,gBAAgBC,MAAMT,SAAS;KACtC;QAEFV,0BAAyB;AACvBK,WAAQa,UAAUG,KAAKF,MAAME,KAA2B;IACxD;;;AAKR,IAAMG,4BACJC,cACG;AACH,SAAQN,UAAqF;EAC3F,MAAM,CAACO,cAAcC,uBAAuB1B,WAAWkB,OAAO,CAAC,GAAGL,iBAAiB,GAAGX,yBAAyB,CAAC;EAEhH,MAAMe,WAAWC,MAAMV,MAAM,IAAIgB,UAAUE,oBAA2B;AAEtEX,aAAWE,UAAUS,oBAAoB;AACzCX,aAAWE,UAAUQ,aAAa;AAElC,SAAOR;;;AAIX,IAAMU,uBACJH,cACG;AACH,SAAQN,UAAgF;AACtF,SAAOK,yBAAqDC,UAAU,CAACN,MAAa;;;;;;AAOxF,MAAarD,mBAAiB8D,oBAAoE7D,eAAmB;;;;AAIrH,MAAaC,eAAa4D,oBACxB3D,WACD;;;;AAID,MAAaC,cAAYsD,yBAA+DrD,UAAc;;;;;AAKtG,MAAaC,aAAWwD,oBAAwDvD,SAAa;;;;AAI7F,MAAaC,aAAWsD,oBAAwDrD,SAAa;;;;AAK7F,MAAaC,cAAYoD,oBAA0DnD,UAAc;;;;AAKjG,MAAaC,aAAWkD,oBAAwDjD,SAAa;;;;AAK7F,MAAaC,eAAagD,oBAA4D/C,WAAe;;;;AAKrG,MAAaC,oBAAkB8C,oBAC7B7C,gBACD;;;;;;AAOD,MAAaC,sBAAoB4C,oBAC/B3C,kBACD;;;;AAKD,MAAaC,oBAAkB0C,oBAC7BzC,gBACD;;;;AAKD,MAAaC,oBAAkBoC,yBAC7BnC,gBACD;;;;AAKD,MAAaC,gBAAckC,yBAAmEjC,YAAgB;;;;AAK9G,MAAaC,WAASoC,oBAAoDnC,OAAW;;;;AAIrF,MAAaC,SAAOkC,oBAAsDjC,KAAS;;;;AAKnF,MAAaC,iBAAegC,oBAAgE/B,aAAiB"}
@@ -32,7 +32,37 @@ const PIXI_EVENT_NAMES = [
32
32
  "wheel",
33
33
  "globalmousemove",
34
34
  "globalpointermove",
35
- "globaltouchmove"
35
+ "globaltouchmove",
36
+ "clickcapture",
37
+ "mousedowncapture",
38
+ "mouseentercapture",
39
+ "mouseleavecapture",
40
+ "mousemovecapture",
41
+ "mouseoutcapture",
42
+ "mouseovercapture",
43
+ "mouseupcapture",
44
+ "mouseupoutsidecapture",
45
+ "pointercancelcapture",
46
+ "pointerdowncapture",
47
+ "pointerentercapture",
48
+ "pointerleavecapture",
49
+ "pointermovecapture",
50
+ "pointeroutcapture",
51
+ "pointerovercapture",
52
+ "pointertapcapture",
53
+ "pointerupcapture",
54
+ "pointerupoutsidecapture",
55
+ "rightclickcapture",
56
+ "rightdowncapture",
57
+ "rightupcapture",
58
+ "rightupoutsidecapture",
59
+ "tapcapture",
60
+ "touchcancelcapture",
61
+ "touchendcapture",
62
+ "touchendoutsidecapture",
63
+ "touchmovecapture",
64
+ "touchstartcapture",
65
+ "wheelcapture"
36
66
  ];
37
67
  const PIXI_EVENT_HANDLER_NAMES = PIXI_EVENT_NAMES.map((eventName) => `on${eventName}`);
38
68
  const PIXI_EVENT_HANDLER_NAME_SET = new Set(PIXI_EVENT_HANDLER_NAMES);
@@ -1 +1 @@
1
- {"version":3,"file":"pixi-events.js","names":["PIXI_EVENT_NAMES: (keyof AllFederatedEventMap)[]","PIXI_EVENT_HANDLER_NAME_SET: Readonly<Set<(typeof PIXI_EVENT_HANDLER_NAMES)[number]>>","allEventsAreHandled: AllEventsAreHandled"],"sources":["../src/pixi-events.ts"],"sourcesContent":["import type { AllFederatedEventMap } from \"pixi.js\";\n\nexport const PIXI_EVENT_NAMES: (keyof AllFederatedEventMap)[] = [\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] as const;\n\nexport const PIXI_EVENT_HANDLER_NAMES = PIXI_EVENT_NAMES.map(\n (eventName) => `on${eventName}` as const,\n);\n\nexport type PixiEventHandlerMap = {\n [K in (typeof PIXI_EVENT_NAMES)[number] as `on${K}`]?: (event: AllFederatedEventMap[K]) => void;\n};\n\nexport const PIXI_EVENT_HANDLER_NAME_SET: Readonly<Set<(typeof PIXI_EVENT_HANDLER_NAMES)[number]>> =\n new Set(PIXI_EVENT_HANDLER_NAMES);\n\n/**\n * This is a type-safe check that ensures `PIXI_EVENT_NAMES` includes every key from Pixi's `AllFederatedEventMap` type.\n * It will cause a build error if any event names are missing.\n */\ntype MissingKeys = Exclude<keyof AllFederatedEventMap, (typeof PIXI_EVENT_NAMES)[number]>;\ntype AllEventsAreHandled = MissingKeys extends never\n ? true\n : `Error: Missing event keys: ${MissingKeys}`;\nconst allEventsAreHandled: AllEventsAreHandled = true;\nvoid allEventsAreHandled;\n"],"mappings":";AAEA,MAAaA,mBAAmD;CAC9D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,2BAA2B,iBAAiB,KACtD,cAAc,KAAK,YACrB;AAMD,MAAaC,8BACX,IAAI,IAAI,yBAAyB"}
1
+ {"version":3,"file":"pixi-events.js","names":["PIXI_EVENT_NAMES: (keyof FederatedEventEmitterTypes)[]","PIXI_EVENT_HANDLER_NAME_SET: Readonly<Set<(typeof PIXI_EVENT_HANDLER_NAMES)[number]>>","allEventsAreHandled: AllEventsAreHandled"],"sources":["../src/pixi-events.ts"],"sourcesContent":["import type { FederatedEventEmitterTypes } from \"pixi.js\";\n\nexport const PIXI_EVENT_NAMES: (keyof FederatedEventEmitterTypes)[] = [\n \"click\",\n \"mousedown\",\n \"mouseenter\",\n \"mouseleave\",\n \"mousemove\",\n \"mouseout\",\n \"mouseover\",\n \"mouseup\",\n \"mouseupoutside\",\n \"pointercancel\",\n \"pointerdown\",\n \"pointerenter\",\n \"pointerleave\",\n \"pointermove\",\n \"pointerout\",\n \"pointerover\",\n \"pointertap\",\n \"pointerup\",\n \"pointerupoutside\",\n \"rightclick\",\n \"rightdown\",\n \"rightup\",\n \"rightupoutside\",\n \"tap\",\n \"touchcancel\",\n \"touchend\",\n \"touchendoutside\",\n \"touchmove\",\n \"touchstart\",\n \"wheel\",\n \"globalmousemove\",\n \"globalpointermove\",\n \"globaltouchmove\",\n \"clickcapture\",\n \"mousedowncapture\",\n \"mouseentercapture\",\n \"mouseleavecapture\",\n \"mousemovecapture\",\n \"mouseoutcapture\",\n \"mouseovercapture\",\n \"mouseupcapture\",\n \"mouseupoutsidecapture\",\n \"pointercancelcapture\",\n \"pointerdowncapture\",\n \"pointerentercapture\",\n \"pointerleavecapture\",\n \"pointermovecapture\",\n \"pointeroutcapture\",\n \"pointerovercapture\",\n \"pointertapcapture\",\n \"pointerupcapture\",\n \"pointerupoutsidecapture\",\n \"rightclickcapture\",\n \"rightdowncapture\",\n \"rightupcapture\",\n \"rightupoutsidecapture\",\n \"tapcapture\",\n \"touchcancelcapture\",\n \"touchendcapture\",\n \"touchendoutsidecapture\",\n \"touchmovecapture\",\n \"touchstartcapture\",\n \"wheelcapture\",\n] as const;\n\nexport const PIXI_EVENT_HANDLER_NAMES = PIXI_EVENT_NAMES.map(\n (eventName) => `on${eventName}` as const,\n);\n\nexport type PixiEventHandlerMap = {\n [K in (typeof PIXI_EVENT_NAMES)[number] as `on${K}`]?:\n | null\n | ((...args: FederatedEventEmitterTypes[K]) => void);\n};\n\nexport const PIXI_EVENT_HANDLER_NAME_SET: Readonly<Set<(typeof PIXI_EVENT_HANDLER_NAMES)[number]>> =\n new Set(PIXI_EVENT_HANDLER_NAMES);\n\n/**\n * This is a type-safe check that ensures `PIXI_EVENT_NAMES` includes every key from Pixi's `AllFederatedEventMap` type.\n * It will cause a build error if any event names are missing.\n */\ntype MissingKeys = Exclude<keyof FederatedEventEmitterTypes, (typeof PIXI_EVENT_NAMES)[number]>;\ntype AllEventsAreHandled = MissingKeys extends never\n ? true\n : `Error: Missing event keys: ${MissingKeys}`;\nconst allEventsAreHandled: AllEventsAreHandled = true;\nvoid allEventsAreHandled;\n"],"mappings":";AAEA,MAAaA,mBAAyD;CACpE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,2BAA2B,iBAAiB,KACtD,cAAc,KAAK,YACrB;AAQD,MAAaC,8BACX,IAAI,IAAI,yBAAyB"}
@@ -29,7 +29,7 @@ export declare const AnimatedSprite: (props: Omit<Pixi.AnimatedSpriteOptions, "c
29
29
  /**
30
30
  * A SolidJS component that renders a `PIXI.BitmapText`.
31
31
  */
32
- export declare const BitmapText: (props: Omit<Pixi.TextOptions<Pixi.TextStyle, Pixi.TextStyleOptions>, "children"> & LeafProps<Pixi.BitmapText>) => JSX.Element;
32
+ export declare const BitmapText: (props: Omit<[text?: Pixi.TextString | undefined, options?: Partial<Pixi.TextStyle> | undefined], "children"> & LeafProps<Pixi.BitmapText>) => JSX.Element;
33
33
  /**
34
34
  * A SolidJS component that renders a `PIXI.Container`.
35
35
  */
@@ -1,7 +1,7 @@
1
- import type { AllFederatedEventMap } from "pixi.js";
2
- export declare const PIXI_EVENT_NAMES: (keyof AllFederatedEventMap)[];
3
- export declare const PIXI_EVENT_HANDLER_NAMES: ("onclick" | "onmousedown" | "onmouseenter" | "onmouseleave" | "onmousemove" | "onmouseout" | "onmouseover" | "onmouseup" | "onmouseupoutside" | "onpointercancel" | "onpointerdown" | "onpointerenter" | "onpointerleave" | "onpointermove" | "onpointerout" | "onpointerover" | "onpointertap" | "onpointerup" | "onpointerupoutside" | "onrightclick" | "onrightdown" | "onrightup" | "onrightupoutside" | "ontap" | "ontouchcancel" | "ontouchend" | "ontouchendoutside" | "ontouchmove" | "ontouchstart" | "onwheel" | "onglobalmousemove" | "onglobalpointermove" | "onglobaltouchmove")[];
1
+ import type { FederatedEventEmitterTypes } from "pixi.js";
2
+ export declare const PIXI_EVENT_NAMES: (keyof FederatedEventEmitterTypes)[];
3
+ export declare const PIXI_EVENT_HANDLER_NAMES: ("onclick" | "onmousedown" | "onmouseenter" | "onmouseleave" | "onmousemove" | "onmouseout" | "onmouseover" | "onmouseup" | "onmouseupoutside" | "onpointercancel" | "onpointerdown" | "onpointerenter" | "onpointerleave" | "onpointermove" | "onpointerout" | "onpointerover" | "onpointertap" | "onpointerup" | "onpointerupoutside" | "onrightclick" | "onrightdown" | "onrightup" | "onrightupoutside" | "ontap" | "ontouchcancel" | "ontouchend" | "ontouchendoutside" | "ontouchmove" | "ontouchstart" | "onwheel" | "onglobalmousemove" | "onglobalpointermove" | "onglobaltouchmove" | "onclickcapture" | "onmousedowncapture" | "onmouseentercapture" | "onmouseleavecapture" | "onmousemovecapture" | "onmouseoutcapture" | "onmouseovercapture" | "onmouseupcapture" | "onmouseupoutsidecapture" | "onpointercancelcapture" | "onpointerdowncapture" | "onpointerentercapture" | "onpointerleavecapture" | "onpointermovecapture" | "onpointeroutcapture" | "onpointerovercapture" | "onpointertapcapture" | "onpointerupcapture" | "onpointerupoutsidecapture" | "onrightclickcapture" | "onrightdowncapture" | "onrightupcapture" | "onrightupoutsidecapture" | "ontapcapture" | "ontouchcancelcapture" | "ontouchendcapture" | "ontouchendoutsidecapture" | "ontouchmovecapture" | "ontouchstartcapture" | "onwheelcapture")[];
4
4
  export type PixiEventHandlerMap = {
5
- [K in (typeof PIXI_EVENT_NAMES)[number] as `on${K}`]?: (event: AllFederatedEventMap[K]) => void;
5
+ [K in (typeof PIXI_EVENT_NAMES)[number] as `on${K}`]?: null | ((...args: FederatedEventEmitterTypes[K]) => void);
6
6
  };
7
7
  export declare const PIXI_EVENT_HANDLER_NAME_SET: Readonly<Set<(typeof PIXI_EVENT_HANDLER_NAMES)[number]>>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pixi-solid",
3
3
  "private": false,
4
- "version": "0.0.7",
4
+ "version": "0.0.9",
5
5
  "description": "A library to write PixiJS applications with SolidJS",
6
6
  "author": "Luke Thompson",
7
7
  "license": "MIT",
@@ -22,17 +22,16 @@
22
22
  "README.md",
23
23
  "LICENSE"
24
24
  ],
25
+ "peerDependencies": {
26
+ "pixi.js": "^8.14.3",
27
+ "solid-js": "^1.9.10"
28
+ },
25
29
  "scripts": {
26
30
  "dev": "vite",
27
31
  "prebuild": "rm -rf dist",
28
32
  "build": "vite build && tsc --project tsconfig.build.json --emitDeclarationOnly",
29
33
  "build:docs": "typedoc --options typedoc.config.js",
30
- "prepublishOnly": "pnpm run build",
31
34
  "preview": "vite preview",
32
35
  "preinstall": "npx only-allow pnpm"
33
- },
34
- "peerDependencies": {
35
- "pixi.js": "^8.14.3",
36
- "solid-js": "^1.9.10"
37
36
  }
38
- }
37
+ }