Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

phavuer

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

phavuer - npm Package Compare versions

Comparing version 0.10.1 to 0.10.2

2

dist/phavuer.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("Vue")):"function"==typeof define&&define.amd?define(["Vue"],t):"object"==typeof exports?exports.Phavuer=t(require("Vue")):e.Phavuer=t(e.Vue)}(this,(e=>(()=>{"use strict";var t={744:(e,t)=>{t.Z=(e,t)=>{const i=e.__vccOpts||e;for(const[e,n]of t)i[e]=n;return i}},740:t=>{t.exports=e}},i={};function n(e){var r=i[e];if(void 0!==r)return r.exports;var o=i[e]={exports:{}};return t[e](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{n.r(r),n.d(r,{Body:()=>I,Circle:()=>S,Container:()=>m,Image:()=>k,InjectionKeys:()=>D,Light:()=>G,Line:()=>j,Rectangle:()=>f,RoundRectangle:()=>v,Scene:()=>p,Sprite:()=>X,StaticBody:()=>W,Text:()=>N,TilemapLayer:()=>_,Zone:()=>A,createPhavuerApp:()=>Z,initGameObject:()=>V,onPostUpdate:()=>J,onPreUpdate:()=>K,refObj:()=>z,refScene:()=>H,refTo:()=>M,useGame:()=>$,useScene:()=>L});var e=n(740);const t=["pointerdown","pointermove","pointerup","pointerout","wheel"],i=e=>{e.updateDisplayOrigin&&e.updateDisplayOrigin(),e.input?e.input.hitArea.setSize(e.width,e.height):e._events&&t.some((t=>t in e._events))&&e.setInteractive()},o=["tween","tweens","timeline","style"],s={active:e=>t=>e.setActive(t),visible:e=>t=>e.setVisible(t),x:e=>t=>e.x=t,_x:e=>t=>e._x=t,y:e=>t=>e.y=t,_y:e=>t=>e._y=t,x1:e=>t=>e.x1=t,y1:e=>t=>e.y1=t,x2:e=>t=>e.x2=t,y2:e=>t=>e.y2=t,rotation:e=>t=>e.setRotation(t),origin:e=>t=>e.setOrigin(t,t),originX:e=>t=>e.setOrigin(t,e.originY),originY:e=>t=>e.setOrigin(e.originX,t),scale:e=>t=>e.setScale(t,t),scaleX:e=>t=>e.setScale(t,e.scaleY),scaleY:e=>t=>e.setScale(e.scaleX,t),width:e=>t=>{e.setSize(t,e.height),i(e)},height:e=>t=>{e.setSize(e.width,t),i(e)},radius:e=>t=>e.setRadius(t),displayWidth:e=>t=>e.setDisplaySize(t,e.displayHeight),displayHeight:e=>t=>e.setDisplaySize(e.displayWidth,t),displayOriginX:e=>t=>e.setDisplayOrigin(t,e.displayOriginY),displayOriginY:e=>t=>e.setDisplayOrigin(e.displayOriginX,t),flipX:e=>t=>e.setFlipX(t),flipY:e=>t=>e.setFlipY(t),depth:e=>t=>e.setDepth(t),alpha:e=>t=>e.setAlpha(t),blendMode:e=>t=>e.setBlendMode(t),pipeline:e=>t=>e.setPipeline(t),intensity:e=>t=>e.setIntensity(t),tint:e=>t=>e.setTint(t),text:e=>t=>e.setText(t),texture:e=>t=>e.setTexture(t,e.frame&&e.frame.name),frame:e=>t=>e.setFrame(t),color:e=>t=>e.setColor(t),fillColor:e=>t=>e.setFillStyle(t,e.fillAlpha),fillAlpha:e=>t=>e.setFillStyle(e.fillColor,t),lineWidth:e=>(t,i)=>{e.setLineWidth?e.setLineWidth(t,i):e.setStrokeStyle(...t?[t,e.strokeColor,e.strokeAlpha]:[])},strokeColor:e=>t=>e.setStrokeStyle(e.lineWidth,t,e.strokeAlpha),strokeAlpha:e=>t=>e.setStrokeStyle(e.lineWidth,e.strokeColor,t),style:e=>t=>e.setStyle(t),lineSpacing:e=>t=>e.setLineSpacing(t),padding:e=>t=>e.setPadding(t),collision:e=>t=>e.setCollision(t),collisionByProperty:e=>t=>e.setCollisionByProperty(t),enable:e=>t=>e.enable=t,immovable:e=>t=>e.setImmovable(t),moves:e=>t=>e.moves=t,bounceX:e=>t=>e.setBounceX(t),bounceY:e=>t=>e.setBounceY(t),drag:e=>t=>e.setDrag(t),dragX:e=>t=>e.setDragX(t),dragY:e=>t=>e.setDragY(t),gravityX:e=>t=>e.setGravityX(t),gravityY:e=>t=>e.setGravityY(t),frictionX:e=>t=>e.setFrictionX(t),frictionY:e=>t=>e.setFrictionY(t),velocityX:e=>t=>e.setVelocityX(t),velocityY:e=>t=>e.setVelocityY(t),maxVelocityX:e=>t=>e.setMaxVelocityX(t),maxVelocityY:e=>t=>e.setMaxVelocityY(t),accelerationX:e=>t=>e.setAccelerationX(t),accelerationY:e=>t=>e.setAccelerationY(t),offsetX:e=>t=>e.setOffset(t,e.offset.y),offsetY:e=>t=>e.setOffset(e.offset.x,t),tween:e=>t=>{e.tween&&e.tween.stop(),t&&(e.tween=e.scene.add.tween(Object.assign({targets:e},t)))},tweens:e=>t=>{e.tween&&e.tween.stop(),t&&(e.tween=e.scene.tweens.timeline({targets:e,tweens:t}))},timeline:e=>t=>{e.tween&&e.tween.stop(),t&&(e.tween=e.scene.tweens.timeline(Object.assign({targets:e},t)))}},l=(0,e.defineComponent)({props:{name:{type:String,required:!0},autoStart:{type:Boolean,default:!0}},setup(t,i){const n=(0,e.ref)(!1),r=[],o=[],s=class extends Phaser.Scene{init(e){i.emit("init",this,e)}create(e){n.value=!0,i.emit("create",this,e)}update(e,t){r.forEach((i=>i(e,t))),i.emit("update",this,e,t),o.forEach((i=>i(e,t)))}preload(){i.emit("preload",this)}},l=(0,e.inject)(D.Game).scene.add(t.name,s,t.autoStart);return l.events.on("shutdown",(()=>n.value=!1)),(0,e.provide)(D.Scene,l),(0,e.provide)(D.PreUpdateEvents,r),(0,e.provide)(D.PostUpdateEvents,o),{scene:l,show:n}}});var a=n(744);const p=(0,a.Z)(l,[["render",function(t,i,n,r,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[t.show?(0,e.renderSlot)(t.$slots,"default",{key:0}):(0,e.createCommentVNode)("v-if",!0)])}]]),h={active:{type:Boolean},visible:{type:Boolean},x:{type:Number},y:{type:Number},x1:{type:Number},y1:{type:Number},x2:{type:Number},y2:{type:Number},rotation:{type:Number},origin:{type:Number},originX:{type:Number},originY:{type:Number},scale:{type:Number},scaleX:{type:Number},scaleY:{type:Number},width:{type:Number},height:{type:Number},radius:{type:Number},displayWidth:{type:Number},displayHeight:{type:Number},displayOriginX:{type:Number},displayOriginY:{type:Number},flipX:{type:Boolean},flipY:{type:Boolean},depth:{type:Number},alpha:{type:Number},blendMode:{type:[Number,String]},pipeline:{type:[String,Object]},intensity:{type:Number},tint:{type:Number},text:{type:[String,Number]},texture:{type:String},frame:{type:[Number,String]},color:{type:String},fillColor:{type:Number},fillAlpha:{type:Number},lineWidth:{type:Number},strokeColor:{type:Number},strokeAlpha:{type:Number},style:{type:Object},lineSpacing:{type:Number},padding:{type:[Number,Object]},collision:{type:[Number,Array]},collisionByProperty:{type:Object},enable:{type:Boolean},immovable:{type:Boolean},moves:{type:Boolean},bounceX:{type:Number},bounceY:{type:Number},drag:{type:Number},dragX:{type:Number},dragY:{type:Number},gravityX:{type:Number},gravityY:{type:Number},frictionX:{type:Number},frictionY:{type:Number},velocityX:{type:Number},velocityY:{type:Number},maxVelocityX:{type:Number},maxVelocityY:{type:Number},accelerationX:{type:Number},accelerationY:{type:Number},offsetX:{type:Number},offsetY:{type:Number},tween:{type:Object},tweens:{type:Array},timeline:{type:Object}},c=Object.entries(h),d=(...e)=>{const t=new Set(e);return Object.fromEntries(c.filter((([e])=>t.has(e))))},u=d("tween","tweens","timeline","visible","x","y","rotation","origin","originX","originY","displayOriginX","displayOriginY","scale","scaleX","scaleY","displayWidth","displayHeight","depth","alpha","blendMode","pipeline"),y=(0,e.defineComponent)({props:{...u},setup(t,i){const n=(0,e.inject)(D.Scene),r=new Phaser.GameObjects.Container(n,t.x||0,t.y||0);return V(r,t,i),(0,e.provide)(D.Container,r),(0,e.provide)(D.GameObject,r),{object:r}}}),m=(0,a.Z)(y,[["render",function(t,i,n,r,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[(0,e.renderSlot)(t.$slots,"default")])}]]),g=(0,e.defineComponent)({props:{...u,...d("width","height","fillColor","fillAlpha","lineWidth","strokeColor","strokeAlpha")},setup(t,i){const n=(0,e.inject)(D.Scene),r=new Phaser.GameObjects.Rectangle(n,t.x||0,t.y||0,t.width,t.height);return V(r,t,i),(0,e.provide)(D.GameObject,r),{object:r}}}),f=(0,a.Z)(g,[["render",function(t,i,n,r,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[(0,e.renderSlot)(t.$slots,"default")])}]]),b=(0,e.defineComponent)({props:{...u,...d("width","height","radius","fillColor","fillAlpha","lineWidth","strokeColor","strokeAlpha")},setup(t,i){const n=(0,e.inject)(D.Scene);class r extends Phaser.GameObjects.Graphics{constructor(e,t,i,n,r,o){super(e,t,i,n,r),this._originX=0,this._originY=0,this._width=n||0,this._height=r||0,this._radius=o||0,this._fillColor=null,this._fillAlpha=1,this._lineWidth=0,this._strokeColor=null,this._strokeAlpha=1,this.setRenderFlag(!0)}preUpdate(...e){this.renderFlag&&this.render()}setRenderFlag(e){this.renderFlag=e}render(){this.setRenderFlag(!1);const e=this.originX*-this.width,t=this.originY*-this.height,i="number"==typeof this.radius?Math.min(this.radius,this.width.half,this.height.half):this.radius;this.clear(),null!==this.fillColor&&(this.fillStyle(this.fillColor,this.fillAlpha),this.fillRoundedRect(e,t,this.width,this.height,i)),this.lineWidth&&null!==this.strokeColor&&(this.lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),this.strokeRoundedRect(e,t,this.width,this.height,i))}get originX(){return this._originX}set originX(e){this._originX=e,this.displayOriginX=this.width*e,this.setRenderFlag(!0)}get originY(){return this._originY}set originY(e){this._originY=e,this.displayOriginY=this.height*e,this.setRenderFlag(!0)}setOrigin(e,t){return this.originX=e,this.originY=void 0===t?e:t,this}get radius(){return this._radius}set radius(e){this._radius=e,this.setRenderFlag(!0)}setRadius(e){return this.radius=e,this}get width(){return this._width}set width(e){this._width=e,this.fixSize(),this.setRenderFlag(!0)}get height(){return this._height}set height(e){this._height=e,this.fixSize(),this.setRenderFlag(!0)}setSize(e,t){return void 0!==e&&(this.width=e),void 0!==t&&(this.height=t),this}fixSize(){this.input&&this.input.hitArea.setSize(this.width,this.height),this.body&&this.body.setSize(this.width,this.height)}get displayWidth(){return Math.abs(this.scaleX*this.width)}set displayWidth(e){this.scaleX=e/this.width}get displayHeight(){return Math.abs(this.scaleY*this.height)}set displayHeight(e){this.scaleY=e/this.height}get fillColor(){return this._fillColor}set fillColor(e){this._fillColor=e,this.setRenderFlag(!0)}get fillAlpha(){return this._fillAlpha}set fillAlpha(e){this._fillAlpha=e,this.setRenderFlag(!0)}setFillStyle(e,t){return void 0!==e&&(this.fillColor=e),void 0!==t&&(this.fillAlpha=t),this}get lineWidth(){return this._lineWidth}set lineWidth(e){this._lineWidth=e,this.setRenderFlag(!0)}get strokeColor(){return this._strokeColor}set strokeColor(e){this._strokeColor=e,this.setRenderFlag(!0)}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(e){this._strokeAlpha=e,this.setRenderFlag(!0)}setStrokeStyle(e,t,i){return void 0!==e&&(this.lineWidth=e),void 0!==t&&(this.strokeColor=t),void 0!==i&&(this.strokeAlpha=i),this}}const o=new r(n,t.x||0,t.y||0,t.width,t.height,t.radius);return V(o,t,i),(0,e.provide)(D.GameObject,o),{object:o}}}),v=(0,a.Z)(b,[["render",function(t,i,n,r,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[(0,e.renderSlot)(t.$slots,"default")])}]]),w=(0,e.defineComponent)({props:{...u,...d("radius","fillColor","fillAlpha","lineWidth","strokeColor","strokeAlpha")},setup(t,i){const n=(0,e.inject)(D.Scene),r=new Phaser.GameObjects.Arc(n,t.x||0,t.y||0,t.radius);return V(r,t,i),(0,e.provide)(D.GameObject,r),{object:r}}}),S=(0,a.Z)(w,[["render",function(t,i,n,r,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[(0,e.renderSlot)(t.$slots,"default")])}]]),x=(0,e.defineComponent)({props:{...u,...d("x1","y1","x2","y2","lineWidth","strokeColor","strokeAlpha")},setup(t,i){const n=(0,e.inject)(D.Scene),r=new Phaser.GameObjects.Line(n,t.x||0,t.y||0,t.x1,t.y1,t.x2,t.y2);return V(r,t,i),(0,e.provide)(D.GameObject,r),{object:r}}}),j=(0,a.Z)(x,[["render",function(t,i,n,r,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[(0,e.renderSlot)(t.$slots,"default")])}]]),O=(0,e.defineComponent)({props:{...u,...d("texture","frame","tint","flipX","flipY")},setup(t,i){const n=(0,e.inject)(D.Scene),r=new Phaser.GameObjects.Image(n,t.x||0,t.y||0,t.texture);return V(r,t,i),(0,e.provide)(D.GameObject,r),{object:r}}}),k=(0,a.Z)(O,[["render",function(t,i,n,r,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[(0,e.renderSlot)(t.$slots,"default")])}]]),Y=(0,e.defineComponent)({props:{...u,...d("texture","frame","tint","flipX","flipY")},setup(t,i){const n=(0,e.inject)(D.Scene),r=new Phaser.GameObjects.Sprite(n,t.x||0,t.y||0,t.texture);return V(r,t,i),(0,e.provide)(D.GameObject,r),{object:r}}}),X=(0,a.Z)(Y,[["render",function(t,i,n,r,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[(0,e.renderSlot)(t.$slots,"default")])}]]),C=(0,e.defineComponent)({props:{...u,...d("text","style","lineSpacing","padding")},setup(t,i){const n=(0,e.inject)(D.Scene),r=new Phaser.GameObjects.Text(n,t.x||0,t.y||0,t.text);return V(r,t,i),{object:r}}}),N=(0,a.Z)(C,[["render",function(t,i,n,r,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div")}]]),B=(0,e.defineComponent)({props:{...d("tween","tweens","timeline","visible","x","y","width","height","depth","pipeline","collision","collisionByProperty"),tilemap:{type:Object},layerIndex:{type:Number},tileset:{type:[Array,String]}},setup(t,i){const n=(0,e.inject)(D.Scene),r=new Phaser.Tilemaps.TilemapLayer(n,t.tilemap,t.layerIndex,t.tileset,t.x||0,t.y||0);return V(r,t,i),{object:r}}}),_=(0,a.Z)(B,[["render",function(t,i,n,r,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div")}]]),P=(0,e.defineComponent)({props:{...d("tween","tweens","timeline","active","x","y","width","height","origin","originX","originY","displayOriginX","displayOriginY")},setup(t,i){const n=(0,e.inject)(D.Scene),r=new Phaser.GameObjects.Zone(n,t.x||0,t.y||0,t.width,t.height);return V(r,t,i),{object:r}}}),A=(0,a.Z)(P,[["render",function(t,i,n,r,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div")}]]),E=(0,e.defineComponent)({props:{...d("tween","tweens","timeline","visible","x","y","radius","color","intensity")},setup(e,t){const i=new Phaser.GameObjects.Light(e.x||0,e.y||0);return V(i,e,t),{object:i}}}),G=(0,a.Z)(E,[["render",function(t,i,n,r,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div")}]]),R=(0,e.defineComponent)({props:{...d("width","height","offsetX","offsetY","enable")},setup(t,i){const n=(0,e.inject)(D.Scene),r=(0,e.inject)(D.GameObject),o=n.physics.add.existing(r,Phaser.Physics.Arcade.STATIC_BODY).body;V(o,t,i)}}),W=(0,a.Z)(R,[["render",function(t,i,n,r,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div")}]]),F=(0,e.defineComponent)({props:{...d("width","height","offsetX","offsetY","enable","immovable","moves","bounceX","bounceY","drag","dragX","dragY","gravityX","gravityY","frictionX","frictionY","velocityX","velocityY","maxVelocityX","maxVelocityY","accelerationX","accelerationY")},setup(t,i){const n=(0,e.inject)(D.Scene),r=(0,e.inject)(D.GameObject),o=n.physics.add.existing(r,Phaser.Physics.Arcade.DYNAMIC_BODY).body;V(o,t,i)}}),I=(0,a.Z)(F,[["render",function(t,i,n,r,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div")}]]),Z=(e,t)=>{t.provide(D.Game,e),t.provide(D.Scene,null),t.provide(D.Container,null);const i=()=>{const e=window.document.createElement("div");return document.body.appendChild(e),t.mount(e)};return new Promise((t=>{if(e.isRunning)return t(i());e.events.addListener("ready",(()=>{t(i())}))}))},U=(e,t,i)=>{const n=`_${t}`,r=`update:${t}`;e[n]=e[t],Object.defineProperty(e,t,{get(){return this[n]},set(e){this[n]!==e&&i(r,e)}})},V=(t,i,n)=>{const r=(0,e.getCurrentInstance)(),l="bounce"in t,a=t.constructor===Phaser.GameObjects.Light,p=(0,e.inject)(D.Scene);if(a)p.lights.active||p.lights.enable(),p.lights.lights.push(t);else if(l);else{p.add.existing(t);const i=(0,e.inject)(D.Container);i&&i.add([t])}const h=r.vnode.props||[],c=Object.keys(h).filter((e=>e.startsWith("onUpdate:"))).map((e=>e.split(":")[1])).filter((e=>s[`_${e}`]));c.forEach((e=>U(t,e,n.emit)));const d=Object.entries(h).filter((([e])=>s[e])).map((([n,r])=>{const l=c.includes(n)?`_${n}`:n,a=s[l](t);return a(r),(0,e.watch)((()=>i[n]),a,{deep:o.includes(n)})})).filter(Boolean);n.attrs.onCreate&&n.emit("create",t);const u=[{attr:"onPointerdown",emit:"pointerdown",eventIndex:3},{attr:"onPointermove",emit:"pointermove",eventIndex:3},{attr:"onPointerup",emit:"pointerup",eventIndex:3},{attr:"onPointerout",emit:"pointerout",eventIndex:1},{attr:"onWheel",emit:"wheel",eventIndex:4}].filter((e=>e.attr in n.attrs));return u.length&&(t.setInteractive(),u.forEach((e=>{t.on(e.emit,((...t)=>{t[0].stopPropagation=t[e.eventIndex].stopPropagation,n.emit(e.emit,...t)}))}))),(0,e.onBeforeUnmount)((()=>{t.tween&&t.tween.stop(),d.forEach((e=>e()))})),a?(0,e.onBeforeUnmount)((()=>p.lights.removeLight(t))):(0,e.onBeforeUnmount)((()=>t.destroy())),t},D={Game:"phavuer_game",Scene:"phavuer_scene",GameObject:"phavuer_gameObject",Container:"phavuer_container",PreUpdateEvents:"phavuer_preUpdateEvents",PostUpdateEvents:"phavuer_postUpdateEvents"},T=t=>()=>{const i=(0,e.inject)(t);if(!i)throw new Error(`${t.description} is not provided`);return i},$=T(D.Game),L=T(D.Scene),M=(t,i)=>(0,e.customRef)(((e,n)=>({get:()=>(e(),t),set(e){t&&e||(t=e?e[i]:null,n())}}))),z=e=>M(e,"object"),H=e=>M(e,"scene"),q=t=>i=>{const n=(0,e.inject)(t);n.push(i),(0,e.onBeforeUnmount)((()=>{const e=n.findIndex((e=>e===i));n.splice(e,1)}))},K=q(D.PreUpdateEvents),J=q(D.PostUpdateEvents)})(),r})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("Vue")):"function"==typeof define&&define.amd?define(["Vue"],t):"object"==typeof exports?exports.Phavuer=t(require("Vue")):e.Phavuer=t(e.Vue)}(this,(e=>(()=>{"use strict";var t={744:(e,t)=>{t.Z=(e,t)=>{const i=e.__vccOpts||e;for(const[e,r]of t)i[e]=r;return i}},740:t=>{t.exports=e}},i={};function r(e){var n=i[e];if(void 0!==n)return n.exports;var o=i[e]={exports:{}};return t[e](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{r.r(n),r.d(n,{Body:()=>I,Circle:()=>x,Container:()=>m,Image:()=>k,InjectionKeys:()=>V,Light:()=>G,Line:()=>j,Rectangle:()=>f,RoundRectangle:()=>v,Scene:()=>p,Sprite:()=>X,StaticBody:()=>W,Text:()=>N,TilemapLayer:()=>_,Zone:()=>A,createPhavuerApp:()=>D,initGameObject:()=>U,onPostUpdate:()=>J,onPreUpdate:()=>K,refObj:()=>z,refScene:()=>H,refTo:()=>M,useGame:()=>$,useScene:()=>L});var e=r(740);const t=[{attr:"onPointerdown",emit:"pointerdown",eventIndex:3},{attr:"onPointermove",emit:"pointermove",eventIndex:3},{attr:"onPointerup",emit:"pointerup",eventIndex:3},{attr:"onPointerout",emit:"pointerout",eventIndex:1},{attr:"onPointerover",emit:"pointerover",eventIndex:3},{attr:"onWheel",emit:"wheel",eventIndex:4},{attr:"onDragstart",emit:"dragstart",drag:!0},{attr:"onDrag",emit:"drag",drag:!0},{attr:"onDragend",emit:"dragend",drag:!0},{attr:"onDragenter",emit:"dragenter",drag:!0},{attr:"onDragover",emit:"dragover",drag:!0},{attr:"onDragleave",emit:"dragleave",drag:!0},{attr:"onDrop",emit:"drop",drag:!0}],i=e=>{e.updateDisplayOrigin&&e.updateDisplayOrigin(),e.input?e.input.hitArea.setSize(e.width,e.height):e._events&&t.some((t=>t.emit in e._events))&&e.setInteractive()},o=["tween","tweens","timeline","style"],s={active:e=>t=>e.setActive(t),visible:e=>t=>e.setVisible(t),x:e=>t=>e.x=t,_x:e=>t=>e._x=t,y:e=>t=>e.y=t,_y:e=>t=>e._y=t,x1:e=>t=>e.x1=t,y1:e=>t=>e.y1=t,x2:e=>t=>e.x2=t,y2:e=>t=>e.y2=t,rotation:e=>t=>e.setRotation(t),origin:e=>t=>e.setOrigin(t,t),originX:e=>t=>e.setOrigin(t,e.originY),originY:e=>t=>e.setOrigin(e.originX,t),scale:e=>t=>e.setScale(t,t),scaleX:e=>t=>e.setScale(t,e.scaleY),scaleY:e=>t=>e.setScale(e.scaleX,t),width:e=>t=>{e.setSize(t,e.height),i(e)},height:e=>t=>{e.setSize(e.width,t),i(e)},radius:e=>t=>e.setRadius(t),displayWidth:e=>t=>e.setDisplaySize(t,e.displayHeight),displayHeight:e=>t=>e.setDisplaySize(e.displayWidth,t),displayOriginX:e=>t=>e.setDisplayOrigin(t,e.displayOriginY),displayOriginY:e=>t=>e.setDisplayOrigin(e.displayOriginX,t),flipX:e=>t=>e.setFlipX(t),flipY:e=>t=>e.setFlipY(t),depth:e=>t=>e.setDepth(t),alpha:e=>t=>e.setAlpha(t),blendMode:e=>t=>e.setBlendMode(t),pipeline:e=>t=>e.setPipeline(t),intensity:e=>t=>e.setIntensity(t),tint:e=>t=>e.setTint(t),text:e=>t=>e.setText(t),texture:e=>t=>e.setTexture(t,e.frame&&e.frame.name),frame:e=>t=>e.setFrame(t),color:e=>t=>e.setColor(t),fillColor:e=>t=>e.setFillStyle(t,e.fillAlpha),fillAlpha:e=>t=>e.setFillStyle(e.fillColor,t),lineWidth:e=>(t,i)=>{e.setLineWidth?e.setLineWidth(t,i):e.setStrokeStyle(...t?[t,e.strokeColor,e.strokeAlpha]:[])},strokeColor:e=>t=>e.setStrokeStyle(e.lineWidth,t,e.strokeAlpha),strokeAlpha:e=>t=>e.setStrokeStyle(e.lineWidth,e.strokeColor,t),style:e=>t=>e.setStyle(t),lineSpacing:e=>t=>e.setLineSpacing(t),padding:e=>t=>e.setPadding(t),collision:e=>t=>e.setCollision(t),collisionByProperty:e=>t=>e.setCollisionByProperty(t),enable:e=>t=>e.enable=t,immovable:e=>t=>e.setImmovable(t),moves:e=>t=>e.moves=t,bounceX:e=>t=>e.setBounceX(t),bounceY:e=>t=>e.setBounceY(t),drag:e=>t=>e.setDrag(t),dragX:e=>t=>e.setDragX(t),dragY:e=>t=>e.setDragY(t),gravityX:e=>t=>e.setGravityX(t),gravityY:e=>t=>e.setGravityY(t),frictionX:e=>t=>e.setFrictionX(t),frictionY:e=>t=>e.setFrictionY(t),velocityX:e=>t=>e.setVelocityX(t),velocityY:e=>t=>e.setVelocityY(t),maxVelocityX:e=>t=>e.setMaxVelocityX(t),maxVelocityY:e=>t=>e.setMaxVelocityY(t),accelerationX:e=>t=>e.setAccelerationX(t),accelerationY:e=>t=>e.setAccelerationY(t),offsetX:e=>t=>e.setOffset(t,e.offset.y),offsetY:e=>t=>e.setOffset(e.offset.x,t),tween:e=>t=>{e.tween&&e.tween.stop(),t&&(e.tween=e.scene.add.tween(Object.assign({targets:e},t)))},tweens:e=>t=>{e.tween&&e.tween.stop(),t&&(e.tween=e.scene.tweens.timeline({targets:e,tweens:t}))},timeline:e=>t=>{e.tween&&e.tween.stop(),t&&(e.tween=e.scene.tweens.timeline(Object.assign({targets:e},t)))}},l=(0,e.defineComponent)({props:{name:{type:String,required:!0},autoStart:{type:Boolean,default:!0}},setup(t,i){const r=(0,e.ref)(!1),n=[],o=[],s=class extends Phaser.Scene{init(e){i.emit("init",this,e)}create(e){r.value=!0,i.emit("create",this,e)}update(e,t){n.forEach((i=>i(e,t))),i.emit("update",this,e,t),o.forEach((i=>i(e,t)))}preload(){i.emit("preload",this)}},l=(0,e.inject)(V.Game).scene.add(t.name,s,t.autoStart);return l.events.on("shutdown",(()=>r.value=!1)),(0,e.provide)(V.Scene,l),(0,e.provide)(V.PreUpdateEvents,n),(0,e.provide)(V.PostUpdateEvents,o),{scene:l,show:r}}});var a=r(744);const p=(0,a.Z)(l,[["render",function(t,i,r,n,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[t.show?(0,e.renderSlot)(t.$slots,"default",{key:0}):(0,e.createCommentVNode)("v-if",!0)])}]]),d={active:{type:Boolean},visible:{type:Boolean},x:{type:Number},y:{type:Number},x1:{type:Number},y1:{type:Number},x2:{type:Number},y2:{type:Number},rotation:{type:Number},origin:{type:Number},originX:{type:Number},originY:{type:Number},scale:{type:Number},scaleX:{type:Number},scaleY:{type:Number},width:{type:Number},height:{type:Number},radius:{type:Number},displayWidth:{type:Number},displayHeight:{type:Number},displayOriginX:{type:Number},displayOriginY:{type:Number},flipX:{type:Boolean},flipY:{type:Boolean},depth:{type:Number},alpha:{type:Number},blendMode:{type:[Number,String]},pipeline:{type:[String,Object]},intensity:{type:Number},tint:{type:Number},text:{type:[String,Number]},texture:{type:String},frame:{type:[Number,String]},color:{type:String},fillColor:{type:Number},fillAlpha:{type:Number},lineWidth:{type:Number},strokeColor:{type:Number},strokeAlpha:{type:Number},style:{type:Object},lineSpacing:{type:Number},padding:{type:[Number,Object]},collision:{type:[Number,Array]},collisionByProperty:{type:Object},enable:{type:Boolean},immovable:{type:Boolean},moves:{type:Boolean},bounceX:{type:Number},bounceY:{type:Number},drag:{type:Number},dragX:{type:Number},dragY:{type:Number},gravityX:{type:Number},gravityY:{type:Number},frictionX:{type:Number},frictionY:{type:Number},velocityX:{type:Number},velocityY:{type:Number},maxVelocityX:{type:Number},maxVelocityY:{type:Number},accelerationX:{type:Number},accelerationY:{type:Number},offsetX:{type:Number},offsetY:{type:Number},tween:{type:Object},tweens:{type:Array},timeline:{type:Object}},c=Object.entries(d),h=(...e)=>{const t=new Set(e);return Object.fromEntries(c.filter((([e])=>t.has(e))))},u=h("tween","tweens","timeline","visible","x","y","rotation","origin","originX","originY","displayOriginX","displayOriginY","scale","scaleX","scaleY","displayWidth","displayHeight","depth","alpha","blendMode","pipeline"),y=(0,e.defineComponent)({props:{...u},setup(t,i){const r=(0,e.inject)(V.Scene),n=new Phaser.GameObjects.Container(r,t.x||0,t.y||0);return U(n,t,i),(0,e.provide)(V.Container,n),(0,e.provide)(V.GameObject,n),{object:n}}}),m=(0,a.Z)(y,[["render",function(t,i,r,n,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[(0,e.renderSlot)(t.$slots,"default")])}]]),g=(0,e.defineComponent)({props:{...u,...h("width","height","fillColor","fillAlpha","lineWidth","strokeColor","strokeAlpha")},setup(t,i){const r=(0,e.inject)(V.Scene),n=new Phaser.GameObjects.Rectangle(r,t.x||0,t.y||0,t.width,t.height);return U(n,t,i),(0,e.provide)(V.GameObject,n),{object:n}}}),f=(0,a.Z)(g,[["render",function(t,i,r,n,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[(0,e.renderSlot)(t.$slots,"default")])}]]),b=(0,e.defineComponent)({props:{...u,...h("width","height","radius","fillColor","fillAlpha","lineWidth","strokeColor","strokeAlpha")},setup(t,i){const r=(0,e.inject)(V.Scene);class n extends Phaser.GameObjects.Graphics{constructor(e,t,i,r,n,o){super(e,t,i,r,n),this._originX=0,this._originY=0,this._width=r||0,this._height=n||0,this._radius=o||0,this._fillColor=null,this._fillAlpha=1,this._lineWidth=0,this._strokeColor=null,this._strokeAlpha=1,this.setRenderFlag(!0)}preUpdate(...e){this.renderFlag&&this.render()}setRenderFlag(e){this.renderFlag=e}render(){this.setRenderFlag(!1);const e=this.originX*-this.width,t=this.originY*-this.height,i="number"==typeof this.radius?Math.min(this.radius,this.width.half,this.height.half):this.radius;this.clear(),null!==this.fillColor&&(this.fillStyle(this.fillColor,this.fillAlpha),this.fillRoundedRect(e,t,this.width,this.height,i)),this.lineWidth&&null!==this.strokeColor&&(this.lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),this.strokeRoundedRect(e,t,this.width,this.height,i))}get originX(){return this._originX}set originX(e){this._originX=e,this.displayOriginX=this.width*e,this.setRenderFlag(!0)}get originY(){return this._originY}set originY(e){this._originY=e,this.displayOriginY=this.height*e,this.setRenderFlag(!0)}setOrigin(e,t){return this.originX=e,this.originY=void 0===t?e:t,this}get radius(){return this._radius}set radius(e){this._radius=e,this.setRenderFlag(!0)}setRadius(e){return this.radius=e,this}get width(){return this._width}set width(e){this._width=e,this.fixSize(),this.setRenderFlag(!0)}get height(){return this._height}set height(e){this._height=e,this.fixSize(),this.setRenderFlag(!0)}setSize(e,t){return void 0!==e&&(this.width=e),void 0!==t&&(this.height=t),this}fixSize(){this.input&&this.input.hitArea.setSize(this.width,this.height),this.body&&this.body.setSize(this.width,this.height)}get displayWidth(){return Math.abs(this.scaleX*this.width)}set displayWidth(e){this.scaleX=e/this.width}get displayHeight(){return Math.abs(this.scaleY*this.height)}set displayHeight(e){this.scaleY=e/this.height}get fillColor(){return this._fillColor}set fillColor(e){this._fillColor=e,this.setRenderFlag(!0)}get fillAlpha(){return this._fillAlpha}set fillAlpha(e){this._fillAlpha=e,this.setRenderFlag(!0)}setFillStyle(e,t){return void 0!==e&&(this.fillColor=e),void 0!==t&&(this.fillAlpha=t),this}get lineWidth(){return this._lineWidth}set lineWidth(e){this._lineWidth=e,this.setRenderFlag(!0)}get strokeColor(){return this._strokeColor}set strokeColor(e){this._strokeColor=e,this.setRenderFlag(!0)}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(e){this._strokeAlpha=e,this.setRenderFlag(!0)}setStrokeStyle(e,t,i){return void 0!==e&&(this.lineWidth=e),void 0!==t&&(this.strokeColor=t),void 0!==i&&(this.strokeAlpha=i),this}}const o=new n(r,t.x||0,t.y||0,t.width,t.height,t.radius);return U(o,t,i),(0,e.provide)(V.GameObject,o),{object:o}}}),v=(0,a.Z)(b,[["render",function(t,i,r,n,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[(0,e.renderSlot)(t.$slots,"default")])}]]),w=(0,e.defineComponent)({props:{...u,...h("radius","fillColor","fillAlpha","lineWidth","strokeColor","strokeAlpha")},setup(t,i){const r=(0,e.inject)(V.Scene),n=new Phaser.GameObjects.Arc(r,t.x||0,t.y||0,t.radius);return U(n,t,i),(0,e.provide)(V.GameObject,n),{object:n}}}),x=(0,a.Z)(w,[["render",function(t,i,r,n,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[(0,e.renderSlot)(t.$slots,"default")])}]]),S=(0,e.defineComponent)({props:{...u,...h("x1","y1","x2","y2","lineWidth","strokeColor","strokeAlpha")},setup(t,i){const r=(0,e.inject)(V.Scene),n=new Phaser.GameObjects.Line(r,t.x||0,t.y||0,t.x1,t.y1,t.x2,t.y2);return U(n,t,i),(0,e.provide)(V.GameObject,n),{object:n}}}),j=(0,a.Z)(S,[["render",function(t,i,r,n,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[(0,e.renderSlot)(t.$slots,"default")])}]]),O=(0,e.defineComponent)({props:{...u,...h("texture","frame","tint","flipX","flipY")},setup(t,i){const r=(0,e.inject)(V.Scene),n=new Phaser.GameObjects.Image(r,t.x||0,t.y||0,t.texture);return U(n,t,i),(0,e.provide)(V.GameObject,n),{object:n}}}),k=(0,a.Z)(O,[["render",function(t,i,r,n,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[(0,e.renderSlot)(t.$slots,"default")])}]]),Y=(0,e.defineComponent)({props:{...u,...h("texture","frame","tint","flipX","flipY")},setup(t,i){const r=(0,e.inject)(V.Scene),n=new Phaser.GameObjects.Sprite(r,t.x||0,t.y||0,t.texture);return U(n,t,i),(0,e.provide)(V.GameObject,n),{object:n}}}),X=(0,a.Z)(Y,[["render",function(t,i,r,n,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div",null,[(0,e.renderSlot)(t.$slots,"default")])}]]),C=(0,e.defineComponent)({props:{...u,...h("text","style","lineSpacing","padding")},setup(t,i){const r=(0,e.inject)(V.Scene),n=new Phaser.GameObjects.Text(r,t.x||0,t.y||0,t.text);return U(n,t,i),{object:n}}}),N=(0,a.Z)(C,[["render",function(t,i,r,n,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div")}]]),B=(0,e.defineComponent)({props:{...h("tween","tweens","timeline","visible","x","y","width","height","depth","pipeline","collision","collisionByProperty"),tilemap:{type:Object},layerIndex:{type:Number},tileset:{type:[Array,String]}},setup(t,i){const r=(0,e.inject)(V.Scene),n=new Phaser.Tilemaps.TilemapLayer(r,t.tilemap,t.layerIndex,t.tileset,t.x||0,t.y||0);return U(n,t,i),{object:n}}}),_=(0,a.Z)(B,[["render",function(t,i,r,n,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div")}]]),P=(0,e.defineComponent)({props:{...h("tween","tweens","timeline","active","x","y","width","height","origin","originX","originY","displayOriginX","displayOriginY")},setup(t,i){const r=(0,e.inject)(V.Scene),n=new Phaser.GameObjects.Zone(r,t.x||0,t.y||0,t.width,t.height);return U(n,t,i),n.input||n.setInteractive(),{object:n}}}),A=(0,a.Z)(P,[["render",function(t,i,r,n,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div")}]]),E=(0,e.defineComponent)({props:{...h("tween","tweens","timeline","visible","x","y","radius","color","intensity")},setup(e,t){const i=new Phaser.GameObjects.Light(e.x||0,e.y||0);return U(i,e,t),{object:i}}}),G=(0,a.Z)(E,[["render",function(t,i,r,n,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div")}]]),R=(0,e.defineComponent)({props:{...h("width","height","offsetX","offsetY","enable")},setup(t,i){const r=(0,e.inject)(V.Scene),n=(0,e.inject)(V.GameObject),o=r.physics.add.existing(n,Phaser.Physics.Arcade.STATIC_BODY).body;U(o,t,i)}}),W=(0,a.Z)(R,[["render",function(t,i,r,n,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div")}]]),F=(0,e.defineComponent)({props:{...h("width","height","offsetX","offsetY","enable","immovable","moves","bounceX","bounceY","drag","dragX","dragY","gravityX","gravityY","frictionX","frictionY","velocityX","velocityY","maxVelocityX","maxVelocityY","accelerationX","accelerationY")},setup(t,i){const r=(0,e.inject)(V.Scene),n=(0,e.inject)(V.GameObject),o=r.physics.add.existing(n,Phaser.Physics.Arcade.DYNAMIC_BODY).body;U(o,t,i)}}),I=(0,a.Z)(F,[["render",function(t,i,r,n,o,s){return(0,e.openBlock)(),(0,e.createElementBlock)("div")}]]),D=(e,t)=>{t.provide(V.Game,e),t.provide(V.Scene,null),t.provide(V.Container,null);const i=()=>{const e=window.document.createElement("div");return document.body.appendChild(e),t.mount(e)};return new Promise((t=>{if(e.isRunning)return t(i());e.events.addListener("ready",(()=>{t(i())}))}))},Z=(e,t,i)=>{const r=`_${t}`,n=`update:${t}`;e[r]=e[t],Object.defineProperty(e,t,{get(){return this[r]},set(e){this[r]!==e&&i(n,e)}})},U=(i,r,n)=>{const l=(0,e.getCurrentInstance)(),a="bounce"in i,p=i.constructor===Phaser.GameObjects.Light,d=(0,e.inject)(V.Scene);if(p)d.lights.active||d.lights.enable(),d.lights.lights.push(i);else if(a);else{d.add.existing(i);const t=(0,e.inject)(V.Container);t&&t.add([i])}const c=l.vnode.props||[],h=Object.keys(c).filter((e=>e.startsWith("onUpdate:"))).map((e=>e.split(":")[1])).filter((e=>s[`_${e}`]));h.forEach((e=>Z(i,e,n.emit)));const u=Object.entries(c).filter((([e])=>s[e])).map((([t,n])=>{const l=h.includes(t)?`_${t}`:t,a=s[l](i);return a(n),(0,e.watch)((()=>r[t]),a,{deep:o.includes(t)})})).filter(Boolean);n.attrs.onCreate&&n.emit("create",i);const y=t.filter((e=>e.attr in n.attrs));return y.length&&(i.setInteractive(),y.some((e=>e.drag))&&d.input.setDraggable(i),y.forEach((e=>{i.on(e.emit,((...t)=>{"eventIndex"in t&&(t[0].stopPropagation=t[e.eventIndex].stopPropagation),n.emit(e.emit,...t)}))}))),(0,e.onBeforeUnmount)((()=>{i.tween&&i.tween.stop(),u.forEach((e=>e()))})),p?(0,e.onBeforeUnmount)((()=>d.lights.removeLight(i))):(0,e.onBeforeUnmount)((()=>i.destroy())),i},V={Game:"phavuer_game",Scene:"phavuer_scene",GameObject:"phavuer_gameObject",Container:"phavuer_container",PreUpdateEvents:"phavuer_preUpdateEvents",PostUpdateEvents:"phavuer_postUpdateEvents"},T=t=>()=>{const i=(0,e.inject)(t);if(!i)throw new Error(`${t.description} is not provided`);return i},$=T(V.Game),L=T(V.Scene),M=(t,i)=>(0,e.customRef)(((e,r)=>({get:()=>(e(),t),set(e){t&&e||(t=e?e[i]:null,r())}}))),z=e=>M(e,"object"),H=e=>M(e,"scene"),q=t=>i=>{const r=(0,e.inject)(t);r.push(i),(0,e.onBeforeUnmount)((()=>{const e=r.findIndex((e=>e===i));r.splice(e,1)}))},K=q(V.PreUpdateEvents),J=q(V.PostUpdateEvents)})(),n})()));
{
"name": "phavuer",
"version": "0.10.1",
"version": "0.10.2",
"description": "Reactive template engine based on Vue 3 for Phaser 3",

@@ -5,0 +5,0 @@ "main": "src/index.js",

import { inject, watch, onBeforeUnmount, customRef, getCurrentInstance } from 'vue'
import { default as setters, deepProps } from './setters.js'
import { default as setters, deepProps, GAME_OBJECT_EVENTS } from './setters.js'
import Scene from './components/Scene.vue'

@@ -83,14 +83,13 @@ import Container from './components/Container.vue'

// Set interactive events
const events = [
{ attr: 'onPointerdown', emit: 'pointerdown', eventIndex: 3 },
{ attr: 'onPointermove', emit: 'pointermove', eventIndex: 3 },
{ attr: 'onPointerup', emit: 'pointerup', eventIndex: 3 },
{ attr: 'onPointerout', emit: 'pointerout', eventIndex: 1 },
{ attr: 'onWheel', emit: 'wheel', eventIndex: 4 },
].filter(v => v.attr in context.attrs)
const events = GAME_OBJECT_EVENTS.filter(v => v.attr in context.attrs)
if (events.length) {
object.setInteractive()
if (events.some(v => v.drag)) {
scene.input.setDraggable(object)
}
events.forEach(v => {
object.on(v.emit, (...args) => {
args[0].stopPropagation = args[v.eventIndex].stopPropagation
if ('eventIndex' in args) {
args[0].stopPropagation = args[v.eventIndex].stopPropagation
}
context.emit(v.emit, ...args)

@@ -97,0 +96,0 @@ })

@@ -1,2 +0,16 @@

const eventNames = ['pointerdown', 'pointermove', 'pointerup', 'pointerout', 'wheel']
export const GAME_OBJECT_EVENTS = [
{ attr: 'onPointerdown', emit: 'pointerdown', eventIndex: 3 },
{ attr: 'onPointermove', emit: 'pointermove', eventIndex: 3 },
{ attr: 'onPointerup', emit: 'pointerup', eventIndex: 3 },
{ attr: 'onPointerout', emit: 'pointerout', eventIndex: 1 },
{ attr: 'onPointerover', emit: 'pointerover', eventIndex: 3 },
{ attr: 'onWheel', emit: 'wheel', eventIndex: 4 },
{ attr: 'onDragstart', emit: 'dragstart', drag: true },
{ attr: 'onDrag', emit: 'drag', drag: true },
{ attr: 'onDragend', emit: 'dragend', drag: true },
{ attr: 'onDragenter', emit: 'dragenter', drag: true },
{ attr: 'onDragover', emit: 'dragover', drag: true },
{ attr: 'onDragleave', emit: 'dragleave', drag: true },
{ attr: 'onDrop', emit: 'drop', drag: true }
]
const fixSize = object => {

@@ -8,3 +22,3 @@ if (object.updateDisplayOrigin) {

object.input.hitArea.setSize(object.width, object.height)
} else if (object._events && eventNames.some(name => name in object._events)) {
} else if (object._events && GAME_OBJECT_EVENTS.some(v => v.emit in object._events)) {
object.setInteractive()

@@ -11,0 +25,0 @@ }

@@ -48,2 +48,18 @@ import * as Phaser from 'phaser'

interface GameObjectEmits {
pointerdown: (pointer: Phaser.Input.Pointer, localX: number, localY: number, event: Phaser.Types.Input.EventData) => void
pointermove: (pointer: Phaser.Input.Pointer, localX: number, localY: number, event: Phaser.Types.Input.EventData) => void
pointerup: (pointer: Phaser.Input.Pointer, localX: number, localY: number, event: Phaser.Types.Input.EventData) => void
pointerout: (pointer: Phaser.Input.Pointer, event: Phaser.Types.Input.EventData) => void
pointerover: (pointer: Phaser.Input.Pointer, localX: number, localY: number, event: Phaser.Types.Input.EventData) => void
wheel: (pointer: Phaser.Input.Pointer, deltaX: number, deltaY: number, deltaZ: number, event: Phaser.Types.Input.EventData) => void
dragstart: (pointer: Phaser.Input.Pointer, dragX: number, dragY: number) => void
drag: (pointer: Phaser.Input.Pointer, dragX: number, dragY: number) => void
dragend: (pointer: Phaser.Input.Pointer, dragX: number, dragY: number) => void
dragenter: (pointer: Phaser.Input.Pointer, target: Phaser.GameObjects.GameObject) => void
dragover: (pointer: Phaser.Input.Pointer, target: Phaser.GameObjects.GameObject) => void
dragleave: (pointer: Phaser.Input.Pointer, target: Phaser.GameObjects.GameObject) => void
drop: (pointer: Phaser.Input.Pointer, target: Phaser.GameObjects.GameObject) => void
}
export const Scene: DefineComponent<{

@@ -58,3 +74,3 @@ name?: string

}>
export const Container: DefineComponent<Phavuer.GameObjectProps>
export const Container: DefineComponent<Phavuer.GameObjectProps, {}, {}, {}, {}, {}, {}, GameObjectEmits>
export const Rectangle: DefineComponent<Phavuer.GameObjectProps & {

@@ -68,3 +84,3 @@ width?: number

strokeAlpha?: number
}>
}, {}, {}, {}, {}, {}, {}, GameObjectEmits>
export const RoundRectangle: DefineComponent<Phavuer.GameObjectProps & {

@@ -79,3 +95,3 @@ width?: number

strokeAlpha?: number
}>
}, {}, {}, {}, {}, {}, {}, GameObjectEmits>
export const Circle: DefineComponent<Phavuer.GameObjectProps & {

@@ -88,3 +104,3 @@ radius?: number

strokeAlpha?: number
}>
}, {}, {}, {}, {}, {}, {}, GameObjectEmits>
export const Line: DefineComponent<Phavuer.GameObjectProps & {

@@ -98,3 +114,3 @@ x1?: number

strokeAlpha?: number
}>
}, {}, {}, {}, {}, {}, {}, GameObjectEmits>
export const Image: DefineComponent<Phavuer.GameObjectProps & {

@@ -106,3 +122,3 @@ texture?: string | Phaser.Textures.Texture

flipY?: boolean
}>
}, {}, {}, {}, {}, {}, {}, GameObjectEmits>
export const Sprite: DefineComponent<Phavuer.GameObjectProps & {

@@ -114,3 +130,3 @@ texture?: string | Phaser.Textures.Texture

flipY?: boolean
}>
}, {}, {}, {}, {}, {}, {}, GameObjectEmits>
export const Text: DefineComponent<Phavuer.GameObjectProps & {

@@ -121,3 +137,3 @@ text?: string

padding?: number | Phaser.Types.GameObjects.Text.TextPadding
}>
}, {}, {}, {}, {}, {}, {}, GameObjectEmits>
export const TilemapLayer: DefineComponent<Phavuer.AnimationProps & {

@@ -124,0 +140,0 @@ visible?: boolean

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc