@utsp/types 0.7.0-nightly.20251207021518.b0c5521 → 0.7.0-nightly.20251208110725.8dda911

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 L=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var p=(e,r,h)=>r in e?L(e,r,{enumerable:!0,configurable:!0,writable:!0,value:h}):e[r]=h;var n=(e,r)=>L(e,"name",{value:r,configurable:!0});var K=(e,r)=>{for(var h in r)L(e,h,{get:r[h],enumerable:!0})},I=(e,r,h,f)=>{if(r&&typeof r=="object"||typeof r=="function")for(let D of d(r))!b.call(e,D)&&D!==h&&L(e,D,{get:()=>r[D],enumerable:!(f=R(r,D))||f.enumerable});return e};var ii=e=>I(L({},"__esModule",{value:!0}),e);var z=(e,r,h)=>(p(e,typeof r!="symbol"?r+"":r,h),h);var ri={};K(ri,{GamepadInput:()=>B,InputDeviceType:()=>P,KeyboardInput:()=>w,MouseInput:()=>A,NetworkState:()=>T,TVRemoteInput:()=>k,TouchInput:()=>S,Vector2:()=>Y,Vector3:()=>X,createInputDescriptor:()=>j,deserializeInputDescriptor:()=>V,gamepadAxisIndexToInput:()=>q,gamepadButtonIndexToInput:()=>u,getTouchXAxis:()=>O,getTouchYAxis:()=>W,inputDescriptorToString:()=>y,isAxis:()=>J,isButton:()=>E,isGamepadAxis:()=>F,isGamepadButton:()=>a,isMouseAxis:()=>N,isMouseButton:()=>M,isTVRemoteAxis:()=>Z,isTVRemoteButton:()=>Q,isTouchButton:()=>U,isTouchGesture:()=>$,isTouchPosition:()=>H,keyCodeToKeyboardInput:()=>C,keyboardInputToKeyCode:()=>v,parseInputDescriptor:()=>_,serializeInputDescriptor:()=>G});module.exports=ii(ri);var P=(g=>(g[g.Keyboard=0]="Keyboard",g[g.Mouse=1]="Mouse",g[g.Gamepad=2]="Gamepad",g[g.Touch=3]="Touch",g[g.TVRemote=4]="TVRemote",g[g.TextInput=5]="TextInput",g))(P||{});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 C(e){let r=w[e];return r!==void 0?r:null}n(C,"keyCodeToKeyboardInput");function v(e){return w[e]}n(v,"keyboardInputToKeyCode");var A=(x=>(x[x.LeftButton=0]="LeftButton",x[x.MiddleButton=1]="MiddleButton",x[x.RightButton=2]="RightButton",x[x.Button4=3]="Button4",x[x.Button5=4]="Button5",x[x.PositionX=100]="PositionX",x[x.PositionY=101]="PositionY",x[x.DeltaX=102]="DeltaX",x[x.DeltaY=103]="DeltaY",x[x.WheelDeltaY=104]="WheelDeltaY",x[x.WheelDeltaX=105]="WheelDeltaX",x))(A||{});function M(e){return e<100}n(M,"isMouseButton");function N(e){return e>=100}n(N,"isMouseAxis");var B=(c=>(c[c.ButtonA=0]="ButtonA",c[c.ButtonB=1]="ButtonB",c[c.ButtonX=2]="ButtonX",c[c.ButtonY=3]="ButtonY",c[c.LeftShoulder=4]="LeftShoulder",c[c.RightShoulder=5]="RightShoulder",c[c.LeftTrigger=6]="LeftTrigger",c[c.RightTrigger=7]="RightTrigger",c[c.Select=8]="Select",c[c.Start=9]="Start",c[c.LeftStick=10]="LeftStick",c[c.RightStick=11]="RightStick",c[c.DPadUp=12]="DPadUp",c[c.DPadDown=13]="DPadDown",c[c.DPadLeft=14]="DPadLeft",c[c.DPadRight=15]="DPadRight",c[c.Home=16]="Home",c[c.Touchpad=17]="Touchpad",c[c.LeftStickX=100]="LeftStickX",c[c.LeftStickY=101]="LeftStickY",c[c.RightStickX=102]="RightStickX",c[c.RightStickY=103]="RightStickY",c[c.LeftTriggerAxis=104]="LeftTriggerAxis",c[c.RightTriggerAxis=105]="RightTriggerAxis",c))(B||{});function a(e){return e<100}n(a,"isGamepadButton");function F(e){return e>=100}n(F,"isGamepadAxis");function u(e){return e>=0&&e<=19?e:null}n(u,"gamepadButtonIndexToInput");function q(e){return{0:100,1:101,2:102,3:103}[e]??null}n(q,"gamepadAxisIndexToInput");var S=(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))(S||{});function U(e){return e<100}n(U,"isTouchButton");function H(e){return e>=100&&e<200}n(H,"isTouchPosition");function $(e){return e>=200}n($,"isTouchGesture");function O(e){return e<0||e>9?null:100+e*2}n(O,"getTouchXAxis");function W(e){return e<0||e>9?null:101+e*2}n(W,"getTouchYAxis");var k=(t=>(t[t.DPadUp=0]="DPadUp",t[t.DPadDown=1]="DPadDown",t[t.DPadLeft=2]="DPadLeft",t[t.DPadRight=3]="DPadRight",t[t.DPadCenter=4]="DPadCenter",t[t.Play=5]="Play",t[t.Pause=6]="Pause",t[t.PlayPause=7]="PlayPause",t[t.Stop=8]="Stop",t[t.Rewind=9]="Rewind",t[t.FastForward=10]="FastForward",t[t.Previous=11]="Previous",t[t.Next=12]="Next",t[t.Record=13]="Record",t[t.VolumeUp=15]="VolumeUp",t[t.VolumeDown=16]="VolumeDown",t[t.Mute=17]="Mute",t[t.ChannelUp=18]="ChannelUp",t[t.ChannelDown=19]="ChannelDown",t[t.Back=20]="Back",t[t.Home=21]="Home",t[t.Menu=22]="Menu",t[t.Info=23]="Info",t[t.Guide=24]="Guide",t[t.Exit=25]="Exit",t[t.Red=30]="Red",t[t.Green=31]="Green",t[t.Yellow=32]="Yellow",t[t.Blue=33]="Blue",t[t.Digit0=40]="Digit0",t[t.Digit1=41]="Digit1",t[t.Digit2=42]="Digit2",t[t.Digit3=43]="Digit3",t[t.Digit4=44]="Digit4",t[t.Digit5=45]="Digit5",t[t.Digit6=46]="Digit6",t[t.Digit7=47]="Digit7",t[t.Digit8=48]="Digit8",t[t.Digit9=49]="Digit9",t[t.Input=50]="Input",t[t.Settings=51]="Settings",t[t.Subtitle=52]="Subtitle",t[t.Audio=53]="Audio",t[t.Power=54]="Power",t[t.PointerX=100]="PointerX",t[t.PointerY=101]="PointerY",t[t.GyroX=102]="GyroX",t[t.GyroY=103]="GyroY",t[t.GyroZ=104]="GyroZ",t))(k||{});function Q(e){return e<100}n(Q,"isTVRemoteButton");function Z(e){return e>=100}n(Z,"isTVRemoteAxis");function j(e,r){return{device:e,input:r}}n(j,"createInputDescriptor");function E(e){switch(e.device){case 0:return!0;case 1:return e.input<100;case 2:return e.input<100;case 3:return e.input<100;case 4:return e.input<100;default:return!1}}n(E,"isButton");function J(e){return!E(e)}n(J,"isAxis");function G(e){let r=new Uint8Array(3);return r[0]=e.device,r[1]=e.input&255,r[2]=e.input>>8&255,r}n(G,"serializeInputDescriptor");function V(e,r=0){let h=e[r],f=e[r+1]|e[r+2]<<8;return{device:h,input:f}}n(V,"deserializeInputDescriptor");function y(e){let r=P[e.device],h;switch(e.device){case 0:h=w[e.input];break;case 1:h=A[e.input];break;case 2:h=B[e.input];break;case 3:h=S[e.input];break;case 4:h=k[e.input];break;default:h="Unknown"}return`${r}:${h}`}n(y,"inputDescriptorToString");function _(e){let[r,h]=e.split(":");if(!r||!h)return null;let f=Object.entries(P).find(([m,g])=>m.toLowerCase()===r.toLowerCase()&&typeof g=="number")?.[1];if(f===void 0)return null;let D;switch(f){case 0:D=w[h];break;case 1:D=A[h];break;case 2:D=B[h];break;case 3:D=S[h];break;case 4:D=k[h];break}return D===void 0?null:{device:f,input:D}}n(_,"parseInputDescriptor");var l=class l{constructor(r=0,h=0){z(this,"x");z(this,"y");this.x=r,this.y=h}static zero(){return new l(0,0)}static one(){return new l(1,1)}static up(){return new l(0,-1)}static down(){return new l(0,1)}static left(){return new l(-1,0)}static right(){return new l(1,0)}add(r){return new l(this.x+r.x,this.y+r.y)}subtract(r){return new l(this.x-r.x,this.y-r.y)}multiply(r){return new l(this.x*r,this.y*r)}divide(r){if(r===0)throw new Error("Division by zero");return new l(this.x/r,this.y/r)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let r=this.length();return r===0?l.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y}cross(r){return this.x*r.y-this.y*r.x}angle(){return Math.atan2(this.y,this.x)}angleTo(r){return Math.atan2(r.y-this.y,r.x-this.x)}rotate(r){let h=Math.cos(r),f=Math.sin(r);return new l(this.x*h-this.y*f,this.x*f+this.y*h)}lerp(r,h){return new l(this.x+(r.x-this.x)*h,this.y+(r.y-this.y)*h)}clone(){return new l(this.x,this.y)}equals(r){return this.x===r.x&&this.y===r.y}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}set(r,h){return this.x=r,this.y=h,this}copy(r){return this.x=r.x,this.y=r.y,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0):(this.x/=r,this.y/=r),this}};n(l,"Vector2");var Y=l;var o=class o{constructor(r=0,h=0,f=0){z(this,"x");z(this,"y");z(this,"z");this.x=r,this.y=h,this.z=f}static zero(){return new o(0,0,0)}static one(){return new o(1,1,1)}static up(){return new o(0,1,0)}static down(){return new o(0,-1,0)}static left(){return new o(-1,0,0)}static right(){return new o(1,0,0)}static forward(){return new o(0,0,1)}static back(){return new o(0,0,-1)}add(r){return new o(this.x+r.x,this.y+r.y,this.z+r.z)}subtract(r){return new o(this.x-r.x,this.y-r.y,this.z-r.z)}multiply(r){return new o(this.x*r,this.y*r,this.z*r)}divide(r){if(r===0)throw new Error("Division by zero");return new o(this.x/r,this.y/r,this.z/r)}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 r=this.length();return r===0?o.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y+this.z*r.z}cross(r){return new o(this.y*r.z-this.z*r.y,this.z*r.x-this.x*r.z,this.x*r.y-this.y*r.x)}lerp(r,h){return new o(this.x+(r.x-this.x)*h,this.y+(r.y-this.y)*h,this.z+(r.z-this.z)*h)}clone(){return new o(this.x,this.y,this.z)}equals(r){return this.x===r.x&&this.y===r.y&&this.z===r.z}toString(){return`Vector3(${this.x}, ${this.y}, ${this.z})`}toArray(){return[this.x,this.y,this.z]}set(r,h,f){return this.x=r,this.y=h,this.z=f,this}copy(r){return this.x=r.x,this.y=r.y,this.z=r.z,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this.z-=r.z,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this.z*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this.z/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0,this.z=0):(this.x/=r,this.y/=r,this.z/=r),this}};n(o,"Vector3");var X=o;var T=(m=>(m[m.Disconnected=0]="Disconnected",m[m.Connecting=1]="Connecting",m[m.Connected=2]="Connected",m[m.Reconnecting=3]="Reconnecting",m[m.Error=4]="Error",m))(T||{});
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||{});
package/dist/index.d.ts CHANGED
@@ -810,6 +810,175 @@ interface IColorPalette {
810
810
  reset?(): void;
811
811
  }
812
812
 
813
+ /**
814
+ * Scaling modes for pixel-perfect rendering
815
+ *
816
+ * Use stricter modes (Integer) for crisp pixels, or looser modes (None)
817
+ * to fill more space at the cost of potential visual artifacts.
818
+ */
819
+ declare enum ScalingMode {
820
+ /**
821
+ * No constraints - scales to fill available space.
822
+ * May cause lines to appear thicker due to sub-pixel rendering.
823
+ * Best for maximizing screen usage.
824
+ */
825
+ None = "none",
826
+ /**
827
+ * Snaps to eighth increments (1.0, 1.125, 1.25, 1.375, ..., 2.0, ...).
828
+ * Finest control with good visual quality for 8×8 pixel cells.
829
+ */
830
+ Eighth = "eighth",
831
+ /**
832
+ * Snaps to quarter increments (1.0, 1.25, 1.5, 1.75, 2.0, ...).
833
+ * Good balance between space usage and visual quality.
834
+ */
835
+ Quarter = "quarter",
836
+ /**
837
+ * Snaps to half increments (1.0, 1.5, 2.0, 2.5, 3.0, ...).
838
+ * Moderate balance between space usage and visual quality.
839
+ */
840
+ Half = "half",
841
+ /**
842
+ * Integer scaling only (1x, 2x, 3x, ...).
843
+ * Crisp pixels with no sub-pixel artifacts.
844
+ * May leave empty space around the canvas.
845
+ */
846
+ Integer = "integer"
847
+ }
848
+ /**
849
+ * Numeric values for ScalingMode (for binary protocol)
850
+ * These map 1:1 with ScalingMode enum values
851
+ */
852
+ declare enum ScalingModeValue {
853
+ None = 0,
854
+ Eighth = 1,
855
+ Quarter = 2,
856
+ Half = 3,
857
+ Integer = 4
858
+ }
859
+ /**
860
+ * Convert ScalingMode string enum to numeric ScalingModeValue
861
+ * Used by encoders to convert API values to binary protocol
862
+ */
863
+ declare function scalingModeToValue(mode: ScalingMode): ScalingModeValue;
864
+ /**
865
+ * Convert numeric ScalingModeValue to ScalingMode string enum
866
+ * Used by decoders to convert binary protocol to API values
867
+ */
868
+ declare function valueToScalingMode(value: ScalingModeValue): ScalingMode;
869
+
870
+ /**
871
+ * Post-processing types
872
+ * @packageDocumentation
873
+ */
874
+ /**
875
+ * Default values for post-processing effects.
876
+ * Use these to ensure consistency across the codebase.
877
+ */
878
+ declare const POST_PROCESS_DEFAULTS: {
879
+ readonly scanlines: {
880
+ readonly opacity: 0.15;
881
+ readonly pattern: "horizontal";
882
+ readonly spacing: 2;
883
+ readonly thickness: 1;
884
+ readonly color: {
885
+ readonly r: 0;
886
+ readonly g: 0;
887
+ readonly b: 0;
888
+ };
889
+ };
890
+ readonly ambientEffect: {
891
+ readonly blur: 30;
892
+ readonly scale: 1.3;
893
+ readonly opacity: 0.7;
894
+ };
895
+ };
896
+ /**
897
+ * Scanlines effect configuration
898
+ */
899
+ interface ScanlinesConfig {
900
+ /** Enable/disable scanlines effect */
901
+ enabled: boolean;
902
+ /** Opacity of dark lines (0-1, default 0.15) */
903
+ opacity?: number;
904
+ /**
905
+ * Pattern type:
906
+ * - 'horizontal': 1px dark line every N rows (classic CRT)
907
+ * - 'vertical': 1px dark line every N columns
908
+ * - 'grid': Combines horizontal and vertical
909
+ */
910
+ pattern?: 'horizontal' | 'vertical' | 'grid';
911
+ /** Line spacing in pixels (default: 2 = line every 2 pixels) */
912
+ spacing?: number;
913
+ /** Line thickness in pixels (default: 1) */
914
+ thickness?: number;
915
+ /** Dark line color RGB (default: black {r:0, g:0, b:0}) */
916
+ color?: {
917
+ r: number;
918
+ g: number;
919
+ b: number;
920
+ };
921
+ }
922
+ /**
923
+ * Ambient effect configuration
924
+ * Creates a blurred glow around the terminal canvas
925
+ */
926
+ interface AmbientEffectConfig {
927
+ /** Enable/disable ambient effect */
928
+ enabled: boolean;
929
+ /** Blur intensity in pixels (default: 30) */
930
+ blur?: number;
931
+ /** Scale factor for the glow (default: 1.3) */
932
+ scale?: number;
933
+ /** Opacity of the ambient effect (default: 0.7) */
934
+ opacity?: number;
935
+ }
936
+ /**
937
+ * Post-processing configuration
938
+ * Sent from Core/User to renderer via commands
939
+ */
940
+ interface PostProcessConfig {
941
+ /** Scanlines effect (CRT-style) */
942
+ scanlines?: ScanlinesConfig;
943
+ /** Ambient effect (blurred glow around terminal) */
944
+ ambientEffect?: AmbientEffectConfig;
945
+ }
946
+ /**
947
+ * Debug grid configuration
948
+ */
949
+ interface GridConfig {
950
+ /** Enable or disable grid overlay */
951
+ enabled: boolean;
952
+ /** Grid line color (CSS color string, e.g., 'rgba(255,0,0,0.5)') */
953
+ color?: string;
954
+ /** Grid line width in pixels (default: 1) */
955
+ lineWidth?: number;
956
+ }
957
+ /**
958
+ * Default grid configuration values
959
+ */
960
+ declare const GRID_DEFAULTS: {
961
+ readonly color: "rgba(144, 24, 24, 1)";
962
+ readonly lineWidth: 1;
963
+ };
964
+ /**
965
+ * Post-process command types
966
+ */
967
+ type PostProcessCommandType = 'set-config' | 'set-scanlines-enabled' | 'set-scanlines-opacity' | 'set-ambient-effect-enabled' | 'set-ambient-effect-blur' | 'set-ambient-effect-scale' | 'set-scaling-mode' | 'set-grid';
968
+ /**
969
+ * Command to update post-processing settings
970
+ */
971
+ interface PostProcessCommand {
972
+ type: PostProcessCommandType;
973
+ config?: PostProcessConfig;
974
+ enabled?: boolean;
975
+ opacity?: number;
976
+ blur?: number;
977
+ scale?: number;
978
+ scalingMode?: ScalingMode;
979
+ gridConfig?: GridConfig;
980
+ }
981
+
813
982
  /**
814
983
  * Network client interface for client-to-server communication
815
984
  * Implementations: Socket.IO, WebRTC, WebSocket, etc.
@@ -1605,5 +1774,5 @@ interface UserMetadata {
1605
1774
  [key: string]: unknown;
1606
1775
  }
1607
1776
 
1608
- export { GamepadInput, InputDeviceType, KeyboardInput, MouseInput, NetworkState, 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, serializeInputDescriptor };
1609
- export type { AnyNetworkMessage, AnySoundLoadPacket, AudioAck, AudioAckBase, AudioAckHandler, AudioAckType, AudioConfigCommand, AudioPlayOptions, AudioPlayResult, AudioSpatialOptions, AxisBinding, AxisSource, ButtonBinding, ButtonSource, ChatMessage, ClientInfo, ConfigureSpatialCommand, ConnectionHandler, DisconnectionHandler, ErrorMessage, FadeOutSoundCommand, GamepadInputDescriptor, 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, RGBColor, RenderState, RenderedCell, ResumeSoundCommand, ServerEventHandler, SetListenerPositionCommand, SetSoundEffectsCommand, SoundErrorAck, SoundExternalEntry, SoundExternalLoadPacket, SoundFileEntry, SoundFormat, SoundInstanceId, SoundLoadPacket, SoundLoadType, SoundLoadedAck, SpatialAudioConfig, StopSoundCommand, TVRemoteInputDescriptor, TouchInputDescriptor, TypedInputDescriptor, UpdateMessage, UserMetadata, UserRenderState };
1777
+ 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 };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var X=Object.defineProperty;var C=(e,r,h)=>r in e?X(e,r,{enumerable:!0,configurable:!0,writable:!0,value:h}):e[r]=h;var n=(e,r)=>X(e,"name",{value:r,configurable:!0});var w=(e,r,h)=>(C(e,typeof r!="symbol"?r+"":r,h),h);var P=(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))(P||{});var z=(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))(z||{});function v(e){let r=z[e];return r!==void 0?r:null}n(v,"keyCodeToKeyboardInput");function M(e){return z[e]}n(M,"keyboardInputToKeyCode");var A=(x=>(x[x.LeftButton=0]="LeftButton",x[x.MiddleButton=1]="MiddleButton",x[x.RightButton=2]="RightButton",x[x.Button4=3]="Button4",x[x.Button5=4]="Button5",x[x.PositionX=100]="PositionX",x[x.PositionY=101]="PositionY",x[x.DeltaX=102]="DeltaX",x[x.DeltaY=103]="DeltaY",x[x.WheelDeltaY=104]="WheelDeltaY",x[x.WheelDeltaX=105]="WheelDeltaX",x))(A||{});function N(e){return e<100}n(N,"isMouseButton");function a(e){return e>=100}n(a,"isMouseAxis");var B=(c=>(c[c.ButtonA=0]="ButtonA",c[c.ButtonB=1]="ButtonB",c[c.ButtonX=2]="ButtonX",c[c.ButtonY=3]="ButtonY",c[c.LeftShoulder=4]="LeftShoulder",c[c.RightShoulder=5]="RightShoulder",c[c.LeftTrigger=6]="LeftTrigger",c[c.RightTrigger=7]="RightTrigger",c[c.Select=8]="Select",c[c.Start=9]="Start",c[c.LeftStick=10]="LeftStick",c[c.RightStick=11]="RightStick",c[c.DPadUp=12]="DPadUp",c[c.DPadDown=13]="DPadDown",c[c.DPadLeft=14]="DPadLeft",c[c.DPadRight=15]="DPadRight",c[c.Home=16]="Home",c[c.Touchpad=17]="Touchpad",c[c.LeftStickX=100]="LeftStickX",c[c.LeftStickY=101]="LeftStickY",c[c.RightStickX=102]="RightStickX",c[c.RightStickY=103]="RightStickY",c[c.LeftTriggerAxis=104]="LeftTriggerAxis",c[c.RightTriggerAxis=105]="RightTriggerAxis",c))(B||{});function F(e){return e<100}n(F,"isGamepadButton");function u(e){return e>=100}n(u,"isGamepadAxis");function q(e){return e>=0&&e<=19?e:null}n(q,"gamepadButtonIndexToInput");function U(e){return{0:100,1:101,2:102,3:103}[e]??null}n(U,"gamepadAxisIndexToInput");var S=(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))(S||{});function H(e){return e<100}n(H,"isTouchButton");function $(e){return e>=100&&e<200}n($,"isTouchPosition");function O(e){return e>=200}n(O,"isTouchGesture");function W(e){return e<0||e>9?null:100+e*2}n(W,"getTouchXAxis");function Q(e){return e<0||e>9?null:101+e*2}n(Q,"getTouchYAxis");var k=(t=>(t[t.DPadUp=0]="DPadUp",t[t.DPadDown=1]="DPadDown",t[t.DPadLeft=2]="DPadLeft",t[t.DPadRight=3]="DPadRight",t[t.DPadCenter=4]="DPadCenter",t[t.Play=5]="Play",t[t.Pause=6]="Pause",t[t.PlayPause=7]="PlayPause",t[t.Stop=8]="Stop",t[t.Rewind=9]="Rewind",t[t.FastForward=10]="FastForward",t[t.Previous=11]="Previous",t[t.Next=12]="Next",t[t.Record=13]="Record",t[t.VolumeUp=15]="VolumeUp",t[t.VolumeDown=16]="VolumeDown",t[t.Mute=17]="Mute",t[t.ChannelUp=18]="ChannelUp",t[t.ChannelDown=19]="ChannelDown",t[t.Back=20]="Back",t[t.Home=21]="Home",t[t.Menu=22]="Menu",t[t.Info=23]="Info",t[t.Guide=24]="Guide",t[t.Exit=25]="Exit",t[t.Red=30]="Red",t[t.Green=31]="Green",t[t.Yellow=32]="Yellow",t[t.Blue=33]="Blue",t[t.Digit0=40]="Digit0",t[t.Digit1=41]="Digit1",t[t.Digit2=42]="Digit2",t[t.Digit3=43]="Digit3",t[t.Digit4=44]="Digit4",t[t.Digit5=45]="Digit5",t[t.Digit6=46]="Digit6",t[t.Digit7=47]="Digit7",t[t.Digit8=48]="Digit8",t[t.Digit9=49]="Digit9",t[t.Input=50]="Input",t[t.Settings=51]="Settings",t[t.Subtitle=52]="Subtitle",t[t.Audio=53]="Audio",t[t.Power=54]="Power",t[t.PointerX=100]="PointerX",t[t.PointerY=101]="PointerY",t[t.GyroX=102]="GyroX",t[t.GyroY=103]="GyroY",t[t.GyroZ=104]="GyroZ",t))(k||{});function Z(e){return e<100}n(Z,"isTVRemoteButton");function j(e){return e>=100}n(j,"isTVRemoteAxis");function J(e,r){return{device:e,input:r}}n(J,"createInputDescriptor");function E(e){switch(e.device){case 0:return!0;case 1:return e.input<100;case 2:return e.input<100;case 3:return e.input<100;case 4:return e.input<100;default:return!1}}n(E,"isButton");function G(e){return!E(e)}n(G,"isAxis");function V(e){let r=new Uint8Array(3);return r[0]=e.device,r[1]=e.input&255,r[2]=e.input>>8&255,r}n(V,"serializeInputDescriptor");function y(e,r=0){let h=e[r],g=e[r+1]|e[r+2]<<8;return{device:h,input:g}}n(y,"deserializeInputDescriptor");function _(e){let r=P[e.device],h;switch(e.device){case 0:h=z[e.input];break;case 1:h=A[e.input];break;case 2:h=B[e.input];break;case 3:h=S[e.input];break;case 4:h=k[e.input];break;default:h="Unknown"}return`${r}:${h}`}n(_,"inputDescriptorToString");function T(e){let[r,h]=e.split(":");if(!r||!h)return null;let g=Object.entries(P).find(([D,f])=>D.toLowerCase()===r.toLowerCase()&&typeof f=="number")?.[1];if(g===void 0)return null;let m;switch(g){case 0:m=z[h];break;case 1:m=A[h];break;case 2:m=B[h];break;case 3:m=S[h];break;case 4:m=k[h];break}return m===void 0?null:{device:g,input:m}}n(T,"parseInputDescriptor");var l=class l{constructor(r=0,h=0){w(this,"x");w(this,"y");this.x=r,this.y=h}static zero(){return new l(0,0)}static one(){return new l(1,1)}static up(){return new l(0,-1)}static down(){return new l(0,1)}static left(){return new l(-1,0)}static right(){return new l(1,0)}add(r){return new l(this.x+r.x,this.y+r.y)}subtract(r){return new l(this.x-r.x,this.y-r.y)}multiply(r){return new l(this.x*r,this.y*r)}divide(r){if(r===0)throw new Error("Division by zero");return new l(this.x/r,this.y/r)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let r=this.length();return r===0?l.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y}cross(r){return this.x*r.y-this.y*r.x}angle(){return Math.atan2(this.y,this.x)}angleTo(r){return Math.atan2(r.y-this.y,r.x-this.x)}rotate(r){let h=Math.cos(r),g=Math.sin(r);return new l(this.x*h-this.y*g,this.x*g+this.y*h)}lerp(r,h){return new l(this.x+(r.x-this.x)*h,this.y+(r.y-this.y)*h)}clone(){return new l(this.x,this.y)}equals(r){return this.x===r.x&&this.y===r.y}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}set(r,h){return this.x=r,this.y=h,this}copy(r){return this.x=r.x,this.y=r.y,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0):(this.x/=r,this.y/=r),this}};n(l,"Vector2");var L=l;var o=class o{constructor(r=0,h=0,g=0){w(this,"x");w(this,"y");w(this,"z");this.x=r,this.y=h,this.z=g}static zero(){return new o(0,0,0)}static one(){return new o(1,1,1)}static up(){return new o(0,1,0)}static down(){return new o(0,-1,0)}static left(){return new o(-1,0,0)}static right(){return new o(1,0,0)}static forward(){return new o(0,0,1)}static back(){return new o(0,0,-1)}add(r){return new o(this.x+r.x,this.y+r.y,this.z+r.z)}subtract(r){return new o(this.x-r.x,this.y-r.y,this.z-r.z)}multiply(r){return new o(this.x*r,this.y*r,this.z*r)}divide(r){if(r===0)throw new Error("Division by zero");return new o(this.x/r,this.y/r,this.z/r)}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 r=this.length();return r===0?o.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y+this.z*r.z}cross(r){return new o(this.y*r.z-this.z*r.y,this.z*r.x-this.x*r.z,this.x*r.y-this.y*r.x)}lerp(r,h){return new o(this.x+(r.x-this.x)*h,this.y+(r.y-this.y)*h,this.z+(r.z-this.z)*h)}clone(){return new o(this.x,this.y,this.z)}equals(r){return this.x===r.x&&this.y===r.y&&this.z===r.z}toString(){return`Vector3(${this.x}, ${this.y}, ${this.z})`}toArray(){return[this.x,this.y,this.z]}set(r,h,g){return this.x=r,this.y=h,this.z=g,this}copy(r){return this.x=r.x,this.y=r.y,this.z=r.z,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this.z-=r.z,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this.z*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this.z/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0,this.z=0):(this.x/=r,this.y/=r,this.z/=r),this}};n(o,"Vector3");var Y=o;var R=(D=>(D[D.Disconnected=0]="Disconnected",D[D.Connecting=1]="Connecting",D[D.Connected=2]="Connected",D[D.Reconnecting=3]="Reconnecting",D[D.Error=4]="Error",D))(R||{});export{B as GamepadInput,P as InputDeviceType,z as KeyboardInput,A as MouseInput,R as NetworkState,k as TVRemoteInput,S as TouchInput,L as Vector2,Y as Vector3,J as createInputDescriptor,y as deserializeInputDescriptor,U as gamepadAxisIndexToInput,q as gamepadButtonIndexToInput,W as getTouchXAxis,Q as getTouchYAxis,_ as inputDescriptorToString,G as isAxis,E as isButton,u as isGamepadAxis,F as isGamepadButton,a as isMouseAxis,N as isMouseButton,j as isTVRemoteAxis,Z as isTVRemoteButton,H as isTouchButton,O as isTouchGesture,$ as isTouchPosition,v as keyCodeToKeyboardInput,M as keyboardInputToKeyCode,T as parseInputDescriptor,V as serializeInputDescriptor};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utsp/types",
3
- "version": "0.7.0-nightly.20251207021518.b0c5521",
3
+ "version": "0.7.0-nightly.20251208110725.8dda911",
4
4
  "description": "Type definitions and interfaces for UTSP (Universal Text Stream Protocol)",
5
5
  "author": "THP Software",
6
6
  "license": "MIT",