mage-engine 3.23.11 → 3.23.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/mage.js +436 -332
  2. package/package.json +2 -2
package/dist/mage.js CHANGED
@@ -53921,6 +53921,7 @@ if ( typeof window !== 'undefined' ) {
53921
53921
  }var three_module=/*#__PURE__*/Object.freeze({__proto__:null,ACESFilmicToneMapping:ACESFilmicToneMapping,AddEquation:AddEquation,AddOperation:AddOperation,AdditiveAnimationBlendMode:AdditiveAnimationBlendMode,AdditiveBlending:AdditiveBlending,AlphaFormat:AlphaFormat,AlwaysDepth:AlwaysDepth,AlwaysStencilFunc:AlwaysStencilFunc,AmbientLight:AmbientLight$1,AmbientLightProbe:AmbientLightProbe,AnimationClip:AnimationClip,AnimationLoader:AnimationLoader,AnimationMixer:AnimationMixer,AnimationObjectGroup:AnimationObjectGroup,AnimationUtils:AnimationUtils,ArcCurve:ArcCurve,ArrayCamera:ArrayCamera,ArrowHelper:ArrowHelper,Audio:Audio$2,AudioAnalyser:AudioAnalyser,AudioContext:AudioContext,AudioListener:AudioListener,AudioLoader:AudioLoader,AxesHelper:AxesHelper$1,AxisHelper:AxisHelper,BackSide:BackSide,BasicDepthPacking:BasicDepthPacking,BasicShadowMap:BasicShadowMap,BinaryTextureLoader:BinaryTextureLoader,Bone:Bone,BooleanKeyframeTrack:BooleanKeyframeTrack,BoundingBoxHelper:BoundingBoxHelper,Box2:Box2,Box3:Box3,Box3Helper:Box3Helper,BoxBufferGeometry:BoxGeometry,BoxGeometry:BoxGeometry,BoxHelper:BoxHelper,BufferAttribute:BufferAttribute,BufferGeometry:BufferGeometry,BufferGeometryLoader:BufferGeometryLoader,ByteType:ByteType,Cache:Cache,Camera:Camera$1,CameraHelper:CameraHelper,CanvasRenderer:CanvasRenderer,CanvasTexture:CanvasTexture,CatmullRomCurve3:CatmullRomCurve3,CineonToneMapping:CineonToneMapping,CircleBufferGeometry:CircleGeometry,CircleGeometry:CircleGeometry,ClampToEdgeWrapping:ClampToEdgeWrapping,Clock:Clock,Color:Color$1,ColorKeyframeTrack:ColorKeyframeTrack,CompressedTexture:CompressedTexture,CompressedTextureLoader:CompressedTextureLoader,ConeBufferGeometry:ConeGeometry,ConeGeometry:ConeGeometry,CubeCamera:CubeCamera,CubeReflectionMapping:CubeReflectionMapping,CubeRefractionMapping:CubeRefractionMapping,CubeTexture:CubeTexture,CubeTextureLoader:CubeTextureLoader,CubeUVReflectionMapping:CubeUVReflectionMapping,CubeUVRefractionMapping:CubeUVRefractionMapping,CubicBezierCurve:CubicBezierCurve,CubicBezierCurve3:CubicBezierCurve3,CubicInterpolant:CubicInterpolant,CullFaceBack:CullFaceBack,CullFaceFront:CullFaceFront,CullFaceFrontBack:CullFaceFrontBack,CullFaceNone:CullFaceNone,Curve:Curve,CurvePath:CurvePath,CustomBlending:CustomBlending,CustomToneMapping:CustomToneMapping,CylinderBufferGeometry:CylinderGeometry,CylinderGeometry:CylinderGeometry,Cylindrical:Cylindrical,DataTexture:DataTexture,DataTexture2DArray:DataTexture2DArray,DataTexture3D:DataTexture3D,DataTextureLoader:DataTextureLoader,DataUtils:DataUtils,DecrementStencilOp:DecrementStencilOp,DecrementWrapStencilOp:DecrementWrapStencilOp,DefaultLoadingManager:DefaultLoadingManager,DepthFormat:DepthFormat,DepthStencilFormat:DepthStencilFormat,DepthTexture:DepthTexture,DirectionalLight:DirectionalLight,DirectionalLightHelper:DirectionalLightHelper,DiscreteInterpolant:DiscreteInterpolant,DodecahedronBufferGeometry:DodecahedronGeometry,DodecahedronGeometry:DodecahedronGeometry,DoubleSide:DoubleSide,DstAlphaFactor:DstAlphaFactor,DstColorFactor:DstColorFactor,DynamicBufferAttribute:DynamicBufferAttribute,DynamicCopyUsage:DynamicCopyUsage,DynamicDrawUsage:DynamicDrawUsage,DynamicReadUsage:DynamicReadUsage,EdgesGeometry:EdgesGeometry,EdgesHelper:EdgesHelper,EllipseCurve:EllipseCurve,EqualDepth:EqualDepth,EqualStencilFunc:EqualStencilFunc,EquirectangularReflectionMapping:EquirectangularReflectionMapping,EquirectangularRefractionMapping:EquirectangularRefractionMapping,Euler:Euler,EventDispatcher:EventDispatcher,ExtrudeBufferGeometry:ExtrudeGeometry,ExtrudeGeometry:ExtrudeGeometry,FaceColors:FaceColors,FileLoader:FileLoader,FlatShading:FlatShading,Float16BufferAttribute:Float16BufferAttribute,Float32Attribute:Float32Attribute,Float32BufferAttribute:Float32BufferAttribute,Float64Attribute:Float64Attribute,Float64BufferAttribute:Float64BufferAttribute,FloatType:FloatType$1,Fog:Fog,FogExp2:FogExp2,Font:Font,FontLoader:FontLoader,FrontSide:FrontSide,Frustum:Frustum$1,GLBufferAttribute:GLBufferAttribute,GLSL1:GLSL1,GLSL3:GLSL3,GammaEncoding:GammaEncoding,GreaterDepth:GreaterDepth,GreaterEqualDepth:GreaterEqualDepth,GreaterEqualStencilFunc:GreaterEqualStencilFunc,GreaterStencilFunc:GreaterStencilFunc,GridHelper:GridHelper,Group:Group,HalfFloatType:HalfFloatType,HemisphereLight:HemisphereLight$1,HemisphereLightHelper:HemisphereLightHelper,HemisphereLightProbe:HemisphereLightProbe,IcosahedronBufferGeometry:IcosahedronGeometry,IcosahedronGeometry:IcosahedronGeometry,ImageBitmapLoader:ImageBitmapLoader,ImageLoader:ImageLoader,ImageUtils:ImageUtils,ImmediateRenderObject:ImmediateRenderObject,IncrementStencilOp:IncrementStencilOp,IncrementWrapStencilOp:IncrementWrapStencilOp,InstancedBufferAttribute:InstancedBufferAttribute,InstancedBufferGeometry:InstancedBufferGeometry,InstancedInterleavedBuffer:InstancedInterleavedBuffer,InstancedMesh:InstancedMesh,Int16Attribute:Int16Attribute,Int16BufferAttribute:Int16BufferAttribute,Int32Attribute:Int32Attribute,Int32BufferAttribute:Int32BufferAttribute,Int8Attribute:Int8Attribute,Int8BufferAttribute:Int8BufferAttribute,IntType:IntType,InterleavedBuffer:InterleavedBuffer,InterleavedBufferAttribute:InterleavedBufferAttribute,Interpolant:Interpolant,InterpolateDiscrete:InterpolateDiscrete,InterpolateLinear:InterpolateLinear,InterpolateSmooth:InterpolateSmooth,InvertStencilOp:InvertStencilOp,JSONLoader:JSONLoader,KeepStencilOp:KeepStencilOp,KeyframeTrack:KeyframeTrack,LOD:LOD,LatheBufferGeometry:LatheGeometry,LatheGeometry:LatheGeometry,Layers:Layers,LensFlare:LensFlare,LessDepth:LessDepth,LessEqualDepth:LessEqualDepth,LessEqualStencilFunc:LessEqualStencilFunc,LessStencilFunc:LessStencilFunc,Light:Light$2,LightProbe:LightProbe,Line:Line$1,Line3:Line3,LineBasicMaterial:LineBasicMaterial,LineCurve:LineCurve,LineCurve3:LineCurve3,LineDashedMaterial:LineDashedMaterial,LineLoop:LineLoop,LinePieces:LinePieces,LineSegments:LineSegments,LineStrip:LineStrip,LinearEncoding:LinearEncoding,LinearFilter:LinearFilter,LinearInterpolant:LinearInterpolant,LinearMipMapLinearFilter:LinearMipMapLinearFilter,LinearMipMapNearestFilter:LinearMipMapNearestFilter,LinearMipmapLinearFilter:LinearMipmapLinearFilter,LinearMipmapNearestFilter:LinearMipmapNearestFilter,LinearToneMapping:LinearToneMapping,Loader:Loader,LoaderUtils:LoaderUtils,LoadingManager:LoadingManager,LogLuvEncoding:LogLuvEncoding,LoopOnce:LoopOnce,LoopPingPong:LoopPingPong,LoopRepeat:LoopRepeat,LuminanceAlphaFormat:LuminanceAlphaFormat,LuminanceFormat:LuminanceFormat,MOUSE:MOUSE,Material:Material,MaterialLoader:MaterialLoader,Math:MathUtils,MathUtils:MathUtils,Matrix3:Matrix3,Matrix4:Matrix4,MaxEquation:MaxEquation,Mesh:Mesh,MeshBasicMaterial:MeshBasicMaterial,MeshDepthMaterial:MeshDepthMaterial,MeshDistanceMaterial:MeshDistanceMaterial,MeshFaceMaterial:MeshFaceMaterial,MeshLambertMaterial:MeshLambertMaterial,MeshMatcapMaterial:MeshMatcapMaterial,MeshNormalMaterial:MeshNormalMaterial,MeshPhongMaterial:MeshPhongMaterial,MeshPhysicalMaterial:MeshPhysicalMaterial,MeshStandardMaterial:MeshStandardMaterial,MeshToonMaterial:MeshToonMaterial,MinEquation:MinEquation,MirroredRepeatWrapping:MirroredRepeatWrapping,MixOperation:MixOperation,MultiMaterial:MultiMaterial,MultiplyBlending:MultiplyBlending,MultiplyOperation:MultiplyOperation,NearestFilter:NearestFilter,NearestMipMapLinearFilter:NearestMipMapLinearFilter,NearestMipMapNearestFilter:NearestMipMapNearestFilter,NearestMipmapLinearFilter:NearestMipmapLinearFilter,NearestMipmapNearestFilter:NearestMipmapNearestFilter,NeverDepth:NeverDepth,NeverStencilFunc:NeverStencilFunc,NoBlending:NoBlending,NoColors:NoColors,NoToneMapping:NoToneMapping,NormalAnimationBlendMode:NormalAnimationBlendMode,NormalBlending:NormalBlending,NotEqualDepth:NotEqualDepth,NotEqualStencilFunc:NotEqualStencilFunc,NumberKeyframeTrack:NumberKeyframeTrack,Object3D:Object3D,ObjectLoader:ObjectLoader,ObjectSpaceNormalMap:ObjectSpaceNormalMap,OctahedronBufferGeometry:OctahedronGeometry,OctahedronGeometry:OctahedronGeometry,OneFactor:OneFactor,OneMinusDstAlphaFactor:OneMinusDstAlphaFactor,OneMinusDstColorFactor:OneMinusDstColorFactor,OneMinusSrcAlphaFactor:OneMinusSrcAlphaFactor,OneMinusSrcColorFactor:OneMinusSrcColorFactor,OrthographicCamera:OrthographicCamera,PCFShadowMap:PCFShadowMap,PCFSoftShadowMap:PCFSoftShadowMap,PMREMGenerator:PMREMGenerator,ParametricBufferGeometry:ParametricGeometry,ParametricGeometry:ParametricGeometry,Particle:Particle,ParticleBasicMaterial:ParticleBasicMaterial,ParticleSystem:ParticleSystem,ParticleSystemMaterial:ParticleSystemMaterial,Path:Path,PerspectiveCamera:PerspectiveCamera,Plane:Plane$1,PlaneBufferGeometry:PlaneGeometry,PlaneGeometry:PlaneGeometry,PlaneHelper:PlaneHelper,PointCloud:PointCloud,PointCloudMaterial:PointCloudMaterial,PointLight:PointLight$1,PointLightHelper:PointLightHelper,Points:Points,PointsMaterial:PointsMaterial,PolarGridHelper:PolarGridHelper,PolyhedronBufferGeometry:PolyhedronGeometry,PolyhedronGeometry:PolyhedronGeometry,PositionalAudio:PositionalAudio,PropertyBinding:PropertyBinding,PropertyMixer:PropertyMixer,QuadraticBezierCurve:QuadraticBezierCurve,QuadraticBezierCurve3:QuadraticBezierCurve3,Quaternion:Quaternion,QuaternionKeyframeTrack:QuaternionKeyframeTrack,QuaternionLinearInterpolant:QuaternionLinearInterpolant,REVISION:REVISION,RGBADepthPacking:RGBADepthPacking,RGBAFormat:RGBAFormat,RGBAIntegerFormat:RGBAIntegerFormat,RGBA_ASTC_10x10_Format:RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format:RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format:RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format:RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format:RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format:RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format:RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format:RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format:RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format:RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format:RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format:RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format:RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format:RGBA_ASTC_8x8_Format,RGBA_BPTC_Format:RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format:RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format:RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format:RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format:RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format:RGBA_S3TC_DXT5_Format,RGBDEncoding:RGBDEncoding,RGBEEncoding:RGBEEncoding,RGBEFormat:RGBEFormat,RGBFormat:RGBFormat,RGBIntegerFormat:RGBIntegerFormat,RGBM16Encoding:RGBM16Encoding,RGBM7Encoding:RGBM7Encoding,RGB_ETC1_Format:RGB_ETC1_Format,RGB_ETC2_Format:RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format:RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format:RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format:RGB_S3TC_DXT1_Format,RGFormat:RGFormat,RGIntegerFormat:RGIntegerFormat,RawShaderMaterial:RawShaderMaterial,Ray:Ray,Raycaster:Raycaster,RectAreaLight:RectAreaLight,RedFormat:RedFormat,RedIntegerFormat:RedIntegerFormat,ReinhardToneMapping:ReinhardToneMapping,RepeatWrapping:RepeatWrapping$1,ReplaceStencilOp:ReplaceStencilOp,ReverseSubtractEquation:ReverseSubtractEquation,RingBufferGeometry:RingGeometry,RingGeometry:RingGeometry,SRGB8_ALPHA8_ASTC_10x10_Format:SRGB8_ALPHA8_ASTC_10x10_Format,SRGB8_ALPHA8_ASTC_10x5_Format:SRGB8_ALPHA8_ASTC_10x5_Format,SRGB8_ALPHA8_ASTC_10x6_Format:SRGB8_ALPHA8_ASTC_10x6_Format,SRGB8_ALPHA8_ASTC_10x8_Format:SRGB8_ALPHA8_ASTC_10x8_Format,SRGB8_ALPHA8_ASTC_12x10_Format:SRGB8_ALPHA8_ASTC_12x10_Format,SRGB8_ALPHA8_ASTC_12x12_Format:SRGB8_ALPHA8_ASTC_12x12_Format,SRGB8_ALPHA8_ASTC_4x4_Format:SRGB8_ALPHA8_ASTC_4x4_Format,SRGB8_ALPHA8_ASTC_5x4_Format:SRGB8_ALPHA8_ASTC_5x4_Format,SRGB8_ALPHA8_ASTC_5x5_Format:SRGB8_ALPHA8_ASTC_5x5_Format,SRGB8_ALPHA8_ASTC_6x5_Format:SRGB8_ALPHA8_ASTC_6x5_Format,SRGB8_ALPHA8_ASTC_6x6_Format:SRGB8_ALPHA8_ASTC_6x6_Format,SRGB8_ALPHA8_ASTC_8x5_Format:SRGB8_ALPHA8_ASTC_8x5_Format,SRGB8_ALPHA8_ASTC_8x6_Format:SRGB8_ALPHA8_ASTC_8x6_Format,SRGB8_ALPHA8_ASTC_8x8_Format:SRGB8_ALPHA8_ASTC_8x8_Format,Scene:Scene$2,SceneUtils:SceneUtils,ShaderChunk:ShaderChunk,ShaderLib:ShaderLib,ShaderMaterial:ShaderMaterial,ShadowMaterial:ShadowMaterial,Shape:Shape,ShapeBufferGeometry:ShapeGeometry,ShapeGeometry:ShapeGeometry,ShapePath:ShapePath,ShapeUtils:ShapeUtils,ShortType:ShortType,Skeleton:Skeleton,SkeletonHelper:SkeletonHelper,SkinnedMesh:SkinnedMesh,SmoothShading:SmoothShading,Sphere:Sphere$1,SphereBufferGeometry:SphereGeometry,SphereGeometry:SphereGeometry,Spherical:Spherical,SphericalHarmonics3:SphericalHarmonics3,SplineCurve:SplineCurve,SpotLight:SpotLight$1,SpotLightHelper:SpotLightHelper,Sprite:Sprite$1,SpriteMaterial:SpriteMaterial,SrcAlphaFactor:SrcAlphaFactor,SrcAlphaSaturateFactor:SrcAlphaSaturateFactor,SrcColorFactor:SrcColorFactor,StaticCopyUsage:StaticCopyUsage,StaticDrawUsage:StaticDrawUsage,StaticReadUsage:StaticReadUsage,StereoCamera:StereoCamera,StreamCopyUsage:StreamCopyUsage,StreamDrawUsage:StreamDrawUsage,StreamReadUsage:StreamReadUsage,StringKeyframeTrack:StringKeyframeTrack,SubtractEquation:SubtractEquation,SubtractiveBlending:SubtractiveBlending,TOUCH:TOUCH,TangentSpaceNormalMap:TangentSpaceNormalMap,TetrahedronBufferGeometry:TetrahedronGeometry,TetrahedronGeometry:TetrahedronGeometry,TextBufferGeometry:TextGeometry,TextGeometry:TextGeometry,Texture:Texture,TextureLoader:TextureLoader,TorusBufferGeometry:TorusGeometry,TorusGeometry:TorusGeometry,TorusKnotBufferGeometry:TorusKnotGeometry,TorusKnotGeometry:TorusKnotGeometry,Triangle:Triangle,TriangleFanDrawMode:TriangleFanDrawMode,TriangleStripDrawMode:TriangleStripDrawMode,TrianglesDrawMode:TrianglesDrawMode,TubeBufferGeometry:TubeGeometry,TubeGeometry:TubeGeometry,UVMapping:UVMapping,Uint16Attribute:Uint16Attribute,Uint16BufferAttribute:Uint16BufferAttribute,Uint32Attribute:Uint32Attribute,Uint32BufferAttribute:Uint32BufferAttribute,Uint8Attribute:Uint8Attribute,Uint8BufferAttribute:Uint8BufferAttribute,Uint8ClampedAttribute:Uint8ClampedAttribute,Uint8ClampedBufferAttribute:Uint8ClampedBufferAttribute,Uniform:Uniform,UniformsLib:UniformsLib,UniformsUtils:UniformsUtils,UnsignedByteType:UnsignedByteType,UnsignedInt248Type:UnsignedInt248Type,UnsignedIntType:UnsignedIntType,UnsignedShort4444Type:UnsignedShort4444Type,UnsignedShort5551Type:UnsignedShort5551Type,UnsignedShort565Type:UnsignedShort565Type,UnsignedShortType:UnsignedShortType,VSMShadowMap:VSMShadowMap,Vector2:Vector2,Vector3:Vector3$1,Vector4:Vector4,VectorKeyframeTrack:VectorKeyframeTrack,Vertex:Vertex,VertexColors:VertexColors,VideoTexture:VideoTexture,WebGL1Renderer:WebGL1Renderer,WebGLCubeRenderTarget:WebGLCubeRenderTarget,WebGLMultisampleRenderTarget:WebGLMultisampleRenderTarget,WebGLRenderTarget:WebGLRenderTarget,WebGLRenderTargetCube:WebGLRenderTargetCube,WebGLRenderer:WebGLRenderer,WebGLUtils:WebGLUtils,WireframeGeometry:WireframeGeometry,WireframeHelper:WireframeHelper,WrapAroundEnding:WrapAroundEnding,XHRLoader:XHRLoader,ZeroCurvatureEnding:ZeroCurvatureEnding,ZeroFactor:ZeroFactor,ZeroSlopeEnding:ZeroSlopeEnding,ZeroStencilOp:ZeroStencilOp,sRGBEncoding:sRGBEncoding});var PREFIX = "[Mage]";
53922
53922
  var DEPRECATED = "[DEPRECATED]";
53923
53923
  var DEPRECATIONS = {
53924
+ PARTICLES_OLD: "".concat(PREFIX, " ").concat(DEPRECATED, " This Particle System is outdated and will be removed in the next major release"),
53924
53925
  PARTICLES_ADD_PARTICLE_EMITTER: "".concat(PREFIX, " ").concat(DEPRECATED, " Particles.addParticleEmitter is deprecated, use Particles.add instead. Will be removed in the next major release"),
53925
53926
  MODELS_GETMODEL: "".concat(PREFIX, " ").concat(DEPRECATED, " Models.getModel is deprecated, use Models.get instead. Will be removed in next major release"),
53926
53927
  SCRIPTS_CREATE: "".concat(PREFIX, " ").concat(DEPRECATED, " Scripts.create is deprecated, use Scripts.register instead. Will be removed in next major release."),
@@ -54039,73 +54040,77 @@ var LABEL_DOMELEMENT_MISSING = "".concat(PREFIX, " Could not create Label, domEl
54039
54040
 
54040
54041
  return BaseScript;
54041
54042
  }();/**!
54042
- * hotkeys-js v3.9.4
54043
+ * hotkeys-js v3.13.7
54043
54044
  * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
54044
54045
  *
54045
- * Copyright (c) 2022 kenny wong <wowohoo@qq.com>
54046
- * http://jaywcjlove.github.io/hotkeys
54046
+ * Copyright (c) 2024 kenny wong <wowohoo@qq.com>
54047
+ * https://github.com/jaywcjlove/hotkeys-js.git
54048
+ *
54049
+ * @website: https://jaywcjlove.github.io/hotkeys-js
54050
+
54047
54051
  * Licensed under the MIT license
54048
54052
  */
54049
54053
 
54050
- var isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false; // 绑定事件
54054
+ const isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false;
54051
54055
 
54056
+ // 绑定事件
54052
54057
  function addEvent(object, event, method, useCapture) {
54053
54058
  if (object.addEventListener) {
54054
54059
  object.addEventListener(event, method, useCapture);
54055
54060
  } else if (object.attachEvent) {
54056
- object.attachEvent("on".concat(event), function () {
54057
- method(window.event);
54058
- });
54061
+ object.attachEvent("on".concat(event), method);
54059
54062
  }
54060
- } // 修饰键转换成对应的键码
54061
-
54062
-
54063
- function getMods(modifier, key) {
54064
- var mods = key.slice(0, key.length - 1);
54065
-
54066
- for (var i = 0; i < mods.length; i++) {
54067
- mods[i] = modifier[mods[i].toLowerCase()];
54063
+ }
54064
+ function removeEvent(object, event, method, useCapture) {
54065
+ if (object.removeEventListener) {
54066
+ object.removeEventListener(event, method, useCapture);
54067
+ } else if (object.detachEvent) {
54068
+ object.detachEvent("on".concat(event), method);
54068
54069
  }
54070
+ }
54069
54071
 
54072
+ // 修饰键转换成对应的键码
54073
+ function getMods(modifier, key) {
54074
+ const mods = key.slice(0, key.length - 1);
54075
+ for (let i = 0; i < mods.length; i++) mods[i] = modifier[mods[i].toLowerCase()];
54070
54076
  return mods;
54071
- } // 处理传的key字符串转换成数组
54072
-
54077
+ }
54073
54078
 
54079
+ // 处理传的key字符串转换成数组
54074
54080
  function getKeys(key) {
54075
54081
  if (typeof key !== 'string') key = '';
54076
54082
  key = key.replace(/\s/g, ''); // 匹配任何空白字符,包括空格、制表符、换页符等等
54083
+ const keys = key.split(','); // 同时设置多个快捷键,以','分割
54084
+ let index = keys.lastIndexOf('');
54077
54085
 
54078
- var keys = key.split(','); // 同时设置多个快捷键,以','分割
54079
-
54080
- var index = keys.lastIndexOf(''); // 快捷键可能包含',',需特殊处理
54081
-
54086
+ // 快捷键可能包含',',需特殊处理
54082
54087
  for (; index >= 0;) {
54083
54088
  keys[index - 1] += ',';
54084
54089
  keys.splice(index, 1);
54085
54090
  index = keys.lastIndexOf('');
54086
54091
  }
54087
-
54088
54092
  return keys;
54089
- } // 比较修饰键的数组
54090
-
54093
+ }
54091
54094
 
54095
+ // 比较修饰键的数组
54092
54096
  function compareArray(a1, a2) {
54093
- var arr1 = a1.length >= a2.length ? a1 : a2;
54094
- var arr2 = a1.length >= a2.length ? a2 : a1;
54095
- var isIndex = true;
54096
-
54097
- for (var i = 0; i < arr1.length; i++) {
54097
+ const arr1 = a1.length >= a2.length ? a1 : a2;
54098
+ const arr2 = a1.length >= a2.length ? a2 : a1;
54099
+ let isIndex = true;
54100
+ for (let i = 0; i < arr1.length; i++) {
54098
54101
  if (arr2.indexOf(arr1[i]) === -1) isIndex = false;
54099
54102
  }
54100
-
54101
54103
  return isIndex;
54102
54104
  }
54103
54105
 
54104
- var _keyMap = {
54106
+ // Special Keys
54107
+ const _keyMap = {
54105
54108
  backspace: 8,
54109
+ '⌫': 8,
54106
54110
  tab: 9,
54107
54111
  clear: 12,
54108
54112
  enter: 13,
54113
+ '↩': 13,
54109
54114
  return: 13,
54110
54115
  esc: 27,
54111
54116
  escape: 27,
@@ -54151,9 +54156,10 @@ var _keyMap = {
54151
54156
  '[': 219,
54152
54157
  ']': 221,
54153
54158
  '\\': 220
54154
- }; // Modifier Keys
54159
+ };
54155
54160
 
54156
- var _modifier = {
54161
+ // Modifier Keys
54162
+ const _modifier = {
54157
54163
  // shiftKey
54158
54164
  '⇧': 16,
54159
54165
  shift: 16,
@@ -54170,7 +54176,7 @@ var _modifier = {
54170
54176
  cmd: 91,
54171
54177
  command: 91
54172
54178
  };
54173
- var modifierMap = {
54179
+ const modifierMap = {
54174
54180
  16: 'shiftKey',
54175
54181
  18: 'altKey',
54176
54182
  17: 'ctrlKey',
@@ -54180,127 +54186,153 @@ var modifierMap = {
54180
54186
  altKey: 18,
54181
54187
  metaKey: 91
54182
54188
  };
54183
- var _mods = {
54189
+ const _mods = {
54184
54190
  16: false,
54185
54191
  18: false,
54186
54192
  17: false,
54187
54193
  91: false
54188
54194
  };
54189
- var _handlers = {}; // F1~F12 special key
54195
+ const _handlers = {};
54190
54196
 
54191
- for (var k$1 = 1; k$1 < 20; k$1++) {
54192
- _keyMap["f".concat(k$1)] = 111 + k$1;
54197
+ // F1~F12 special key
54198
+ for (let k = 1; k < 20; k++) {
54199
+ _keyMap["f".concat(k)] = 111 + k;
54193
54200
  }
54194
54201
 
54195
- var _downKeys = []; // 记录摁下的绑定键
54196
-
54197
- var winListendFocus = false; // window是否已经监听了focus事件
54198
-
54199
- var _scope = 'all'; // 默认热键范围
54202
+ let _downKeys = []; // 记录摁下的绑定键
54203
+ let winListendFocus = null; // window是否已经监听了focus事件
54204
+ let _scope = 'all'; // 默认热键范围
54205
+ const elementEventMap = new Map(); // 已绑定事件的节点记录
54200
54206
 
54201
- var elementHasBindEvent = []; // 已绑定事件的节点记录
54202
54207
  // 返回键码
54208
+ const code = x => _keyMap[x.toLowerCase()] || _modifier[x.toLowerCase()] || x.toUpperCase().charCodeAt(0);
54209
+ const getKey = x => Object.keys(_keyMap).find(k => _keyMap[k] === x);
54210
+ const getModifier = x => Object.keys(_modifier).find(k => _modifier[k] === x);
54203
54211
 
54204
- var code = function code(x) {
54205
- return _keyMap[x.toLowerCase()] || _modifier[x.toLowerCase()] || x.toUpperCase().charCodeAt(0);
54206
- }; // 设置获取当前范围(默认为'所有')
54207
-
54208
-
54212
+ // 设置获取当前范围(默认为'所有')
54209
54213
  function setScope(scope) {
54210
54214
  _scope = scope || 'all';
54211
- } // 获取当前范围
54212
-
54213
-
54215
+ }
54216
+ // 获取当前范围
54214
54217
  function getScope() {
54215
54218
  return _scope || 'all';
54216
- } // 获取摁下绑定键的键值
54217
-
54218
-
54219
+ }
54220
+ // 获取摁下绑定键的键值
54219
54221
  function getPressedKeyCodes() {
54220
54222
  return _downKeys.slice(0);
54221
- } // 表单控件控件判断 返回 Boolean
54222
- // hotkey is effective only when filter return true
54223
-
54223
+ }
54224
+ function getPressedKeyString() {
54225
+ return _downKeys.map(c => getKey(c) || getModifier(c) || String.fromCharCode(c));
54226
+ }
54227
+ function getAllKeyCodes() {
54228
+ const result = [];
54229
+ Object.keys(_handlers).forEach(k => {
54230
+ _handlers[k].forEach(_ref => {
54231
+ let {
54232
+ key,
54233
+ scope,
54234
+ mods,
54235
+ shortcut
54236
+ } = _ref;
54237
+ result.push({
54238
+ scope,
54239
+ shortcut,
54240
+ mods,
54241
+ keys: key.split('+').map(v => code(v))
54242
+ });
54243
+ });
54244
+ });
54245
+ return result;
54246
+ }
54224
54247
 
54248
+ // 表单控件控件判断 返回 Boolean
54249
+ // hotkey is effective only when filter return true
54225
54250
  function filter$1(event) {
54226
- var target = event.target || event.srcElement;
54227
- var tagName = target.tagName;
54228
- var flag = true; // ignore: isContentEditable === 'true', <input> and <textarea> when readOnly state is false, <select>
54229
-
54230
- if (target.isContentEditable || (tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT') && !target.readOnly) {
54251
+ const target = event.target || event.srcElement;
54252
+ const {
54253
+ tagName
54254
+ } = target;
54255
+ let flag = true;
54256
+ const isInput = tagName === 'INPUT' && !['checkbox', 'radio', 'range', 'button', 'file', 'reset', 'submit', 'color'].includes(target.type);
54257
+ // ignore: isContentEditable === 'true', <input> and <textarea> when readOnly state is false, <select>
54258
+ if (target.isContentEditable || (isInput || tagName === 'TEXTAREA' || tagName === 'SELECT') && !target.readOnly) {
54231
54259
  flag = false;
54232
54260
  }
54233
-
54234
54261
  return flag;
54235
- } // 判断摁下的键是否为某个键,返回true或者false
54236
-
54262
+ }
54237
54263
 
54264
+ // 判断摁下的键是否为某个键,返回true或者false
54238
54265
  function isPressed(keyCode) {
54239
54266
  if (typeof keyCode === 'string') {
54240
54267
  keyCode = code(keyCode); // 转换成键码
54241
54268
  }
54242
-
54243
54269
  return _downKeys.indexOf(keyCode) !== -1;
54244
- } // 循环删除handlers中的所有 scope(范围)
54245
-
54270
+ }
54246
54271
 
54272
+ // 循环删除handlers中的所有 scope(范围)
54247
54273
  function deleteScope(scope, newScope) {
54248
- var handlers;
54249
- var i; // 没有指定scope,获取scope
54274
+ let handlers;
54275
+ let i;
54250
54276
 
54277
+ // 没有指定scope,获取scope
54251
54278
  if (!scope) scope = getScope();
54252
-
54253
- for (var key in _handlers) {
54279
+ for (const key in _handlers) {
54254
54280
  if (Object.prototype.hasOwnProperty.call(_handlers, key)) {
54255
54281
  handlers = _handlers[key];
54256
-
54257
54282
  for (i = 0; i < handlers.length;) {
54258
- if (handlers[i].scope === scope) handlers.splice(i, 1);else i++;
54283
+ if (handlers[i].scope === scope) {
54284
+ const deleteItems = handlers.splice(i, 1);
54285
+ deleteItems.forEach(_ref2 => {
54286
+ let {
54287
+ element
54288
+ } = _ref2;
54289
+ return removeKeyEvent(element);
54290
+ });
54291
+ } else {
54292
+ i++;
54293
+ }
54259
54294
  }
54260
54295
  }
54261
- } // 如果scope被删除,将scope重置为all
54262
-
54296
+ }
54263
54297
 
54298
+ // 如果scope被删除,将scope重置为all
54264
54299
  if (getScope() === scope) setScope(newScope || 'all');
54265
- } // 清除修饰键
54266
-
54300
+ }
54267
54301
 
54302
+ // 清除修饰键
54268
54303
  function clearModifier(event) {
54269
- var key = event.keyCode || event.which || event.charCode;
54270
-
54271
- var i = _downKeys.indexOf(key); // 从列表中清除按压过的键
54272
-
54304
+ let key = event.keyCode || event.which || event.charCode;
54305
+ const i = _downKeys.indexOf(key);
54273
54306
 
54307
+ // 从列表中清除按压过的键
54274
54308
  if (i >= 0) {
54275
54309
  _downKeys.splice(i, 1);
54276
- } // 特殊处理 cmmand 键,在 cmmand 组合快捷键 keyup 只执行一次的问题
54277
-
54278
-
54310
+ }
54311
+ // 特殊处理 cmmand 键,在 cmmand 组合快捷键 keyup 只执行一次的问题
54279
54312
  if (event.key && event.key.toLowerCase() === 'meta') {
54280
54313
  _downKeys.splice(0, _downKeys.length);
54281
- } // 修饰键 shiftKey altKey ctrlKey (command||metaKey) 清除
54282
-
54314
+ }
54283
54315
 
54316
+ // 修饰键 shiftKey altKey ctrlKey (command||metaKey) 清除
54284
54317
  if (key === 93 || key === 224) key = 91;
54285
-
54286
54318
  if (key in _mods) {
54287
- _mods[key] = false; // 将修饰键重置为false
54319
+ _mods[key] = false;
54288
54320
 
54289
- for (var k in _modifier) {
54290
- if (_modifier[k] === key) hotkeys[k] = false;
54291
- }
54321
+ // 将修饰键重置为false
54322
+ for (const k in _modifier) if (_modifier[k] === key) hotkeys[k] = false;
54292
54323
  }
54293
54324
  }
54294
-
54295
54325
  function unbind(keysInfo) {
54296
54326
  // unbind(), unbind all keys
54297
54327
  if (typeof keysInfo === 'undefined') {
54298
- Object.keys(_handlers).forEach(function (key) {
54299
- return delete _handlers[key];
54328
+ Object.keys(_handlers).forEach(key => {
54329
+ Array.isArray(_handlers[key]) && _handlers[key].forEach(info => eachUnbind(info));
54330
+ delete _handlers[key];
54300
54331
  });
54332
+ removeKeyEvent(null);
54301
54333
  } else if (Array.isArray(keysInfo)) {
54302
54334
  // support like : unbind([{key: 'ctrl+a', scope: 's1'}, {key: 'ctrl-a', scope: 's2', splitKey: '-'}])
54303
- keysInfo.forEach(function (info) {
54335
+ keysInfo.forEach(info => {
54304
54336
  if (info.key) eachUnbind(info);
54305
54337
  });
54306
54338
  } else if (typeof keysInfo === 'object') {
@@ -54310,73 +54342,75 @@ function unbind(keysInfo) {
54310
54342
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
54311
54343
  args[_key - 1] = arguments[_key];
54312
54344
  }
54313
-
54314
54345
  // support old method
54315
54346
  // eslint-disable-line
54316
- var scope = args[0],
54317
- method = args[1];
54318
-
54347
+ let [scope, method] = args;
54319
54348
  if (typeof scope === 'function') {
54320
54349
  method = scope;
54321
54350
  scope = '';
54322
54351
  }
54323
-
54324
54352
  eachUnbind({
54325
54353
  key: keysInfo,
54326
- scope: scope,
54327
- method: method,
54354
+ scope,
54355
+ method,
54328
54356
  splitKey: '+'
54329
54357
  });
54330
54358
  }
54331
- } // 解除绑定某个范围的快捷键
54332
-
54333
-
54334
- var eachUnbind = function eachUnbind(_ref) {
54335
- var key = _ref.key,
54336
- scope = _ref.scope,
54337
- method = _ref.method,
54338
- _ref$splitKey = _ref.splitKey,
54339
- splitKey = _ref$splitKey === void 0 ? '+' : _ref$splitKey;
54340
- var multipleKeys = getKeys(key);
54341
- multipleKeys.forEach(function (originKey) {
54342
- var unbindKeys = originKey.split(splitKey);
54343
- var len = unbindKeys.length;
54344
- var lastKey = unbindKeys[len - 1];
54345
- var keyCode = lastKey === '*' ? '*' : code(lastKey);
54346
- if (!_handlers[keyCode]) return; // 判断是否传入范围,没有就获取范围
54359
+ }
54347
54360
 
54361
+ // 解除绑定某个范围的快捷键
54362
+ const eachUnbind = _ref3 => {
54363
+ let {
54364
+ key,
54365
+ scope,
54366
+ method,
54367
+ splitKey = '+'
54368
+ } = _ref3;
54369
+ const multipleKeys = getKeys(key);
54370
+ multipleKeys.forEach(originKey => {
54371
+ const unbindKeys = originKey.split(splitKey);
54372
+ const len = unbindKeys.length;
54373
+ const lastKey = unbindKeys[len - 1];
54374
+ const keyCode = lastKey === '*' ? '*' : code(lastKey);
54375
+ if (!_handlers[keyCode]) return;
54376
+ // 判断是否传入范围,没有就获取范围
54348
54377
  if (!scope) scope = getScope();
54349
- var mods = len > 1 ? getMods(_modifier, unbindKeys) : [];
54350
- _handlers[keyCode] = _handlers[keyCode].filter(function (record) {
54378
+ const mods = len > 1 ? getMods(_modifier, unbindKeys) : [];
54379
+ const unbindElements = [];
54380
+ _handlers[keyCode] = _handlers[keyCode].filter(record => {
54351
54381
  // 通过函数判断,是否解除绑定,函数相等直接返回
54352
- var isMatchingMethod = method ? record.method === method : true;
54353
- return !(isMatchingMethod && record.scope === scope && compareArray(record.mods, mods));
54382
+ const isMatchingMethod = method ? record.method === method : true;
54383
+ const isUnbind = isMatchingMethod && record.scope === scope && compareArray(record.mods, mods);
54384
+ if (isUnbind) unbindElements.push(record.element);
54385
+ return !isUnbind;
54354
54386
  });
54387
+ unbindElements.forEach(element => removeKeyEvent(element));
54355
54388
  });
54356
- }; // 对监听对应快捷键的回调函数进行处理
54357
-
54389
+ };
54358
54390
 
54391
+ // 对监听对应快捷键的回调函数进行处理
54359
54392
  function eventHandler(event, handler, scope, element) {
54360
54393
  if (handler.element !== element) {
54361
54394
  return;
54362
54395
  }
54396
+ let modifiersMatch;
54363
54397
 
54364
- var modifiersMatch; // 看它是否在当前范围
54365
-
54398
+ // 看它是否在当前范围
54366
54399
  if (handler.scope === scope || handler.scope === 'all') {
54367
54400
  // 检查是否匹配修饰符(如果有返回true)
54368
54401
  modifiersMatch = handler.mods.length > 0;
54369
-
54370
- for (var y in _mods) {
54402
+ for (const y in _mods) {
54371
54403
  if (Object.prototype.hasOwnProperty.call(_mods, y)) {
54372
54404
  if (!_mods[y] && handler.mods.indexOf(+y) > -1 || _mods[y] && handler.mods.indexOf(+y) === -1) {
54373
54405
  modifiersMatch = false;
54374
54406
  }
54375
54407
  }
54376
- } // 调用处理程序,如果是修饰键不做处理
54377
-
54408
+ }
54378
54409
 
54410
+ // 调用处理程序,如果是修饰键不做处理
54379
54411
  if (handler.mods.length === 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91] || modifiersMatch || handler.shortcut === '*') {
54412
+ handler.keys = [];
54413
+ handler.keys = handler.keys.concat(_downKeys);
54380
54414
  if (handler.method(event, handler) === false) {
54381
54415
  if (event.preventDefault) event.preventDefault();else event.returnValue = false;
54382
54416
  if (event.stopPropagation) event.stopPropagation();
@@ -54384,33 +54418,33 @@ function eventHandler(event, handler, scope, element) {
54384
54418
  }
54385
54419
  }
54386
54420
  }
54387
- } // 处理keydown事件
54388
-
54421
+ }
54389
54422
 
54423
+ // 处理keydown事件
54390
54424
  function dispatch$9(event, element) {
54391
- var asterisk = _handlers['*'];
54392
- var key = event.keyCode || event.which || event.charCode; // 表单控件过滤 默认表单控件不触发快捷键
54425
+ const asterisk = _handlers['*'];
54426
+ let key = event.keyCode || event.which || event.charCode;
54393
54427
 
54394
- if (!hotkeys.filter.call(this, event)) return; // Gecko(Firefox)的command键值224,在Webkit(Chrome)中保持一致
54395
- // Webkit左右 command 键值不一样
54428
+ // 表单控件过滤 默认表单控件不触发快捷键
54429
+ if (!hotkeys.filter.call(this, event)) return;
54396
54430
 
54431
+ // Gecko(Firefox)的command键值224,在Webkit(Chrome)中保持一致
54432
+ // Webkit左右 command 键值不一样
54397
54433
  if (key === 93 || key === 224) key = 91;
54434
+
54398
54435
  /**
54399
54436
  * Collect bound keys
54400
54437
  * If an Input Method Editor is processing key input and the event is keydown, return 229.
54401
54438
  * https://stackoverflow.com/questions/25043934/is-it-ok-to-ignore-keydown-events-with-keycode-229
54402
54439
  * http://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html
54403
54440
  */
54404
-
54405
54441
  if (_downKeys.indexOf(key) === -1 && key !== 229) _downKeys.push(key);
54406
54442
  /**
54407
54443
  * Jest test cases are required.
54408
54444
  * ===============================
54409
54445
  */
54410
-
54411
- ['ctrlKey', 'altKey', 'shiftKey', 'metaKey'].forEach(function (keyName) {
54412
- var keyNum = modifierMap[keyName];
54413
-
54446
+ ['ctrlKey', 'altKey', 'shiftKey', 'metaKey'].forEach(keyName => {
54447
+ const keyNum = modifierMap[keyName];
54414
54448
  if (event[keyName] && _downKeys.indexOf(keyNum) === -1) {
54415
54449
  _downKeys.push(keyNum);
54416
54450
  } else if (!event[keyName] && _downKeys.indexOf(keyNum) > -1) {
@@ -54430,17 +54464,17 @@ function dispatch$9(event, element) {
54430
54464
  */
54431
54465
 
54432
54466
  if (key in _mods) {
54433
- _mods[key] = true; // 将特殊字符的key注册到 hotkeys 上
54467
+ _mods[key] = true;
54434
54468
 
54435
- for (var k in _modifier) {
54469
+ // 将特殊字符的key注册到 hotkeys
54470
+ for (const k in _modifier) {
54436
54471
  if (_modifier[k] === key) hotkeys[k] = true;
54437
54472
  }
54438
-
54439
54473
  if (!asterisk) return;
54440
- } // 将 modifierMap 里面的修饰键绑定到 event 中
54441
-
54474
+ }
54442
54475
 
54443
- for (var e in _mods) {
54476
+ // modifierMap 里面的修饰键绑定到 event
54477
+ for (const e in _mods) {
54444
54478
  if (Object.prototype.hasOwnProperty.call(_mods, e)) {
54445
54479
  _mods[e] = event[modifierMap[e]];
54446
54480
  }
@@ -54451,47 +54485,43 @@ function dispatch$9(event, element) {
54451
54485
  * An example of this is ctrl+alt+m on a Swedish keyboard which is used to type μ.
54452
54486
  * Browser support: https://caniuse.com/#feat=keyboardevent-getmodifierstate
54453
54487
  */
54454
-
54455
-
54456
54488
  if (event.getModifierState && !(event.altKey && !event.ctrlKey) && event.getModifierState('AltGraph')) {
54457
54489
  if (_downKeys.indexOf(17) === -1) {
54458
54490
  _downKeys.push(17);
54459
54491
  }
54460
-
54461
54492
  if (_downKeys.indexOf(18) === -1) {
54462
54493
  _downKeys.push(18);
54463
54494
  }
54464
-
54465
54495
  _mods[17] = true;
54466
54496
  _mods[18] = true;
54467
- } // 获取范围 默认为 `all`
54468
-
54469
-
54470
- var scope = getScope(); // 对任何快捷键都需要做的处理
54497
+ }
54471
54498
 
54499
+ // 获取范围 默认为 `all`
54500
+ const scope = getScope();
54501
+ // 对任何快捷键都需要做的处理
54472
54502
  if (asterisk) {
54473
- for (var i = 0; i < asterisk.length; i++) {
54503
+ for (let i = 0; i < asterisk.length; i++) {
54474
54504
  if (asterisk[i].scope === scope && (event.type === 'keydown' && asterisk[i].keydown || event.type === 'keyup' && asterisk[i].keyup)) {
54475
54505
  eventHandler(event, asterisk[i], scope, element);
54476
54506
  }
54477
54507
  }
54478
- } // key 不在 _handlers 中返回
54479
-
54480
-
54508
+ }
54509
+ // key 不在 _handlers 中返回
54481
54510
  if (!(key in _handlers)) return;
54482
-
54483
- for (var _i = 0; _i < _handlers[key].length; _i++) {
54484
- if (event.type === 'keydown' && _handlers[key][_i].keydown || event.type === 'keyup' && _handlers[key][_i].keyup) {
54485
- if (_handlers[key][_i].key) {
54486
- var record = _handlers[key][_i];
54487
- var splitKey = record.splitKey;
54488
- var keyShortcut = record.key.split(splitKey);
54489
- var _downKeysCurrent = []; // 记录当前按键键值
54490
-
54491
- for (var a = 0; a < keyShortcut.length; a++) {
54511
+ const handlerKey = _handlers[key];
54512
+ const keyLen = handlerKey.length;
54513
+ for (let i = 0; i < keyLen; i++) {
54514
+ if (event.type === 'keydown' && handlerKey[i].keydown || event.type === 'keyup' && handlerKey[i].keyup) {
54515
+ if (handlerKey[i].key) {
54516
+ const record = handlerKey[i];
54517
+ const {
54518
+ splitKey
54519
+ } = record;
54520
+ const keyShortcut = record.key.split(splitKey);
54521
+ const _downKeysCurrent = []; // 记录当前按键键值
54522
+ for (let a = 0; a < keyShortcut.length; a++) {
54492
54523
  _downKeysCurrent.push(code(keyShortcut[a]));
54493
54524
  }
54494
-
54495
54525
  if (_downKeysCurrent.sort().join('') === _downKeys.sort().join('')) {
54496
54526
  // 找到处理内容
54497
54527
  eventHandler(event, record, scope, element);
@@ -54499,139 +54529,187 @@ function dispatch$9(event, element) {
54499
54529
  }
54500
54530
  }
54501
54531
  }
54502
- } // 判断 element 是否已经绑定事件
54503
-
54504
-
54505
- function isElementBind(element) {
54506
- return elementHasBindEvent.indexOf(element) > -1;
54507
54532
  }
54508
-
54509
54533
  function hotkeys(key, option, method) {
54510
54534
  _downKeys = [];
54511
- var keys = getKeys(key); // 需要处理的快捷键列表
54512
-
54513
- var mods = [];
54514
- var scope = 'all'; // scope默认为all,所有范围都有效
54515
-
54516
- var element = document; // 快捷键事件绑定节点
54517
-
54518
- var i = 0;
54519
- var keyup = false;
54520
- var keydown = true;
54521
- var splitKey = '+';
54522
- var capture = false; // 对为设定范围的判断
54523
-
54535
+ const keys = getKeys(key); // 需要处理的快捷键列表
54536
+ let mods = [];
54537
+ let scope = 'all'; // scope默认为all,所有范围都有效
54538
+ let element = document; // 快捷键事件绑定节点
54539
+ let i = 0;
54540
+ let keyup = false;
54541
+ let keydown = true;
54542
+ let splitKey = '+';
54543
+ let capture = false;
54544
+ let single = false; // 单个callback
54545
+
54546
+ // 对为设定范围的判断
54524
54547
  if (method === undefined && typeof option === 'function') {
54525
54548
  method = option;
54526
54549
  }
54527
-
54528
54550
  if (Object.prototype.toString.call(option) === '[object Object]') {
54529
54551
  if (option.scope) scope = option.scope; // eslint-disable-line
54530
-
54531
54552
  if (option.element) element = option.element; // eslint-disable-line
54532
-
54533
54553
  if (option.keyup) keyup = option.keyup; // eslint-disable-line
54534
-
54535
54554
  if (option.keydown !== undefined) keydown = option.keydown; // eslint-disable-line
54536
-
54537
54555
  if (option.capture !== undefined) capture = option.capture; // eslint-disable-line
54538
-
54539
54556
  if (typeof option.splitKey === 'string') splitKey = option.splitKey; // eslint-disable-line
54557
+ if (option.single === true) single = true; // eslint-disable-line
54540
54558
  }
54559
+ if (typeof option === 'string') scope = option;
54541
54560
 
54542
- if (typeof option === 'string') scope = option; // 对于每个快捷键进行处理
54561
+ // 如果只允许单个callback,先unbind
54562
+ if (single) unbind(key, scope);
54543
54563
 
54564
+ // 对于每个快捷键进行处理
54544
54565
  for (; i < keys.length; i++) {
54545
54566
  key = keys[i].split(splitKey); // 按键列表
54567
+ mods = [];
54546
54568
 
54547
- mods = []; // 如果是组合快捷键取得组合快捷键
54548
-
54549
- if (key.length > 1) mods = getMods(_modifier, key); // 将非修饰键转化为键码
54569
+ // 如果是组合快捷键取得组合快捷键
54570
+ if (key.length > 1) mods = getMods(_modifier, key);
54550
54571
 
54572
+ // 将非修饰键转化为键码
54551
54573
  key = key[key.length - 1];
54552
54574
  key = key === '*' ? '*' : code(key); // *表示匹配所有快捷键
54553
- // 判断key是否在_handlers中,不在就赋一个空数组
54554
54575
 
54576
+ // 判断key是否在_handlers中,不在就赋一个空数组
54555
54577
  if (!(key in _handlers)) _handlers[key] = [];
54556
-
54557
54578
  _handlers[key].push({
54558
- keyup: keyup,
54559
- keydown: keydown,
54560
- scope: scope,
54561
- mods: mods,
54579
+ keyup,
54580
+ keydown,
54581
+ scope,
54582
+ mods,
54562
54583
  shortcut: keys[i],
54563
- method: method,
54584
+ method,
54564
54585
  key: keys[i],
54565
- splitKey: splitKey,
54566
- element: element
54586
+ splitKey,
54587
+ element
54567
54588
  });
54568
- } // 在全局document上设置快捷键
54569
-
54570
-
54571
- if (typeof element !== 'undefined' && !isElementBind(element) && window) {
54572
- elementHasBindEvent.push(element);
54573
- addEvent(element, 'keydown', function (e) {
54574
- dispatch$9(e, element);
54575
- }, capture);
54576
-
54589
+ }
54590
+ // 在全局document上设置快捷键
54591
+ if (typeof element !== 'undefined' && window) {
54592
+ if (!elementEventMap.has(element)) {
54593
+ const keydownListener = function () {
54594
+ let event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.event;
54595
+ return dispatch$9(event, element);
54596
+ };
54597
+ const keyupListenr = function () {
54598
+ let event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.event;
54599
+ dispatch$9(event, element);
54600
+ clearModifier(event);
54601
+ };
54602
+ elementEventMap.set(element, {
54603
+ keydownListener,
54604
+ keyupListenr,
54605
+ capture
54606
+ });
54607
+ addEvent(element, 'keydown', keydownListener, capture);
54608
+ addEvent(element, 'keyup', keyupListenr, capture);
54609
+ }
54577
54610
  if (!winListendFocus) {
54578
- winListendFocus = true;
54579
- addEvent(window, 'focus', function () {
54611
+ const listener = () => {
54580
54612
  _downKeys = [];
54581
- }, capture);
54613
+ };
54614
+ winListendFocus = {
54615
+ listener,
54616
+ capture
54617
+ };
54618
+ addEvent(window, 'focus', listener, capture);
54582
54619
  }
54583
-
54584
- addEvent(element, 'keyup', function (e) {
54585
- dispatch$9(e, element);
54586
- clearModifier(e);
54587
- }, capture);
54588
54620
  }
54589
54621
  }
54590
-
54591
54622
  function trigger(shortcut) {
54592
- var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
54593
- Object.keys(_handlers).forEach(function (key) {
54594
- var data = _handlers[key].find(function (item) {
54595
- return item.scope === scope && item.shortcut === shortcut;
54623
+ let scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
54624
+ Object.keys(_handlers).forEach(key => {
54625
+ const dataList = _handlers[key].filter(item => item.scope === scope && item.shortcut === shortcut);
54626
+ dataList.forEach(data => {
54627
+ if (data && data.method) {
54628
+ data.method();
54629
+ }
54596
54630
  });
54597
-
54598
- if (data && data.method) {
54599
- data.method();
54600
- }
54601
54631
  });
54602
54632
  }
54603
54633
 
54604
- var _api = {
54605
- setScope: setScope,
54606
- getScope: getScope,
54607
- deleteScope: deleteScope,
54608
- getPressedKeyCodes: getPressedKeyCodes,
54609
- isPressed: isPressed,
54634
+ // 销毁事件,unbind之后判断element上是否还有键盘快捷键,如果没有移除监听
54635
+ function removeKeyEvent(element) {
54636
+ const values = Object.values(_handlers).flat();
54637
+ const findindex = values.findIndex(_ref4 => {
54638
+ let {
54639
+ element: el
54640
+ } = _ref4;
54641
+ return el === element;
54642
+ });
54643
+ if (findindex < 0) {
54644
+ const {
54645
+ keydownListener,
54646
+ keyupListenr,
54647
+ capture
54648
+ } = elementEventMap.get(element) || {};
54649
+ if (keydownListener && keyupListenr) {
54650
+ removeEvent(element, 'keyup', keyupListenr, capture);
54651
+ removeEvent(element, 'keydown', keydownListener, capture);
54652
+ elementEventMap.delete(element);
54653
+ }
54654
+ }
54655
+ if (values.length <= 0 || elementEventMap.size <= 0) {
54656
+ // 移除所有的元素上的监听
54657
+ const eventKeys = Object.keys(elementEventMap);
54658
+ eventKeys.forEach(el => {
54659
+ const {
54660
+ keydownListener,
54661
+ keyupListenr,
54662
+ capture
54663
+ } = elementEventMap.get(el) || {};
54664
+ if (keydownListener && keyupListenr) {
54665
+ removeEvent(el, 'keyup', keyupListenr, capture);
54666
+ removeEvent(el, 'keydown', keydownListener, capture);
54667
+ elementEventMap.delete(el);
54668
+ }
54669
+ });
54670
+ // 清空 elementEventMap
54671
+ elementEventMap.clear();
54672
+ // 清空 _handlers
54673
+ Object.keys(_handlers).forEach(key => delete _handlers[key]);
54674
+ // 移除window上的focus监听
54675
+ if (winListendFocus) {
54676
+ const {
54677
+ listener,
54678
+ capture
54679
+ } = winListendFocus;
54680
+ removeEvent(window, 'focus', listener, capture);
54681
+ winListendFocus = null;
54682
+ }
54683
+ }
54684
+ }
54685
+ const _api = {
54686
+ getPressedKeyString,
54687
+ setScope,
54688
+ getScope,
54689
+ deleteScope,
54690
+ getPressedKeyCodes,
54691
+ getAllKeyCodes,
54692
+ isPressed,
54610
54693
  filter: filter$1,
54611
- trigger: trigger,
54612
- unbind: unbind,
54694
+ trigger,
54695
+ unbind,
54613
54696
  keyMap: _keyMap,
54614
54697
  modifier: _modifier,
54615
- modifierMap: modifierMap
54698
+ modifierMap
54616
54699
  };
54617
-
54618
- for (var a in _api) {
54700
+ for (const a in _api) {
54619
54701
  if (Object.prototype.hasOwnProperty.call(_api, a)) {
54620
54702
  hotkeys[a] = _api[a];
54621
54703
  }
54622
54704
  }
54623
-
54624
54705
  if (typeof window !== 'undefined') {
54625
- var _hotkeys = window.hotkeys;
54626
-
54627
- hotkeys.noConflict = function (deep) {
54706
+ const _hotkeys = window.hotkeys;
54707
+ hotkeys.noConflict = deep => {
54628
54708
  if (deep && window.hotkeys === hotkeys) {
54629
54709
  window.hotkeys = _hotkeys;
54630
54710
  }
54631
-
54632
54711
  return hotkeys;
54633
54712
  };
54634
-
54635
54713
  window.hotkeys = hotkeys;
54636
54714
  }var HOTKEYS_DEFAULT_OPTIONS = {
54637
54715
  keyup: true,
@@ -54728,6 +54806,7 @@ var Keyboard = /*#__PURE__*/function (_EventDispatcher) {
54728
54806
  }, {
54729
54807
  key: "isPressed",
54730
54808
  value: function isPressed(key) {
54809
+ console.log(key, hotkeys.getPressedKeyCodes());
54731
54810
  return hotkeys.isPressed(key);
54732
54811
  }
54733
54812
  }]);
@@ -55039,6 +55118,7 @@ var Config$1 = new Config();var Universe = /*#__PURE__*/function () {
55039
55118
  }, {
55040
55119
  key: "find",
55041
55120
  value: function find(element) {
55121
+ if (!element) return;
55042
55122
  var found;
55043
55123
  this.forEach(function (el) {
55044
55124
  if (el.has(element) && !found) {
@@ -57798,7 +57878,7 @@ function applyMiddleware() {
57798
57878
 
57799
57879
  var thunk = createThunkMiddleware();
57800
57880
  thunk.withExtraArgument = createThunkMiddleware;var name$1 = "mage-engine";
57801
- var version$1 = "3.23.11";
57881
+ var version$1 = "3.23.13";
57802
57882
  var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
57803
57883
  var main = "dist/mage.js";
57804
57884
  var author$1 = {
@@ -57840,7 +57920,7 @@ var dependencies = {
57840
57920
  "@babel/plugin-transform-runtime": "7.5.0",
57841
57921
  "@babel/runtime": "7.5.0",
57842
57922
  "between.js": "0.1.2-fix.2",
57843
- "hotkeys-js": "3.9.4",
57923
+ "hotkeys-js": "^3.13.7",
57844
57924
  "html-to-image": "^1.9.0",
57845
57925
  html2canvas: "^1.4.1",
57846
57926
  inferno: "7.3.2",
@@ -59084,7 +59164,7 @@ var BaseCar = /*#__PURE__*/function (_BaseScript) {
59084
59164
  function BaseCar() {
59085
59165
  _classCallCheck(this, BaseCar);
59086
59166
 
59087
- return _super.call(this, 'BaseCar');
59167
+ return _super.call(this, "BaseCar");
59088
59168
  }
59089
59169
 
59090
59170
  _createClass(BaseCar, [{
@@ -59092,13 +59172,13 @@ var BaseCar = /*#__PURE__*/function (_BaseScript) {
59092
59172
  value: function start(element, options) {
59093
59173
  var wheels = options.wheels,
59094
59174
  _options$acceleration = options.accelerationKey,
59095
- accelerationKey = _options$acceleration === void 0 ? 'w' : _options$acceleration,
59175
+ accelerationKey = _options$acceleration === void 0 ? "w" : _options$acceleration,
59096
59176
  _options$brakingKey = options.brakingKey,
59097
- brakingKey = _options$brakingKey === void 0 ? 's' : _options$brakingKey,
59177
+ brakingKey = _options$brakingKey === void 0 ? "s" : _options$brakingKey,
59098
59178
  _options$rightKey = options.rightKey,
59099
- rightKey = _options$rightKey === void 0 ? 'd' : _options$rightKey,
59179
+ rightKey = _options$rightKey === void 0 ? "d" : _options$rightKey,
59100
59180
  _options$leftKey = options.leftKey,
59101
- leftKey = _options$leftKey === void 0 ? 'a' : _options$leftKey;
59181
+ leftKey = _options$leftKey === void 0 ? "a" : _options$leftKey;
59102
59182
  options.debug;
59103
59183
  var _options$autostart = options.autostart,
59104
59184
  autostart = _options$autostart === void 0 ? true : _options$autostart,
@@ -59118,6 +59198,7 @@ var BaseCar = /*#__PURE__*/function (_BaseScript) {
59118
59198
  this.leftKey = leftKey;
59119
59199
  this.engineStarted = autostart;
59120
59200
  Input$1.enable();
59201
+ Input$1.keyboard.listenTo([accelerationKey, brakingKey, rightKey, leftKey]);
59121
59202
  Physics$1.addVehicle(this.car, _objectSpread2$1({
59122
59203
  wheels: wheels.map(function (w) {
59123
59204
  return w.uuid();
@@ -60267,7 +60348,8 @@ var tweenTo = function tweenTo(origin, target) {
60267
60348
  this.isMage = true;
60268
60349
  this.parent = false;
60269
60350
  this.tags = [DEFAULT_TAG];
60270
- }
60351
+ } // TODO: this is ridiculous, it's introducing a 200ms delay for no reason if delay is missing.
60352
+
60271
60353
  }, {
60272
60354
  key: "waitForBody",
60273
60355
  value: function waitForBody() {
@@ -60366,6 +60448,8 @@ var tweenTo = function tweenTo(origin, target) {
60366
60448
  }, {
60367
60449
  key: "isParentOf",
60368
60450
  value: function isParentOf(child) {
60451
+ if (!child) return false;
60452
+
60369
60453
  var comparator = function comparator(child) {
60370
60454
  return !!child.getBody().getObjectById(child.id);
60371
60455
  };
@@ -60381,6 +60465,8 @@ var tweenTo = function tweenTo(origin, target) {
60381
60465
  }, {
60382
60466
  key: "has",
60383
60467
  value: function has(child) {
60468
+ if (!child) return false;
60469
+
60384
60470
  if (child.isMage) {
60385
60471
  return this.equals(child) || this.isParentOf(child);
60386
60472
  } else {
@@ -61169,7 +61255,34 @@ var tweenTo = function tweenTo(origin, target) {
61169
61255
  }(EventDispatcher);var _MATERIAL_TEXTURE_MAP;
61170
61256
  var MATERIAL_TEXTURE_MAP = (_MATERIAL_TEXTURE_MAP = {}, _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.BASIC, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.SPECULAR]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.LAMBERT, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.SPECULAR, TEXTURES.EMISSIVE]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.PHONG, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.SPECULAR, TEXTURES.EMISSIVE, TEXTURES.BUMP, TEXTURES.DISPLACEMENT, TEXTURES.NORMAL]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.DEPTH, [TEXTURES.ALPHA, TEXTURES.MAP, TEXTURES.DISPLACEMENT]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.STANDARD, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.EMISSIVE, TEXTURES.BUMP, TEXTURES.DISPLACEMENT, TEXTURES.NORMAL, TEXTURES.METALNESS, TEXTURES.ROUGHNESS]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.THREE_TOON, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.BUMP, TEXTURES.DISPLACEMENT, TEXTURES.EMISSIVE, TEXTURES.GRADIENT, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.NORMAL]), _MATERIAL_TEXTURE_MAP);var material_constants=/*#__PURE__*/Object.freeze({__proto__:null,MATERIAL_TEXTURE_MAP:MATERIAL_TEXTURE_MAP});var isTextureMapAllowedForMaterial = function isTextureMapAllowedForMaterial(materialType, textureType) {
61171
61257
  return MATERIAL_TEXTURE_MAP[materialType] && MATERIAL_TEXTURE_MAP[materialType].includes(textureType);
61172
- };var _excluded$7 = ["position", "quaternion"],
61258
+ };var serializeMap = function serializeMap(map) {
61259
+ var reducer = function reducer(m) {
61260
+ return _toConsumableArray(m).reduce(function (a, v) {
61261
+ a[v[0]] = v[1];
61262
+ return a;
61263
+ }, {});
61264
+ };
61265
+
61266
+ var replacer = function replacer(key, value) {
61267
+ return value instanceof Map ? reducer(value) : value;
61268
+ };
61269
+
61270
+ return JSON.stringify(map, replacer);
61271
+ };
61272
+ var deserialiseMap = function deserialiseMap(o) {
61273
+ var json = JSON.parse(o);
61274
+ var m = new Map();
61275
+ Object.keys(json).forEach(function (k) {
61276
+ m.set(k, json[k]);
61277
+ });
61278
+ return m;
61279
+ };
61280
+ var populateMap = function populateMap(map, data) {
61281
+ Object.keys(data).forEach(function (k) {
61282
+ map.set(k, data[k]);
61283
+ });
61284
+ return map;
61285
+ };var map$1=/*#__PURE__*/Object.freeze({__proto__:null,serializeMap:serializeMap,deserialiseMap:deserialiseMap,populateMap:populateMap});var _excluded$7 = ["position", "quaternion"],
61173
61286
  _excluded2 = ["applyPhysicsUpdate"],
61174
61287
  _excluded3 = ["dt", "event"];
61175
61288
  var COLLIDER_TAG = "collider";
@@ -61381,13 +61494,13 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
61381
61494
  geometry = _options.geometry,
61382
61495
  material = _options.material,
61383
61496
  _body = _options.body;
61384
- _this.textures = {};
61497
+ _this.textures = new Map();
61385
61498
  _this.opacity = 1;
61386
61499
  _this.options = _objectSpread2$1(_objectSpread2$1({}, _options), {}, {
61387
61500
  name: name
61388
61501
  });
61389
61502
  _this.physicsOptions = DEFAULT_PHYSICS_OPTIONS;
61390
- _this.physicsState = {};
61503
+ _this.physicsState = new Map();
61391
61504
 
61392
61505
  _this.setBody({
61393
61506
  geometry: geometry,
@@ -61611,14 +61724,12 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
61611
61724
  _ref10.event;
61612
61725
  var data = _objectWithoutProperties(_ref10, _excluded3);
61613
61726
 
61614
- var physicsState = _objectSpread2$1(_objectSpread2$1({}, this.physicsState), data);
61615
-
61616
- this.physicsState = physicsState;
61727
+ populateMap(this.physicsState, data);
61617
61728
  }
61618
61729
  }, {
61619
61730
  key: "getPhysicsState",
61620
61731
  value: function getPhysicsState(key) {
61621
- return key ? this.physicsState[key] : this.physicsState;
61732
+ return key ? this.physicsState.get(key) : this.physicsState;
61622
61733
  }
61623
61734
  }, {
61624
61735
  key: "enablePhysics",
@@ -61724,7 +61835,7 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
61724
61835
  }, {
61725
61836
  key: "recordTexture",
61726
61837
  value: function recordTexture(textureId, textureType) {
61727
- this.textures[textureType] = textureId;
61838
+ this.textures.set(textureType, textureId);
61728
61839
  }
61729
61840
  }, {
61730
61841
  key: "setTexture",
@@ -61911,11 +62022,11 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
61911
62022
  var color = this.getColor();
61912
62023
  return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(Element.prototype), "toJSON", this).call(this, parseJSON)), {}, {
61913
62024
  physics: {
61914
- state: this.getPhysicsState(),
62025
+ state: serializeMap(this.getPhysicsState()),
61915
62026
  options: this.getPhysicsOptions()
61916
62027
  },
61917
62028
  body: this.body.toJSON(),
61918
- textures: this.textures,
62029
+ textures: serializeMap(this.textures),
61919
62030
  materialType: this.getMaterialType(),
61920
62031
  opacity: this.opacity,
61921
62032
  color: parseJSON ? serializeColor(color) : color
@@ -85543,14 +85654,15 @@ var Proton = three_proton_min.exports;var ParticleEmitterGroup = /*#__PURE__*/fu
85543
85654
  _classCallCheck(this, ParticleEmitterGroup);
85544
85655
 
85545
85656
  _this = _super.call(this, {
85546
- tag: 'particle '
85657
+ tag: "particle "
85547
85658
  });
85548
85659
  var _options$name = options.name,
85549
- name = _options$name === void 0 ? generateRandomName('EmitterGroup') : _options$name,
85660
+ name = _options$name === void 0 ? generateRandomName("EmitterGroup") : _options$name,
85550
85661
  system = options.system;
85551
85662
  _this.options = _objectSpread2$1(_objectSpread2$1({}, options), {}, {
85552
85663
  name: name
85553
85664
  });
85665
+ _this.system = new Map();
85554
85666
 
85555
85667
  _this.setBody({
85556
85668
  body: new Object3D()
@@ -85590,10 +85702,8 @@ var Proton = three_proton_min.exports;var ParticleEmitterGroup = /*#__PURE__*/fu
85590
85702
  }, {
85591
85703
  key: "isProtonEmitter",
85592
85704
  value: function isProtonEmitter() {
85593
- var _this2 = this;
85594
-
85595
- Object.keys(this.system).forEach(function (emitterId) {
85596
- return _this2.system[emitterId].isProtonEmitter();
85705
+ this.system.forEach(function (emitter) {
85706
+ return emitter.isProtonEmitter();
85597
85707
  });
85598
85708
  }
85599
85709
  }, {
@@ -85604,30 +85714,26 @@ var Proton = three_proton_min.exports;var ParticleEmitterGroup = /*#__PURE__*/fu
85604
85714
  }, {
85605
85715
  key: "hasSystem",
85606
85716
  value: function hasSystem() {
85607
- return !!this.system && !!Object.keys(this.system).length;
85717
+ return !!this.system && !!this.system.size > 0;
85608
85718
  }
85609
85719
  }, {
85610
85720
  key: "isSystemDead",
85611
85721
  value: function isSystemDead() {
85612
- var _this3 = this;
85613
-
85614
- Object.keys(this.system).forEach(function (emitterId) {
85615
- return _this3.system[emitterId].isSystemDead();
85722
+ this.system.forEach(function (emitter) {
85723
+ return emitter.isSystemDead();
85616
85724
  });
85617
85725
  }
85618
85726
  }, {
85619
85727
  key: "setSystem",
85620
85728
  value: function setSystem() {
85621
- var _this4 = this;
85729
+ var _this2 = this;
85622
85730
 
85623
85731
  var system = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
85624
- this.system = system.reduce(function (system, emitter) {
85625
- system[emitter.getName()] = emitter;
85626
-
85627
- _this4.add(emitter);
85732
+ system.forEach(function (emitter) {
85733
+ _this2.add(emitter);
85628
85734
 
85629
- return system;
85630
- }, {});
85735
+ _this2.system.set(emitter.getName(), emitter);
85736
+ });
85631
85737
  }
85632
85738
  }, {
85633
85739
  key: "getSystem",
@@ -85637,7 +85743,7 @@ var Proton = three_proton_min.exports;var ParticleEmitterGroup = /*#__PURE__*/fu
85637
85743
  }, {
85638
85744
  key: "getEmitter",
85639
85745
  value: function getEmitter(name) {
85640
- var emitter = this.system[name];
85746
+ var emitter = this.system.get(name);
85641
85747
 
85642
85748
  if (emitter) {
85643
85749
  return emitter;
@@ -85648,61 +85754,49 @@ var Proton = three_proton_min.exports;var ParticleEmitterGroup = /*#__PURE__*/fu
85648
85754
  }, {
85649
85755
  key: "forEach",
85650
85756
  value: function forEach(cb) {
85651
- var _this5 = this;
85652
-
85653
- Object.keys(this.system).forEach(function (k) {
85654
- cb(_this5.system[k]);
85757
+ this.system.forEach(function (emitter) {
85758
+ return cb(emitter);
85655
85759
  });
85656
85760
  }
85657
85761
  }, {
85658
85762
  key: "emit",
85659
85763
  value: function emit() {
85660
- var _this6 = this;
85661
-
85662
85764
  for (var _len = arguments.length, options = new Array(_len), _key = 0; _key < _len; _key++) {
85663
85765
  options[_key] = arguments[_key];
85664
85766
  }
85665
85767
 
85666
85768
  if (this.hasSystem()) {
85667
- Object.keys(this.system).forEach(function (emitterId) {
85668
- var _this6$system$emitter;
85669
-
85670
- return (_this6$system$emitter = _this6.system[emitterId]).emit.apply(_this6$system$emitter, options);
85769
+ this.system.forEach(function (emitter) {
85770
+ return emitter.emit.apply(emitter, options);
85671
85771
  });
85672
85772
  }
85673
85773
  }
85674
85774
  }, {
85675
85775
  key: "stop",
85676
85776
  value: function stop() {
85677
- var _this7 = this;
85678
-
85679
85777
  if (this.hasSystem()) {
85680
- Object.keys(this.system).forEach(function (emitterId) {
85681
- return _this7.system[emitterId].stop();
85778
+ this.system.forEach(function (emitter) {
85779
+ return emitter.stop();
85682
85780
  });
85683
85781
  }
85684
85782
  }
85685
85783
  }, {
85686
85784
  key: "dispose",
85687
85785
  value: function dispose() {
85688
- var _this8 = this;
85689
-
85690
85786
  _get(_getPrototypeOf(ParticleEmitterGroup.prototype), "dispose", this).call(this);
85691
85787
 
85692
- Object.keys(this.system).forEach(function (emitterId) {
85693
- return _this8.system[emitterId].dispose();
85788
+ this.system.forEach(function (emitter) {
85789
+ return emitter.dispose();
85694
85790
  });
85695
85791
  }
85696
85792
  }, {
85697
85793
  key: "update",
85698
85794
  value: function update(dt) {
85699
- var _this9 = this;
85700
-
85701
85795
  _get(_getPrototypeOf(ParticleEmitterGroup.prototype), "update", this).call(this, dt);
85702
85796
 
85703
85797
  if (this.hasSystem()) {
85704
- Object.keys(this.system).forEach(function (emitterId) {
85705
- return _this9.system[emitterId].update(dt);
85798
+ this.system.forEach(function (emitter) {
85799
+ return emitter.update(dt);
85706
85800
  });
85707
85801
  }
85708
85802
  }
@@ -86123,23 +86217,23 @@ var Trail = /*#__PURE__*/function (_ParticleEmitterGroup) {
86123
86217
 
86124
86218
  return Trail;
86125
86219
  }(ParticleEmitterGroup);var PARTICLES = {
86126
- RAIN: 'rain',
86127
- EXPLOSION: 'explosion',
86128
- FOUNTAIN: 'fountain',
86129
- FIRE: 'fire',
86130
- SNOW: 'snow',
86131
- TRAIL: 'trail'
86220
+ RAIN: "rain",
86221
+ EXPLOSION: "explosion",
86222
+ FOUNTAIN: "fountain",
86223
+ FIRE: "fire",
86224
+ SNOW: "snow",
86225
+ TRAIL: "trail"
86132
86226
  };
86227
+ var DEPRECATED_PARTICLES = [PARTICLES.RAIN, PARTICLES.FOUNTAIN, PARTICLES.SNOW];
86133
86228
  var GROUP = PARTICLE_EMITTER_TYPES.GROUP;
86134
86229
  var Particles = /*#__PURE__*/function () {
86135
86230
  function Particles() {
86136
- var _this = this,
86137
- _this$map;
86231
+ var _this = this;
86138
86232
 
86139
86233
  _classCallCheck(this, Particles);
86140
86234
 
86141
86235
  _defineProperty$1(this, "isRegisteredEmitter", function (name) {
86142
- return typeof name === 'string' && name in _this.map;
86236
+ return typeof name === "string" && _this.map.has(name);
86143
86237
  });
86144
86238
 
86145
86239
  _defineProperty$1(this, "hasEmitters", function () {
@@ -86148,15 +86242,20 @@ var Particles = /*#__PURE__*/function () {
86148
86242
 
86149
86243
  _defineProperty$1(this, "updateEmitters", function (dt) {
86150
86244
  _this.toDispose = [];
86151
- Object.keys(_this.emitters).forEach(function (uuid) {
86152
- var emitter = _this.emitters[uuid];
86153
86245
 
86246
+ _this.emitters.forEach(function (emitter) {
86154
86247
  _this.updateSingleEmitter(emitter, dt);
86155
86248
  });
86156
86249
  });
86157
86250
 
86158
- this.map = (_this$map = {}, _defineProperty$1(_this$map, PARTICLES.RAIN, Rain), _defineProperty$1(_this$map, PARTICLES.EXPLOSION, Explosion), _defineProperty$1(_this$map, PARTICLES.FOUNTAIN, Fountain), _defineProperty$1(_this$map, PARTICLES.FIRE, Fire), _defineProperty$1(_this$map, PARTICLES.SNOW, Snow), _defineProperty$1(_this$map, PARTICLES.TRAIL, Trail), _this$map);
86159
- this.emitters = {};
86251
+ this.map = new Map();
86252
+ this.map.set(PARTICLES.RAIN, Rain);
86253
+ this.map.set(PARTICLES.EXPLOSION, Explosion);
86254
+ this.map.set(PARTICLES.FOUNTAIN, Fountain);
86255
+ this.map.set(PARTICLES.FIRE, Fire);
86256
+ this.map.set(PARTICLES.SNOW, Snow);
86257
+ this.map.set(PARTICLES.TRAIL, Trail);
86258
+ this.emitters = new Map();
86160
86259
  this.toDispose = [];
86161
86260
  }
86162
86261
 
@@ -86174,12 +86273,12 @@ var Particles = /*#__PURE__*/function () {
86174
86273
  }, {
86175
86274
  key: "get",
86176
86275
  value: function get(name) {
86177
- return this.map[name] || null;
86276
+ return this.map.get(name) || null;
86178
86277
  }
86179
86278
  }, {
86180
86279
  key: "registerEmitter",
86181
86280
  value: function registerEmitter(key, Emitter) {
86182
- this.map[key] = Emitter;
86281
+ this.map.set(key, Emitter);
86183
86282
  }
86184
86283
  }, {
86185
86284
  key: "isValidEmitter",
@@ -86199,6 +86298,11 @@ var Particles = /*#__PURE__*/function () {
86199
86298
  var _this2 = this;
86200
86299
 
86201
86300
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
86301
+
86302
+ if (DEPRECATED_PARTICLES.includes(_emitter)) {
86303
+ console.warn(DEPRECATIONS.PARTICLES_OLD);
86304
+ }
86305
+
86202
86306
  var emitter;
86203
86307
 
86204
86308
  if (this.isRegisteredEmitter(_emitter)) {
@@ -86211,7 +86315,7 @@ var Particles = /*#__PURE__*/function () {
86211
86315
  return;
86212
86316
  }
86213
86317
 
86214
- this.emitters[emitter.uuid()] = emitter;
86318
+ this.emitters.set(emitter.uuid(), emitter);
86215
86319
 
86216
86320
  if (emitter.getType() === GROUP) {
86217
86321
  emitter.forEach(function (singleEmitter) {
@@ -86257,15 +86361,15 @@ var Particles = /*#__PURE__*/function () {
86257
86361
  var _this3 = this;
86258
86362
 
86259
86363
  this.toDispose.forEach(function (uuid) {
86260
- var emitter = _this3.emitters[uuid];
86364
+ var emitter = _this3.emitters.get(uuid);
86261
86365
 
86262
86366
  if (emitter.isProtonEmitter()) {
86263
86367
  _this3.removeProtonEmitter(emitter);
86264
86368
  } else {
86265
- _this3.emitters[uuid].dispose();
86369
+ emitter.dispose();
86266
86370
  }
86267
86371
 
86268
- delete _this3.emitters[uuid];
86372
+ _this3.emitters.delete(uuid);
86269
86373
  });
86270
86374
  }
86271
86375
  }, {
@@ -94501,4 +94605,4 @@ var Shaders$1 = new Shaders();var Shader = function Shader(name, attributes, uni
94501
94605
  } else {
94502
94606
  this.instance = this.shader.instance;
94503
94607
  }
94504
- };var constants = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, lib_constants), light_contants), material_constants), controls_contants);export{AUDIO_RAMPS,AmbientLight,AmbientSound,Atmosphere,Audio$1 as Audio,Axes,BUILTIN,BaseScript,Box,CONTROL_EVENTS,Camera,Color,Cone,Config$1 as Config,Controls$1 as Controls,Cube,CurveLine,Cylinder,DirectionalSound,ENTITY_EVENTS,ENTITY_TYPES,Element$1 as Element,Entity,EventDispatcher,FEATURES,Features$1 as Features,GameRunner$1 as GameRunner,Grid,HelperSprite,HemisphereLight,INPUT_EVENTS,Images$1 as Images,Input$1 as Input,Label,LabelComponent,Level,Lights$1 as Lights,Line,Mirror,Models$1 as Models,Ocean,PALETTES,PARTICLES,constants$1 as PHYSICS_CONSTANTS,PHYSICS_EVENTS,ParticleEmitter,ParticleEmitterGroup,Particles$1 as Particles,index$1 as Partykals,Physics$1 as Physics,Plane,PointLight,PostProcessing$1 as PostProcessing,Proton,ProtonParticleEmitter,Provider,Router$1 as Router,Scene$1 as Scene,Scripts$1 as Scripts,Shader,Sky,Skybox,Sound,Sphere,SpotLight,Sprite,Stats$1 as Stats,SunLight,three_module as THREE,THREEJS_CONTROL_EVENTS,Universe$1 as Universe,Vector3$1 as Vector3,Water,author,connect,constants,createElement,easing,functions,hitbox as hitboxUtils,index_esm as inferno,math,utils as physicsUtils,index$2 as rxjs,index as store,strings,uuid$1 as uuid,workers,index$3 as xstate};
94608
+ };var constants = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, lib_constants), light_contants), material_constants), controls_contants);export{AUDIO_RAMPS,AmbientLight,AmbientSound,Atmosphere,Audio$1 as Audio,Axes,BUILTIN,BaseScript,Box,CONTROL_EVENTS,Camera,Color,Cone,Config$1 as Config,Controls$1 as Controls,Cube,CurveLine,Cylinder,DirectionalSound,ENTITY_EVENTS,ENTITY_TYPES,Element$1 as Element,Entity,EventDispatcher,FEATURES,Features$1 as Features,GameRunner$1 as GameRunner,Grid,HelperSprite,HemisphereLight,INPUT_EVENTS,Images$1 as Images,Input$1 as Input,Label,LabelComponent,Level,Lights$1 as Lights,Line,Mirror,Models$1 as Models,Ocean,PALETTES,PARTICLES,constants$1 as PHYSICS_CONSTANTS,PHYSICS_EVENTS,ParticleEmitter,ParticleEmitterGroup,Particles$1 as Particles,index$1 as Partykals,Physics$1 as Physics,Plane,PointLight,PostProcessing$1 as PostProcessing,Proton,ProtonParticleEmitter,Provider,Router$1 as Router,Scene$1 as Scene,Scripts$1 as Scripts,Shader,Sky,Skybox,Sound,Sphere,SpotLight,Sprite,Stats$1 as Stats,SunLight,three_module as THREE,THREEJS_CONTROL_EVENTS,Universe$1 as Universe,Vector3$1 as Vector3,Water,author,connect,constants,createElement,easing,functions,hitbox as hitboxUtils,index_esm as inferno,map$1 as map,math,utils as physicsUtils,index$2 as rxjs,index as store,strings,uuid$1 as uuid,workers,index$3 as xstate};