@utsp/types 0.10.0-nightly.20251211194839.e68c16e → 0.10.0-nightly.20251213135145.115c488

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.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var A=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var I=(t,e,c)=>e in t?A(t,e,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[e]=c;var o=(t,e)=>A(t,"name",{value:e,configurable:!0});var ii=(t,e)=>{for(var c in e)A(t,c,{get:e[c],enumerable:!0})},ei=(t,e,c,f)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of p(e))!K.call(t,m)&&m!==c&&A(t,m,{get:()=>e[m],enumerable:!(f=R(e,m))||f.enumerable});return t};var ri=t=>ei(A({},"__esModule",{value:!0}),t);var u=(t,e,c)=>(I(t,typeof e!="symbol"?e+"":e,c),c);var oi={};ii(oi,{GRID_DEFAULTS:()=>si,GamepadInput:()=>S,InputDeviceType:()=>w,KeyboardInput:()=>D,MouseInput:()=>z,NetworkState:()=>b,POST_PROCESS_DEFAULTS:()=>ti,ScalingMode:()=>T,ScalingModeValue:()=>_,TVRemoteInput:()=>B,TouchInput:()=>P,Vector2:()=>k,Vector3:()=>C,createInputDescriptor:()=>j,deserializeInputDescriptor:()=>G,gamepadAxisIndexToInput:()=>H,gamepadButtonIndexToInput:()=>F,getTouchXAxis:()=>$,getTouchYAxis:()=>O,inputDescriptorToString:()=>y,isAxis:()=>J,isButton:()=>E,isGamepadAxis:()=>X,isGamepadButton:()=>Y,isMouseAxis:()=>N,isMouseButton:()=>v,isTVRemoteAxis:()=>Z,isTVRemoteButton:()=>W,isTouchButton:()=>q,isTouchGesture:()=>Q,isTouchPosition:()=>U,keyCodeToKeyboardInput:()=>M,keyboardInputToKeyCode:()=>L,parseInputDescriptor:()=>V,scalingModeToValue:()=>ni,serializeInputDescriptor:()=>d,valueToScalingMode:()=>ci});module.exports=ri(oi);var w=(a=>(a[a.Keyboard=0]="Keyboard",a[a.Mouse=1]="Mouse",a[a.Gamepad=2]="Gamepad",a[a.Touch=3]="Touch",a[a.TVRemote=4]="TVRemote",a[a.TextInput=5]="TextInput",a))(w||{});var D=(i=>(i[i.KeyA=0]="KeyA",i[i.KeyB=1]="KeyB",i[i.KeyC=2]="KeyC",i[i.KeyD=3]="KeyD",i[i.KeyE=4]="KeyE",i[i.KeyF=5]="KeyF",i[i.KeyG=6]="KeyG",i[i.KeyH=7]="KeyH",i[i.KeyI=8]="KeyI",i[i.KeyJ=9]="KeyJ",i[i.KeyK=10]="KeyK",i[i.KeyL=11]="KeyL",i[i.KeyM=12]="KeyM",i[i.KeyN=13]="KeyN",i[i.KeyO=14]="KeyO",i[i.KeyP=15]="KeyP",i[i.KeyQ=16]="KeyQ",i[i.KeyR=17]="KeyR",i[i.KeyS=18]="KeyS",i[i.KeyT=19]="KeyT",i[i.KeyU=20]="KeyU",i[i.KeyV=21]="KeyV",i[i.KeyW=22]="KeyW",i[i.KeyX=23]="KeyX",i[i.KeyY=24]="KeyY",i[i.KeyZ=25]="KeyZ",i[i.Digit0=26]="Digit0",i[i.Digit1=27]="Digit1",i[i.Digit2=28]="Digit2",i[i.Digit3=29]="Digit3",i[i.Digit4=30]="Digit4",i[i.Digit5=31]="Digit5",i[i.Digit6=32]="Digit6",i[i.Digit7=33]="Digit7",i[i.Digit8=34]="Digit8",i[i.Digit9=35]="Digit9",i[i.ArrowUp=36]="ArrowUp",i[i.ArrowDown=37]="ArrowDown",i[i.ArrowLeft=38]="ArrowLeft",i[i.ArrowRight=39]="ArrowRight",i[i.Space=40]="Space",i[i.Enter=41]="Enter",i[i.Escape=42]="Escape",i[i.Backspace=43]="Backspace",i[i.Tab=44]="Tab",i[i.ShiftLeft=45]="ShiftLeft",i[i.ShiftRight=46]="ShiftRight",i[i.ControlLeft=47]="ControlLeft",i[i.ControlRight=48]="ControlRight",i[i.AltLeft=49]="AltLeft",i[i.AltRight=50]="AltRight",i[i.MetaLeft=51]="MetaLeft",i[i.MetaRight=52]="MetaRight",i[i.CapsLock=53]="CapsLock",i[i.Delete=54]="Delete",i[i.Insert=55]="Insert",i[i.Home=56]="Home",i[i.End=57]="End",i[i.PageUp=58]="PageUp",i[i.PageDown=59]="PageDown",i[i.F1=60]="F1",i[i.F2=61]="F2",i[i.F3=62]="F3",i[i.F4=63]="F4",i[i.F5=64]="F5",i[i.F6=65]="F6",i[i.F7=66]="F7",i[i.F8=67]="F8",i[i.F9=68]="F9",i[i.F10=69]="F10",i[i.F11=70]="F11",i[i.F12=71]="F12",i[i.Minus=72]="Minus",i[i.Equal=73]="Equal",i[i.BracketLeft=74]="BracketLeft",i[i.BracketRight=75]="BracketRight",i[i.Backslash=76]="Backslash",i[i.Semicolon=77]="Semicolon",i[i.Quote=78]="Quote",i[i.Comma=79]="Comma",i[i.Period=80]="Period",i[i.Slash=81]="Slash",i[i.Backquote=82]="Backquote",i[i.Numpad0=91]="Numpad0",i[i.Numpad1=92]="Numpad1",i[i.Numpad2=93]="Numpad2",i[i.Numpad3=94]="Numpad3",i[i.Numpad4=95]="Numpad4",i[i.Numpad5=96]="Numpad5",i[i.Numpad6=97]="Numpad6",i[i.Numpad7=98]="Numpad7",i[i.Numpad8=99]="Numpad8",i[i.Numpad9=100]="Numpad9",i[i.NumpadAdd=101]="NumpadAdd",i[i.NumpadSubtract=102]="NumpadSubtract",i[i.NumpadMultiply=103]="NumpadMultiply",i[i.NumpadDivide=104]="NumpadDivide",i[i.NumpadDecimal=105]="NumpadDecimal",i[i.NumpadEnter=106]="NumpadEnter",i[i.NumLock=107]="NumLock",i[i.PrintScreen=111]="PrintScreen",i[i.ScrollLock=112]="ScrollLock",i[i.Pause=113]="Pause",i[i.ContextMenu=114]="ContextMenu",i))(D||{});function M(t){let e=D[t];return e!==void 0?e:null}o(M,"keyCodeToKeyboardInput");function L(t){return D[t]}o(L,"keyboardInputToKeyCode");var z=(l=>(l[l.LeftButton=0]="LeftButton",l[l.MiddleButton=1]="MiddleButton",l[l.RightButton=2]="RightButton",l[l.Button4=3]="Button4",l[l.Button5=4]="Button5",l[l.PositionX=100]="PositionX",l[l.PositionY=101]="PositionY",l[l.DeltaX=102]="DeltaX",l[l.DeltaY=103]="DeltaY",l[l.WheelDeltaY=104]="WheelDeltaY",l[l.WheelDeltaX=105]="WheelDeltaX",l))(z||{});function v(t){return t<100}o(v,"isMouseButton");function N(t){return t>=100}o(N,"isMouseAxis");var S=(n=>(n[n.ButtonA=0]="ButtonA",n[n.ButtonB=1]="ButtonB",n[n.ButtonX=2]="ButtonX",n[n.ButtonY=3]="ButtonY",n[n.LeftShoulder=4]="LeftShoulder",n[n.RightShoulder=5]="RightShoulder",n[n.LeftTrigger=6]="LeftTrigger",n[n.RightTrigger=7]="RightTrigger",n[n.Select=8]="Select",n[n.Start=9]="Start",n[n.LeftStick=10]="LeftStick",n[n.RightStick=11]="RightStick",n[n.DPadUp=12]="DPadUp",n[n.DPadDown=13]="DPadDown",n[n.DPadLeft=14]="DPadLeft",n[n.DPadRight=15]="DPadRight",n[n.Home=16]="Home",n[n.Touchpad=17]="Touchpad",n[n.LeftStickX=100]="LeftStickX",n[n.LeftStickY=101]="LeftStickY",n[n.RightStickX=102]="RightStickX",n[n.RightStickY=103]="RightStickY",n[n.LeftTriggerAxis=104]="LeftTriggerAxis",n[n.RightTriggerAxis=105]="RightTriggerAxis",n))(S||{});function Y(t){return t<100}o(Y,"isGamepadButton");function X(t){return t>=100}o(X,"isGamepadAxis");function F(t){return t>=0&&t<=19?t:null}o(F,"gamepadButtonIndexToInput");function H(t){return{0:100,1:101,2:102,3:103}[t]??null}o(H,"gamepadAxisIndexToInput");var P=(s=>(s[s.Touch0=0]="Touch0",s[s.Touch1=1]="Touch1",s[s.Touch2=2]="Touch2",s[s.Touch3=3]="Touch3",s[s.Touch4=4]="Touch4",s[s.Touch5=5]="Touch5",s[s.Touch6=6]="Touch6",s[s.Touch7=7]="Touch7",s[s.Touch8=8]="Touch8",s[s.Touch9=9]="Touch9",s[s.Touch0X=100]="Touch0X",s[s.Touch0Y=101]="Touch0Y",s[s.Touch1X=102]="Touch1X",s[s.Touch1Y=103]="Touch1Y",s[s.Touch2X=104]="Touch2X",s[s.Touch2Y=105]="Touch2Y",s[s.Touch3X=106]="Touch3X",s[s.Touch3Y=107]="Touch3Y",s[s.Touch4X=108]="Touch4X",s[s.Touch4Y=109]="Touch4Y",s[s.Touch5X=110]="Touch5X",s[s.Touch5Y=111]="Touch5Y",s[s.Touch6X=112]="Touch6X",s[s.Touch6Y=113]="Touch6Y",s[s.Touch7X=114]="Touch7X",s[s.Touch7Y=115]="Touch7Y",s[s.Touch8X=116]="Touch8X",s[s.Touch8Y=117]="Touch8Y",s[s.Touch9X=118]="Touch9X",s[s.Touch9Y=119]="Touch9Y",s[s.PinchScale=200]="PinchScale",s[s.RotationAngle=201]="RotationAngle",s[s.SwipeVelocityX=202]="SwipeVelocityX",s[s.SwipeVelocityY=203]="SwipeVelocityY",s))(P||{});function q(t){return t<100}o(q,"isTouchButton");function U(t){return t>=100&&t<200}o(U,"isTouchPosition");function Q(t){return t>=200}o(Q,"isTouchGesture");function $(t){return t<0||t>9?null:100+t*2}o($,"getTouchXAxis");function O(t){return t<0||t>9?null:101+t*2}o(O,"getTouchYAxis");var B=(r=>(r[r.DPadUp=0]="DPadUp",r[r.DPadDown=1]="DPadDown",r[r.DPadLeft=2]="DPadLeft",r[r.DPadRight=3]="DPadRight",r[r.DPadCenter=4]="DPadCenter",r[r.Play=5]="Play",r[r.Pause=6]="Pause",r[r.PlayPause=7]="PlayPause",r[r.Stop=8]="Stop",r[r.Rewind=9]="Rewind",r[r.FastForward=10]="FastForward",r[r.Previous=11]="Previous",r[r.Next=12]="Next",r[r.Record=13]="Record",r[r.VolumeUp=15]="VolumeUp",r[r.VolumeDown=16]="VolumeDown",r[r.Mute=17]="Mute",r[r.ChannelUp=18]="ChannelUp",r[r.ChannelDown=19]="ChannelDown",r[r.Back=20]="Back",r[r.Home=21]="Home",r[r.Menu=22]="Menu",r[r.Info=23]="Info",r[r.Guide=24]="Guide",r[r.Exit=25]="Exit",r[r.Red=30]="Red",r[r.Green=31]="Green",r[r.Yellow=32]="Yellow",r[r.Blue=33]="Blue",r[r.Digit0=40]="Digit0",r[r.Digit1=41]="Digit1",r[r.Digit2=42]="Digit2",r[r.Digit3=43]="Digit3",r[r.Digit4=44]="Digit4",r[r.Digit5=45]="Digit5",r[r.Digit6=46]="Digit6",r[r.Digit7=47]="Digit7",r[r.Digit8=48]="Digit8",r[r.Digit9=49]="Digit9",r[r.Input=50]="Input",r[r.Settings=51]="Settings",r[r.Subtitle=52]="Subtitle",r[r.Audio=53]="Audio",r[r.Power=54]="Power",r[r.PointerX=100]="PointerX",r[r.PointerY=101]="PointerY",r[r.GyroX=102]="GyroX",r[r.GyroY=103]="GyroY",r[r.GyroZ=104]="GyroZ",r))(B||{});function W(t){return t<100}o(W,"isTVRemoteButton");function Z(t){return t>=100}o(Z,"isTVRemoteAxis");function j(t,e){return{device:t,input:e}}o(j,"createInputDescriptor");function E(t){switch(t.device){case 0:return!0;case 1:return t.input<100;case 2:return t.input<100;case 3:return t.input<100;case 4:return t.input<100;default:return!1}}o(E,"isButton");function J(t){return!E(t)}o(J,"isAxis");function d(t){let e=new Uint8Array(3);return e[0]=t.device,e[1]=t.input&255,e[2]=t.input>>8&255,e}o(d,"serializeInputDescriptor");function G(t,e=0){let c=t[e],f=t[e+1]|t[e+2]<<8;return{device:c,input:f}}o(G,"deserializeInputDescriptor");function y(t){let e=w[t.device],c;switch(t.device){case 0:c=D[t.input];break;case 1:c=z[t.input];break;case 2:c=S[t.input];break;case 3:c=P[t.input];break;case 4:c=B[t.input];break;default:c="Unknown"}return`${e}:${c}`}o(y,"inputDescriptorToString");function V(t){let[e,c]=t.split(":");if(!e||!c)return null;let f=Object.entries(w).find(([h,a])=>h.toLowerCase()===e.toLowerCase()&&typeof a=="number")?.[1];if(f===void 0)return null;let m;switch(f){case 0:m=D[c];break;case 1:m=z[c];break;case 2:m=S[c];break;case 3:m=P[c];break;case 4:m=B[c];break}return m===void 0?null:{device:f,input:m}}o(V,"parseInputDescriptor");var g=class g{constructor(e=0,c=0){u(this,"x");u(this,"y");this.x=e,this.y=c}static zero(){return new g(0,0)}static one(){return new g(1,1)}static up(){return new g(0,-1)}static down(){return new g(0,1)}static left(){return new g(-1,0)}static right(){return new g(1,0)}add(e){return new g(this.x+e.x,this.y+e.y)}subtract(e){return new g(this.x-e.x,this.y-e.y)}multiply(e){return new g(this.x*e,this.y*e)}divide(e){if(e===0)throw new Error("Division by zero");return new g(this.x/e,this.y/e)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let e=this.length();return e===0?g.zero():this.divide(e)}distance(e){return this.subtract(e).length()}distanceSquared(e){return this.subtract(e).lengthSquared()}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}angle(){return Math.atan2(this.y,this.x)}angleTo(e){return Math.atan2(e.y-this.y,e.x-this.x)}rotate(e){let c=Math.cos(e),f=Math.sin(e);return new g(this.x*c-this.y*f,this.x*f+this.y*c)}lerp(e,c){return new g(this.x+(e.x-this.x)*c,this.y+(e.y-this.y)*c)}clone(){return new g(this.x,this.y)}equals(e){return this.x===e.x&&this.y===e.y}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}set(e,c){return this.x=e,this.y=c,this}copy(e){return this.x=e.x,this.y=e.y,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this}multiplyInPlace(e){return this.x*=e,this.y*=e,this}divideInPlace(e){if(e===0)throw new Error("Division by zero");return this.x/=e,this.y/=e,this}normalizeInPlace(){let e=this.length();return e===0?(this.x=0,this.y=0):(this.x/=e,this.y/=e),this}};o(g,"Vector2");var k=g;var x=class x{constructor(e=0,c=0,f=0){u(this,"x");u(this,"y");u(this,"z");this.x=e,this.y=c,this.z=f}static zero(){return new x(0,0,0)}static one(){return new x(1,1,1)}static up(){return new x(0,1,0)}static down(){return new x(0,-1,0)}static left(){return new x(-1,0,0)}static right(){return new x(1,0,0)}static forward(){return new x(0,0,1)}static back(){return new x(0,0,-1)}add(e){return new x(this.x+e.x,this.y+e.y,this.z+e.z)}subtract(e){return new x(this.x-e.x,this.y-e.y,this.z-e.z)}multiply(e){return new x(this.x*e,this.y*e,this.z*e)}divide(e){if(e===0)throw new Error("Division by zero");return new x(this.x/e,this.y/e,this.z/e)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){let e=this.length();return e===0?x.zero():this.divide(e)}distance(e){return this.subtract(e).length()}distanceSquared(e){return this.subtract(e).lengthSquared()}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){return new x(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}lerp(e,c){return new x(this.x+(e.x-this.x)*c,this.y+(e.y-this.y)*c,this.z+(e.z-this.z)*c)}clone(){return new x(this.x,this.y,this.z)}equals(e){return this.x===e.x&&this.y===e.y&&this.z===e.z}toString(){return`Vector3(${this.x}, ${this.y}, ${this.z})`}toArray(){return[this.x,this.y,this.z]}set(e,c,f){return this.x=e,this.y=c,this.z=f,this}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}multiplyInPlace(e){return this.x*=e,this.y*=e,this.z*=e,this}divideInPlace(e){if(e===0)throw new Error("Division by zero");return this.x/=e,this.y/=e,this.z/=e,this}normalizeInPlace(){let e=this.length();return e===0?(this.x=0,this.y=0,this.z=0):(this.x/=e,this.y/=e,this.z/=e),this}};o(x,"Vector3");var C=x;var ti={scanlines:{opacity:.15,pattern:"horizontal",spacing:2,thickness:1,color:{r:0,g:0,b:0}},ambientEffect:{blur:30,scale:1.3,opacity:.7}},si={color:"rgba(144, 24, 24, 1)",lineWidth:1};var T=(h=>(h.None="none",h.Eighth="eighth",h.Quarter="quarter",h.Half="half",h.Integer="integer",h))(T||{}),_=(h=>(h[h.None=0]="None",h[h.Eighth=1]="Eighth",h[h.Quarter=2]="Quarter",h[h.Half=3]="Half",h[h.Integer=4]="Integer",h))(_||{});function ni(t){switch(t){case"none":return 0;case"eighth":return 1;case"quarter":return 2;case"half":return 3;case"integer":return 4;default:return 0}}o(ni,"scalingModeToValue");function ci(t){switch(t){case 0:return"none";case 1:return"eighth";case 2:return"quarter";case 3:return"half";case 4:return"integer";default:return"none"}}o(ci,"valueToScalingMode");var b=(h=>(h[h.Disconnected=0]="Disconnected",h[h.Connecting=1]="Connecting",h[h.Connected=2]="Connected",h[h.Reconnecting=3]="Reconnecting",h[h.Error=4]="Error",h))(b||{});
1
+ "use strict";var A=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var ii=(t,e,c)=>e in t?A(t,e,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[e]=c;var o=(t,e)=>A(t,"name",{value:e,configurable:!0});var ei=(t,e)=>{for(var c in e)A(t,c,{get:e[c],enumerable:!0})},ri=(t,e,c,f)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of K(e))!I.call(t,m)&&m!==c&&A(t,m,{get:()=>e[m],enumerable:!(f=p(e,m))||f.enumerable});return t};var ti=t=>ri(A({},"__esModule",{value:!0}),t);var w=(t,e,c)=>(ii(t,typeof e!="symbol"?e+"":e,c),c);var hi={};ei(hi,{GRID_DEFAULTS:()=>ni,GamepadInput:()=>S,InputDeviceType:()=>u,KeyboardInput:()=>D,MouseInput:()=>z,NetworkState:()=>b,POST_PROCESS_DEFAULTS:()=>si,ScalingMode:()=>T,ScalingModeValue:()=>_,TVRemoteInput:()=>B,TouchInput:()=>P,Vector2:()=>k,Vector3:()=>C,createInputDescriptor:()=>j,deserializeInputDescriptor:()=>G,gamepadAxisIndexToInput:()=>H,gamepadButtonIndexToInput:()=>F,getTouchXAxis:()=>$,getTouchYAxis:()=>O,inputDescriptorToString:()=>y,isAxis:()=>J,isButton:()=>E,isGamepadAxis:()=>X,isGamepadButton:()=>v,isMouseAxis:()=>Y,isMouseButton:()=>N,isTVRemoteAxis:()=>Z,isTVRemoteButton:()=>W,isTouchButton:()=>q,isTouchGesture:()=>Q,isTouchPosition:()=>U,keyCodeToKeyboardInput:()=>M,keyboardInputToKeyCode:()=>L,parseInputDescriptor:()=>V,scalingModeToValue:()=>ci,serializeInputDescriptor:()=>d,valueToScalingMode:()=>oi});module.exports=ti(hi);var u=(a=>(a[a.Keyboard=0]="Keyboard",a[a.Mouse=1]="Mouse",a[a.Gamepad=2]="Gamepad",a[a.Touch=3]="Touch",a[a.TVRemote=4]="TVRemote",a[a.TextInput=5]="TextInput",a[a.Motion=6]="Motion",a))(u||{});var D=(i=>(i[i.KeyA=0]="KeyA",i[i.KeyB=1]="KeyB",i[i.KeyC=2]="KeyC",i[i.KeyD=3]="KeyD",i[i.KeyE=4]="KeyE",i[i.KeyF=5]="KeyF",i[i.KeyG=6]="KeyG",i[i.KeyH=7]="KeyH",i[i.KeyI=8]="KeyI",i[i.KeyJ=9]="KeyJ",i[i.KeyK=10]="KeyK",i[i.KeyL=11]="KeyL",i[i.KeyM=12]="KeyM",i[i.KeyN=13]="KeyN",i[i.KeyO=14]="KeyO",i[i.KeyP=15]="KeyP",i[i.KeyQ=16]="KeyQ",i[i.KeyR=17]="KeyR",i[i.KeyS=18]="KeyS",i[i.KeyT=19]="KeyT",i[i.KeyU=20]="KeyU",i[i.KeyV=21]="KeyV",i[i.KeyW=22]="KeyW",i[i.KeyX=23]="KeyX",i[i.KeyY=24]="KeyY",i[i.KeyZ=25]="KeyZ",i[i.Digit0=26]="Digit0",i[i.Digit1=27]="Digit1",i[i.Digit2=28]="Digit2",i[i.Digit3=29]="Digit3",i[i.Digit4=30]="Digit4",i[i.Digit5=31]="Digit5",i[i.Digit6=32]="Digit6",i[i.Digit7=33]="Digit7",i[i.Digit8=34]="Digit8",i[i.Digit9=35]="Digit9",i[i.ArrowUp=36]="ArrowUp",i[i.ArrowDown=37]="ArrowDown",i[i.ArrowLeft=38]="ArrowLeft",i[i.ArrowRight=39]="ArrowRight",i[i.Space=40]="Space",i[i.Enter=41]="Enter",i[i.Escape=42]="Escape",i[i.Backspace=43]="Backspace",i[i.Tab=44]="Tab",i[i.ShiftLeft=45]="ShiftLeft",i[i.ShiftRight=46]="ShiftRight",i[i.ControlLeft=47]="ControlLeft",i[i.ControlRight=48]="ControlRight",i[i.AltLeft=49]="AltLeft",i[i.AltRight=50]="AltRight",i[i.MetaLeft=51]="MetaLeft",i[i.MetaRight=52]="MetaRight",i[i.CapsLock=53]="CapsLock",i[i.Delete=54]="Delete",i[i.Insert=55]="Insert",i[i.Home=56]="Home",i[i.End=57]="End",i[i.PageUp=58]="PageUp",i[i.PageDown=59]="PageDown",i[i.F1=60]="F1",i[i.F2=61]="F2",i[i.F3=62]="F3",i[i.F4=63]="F4",i[i.F5=64]="F5",i[i.F6=65]="F6",i[i.F7=66]="F7",i[i.F8=67]="F8",i[i.F9=68]="F9",i[i.F10=69]="F10",i[i.F11=70]="F11",i[i.F12=71]="F12",i[i.Minus=72]="Minus",i[i.Equal=73]="Equal",i[i.BracketLeft=74]="BracketLeft",i[i.BracketRight=75]="BracketRight",i[i.Backslash=76]="Backslash",i[i.Semicolon=77]="Semicolon",i[i.Quote=78]="Quote",i[i.Comma=79]="Comma",i[i.Period=80]="Period",i[i.Slash=81]="Slash",i[i.Backquote=82]="Backquote",i[i.Numpad0=91]="Numpad0",i[i.Numpad1=92]="Numpad1",i[i.Numpad2=93]="Numpad2",i[i.Numpad3=94]="Numpad3",i[i.Numpad4=95]="Numpad4",i[i.Numpad5=96]="Numpad5",i[i.Numpad6=97]="Numpad6",i[i.Numpad7=98]="Numpad7",i[i.Numpad8=99]="Numpad8",i[i.Numpad9=100]="Numpad9",i[i.NumpadAdd=101]="NumpadAdd",i[i.NumpadSubtract=102]="NumpadSubtract",i[i.NumpadMultiply=103]="NumpadMultiply",i[i.NumpadDivide=104]="NumpadDivide",i[i.NumpadDecimal=105]="NumpadDecimal",i[i.NumpadEnter=106]="NumpadEnter",i[i.NumLock=107]="NumLock",i[i.PrintScreen=111]="PrintScreen",i[i.ScrollLock=112]="ScrollLock",i[i.Pause=113]="Pause",i[i.ContextMenu=114]="ContextMenu",i))(D||{});function M(t){let e=D[t];return e!==void 0?e:null}o(M,"keyCodeToKeyboardInput");function L(t){return D[t]}o(L,"keyboardInputToKeyCode");var z=(l=>(l[l.LeftButton=0]="LeftButton",l[l.MiddleButton=1]="MiddleButton",l[l.RightButton=2]="RightButton",l[l.Button4=3]="Button4",l[l.Button5=4]="Button5",l[l.PositionX=100]="PositionX",l[l.PositionY=101]="PositionY",l[l.DeltaX=102]="DeltaX",l[l.DeltaY=103]="DeltaY",l[l.WheelDeltaY=104]="WheelDeltaY",l[l.WheelDeltaX=105]="WheelDeltaX",l))(z||{});function N(t){return t<100}o(N,"isMouseButton");function Y(t){return t>=100}o(Y,"isMouseAxis");var S=(n=>(n[n.ButtonA=0]="ButtonA",n[n.ButtonB=1]="ButtonB",n[n.ButtonX=2]="ButtonX",n[n.ButtonY=3]="ButtonY",n[n.LeftShoulder=4]="LeftShoulder",n[n.RightShoulder=5]="RightShoulder",n[n.LeftTrigger=6]="LeftTrigger",n[n.RightTrigger=7]="RightTrigger",n[n.Select=8]="Select",n[n.Start=9]="Start",n[n.LeftStick=10]="LeftStick",n[n.RightStick=11]="RightStick",n[n.DPadUp=12]="DPadUp",n[n.DPadDown=13]="DPadDown",n[n.DPadLeft=14]="DPadLeft",n[n.DPadRight=15]="DPadRight",n[n.Home=16]="Home",n[n.Touchpad=17]="Touchpad",n[n.LeftStickX=100]="LeftStickX",n[n.LeftStickY=101]="LeftStickY",n[n.RightStickX=102]="RightStickX",n[n.RightStickY=103]="RightStickY",n[n.LeftTriggerAxis=104]="LeftTriggerAxis",n[n.RightTriggerAxis=105]="RightTriggerAxis",n))(S||{});function v(t){return t<100}o(v,"isGamepadButton");function X(t){return t>=100}o(X,"isGamepadAxis");function F(t){return t>=0&&t<=19?t:null}o(F,"gamepadButtonIndexToInput");function H(t){return{0:100,1:101,2:102,3:103}[t]??null}o(H,"gamepadAxisIndexToInput");var P=(s=>(s[s.Touch0=0]="Touch0",s[s.Touch1=1]="Touch1",s[s.Touch2=2]="Touch2",s[s.Touch3=3]="Touch3",s[s.Touch4=4]="Touch4",s[s.Touch5=5]="Touch5",s[s.Touch6=6]="Touch6",s[s.Touch7=7]="Touch7",s[s.Touch8=8]="Touch8",s[s.Touch9=9]="Touch9",s[s.Touch0X=100]="Touch0X",s[s.Touch0Y=101]="Touch0Y",s[s.Touch1X=102]="Touch1X",s[s.Touch1Y=103]="Touch1Y",s[s.Touch2X=104]="Touch2X",s[s.Touch2Y=105]="Touch2Y",s[s.Touch3X=106]="Touch3X",s[s.Touch3Y=107]="Touch3Y",s[s.Touch4X=108]="Touch4X",s[s.Touch4Y=109]="Touch4Y",s[s.Touch5X=110]="Touch5X",s[s.Touch5Y=111]="Touch5Y",s[s.Touch6X=112]="Touch6X",s[s.Touch6Y=113]="Touch6Y",s[s.Touch7X=114]="Touch7X",s[s.Touch7Y=115]="Touch7Y",s[s.Touch8X=116]="Touch8X",s[s.Touch8Y=117]="Touch8Y",s[s.Touch9X=118]="Touch9X",s[s.Touch9Y=119]="Touch9Y",s[s.PinchScale=200]="PinchScale",s[s.RotationAngle=201]="RotationAngle",s[s.SwipeVelocityX=202]="SwipeVelocityX",s[s.SwipeVelocityY=203]="SwipeVelocityY",s))(P||{});function q(t){return t<100}o(q,"isTouchButton");function U(t){return t>=100&&t<200}o(U,"isTouchPosition");function Q(t){return t>=200}o(Q,"isTouchGesture");function $(t){return t<0||t>9?null:100+t*2}o($,"getTouchXAxis");function O(t){return t<0||t>9?null:101+t*2}o(O,"getTouchYAxis");var B=(r=>(r[r.DPadUp=0]="DPadUp",r[r.DPadDown=1]="DPadDown",r[r.DPadLeft=2]="DPadLeft",r[r.DPadRight=3]="DPadRight",r[r.DPadCenter=4]="DPadCenter",r[r.Play=5]="Play",r[r.Pause=6]="Pause",r[r.PlayPause=7]="PlayPause",r[r.Stop=8]="Stop",r[r.Rewind=9]="Rewind",r[r.FastForward=10]="FastForward",r[r.Previous=11]="Previous",r[r.Next=12]="Next",r[r.Record=13]="Record",r[r.VolumeUp=15]="VolumeUp",r[r.VolumeDown=16]="VolumeDown",r[r.Mute=17]="Mute",r[r.ChannelUp=18]="ChannelUp",r[r.ChannelDown=19]="ChannelDown",r[r.Back=20]="Back",r[r.Home=21]="Home",r[r.Menu=22]="Menu",r[r.Info=23]="Info",r[r.Guide=24]="Guide",r[r.Exit=25]="Exit",r[r.Red=30]="Red",r[r.Green=31]="Green",r[r.Yellow=32]="Yellow",r[r.Blue=33]="Blue",r[r.Digit0=40]="Digit0",r[r.Digit1=41]="Digit1",r[r.Digit2=42]="Digit2",r[r.Digit3=43]="Digit3",r[r.Digit4=44]="Digit4",r[r.Digit5=45]="Digit5",r[r.Digit6=46]="Digit6",r[r.Digit7=47]="Digit7",r[r.Digit8=48]="Digit8",r[r.Digit9=49]="Digit9",r[r.Input=50]="Input",r[r.Settings=51]="Settings",r[r.Subtitle=52]="Subtitle",r[r.Audio=53]="Audio",r[r.Power=54]="Power",r[r.PointerX=100]="PointerX",r[r.PointerY=101]="PointerY",r[r.GyroX=102]="GyroX",r[r.GyroY=103]="GyroY",r[r.GyroZ=104]="GyroZ",r))(B||{});function W(t){return t<100}o(W,"isTVRemoteButton");function Z(t){return t>=100}o(Z,"isTVRemoteAxis");function j(t,e){return{device:t,input:e}}o(j,"createInputDescriptor");function E(t){switch(t.device){case 0:return!0;case 1:return t.input<100;case 2:return t.input<100;case 3:return t.input<100;case 4:return t.input<100;default:return!1}}o(E,"isButton");function J(t){return!E(t)}o(J,"isAxis");function d(t){let e=new Uint8Array(3);return e[0]=t.device,e[1]=t.input&255,e[2]=t.input>>8&255,e}o(d,"serializeInputDescriptor");function G(t,e=0){let c=t[e],f=t[e+1]|t[e+2]<<8;return{device:c,input:f}}o(G,"deserializeInputDescriptor");function y(t){let e=u[t.device],c;switch(t.device){case 0:c=D[t.input];break;case 1:c=z[t.input];break;case 2:c=S[t.input];break;case 3:c=P[t.input];break;case 4:c=B[t.input];break;default:c="Unknown"}return`${e}:${c}`}o(y,"inputDescriptorToString");function V(t){let[e,c]=t.split(":");if(!e||!c)return null;let f=Object.entries(u).find(([h,R])=>h.toLowerCase()===e.toLowerCase()&&typeof R=="number")?.[1];if(f===void 0)return null;let m;switch(f){case 0:m=D[c];break;case 1:m=z[c];break;case 2:m=S[c];break;case 3:m=P[c];break;case 4:m=B[c];break}return m===void 0?null:{device:f,input:m}}o(V,"parseInputDescriptor");var g=class g{constructor(e=0,c=0){w(this,"x");w(this,"y");this.x=e,this.y=c}static zero(){return new g(0,0)}static one(){return new g(1,1)}static up(){return new g(0,-1)}static down(){return new g(0,1)}static left(){return new g(-1,0)}static right(){return new g(1,0)}add(e){return new g(this.x+e.x,this.y+e.y)}subtract(e){return new g(this.x-e.x,this.y-e.y)}multiply(e){return new g(this.x*e,this.y*e)}divide(e){if(e===0)throw new Error("Division by zero");return new g(this.x/e,this.y/e)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let e=this.length();return e===0?g.zero():this.divide(e)}distance(e){return this.subtract(e).length()}distanceSquared(e){return this.subtract(e).lengthSquared()}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}angle(){return Math.atan2(this.y,this.x)}angleTo(e){return Math.atan2(e.y-this.y,e.x-this.x)}rotate(e){let c=Math.cos(e),f=Math.sin(e);return new g(this.x*c-this.y*f,this.x*f+this.y*c)}lerp(e,c){return new g(this.x+(e.x-this.x)*c,this.y+(e.y-this.y)*c)}clone(){return new g(this.x,this.y)}equals(e){return this.x===e.x&&this.y===e.y}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}set(e,c){return this.x=e,this.y=c,this}copy(e){return this.x=e.x,this.y=e.y,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this}multiplyInPlace(e){return this.x*=e,this.y*=e,this}divideInPlace(e){if(e===0)throw new Error("Division by zero");return this.x/=e,this.y/=e,this}normalizeInPlace(){let e=this.length();return e===0?(this.x=0,this.y=0):(this.x/=e,this.y/=e),this}};o(g,"Vector2");var k=g;var x=class x{constructor(e=0,c=0,f=0){w(this,"x");w(this,"y");w(this,"z");this.x=e,this.y=c,this.z=f}static zero(){return new x(0,0,0)}static one(){return new x(1,1,1)}static up(){return new x(0,1,0)}static down(){return new x(0,-1,0)}static left(){return new x(-1,0,0)}static right(){return new x(1,0,0)}static forward(){return new x(0,0,1)}static back(){return new x(0,0,-1)}add(e){return new x(this.x+e.x,this.y+e.y,this.z+e.z)}subtract(e){return new x(this.x-e.x,this.y-e.y,this.z-e.z)}multiply(e){return new x(this.x*e,this.y*e,this.z*e)}divide(e){if(e===0)throw new Error("Division by zero");return new x(this.x/e,this.y/e,this.z/e)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){let e=this.length();return e===0?x.zero():this.divide(e)}distance(e){return this.subtract(e).length()}distanceSquared(e){return this.subtract(e).lengthSquared()}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){return new x(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}lerp(e,c){return new x(this.x+(e.x-this.x)*c,this.y+(e.y-this.y)*c,this.z+(e.z-this.z)*c)}clone(){return new x(this.x,this.y,this.z)}equals(e){return this.x===e.x&&this.y===e.y&&this.z===e.z}toString(){return`Vector3(${this.x}, ${this.y}, ${this.z})`}toArray(){return[this.x,this.y,this.z]}set(e,c,f){return this.x=e,this.y=c,this.z=f,this}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}multiplyInPlace(e){return this.x*=e,this.y*=e,this.z*=e,this}divideInPlace(e){if(e===0)throw new Error("Division by zero");return this.x/=e,this.y/=e,this.z/=e,this}normalizeInPlace(){let e=this.length();return e===0?(this.x=0,this.y=0,this.z=0):(this.x/=e,this.y/=e,this.z/=e),this}};o(x,"Vector3");var C=x;var si={scanlines:{opacity:.15,pattern:"horizontal",spacing:2,thickness:1,color:{r:0,g:0,b:0}},ambientEffect:{blur:30,scale:1.3,opacity:.7}},ni={color:"rgba(144, 24, 24, 1)",lineWidth:1};var T=(h=>(h.None="none",h.Eighth="eighth",h.Quarter="quarter",h.Half="half",h.Integer="integer",h))(T||{}),_=(h=>(h[h.None=0]="None",h[h.Eighth=1]="Eighth",h[h.Quarter=2]="Quarter",h[h.Half=3]="Half",h[h.Integer=4]="Integer",h))(_||{});function ci(t){switch(t){case"none":return 0;case"eighth":return 1;case"quarter":return 2;case"half":return 3;case"integer":return 4;default:return 0}}o(ci,"scalingModeToValue");function oi(t){switch(t){case 0:return"none";case 1:return"eighth";case 2:return"quarter";case 3:return"half";case 4:return"integer";default:return"none"}}o(oi,"valueToScalingMode");var b=(h=>(h[h.Disconnected=0]="Disconnected",h[h.Connecting=1]="Connecting",h[h.Connected=2]="Connected",h[h.Reconnecting=3]="Reconnecting",h[h.Error=4]="Error",h))(b||{});
package/dist/index.d.ts CHANGED
@@ -8,7 +8,8 @@ declare enum InputDeviceType {
8
8
  Gamepad = 2,
9
9
  Touch = 3,
10
10
  TVRemote = 4,
11
- TextInput = 5
11
+ TextInput = 5,// For text input (captures event.key directly for input boxes, chat, etc.)
12
+ Motion = 6
12
13
  }
13
14
 
14
15
  /**
@@ -1857,5 +1858,111 @@ interface UserMetadata {
1857
1858
  [key: string]: unknown;
1858
1859
  }
1859
1860
 
1861
+ /**
1862
+ * Vibration types for tactile feedback
1863
+ *
1864
+ * Supports both mobile vibration (Navigator Vibration API) and
1865
+ * gamepad vibration (Gamepad API dual-motor rumble).
1866
+ *
1867
+ * @packageDocumentation
1868
+ */
1869
+ /**
1870
+ * Vibration pattern: single duration or array of [vibrate, pause, vibrate, ...]
1871
+ */
1872
+ type VibrationPattern = number | readonly number[];
1873
+ /**
1874
+ * Command to trigger a vibration on mobile device
1875
+ */
1876
+ interface VibrateCommand {
1877
+ /** Vibration pattern in milliseconds */
1878
+ pattern: VibrationPattern;
1879
+ /** Optional intensity (0.0 to 1.0, default 1.0). Scales the pattern durations. */
1880
+ intensity?: number;
1881
+ }
1882
+ /**
1883
+ * Command to cancel mobile vibration
1884
+ */
1885
+ interface CancelVibrationCommand {
1886
+ /** Marker to identify this as a cancel command */
1887
+ cancel: true;
1888
+ }
1889
+ /**
1890
+ * Union type for mobile vibration commands
1891
+ */
1892
+ type MobileVibrationCommand = VibrateCommand | CancelVibrationCommand;
1893
+ /**
1894
+ * Interface for mobile vibration processor (implemented by MobileVibration class in @utsp/input)
1895
+ */
1896
+ interface IMobileVibrationProcessor {
1897
+ /** Check if vibration is supported on this device */
1898
+ isSupported(): boolean;
1899
+ /** Check if vibration is enabled */
1900
+ isEnabled(): boolean;
1901
+ /** Trigger a vibration with the given pattern */
1902
+ vibrate(pattern: VibrationPattern): boolean;
1903
+ /** Cancel any ongoing vibration */
1904
+ cancel(): void;
1905
+ }
1906
+ /**
1907
+ * Mobile vibration preset names
1908
+ */
1909
+ type MobileVibrationPreset = 'tap' | 'mediumTap' | 'heavyTap' | 'success' | 'error' | 'warning' | 'selection' | 'impactLight' | 'impactMedium' | 'impactHeavy' | 'notification';
1910
+ /**
1911
+ * Gamepad vibration options for dual-motor controllers
1912
+ *
1913
+ * Modern gamepads have two motors:
1914
+ * - Strong motor (low frequency): Heavy rumble, felt in the palm
1915
+ * - Weak motor (high frequency): Light vibration, felt in the fingers
1916
+ */
1917
+ interface GamepadVibrationOptions {
1918
+ /** Duration in milliseconds */
1919
+ duration: number;
1920
+ /** Strong motor magnitude (0.0 - 1.0), low frequency rumble */
1921
+ strongMagnitude?: number;
1922
+ /** Weak motor magnitude (0.0 - 1.0), high frequency vibration */
1923
+ weakMagnitude?: number;
1924
+ /** Start delay in milliseconds (default: 0) */
1925
+ startDelay?: number;
1926
+ }
1927
+ /**
1928
+ * Command to trigger gamepad vibration
1929
+ */
1930
+ interface GamepadVibrateCommand {
1931
+ /** Gamepad index (0-3), or 'all' for all connected gamepads */
1932
+ gamepadIndex: number | 'all';
1933
+ /** Vibration options */
1934
+ options: GamepadVibrationOptions;
1935
+ }
1936
+ /**
1937
+ * Command to stop gamepad vibration
1938
+ */
1939
+ interface GamepadCancelVibrationCommand {
1940
+ /** Gamepad index (0-3), or 'all' for all connected gamepads */
1941
+ gamepadIndex: number | 'all';
1942
+ /** Marker to identify this as a cancel command */
1943
+ cancel: true;
1944
+ }
1945
+ /**
1946
+ * Union type for gamepad vibration commands
1947
+ */
1948
+ type GamepadVibrationCommand = GamepadVibrateCommand | GamepadCancelVibrationCommand;
1949
+ /**
1950
+ * Interface for gamepad vibration processor
1951
+ */
1952
+ interface IGamepadVibrationProcessor {
1953
+ /** Check if a gamepad supports vibration */
1954
+ supportsVibration(gamepadIndex: number): boolean;
1955
+ /** Vibrate a specific gamepad */
1956
+ vibrate(gamepadIndex: number, options: GamepadVibrationOptions): Promise<boolean>;
1957
+ /** Stop vibration on a specific gamepad */
1958
+ stopVibration(gamepadIndex: number): Promise<boolean>;
1959
+ /** Stop vibration on all gamepads */
1960
+ stopAllVibrations(): Promise<void>;
1961
+ }
1962
+ /**
1963
+ * Gamepad vibration preset names
1964
+ */
1965
+ type GamepadVibrationPreset = 'tap' | 'impact' | 'heavy' | 'success' | 'error' | 'explosion' | 'engine' | 'heartbeat';
1966
+
1860
1967
  export { GRID_DEFAULTS, GamepadInput, InputDeviceType, KeyboardInput, MouseInput, NetworkState, POST_PROCESS_DEFAULTS, ScalingMode, ScalingModeValue, TVRemoteInput, TouchInput, Vector2, Vector3, createInputDescriptor, deserializeInputDescriptor, gamepadAxisIndexToInput, gamepadButtonIndexToInput, getTouchXAxis, getTouchYAxis, inputDescriptorToString, isAxis, isButton, isGamepadAxis, isGamepadButton, isMouseAxis, isMouseButton, isTVRemoteAxis, isTVRemoteButton, isTouchButton, isTouchGesture, isTouchPosition, keyCodeToKeyboardInput, keyboardInputToKeyCode, parseInputDescriptor, scalingModeToValue, serializeInputDescriptor, valueToScalingMode };
1861
- export type { AmbientEffectConfig, AnyNetworkMessage, AnySoundLoadPacket, AudioAck, AudioAckBase, AudioAckHandler, AudioAckType, AudioConfigCommand, AudioPlayOptions, AudioPlayResult, AudioSpatialOptions, AxisBinding, AxisSource, BridgeClientHandler, BridgeServerHandler, ButtonBinding, ButtonSource, ChatMessage, ClientInfo, ConfigureSpatialCommand, ConnectionHandler, DisconnectionHandler, ErrorMessage, FadeOutSoundCommand, GamepadInputDescriptor, GridConfig, IApplication, IAudioProcessor, IColorPalette, IInputSystem, INetworkClient, INetworkServer, IRenderer, ISoundLoader, InputBindingLoadPacket, InputDescriptor, InputEnum, InputMessage, JoinMessage, JoinResponseMessage, KeyboardInputDescriptor, LeaveMessage, LoadMessage, MessageType, MouseInputDescriptor, NetworkClientOptions, NetworkEventHandler, NetworkMessage, NetworkServerOptions, PauseSoundCommand, PingMessage, PlaySoundCommand, PlaybackEndedAck, PlaybackErrorAck, PlaybackStartedAck, PongMessage, PostProcessCommand, PostProcessCommandType, PostProcessConfig, RGBColor, RenderState, RenderedCell, ResumeSoundCommand, ScanlinesConfig, ServerEventHandler, SetListenerPositionCommand, SetSoundEffectsCommand, SoundErrorAck, SoundExternalEntry, SoundExternalLoadPacket, SoundFileEntry, SoundFormat, SoundInstanceId, SoundLoadPacket, SoundLoadType, SoundLoadedAck, SpatialAudioConfig, StopSoundCommand, TVRemoteInputDescriptor, TouchInputDescriptor, TypedInputDescriptor, UpdateMessage, UserMetadata, UserRenderState };
1968
+ export type { AmbientEffectConfig, AnyNetworkMessage, AnySoundLoadPacket, AudioAck, AudioAckBase, AudioAckHandler, AudioAckType, AudioConfigCommand, AudioPlayOptions, AudioPlayResult, AudioSpatialOptions, AxisBinding, AxisSource, BridgeClientHandler, BridgeServerHandler, ButtonBinding, ButtonSource, CancelVibrationCommand, ChatMessage, ClientInfo, ConfigureSpatialCommand, ConnectionHandler, DisconnectionHandler, ErrorMessage, FadeOutSoundCommand, GamepadCancelVibrationCommand, GamepadInputDescriptor, GamepadVibrateCommand, GamepadVibrationCommand, GamepadVibrationOptions, GamepadVibrationPreset, GridConfig, IApplication, IAudioProcessor, IColorPalette, IGamepadVibrationProcessor, IInputSystem, IMobileVibrationProcessor, INetworkClient, INetworkServer, IRenderer, ISoundLoader, InputBindingLoadPacket, InputDescriptor, InputEnum, InputMessage, JoinMessage, JoinResponseMessage, KeyboardInputDescriptor, LeaveMessage, LoadMessage, MessageType, MobileVibrationCommand, MobileVibrationPreset, MouseInputDescriptor, NetworkClientOptions, NetworkEventHandler, NetworkMessage, NetworkServerOptions, PauseSoundCommand, PingMessage, PlaySoundCommand, PlaybackEndedAck, PlaybackErrorAck, PlaybackStartedAck, PongMessage, PostProcessCommand, PostProcessCommandType, PostProcessConfig, RGBColor, RenderState, RenderedCell, ResumeSoundCommand, ScanlinesConfig, ServerEventHandler, SetListenerPositionCommand, SetSoundEffectsCommand, SoundErrorAck, SoundExternalEntry, SoundExternalLoadPacket, SoundFileEntry, SoundFormat, SoundInstanceId, SoundLoadPacket, SoundLoadType, SoundLoadedAck, SpatialAudioConfig, StopSoundCommand, TVRemoteInputDescriptor, TouchInputDescriptor, TypedInputDescriptor, UpdateMessage, UserMetadata, UserRenderState, VibrateCommand, VibrationPattern };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var C=Object.defineProperty;var M=(t,e,c)=>e in t?C(t,e,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[e]=c;var o=(t,e)=>C(t,"name",{value:e,configurable:!0});var D=(t,e,c)=>(M(t,typeof e!="symbol"?e+"":e,c),c);var w=(f=>(f[f.Keyboard=0]="Keyboard",f[f.Mouse=1]="Mouse",f[f.Gamepad=2]="Gamepad",f[f.Touch=3]="Touch",f[f.TVRemote=4]="TVRemote",f[f.TextInput=5]="TextInput",f))(w||{});var u=(i=>(i[i.KeyA=0]="KeyA",i[i.KeyB=1]="KeyB",i[i.KeyC=2]="KeyC",i[i.KeyD=3]="KeyD",i[i.KeyE=4]="KeyE",i[i.KeyF=5]="KeyF",i[i.KeyG=6]="KeyG",i[i.KeyH=7]="KeyH",i[i.KeyI=8]="KeyI",i[i.KeyJ=9]="KeyJ",i[i.KeyK=10]="KeyK",i[i.KeyL=11]="KeyL",i[i.KeyM=12]="KeyM",i[i.KeyN=13]="KeyN",i[i.KeyO=14]="KeyO",i[i.KeyP=15]="KeyP",i[i.KeyQ=16]="KeyQ",i[i.KeyR=17]="KeyR",i[i.KeyS=18]="KeyS",i[i.KeyT=19]="KeyT",i[i.KeyU=20]="KeyU",i[i.KeyV=21]="KeyV",i[i.KeyW=22]="KeyW",i[i.KeyX=23]="KeyX",i[i.KeyY=24]="KeyY",i[i.KeyZ=25]="KeyZ",i[i.Digit0=26]="Digit0",i[i.Digit1=27]="Digit1",i[i.Digit2=28]="Digit2",i[i.Digit3=29]="Digit3",i[i.Digit4=30]="Digit4",i[i.Digit5=31]="Digit5",i[i.Digit6=32]="Digit6",i[i.Digit7=33]="Digit7",i[i.Digit8=34]="Digit8",i[i.Digit9=35]="Digit9",i[i.ArrowUp=36]="ArrowUp",i[i.ArrowDown=37]="ArrowDown",i[i.ArrowLeft=38]="ArrowLeft",i[i.ArrowRight=39]="ArrowRight",i[i.Space=40]="Space",i[i.Enter=41]="Enter",i[i.Escape=42]="Escape",i[i.Backspace=43]="Backspace",i[i.Tab=44]="Tab",i[i.ShiftLeft=45]="ShiftLeft",i[i.ShiftRight=46]="ShiftRight",i[i.ControlLeft=47]="ControlLeft",i[i.ControlRight=48]="ControlRight",i[i.AltLeft=49]="AltLeft",i[i.AltRight=50]="AltRight",i[i.MetaLeft=51]="MetaLeft",i[i.MetaRight=52]="MetaRight",i[i.CapsLock=53]="CapsLock",i[i.Delete=54]="Delete",i[i.Insert=55]="Insert",i[i.Home=56]="Home",i[i.End=57]="End",i[i.PageUp=58]="PageUp",i[i.PageDown=59]="PageDown",i[i.F1=60]="F1",i[i.F2=61]="F2",i[i.F3=62]="F3",i[i.F4=63]="F4",i[i.F5=64]="F5",i[i.F6=65]="F6",i[i.F7=66]="F7",i[i.F8=67]="F8",i[i.F9=68]="F9",i[i.F10=69]="F10",i[i.F11=70]="F11",i[i.F12=71]="F12",i[i.Minus=72]="Minus",i[i.Equal=73]="Equal",i[i.BracketLeft=74]="BracketLeft",i[i.BracketRight=75]="BracketRight",i[i.Backslash=76]="Backslash",i[i.Semicolon=77]="Semicolon",i[i.Quote=78]="Quote",i[i.Comma=79]="Comma",i[i.Period=80]="Period",i[i.Slash=81]="Slash",i[i.Backquote=82]="Backquote",i[i.Numpad0=91]="Numpad0",i[i.Numpad1=92]="Numpad1",i[i.Numpad2=93]="Numpad2",i[i.Numpad3=94]="Numpad3",i[i.Numpad4=95]="Numpad4",i[i.Numpad5=96]="Numpad5",i[i.Numpad6=97]="Numpad6",i[i.Numpad7=98]="Numpad7",i[i.Numpad8=99]="Numpad8",i[i.Numpad9=100]="Numpad9",i[i.NumpadAdd=101]="NumpadAdd",i[i.NumpadSubtract=102]="NumpadSubtract",i[i.NumpadMultiply=103]="NumpadMultiply",i[i.NumpadDivide=104]="NumpadDivide",i[i.NumpadDecimal=105]="NumpadDecimal",i[i.NumpadEnter=106]="NumpadEnter",i[i.NumLock=107]="NumLock",i[i.PrintScreen=111]="PrintScreen",i[i.ScrollLock=112]="ScrollLock",i[i.Pause=113]="Pause",i[i.ContextMenu=114]="ContextMenu",i))(u||{});function L(t){let e=u[t];return e!==void 0?e:null}o(L,"keyCodeToKeyboardInput");function v(t){return u[t]}o(v,"keyboardInputToKeyCode");var z=(l=>(l[l.LeftButton=0]="LeftButton",l[l.MiddleButton=1]="MiddleButton",l[l.RightButton=2]="RightButton",l[l.Button4=3]="Button4",l[l.Button5=4]="Button5",l[l.PositionX=100]="PositionX",l[l.PositionY=101]="PositionY",l[l.DeltaX=102]="DeltaX",l[l.DeltaY=103]="DeltaY",l[l.WheelDeltaY=104]="WheelDeltaY",l[l.WheelDeltaX=105]="WheelDeltaX",l))(z||{});function N(t){return t<100}o(N,"isMouseButton");function Y(t){return t>=100}o(Y,"isMouseAxis");var S=(n=>(n[n.ButtonA=0]="ButtonA",n[n.ButtonB=1]="ButtonB",n[n.ButtonX=2]="ButtonX",n[n.ButtonY=3]="ButtonY",n[n.LeftShoulder=4]="LeftShoulder",n[n.RightShoulder=5]="RightShoulder",n[n.LeftTrigger=6]="LeftTrigger",n[n.RightTrigger=7]="RightTrigger",n[n.Select=8]="Select",n[n.Start=9]="Start",n[n.LeftStick=10]="LeftStick",n[n.RightStick=11]="RightStick",n[n.DPadUp=12]="DPadUp",n[n.DPadDown=13]="DPadDown",n[n.DPadLeft=14]="DPadLeft",n[n.DPadRight=15]="DPadRight",n[n.Home=16]="Home",n[n.Touchpad=17]="Touchpad",n[n.LeftStickX=100]="LeftStickX",n[n.LeftStickY=101]="LeftStickY",n[n.RightStickX=102]="RightStickX",n[n.RightStickY=103]="RightStickY",n[n.LeftTriggerAxis=104]="LeftTriggerAxis",n[n.RightTriggerAxis=105]="RightTriggerAxis",n))(S||{});function X(t){return t<100}o(X,"isGamepadButton");function F(t){return t>=100}o(F,"isGamepadAxis");function H(t){return t>=0&&t<=19?t:null}o(H,"gamepadButtonIndexToInput");function q(t){return{0:100,1:101,2:102,3:103}[t]??null}o(q,"gamepadAxisIndexToInput");var P=(s=>(s[s.Touch0=0]="Touch0",s[s.Touch1=1]="Touch1",s[s.Touch2=2]="Touch2",s[s.Touch3=3]="Touch3",s[s.Touch4=4]="Touch4",s[s.Touch5=5]="Touch5",s[s.Touch6=6]="Touch6",s[s.Touch7=7]="Touch7",s[s.Touch8=8]="Touch8",s[s.Touch9=9]="Touch9",s[s.Touch0X=100]="Touch0X",s[s.Touch0Y=101]="Touch0Y",s[s.Touch1X=102]="Touch1X",s[s.Touch1Y=103]="Touch1Y",s[s.Touch2X=104]="Touch2X",s[s.Touch2Y=105]="Touch2Y",s[s.Touch3X=106]="Touch3X",s[s.Touch3Y=107]="Touch3Y",s[s.Touch4X=108]="Touch4X",s[s.Touch4Y=109]="Touch4Y",s[s.Touch5X=110]="Touch5X",s[s.Touch5Y=111]="Touch5Y",s[s.Touch6X=112]="Touch6X",s[s.Touch6Y=113]="Touch6Y",s[s.Touch7X=114]="Touch7X",s[s.Touch7Y=115]="Touch7Y",s[s.Touch8X=116]="Touch8X",s[s.Touch8Y=117]="Touch8Y",s[s.Touch9X=118]="Touch9X",s[s.Touch9Y=119]="Touch9Y",s[s.PinchScale=200]="PinchScale",s[s.RotationAngle=201]="RotationAngle",s[s.SwipeVelocityX=202]="SwipeVelocityX",s[s.SwipeVelocityY=203]="SwipeVelocityY",s))(P||{});function U(t){return t<100}o(U,"isTouchButton");function Q(t){return t>=100&&t<200}o(Q,"isTouchPosition");function $(t){return t>=200}o($,"isTouchGesture");function O(t){return t<0||t>9?null:100+t*2}o(O,"getTouchXAxis");function W(t){return t<0||t>9?null:101+t*2}o(W,"getTouchYAxis");var B=(r=>(r[r.DPadUp=0]="DPadUp",r[r.DPadDown=1]="DPadDown",r[r.DPadLeft=2]="DPadLeft",r[r.DPadRight=3]="DPadRight",r[r.DPadCenter=4]="DPadCenter",r[r.Play=5]="Play",r[r.Pause=6]="Pause",r[r.PlayPause=7]="PlayPause",r[r.Stop=8]="Stop",r[r.Rewind=9]="Rewind",r[r.FastForward=10]="FastForward",r[r.Previous=11]="Previous",r[r.Next=12]="Next",r[r.Record=13]="Record",r[r.VolumeUp=15]="VolumeUp",r[r.VolumeDown=16]="VolumeDown",r[r.Mute=17]="Mute",r[r.ChannelUp=18]="ChannelUp",r[r.ChannelDown=19]="ChannelDown",r[r.Back=20]="Back",r[r.Home=21]="Home",r[r.Menu=22]="Menu",r[r.Info=23]="Info",r[r.Guide=24]="Guide",r[r.Exit=25]="Exit",r[r.Red=30]="Red",r[r.Green=31]="Green",r[r.Yellow=32]="Yellow",r[r.Blue=33]="Blue",r[r.Digit0=40]="Digit0",r[r.Digit1=41]="Digit1",r[r.Digit2=42]="Digit2",r[r.Digit3=43]="Digit3",r[r.Digit4=44]="Digit4",r[r.Digit5=45]="Digit5",r[r.Digit6=46]="Digit6",r[r.Digit7=47]="Digit7",r[r.Digit8=48]="Digit8",r[r.Digit9=49]="Digit9",r[r.Input=50]="Input",r[r.Settings=51]="Settings",r[r.Subtitle=52]="Subtitle",r[r.Audio=53]="Audio",r[r.Power=54]="Power",r[r.PointerX=100]="PointerX",r[r.PointerY=101]="PointerY",r[r.GyroX=102]="GyroX",r[r.GyroY=103]="GyroY",r[r.GyroZ=104]="GyroZ",r))(B||{});function Z(t){return t<100}o(Z,"isTVRemoteButton");function j(t){return t>=100}o(j,"isTVRemoteAxis");function J(t,e){return{device:t,input:e}}o(J,"createInputDescriptor");function E(t){switch(t.device){case 0:return!0;case 1:return t.input<100;case 2:return t.input<100;case 3:return t.input<100;case 4:return t.input<100;default:return!1}}o(E,"isButton");function d(t){return!E(t)}o(d,"isAxis");function G(t){let e=new Uint8Array(3);return e[0]=t.device,e[1]=t.input&255,e[2]=t.input>>8&255,e}o(G,"serializeInputDescriptor");function y(t,e=0){let c=t[e],a=t[e+1]|t[e+2]<<8;return{device:c,input:a}}o(y,"deserializeInputDescriptor");function V(t){let e=w[t.device],c;switch(t.device){case 0:c=u[t.input];break;case 1:c=z[t.input];break;case 2:c=S[t.input];break;case 3:c=P[t.input];break;case 4:c=B[t.input];break;default:c="Unknown"}return`${e}:${c}`}o(V,"inputDescriptorToString");function T(t){let[e,c]=t.split(":");if(!e||!c)return null;let a=Object.entries(w).find(([h,f])=>h.toLowerCase()===e.toLowerCase()&&typeof f=="number")?.[1];if(a===void 0)return null;let m;switch(a){case 0:m=u[c];break;case 1:m=z[c];break;case 2:m=S[c];break;case 3:m=P[c];break;case 4:m=B[c];break}return m===void 0?null:{device:a,input:m}}o(T,"parseInputDescriptor");var g=class g{constructor(e=0,c=0){D(this,"x");D(this,"y");this.x=e,this.y=c}static zero(){return new g(0,0)}static one(){return new g(1,1)}static up(){return new g(0,-1)}static down(){return new g(0,1)}static left(){return new g(-1,0)}static right(){return new g(1,0)}add(e){return new g(this.x+e.x,this.y+e.y)}subtract(e){return new g(this.x-e.x,this.y-e.y)}multiply(e){return new g(this.x*e,this.y*e)}divide(e){if(e===0)throw new Error("Division by zero");return new g(this.x/e,this.y/e)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let e=this.length();return e===0?g.zero():this.divide(e)}distance(e){return this.subtract(e).length()}distanceSquared(e){return this.subtract(e).lengthSquared()}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}angle(){return Math.atan2(this.y,this.x)}angleTo(e){return Math.atan2(e.y-this.y,e.x-this.x)}rotate(e){let c=Math.cos(e),a=Math.sin(e);return new g(this.x*c-this.y*a,this.x*a+this.y*c)}lerp(e,c){return new g(this.x+(e.x-this.x)*c,this.y+(e.y-this.y)*c)}clone(){return new g(this.x,this.y)}equals(e){return this.x===e.x&&this.y===e.y}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}set(e,c){return this.x=e,this.y=c,this}copy(e){return this.x=e.x,this.y=e.y,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this}multiplyInPlace(e){return this.x*=e,this.y*=e,this}divideInPlace(e){if(e===0)throw new Error("Division by zero");return this.x/=e,this.y/=e,this}normalizeInPlace(){let e=this.length();return e===0?(this.x=0,this.y=0):(this.x/=e,this.y/=e),this}};o(g,"Vector2");var A=g;var x=class x{constructor(e=0,c=0,a=0){D(this,"x");D(this,"y");D(this,"z");this.x=e,this.y=c,this.z=a}static zero(){return new x(0,0,0)}static one(){return new x(1,1,1)}static up(){return new x(0,1,0)}static down(){return new x(0,-1,0)}static left(){return new x(-1,0,0)}static right(){return new x(1,0,0)}static forward(){return new x(0,0,1)}static back(){return new x(0,0,-1)}add(e){return new x(this.x+e.x,this.y+e.y,this.z+e.z)}subtract(e){return new x(this.x-e.x,this.y-e.y,this.z-e.z)}multiply(e){return new x(this.x*e,this.y*e,this.z*e)}divide(e){if(e===0)throw new Error("Division by zero");return new x(this.x/e,this.y/e,this.z/e)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){let e=this.length();return e===0?x.zero():this.divide(e)}distance(e){return this.subtract(e).length()}distanceSquared(e){return this.subtract(e).lengthSquared()}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){return new x(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}lerp(e,c){return new x(this.x+(e.x-this.x)*c,this.y+(e.y-this.y)*c,this.z+(e.z-this.z)*c)}clone(){return new x(this.x,this.y,this.z)}equals(e){return this.x===e.x&&this.y===e.y&&this.z===e.z}toString(){return`Vector3(${this.x}, ${this.y}, ${this.z})`}toArray(){return[this.x,this.y,this.z]}set(e,c,a){return this.x=e,this.y=c,this.z=a,this}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}multiplyInPlace(e){return this.x*=e,this.y*=e,this.z*=e,this}divideInPlace(e){if(e===0)throw new Error("Division by zero");return this.x/=e,this.y/=e,this.z/=e,this}normalizeInPlace(){let e=this.length();return e===0?(this.x=0,this.y=0,this.z=0):(this.x/=e,this.y/=e,this.z/=e),this}};o(x,"Vector3");var k=x;var Fi={scanlines:{opacity:.15,pattern:"horizontal",spacing:2,thickness:1,color:{r:0,g:0,b:0}},ambientEffect:{blur:30,scale:1.3,opacity:.7}},Hi={color:"rgba(144, 24, 24, 1)",lineWidth:1};var _=(h=>(h.None="none",h.Eighth="eighth",h.Quarter="quarter",h.Half="half",h.Integer="integer",h))(_||{}),b=(h=>(h[h.None=0]="None",h[h.Eighth=1]="Eighth",h[h.Quarter=2]="Quarter",h[h.Half=3]="Half",h[h.Integer=4]="Integer",h))(b||{});function Ui(t){switch(t){case"none":return 0;case"eighth":return 1;case"quarter":return 2;case"half":return 3;case"integer":return 4;default:return 0}}o(Ui,"scalingModeToValue");function Qi(t){switch(t){case 0:return"none";case 1:return"eighth";case 2:return"quarter";case 3:return"half";case 4:return"integer";default:return"none"}}o(Qi,"valueToScalingMode");var R=(h=>(h[h.Disconnected=0]="Disconnected",h[h.Connecting=1]="Connecting",h[h.Connected=2]="Connected",h[h.Reconnecting=3]="Reconnecting",h[h.Error=4]="Error",h))(R||{});export{Hi as GRID_DEFAULTS,S as GamepadInput,w as InputDeviceType,u as KeyboardInput,z as MouseInput,R as NetworkState,Fi as POST_PROCESS_DEFAULTS,_ as ScalingMode,b as ScalingModeValue,B as TVRemoteInput,P as TouchInput,A as Vector2,k as Vector3,J as createInputDescriptor,y as deserializeInputDescriptor,q as gamepadAxisIndexToInput,H as gamepadButtonIndexToInput,O as getTouchXAxis,W as getTouchYAxis,V as inputDescriptorToString,d as isAxis,E as isButton,F as isGamepadAxis,X as isGamepadButton,Y as isMouseAxis,N as isMouseButton,j as isTVRemoteAxis,Z as isTVRemoteButton,U as isTouchButton,$ as isTouchGesture,Q as isTouchPosition,L as keyCodeToKeyboardInput,v as keyboardInputToKeyCode,T as parseInputDescriptor,Ui as scalingModeToValue,G as serializeInputDescriptor,Qi as valueToScalingMode};
1
+ var C=Object.defineProperty;var L=(t,e,c)=>e in t?C(t,e,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[e]=c;var o=(t,e)=>C(t,"name",{value:e,configurable:!0});var D=(t,e,c)=>(L(t,typeof e!="symbol"?e+"":e,c),c);var u=(f=>(f[f.Keyboard=0]="Keyboard",f[f.Mouse=1]="Mouse",f[f.Gamepad=2]="Gamepad",f[f.Touch=3]="Touch",f[f.TVRemote=4]="TVRemote",f[f.TextInput=5]="TextInput",f[f.Motion=6]="Motion",f))(u||{});var w=(i=>(i[i.KeyA=0]="KeyA",i[i.KeyB=1]="KeyB",i[i.KeyC=2]="KeyC",i[i.KeyD=3]="KeyD",i[i.KeyE=4]="KeyE",i[i.KeyF=5]="KeyF",i[i.KeyG=6]="KeyG",i[i.KeyH=7]="KeyH",i[i.KeyI=8]="KeyI",i[i.KeyJ=9]="KeyJ",i[i.KeyK=10]="KeyK",i[i.KeyL=11]="KeyL",i[i.KeyM=12]="KeyM",i[i.KeyN=13]="KeyN",i[i.KeyO=14]="KeyO",i[i.KeyP=15]="KeyP",i[i.KeyQ=16]="KeyQ",i[i.KeyR=17]="KeyR",i[i.KeyS=18]="KeyS",i[i.KeyT=19]="KeyT",i[i.KeyU=20]="KeyU",i[i.KeyV=21]="KeyV",i[i.KeyW=22]="KeyW",i[i.KeyX=23]="KeyX",i[i.KeyY=24]="KeyY",i[i.KeyZ=25]="KeyZ",i[i.Digit0=26]="Digit0",i[i.Digit1=27]="Digit1",i[i.Digit2=28]="Digit2",i[i.Digit3=29]="Digit3",i[i.Digit4=30]="Digit4",i[i.Digit5=31]="Digit5",i[i.Digit6=32]="Digit6",i[i.Digit7=33]="Digit7",i[i.Digit8=34]="Digit8",i[i.Digit9=35]="Digit9",i[i.ArrowUp=36]="ArrowUp",i[i.ArrowDown=37]="ArrowDown",i[i.ArrowLeft=38]="ArrowLeft",i[i.ArrowRight=39]="ArrowRight",i[i.Space=40]="Space",i[i.Enter=41]="Enter",i[i.Escape=42]="Escape",i[i.Backspace=43]="Backspace",i[i.Tab=44]="Tab",i[i.ShiftLeft=45]="ShiftLeft",i[i.ShiftRight=46]="ShiftRight",i[i.ControlLeft=47]="ControlLeft",i[i.ControlRight=48]="ControlRight",i[i.AltLeft=49]="AltLeft",i[i.AltRight=50]="AltRight",i[i.MetaLeft=51]="MetaLeft",i[i.MetaRight=52]="MetaRight",i[i.CapsLock=53]="CapsLock",i[i.Delete=54]="Delete",i[i.Insert=55]="Insert",i[i.Home=56]="Home",i[i.End=57]="End",i[i.PageUp=58]="PageUp",i[i.PageDown=59]="PageDown",i[i.F1=60]="F1",i[i.F2=61]="F2",i[i.F3=62]="F3",i[i.F4=63]="F4",i[i.F5=64]="F5",i[i.F6=65]="F6",i[i.F7=66]="F7",i[i.F8=67]="F8",i[i.F9=68]="F9",i[i.F10=69]="F10",i[i.F11=70]="F11",i[i.F12=71]="F12",i[i.Minus=72]="Minus",i[i.Equal=73]="Equal",i[i.BracketLeft=74]="BracketLeft",i[i.BracketRight=75]="BracketRight",i[i.Backslash=76]="Backslash",i[i.Semicolon=77]="Semicolon",i[i.Quote=78]="Quote",i[i.Comma=79]="Comma",i[i.Period=80]="Period",i[i.Slash=81]="Slash",i[i.Backquote=82]="Backquote",i[i.Numpad0=91]="Numpad0",i[i.Numpad1=92]="Numpad1",i[i.Numpad2=93]="Numpad2",i[i.Numpad3=94]="Numpad3",i[i.Numpad4=95]="Numpad4",i[i.Numpad5=96]="Numpad5",i[i.Numpad6=97]="Numpad6",i[i.Numpad7=98]="Numpad7",i[i.Numpad8=99]="Numpad8",i[i.Numpad9=100]="Numpad9",i[i.NumpadAdd=101]="NumpadAdd",i[i.NumpadSubtract=102]="NumpadSubtract",i[i.NumpadMultiply=103]="NumpadMultiply",i[i.NumpadDivide=104]="NumpadDivide",i[i.NumpadDecimal=105]="NumpadDecimal",i[i.NumpadEnter=106]="NumpadEnter",i[i.NumLock=107]="NumLock",i[i.PrintScreen=111]="PrintScreen",i[i.ScrollLock=112]="ScrollLock",i[i.Pause=113]="Pause",i[i.ContextMenu=114]="ContextMenu",i))(w||{});function N(t){let e=w[t];return e!==void 0?e:null}o(N,"keyCodeToKeyboardInput");function Y(t){return w[t]}o(Y,"keyboardInputToKeyCode");var z=(l=>(l[l.LeftButton=0]="LeftButton",l[l.MiddleButton=1]="MiddleButton",l[l.RightButton=2]="RightButton",l[l.Button4=3]="Button4",l[l.Button5=4]="Button5",l[l.PositionX=100]="PositionX",l[l.PositionY=101]="PositionY",l[l.DeltaX=102]="DeltaX",l[l.DeltaY=103]="DeltaY",l[l.WheelDeltaY=104]="WheelDeltaY",l[l.WheelDeltaX=105]="WheelDeltaX",l))(z||{});function v(t){return t<100}o(v,"isMouseButton");function X(t){return t>=100}o(X,"isMouseAxis");var S=(n=>(n[n.ButtonA=0]="ButtonA",n[n.ButtonB=1]="ButtonB",n[n.ButtonX=2]="ButtonX",n[n.ButtonY=3]="ButtonY",n[n.LeftShoulder=4]="LeftShoulder",n[n.RightShoulder=5]="RightShoulder",n[n.LeftTrigger=6]="LeftTrigger",n[n.RightTrigger=7]="RightTrigger",n[n.Select=8]="Select",n[n.Start=9]="Start",n[n.LeftStick=10]="LeftStick",n[n.RightStick=11]="RightStick",n[n.DPadUp=12]="DPadUp",n[n.DPadDown=13]="DPadDown",n[n.DPadLeft=14]="DPadLeft",n[n.DPadRight=15]="DPadRight",n[n.Home=16]="Home",n[n.Touchpad=17]="Touchpad",n[n.LeftStickX=100]="LeftStickX",n[n.LeftStickY=101]="LeftStickY",n[n.RightStickX=102]="RightStickX",n[n.RightStickY=103]="RightStickY",n[n.LeftTriggerAxis=104]="LeftTriggerAxis",n[n.RightTriggerAxis=105]="RightTriggerAxis",n))(S||{});function F(t){return t<100}o(F,"isGamepadButton");function H(t){return t>=100}o(H,"isGamepadAxis");function q(t){return t>=0&&t<=19?t:null}o(q,"gamepadButtonIndexToInput");function U(t){return{0:100,1:101,2:102,3:103}[t]??null}o(U,"gamepadAxisIndexToInput");var P=(s=>(s[s.Touch0=0]="Touch0",s[s.Touch1=1]="Touch1",s[s.Touch2=2]="Touch2",s[s.Touch3=3]="Touch3",s[s.Touch4=4]="Touch4",s[s.Touch5=5]="Touch5",s[s.Touch6=6]="Touch6",s[s.Touch7=7]="Touch7",s[s.Touch8=8]="Touch8",s[s.Touch9=9]="Touch9",s[s.Touch0X=100]="Touch0X",s[s.Touch0Y=101]="Touch0Y",s[s.Touch1X=102]="Touch1X",s[s.Touch1Y=103]="Touch1Y",s[s.Touch2X=104]="Touch2X",s[s.Touch2Y=105]="Touch2Y",s[s.Touch3X=106]="Touch3X",s[s.Touch3Y=107]="Touch3Y",s[s.Touch4X=108]="Touch4X",s[s.Touch4Y=109]="Touch4Y",s[s.Touch5X=110]="Touch5X",s[s.Touch5Y=111]="Touch5Y",s[s.Touch6X=112]="Touch6X",s[s.Touch6Y=113]="Touch6Y",s[s.Touch7X=114]="Touch7X",s[s.Touch7Y=115]="Touch7Y",s[s.Touch8X=116]="Touch8X",s[s.Touch8Y=117]="Touch8Y",s[s.Touch9X=118]="Touch9X",s[s.Touch9Y=119]="Touch9Y",s[s.PinchScale=200]="PinchScale",s[s.RotationAngle=201]="RotationAngle",s[s.SwipeVelocityX=202]="SwipeVelocityX",s[s.SwipeVelocityY=203]="SwipeVelocityY",s))(P||{});function Q(t){return t<100}o(Q,"isTouchButton");function $(t){return t>=100&&t<200}o($,"isTouchPosition");function O(t){return t>=200}o(O,"isTouchGesture");function W(t){return t<0||t>9?null:100+t*2}o(W,"getTouchXAxis");function Z(t){return t<0||t>9?null:101+t*2}o(Z,"getTouchYAxis");var B=(r=>(r[r.DPadUp=0]="DPadUp",r[r.DPadDown=1]="DPadDown",r[r.DPadLeft=2]="DPadLeft",r[r.DPadRight=3]="DPadRight",r[r.DPadCenter=4]="DPadCenter",r[r.Play=5]="Play",r[r.Pause=6]="Pause",r[r.PlayPause=7]="PlayPause",r[r.Stop=8]="Stop",r[r.Rewind=9]="Rewind",r[r.FastForward=10]="FastForward",r[r.Previous=11]="Previous",r[r.Next=12]="Next",r[r.Record=13]="Record",r[r.VolumeUp=15]="VolumeUp",r[r.VolumeDown=16]="VolumeDown",r[r.Mute=17]="Mute",r[r.ChannelUp=18]="ChannelUp",r[r.ChannelDown=19]="ChannelDown",r[r.Back=20]="Back",r[r.Home=21]="Home",r[r.Menu=22]="Menu",r[r.Info=23]="Info",r[r.Guide=24]="Guide",r[r.Exit=25]="Exit",r[r.Red=30]="Red",r[r.Green=31]="Green",r[r.Yellow=32]="Yellow",r[r.Blue=33]="Blue",r[r.Digit0=40]="Digit0",r[r.Digit1=41]="Digit1",r[r.Digit2=42]="Digit2",r[r.Digit3=43]="Digit3",r[r.Digit4=44]="Digit4",r[r.Digit5=45]="Digit5",r[r.Digit6=46]="Digit6",r[r.Digit7=47]="Digit7",r[r.Digit8=48]="Digit8",r[r.Digit9=49]="Digit9",r[r.Input=50]="Input",r[r.Settings=51]="Settings",r[r.Subtitle=52]="Subtitle",r[r.Audio=53]="Audio",r[r.Power=54]="Power",r[r.PointerX=100]="PointerX",r[r.PointerY=101]="PointerY",r[r.GyroX=102]="GyroX",r[r.GyroY=103]="GyroY",r[r.GyroZ=104]="GyroZ",r))(B||{});function j(t){return t<100}o(j,"isTVRemoteButton");function J(t){return t>=100}o(J,"isTVRemoteAxis");function d(t,e){return{device:t,input:e}}o(d,"createInputDescriptor");function E(t){switch(t.device){case 0:return!0;case 1:return t.input<100;case 2:return t.input<100;case 3:return t.input<100;case 4:return t.input<100;default:return!1}}o(E,"isButton");function G(t){return!E(t)}o(G,"isAxis");function y(t){let e=new Uint8Array(3);return e[0]=t.device,e[1]=t.input&255,e[2]=t.input>>8&255,e}o(y,"serializeInputDescriptor");function V(t,e=0){let c=t[e],a=t[e+1]|t[e+2]<<8;return{device:c,input:a}}o(V,"deserializeInputDescriptor");function T(t){let e=u[t.device],c;switch(t.device){case 0:c=w[t.input];break;case 1:c=z[t.input];break;case 2:c=S[t.input];break;case 3:c=P[t.input];break;case 4:c=B[t.input];break;default:c="Unknown"}return`${e}:${c}`}o(T,"inputDescriptorToString");function _(t){let[e,c]=t.split(":");if(!e||!c)return null;let a=Object.entries(u).find(([h,M])=>h.toLowerCase()===e.toLowerCase()&&typeof M=="number")?.[1];if(a===void 0)return null;let m;switch(a){case 0:m=w[c];break;case 1:m=z[c];break;case 2:m=S[c];break;case 3:m=P[c];break;case 4:m=B[c];break}return m===void 0?null:{device:a,input:m}}o(_,"parseInputDescriptor");var g=class g{constructor(e=0,c=0){D(this,"x");D(this,"y");this.x=e,this.y=c}static zero(){return new g(0,0)}static one(){return new g(1,1)}static up(){return new g(0,-1)}static down(){return new g(0,1)}static left(){return new g(-1,0)}static right(){return new g(1,0)}add(e){return new g(this.x+e.x,this.y+e.y)}subtract(e){return new g(this.x-e.x,this.y-e.y)}multiply(e){return new g(this.x*e,this.y*e)}divide(e){if(e===0)throw new Error("Division by zero");return new g(this.x/e,this.y/e)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let e=this.length();return e===0?g.zero():this.divide(e)}distance(e){return this.subtract(e).length()}distanceSquared(e){return this.subtract(e).lengthSquared()}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}angle(){return Math.atan2(this.y,this.x)}angleTo(e){return Math.atan2(e.y-this.y,e.x-this.x)}rotate(e){let c=Math.cos(e),a=Math.sin(e);return new g(this.x*c-this.y*a,this.x*a+this.y*c)}lerp(e,c){return new g(this.x+(e.x-this.x)*c,this.y+(e.y-this.y)*c)}clone(){return new g(this.x,this.y)}equals(e){return this.x===e.x&&this.y===e.y}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}set(e,c){return this.x=e,this.y=c,this}copy(e){return this.x=e.x,this.y=e.y,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this}multiplyInPlace(e){return this.x*=e,this.y*=e,this}divideInPlace(e){if(e===0)throw new Error("Division by zero");return this.x/=e,this.y/=e,this}normalizeInPlace(){let e=this.length();return e===0?(this.x=0,this.y=0):(this.x/=e,this.y/=e),this}};o(g,"Vector2");var A=g;var x=class x{constructor(e=0,c=0,a=0){D(this,"x");D(this,"y");D(this,"z");this.x=e,this.y=c,this.z=a}static zero(){return new x(0,0,0)}static one(){return new x(1,1,1)}static up(){return new x(0,1,0)}static down(){return new x(0,-1,0)}static left(){return new x(-1,0,0)}static right(){return new x(1,0,0)}static forward(){return new x(0,0,1)}static back(){return new x(0,0,-1)}add(e){return new x(this.x+e.x,this.y+e.y,this.z+e.z)}subtract(e){return new x(this.x-e.x,this.y-e.y,this.z-e.z)}multiply(e){return new x(this.x*e,this.y*e,this.z*e)}divide(e){if(e===0)throw new Error("Division by zero");return new x(this.x/e,this.y/e,this.z/e)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){let e=this.length();return e===0?x.zero():this.divide(e)}distance(e){return this.subtract(e).length()}distanceSquared(e){return this.subtract(e).lengthSquared()}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){return new x(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}lerp(e,c){return new x(this.x+(e.x-this.x)*c,this.y+(e.y-this.y)*c,this.z+(e.z-this.z)*c)}clone(){return new x(this.x,this.y,this.z)}equals(e){return this.x===e.x&&this.y===e.y&&this.z===e.z}toString(){return`Vector3(${this.x}, ${this.y}, ${this.z})`}toArray(){return[this.x,this.y,this.z]}set(e,c,a){return this.x=e,this.y=c,this.z=a,this}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}multiplyInPlace(e){return this.x*=e,this.y*=e,this.z*=e,this}divideInPlace(e){if(e===0)throw new Error("Division by zero");return this.x/=e,this.y/=e,this.z/=e,this}normalizeInPlace(){let e=this.length();return e===0?(this.x=0,this.y=0,this.z=0):(this.x/=e,this.y/=e,this.z/=e),this}};o(x,"Vector3");var k=x;var Hi={scanlines:{opacity:.15,pattern:"horizontal",spacing:2,thickness:1,color:{r:0,g:0,b:0}},ambientEffect:{blur:30,scale:1.3,opacity:.7}},qi={color:"rgba(144, 24, 24, 1)",lineWidth:1};var b=(h=>(h.None="none",h.Eighth="eighth",h.Quarter="quarter",h.Half="half",h.Integer="integer",h))(b||{}),R=(h=>(h[h.None=0]="None",h[h.Eighth=1]="Eighth",h[h.Quarter=2]="Quarter",h[h.Half=3]="Half",h[h.Integer=4]="Integer",h))(R||{});function Qi(t){switch(t){case"none":return 0;case"eighth":return 1;case"quarter":return 2;case"half":return 3;case"integer":return 4;default:return 0}}o(Qi,"scalingModeToValue");function $i(t){switch(t){case 0:return"none";case 1:return"eighth";case 2:return"quarter";case 3:return"half";case 4:return"integer";default:return"none"}}o($i,"valueToScalingMode");var p=(h=>(h[h.Disconnected=0]="Disconnected",h[h.Connecting=1]="Connecting",h[h.Connected=2]="Connected",h[h.Reconnecting=3]="Reconnecting",h[h.Error=4]="Error",h))(p||{});export{qi as GRID_DEFAULTS,S as GamepadInput,u as InputDeviceType,w as KeyboardInput,z as MouseInput,p as NetworkState,Hi as POST_PROCESS_DEFAULTS,b as ScalingMode,R as ScalingModeValue,B as TVRemoteInput,P as TouchInput,A as Vector2,k as Vector3,d as createInputDescriptor,V as deserializeInputDescriptor,U as gamepadAxisIndexToInput,q as gamepadButtonIndexToInput,W as getTouchXAxis,Z as getTouchYAxis,T as inputDescriptorToString,G as isAxis,E as isButton,H as isGamepadAxis,F as isGamepadButton,X as isMouseAxis,v as isMouseButton,J as isTVRemoteAxis,j as isTVRemoteButton,Q as isTouchButton,O as isTouchGesture,$ as isTouchPosition,N as keyCodeToKeyboardInput,Y as keyboardInputToKeyCode,_ as parseInputDescriptor,Qi as scalingModeToValue,y as serializeInputDescriptor,$i as valueToScalingMode};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utsp/types",
3
- "version": "0.10.0-nightly.20251211194839.e68c16e",
3
+ "version": "0.10.0-nightly.20251213135145.115c488",
4
4
  "description": "Type definitions and interfaces for UTSP (Universal Text Stream Protocol)",
5
5
  "author": "THP Software",
6
6
  "license": "MIT",