@utsp/types 0.7.2 → 0.8.0-nightly.20251210143611.28813c1

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 k=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var I=(t,e,c)=>e in t?k(t,e,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[e]=c;var o=(t,e)=>k(t,"name",{value:e,configurable:!0});var ii=(t,e)=>{for(var c in e)k(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&&k(t,m,{get:()=>e[m],enumerable:!(f=R(e,m))||f.enumerable});return t};var ri=t=>ei(k({},"__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:()=>_,ScalingModeValue:()=>T,TVRemoteInput:()=>A,TouchInput:()=>P,Vector2:()=>B,Vector3:()=>E,createInputDescriptor:()=>j,deserializeInputDescriptor:()=>y,gamepadAxisIndexToInput:()=>q,gamepadButtonIndexToInput:()=>F,getTouchXAxis:()=>$,getTouchYAxis:()=>O,inputDescriptorToString:()=>V,isAxis:()=>J,isButton:()=>C,isGamepadAxis:()=>v,isGamepadButton:()=>X,isMouseAxis:()=>Y,isMouseButton:()=>N,isTVRemoteAxis:()=>Z,isTVRemoteButton:()=>W,isTouchButton:()=>H,isTouchGesture:()=>Q,isTouchPosition:()=>U,keyCodeToKeyboardInput:()=>M,keyboardInputToKeyCode:()=>L,parseInputDescriptor:()=>d,scalingModeToValue:()=>ni,serializeInputDescriptor:()=>G,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 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 v(t){return t>=100}o(v,"isGamepadAxis");function F(t){return t>=0&&t<=19?t:null}o(F,"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 H(t){return t<100}o(H,"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 A=(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))(A||{});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 C(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(C,"isButton");function J(t){return!C(t)}o(J,"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],f=t[e+1]|t[e+2]<<8;return{device:c,input:f}}o(y,"deserializeInputDescriptor");function V(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=A[t.input];break;default:c="Unknown"}return`${e}:${c}`}o(V,"inputDescriptorToString");function d(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=A[c];break}return m===void 0?null:{device:f,input:m}}o(d,"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 B=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 E=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 _=(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))(T||{});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 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||{});
package/dist/index.d.ts CHANGED
@@ -985,6 +985,8 @@ interface PostProcessCommand {
985
985
  */
986
986
  /** Event handler callback */
987
987
  type NetworkEventHandler<T = any> = (data: T) => void;
988
+ /** Bridge message handler (client-side) */
989
+ type BridgeClientHandler<T = unknown> = (data: T) => void;
988
990
  /** Connection state */
989
991
  declare enum NetworkState {
990
992
  Disconnected = 0,
@@ -1032,6 +1034,23 @@ interface INetworkClient {
1032
1034
  request<T = any>(event: string, data: any, timeout?: number): Promise<T>;
1033
1035
  /** Get ping to server (ms) */
1034
1036
  getPing(): number;
1037
+ /**
1038
+ * Send data to the server through the bridge channel
1039
+ * Bridge bypasses UTSP protocol - for external app communication
1040
+ */
1041
+ sendBridge?(channel: string, data: unknown): void;
1042
+ /**
1043
+ * Listen for incoming bridge messages from the server
1044
+ */
1045
+ onBridge?<T = unknown>(channel: string, handler: BridgeClientHandler<T>): void;
1046
+ /**
1047
+ * Remove a bridge handler
1048
+ */
1049
+ offBridge?<T = unknown>(channel: string, handler: BridgeClientHandler<T>): void;
1050
+ /**
1051
+ * Remove all bridge handlers for a channel or all channels
1052
+ */
1053
+ removeAllBridgeHandlers?(channel?: string): void;
1035
1054
  /** Cleanup */
1036
1055
  destroy(): void;
1037
1056
  }
@@ -1046,6 +1065,8 @@ type ServerEventHandler<T = any> = (clientId: string, data: T) => void;
1046
1065
  type ConnectionHandler = (clientId: string) => void;
1047
1066
  /** Disconnection handler */
1048
1067
  type DisconnectionHandler = (clientId: string, reason: string) => void;
1068
+ /** Bridge message handler (server-side) */
1069
+ type BridgeServerHandler<T = unknown> = (clientId: string, data: T) => void;
1049
1070
  /** Server options */
1050
1071
  interface NetworkServerOptions {
1051
1072
  /** Port */
@@ -1127,6 +1148,23 @@ interface INetworkServer {
1127
1148
  totalConnections: number;
1128
1149
  uptime: number;
1129
1150
  };
1151
+ /**
1152
+ * Send data to a client through the bridge channel
1153
+ * Bridge bypasses UTSP protocol - for external app communication
1154
+ */
1155
+ sendBridge?(clientId: string, channel: string, data: unknown): void;
1156
+ /**
1157
+ * Broadcast data to all clients through the bridge channel
1158
+ */
1159
+ broadcastBridge?(channel: string, data: unknown): void;
1160
+ /**
1161
+ * Listen for incoming bridge messages from clients
1162
+ */
1163
+ onBridge?<T = unknown>(channel: string, handler: BridgeServerHandler<T>): void;
1164
+ /**
1165
+ * Remove a bridge handler
1166
+ */
1167
+ offBridge?<T = unknown>(channel: string, handler: BridgeServerHandler<T>): void;
1130
1168
  /** Cleanup */
1131
1169
  destroy(): Promise<void>;
1132
1170
  }
@@ -1741,6 +1779,40 @@ interface IApplication<TCore = any, TUser = any, TRuntime = unknown> {
1741
1779
  * ```
1742
1780
  */
1743
1781
  onAudioAck?(core: TCore, user: TUser, ack: AudioAck): void;
1782
+ /**
1783
+ * Handle bridge messages from clients (optional, server mode only)
1784
+ *
1785
+ * Called when a client sends a bridge message via `networkClient.sendBridge(channel, data)`.
1786
+ * The Bridge Channel allows custom bidirectional communication between the server
1787
+ * and external client applications (React, HTML, etc.) bypassing the UTSP protocol.
1788
+ *
1789
+ * Useful for:
1790
+ * - Chat messages
1791
+ * - Custom UI commands
1792
+ * - Game lobbies and matchmaking
1793
+ * - Debug/admin commands
1794
+ * - Integration with external systems
1795
+ *
1796
+ * @param core - Core instance
1797
+ * @param user - User who sent the message
1798
+ * @param channel - The bridge channel name (e.g., 'chat', 'lobby', 'debug')
1799
+ * @param data - The message data (JSON parsed from client)
1800
+ *
1801
+ * @example
1802
+ * ```typescript
1803
+ * onBridgeMessage(core, user, channel, data) {
1804
+ * if (channel === 'chat') {
1805
+ * const { message } = data as { message: string };
1806
+ * console.log(`[Chat] ${user.id}: ${message}`);
1807
+ * // Broadcast to all users or handle as needed
1808
+ * } else if (channel === 'ready') {
1809
+ * // Mark user as ready in lobby
1810
+ * this.readyPlayers.add(user.id);
1811
+ * }
1812
+ * }
1813
+ * ```
1814
+ */
1815
+ onBridgeMessage?(core: TCore, user: TUser, channel: string, data: unknown): void;
1744
1816
  /**
1745
1817
  * Handle errors during execution (optional)
1746
1818
  * @param core - Core instance
@@ -1775,4 +1847,4 @@ interface UserMetadata {
1775
1847
  }
1776
1848
 
1777
1849
  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 };
1778
- export type { AmbientEffectConfig, AnyNetworkMessage, AnySoundLoadPacket, AudioAck, AudioAckBase, AudioAckHandler, AudioAckType, AudioConfigCommand, AudioPlayOptions, AudioPlayResult, AudioSpatialOptions, AxisBinding, AxisSource, 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 };
1850
+ 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 };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var E=Object.defineProperty;var M=(t,e,c)=>e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[e]=c;var o=(t,e)=>E(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 N(t){return u[t]}o(N,"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 Y(t){return t<100}o(Y,"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 v(t){return t<100}o(v,"isGamepadButton");function F(t){return t>=100}o(F,"isGamepadAxis");function q(t){return t>=0&&t<=19?t:null}o(q,"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 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 A=(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))(A||{});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 C(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(C,"isButton");function G(t){return!C(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 d(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=A[t.input];break;default:c="Unknown"}return`${e}:${c}`}o(d,"inputDescriptorToString");function _(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=A[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 k=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 B=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}},qi={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||{}),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{qi as GRID_DEFAULTS,S as GamepadInput,w as InputDeviceType,u as KeyboardInput,z as MouseInput,R as NetworkState,Fi as POST_PROCESS_DEFAULTS,T as ScalingMode,b as ScalingModeValue,A as TVRemoteInput,P as TouchInput,k as Vector2,B as Vector3,J as createInputDescriptor,V as deserializeInputDescriptor,H as gamepadAxisIndexToInput,q as gamepadButtonIndexToInput,O as getTouchXAxis,W as getTouchYAxis,d as inputDescriptorToString,G as isAxis,C as isButton,F as isGamepadAxis,v as isGamepadButton,X as isMouseAxis,Y as isMouseButton,j as isTVRemoteAxis,Z as isTVRemoteButton,U as isTouchButton,$ as isTouchGesture,Q as isTouchPosition,L as keyCodeToKeyboardInput,N as keyboardInputToKeyCode,_ as parseInputDescriptor,Ui as scalingModeToValue,y as serializeInputDescriptor,Qi as valueToScalingMode};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utsp/types",
3
- "version": "0.7.2",
3
+ "version": "0.8.0-nightly.20251210143611.28813c1",
4
4
  "description": "Type definitions and interfaces for UTSP (Universal Text Stream Protocol)",
5
5
  "author": "THP Software",
6
6
  "license": "MIT",