react-pixi-fiber 2.0.0-rc.2 → 2.0.0-rc.3

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.
@@ -23412,6 +23412,10 @@ function setValueForProperty(type, instance, propName, value, internalHandle) {
23412
23412
  }
23413
23413
 
23414
23414
  // Based on: https://github.com/facebook/react/blob/27535e7bfcb63e8a4d65f273311e380b4ca12eff/packages/react-dom/src/client/ReactDOMFiberComponent.js
23415
+
23416
+ // PixiJS v4 keeps these classes under extras/mesh/particles, which v5+ does not export. Reading them from a
23417
+ // plain copy of the namespace stops bundlers from reporting them as missing ES module exports.
23418
+ var PIXI_V4 = Object.assign({}, PIXI__namespace);
23415
23419
  function createInstance(type, props, rootContainer, hostContext, internalHandle) {
23416
23420
  var instance;
23417
23421
  switch (type) {
@@ -23422,7 +23426,7 @@ function createInstance(type, props, rootContainer, hostContext, internalHandle)
23422
23426
  tint: props.tint
23423
23427
  };
23424
23428
  try {
23425
- instance = new PIXI__namespace.extras.BitmapText(props.text, style);
23429
+ instance = new PIXI_V4.extras.BitmapText(props.text, style);
23426
23430
  } catch (e) {
23427
23431
  instance = new PIXI__namespace.BitmapText(props.text, style);
23428
23432
  }
@@ -23435,14 +23439,14 @@ function createInstance(type, props, rootContainer, hostContext, internalHandle)
23435
23439
  break;
23436
23440
  case TYPES.NINE_SLICE_PLANE:
23437
23441
  try {
23438
- instance = new PIXI__namespace.mesh.NineSlicePlane(props.texture, props.leftWidth, props.topHeight, props.rightWidth, props.bottomHeight);
23442
+ instance = new PIXI_V4.mesh.NineSlicePlane(props.texture, props.leftWidth, props.topHeight, props.rightWidth, props.bottomHeight);
23439
23443
  } catch (e) {
23440
23444
  instance = new PIXI__namespace.NineSlicePlane(props.texture, props.leftWidth, props.topHeight, props.rightWidth, props.bottomHeight);
23441
23445
  }
23442
23446
  break;
23443
23447
  case TYPES.PARTICLE_CONTAINER:
23444
23448
  try {
23445
- instance = new PIXI__namespace.particles.ParticleContainer(props.maxSize, props.properties, props.batchSize, props.autoResize);
23449
+ instance = new PIXI_V4.particles.ParticleContainer(props.maxSize, props.properties, props.batchSize, props.autoResize);
23446
23450
  } catch (e) {
23447
23451
  instance = new PIXI__namespace.ParticleContainer(props.maxSize, props.properties, props.batchSize, props.autoResize);
23448
23452
  }
@@ -23455,7 +23459,7 @@ function createInstance(type, props, rootContainer, hostContext, internalHandle)
23455
23459
  break;
23456
23460
  case TYPES.TILING_SPRITE:
23457
23461
  try {
23458
- instance = new PIXI__namespace.extras.TilingSprite(props.texture, props.width, props.height);
23462
+ instance = new PIXI_V4.extras.TilingSprite(props.texture, props.width, props.height);
23459
23463
  } catch (e) {
23460
23464
  instance = new PIXI__namespace.TilingSprite(props.texture, props.width, props.height);
23461
23465
  }
@@ -17,5 +17,5 @@
17
17
  * This source code is licensed under the MIT license found in the
18
18
  * LICENSE file in the root directory of this source tree.
19
19
  */
20
- ConcurrentRoot:1,ContinuousEventPriority:4,DefaultEventPriority:16,DiscreteEventPriority:1,IdleEventPriority:536870912,LegacyRoot:0};we.exports=ke;var Pe=we.exports,Ce="children",ze=b(b({},{alpha:1,angle:0,buttonMode:!1,cacheAsBitmap:!1,cursor:"auto",interactive:!1,pivot:0,position:0,renderable:!0,rotation:0,scale:1,skew:0,visible:!0,x:0,y:0}),{},{interactiveChildren:!0}),Ee=b(b({},ze),{},{anchor:0,blendMode:o.BLEND_MODES.NORMAL,pluginName:"batch",roundPixels:!1,tint:16777215}),Ne=b(b({},ze),{},{align:"left",anchor:0,letterSpacing:0,maxWidth:0,roundPixels:!1,text:"",tint:16777215}),_e=b(b({},ze),{},{blendMode:o.BLEND_MODES.NORMAL,pluginName:"batch",tint:16777215}),Ie=b(b({},ze),{},{autoResize:!1,batchSize:16384,blendMode:o.BLEND_MODES.NORMAL,interactiveChildren:!0,maxSize:1500,roundPixels:!0,tint:16777215}),Te=b(b({},Ee),{},{resolution:1,text:""}),Re=b(b({},Ee),{},{clampMargin:.5,uvRespectAnchor:!1}),Le=p(p(p(p(p(p(p({},L,Ne),O,ze),M,_e),j,Ie),D,Ee),F,Te),U,Re),Oe=C(N);function Me(e,n,t,r,l){var a,i=(a=t,re.hasOwnProperty(a)?re[a]:null);if(!function(e,n,t){return null!==t?0===t.type:(R(e),!1)}(e,0,i)){var o=!1;if(ne(e,0,r,i)){var u=function(e,n){var t=Le[e];if(void 0!==t)return t[n]}(e,t);void 0!==u?r=u:o=!0}o||function(e,n,t){if(ee(e[n])&&ee(t))!function(e,n,t){"function"==typeof e[n].copyFrom?e[n].copyFrom(t):e[n].copy(t)}(e,n,t);else if(ee(e[n])){var r=Z(t);I(void 0!==r&&r.length>0&&r.length<3,"The property `%s` is a PIXI.Point or PIXI.ObservablePoint and must be set to a comma-separated string of either 1 or 2 coordinates, a 1 or 2 element array containing coordinates, or a PIXI Point/ObservablePoint. If only one coordinate is given then X and Y will be set to the provided value.%s",n,""),e[n].set(r.shift(),r.shift())}else e[n]=t}(n,t,r)}}function Ae(e,n,t,r,l){R(e)&&"function"==typeof n._customApplyProps?function(e,n,t){n._customApplyProps(n,void 0,t)}(0,n,t):function(e,n,t){for(var r in t)if(t.hasOwnProperty(r)){var l=t[r];r===Ce||Me(e,n,r,l)}}(e,n,t)}function je(e,n,t,r){var l,a=null,i=t,o=r;for(l in i)!o.hasOwnProperty(l)&&i.hasOwnProperty(l)&&(l===Ce||(a=a||[]).push(l,null));for(l in o){var u=o[l],s=null!=i?i[l]:void 0;o.hasOwnProperty(l)&&u!==s&&(l===Ce||(a=a||[]).push(l,u))}return a}function De(e,n,t,r){var l=je(0,0,t,r);null!==l&&Fe(e,n,l)}function Fe(e,n,t,r,l,a){for(var i=0;i<t.length;i+=2){var o=t[i],u=t[i+1];o===Ce||Me(e,n,o,u)}}function Ue(e,n,t,r,l,a){R(e)&&"function"==typeof n._customApplyProps?function(e,n,t,r,l){n._customApplyProps(n,r,l)}(0,n,0,r,l):Fe(e,n,t)}function Be(e,n){null!=e&&(e.removeChild(n),e.addChild(n),"function"==typeof n._customDidAttach&&n._customDidAttach(n))}function He(e,n){"function"==typeof n._customWillDetach&&n._customWillDetach(n),e.removeChild(n),n.destroy({children:!0})}function We(e,n,t){I(n!==t,"ReactPixiFiber cannot insert node before itself"),-1!==e.children.indexOf(n)&&e.removeChild(n);var r=e.getChildIndex(t);e.addChildAt(n,r)}var Qe={afterActiveInstanceBlur:function(){},appendChild:Be,appendChildToContainer:Be,appendInitialChild:Be,beforeActiveInstanceBlur:function(){},cancelTimeout:function(e){clearTimeout(e)},clearContainer:function(e){e&&e.removeChildren()},commitMount:function(e,n,t,r){},commitTextUpdate:function(e,n,t){},commitUpdate:function(e,n,t,r,l,a){Ue(t,e,n,r,l)},createInstance:function(e,n,t,r,l){var a;switch(e){case L:var i=void 0!==n.style?n.style:{align:n.align,font:n.font,tint:n.tint};try{a=new o.extras.BitmapText(n.text,i)}catch(e){a=new o.BitmapText(n.text,i)}break;case O:a=new o.Container;break;case M:a=new o.Graphics;break;case A:try{a=new o.mesh.NineSlicePlane(n.texture,n.leftWidth,n.topHeight,n.rightWidth,n.bottomHeight)}catch(e){a=new o.NineSlicePlane(n.texture,n.leftWidth,n.topHeight,n.rightWidth,n.bottomHeight)}break;case j:try{a=new o.particles.ParticleContainer(n.maxSize,n.properties,n.batchSize,n.autoResize)}catch(e){a=new o.ParticleContainer(n.maxSize,n.properties,n.batchSize,n.autoResize)}break;case D:a=new o.Sprite(n.texture);break;case F:a=new o.Text(n.text,n.style,n.canvas);break;case U:try{a=new o.extras.TilingSprite(n.texture,n.width,n.height)}catch(e){a=new o.TilingSprite(n.texture,n.width,n.height)}break;default:a=function(e,n,t,r,l,a){var i;if(e in T){var o,u=T[e];"function"==typeof u?o=u:"function"==typeof u.customDisplayObject&&(o=u.customDisplayObject),I(o,"Invalid Component injected to ReactPixiFiber: `%s`.",e),i=o(n),"function"==typeof u.customApplyProps&&(i._customApplyProps=u.customApplyProps.bind({applyDisplayObjectProps:a.bind(null,e,i)})),"function"==typeof u.customDidAttach&&(i._customDidAttach=u.customDidAttach),"function"==typeof u.customWillDetach&&(i._customWillDetach=u.customWillDetach)}return i}(e,n,0,0,0,De)}return I(a,"ReactPixiFiber does not support the type: `%s`.",e),a},createTextInstance:function(e,n,t,r){I(!1,"ReactPixiFiber does not support text instances. Use `Text` component instead.")},detachDeletedInstance:function(e){},finalizeInitialChildren:function(e,n,t,r,l){return Ae(n,e,t),!0},getChildHostContext:function(e,n,t){return e},getCurrentEventPriority:function(){return Pe.DefaultEventPriority},getInstanceFromNode:function(){I(!1,"Not yet implemented.")},getInstanceFromScope:function(){I(!1,"Not yet implemented.")},getRootHostContext:function(e){return fe},getPublicInstance:function(e){return e},hideInstance:function(e){e.visible=!1},hideTextInstance:function(e){},insertBefore:We,insertInContainerBefore:We,noTimeout:-1,now:function(){return"object"===("undefined"==typeof performance?"undefined":P(performance))&&"function"==typeof performance.now?function(){return performance.now()}:function(){return Date.now()}},prepareForCommit:function(e){return null},preparePortalMount:function(e){},prepareUpdate:function(e,n,t,r,l,a){return je(0,0,t,r)},prepareScopeUpdate:function(){},removeChild:He,removeChildFromContainer:He,resetAfterCommit:function(e){},resetTextContent:function(e){},scheduleTimeout:function(e,n){setTimeout(e,n)},shouldSetTextContent:function(e,n){return!1},supportsHydration:!1,scheduleMicrotask:"function"==typeof queueMicrotask?queueMicrotask:"undefined"!=typeof Promise?function(e){return Promise.resolve(null).then(e).catch(function(e){setTimeout(function(){throw e})})}:setTimeout,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,unhideInstance:function(e,n){e.visible=void 0===n.visible||n.visible},unhideTextInstance:function(e,n){}},$e=xe(b(b({},Qe),{},{isPrimaryRenderer:!0})),Ve=xe(b(b({},Qe),{},{isPrimaryRenderer:!1}));var qe=new Map;function Xe(n){return function(t,r,l,a){var i=qe.get(r);return i||(i=n.createContainer(r),qe.set(r,i),n.injectIntoDevTools({findFiberByHostInstance:n.findFiberByHostInstance,bundleType:0,version:e.version,rendererPackageName:"react-pixi-fiber"})),n.updateContainer(t,i,a,l),n.getPublicRootInstance(i)}}function Ke(e){return function(n){var t=qe.get(n);I(t,"ReactPixiFiber did not render into container provided"),e.updateContainer(null,t)}}var Ye={};function Ge(e,n){return function(t,r,l){if(null!=t[r]){var a='"'.concat(r,'" property of "').concat(l,'" has been deprecated.\n').concat(n);Ye[a]||(Oe(!1,a),Ye[a]=!0)}for(var i=arguments.length,o=new Array(i>3?i-3:0),u=3;u<i;u++)o[u-3]=arguments[u];return e.apply(void 0,[t,r,l].concat(o))}}var Je={app:function(e,n,t){var r=e[n];if(void 0!==r){var l=e.options;if(Oe(0===Object.keys(l||{}).length,"'options' property of '".concat(t,"' has no effect when 'app' property is provided. Only use 'app' or 'options', never both.")),!(r instanceof o.Application)){var a=P(r);return new Error("Invalid prop '".concat(n,"' of type '").concat(a,"' supplied to '").concat(t,"', expected 'PIXI.Application'."))}}},options:i.default.shape({antialias:i.default.bool,autoStart:i.default.bool,backgroundColor:i.default.number,clearBeforeRender:i.default.bool,forceCanvas:i.default.bool,forceFXAA:i.default.bool,height:i.default.number,legacy:i.default.bool,powerPreference:i.default.string,preserveDrawingBuffer:i.default.bool,resolution:i.default.number,roundPixels:i.default.bool,sharedLoader:i.default.bool,sharedTicker:i.default.bool,transparent:i.default.bool,view:function(e,n,t){var r=e[n];if(void 0!==r&&!(r instanceof Element&&"function"==typeof r.getContext)){var l=P(r);return new Error("Invalid prop '".concat(n,"' of type '").concat(l,"' supplied to '").concat(t,"', expected '<canvas> Element'."))}},width:i.default.number}),children:i.default.node,height:Ge(i.default.number,"Pass `height` in `options` prop instead."),width:Ge(i.default.number,"Pass `height` in `options` prop instead.")},Ze={options:{}},en=Y(Object.keys(K[O])),nn=Y(Object.keys(Je)),tn=function(e){return!en(e)&&!nn(e)},rn=function(e){return G(e,tn)},ln=function(e){return G(e,en)},an=Xe(Ve),on=Ke(Ve),un=!1,sn=!0;function cn(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:un;on(e.stage),setTimeout(function(){e.destroy(false,n)},0)}function fn(e){var n=e.options,t=n.height;return[n.width,t]}function dn(e,n,t){var r=a.default.createElement(se,{app:e},n.children);"object"===P(t)?an(r,e.stage,void 0,t):an(r,e.stage)}function pn(e,n,t){var r=ln(n);Ae(O,e.stage,r),dn(e,n,t)}function hn(e,n,t,r){var l=ln(n),a=ln(t),i=je(0,e.stage,l,a);null!==i&&Ue(O,e.stage,i),dn(e,t,r)}function mn(e,n,t){var r=w(fn(n),2),l=r[0],a=r[1],i=w(fn(t),2),o=i[0],u=i[1];u===a&&o===l||e.renderer.resize(o,u)}var gn=["height","width"],vn=["height","width"];function yn(n,t,r){var l=function(n){var t=e.useRef(fe);return e.useEffect(function(){t.current=n}),t.current}(n),a=w(e.useState(0),2),i=a[0],u=a[1];return e.useLayoutEffect(function(){if(l!==fe){var e=n.app,a=n.options;if(e instanceof o.Application)hn(t.current,l,n);else{var i=r.current;if(null==t.current)return t.current=J(b({view:i},a)),void pn(t.current,n);var s=n.options;s.height,s.width;var c=S(s,gn),f=l.options;f.height,f.width;var d=S(f,vn);ge(c,d)?(hn(t.current,l,n),mn(t.current,l,n)):(cn(t.current,un),a.view?(t.current=J(b({view:i},a)),pn(t.current,n)):(t.current=null,u(function(e){return e+1})))}}}),i}var bn=["height","width"],Sn=["height","width"];function xn(){var e=function(){function e(n){var t;return c(this,e),(t=s(this,e,[n]))._app=ae(),t._canvas=ae(),t.state={canvasKey:0},t}return g(e,a["default"].Component),d(e,[{key:"componentDidMount",value:function(){var e=this.getPixiApplication(this.props);this.renderStage(e,this.props),this._app.current=e}},{key:"componentDidUpdate",value:function(e){var n=this.getPixiApplication(this.props,e);null!==n&&(this.renderStage(n,this.props),this.rerenderStage(n,this.props,e),this._app.current=n)}},{key:"componentWillUnmount",value:function(){this.props.app instanceof o.Application||null==this._app.current||cn(this._app.current,sn)}},{key:"render",value:function(){var e=this.props,n=e.app,t=e.options;if(n instanceof o.Application)return null;if(void 0!==t&&t.view)return null;var r=rn(this.props);return a.default.createElement("canvas",h({key:this.state.canvasKey,ref:this._canvas},r))}},{key:"getPixiApplication",value:function(e,n){var t=e.app,r=e.options;if(null!=t)return I(t instanceof o.Application,"Provided `app` has to be an instance of PIXI.Application"),t;var l=this._canvas.current;if(null==this._app.current)return J(b({view:l},r));var a=e.options;a.height,a.width;var i=S(a,bn),u=n.options;u.height,u.width;var s=S(u,Sn);return ge(i,s)?this._app.current:(cn(this._app.current,un),r.view?J(b({view:l},r)):(this._app.current=null,this.setState(function(e){return{canvasKey:e.canvasKey+1}}),null))}},{key:"renderStage",value:function(e,n){e!==this._app.current&&pn(e,n,this)}},{key:"rerenderStage",value:function(e,n,t){e===this._app.current&&(hn(e,t,n,this),n.app instanceof o.Application||mn(e,t,n))}}])}();return e.propTypes=Je,e.defaultProps=Ze,e}var wn,kn="function"==typeof a.default.useEffect?((wn=e.forwardRef(function(n,t){var r=n.app,l=n.options,i=e.useRef(),u=e.useRef();e.useImperativeHandle(t,function(){return{_app:i,_canvas:u,props:n}});var s=yn(n,i,u);if(function(n,t,r){e.useLayoutEffect(function(){var e=n.app,l=n.options;if(null!=e)return I(e instanceof o.Application,"Provided `app` has to be an instance of PIXI.Application"),t.current=e,void pn(t.current,n);var a=r.current;return t.current=J(b({view:a},l)),pn(t.current,n),function(){null!=t.current&&cn(t.current,sn)}},[])}(n,i,u),r instanceof o.Application)return null;if(void 0!==l&&l.view)return null;var c=rn(n);return a.default.createElement("canvas",h({key:s,ref:u},c))})).propTypes=Je,wn.defaultProps=Ze,wn):xn();function Pn(){var n=e.useContext(exports.AppContext);if(null===n)throw new Error("No PIXI.Application is available here. You can only access it in children of <Stage />");return n}var Cn=Xe($e),zn=Ke($e),En=L,Nn=O,_n=M,In=A,Tn=j,Rn=D,Ln=F,On=U;exports.AppProvider=se,exports.BitmapText=En,exports.Container=Nn,exports.CustomPIXIComponent=function(e,n){return I("string"==typeof n,"Invalid argument `type` of type `%s` supplied to `CustomPIXIComponent`, expected `string`.",P(n)),function(e,n){return T[e]=n,e}(n,e)},exports.CustomPIXIProperty=le,exports.Graphics=_n,exports.NineSlicePlane=In,exports.ParticleContainer=Tn,exports.Sprite=Rn,exports.Stage=kn,exports.Text=Ln,exports.TilingSprite=On,exports.applyDisplayObjectProps=De,exports.createStageClass=xn,exports.render=Cn,exports.unmount=zn,exports.usePixiApp=Pn,exports.usePixiTicker=function(n){var t=Pn().ticker;e.useEffect(function(){return t.add(n),function(){t.remove(n)}},[n,t])},exports.withApp=ce;
20
+ ConcurrentRoot:1,ContinuousEventPriority:4,DefaultEventPriority:16,DiscreteEventPriority:1,IdleEventPriority:536870912,LegacyRoot:0};we.exports=ke;var Pe=we.exports,Ce="children",ze=b(b({},{alpha:1,angle:0,buttonMode:!1,cacheAsBitmap:!1,cursor:"auto",interactive:!1,pivot:0,position:0,renderable:!0,rotation:0,scale:1,skew:0,visible:!0,x:0,y:0}),{},{interactiveChildren:!0}),Ee=b(b({},ze),{},{anchor:0,blendMode:o.BLEND_MODES.NORMAL,pluginName:"batch",roundPixels:!1,tint:16777215}),Ne=b(b({},ze),{},{align:"left",anchor:0,letterSpacing:0,maxWidth:0,roundPixels:!1,text:"",tint:16777215}),_e=b(b({},ze),{},{blendMode:o.BLEND_MODES.NORMAL,pluginName:"batch",tint:16777215}),Ie=b(b({},ze),{},{autoResize:!1,batchSize:16384,blendMode:o.BLEND_MODES.NORMAL,interactiveChildren:!0,maxSize:1500,roundPixels:!0,tint:16777215}),Te=b(b({},Ee),{},{resolution:1,text:""}),Re=b(b({},Ee),{},{clampMargin:.5,uvRespectAnchor:!1}),Le=p(p(p(p(p(p(p({},L,Ne),O,ze),M,_e),j,Ie),D,Ee),F,Te),U,Re),Oe=C(N);function Me(e,n,t,r,l){var a,i=(a=t,re.hasOwnProperty(a)?re[a]:null);if(!function(e,n,t){return null!==t?0===t.type:(R(e),!1)}(e,0,i)){var o=!1;if(ne(e,0,r,i)){var u=function(e,n){var t=Le[e];if(void 0!==t)return t[n]}(e,t);void 0!==u?r=u:o=!0}o||function(e,n,t){if(ee(e[n])&&ee(t))!function(e,n,t){"function"==typeof e[n].copyFrom?e[n].copyFrom(t):e[n].copy(t)}(e,n,t);else if(ee(e[n])){var r=Z(t);I(void 0!==r&&r.length>0&&r.length<3,"The property `%s` is a PIXI.Point or PIXI.ObservablePoint and must be set to a comma-separated string of either 1 or 2 coordinates, a 1 or 2 element array containing coordinates, or a PIXI Point/ObservablePoint. If only one coordinate is given then X and Y will be set to the provided value.%s",n,""),e[n].set(r.shift(),r.shift())}else e[n]=t}(n,t,r)}}var Ae=Object.assign({},o);function je(e,n,t,r,l){R(e)&&"function"==typeof n._customApplyProps?function(e,n,t){n._customApplyProps(n,void 0,t)}(0,n,t):function(e,n,t){for(var r in t)if(t.hasOwnProperty(r)){var l=t[r];r===Ce||Me(e,n,r,l)}}(e,n,t)}function De(e,n,t,r){var l,a=null,i=t,o=r;for(l in i)!o.hasOwnProperty(l)&&i.hasOwnProperty(l)&&(l===Ce||(a=a||[]).push(l,null));for(l in o){var u=o[l],s=null!=i?i[l]:void 0;o.hasOwnProperty(l)&&u!==s&&(l===Ce||(a=a||[]).push(l,u))}return a}function Fe(e,n,t,r){var l=De(0,0,t,r);null!==l&&Ue(e,n,l)}function Ue(e,n,t,r,l,a){for(var i=0;i<t.length;i+=2){var o=t[i],u=t[i+1];o===Ce||Me(e,n,o,u)}}function Be(e,n,t,r,l,a){R(e)&&"function"==typeof n._customApplyProps?function(e,n,t,r,l){n._customApplyProps(n,r,l)}(0,n,0,r,l):Ue(e,n,t)}function He(e,n){null!=e&&(e.removeChild(n),e.addChild(n),"function"==typeof n._customDidAttach&&n._customDidAttach(n))}function We(e,n){"function"==typeof n._customWillDetach&&n._customWillDetach(n),e.removeChild(n),n.destroy({children:!0})}function Qe(e,n,t){I(n!==t,"ReactPixiFiber cannot insert node before itself"),-1!==e.children.indexOf(n)&&e.removeChild(n);var r=e.getChildIndex(t);e.addChildAt(n,r)}var $e={afterActiveInstanceBlur:function(){},appendChild:He,appendChildToContainer:He,appendInitialChild:He,beforeActiveInstanceBlur:function(){},cancelTimeout:function(e){clearTimeout(e)},clearContainer:function(e){e&&e.removeChildren()},commitMount:function(e,n,t,r){},commitTextUpdate:function(e,n,t){},commitUpdate:function(e,n,t,r,l,a){Be(t,e,n,r,l)},createInstance:function(e,n,t,r,l){var a;switch(e){case L:var i=void 0!==n.style?n.style:{align:n.align,font:n.font,tint:n.tint};try{a=new Ae.extras.BitmapText(n.text,i)}catch(e){a=new o.BitmapText(n.text,i)}break;case O:a=new o.Container;break;case M:a=new o.Graphics;break;case A:try{a=new Ae.mesh.NineSlicePlane(n.texture,n.leftWidth,n.topHeight,n.rightWidth,n.bottomHeight)}catch(e){a=new o.NineSlicePlane(n.texture,n.leftWidth,n.topHeight,n.rightWidth,n.bottomHeight)}break;case j:try{a=new Ae.particles.ParticleContainer(n.maxSize,n.properties,n.batchSize,n.autoResize)}catch(e){a=new o.ParticleContainer(n.maxSize,n.properties,n.batchSize,n.autoResize)}break;case D:a=new o.Sprite(n.texture);break;case F:a=new o.Text(n.text,n.style,n.canvas);break;case U:try{a=new Ae.extras.TilingSprite(n.texture,n.width,n.height)}catch(e){a=new o.TilingSprite(n.texture,n.width,n.height)}break;default:a=function(e,n,t,r,l,a){var i;if(e in T){var o,u=T[e];"function"==typeof u?o=u:"function"==typeof u.customDisplayObject&&(o=u.customDisplayObject),I(o,"Invalid Component injected to ReactPixiFiber: `%s`.",e),i=o(n),"function"==typeof u.customApplyProps&&(i._customApplyProps=u.customApplyProps.bind({applyDisplayObjectProps:a.bind(null,e,i)})),"function"==typeof u.customDidAttach&&(i._customDidAttach=u.customDidAttach),"function"==typeof u.customWillDetach&&(i._customWillDetach=u.customWillDetach)}return i}(e,n,0,0,0,Fe)}return I(a,"ReactPixiFiber does not support the type: `%s`.",e),a},createTextInstance:function(e,n,t,r){I(!1,"ReactPixiFiber does not support text instances. Use `Text` component instead.")},detachDeletedInstance:function(e){},finalizeInitialChildren:function(e,n,t,r,l){return je(n,e,t),!0},getChildHostContext:function(e,n,t){return e},getCurrentEventPriority:function(){return Pe.DefaultEventPriority},getInstanceFromNode:function(){I(!1,"Not yet implemented.")},getInstanceFromScope:function(){I(!1,"Not yet implemented.")},getRootHostContext:function(e){return fe},getPublicInstance:function(e){return e},hideInstance:function(e){e.visible=!1},hideTextInstance:function(e){},insertBefore:Qe,insertInContainerBefore:Qe,noTimeout:-1,now:function(){return"object"===("undefined"==typeof performance?"undefined":P(performance))&&"function"==typeof performance.now?function(){return performance.now()}:function(){return Date.now()}},prepareForCommit:function(e){return null},preparePortalMount:function(e){},prepareUpdate:function(e,n,t,r,l,a){return De(0,0,t,r)},prepareScopeUpdate:function(){},removeChild:We,removeChildFromContainer:We,resetAfterCommit:function(e){},resetTextContent:function(e){},scheduleTimeout:function(e,n){setTimeout(e,n)},shouldSetTextContent:function(e,n){return!1},supportsHydration:!1,scheduleMicrotask:"function"==typeof queueMicrotask?queueMicrotask:"undefined"!=typeof Promise?function(e){return Promise.resolve(null).then(e).catch(function(e){setTimeout(function(){throw e})})}:setTimeout,supportsMicrotasks:!0,supportsMutation:!0,supportsPersistence:!1,unhideInstance:function(e,n){e.visible=void 0===n.visible||n.visible},unhideTextInstance:function(e,n){}},Ve=xe(b(b({},$e),{},{isPrimaryRenderer:!0})),qe=xe(b(b({},$e),{},{isPrimaryRenderer:!1}));var Xe=new Map;function Ke(n){return function(t,r,l,a){var i=Xe.get(r);return i||(i=n.createContainer(r),Xe.set(r,i),n.injectIntoDevTools({findFiberByHostInstance:n.findFiberByHostInstance,bundleType:0,version:e.version,rendererPackageName:"react-pixi-fiber"})),n.updateContainer(t,i,a,l),n.getPublicRootInstance(i)}}function Ye(e){return function(n){var t=Xe.get(n);I(t,"ReactPixiFiber did not render into container provided"),e.updateContainer(null,t)}}var Ge={};function Je(e,n){return function(t,r,l){if(null!=t[r]){var a='"'.concat(r,'" property of "').concat(l,'" has been deprecated.\n').concat(n);Ge[a]||(Oe(!1,a),Ge[a]=!0)}for(var i=arguments.length,o=new Array(i>3?i-3:0),u=3;u<i;u++)o[u-3]=arguments[u];return e.apply(void 0,[t,r,l].concat(o))}}var Ze={app:function(e,n,t){var r=e[n];if(void 0!==r){var l=e.options;if(Oe(0===Object.keys(l||{}).length,"'options' property of '".concat(t,"' has no effect when 'app' property is provided. Only use 'app' or 'options', never both.")),!(r instanceof o.Application)){var a=P(r);return new Error("Invalid prop '".concat(n,"' of type '").concat(a,"' supplied to '").concat(t,"', expected 'PIXI.Application'."))}}},options:i.default.shape({antialias:i.default.bool,autoStart:i.default.bool,backgroundColor:i.default.number,clearBeforeRender:i.default.bool,forceCanvas:i.default.bool,forceFXAA:i.default.bool,height:i.default.number,legacy:i.default.bool,powerPreference:i.default.string,preserveDrawingBuffer:i.default.bool,resolution:i.default.number,roundPixels:i.default.bool,sharedLoader:i.default.bool,sharedTicker:i.default.bool,transparent:i.default.bool,view:function(e,n,t){var r=e[n];if(void 0!==r&&!(r instanceof Element&&"function"==typeof r.getContext)){var l=P(r);return new Error("Invalid prop '".concat(n,"' of type '").concat(l,"' supplied to '").concat(t,"', expected '<canvas> Element'."))}},width:i.default.number}),children:i.default.node,height:Je(i.default.number,"Pass `height` in `options` prop instead."),width:Je(i.default.number,"Pass `height` in `options` prop instead.")},en={options:{}},nn=Y(Object.keys(K[O])),tn=Y(Object.keys(Ze)),rn=function(e){return!nn(e)&&!tn(e)},ln=function(e){return G(e,rn)},an=function(e){return G(e,nn)},on=Ke(qe),un=Ye(qe),sn=!1,cn=!0;function fn(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sn;un(e.stage),setTimeout(function(){e.destroy(false,n)},0)}function dn(e){var n=e.options,t=n.height;return[n.width,t]}function pn(e,n,t){var r=a.default.createElement(se,{app:e},n.children);"object"===P(t)?on(r,e.stage,void 0,t):on(r,e.stage)}function hn(e,n,t){var r=an(n);je(O,e.stage,r),pn(e,n,t)}function mn(e,n,t,r){var l=an(n),a=an(t),i=De(0,e.stage,l,a);null!==i&&Be(O,e.stage,i),pn(e,t,r)}function gn(e,n,t){var r=w(dn(n),2),l=r[0],a=r[1],i=w(dn(t),2),o=i[0],u=i[1];u===a&&o===l||e.renderer.resize(o,u)}var vn=["height","width"],yn=["height","width"];function bn(n,t,r){var l=function(n){var t=e.useRef(fe);return e.useEffect(function(){t.current=n}),t.current}(n),a=w(e.useState(0),2),i=a[0],u=a[1];return e.useLayoutEffect(function(){if(l!==fe){var e=n.app,a=n.options;if(e instanceof o.Application)mn(t.current,l,n);else{var i=r.current;if(null==t.current)return t.current=J(b({view:i},a)),void hn(t.current,n);var s=n.options;s.height,s.width;var c=S(s,vn),f=l.options;f.height,f.width;var d=S(f,yn);ge(c,d)?(mn(t.current,l,n),gn(t.current,l,n)):(fn(t.current,sn),a.view?(t.current=J(b({view:i},a)),hn(t.current,n)):(t.current=null,u(function(e){return e+1})))}}}),i}var Sn=["height","width"],xn=["height","width"];function wn(){var e=function(){function e(n){var t;return c(this,e),(t=s(this,e,[n]))._app=ae(),t._canvas=ae(),t.state={canvasKey:0},t}return g(e,a["default"].Component),d(e,[{key:"componentDidMount",value:function(){var e=this.getPixiApplication(this.props);this.renderStage(e,this.props),this._app.current=e}},{key:"componentDidUpdate",value:function(e){var n=this.getPixiApplication(this.props,e);null!==n&&(this.renderStage(n,this.props),this.rerenderStage(n,this.props,e),this._app.current=n)}},{key:"componentWillUnmount",value:function(){this.props.app instanceof o.Application||null==this._app.current||fn(this._app.current,cn)}},{key:"render",value:function(){var e=this.props,n=e.app,t=e.options;if(n instanceof o.Application)return null;if(void 0!==t&&t.view)return null;var r=ln(this.props);return a.default.createElement("canvas",h({key:this.state.canvasKey,ref:this._canvas},r))}},{key:"getPixiApplication",value:function(e,n){var t=e.app,r=e.options;if(null!=t)return I(t instanceof o.Application,"Provided `app` has to be an instance of PIXI.Application"),t;var l=this._canvas.current;if(null==this._app.current)return J(b({view:l},r));var a=e.options;a.height,a.width;var i=S(a,Sn),u=n.options;u.height,u.width;var s=S(u,xn);return ge(i,s)?this._app.current:(fn(this._app.current,sn),r.view?J(b({view:l},r)):(this._app.current=null,this.setState(function(e){return{canvasKey:e.canvasKey+1}}),null))}},{key:"renderStage",value:function(e,n){e!==this._app.current&&hn(e,n,this)}},{key:"rerenderStage",value:function(e,n,t){e===this._app.current&&(mn(e,t,n,this),n.app instanceof o.Application||gn(e,t,n))}}])}();return e.propTypes=Ze,e.defaultProps=en,e}var kn,Pn="function"==typeof a.default.useEffect?((kn=e.forwardRef(function(n,t){var r=n.app,l=n.options,i=e.useRef(),u=e.useRef();e.useImperativeHandle(t,function(){return{_app:i,_canvas:u,props:n}});var s=bn(n,i,u);if(function(n,t,r){e.useLayoutEffect(function(){var e=n.app,l=n.options;if(null!=e)return I(e instanceof o.Application,"Provided `app` has to be an instance of PIXI.Application"),t.current=e,void hn(t.current,n);var a=r.current;return t.current=J(b({view:a},l)),hn(t.current,n),function(){null!=t.current&&fn(t.current,cn)}},[])}(n,i,u),r instanceof o.Application)return null;if(void 0!==l&&l.view)return null;var c=ln(n);return a.default.createElement("canvas",h({key:s,ref:u},c))})).propTypes=Ze,kn.defaultProps=en,kn):wn();function Cn(){var n=e.useContext(exports.AppContext);if(null===n)throw new Error("No PIXI.Application is available here. You can only access it in children of <Stage />");return n}var zn=Ke(Ve),En=Ye(Ve),Nn=L,_n=O,In=M,Tn=A,Rn=j,Ln=D,On=F,Mn=U;exports.AppProvider=se,exports.BitmapText=Nn,exports.Container=_n,exports.CustomPIXIComponent=function(e,n){return I("string"==typeof n,"Invalid argument `type` of type `%s` supplied to `CustomPIXIComponent`, expected `string`.",P(n)),function(e,n){return T[e]=n,e}(n,e)},exports.CustomPIXIProperty=le,exports.Graphics=In,exports.NineSlicePlane=Tn,exports.ParticleContainer=Rn,exports.Sprite=Ln,exports.Stage=Pn,exports.Text=On,exports.TilingSprite=Mn,exports.applyDisplayObjectProps=Fe,exports.createStageClass=wn,exports.render=zn,exports.unmount=En,exports.usePixiApp=Cn,exports.usePixiTicker=function(n){var t=Cn().ticker;e.useEffect(function(){return t.add(n),function(){t.remove(n)}},[n,t])},exports.withApp=ce;
21
21
  //# sourceMappingURL=react-pixi-fiber.production.min.js.map