@omnipad/core 0.4.3 → 0.4.5
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/chunk-4J2ZANLB.cjs +1 -0
- package/dist/chunk-W7OR5ESR.mjs +1 -0
- package/dist/{index-DlGCSMP1.d.cts → index-CT1fDlB9.d.cts} +39 -14
- package/dist/{index-DlGCSMP1.d.ts → index-CT1fDlB9.d.ts} +39 -14
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +105 -22
- package/dist/index.d.ts +105 -22
- package/dist/index.mjs +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.cts +36 -2
- package/dist/utils/index.d.ts +36 -2
- package/dist/utils/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-MSERY5BP.mjs +0 -1
- package/dist/chunk-PAGWIRTX.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var x=Object.defineProperty;var f=(t,e,o)=>e in t?x(t,e,{enumerable:true,configurable:true,writable:true,value:o}):t[e]=o;var m=(t,e,o)=>f(t,typeof e!="symbol"?e+"":e,o);var E={Backspace:{key:"Backspace",code:"Backspace",keyCode:8},Tab:{key:"Tab",code:"Tab",keyCode:9},Enter:{key:"Enter",code:"Enter",keyCode:13},ShiftLeft:{key:"Shift",code:"ShiftLeft",keyCode:16},ControlLeft:{key:"Control",code:"ControlLeft",keyCode:17},AltLeft:{key:"Alt",code:"AltLeft",keyCode:18},Pause:{key:"Pause",code:"Pause",keyCode:19},CapsLock:{key:"CapsLock",code:"CapsLock",keyCode:20},Escape:{key:"Escape",code:"Escape",keyCode:27},Space:{key:" ",code:"Space",keyCode:32},PageUp:{key:"PageUp",code:"PageUp",keyCode:33},PageDown:{key:"PageDown",code:"PageDown",keyCode:34},End:{key:"End",code:"End",keyCode:35},Home:{key:"Home",code:"Home",keyCode:36},ArrowLeft:{key:"ArrowLeft",code:"ArrowLeft",keyCode:37},ArrowUp:{key:"ArrowUp",code:"ArrowUp",keyCode:38},ArrowRight:{key:"ArrowRight",code:"ArrowRight",keyCode:39},ArrowDown:{key:"ArrowDown",code:"ArrowDown",keyCode:40},PrintScreen:{key:"PrintScreen",code:"PrintScreen",keyCode:44},Insert:{key:"Insert",code:"Insert",keyCode:45},Delete:{key:"Delete",code:"Delete",keyCode:46},Digit0:{key:"0",code:"Digit0",keyCode:48},Digit1:{key:"1",code:"Digit1",keyCode:49},Digit2:{key:"2",code:"Digit2",keyCode:50},Digit3:{key:"3",code:"Digit3",keyCode:51},Digit4:{key:"4",code:"Digit4",keyCode:52},Digit5:{key:"5",code:"Digit5",keyCode:53},Digit6:{key:"6",code:"Digit6",keyCode:54},Digit7:{key:"7",code:"Digit7",keyCode:55},Digit8:{key:"8",code:"Digit8",keyCode:56},Digit9:{key:"9",code:"Digit9",keyCode:57},KeyA:{key:"a",code:"KeyA",keyCode:65},KeyB:{key:"b",code:"KeyB",keyCode:66},KeyC:{key:"c",code:"KeyC",keyCode:67},KeyD:{key:"d",code:"KeyD",keyCode:68},KeyE:{key:"e",code:"KeyE",keyCode:69},KeyF:{key:"f",code:"KeyF",keyCode:70},KeyG:{key:"g",code:"KeyG",keyCode:71},KeyH:{key:"h",code:"KeyH",keyCode:72},KeyI:{key:"i",code:"KeyI",keyCode:73},KeyJ:{key:"j",code:"KeyJ",keyCode:74},KeyK:{key:"k",code:"KeyK",keyCode:75},KeyL:{key:"l",code:"KeyL",keyCode:76},KeyM:{key:"m",code:"KeyM",keyCode:77},KeyN:{key:"n",code:"KeyN",keyCode:78},KeyO:{key:"o",code:"KeyO",keyCode:79},KeyP:{key:"p",code:"KeyP",keyCode:80},KeyQ:{key:"q",code:"KeyQ",keyCode:81},KeyR:{key:"r",code:"KeyR",keyCode:82},KeyS:{key:"s",code:"KeyS",keyCode:83},KeyT:{key:"t",code:"KeyT",keyCode:84},KeyU:{key:"u",code:"KeyU",keyCode:85},KeyV:{key:"v",code:"KeyV",keyCode:86},KeyW:{key:"w",code:"KeyW",keyCode:87},KeyX:{key:"x",code:"KeyX",keyCode:88},KeyY:{key:"y",code:"KeyY",keyCode:89},KeyZ:{key:"z",code:"KeyZ",keyCode:90},MetaLeft:{key:"Meta",code:"MetaLeft",keyCode:91},ContextMenu:{key:"ContextMenu",code:"ContextMenu",keyCode:93},Numpad0:{key:"0",code:"Numpad0",keyCode:96},Numpad1:{key:"1",code:"Numpad1",keyCode:97},Numpad2:{key:"2",code:"Numpad2",keyCode:98},Numpad3:{key:"3",code:"Numpad3",keyCode:99},Numpad4:{key:"4",code:"Numpad4",keyCode:100},Numpad5:{key:"5",code:"Numpad5",keyCode:101},Numpad6:{key:"6",code:"Numpad6",keyCode:102},Numpad7:{key:"7",code:"Numpad7",keyCode:103},Numpad8:{key:"8",code:"Numpad8",keyCode:104},Numpad9:{key:"9",code:"Numpad9",keyCode:105},NumpadMultiply:{key:"*",code:"NumpadMultiply",keyCode:106},NumpadAdd:{key:"+",code:"NumpadAdd",keyCode:107},NumpadSubtract:{key:"-",code:"NumpadSubtract",keyCode:109},NumpadDecimal:{key:".",code:"NumpadDecimal",keyCode:110},NumpadDivide:{key:"/",code:"NumpadDivide",keyCode:111},F1:{key:"F1",code:"F1",keyCode:112},F2:{key:"F2",code:"F2",keyCode:113},F3:{key:"F3",code:"F3",keyCode:114},F4:{key:"F4",code:"F4",keyCode:115},F5:{key:"F5",code:"F5",keyCode:116},F6:{key:"F6",code:"F6",keyCode:117},F7:{key:"F7",code:"F7",keyCode:118},F8:{key:"F8",code:"F8",keyCode:119},F9:{key:"F9",code:"F9",keyCode:120},F10:{key:"F10",code:"F10",keyCode:121},F11:{key:"F11",code:"F11",keyCode:122},F12:{key:"F12",code:"F12",keyCode:123},NumLock:{key:"NumLock",code:"NumLock",keyCode:144},ScrollLock:{key:"ScrollLock",code:"ScrollLock",keyCode:145},Semicolon:{key:";",code:"Semicolon",keyCode:186},Equal:{key:"=",code:"Equal",keyCode:187},Comma:{key:",",code:"Comma",keyCode:188},Minus:{key:"-",code:"Minus",keyCode:189},Period:{key:".",code:"Period",keyCode:190},Slash:{key:"/",code:"Slash",keyCode:191},Backquote:{key:"`",code:"Backquote",keyCode:192},BracketLeft:{key:"[",code:"BracketLeft",keyCode:219},Backslash:{key:"\\",code:"Backslash",keyCode:220},BracketRight:{key:"]",code:"BracketRight",keyCode:221},Quote:{key:"'",code:"Quote",keyCode:222}},P=E;var A={INPUT_ZONE:"input-zone",TARGET_ZONE:"target-zone",BUTTON:"button",KEYBOARD_BUTTON:"keyboard-button",MOUSE_BUTTON:"mouse-button",JOYSTICK:"joystick",D_PAD:"d-pad",TRACKPAD:"trackpad",VIRTUAL_CURSOR:"virtual-cursor",ROOT_LAYER:"root-layer"},D={KEYDOWN:"keydown",KEYUP:"keyup",POINTER:"pointer",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",MOUSE:"mouse",MOUSEMOVE:"mousemove",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",CLICK:"click"},I=["px","%","vh","vw","rem","em"],M={PARENT_ID_KEY:"omnipad-parent-id-link"};var k=Symbol.for("omnipad.registry.instance"),s=null;function _(t){s=t;}var C=class t{constructor(){m(this,"entities",new Map);undefined?.DEV&&console.log("[OmniPad-Core] Registry initialized.");}static getInstance(){let e=globalThis;return e[k]||(e[k]=new t),e[k]}register(e){if(!e.uid){console.warn("[OmniPad-Core] Registry: Attempted to register entity without UID.",e);return}this.entities.has(e.uid),this.entities.set(e.uid,e);}unregister(e){this.entities.has(e)&&this.entities.delete(e);}getEntity(e){return this.entities.get(e)}getAllEntities(){return Array.from(this.entities.values())}getEntitiesByRoot(e){let o=this.getAllEntities();if(!e)return o;if(!this.entities.get(e))return console.warn(`[OmniPad-Core] Registry: Root entity ${e} not found.`),[];let r=new Map;o.forEach(d=>{let a=d;if(typeof a.getConfig=="function"){let i=a.getConfig();i.parentId&&(r.has(i.parentId)||r.set(i.parentId,[]),r.get(i.parentId).push(d));}});let y=[],c=[e],u=new Set;for(;c.length>0;){let d=c.shift();if(u.has(d))continue;u.add(d);let a=this.entities.get(d);if(a){y.push(a);let i=r.get(d);i&&i.forEach(b=>c.push(b.uid));}}return y}destroyByRoot(e){let o=this.getEntitiesByRoot(e);for(let n=o.length-1;n>=0;n--){let r=o[n];try{r.destroy();}catch(y){console.error(`[OmniPad-Core] Error during destroyByRoot at ${r.uid}:`,y);}}}clear(){this.entities.clear();}resetAll(){this.entities.forEach(e=>{"reset"in e&&e.reset();});}markAllRectDirty(){this.entities.forEach(e=>{"markRectDirty"in e&&e.markRectDirty();});}broadcastSignal(e){let o=this.getEntity(e.targetStageId);o&&"handleSignal"in o?o.handleSignal(e):s&&s(e);}};var B=(t,e)=>({x:t.x-e.x,y:t.y-e.y}),v=(t,e)=>({x:t.x+e.x,y:t.y+e.y}),h=(t,e)=>({x:t.x*e,y:t.y*e}),l=(t,e,o)=>Math.max(e,Math.min(o,t)),T=(t,e,o)=>t+(e-t)*o,g=(t,e=2)=>{let o=Math.pow(10,e);return Math.round(t*o)/o},z=(t,e)=>Math.hypot(e.x-t.x,e.y-t.y),Z=(t,e)=>Math.atan2(e.y-t.y,e.x-t.x),q=t=>t*180/Math.PI,G=t=>t*Math.PI/180,H=(t,e,o)=>{let n=e.x-t.x,r=e.y-t.y;if(Math.hypot(n,r)<=o)return e;let c=Math.atan2(r,n);return {x:t.x+Math.cos(c)*o,y:t.y+Math.sin(c)*o}},W=t=>{let e=Math.PI/4;return Math.round(t/e)*e},J=t=>{let e=Math.PI/2;return Math.round(t/e)*e},Q=(t,e)=>g(t*e/100),X=(t,e)=>e===0?0:g(t*100/e),j=t=>{let e=Math.hypot(t.x,t.y);return e===0?{x:0,y:0}:{x:t.x/e,y:t.y/e}},$=t=>({x:Math.cos(t),y:Math.sin(t)}),ee=(t,e,o,n,r)=>{let y=(t-e)/(o-e);return T(n,r,l(y,0,1))},te=(t,e,o=1e-4)=>Math.abs(t.x-e.x)<o&&Math.abs(t.y-e.y)<o,p=(t,e,o)=>{if(t<e)return 0;let n=(t-e)/(o-e);return l(n,0,1)},oe=(t,e,o)=>{let n=Math.hypot(t.x,t.y),r=e*o,y=p(n,r,e);if(y===0)return {x:0,y:0};let c={x:t.x/n,y:t.y/n};return h(c,y)},ne=(t,e,o)=>({x:p(Math.abs(t.x),e,o)*Math.sign(t.x),y:p(Math.abs(t.y),e,o)*Math.sign(t.y)});exports.A=te;exports.B=p;exports.C=oe;exports.D=ne;exports.a=m;exports.b=P;exports.c=A;exports.d=D;exports.e=I;exports.f=M;exports.g=_;exports.h=C;exports.i=B;exports.j=v;exports.k=h;exports.l=l;exports.m=T;exports.n=g;exports.o=z;exports.p=Z;exports.q=q;exports.r=G;exports.s=H;exports.t=W;exports.u=J;exports.v=Q;exports.w=X;exports.x=j;exports.y=$;exports.z=ee;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var x=Object.defineProperty;var f=(t,e,o)=>e in t?x(t,e,{enumerable:true,configurable:true,writable:true,value:o}):t[e]=o;var m=(t,e,o)=>f(t,typeof e!="symbol"?e+"":e,o);var E={Backspace:{key:"Backspace",code:"Backspace",keyCode:8},Tab:{key:"Tab",code:"Tab",keyCode:9},Enter:{key:"Enter",code:"Enter",keyCode:13},ShiftLeft:{key:"Shift",code:"ShiftLeft",keyCode:16},ControlLeft:{key:"Control",code:"ControlLeft",keyCode:17},AltLeft:{key:"Alt",code:"AltLeft",keyCode:18},Pause:{key:"Pause",code:"Pause",keyCode:19},CapsLock:{key:"CapsLock",code:"CapsLock",keyCode:20},Escape:{key:"Escape",code:"Escape",keyCode:27},Space:{key:" ",code:"Space",keyCode:32},PageUp:{key:"PageUp",code:"PageUp",keyCode:33},PageDown:{key:"PageDown",code:"PageDown",keyCode:34},End:{key:"End",code:"End",keyCode:35},Home:{key:"Home",code:"Home",keyCode:36},ArrowLeft:{key:"ArrowLeft",code:"ArrowLeft",keyCode:37},ArrowUp:{key:"ArrowUp",code:"ArrowUp",keyCode:38},ArrowRight:{key:"ArrowRight",code:"ArrowRight",keyCode:39},ArrowDown:{key:"ArrowDown",code:"ArrowDown",keyCode:40},PrintScreen:{key:"PrintScreen",code:"PrintScreen",keyCode:44},Insert:{key:"Insert",code:"Insert",keyCode:45},Delete:{key:"Delete",code:"Delete",keyCode:46},Digit0:{key:"0",code:"Digit0",keyCode:48},Digit1:{key:"1",code:"Digit1",keyCode:49},Digit2:{key:"2",code:"Digit2",keyCode:50},Digit3:{key:"3",code:"Digit3",keyCode:51},Digit4:{key:"4",code:"Digit4",keyCode:52},Digit5:{key:"5",code:"Digit5",keyCode:53},Digit6:{key:"6",code:"Digit6",keyCode:54},Digit7:{key:"7",code:"Digit7",keyCode:55},Digit8:{key:"8",code:"Digit8",keyCode:56},Digit9:{key:"9",code:"Digit9",keyCode:57},KeyA:{key:"a",code:"KeyA",keyCode:65},KeyB:{key:"b",code:"KeyB",keyCode:66},KeyC:{key:"c",code:"KeyC",keyCode:67},KeyD:{key:"d",code:"KeyD",keyCode:68},KeyE:{key:"e",code:"KeyE",keyCode:69},KeyF:{key:"f",code:"KeyF",keyCode:70},KeyG:{key:"g",code:"KeyG",keyCode:71},KeyH:{key:"h",code:"KeyH",keyCode:72},KeyI:{key:"i",code:"KeyI",keyCode:73},KeyJ:{key:"j",code:"KeyJ",keyCode:74},KeyK:{key:"k",code:"KeyK",keyCode:75},KeyL:{key:"l",code:"KeyL",keyCode:76},KeyM:{key:"m",code:"KeyM",keyCode:77},KeyN:{key:"n",code:"KeyN",keyCode:78},KeyO:{key:"o",code:"KeyO",keyCode:79},KeyP:{key:"p",code:"KeyP",keyCode:80},KeyQ:{key:"q",code:"KeyQ",keyCode:81},KeyR:{key:"r",code:"KeyR",keyCode:82},KeyS:{key:"s",code:"KeyS",keyCode:83},KeyT:{key:"t",code:"KeyT",keyCode:84},KeyU:{key:"u",code:"KeyU",keyCode:85},KeyV:{key:"v",code:"KeyV",keyCode:86},KeyW:{key:"w",code:"KeyW",keyCode:87},KeyX:{key:"x",code:"KeyX",keyCode:88},KeyY:{key:"y",code:"KeyY",keyCode:89},KeyZ:{key:"z",code:"KeyZ",keyCode:90},MetaLeft:{key:"Meta",code:"MetaLeft",keyCode:91},ContextMenu:{key:"ContextMenu",code:"ContextMenu",keyCode:93},Numpad0:{key:"0",code:"Numpad0",keyCode:96},Numpad1:{key:"1",code:"Numpad1",keyCode:97},Numpad2:{key:"2",code:"Numpad2",keyCode:98},Numpad3:{key:"3",code:"Numpad3",keyCode:99},Numpad4:{key:"4",code:"Numpad4",keyCode:100},Numpad5:{key:"5",code:"Numpad5",keyCode:101},Numpad6:{key:"6",code:"Numpad6",keyCode:102},Numpad7:{key:"7",code:"Numpad7",keyCode:103},Numpad8:{key:"8",code:"Numpad8",keyCode:104},Numpad9:{key:"9",code:"Numpad9",keyCode:105},NumpadMultiply:{key:"*",code:"NumpadMultiply",keyCode:106},NumpadAdd:{key:"+",code:"NumpadAdd",keyCode:107},NumpadSubtract:{key:"-",code:"NumpadSubtract",keyCode:109},NumpadDecimal:{key:".",code:"NumpadDecimal",keyCode:110},NumpadDivide:{key:"/",code:"NumpadDivide",keyCode:111},F1:{key:"F1",code:"F1",keyCode:112},F2:{key:"F2",code:"F2",keyCode:113},F3:{key:"F3",code:"F3",keyCode:114},F4:{key:"F4",code:"F4",keyCode:115},F5:{key:"F5",code:"F5",keyCode:116},F6:{key:"F6",code:"F6",keyCode:117},F7:{key:"F7",code:"F7",keyCode:118},F8:{key:"F8",code:"F8",keyCode:119},F9:{key:"F9",code:"F9",keyCode:120},F10:{key:"F10",code:"F10",keyCode:121},F11:{key:"F11",code:"F11",keyCode:122},F12:{key:"F12",code:"F12",keyCode:123},NumLock:{key:"NumLock",code:"NumLock",keyCode:144},ScrollLock:{key:"ScrollLock",code:"ScrollLock",keyCode:145},Semicolon:{key:";",code:"Semicolon",keyCode:186},Equal:{key:"=",code:"Equal",keyCode:187},Comma:{key:",",code:"Comma",keyCode:188},Minus:{key:"-",code:"Minus",keyCode:189},Period:{key:".",code:"Period",keyCode:190},Slash:{key:"/",code:"Slash",keyCode:191},Backquote:{key:"`",code:"Backquote",keyCode:192},BracketLeft:{key:"[",code:"BracketLeft",keyCode:219},Backslash:{key:"\\",code:"Backslash",keyCode:220},BracketRight:{key:"]",code:"BracketRight",keyCode:221},Quote:{key:"'",code:"Quote",keyCode:222}},P=E;var A={INPUT_ZONE:"input-zone",TARGET_ZONE:"target-zone",BUTTON:"button",KEYBOARD_BUTTON:"keyboard-button",MOUSE_BUTTON:"mouse-button",JOYSTICK:"joystick",D_PAD:"d-pad",TRACKPAD:"trackpad",VIRTUAL_CURSOR:"virtual-cursor",ROOT_LAYER:"root-layer"},D={KEYDOWN:"keydown",KEYUP:"keyup",POINTER:"pointer",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",MOUSE:"mouse",MOUSEMOVE:"mousemove",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",CLICK:"click"},I=["px","%","vh","vw","rem","em"],M={PARENT_ID_KEY:"omnipad-parent-id-link"};var k=Symbol.for("omnipad.registry.instance"),s=null;function _(t){s=t;}var C=class t{constructor(){m(this,"entities",new Map);import.meta.env?.DEV&&console.log("[OmniPad-Core] Registry initialized.");}static getInstance(){let e=globalThis;return e[k]||(e[k]=new t),e[k]}register(e){if(!e.uid){console.warn("[OmniPad-Core] Registry: Attempted to register entity without UID.",e);return}this.entities.has(e.uid),this.entities.set(e.uid,e);}unregister(e){this.entities.has(e)&&this.entities.delete(e);}getEntity(e){return this.entities.get(e)}getAllEntities(){return Array.from(this.entities.values())}getEntitiesByRoot(e){let o=this.getAllEntities();if(!e)return o;if(!this.entities.get(e))return console.warn(`[OmniPad-Core] Registry: Root entity ${e} not found.`),[];let r=new Map;o.forEach(d=>{let a=d;if(typeof a.getConfig=="function"){let i=a.getConfig();i.parentId&&(r.has(i.parentId)||r.set(i.parentId,[]),r.get(i.parentId).push(d));}});let y=[],c=[e],u=new Set;for(;c.length>0;){let d=c.shift();if(u.has(d))continue;u.add(d);let a=this.entities.get(d);if(a){y.push(a);let i=r.get(d);i&&i.forEach(b=>c.push(b.uid));}}return y}destroyByRoot(e){let o=this.getEntitiesByRoot(e);for(let n=o.length-1;n>=0;n--){let r=o[n];try{r.destroy();}catch(y){console.error(`[OmniPad-Core] Error during destroyByRoot at ${r.uid}:`,y);}}}clear(){this.entities.clear();}resetAll(){this.entities.forEach(e=>{"reset"in e&&e.reset();});}markAllRectDirty(){this.entities.forEach(e=>{"markRectDirty"in e&&e.markRectDirty();});}broadcastSignal(e){let o=this.getEntity(e.targetStageId);o&&"handleSignal"in o?o.handleSignal(e):s&&s(e);}};var B=(t,e)=>({x:t.x-e.x,y:t.y-e.y}),v=(t,e)=>({x:t.x+e.x,y:t.y+e.y}),h=(t,e)=>({x:t.x*e,y:t.y*e}),l=(t,e,o)=>Math.max(e,Math.min(o,t)),T=(t,e,o)=>t+(e-t)*o,g=(t,e=2)=>{let o=Math.pow(10,e);return Math.round(t*o)/o},z=(t,e)=>Math.hypot(e.x-t.x,e.y-t.y),Z=(t,e)=>Math.atan2(e.y-t.y,e.x-t.x),q=t=>t*180/Math.PI,G=t=>t*Math.PI/180,H=(t,e,o)=>{let n=e.x-t.x,r=e.y-t.y;if(Math.hypot(n,r)<=o)return e;let c=Math.atan2(r,n);return {x:t.x+Math.cos(c)*o,y:t.y+Math.sin(c)*o}},W=t=>{let e=Math.PI/4;return Math.round(t/e)*e},J=t=>{let e=Math.PI/2;return Math.round(t/e)*e},Q=(t,e)=>g(t*e/100),X=(t,e)=>e===0?0:g(t*100/e),j=t=>{let e=Math.hypot(t.x,t.y);return e===0?{x:0,y:0}:{x:t.x/e,y:t.y/e}},$=t=>({x:Math.cos(t),y:Math.sin(t)}),ee=(t,e,o,n,r)=>{let y=(t-e)/(o-e);return T(n,r,l(y,0,1))},te=(t,e,o=1e-4)=>Math.abs(t.x-e.x)<o&&Math.abs(t.y-e.y)<o,p=(t,e,o)=>{if(t<e)return 0;let n=(t-e)/(o-e);return l(n,0,1)},oe=(t,e,o)=>{let n=Math.hypot(t.x,t.y),r=e*o,y=p(n,r,e);if(y===0)return {x:0,y:0};let c={x:t.x/n,y:t.y/n};return h(c,y)},ne=(t,e,o)=>({x:p(Math.abs(t.x),e,o)*Math.sign(t.x),y:p(Math.abs(t.y),e,o)*Math.sign(t.y)});export{te as A,p as B,oe as C,ne as D,m as a,P as b,A as c,D as d,I as e,M as f,_ as g,C as h,B as i,v as j,h as k,l,T as m,g as n,z as o,Z as p,q,G as r,H as s,W as t,J as u,Q as v,X as w,j as x,$ as y,ee as z};
|
|
@@ -797,30 +797,41 @@ interface ISpatial {
|
|
|
797
797
|
* Trait: Provides configuration management.
|
|
798
798
|
*/
|
|
799
799
|
interface IConfigurable<TConfig> {
|
|
800
|
-
/**
|
|
801
|
-
* Dynamically updates the current configuration.
|
|
802
|
-
* @param config - Partial configuration object to merge.
|
|
803
|
-
*/
|
|
804
|
-
updateConfig(config: Partial<TConfig>): void;
|
|
805
800
|
/**
|
|
806
801
|
* Retrieves a snapshot of the current configuration.
|
|
807
802
|
*/
|
|
808
803
|
getConfig(): TConfig;
|
|
804
|
+
/**
|
|
805
|
+
* Subscribes to config changes.
|
|
806
|
+
* @param cb - Callback function triggered on config updates.
|
|
807
|
+
* @returns An unsubscribe function.
|
|
808
|
+
*/
|
|
809
|
+
subscribeConfig(cb: (config: TConfig) => void): () => void;
|
|
810
|
+
/**
|
|
811
|
+
* Updates the internal config and notifies all subscribers.
|
|
812
|
+
* @param config - Partial configuration object to merge.
|
|
813
|
+
*/
|
|
814
|
+
updateConfig(config: Partial<TConfig>): void;
|
|
809
815
|
}
|
|
810
816
|
/**
|
|
811
|
-
* Trait:
|
|
817
|
+
* Trait: Provides state management.
|
|
812
818
|
*/
|
|
813
|
-
interface
|
|
819
|
+
interface IStateful<TState> {
|
|
820
|
+
/**
|
|
821
|
+
* Retrieves the current state snapshot.
|
|
822
|
+
*/
|
|
823
|
+
getState(): TState;
|
|
814
824
|
/**
|
|
815
825
|
* Subscribes to state changes.
|
|
816
826
|
* @param cb - Callback function triggered on state updates.
|
|
817
827
|
* @returns An unsubscribe function.
|
|
818
828
|
*/
|
|
819
|
-
|
|
829
|
+
subscribeState(cb: (state: TState) => void): () => void;
|
|
820
830
|
/**
|
|
821
|
-
*
|
|
831
|
+
* Updates the internal state and notifies all subscribers.
|
|
832
|
+
* @param state - Partial object containing updated state values.
|
|
822
833
|
*/
|
|
823
|
-
|
|
834
|
+
setState(state: Partial<TState>): void;
|
|
824
835
|
}
|
|
825
836
|
/**
|
|
826
837
|
* Trait: Allows resetting the entity to its idle/safe state.
|
|
@@ -990,13 +1001,27 @@ type EntityType = AnyEntityType | (string & {});
|
|
|
990
1001
|
type BuiltInActionType = (typeof ACTION_TYPES)[keyof typeof ACTION_TYPES];
|
|
991
1002
|
/** Input action type strings, allowing for custom action extensions */
|
|
992
1003
|
type InputActionType = BuiltInActionType | (string & {});
|
|
993
|
-
/**
|
|
994
|
-
|
|
1004
|
+
/**
|
|
1005
|
+
* Supported CSS units for layout calculation.
|
|
1006
|
+
* Using a constant array for runtime validation.
|
|
1007
|
+
*/
|
|
1008
|
+
declare const VALID_UNITS: readonly ["px", "%", "vh", "vw", "rem", "em"];
|
|
1009
|
+
/**
|
|
1010
|
+
* Derived type for type safety in TS
|
|
1011
|
+
*/
|
|
1012
|
+
type CssUnit = (typeof VALID_UNITS)[number];
|
|
1013
|
+
/**
|
|
1014
|
+
* Parsed length input.
|
|
1015
|
+
*/
|
|
1016
|
+
interface ParsedLength {
|
|
1017
|
+
value: number;
|
|
1018
|
+
unit: CssUnit;
|
|
1019
|
+
}
|
|
995
1020
|
/**
|
|
996
1021
|
* Flexible length input.
|
|
997
1022
|
* Supports numbers (interpreted as px) or strings (e.g., '50%', '10vh').
|
|
998
1023
|
*/
|
|
999
|
-
type FlexibleLength = string | number;
|
|
1024
|
+
type FlexibleLength = ParsedLength | string | number;
|
|
1000
1025
|
/**
|
|
1001
1026
|
* Anchor position used to determine the alignment of an element relative to its coordinates.
|
|
1002
1027
|
*/
|
|
@@ -1048,4 +1073,4 @@ declare const CONTEXT: {
|
|
|
1048
1073
|
*/
|
|
1049
1074
|
type AnyFunction = (...args: any[]) => void;
|
|
1050
1075
|
|
|
1051
|
-
export { type AbstractRect as A, type ButtonConfig as B, CMP_TYPES as C, type DPadConfig as D, type EntityType as E, type FlatConfigItem as F, type GamepadMappingConfig as G, type
|
|
1076
|
+
export { type AbstractRect as A, type ButtonConfig as B, CMP_TYPES as C, type DPadConfig as D, type EntityType as E, type FlatConfigItem as F, type GamepadMappingConfig as G, type ILifecycle as H, type ICoreEntity as I, type JoystickConfig as J, type InputActionType as K, KEYS as L, type KeyMapping as M, type LayoutBox as N, type StandardButton as O, type ParsedLength as P, VALID_UNITS as Q, type WidgetType as R, type StageId as S, type TargetZoneConfig as T, type ZoneType as U, type Vec2 as V, type WidgetId as W, type ZoneId as Z, type InputActionSignal as a, type ISpatial as b, type IResettable as c, type IConfigurable as d, type IStateful as e, type IPointerHandler as f, type IProgrammatic as g, type AbstractPointerEvent as h, type InputZoneConfig as i, type IDependencyBindable as j, type AnyFunction as k, type BaseConfig as l, type ISignalReceiver as m, type TrackpadConfig as n, ACTION_TYPES as o, type ActionMapping as p, type AnchorPoint as q, type AnyConfig as r, type AnyEntityType as s, type BuiltInActionType as t, CONTEXT as u, type ConfigTreeNode as v, type CssUnit as w, type FlexibleLength as x, type GamepadProfile as y, type IIdentifiable as z };
|
|
@@ -797,30 +797,41 @@ interface ISpatial {
|
|
|
797
797
|
* Trait: Provides configuration management.
|
|
798
798
|
*/
|
|
799
799
|
interface IConfigurable<TConfig> {
|
|
800
|
-
/**
|
|
801
|
-
* Dynamically updates the current configuration.
|
|
802
|
-
* @param config - Partial configuration object to merge.
|
|
803
|
-
*/
|
|
804
|
-
updateConfig(config: Partial<TConfig>): void;
|
|
805
800
|
/**
|
|
806
801
|
* Retrieves a snapshot of the current configuration.
|
|
807
802
|
*/
|
|
808
803
|
getConfig(): TConfig;
|
|
804
|
+
/**
|
|
805
|
+
* Subscribes to config changes.
|
|
806
|
+
* @param cb - Callback function triggered on config updates.
|
|
807
|
+
* @returns An unsubscribe function.
|
|
808
|
+
*/
|
|
809
|
+
subscribeConfig(cb: (config: TConfig) => void): () => void;
|
|
810
|
+
/**
|
|
811
|
+
* Updates the internal config and notifies all subscribers.
|
|
812
|
+
* @param config - Partial configuration object to merge.
|
|
813
|
+
*/
|
|
814
|
+
updateConfig(config: Partial<TConfig>): void;
|
|
809
815
|
}
|
|
810
816
|
/**
|
|
811
|
-
* Trait:
|
|
817
|
+
* Trait: Provides state management.
|
|
812
818
|
*/
|
|
813
|
-
interface
|
|
819
|
+
interface IStateful<TState> {
|
|
820
|
+
/**
|
|
821
|
+
* Retrieves the current state snapshot.
|
|
822
|
+
*/
|
|
823
|
+
getState(): TState;
|
|
814
824
|
/**
|
|
815
825
|
* Subscribes to state changes.
|
|
816
826
|
* @param cb - Callback function triggered on state updates.
|
|
817
827
|
* @returns An unsubscribe function.
|
|
818
828
|
*/
|
|
819
|
-
|
|
829
|
+
subscribeState(cb: (state: TState) => void): () => void;
|
|
820
830
|
/**
|
|
821
|
-
*
|
|
831
|
+
* Updates the internal state and notifies all subscribers.
|
|
832
|
+
* @param state - Partial object containing updated state values.
|
|
822
833
|
*/
|
|
823
|
-
|
|
834
|
+
setState(state: Partial<TState>): void;
|
|
824
835
|
}
|
|
825
836
|
/**
|
|
826
837
|
* Trait: Allows resetting the entity to its idle/safe state.
|
|
@@ -990,13 +1001,27 @@ type EntityType = AnyEntityType | (string & {});
|
|
|
990
1001
|
type BuiltInActionType = (typeof ACTION_TYPES)[keyof typeof ACTION_TYPES];
|
|
991
1002
|
/** Input action type strings, allowing for custom action extensions */
|
|
992
1003
|
type InputActionType = BuiltInActionType | (string & {});
|
|
993
|
-
/**
|
|
994
|
-
|
|
1004
|
+
/**
|
|
1005
|
+
* Supported CSS units for layout calculation.
|
|
1006
|
+
* Using a constant array for runtime validation.
|
|
1007
|
+
*/
|
|
1008
|
+
declare const VALID_UNITS: readonly ["px", "%", "vh", "vw", "rem", "em"];
|
|
1009
|
+
/**
|
|
1010
|
+
* Derived type for type safety in TS
|
|
1011
|
+
*/
|
|
1012
|
+
type CssUnit = (typeof VALID_UNITS)[number];
|
|
1013
|
+
/**
|
|
1014
|
+
* Parsed length input.
|
|
1015
|
+
*/
|
|
1016
|
+
interface ParsedLength {
|
|
1017
|
+
value: number;
|
|
1018
|
+
unit: CssUnit;
|
|
1019
|
+
}
|
|
995
1020
|
/**
|
|
996
1021
|
* Flexible length input.
|
|
997
1022
|
* Supports numbers (interpreted as px) or strings (e.g., '50%', '10vh').
|
|
998
1023
|
*/
|
|
999
|
-
type FlexibleLength = string | number;
|
|
1024
|
+
type FlexibleLength = ParsedLength | string | number;
|
|
1000
1025
|
/**
|
|
1001
1026
|
* Anchor position used to determine the alignment of an element relative to its coordinates.
|
|
1002
1027
|
*/
|
|
@@ -1048,4 +1073,4 @@ declare const CONTEXT: {
|
|
|
1048
1073
|
*/
|
|
1049
1074
|
type AnyFunction = (...args: any[]) => void;
|
|
1050
1075
|
|
|
1051
|
-
export { type AbstractRect as A, type ButtonConfig as B, CMP_TYPES as C, type DPadConfig as D, type EntityType as E, type FlatConfigItem as F, type GamepadMappingConfig as G, type
|
|
1076
|
+
export { type AbstractRect as A, type ButtonConfig as B, CMP_TYPES as C, type DPadConfig as D, type EntityType as E, type FlatConfigItem as F, type GamepadMappingConfig as G, type ILifecycle as H, type ICoreEntity as I, type JoystickConfig as J, type InputActionType as K, KEYS as L, type KeyMapping as M, type LayoutBox as N, type StandardButton as O, type ParsedLength as P, VALID_UNITS as Q, type WidgetType as R, type StageId as S, type TargetZoneConfig as T, type ZoneType as U, type Vec2 as V, type WidgetId as W, type ZoneId as Z, type InputActionSignal as a, type ISpatial as b, type IResettable as c, type IConfigurable as d, type IStateful as e, type IPointerHandler as f, type IProgrammatic as g, type AbstractPointerEvent as h, type InputZoneConfig as i, type IDependencyBindable as j, type AnyFunction as k, type BaseConfig as l, type ISignalReceiver as m, type TrackpadConfig as n, ACTION_TYPES as o, type ActionMapping as p, type AnchorPoint as q, type AnyConfig as r, type AnyEntityType as s, type BuiltInActionType as t, CONTEXT as u, type ConfigTreeNode as v, type CssUnit as w, type FlexibleLength as x, type GamepadProfile as y, type IIdentifiable as z };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var chunkPAGWIRTX_cjs=require('./chunk-PAGWIRTX.cjs');var $={Backspace:{key:"Backspace",code:"Backspace",keyCode:8},Tab:{key:"Tab",code:"Tab",keyCode:9},Enter:{key:"Enter",code:"Enter",keyCode:13},ShiftLeft:{key:"Shift",code:"ShiftLeft",keyCode:16},ControlLeft:{key:"Control",code:"ControlLeft",keyCode:17},AltLeft:{key:"Alt",code:"AltLeft",keyCode:18},Pause:{key:"Pause",code:"Pause",keyCode:19},CapsLock:{key:"CapsLock",code:"CapsLock",keyCode:20},Escape:{key:"Escape",code:"Escape",keyCode:27},Space:{key:" ",code:"Space",keyCode:32},PageUp:{key:"PageUp",code:"PageUp",keyCode:33},PageDown:{key:"PageDown",code:"PageDown",keyCode:34},End:{key:"End",code:"End",keyCode:35},Home:{key:"Home",code:"Home",keyCode:36},ArrowLeft:{key:"ArrowLeft",code:"ArrowLeft",keyCode:37},ArrowUp:{key:"ArrowUp",code:"ArrowUp",keyCode:38},ArrowRight:{key:"ArrowRight",code:"ArrowRight",keyCode:39},ArrowDown:{key:"ArrowDown",code:"ArrowDown",keyCode:40},PrintScreen:{key:"PrintScreen",code:"PrintScreen",keyCode:44},Insert:{key:"Insert",code:"Insert",keyCode:45},Delete:{key:"Delete",code:"Delete",keyCode:46},Digit0:{key:"0",code:"Digit0",keyCode:48},Digit1:{key:"1",code:"Digit1",keyCode:49},Digit2:{key:"2",code:"Digit2",keyCode:50},Digit3:{key:"3",code:"Digit3",keyCode:51},Digit4:{key:"4",code:"Digit4",keyCode:52},Digit5:{key:"5",code:"Digit5",keyCode:53},Digit6:{key:"6",code:"Digit6",keyCode:54},Digit7:{key:"7",code:"Digit7",keyCode:55},Digit8:{key:"8",code:"Digit8",keyCode:56},Digit9:{key:"9",code:"Digit9",keyCode:57},KeyA:{key:"a",code:"KeyA",keyCode:65},KeyB:{key:"b",code:"KeyB",keyCode:66},KeyC:{key:"c",code:"KeyC",keyCode:67},KeyD:{key:"d",code:"KeyD",keyCode:68},KeyE:{key:"e",code:"KeyE",keyCode:69},KeyF:{key:"f",code:"KeyF",keyCode:70},KeyG:{key:"g",code:"KeyG",keyCode:71},KeyH:{key:"h",code:"KeyH",keyCode:72},KeyI:{key:"i",code:"KeyI",keyCode:73},KeyJ:{key:"j",code:"KeyJ",keyCode:74},KeyK:{key:"k",code:"KeyK",keyCode:75},KeyL:{key:"l",code:"KeyL",keyCode:76},KeyM:{key:"m",code:"KeyM",keyCode:77},KeyN:{key:"n",code:"KeyN",keyCode:78},KeyO:{key:"o",code:"KeyO",keyCode:79},KeyP:{key:"p",code:"KeyP",keyCode:80},KeyQ:{key:"q",code:"KeyQ",keyCode:81},KeyR:{key:"r",code:"KeyR",keyCode:82},KeyS:{key:"s",code:"KeyS",keyCode:83},KeyT:{key:"t",code:"KeyT",keyCode:84},KeyU:{key:"u",code:"KeyU",keyCode:85},KeyV:{key:"v",code:"KeyV",keyCode:86},KeyW:{key:"w",code:"KeyW",keyCode:87},KeyX:{key:"x",code:"KeyX",keyCode:88},KeyY:{key:"y",code:"KeyY",keyCode:89},KeyZ:{key:"z",code:"KeyZ",keyCode:90},MetaLeft:{key:"Meta",code:"MetaLeft",keyCode:91},ContextMenu:{key:"ContextMenu",code:"ContextMenu",keyCode:93},Numpad0:{key:"0",code:"Numpad0",keyCode:96},Numpad1:{key:"1",code:"Numpad1",keyCode:97},Numpad2:{key:"2",code:"Numpad2",keyCode:98},Numpad3:{key:"3",code:"Numpad3",keyCode:99},Numpad4:{key:"4",code:"Numpad4",keyCode:100},Numpad5:{key:"5",code:"Numpad5",keyCode:101},Numpad6:{key:"6",code:"Numpad6",keyCode:102},Numpad7:{key:"7",code:"Numpad7",keyCode:103},Numpad8:{key:"8",code:"Numpad8",keyCode:104},Numpad9:{key:"9",code:"Numpad9",keyCode:105},NumpadMultiply:{key:"*",code:"NumpadMultiply",keyCode:106},NumpadAdd:{key:"+",code:"NumpadAdd",keyCode:107},NumpadSubtract:{key:"-",code:"NumpadSubtract",keyCode:109},NumpadDecimal:{key:".",code:"NumpadDecimal",keyCode:110},NumpadDivide:{key:"/",code:"NumpadDivide",keyCode:111},F1:{key:"F1",code:"F1",keyCode:112},F2:{key:"F2",code:"F2",keyCode:113},F3:{key:"F3",code:"F3",keyCode:114},F4:{key:"F4",code:"F4",keyCode:115},F5:{key:"F5",code:"F5",keyCode:116},F6:{key:"F6",code:"F6",keyCode:117},F7:{key:"F7",code:"F7",keyCode:118},F8:{key:"F8",code:"F8",keyCode:119},F9:{key:"F9",code:"F9",keyCode:120},F10:{key:"F10",code:"F10",keyCode:121},F11:{key:"F11",code:"F11",keyCode:122},F12:{key:"F12",code:"F12",keyCode:123},NumLock:{key:"NumLock",code:"NumLock",keyCode:144},ScrollLock:{key:"ScrollLock",code:"ScrollLock",keyCode:145},Semicolon:{key:";",code:"Semicolon",keyCode:186},Equal:{key:"=",code:"Equal",keyCode:187},Comma:{key:",",code:"Comma",keyCode:188},Minus:{key:"-",code:"Minus",keyCode:189},Period:{key:".",code:"Period",keyCode:190},Slash:{key:"/",code:"Slash",keyCode:191},Backquote:{key:"`",code:"Backquote",keyCode:192},BracketLeft:{key:"[",code:"BracketLeft",keyCode:219},Backslash:{key:"\\",code:"Backslash",keyCode:220},BracketRight:{key:"]",code:"BracketRight",keyCode:221},Quote:{key:"'",code:"Quote",keyCode:222}},S=$;var u={INPUT_ZONE:"input-zone",TARGET_ZONE:"target-zone",BUTTON:"button",KEYBOARD_BUTTON:"keyboard-button",MOUSE_BUTTON:"mouse-button",JOYSTICK:"joystick",D_PAD:"d-pad",TRACKPAD:"trackpad",VIRTUAL_CURSOR:"virtual-cursor",ROOT_LAYER:"root-layer"},n={KEYDOWN:"keydown",KEYUP:"keyup",POINTER:"pointer",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",MOUSE:"mouse",MOUSEMOVE:"mousemove",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",CLICK:"click"},G={PARENT_ID_KEY:"omnipad-parent-id-link"};var w=Symbol.for("omnipad.gamepad_manager.instance"),ee={A:0,B:1,X:2,Y:3,LB:4,RB:5,LT:6,RT:7,Select:8,Start:9,L3:10,R3:11,Up:12,Down:13,Left:14,Right:15},R=class a{constructor(){chunkPAGWIRTX_cjs.a(this,"isRunning",false);chunkPAGWIRTX_cjs.a(this,"config",null);chunkPAGWIRTX_cjs.a(this,"lastButtonStates",[]);chunkPAGWIRTX_cjs.a(this,"loop",()=>{if(!this.isRunning)return;let o=navigator.getGamepads();this.config?.forEach((e,t)=>{let i=o[t];i&&i.connected&&e&&(this.lastButtonStates[t]||(this.lastButtonStates[t]=[]),this.processButtons(i,e,t),this.processDPad(i,e),this.processAxes(i,e));}),requestAnimationFrame(this.loop);});}static getInstance(){let o=globalThis;return o[w]||(o[w]=new a),o[w]}setConfig(o){this.config=o;}getConfig(){return this.config}start(){this.isRunning||(this.isRunning=true,window.addEventListener("gamepadconnected",o=>{undefined?.DEV&&console.log("[Omnipad-Core] Gamepad Connected:",o.gamepad.id);}),window.addEventListener("gamepaddisconnected",()=>{undefined?.DEV&&console.log("[Omnipad-Core] Gamepad disconnected.");}),this.loop());}stop(){this.isRunning=false;}processButtons(o,e,t){e.buttons&&Object.entries(e.buttons).forEach(([i,r])=>{let c=ee[i];if(c===void 0||!o.buttons[c])return;let d=o.buttons[c].pressed,h=this.lastButtonStates[t][c]||false;d&&!h?this.triggerVirtualEntity(r,"down"):!d&&h&&this.triggerVirtualEntity(r,"up"),this.lastButtonStates[t][c]=d;});}processDPad(o,e){let t=e?.dpad;if(!t)return;let i=o.buttons[12]?.pressed?-1:0,r=o.buttons[13]?.pressed?1:0,c=o.buttons[14]?.pressed?-1:0,d=o.buttons[15]?.pressed?1:0,h=c+d,f=i+r;this.triggerVirtualEntity(t,"vector",{x:h,y:f});}processAxes(o,e){let t=e?.deadzone??.1;if(e?.leftStick){let i=Math.abs(o.axes[0])>t?o.axes[0]:0,r=Math.abs(o.axes[1])>t?o.axes[1]:0;this.triggerVirtualEntity(e.leftStick,"vector",{x:i,y:r});}if(e?.rightStick){let i=Math.abs(o.axes[2])>t?o.axes[2]:0,r=Math.abs(o.axes[3])>t?o.axes[3]:0;this.triggerVirtualEntity(e.rightStick,"vector",{x:i,y:r});}}triggerVirtualEntity(o,e,t){let i=chunkPAGWIRTX_cjs.b.getInstance().getEntity(o);!i||i.activePointerId!=null||(e==="down"&&i.triggerDown&&i.triggerDown(),e==="up"&&i.triggerUp&&i.triggerUp(),e==="vector"&&i.triggerVector&&t&&i.triggerVector(t.x,t.y));}};var A=typeof globalThis<"u"&&globalThis.requestAnimationFrame?globalThis.requestAnimationFrame.bind(globalThis):a=>setTimeout(a,16),te=typeof globalThis<"u"&&globalThis.cancelAnimationFrame?globalThis.cancelAnimationFrame.bind(globalThis):a=>clearTimeout(a);function I(a){let o=false,e;return function(t){e=t,o||(o=true,A(()=>{a(e),o=false;}));}}function W(a){let o=null,e=()=>{a(),o=A(e);};return {start:()=>{o===null&&e();},stop:()=>{o!==null&&(te(o),o=null);}}}var X=(a=2)=>new Promise(o=>{let e=0,t=()=>{++e>=a?o():A(t);};A(t);});var M=Symbol.for("omnipad.window_manager.instance"),O=class a{constructor(){chunkPAGWIRTX_cjs.a(this,"_isListening",false);chunkPAGWIRTX_cjs.a(this,"throttledReset");chunkPAGWIRTX_cjs.a(this,"handleGlobalReset",()=>{undefined?.DEV&&console.debug("[OmniPad-Core] Safety reset triggered by environment change."),chunkPAGWIRTX_cjs.b.getInstance().resetAll();});chunkPAGWIRTX_cjs.a(this,"handleResizeReset",()=>{this.throttledReset(null);});chunkPAGWIRTX_cjs.a(this,"handleBlurReset",()=>{this.handleGlobalReset();});chunkPAGWIRTX_cjs.a(this,"handleScrollReset",()=>{this.throttledReset(null);});chunkPAGWIRTX_cjs.a(this,"handleVisibilityChangeReset",()=>{document.visibilityState==="hidden"&&this.handleGlobalReset();});this.throttledReset=I(()=>{this.handleGlobalReset();});}static getInstance(){let o=globalThis;return o[M]||(o[M]=new a),o[M]}init(){this._isListening||(window.addEventListener("resize",this.handleResizeReset),window.addEventListener("blur",this.handleBlurReset),window.addEventListener("scroll",this.handleScrollReset,{capture:true,passive:true}),document.addEventListener("visibilitychange",this.handleVisibilityChangeReset),this._isListening=true,undefined?.DEV&&console.log("[OmniPad-Core] Global WindowManager monitoring started."));}async toggleFullscreen(o){let e=o||document.documentElement;try{document.fullscreenElement?(chunkPAGWIRTX_cjs.b.getInstance().resetAll(),await document.exitFullscreen()):(chunkPAGWIRTX_cjs.b.getInstance().resetAll(),await e.requestFullscreen());}catch(t){console.error("[OmniPad-Core] Fullscreen toggle failed:",t);}}isFullscreen(){return !!document.fullscreenElement}destroy(){window.removeEventListener("resize",this.handleResizeReset),window.removeEventListener("blur",this.handleBlurReset),window.removeEventListener("scroll",this.handleScrollReset,{capture:true}),window.removeEventListener("visibilitychange",this.handleVisibilityChangeReset),this._isListening=false;}};var D=class{constructor(){chunkPAGWIRTX_cjs.a(this,"listeners",new Set);}subscribe(o){return this.listeners.add(o),()=>this.listeners.delete(o)}emit(o){this.listeners.forEach(e=>{try{e(o);}catch(t){console.error("[OmniPad-Core] Emitter callback error:",t);}});}clear(){this.listeners.clear();}};var l=class{constructor(o,e,t,i){chunkPAGWIRTX_cjs.a(this,"uid");chunkPAGWIRTX_cjs.a(this,"type");chunkPAGWIRTX_cjs.a(this,"config");chunkPAGWIRTX_cjs.a(this,"state");chunkPAGWIRTX_cjs.a(this,"rectProvider",null);chunkPAGWIRTX_cjs.a(this,"_onMarkDirtyCb",null);chunkPAGWIRTX_cjs.a(this,"stateEmitter",new D);this.uid=o,this.type=e,this.config=t,this.state=i;}subscribe(o){return o(this.state),this.stateEmitter.subscribe(o)}setState(o){this.state={...this.state,...o},this.stateEmitter.emit(this.state);}destroy(){this.reset(),this.stateEmitter.clear(),chunkPAGWIRTX_cjs.b.getInstance().unregister(this.uid);}get rect(){return this.rectProvider?this.rectProvider():null}bindRectProvider(o,e){this.rectProvider=o,e&&(this._onMarkDirtyCb=e);}markRectDirty(){this._onMarkDirtyCb?.();}updateConfig(o){this.config={...this.config,...o},this.stateEmitter.emit(this.state);}getState(){return this.state}getConfig(){return this.config}};var p=class{constructor(o,e){chunkPAGWIRTX_cjs.a(this,"isPressed",false);chunkPAGWIRTX_cjs.a(this,"mapping");chunkPAGWIRTX_cjs.a(this,"targetId");this.update(o,e);}update(o,e){this.isPressed&&this.reset(),this.targetId=o,this.mapping=this.hydrate(e);}hydrate(o){if(!o)return;let e={...o};if(e.type==="mouse")return e.button=e.button??0,e;let{key:t,code:i,keyCode:r}=e;if(t||i||r){e.type="keyboard";let c=Object.values(S).find(d=>d.code===i||d.key===t||d.keyCode===r);c&&(e.key=t??c.key,e.code=i??c.code,e.keyCode=r??c.keyCode);}return e}press(){if(!this.mapping||this.isPressed)return;this.isPressed=true;let o=this.mapping.type==="keyboard"?n.KEYDOWN:n.MOUSEDOWN;this.emitSignal(o);}release(o=true){if(!this.mapping||!this.isPressed)return;this.isPressed=false;let e=this.mapping.type==="keyboard"?n.KEYUP:n.MOUSEUP;this.emitSignal(e),this.mapping.type==="mouse"&&o&&this.emitSignal(n.CLICK);}move(o){this.mapping?.type==="mouse"&&this.emitSignal(n.MOUSEMOVE,o);}reset(){this.isPressed&&this.release(false);}async tap(o=true){this.isPressed||(this.press(),await X(2),this.isPressed&&this.release(o));}emitSignal(o,e={}){if(!this.targetId||!this.mapping)return;let t=chunkPAGWIRTX_cjs.b.getInstance().getEntity(this.targetId);t&&t.handleSignal({targetStageId:this.targetId,type:o,payload:{key:this.mapping.key,code:this.mapping.code,keyCode:this.mapping.keyCode,button:this.mapping.button,point:this.mapping.fixedPoint,...e}});}};var N={isActive:false,isPressed:false,pointerId:null,value:0},K=class extends l{constructor(e,t){super(e,u.BUTTON,t,N);chunkPAGWIRTX_cjs.a(this,"emitter");this.emitter=new p(t.targetStageId,t.mapping);}get activePointerId(){return this.state.pointerId}onPointerDown(e){this.setState({isActive:true,isPressed:true,pointerId:e.pointerId}),this.emitter.press();}onPointerUp(e){!this.state.isActive||e.pointerId!==this.state.pointerId||this.handleRelease(true);}onPointerCancel(){this.handleRelease(false);}onPointerMove(){}reset(){this.setState(N),this.emitter.reset();}updateConfig(e){super.updateConfig(e),this.emitter.update(this.config.targetStageId,this.config.mapping);}handleRelease(e){this.setState(N),this.emitter.release(e);}triggerDown(){this.state.isPressed||(this.setState({isActive:true,isPressed:true}),this.emitter.press());}triggerUp(){this.state.isPressed&&(this.setState({isActive:false,isPressed:false}),this.emitter.release(true));}};var Z={isActive:false,pointerId:null,vector:{x:0,y:0}},q=.002,z=.3,F=class extends l{constructor(e,t){super(e,u.D_PAD,t,Z);chunkPAGWIRTX_cjs.a(this,"emitters");let i=t.targetStageId;this.emitters={up:new p(i,t.mapping?.up),down:new p(i,t.mapping?.down),left:new p(i,t.mapping?.left),right:new p(i,t.mapping?.right)};}get activePointerId(){return this.state.pointerId}onPointerDown(e){this.setState({isActive:true,pointerId:e.pointerId,vector:{x:0,y:0}}),this.processInput(e,true);}onPointerMove(e){!this.state.isActive||e.pointerId!==this.state.pointerId||this.processInput(e);}onPointerUp(e){!this.state.isActive||e.pointerId!==this.state.pointerId||this.reset();}onPointerCancel(){this.reset();}processInput(e,t=false){if(!this.state.isActive)return;let i=this.rect;if(!i)return;let r=i.left+i.width/2,c=i.top+i.height/2,d=i.width/2,h=i.height/2,f=(e.clientX-r)/d,P=(e.clientY-c)/h;if(t&&(f!=chunkPAGWIRTX_cjs.f(f,-1,1)||P!=chunkPAGWIRTX_cjs.f(P,-1,1))){this.setState({vector:{x:0,y:0}}),this.markRectDirty();return}let C={x:chunkPAGWIRTX_cjs.f(f,-1,1),y:chunkPAGWIRTX_cjs.f(P,-1,1)};chunkPAGWIRTX_cjs.u(C,this.state.vector,q)||(this.setState({vector:C}),this.handleDigitalKeys(C));}handleDigitalKeys(e){let t=this.config.threshold??.3;e.y<-t?(this.emitters.up.press(),this.emitters.down.release()):e.y>t?(this.emitters.down.press(),this.emitters.up.release()):(this.emitters.up.release(),this.emitters.down.release()),e.x<-t?(this.emitters.left.press(),this.emitters.right.release()):e.x>t?(this.emitters.right.press(),this.emitters.left.release()):(this.emitters.left.release(),this.emitters.right.release());}reset(){this.emitters.up.reset(),this.emitters.down.reset(),this.emitters.left.reset(),this.emitters.right.reset(),this.setState(Z);}updateConfig(e){super.updateConfig(e),this.emitters.up.update(this.config.targetStageId,this.config.mapping?.up),this.emitters.down.update(this.config.targetStageId,this.config.mapping?.down),this.emitters.left.update(this.config.targetStageId,this.config.mapping?.left),this.emitters.right.update(this.config.targetStageId,this.config.mapping?.right);}triggerVector(e,t){let i=this.config.threshold??.3;if(Math.abs(e)<i&&Math.abs(t)<i){this.state.isActive&&this.reset();return}this.state.isActive||this.setState({isActive:true});let r=chunkPAGWIRTX_cjs.g(this.state.vector.x,e,z),c=chunkPAGWIRTX_cjs.g(this.state.vector.y,t,z),d={x:r,y:c};chunkPAGWIRTX_cjs.u(d,this.state.vector,q)||(this.setState({vector:d}),this.handleDigitalKeys(d));}};var ie={isDynamicActive:false,dynamicPointerId:null,dynamicPosition:{x:0,y:0}},Y=class extends l{constructor(e,t){super(e,u.INPUT_ZONE,t,ie);chunkPAGWIRTX_cjs.a(this,"delegates",{dynamicWidgetPointerDown:()=>{},dynamicWidgetPointerMove:()=>{},dynamicWidgetPointerUp:()=>{},dynamicWidgetPointerCancel:()=>{}});}bindDelegate(e,t){Object.prototype.hasOwnProperty.call(this.delegates,e)?this.delegates[e]=t:undefined?.DEV&&console.warn(`[Omnipad-Core] TargetZone attempted to bind unknown delegate: ${e}`);}get activePointerId(){return this.state.dynamicPointerId}onPointerDown(e){if(this.state.isDynamicActive)return;let t=this.calculateRelativePosition(e.clientX,e.clientY);this.setState({isDynamicActive:true,dynamicPointerId:e.pointerId,dynamicPosition:t}),this.delegates.dynamicWidgetPointerDown?.(e);}onPointerMove(e){this.state.isDynamicActive&&this.delegates.dynamicWidgetPointerMove?.(e);}onPointerUp(e){this.delegates.dynamicWidgetPointerUp?.(e),this.reset();}onPointerCancel(e){this.delegates.dynamicWidgetPointerCancel?.(e),this.reset();}calculateRelativePosition(e,t){let i=this.rect;return i?{x:chunkPAGWIRTX_cjs.q(e-i.left,i.width),y:chunkPAGWIRTX_cjs.q(t-i.top,i.height)}:{x:0,y:0}}get isInterceptorRequired(){return !!(this.config.dynamicWidgetId||this.config.preventFocusLoss)}reset(){this.setState({isDynamicActive:false,dynamicPointerId:null});}};var T=class{constructor(o={}){chunkPAGWIRTX_cjs.a(this,"options");chunkPAGWIRTX_cjs.a(this,"startTime",0);chunkPAGWIRTX_cjs.a(this,"startPos",{x:0,y:0});chunkPAGWIRTX_cjs.a(this,"lastTapTime",0);chunkPAGWIRTX_cjs.a(this,"hasMoved",false);chunkPAGWIRTX_cjs.a(this,"isDoubleTapHolding",false);this.options={tapTime:250,tapDistance:10,doubleTapGap:300,...o};}onPointerDown(o,e){let t=Date.now();this.startTime=t,this.startPos={x:o,y:e},this.hasMoved=false,t-this.lastTapTime<this.options.doubleTapGap?(this.isDoubleTapHolding=true,this.options.onDoubleTapHoldStart?.()):this.isDoubleTapHolding=false;}onPointerMove(o,e){this.hasMoved||Math.hypot(o-this.startPos.x,e-this.startPos.y)>this.options.tapDistance&&(this.hasMoved=true);}onPointerUp(){let o=Date.now(),e=o-this.startTime;this.isDoubleTapHolding?(this.isDoubleTapHolding=false,this.options.onDoubleTapHoldEnd?.(),this.lastTapTime=0):e<=this.options.tapTime&&!this.hasMoved&&(this.options.onTap?.(),o-this.lastTapTime<this.options.doubleTapGap?(this.options.onDoubleTap?.(),this.lastTapTime=0):this.lastTapTime=o);}reset(){this.isDoubleTapHolding&&this.options.onDoubleTapHoldEnd?.(),this.isDoubleTapHolding=false,this.hasMoved=false,this.startTime=0,this.lastTapTime=0;}};var J={isActive:false,isPressed:false,pointerId:null,value:0,vector:{x:0,y:0}},_=.002,j=.3,U=class extends l{constructor(e,t){super(e,u.JOYSTICK,t,J);chunkPAGWIRTX_cjs.a(this,"emitters");chunkPAGWIRTX_cjs.a(this,"stickEmitter");chunkPAGWIRTX_cjs.a(this,"cursorEmitter");chunkPAGWIRTX_cjs.a(this,"gesture");chunkPAGWIRTX_cjs.a(this,"ticker");let i=t.targetStageId,r=t.mapping||{};this.emitters={up:new p(i,r.up),down:new p(i,r.down),left:new p(i,r.left),right:new p(i,r.right)},this.stickEmitter=new p(i,r.stick),this.cursorEmitter=new p(i,{type:"mouse"}),this.gesture=new T({onTap:async()=>{this.setState({isPressed:true}),await this.stickEmitter.tap(),this.setState({isPressed:false});},onDoubleTapHoldStart:()=>{this.setState({isPressed:true}),this.stickEmitter.press();},onDoubleTapHoldEnd:()=>{this.setState({isPressed:false}),this.stickEmitter.release(false);}}),this.ticker=W(()=>{this.handleCursorTick();});}get activePointerId(){return this.state.pointerId}onPointerDown(e){this.setState({isActive:true,pointerId:e.pointerId,vector:{x:0,y:0}}),this.gesture.onPointerDown(e.clientX,e.clientY),this.processInput(e,true);}onPointerMove(e){!this.state.isActive||e.pointerId!==this.state.pointerId||(this.gesture.onPointerMove(e.clientX,e.clientY),this.config.cursorMode&&this.ticker.start(),this.processInput(e));}onPointerUp(e){!this.state.isActive||e.pointerId!==this.state.pointerId||(this.gesture.onPointerUp(),this.handleRelease());}onPointerCancel(){this.handleRelease();}handleRelease(){this.setState({isActive:false,pointerId:null,vector:{x:0,y:0}}),this.ticker.stop(),Object.values(this.emitters).forEach(e=>e?.reset());}processInput(e,t=false){if(!this.state.isActive)return;let i=this.rect;if(!i)return;let r=i.left+i.width/2,c=i.top+i.height/2,d=i.width/2,h=i.height/2,f=(e.clientX-r)/d,P=(e.clientY-c)/h;if(t&&(f!=chunkPAGWIRTX_cjs.f(f,-1,1)||P!=chunkPAGWIRTX_cjs.f(P,-1,1))){this.setState({vector:{x:0,y:0}}),this.markRectDirty();return}let x=chunkPAGWIRTX_cjs.w({x:f,y:P},1,this.config.threshold||.15);chunkPAGWIRTX_cjs.u(x,this.state.vector,_)||(this.setState({vector:x}),this.handleDigitalKeys(x));}handleCursorTick(){let{vector:e,isActive:t}=this.state;if(!t||!this.config.cursorMode||chunkPAGWIRTX_cjs.u(e,{x:0,y:0},_)){this.ticker.stop();return}let i=this.config.cursorSensitivity??1,r={x:e.x*Math.abs(e.x)*i,y:e.y*Math.abs(e.y)*i};(Math.abs(r.x)>0||Math.abs(r.y)>0)&&this.cursorEmitter.move({delta:r});}handleDigitalKeys(e){let t=this.config.threshold??.3;e.y<-t?(this.emitters.up.press(),this.emitters.down.release()):e.y>t?(this.emitters.down.press(),this.emitters.up.release()):(this.emitters.up.release(),this.emitters.down.release()),e.x<-t?(this.emitters.left.press(),this.emitters.right.release()):e.x>t?(this.emitters.right.press(),this.emitters.left.release()):(this.emitters.left.release(),this.emitters.right.release());}reset(){this.setState(J),this.gesture.reset(),this.handleRelease(),this.stickEmitter.reset(),this.cursorEmitter.reset();}updateConfig(e){super.updateConfig(e);let t=this.config.targetStageId,i=this.config.mapping||{};this.emitters.up.update(t,i.up),this.emitters.down.update(t,i.down),this.emitters.left.update(t,i.left),this.emitters.right.update(t,i.right),this.stickEmitter.update(t,i.stick),this.cursorEmitter.update(t);}triggerDown(){this.state.isPressed||(this.setState({isActive:true,isPressed:true}),this.stickEmitter.press());}triggerUp(){this.state.isPressed&&(this.setState({isActive:false,isPressed:false}),this.stickEmitter.release(true));}triggerVector(e,t){let i=this.config.threshold??.15;if(Math.hypot(e,t)<i){this.state.isActive&&this.handleRelease();return}this.state.isActive||this.setState({isActive:true});let c=chunkPAGWIRTX_cjs.g(this.state.vector.x,e,j),d=chunkPAGWIRTX_cjs.g(this.state.vector.y,t,j),h={x:c,y:d};chunkPAGWIRTX_cjs.u(h,this.state.vector,_)||(this.setState({vector:h}),this.handleDigitalKeys(h)),this.config.cursorMode&&this.ticker.start();}};var oe={isHighlighted:false},L=class extends l{constructor(o,e){super(o,u.ROOT_LAYER,e,oe);}reset(){}};var se={position:{x:50,y:50},isVisible:false,isPointerDown:false,isFocusReturning:false},b=1,B=class extends l{constructor(e,t){super(e,u.TARGET_ZONE,t,se);chunkPAGWIRTX_cjs.a(this,"hideTimer",null);chunkPAGWIRTX_cjs.a(this,"focusFeedbackTimer",null);chunkPAGWIRTX_cjs.a(this,"throttledMoveExecution");chunkPAGWIRTX_cjs.a(this,"delegates",{dispatchKeyboardEvent:()=>{},dispatchPointerEventAtPos:()=>{},reclaimFocusAtPos:()=>{}});this.throttledMoveExecution=I(i=>{this.executeMouseAction(n.POINTERMOVE,i);});}bindDelegate(e,t){Object.prototype.hasOwnProperty.call(this.delegates,e)?this.delegates[e]=t:undefined?.DEV&&console.warn(`[Omnipad-Core] TargetZone attempted to bind unknown delegate: ${e}`);}get activePointerId(){return null}onPointerDown(e){this.processPhysicalEvent(e,n.MOUSEDOWN);}onPointerMove(e){this.processPhysicalEvent(e,n.MOUSEMOVE);}onPointerUp(e){this.processPhysicalEvent(e,n.MOUSEUP),this.processPhysicalEvent(e,n.CLICK);}onPointerCancel(e){this.processPhysicalEvent(e,n.MOUSEUP);}processPhysicalEvent(e,t){let i=this.rect;if(!i)return;let r={x:chunkPAGWIRTX_cjs.q(e.clientX-i.left,i.width),y:chunkPAGWIRTX_cjs.q(e.clientY-i.top,i.height)};this.handleSignal({targetStageId:this.uid,type:t,payload:{point:r,button:e.button}});}handleSignal(e){let{type:t,payload:i}=e;switch(this.ensureFocus(),t){case n.KEYDOWN:case n.KEYUP:this.delegates.dispatchKeyboardEvent?.(t,i);break;case n.MOUSEMOVE:i.point?this.updateCursorPosition(i.point):i.delta&&this.updateCursorPositionByDelta(i.delta),this.config.cursorEnabled&&this.showCursor(),this.throttledMoveExecution(i);break;case n.MOUSEDOWN:case n.MOUSEUP:case n.CLICK:i.point&&this.updateCursorPosition(i.point),this.config.cursorEnabled&&this.showCursor(),this.executeMouseAction(t.startsWith(n.MOUSE)?t.replace(n.MOUSE,n.POINTER):t,i);break}}executeMouseAction(e,t){let i=this.rect;if(!i)return;e===n.POINTERDOWN&&this.setState({isPointerDown:true}),e===n.POINTERUP&&this.setState({isPointerDown:false});let r=t.point||this.state.position,c=chunkPAGWIRTX_cjs.f(i.left+chunkPAGWIRTX_cjs.p(r.x,i.width),i.left+b,i.left+i.width-b),d=chunkPAGWIRTX_cjs.f(i.top+chunkPAGWIRTX_cjs.p(r.y,i.height),i.top+b,i.top+i.height-b);this.delegates.dispatchPointerEventAtPos?.(e,c,d,{button:t.button??0,buttons:this.state.isPointerDown?1:0,pressure:this.state.isPointerDown?.5:0});}ensureFocus(){let e=this.rect;if(!e)return;let t=chunkPAGWIRTX_cjs.f(e.left+chunkPAGWIRTX_cjs.p(this.state.position.x,e.width),e.left+b,e.left+e.width-b),i=chunkPAGWIRTX_cjs.f(e.top+chunkPAGWIRTX_cjs.p(this.state.position.y,e.height),e.top+b,e.top+e.height-b);this.delegates.reclaimFocusAtPos?.(t,i,()=>this.triggerFocusFeedback());}triggerFocusFeedback(){this.setState({isFocusReturning:true}),this.focusFeedbackTimer&&clearTimeout(this.focusFeedbackTimer),this.focusFeedbackTimer=setTimeout(()=>this.setState({isFocusReturning:false}),500);}updateCursorPosition(e){chunkPAGWIRTX_cjs.u(e,this.state.position)||this.setState({position:{...e}});}updateCursorPositionByDelta(e){if(chunkPAGWIRTX_cjs.u(e,{x:0,y:0}))return;let t=this.rect;if(!t)return;let i=chunkPAGWIRTX_cjs.q(e.x,t.width),r=chunkPAGWIRTX_cjs.q(e.y,t.height);this.updateCursorPosition({x:chunkPAGWIRTX_cjs.f(this.state.position.x+i,0,100),y:chunkPAGWIRTX_cjs.f(this.state.position.y+r,0,100)});}showCursor(){this.setState({isVisible:true}),this.hideTimer&&clearTimeout(this.hideTimer),this.config.cursorAutoDelay&&this.config.cursorAutoDelay>0&&(this.hideTimer=setTimeout(()=>this.setState({isVisible:false}),this.config.cursorAutoDelay));}reset(){this.state.isPointerDown&&this.executeMouseAction(n.POINTERUP,{}),this.hideTimer&&clearTimeout(this.hideTimer),this.focusFeedbackTimer&&clearTimeout(this.focusFeedbackTimer),this.setState({isVisible:false,isPointerDown:false,isFocusReturning:false});}};var Q={isActive:false,isPressed:false,pointerId:null,value:0},V=class extends l{constructor(e,t){super(e,u.TRACKPAD,t,Q);chunkPAGWIRTX_cjs.a(this,"lastPointerPos",{x:0,y:0});chunkPAGWIRTX_cjs.a(this,"gesture");chunkPAGWIRTX_cjs.a(this,"emitter");let i=t.mapping||{type:"mouse"};this.emitter=new p(t.targetStageId,i),this.gesture=new T({onTap:()=>{this.setState({isPressed:true}),this.emitter.tap();},onDoubleTapHoldStart:()=>{this.setState({isPressed:true}),this.emitter.press();},onDoubleTapHoldEnd:()=>{this.setState({isPressed:false}),this.emitter.release(false);}});}get activePointerId(){return this.state.pointerId}onPointerDown(e){this.lastPointerPos={x:e.clientX,y:e.clientY},this.gesture.onPointerDown(e.clientX,e.clientY),this.setState({isActive:true,pointerId:e.pointerId});}onPointerMove(e){!this.state.isActive||e.pointerId!==this.state.pointerId||(this.gesture.onPointerMove(e.clientX,e.clientY),this.processInput(e));}processInput(e){if(!this.state.isActive)return;let t=e.clientX-this.lastPointerPos.x,i=e.clientY-this.lastPointerPos.y,r=this.rect;if(!r)return;let c=t/r.width*100*(this.config.sensitivity??1),d=i/r.height*100*(this.config.sensitivity??1),h={x:c,y:d};chunkPAGWIRTX_cjs.u(h,{x:0,y:0})||this.emitter.move({delta:h}),this.lastPointerPos={x:e.clientX,y:e.clientY};}onPointerUp(e){!this.state.isActive||e.pointerId!==this.state.pointerId||(this.gesture.onPointerUp(),this.handleRelease());}onPointerCancel(){this.handleRelease();}reset(){this.gesture.reset(),this.emitter.reset(),this.handleRelease();}updateConfig(e){super.updateConfig(e),this.emitter.update(this.config.targetStageId,this.config.mapping);}handleRelease(){this.setState(Q);}};var Kt={ActionTypes:n,Context:G,Keys:S,Types:u};Object.defineProperty(exports,"Registry",{enumerable:true,get:function(){return chunkPAGWIRTX_cjs.b}});exports.ACTION_TYPES=n;exports.BaseEntity=l;exports.ButtonCore=K;exports.CMP_TYPES=u;exports.CONTEXT=G;exports.DPadCore=F;exports.GamepadManager=R;exports.InputZoneCore=Y;exports.JoystickCore=U;exports.KEYS=S;exports.OmniPad=Kt;exports.RootLayerCore=L;exports.TargetZoneCore=B;exports.TrackpadCore=V;exports.WindowManager=O;
|
|
1
|
+
'use strict';var chunk4J2ZANLB_cjs=require('./chunk-4J2ZANLB.cjs');var x=Symbol.for("omnipad.gamepad_manager.instance"),it={A:0,B:1,X:2,Y:3,LB:4,RB:5,LT:6,RT:7,Select:8,Start:9,L3:10,R3:11,Up:12,Down:13,Left:14,Right:15},M=class c{constructor(){chunk4J2ZANLB_cjs.a(this,"isRunning",false);chunk4J2ZANLB_cjs.a(this,"config",null);chunk4J2ZANLB_cjs.a(this,"lastButtonStates",[]);chunk4J2ZANLB_cjs.a(this,"loop",()=>{if(!this.isRunning)return;let i=navigator.getGamepads();this.config?.forEach((t,e)=>{let s=i[e];s&&s.connected&&t&&(this.lastButtonStates[e]||(this.lastButtonStates[e]=[]),this.processButtons(s,t,e),this.processDPad(s,t),this.processAxes(s,t));}),requestAnimationFrame(this.loop);});}static getInstance(){let i=globalThis;return i[x]||(i[x]=new c),i[x]}setConfig(i){this.config=i;}getConfig(){return this.config}start(){this.isRunning||(this.isRunning=true,window.addEventListener("gamepadconnected",i=>{undefined?.DEV&&console.log("[Omnipad-Core] Gamepad Connected:",i.gamepad.id);}),window.addEventListener("gamepaddisconnected",()=>{undefined?.DEV&&console.log("[Omnipad-Core] Gamepad disconnected.");}),this.loop());}stop(){this.isRunning=false;}processButtons(i,t,e){t.buttons&&Object.entries(t.buttons).forEach(([s,o])=>{let n=it[s];if(n===void 0||!i.buttons[n])return;let l=i.buttons[n].pressed,u=this.lastButtonStates[e][n]||false;l&&!u?this.triggerVirtualEntity(o,"down"):!l&&u&&this.triggerVirtualEntity(o,"up"),this.lastButtonStates[e][n]=l;});}processDPad(i,t){let e=t?.dpad;if(!e)return;let s=i.buttons[12]?.pressed?-1:0,o=i.buttons[13]?.pressed?1:0,n=i.buttons[14]?.pressed?-1:0,l=i.buttons[15]?.pressed?1:0,u=n+l,v=s+o;this.triggerVirtualEntity(e,"vector",{x:u,y:v});}processAxes(i,t){let e=t?.deadzone??.1;if(t?.leftStick){let s=Math.abs(i.axes[0])>e?i.axes[0]:0,o=Math.abs(i.axes[1])>e?i.axes[1]:0;this.triggerVirtualEntity(t.leftStick,"vector",{x:s,y:o});}if(t?.rightStick){let s=Math.abs(i.axes[2])>e?i.axes[2]:0,o=Math.abs(i.axes[3])>e?i.axes[3]:0;this.triggerVirtualEntity(t.rightStick,"vector",{x:s,y:o});}}triggerVirtualEntity(i,t,e){let s=chunk4J2ZANLB_cjs.h.getInstance().getEntity(i);!s||s.activePointerId!=null||(t==="down"&&typeof s.triggerDown=="function"&&s.triggerDown(),t==="up"&&typeof s.triggerUp=="function"&&s.triggerUp(),t==="vector"&&typeof s.triggerVector=="function"&&e&&s.triggerVector(e.x,e.y));}};var R=typeof globalThis<"u"&&globalThis.requestAnimationFrame?globalThis.requestAnimationFrame.bind(globalThis):c=>setTimeout(c,16),st=typeof globalThis<"u"&&globalThis.cancelAnimationFrame?globalThis.cancelAnimationFrame.bind(globalThis):c=>clearTimeout(c);function T(c){let i=false,t;return function(e){t=e,i||(i=true,R(()=>{c(t),i=false;}));}}function z(c){let i=null,t=()=>{c(),i=R(t);};return {start:()=>{i===null&&t();},stop:()=>{i!==null&&(st(i),i=null);}}}var Z=(c=2)=>new Promise(i=>{let t=0,e=()=>{++t>=c?i():R(e);};R(e);});var O=Symbol.for("omnipad.element_observer.instance"),k=class c{constructor(){chunk4J2ZANLB_cjs.a(this,"_ro");chunk4J2ZANLB_cjs.a(this,"_roRegistry",new Map);chunk4J2ZANLB_cjs.a(this,"_elToRoCb",new WeakMap);chunk4J2ZANLB_cjs.a(this,"_io");chunk4J2ZANLB_cjs.a(this,"_ioRegistry",new Map);chunk4J2ZANLB_cjs.a(this,"_elToIoCb",new WeakMap);let i=T(t=>{for(let e of t)this._elToRoCb.get(e.target)?.();});this._ro=new ResizeObserver(t=>{i(t);}),this._io=new IntersectionObserver(t=>{for(let e of t)this._elToIoCb.get(e.target)?.(e.isIntersecting);},{threshold:0});}static getInstance(){let i=globalThis;return i[O]||(i[O]=new c),i[O]}observeResize(i,t,e){this.unobserveResize(i),this._roRegistry.set(i,t),this._elToRoCb.set(t,e),this._ro.observe(t);}unobserveResize(i){let t=this._roRegistry.get(i);t&&(this._ro.unobserve(t),this._elToRoCb.delete(t),this._roRegistry.delete(i));}observeIntersect(i,t,e){this.unobserveIntersect(i),this._ioRegistry.set(i,t),this._elToIoCb.set(t,e),this._io.observe(t);}unobserveIntersect(i){let t=this._ioRegistry.get(i);t&&(this._io.unobserve(t),this._elToIoCb.delete(t),this._ioRegistry.delete(i));}disconnect(i){this.unobserveResize(i),this.unobserveIntersect(i);}};var _=Symbol.for("omnipad.window_manager.instance"),Y=class c{constructor(){chunk4J2ZANLB_cjs.a(this,"_isListening",false);chunk4J2ZANLB_cjs.a(this,"throttledReset");chunk4J2ZANLB_cjs.a(this,"handleGlobalReset",()=>{undefined?.DEV&&console.debug("[OmniPad-Core] Safety reset triggered by environment change."),chunk4J2ZANLB_cjs.h.getInstance().resetAll(),chunk4J2ZANLB_cjs.h.getInstance().markAllRectDirty();});chunk4J2ZANLB_cjs.a(this,"handleResizeReset",()=>{this.throttledReset(null);});chunk4J2ZANLB_cjs.a(this,"handleBlurReset",()=>{this.handleGlobalReset();});chunk4J2ZANLB_cjs.a(this,"handleScrollReset",()=>{this.throttledReset(null);});chunk4J2ZANLB_cjs.a(this,"handleVisibilityChangeReset",()=>{document.visibilityState==="hidden"&&this.handleGlobalReset();});this.throttledReset=T(()=>{this.handleGlobalReset();});}static getInstance(){let i=globalThis;return i[_]||(i[_]=new c),i[_]}init(){this._isListening||(window.addEventListener("resize",this.handleResizeReset),window.addEventListener("blur",this.handleBlurReset),window.addEventListener("scroll",this.handleScrollReset,{capture:true,passive:true}),document.addEventListener("visibilitychange",this.handleVisibilityChangeReset),this._isListening=true,undefined?.DEV&&console.log("[OmniPad-Core] Global WindowManager monitoring started."));}async toggleFullscreen(i){let t=i||document.documentElement;try{document.fullscreenElement?(this.handleGlobalReset(),await document.exitFullscreen()):(this.handleGlobalReset(),await t.requestFullscreen());}catch(e){console.error("[OmniPad-Core] Fullscreen toggle failed:",e);}}isFullscreen(){return !!document.fullscreenElement}destroy(){window.removeEventListener("resize",this.handleResizeReset),window.removeEventListener("blur",this.handleBlurReset),window.removeEventListener("scroll",this.handleScrollReset,{capture:true}),window.removeEventListener("visibilitychange",this.handleVisibilityChangeReset),this._isListening=false;}};var A=class{constructor(){chunk4J2ZANLB_cjs.a(this,"listeners",new Set);}subscribe(i){return this.listeners.add(i),()=>this.listeners.delete(i)}emit(i){this.listeners.forEach(t=>{try{t(i);}catch(e){console.error("[OmniPad-Core] Emitter callback error:",e);}});}clear(){this.listeners.clear();}};var d=class{constructor(i,t,e,s){chunk4J2ZANLB_cjs.a(this,"uid");chunk4J2ZANLB_cjs.a(this,"type");chunk4J2ZANLB_cjs.a(this,"config");chunk4J2ZANLB_cjs.a(this,"state");chunk4J2ZANLB_cjs.a(this,"rectProvider",null);chunk4J2ZANLB_cjs.a(this,"_onMarkDirtyCb",null);chunk4J2ZANLB_cjs.a(this,"stateEmitter",new A);chunk4J2ZANLB_cjs.a(this,"configEmitter",new A);this.uid=i,this.type=t,this.config=e,this.state=s;}getConfig(){return this.config}subscribeConfig(i){return i(this.config),this.configEmitter.subscribe(i)}updateConfig(i){this.config={...this.config,...i},this.configEmitter.emit(this.config);}getState(){return this.state}setState(i){this.state={...this.state,...i},this.stateEmitter.emit(this.state);}subscribeState(i){return i(this.state),this.stateEmitter.subscribe(i)}destroy(){this.reset(),this.stateEmitter.clear(),this.configEmitter.clear(),chunk4J2ZANLB_cjs.h.getInstance().unregister(this.uid);}get rect(){return this.rectProvider?this.rectProvider():null}bindRectProvider(i,t){this.rectProvider=i,t&&(this._onMarkDirtyCb=t);}markRectDirty(){this._onMarkDirtyCb?.();}};var p=class{constructor(i,t){chunk4J2ZANLB_cjs.a(this,"isPressed",false);chunk4J2ZANLB_cjs.a(this,"mapping");chunk4J2ZANLB_cjs.a(this,"targetId");this.update(i,t);}update(i,t){this.isPressed&&this.reset(),this.targetId=i,this.mapping=this.hydrate(t);}hydrate(i){if(!i)return;let t={...i};if(t.type==="mouse")return t.button=t.button??0,t;let{key:e,code:s,keyCode:o}=t;if(e||s||o){t.type="keyboard";let n=Object.values(chunk4J2ZANLB_cjs.b).find(l=>l.code===s||l.key===e||l.keyCode===o);n&&(t.key=e??n.key,t.code=s??n.code,t.keyCode=o??n.keyCode);}return t}press(){if(!this.mapping||this.isPressed)return;this.isPressed=true;let i=this.mapping.type==="keyboard"?chunk4J2ZANLB_cjs.d.KEYDOWN:chunk4J2ZANLB_cjs.d.MOUSEDOWN;this.emitSignal(i);}release(i=true){if(!this.mapping||!this.isPressed)return;this.isPressed=false;let t=this.mapping.type==="keyboard"?chunk4J2ZANLB_cjs.d.KEYUP:chunk4J2ZANLB_cjs.d.MOUSEUP;this.emitSignal(t),this.mapping.type==="mouse"&&i&&this.emitSignal(chunk4J2ZANLB_cjs.d.CLICK);}move(i){this.mapping?.type==="mouse"&&this.emitSignal(chunk4J2ZANLB_cjs.d.MOUSEMOVE,i);}reset(){this.isPressed&&this.release(false);}async tap(i=true){this.isPressed||(this.press(),await Z(2),this.isPressed&&this.release(i));}emitSignal(i,t={}){!this.targetId||!this.mapping||chunk4J2ZANLB_cjs.h.getInstance().broadcastSignal({targetStageId:this.targetId,type:i,payload:{key:this.mapping.key,code:this.mapping.code,keyCode:this.mapping.keyCode,button:this.mapping.button,point:this.mapping.fixedPoint,...t}});}};var V={isActive:false,isPressed:false,pointerId:null,value:0},B=class extends d{constructor(t,e,s){super(t,s||chunk4J2ZANLB_cjs.c.BUTTON,e,V);chunk4J2ZANLB_cjs.a(this,"emitter");this.emitter=new p(e.targetStageId,e.mapping);}get activePointerId(){return this.state.pointerId}onPointerDown(t){this.setState({isActive:true,isPressed:true,pointerId:t.pointerId}),this.emitter.press();}onPointerUp(t){!this.state.isActive||t.pointerId!==this.state.pointerId||this.handleRelease(true);}onPointerCancel(){this.handleRelease(false);}onPointerMove(){}reset(){this.setState(V),this.emitter.reset();}updateConfig(t){super.updateConfig(t),this.emitter.update(this.config.targetStageId,this.config.mapping);}handleRelease(t){this.setState(V),this.emitter.release(t);}triggerDown(){this.state.isPressed||(this.setState({isActive:true,isPressed:true}),this.emitter.press());}triggerUp(){this.state.isPressed&&(this.setState({isActive:false,isPressed:false}),this.emitter.release(true));}};var q={isActive:false,pointerId:null,vector:{x:0,y:0}},j=.002,J=.3,G=class extends d{constructor(t,e,s){super(t,s||chunk4J2ZANLB_cjs.c.D_PAD,e,q);chunk4J2ZANLB_cjs.a(this,"emitters");let o=e.targetStageId;this.emitters={up:new p(o,e.mapping?.up),down:new p(o,e.mapping?.down),left:new p(o,e.mapping?.left),right:new p(o,e.mapping?.right)};}get activePointerId(){return this.state.pointerId}onPointerDown(t){this.setState({isActive:true,pointerId:t.pointerId,vector:{x:0,y:0}}),this.processInput(t,true);}onPointerMove(t){!this.state.isActive||t.pointerId!==this.state.pointerId||this.processInput(t);}onPointerUp(t){!this.state.isActive||t.pointerId!==this.state.pointerId||this.reset();}onPointerCancel(){this.reset();}processInput(t,e=false){if(!this.state.isActive)return;let s=this.rect;if(!s)return;let o=s.left+s.width/2,n=s.top+s.height/2,l=s.width/2,u=s.height/2,v=(t.clientX-o)/l,P=(t.clientY-n)/u;if(e&&(v!=chunk4J2ZANLB_cjs.l(v,-1,1)||P!=chunk4J2ZANLB_cjs.l(P,-1,1))){this.setState({vector:{x:0,y:0}}),this.markRectDirty();return}let C={x:chunk4J2ZANLB_cjs.l(v,-1,1),y:chunk4J2ZANLB_cjs.l(P,-1,1)};chunk4J2ZANLB_cjs.A(C,this.state.vector,j)||(this.setState({vector:C}),this.handleDigitalKeys(C));}handleDigitalKeys(t){let e=this.config.threshold??.3;t.y<-e?(this.emitters.up.press(),this.emitters.down.release()):t.y>e?(this.emitters.down.press(),this.emitters.up.release()):(this.emitters.up.release(),this.emitters.down.release()),t.x<-e?(this.emitters.left.press(),this.emitters.right.release()):t.x>e?(this.emitters.right.press(),this.emitters.left.release()):(this.emitters.left.release(),this.emitters.right.release());}reset(){this.emitters.up.reset(),this.emitters.down.reset(),this.emitters.left.reset(),this.emitters.right.reset(),this.setState(q);}updateConfig(t){super.updateConfig(t),this.emitters.up.update(this.config.targetStageId,this.config.mapping?.up),this.emitters.down.update(this.config.targetStageId,this.config.mapping?.down),this.emitters.left.update(this.config.targetStageId,this.config.mapping?.left),this.emitters.right.update(this.config.targetStageId,this.config.mapping?.right);}triggerVector(t,e){let s=this.config.threshold??.3;if(Math.abs(t)<s&&Math.abs(e)<s){this.state.isActive&&this.reset();return}this.state.isActive||this.setState({isActive:true});let o=chunk4J2ZANLB_cjs.m(this.state.vector.x,t,J),n=chunk4J2ZANLB_cjs.m(this.state.vector.y,e,J),l={x:o,y:n};chunk4J2ZANLB_cjs.A(l,this.state.vector,j)||(this.setState({vector:l}),this.handleDigitalKeys(l));}};var rt={isDynamicActive:false,dynamicPointerId:null,dynamicPosition:{x:0,y:0}},H=class extends d{constructor(t,e,s){super(t,s||chunk4J2ZANLB_cjs.c.INPUT_ZONE,e,rt);chunk4J2ZANLB_cjs.a(this,"delegates",{dynamicWidgetPointerDown:()=>{},dynamicWidgetPointerMove:()=>{},dynamicWidgetPointerUp:()=>{},dynamicWidgetPointerCancel:()=>{}});}bindDelegate(t,e){Object.prototype.hasOwnProperty.call(this.delegates,t)?this.delegates[t]=e:undefined?.DEV&&console.warn(`[Omnipad-Core] TargetZone attempted to bind unknown delegate: ${t}`);}get activePointerId(){return this.state.dynamicPointerId}onPointerDown(t){if(this.state.isDynamicActive)return;let e=this.calculateRelativePosition(t.clientX,t.clientY);this.setState({isDynamicActive:true,dynamicPointerId:t.pointerId,dynamicPosition:e}),this.delegates.dynamicWidgetPointerDown?.(t);}onPointerMove(t){this.state.isDynamicActive&&this.delegates.dynamicWidgetPointerMove?.(t);}onPointerUp(t){this.delegates.dynamicWidgetPointerUp?.(t),this.reset();}onPointerCancel(t){this.delegates.dynamicWidgetPointerCancel?.(t),this.reset();}calculateRelativePosition(t,e){let s=this.rect;return s?{x:chunk4J2ZANLB_cjs.w(t-s.left,s.width),y:chunk4J2ZANLB_cjs.w(e-s.top,s.height)}:{x:0,y:0}}get isInterceptorRequired(){return !!(this.config.dynamicWidgetId||this.config.preventFocusLoss)}reset(){this.setState({isDynamicActive:false,dynamicPointerId:null});}};var I=class{constructor(i={}){chunk4J2ZANLB_cjs.a(this,"options");chunk4J2ZANLB_cjs.a(this,"startTime",0);chunk4J2ZANLB_cjs.a(this,"startPos",{x:0,y:0});chunk4J2ZANLB_cjs.a(this,"lastTapTime",0);chunk4J2ZANLB_cjs.a(this,"hasMoved",false);chunk4J2ZANLB_cjs.a(this,"isDoubleTapHolding",false);this.options={tapTime:250,tapDistance:10,doubleTapGap:300,...i};}onPointerDown(i,t){let e=Date.now();this.startTime=e,this.startPos={x:i,y:t},this.hasMoved=false,e-this.lastTapTime<this.options.doubleTapGap?(this.isDoubleTapHolding=true,this.options.onDoubleTapHoldStart?.()):this.isDoubleTapHolding=false;}onPointerMove(i,t){this.hasMoved||Math.hypot(i-this.startPos.x,t-this.startPos.y)>this.options.tapDistance&&(this.hasMoved=true);}onPointerUp(){let i=Date.now(),t=i-this.startTime;this.isDoubleTapHolding?(this.isDoubleTapHolding=false,this.options.onDoubleTapHoldEnd?.(),this.lastTapTime=0):t<=this.options.tapTime&&!this.hasMoved&&(this.options.onTap?.(),i-this.lastTapTime<this.options.doubleTapGap?(this.options.onDoubleTap?.(),this.lastTapTime=0):this.lastTapTime=i);}reset(){this.isDoubleTapHolding&&this.options.onDoubleTapHoldEnd?.(),this.isDoubleTapHolding=false,this.hasMoved=false,this.startTime=0,this.lastTapTime=0;}};var $={isActive:false,isPressed:false,pointerId:null,value:0,vector:{x:0,y:0}},U=.002,Q=.3,L=class extends d{constructor(t,e,s){super(t,s||chunk4J2ZANLB_cjs.c.JOYSTICK,e,$);chunk4J2ZANLB_cjs.a(this,"emitters");chunk4J2ZANLB_cjs.a(this,"stickEmitter");chunk4J2ZANLB_cjs.a(this,"cursorEmitter");chunk4J2ZANLB_cjs.a(this,"gesture");chunk4J2ZANLB_cjs.a(this,"ticker");let o=e.targetStageId,n=e.mapping||{};this.emitters={up:new p(o,n.up),down:new p(o,n.down),left:new p(o,n.left),right:new p(o,n.right)},this.stickEmitter=new p(o,n.stick),this.cursorEmitter=new p(o,{type:"mouse"}),this.gesture=new I({onTap:async()=>{this.setState({isPressed:true}),await this.stickEmitter.tap(),this.setState({isPressed:false});},onDoubleTapHoldStart:()=>{this.setState({isPressed:true}),this.stickEmitter.press();},onDoubleTapHoldEnd:()=>{this.setState({isPressed:false}),this.stickEmitter.release(false);}}),this.ticker=z(()=>{this.handleCursorTick();});}get activePointerId(){return this.state.pointerId}onPointerDown(t){this.setState({isActive:true,pointerId:t.pointerId,vector:{x:0,y:0}}),this.gesture.onPointerDown(t.clientX,t.clientY),this.processInput(t,true);}onPointerMove(t){!this.state.isActive||t.pointerId!==this.state.pointerId||(this.gesture.onPointerMove(t.clientX,t.clientY),this.config.cursorMode&&this.ticker.start(),this.processInput(t));}onPointerUp(t){!this.state.isActive||t.pointerId!==this.state.pointerId||(this.gesture.onPointerUp(),this.handleRelease());}onPointerCancel(){this.handleRelease();}handleRelease(){this.setState({isActive:false,pointerId:null,vector:{x:0,y:0}}),this.ticker.stop(),Object.values(this.emitters).forEach(t=>t?.reset());}processInput(t,e=false){if(!this.state.isActive)return;let s=this.rect;if(!s)return;let o=s.left+s.width/2,n=s.top+s.height/2,l=s.width/2,u=s.height/2,v=(t.clientX-o)/l,P=(t.clientY-n)/u;if(e&&(v!=chunk4J2ZANLB_cjs.l(v,-1,1)||P!=chunk4J2ZANLB_cjs.l(P,-1,1))){this.setState({vector:{x:0,y:0}}),this.markRectDirty();return}let D=chunk4J2ZANLB_cjs.C({x:v,y:P},1,this.config.threshold||.15);chunk4J2ZANLB_cjs.A(D,this.state.vector,U)||(this.setState({vector:D}),this.handleDigitalKeys(D));}handleCursorTick(){let{vector:t,isActive:e}=this.state;if(!e||!this.config.cursorMode||chunk4J2ZANLB_cjs.A(t,{x:0,y:0},U)){this.ticker.stop();return}let s=this.config.cursorSensitivity??1,o={x:t.x*Math.abs(t.x)*s,y:t.y*Math.abs(t.y)*s};(Math.abs(o.x)>0||Math.abs(o.y)>0)&&this.cursorEmitter.move({delta:o});}handleDigitalKeys(t){let e=this.config.threshold??.3;t.y<-e?(this.emitters.up.press(),this.emitters.down.release()):t.y>e?(this.emitters.down.press(),this.emitters.up.release()):(this.emitters.up.release(),this.emitters.down.release()),t.x<-e?(this.emitters.left.press(),this.emitters.right.release()):t.x>e?(this.emitters.right.press(),this.emitters.left.release()):(this.emitters.left.release(),this.emitters.right.release());}reset(){this.setState($),this.gesture.reset(),this.handleRelease(),this.stickEmitter.reset(),this.cursorEmitter.reset();}updateConfig(t){super.updateConfig(t);let e=this.config.targetStageId,s=this.config.mapping||{};this.emitters.up.update(e,s.up),this.emitters.down.update(e,s.down),this.emitters.left.update(e,s.left),this.emitters.right.update(e,s.right),this.stickEmitter.update(e,s.stick),this.cursorEmitter.update(e);}triggerDown(){this.state.isPressed||(this.setState({isActive:true,isPressed:true}),this.stickEmitter.press());}triggerUp(){this.state.isPressed&&(this.setState({isActive:false,isPressed:false}),this.stickEmitter.release(true));}triggerVector(t,e){let s=this.config.threshold??.15;if(Math.hypot(t,e)<s){this.state.isActive&&this.handleRelease();return}this.state.isActive||this.setState({isActive:true});let n=chunk4J2ZANLB_cjs.m(this.state.vector.x,t,Q),l=chunk4J2ZANLB_cjs.m(this.state.vector.y,e,Q),u={x:n,y:l};chunk4J2ZANLB_cjs.A(u,this.state.vector,U)||(this.setState({vector:u}),this.handleDigitalKeys(u)),this.config.cursorMode&&this.ticker.start();}};var ot={isHighlighted:false},F=class extends d{constructor(i,t,e){super(i,e||chunk4J2ZANLB_cjs.c.ROOT_LAYER,t,ot);}reset(){}};var nt={position:{x:50,y:50},isVisible:false,isPointerDown:false,isFocusReturning:false},y=1,N=class extends d{constructor(t,e,s){super(t,s||chunk4J2ZANLB_cjs.c.TARGET_ZONE,e,nt);chunk4J2ZANLB_cjs.a(this,"hideTimer",null);chunk4J2ZANLB_cjs.a(this,"focusFeedbackTimer",null);chunk4J2ZANLB_cjs.a(this,"throttledMoveExecution");chunk4J2ZANLB_cjs.a(this,"delegates",{dispatchKeyboardEvent:()=>{},dispatchPointerEventAtPos:()=>{},reclaimFocusAtPos:()=>{}});this.throttledMoveExecution=T(o=>{this.executeMouseAction(chunk4J2ZANLB_cjs.d.POINTERMOVE,o);});}bindDelegate(t,e){Object.prototype.hasOwnProperty.call(this.delegates,t)?this.delegates[t]=e:undefined?.DEV&&console.warn(`[Omnipad-Core] TargetZone attempted to bind unknown delegate: ${t}`);}get activePointerId(){return null}onPointerDown(t){this.processPhysicalEvent(t,chunk4J2ZANLB_cjs.d.MOUSEDOWN);}onPointerMove(t){this.processPhysicalEvent(t,chunk4J2ZANLB_cjs.d.MOUSEMOVE);}onPointerUp(t){this.processPhysicalEvent(t,chunk4J2ZANLB_cjs.d.MOUSEUP),this.processPhysicalEvent(t,chunk4J2ZANLB_cjs.d.CLICK);}onPointerCancel(t){this.processPhysicalEvent(t,chunk4J2ZANLB_cjs.d.MOUSEUP);}processPhysicalEvent(t,e){let s=this.rect;if(!s)return;let o={x:chunk4J2ZANLB_cjs.w(t.clientX-s.left,s.width),y:chunk4J2ZANLB_cjs.w(t.clientY-s.top,s.height)};this.handleSignal({targetStageId:this.uid,type:e,payload:{point:o,button:t.button}});}handleSignal(t){let{type:e,payload:s}=t;switch(this.ensureFocus(),e){case chunk4J2ZANLB_cjs.d.KEYDOWN:case chunk4J2ZANLB_cjs.d.KEYUP:this.delegates.dispatchKeyboardEvent?.(e,s);break;case chunk4J2ZANLB_cjs.d.MOUSEMOVE:s.point?this.updateCursorPosition(s.point):s.delta&&this.updateCursorPositionByDelta(s.delta),this.config.cursorEnabled&&this.showCursor(),this.throttledMoveExecution(s);break;case chunk4J2ZANLB_cjs.d.MOUSEDOWN:case chunk4J2ZANLB_cjs.d.MOUSEUP:case chunk4J2ZANLB_cjs.d.CLICK:s.point&&this.updateCursorPosition(s.point),this.config.cursorEnabled&&this.showCursor(),this.executeMouseAction(e.startsWith(chunk4J2ZANLB_cjs.d.MOUSE)?e.replace(chunk4J2ZANLB_cjs.d.MOUSE,chunk4J2ZANLB_cjs.d.POINTER):e,s);break}}executeMouseAction(t,e){let s=this.rect;if(!s)return;t===chunk4J2ZANLB_cjs.d.POINTERDOWN&&this.setState({isPointerDown:true}),t===chunk4J2ZANLB_cjs.d.POINTERUP&&this.setState({isPointerDown:false});let o=e.point||this.state.position,n=chunk4J2ZANLB_cjs.l(s.left+chunk4J2ZANLB_cjs.v(o.x,s.width),s.left+y,s.left+s.width-y),l=chunk4J2ZANLB_cjs.l(s.top+chunk4J2ZANLB_cjs.v(o.y,s.height),s.top+y,s.top+s.height-y);this.delegates.dispatchPointerEventAtPos?.(t,n,l,{button:e.button??0,buttons:this.state.isPointerDown?1:0,pressure:this.state.isPointerDown?.5:0});}ensureFocus(){let t=this.rect;if(!t)return;let e=chunk4J2ZANLB_cjs.l(t.left+chunk4J2ZANLB_cjs.v(this.state.position.x,t.width),t.left+y,t.left+t.width-y),s=chunk4J2ZANLB_cjs.l(t.top+chunk4J2ZANLB_cjs.v(this.state.position.y,t.height),t.top+y,t.top+t.height-y);this.delegates.reclaimFocusAtPos?.(e,s,()=>this.triggerFocusFeedback());}triggerFocusFeedback(){this.setState({isFocusReturning:true}),this.focusFeedbackTimer&&clearTimeout(this.focusFeedbackTimer),this.focusFeedbackTimer=setTimeout(()=>this.setState({isFocusReturning:false}),500);}updateCursorPosition(t){chunk4J2ZANLB_cjs.A(t,this.state.position)||this.setState({position:{...t}});}updateCursorPositionByDelta(t){if(chunk4J2ZANLB_cjs.A(t,{x:0,y:0}))return;let e=this.rect;if(!e)return;let s=chunk4J2ZANLB_cjs.w(t.x,e.width),o=chunk4J2ZANLB_cjs.w(t.y,e.height);this.updateCursorPosition({x:chunk4J2ZANLB_cjs.l(this.state.position.x+s,0,100),y:chunk4J2ZANLB_cjs.l(this.state.position.y+o,0,100)});}showCursor(){this.setState({isVisible:true}),this.hideTimer&&clearTimeout(this.hideTimer),this.config.cursorAutoDelay&&this.config.cursorAutoDelay>0&&(this.hideTimer=setTimeout(()=>this.setState({isVisible:false}),this.config.cursorAutoDelay));}reset(){this.state.isPointerDown&&this.executeMouseAction(chunk4J2ZANLB_cjs.d.POINTERUP,{}),this.hideTimer&&clearTimeout(this.hideTimer),this.focusFeedbackTimer&&clearTimeout(this.focusFeedbackTimer),this.setState({isVisible:false,isPointerDown:false,isFocusReturning:false});}};var tt={isActive:false,isPressed:false,pointerId:null,value:0},W=class extends d{constructor(t,e,s){super(t,s||chunk4J2ZANLB_cjs.c.TRACKPAD,e,tt);chunk4J2ZANLB_cjs.a(this,"lastPointerPos",{x:0,y:0});chunk4J2ZANLB_cjs.a(this,"gesture");chunk4J2ZANLB_cjs.a(this,"emitter");let o=e.mapping||{type:"mouse"};this.emitter=new p(e.targetStageId,o),this.gesture=new I({onTap:()=>{this.setState({isPressed:true}),this.emitter.tap();},onDoubleTapHoldStart:()=>{this.setState({isPressed:true}),this.emitter.press();},onDoubleTapHoldEnd:()=>{this.setState({isPressed:false}),this.emitter.release(false);}});}get activePointerId(){return this.state.pointerId}onPointerDown(t){this.lastPointerPos={x:t.clientX,y:t.clientY},this.gesture.onPointerDown(t.clientX,t.clientY),this.setState({isActive:true,pointerId:t.pointerId});}onPointerMove(t){!this.state.isActive||t.pointerId!==this.state.pointerId||(this.gesture.onPointerMove(t.clientX,t.clientY),this.processInput(t));}processInput(t){if(!this.state.isActive)return;let e=t.clientX-this.lastPointerPos.x,s=t.clientY-this.lastPointerPos.y,o=this.rect;if(!o)return;let n=e/o.width*100*(this.config.sensitivity??1),l=s/o.height*100*(this.config.sensitivity??1),u={x:n,y:l};chunk4J2ZANLB_cjs.A(u,{x:0,y:0})||this.emitter.move({delta:u}),this.lastPointerPos={x:t.clientX,y:t.clientY};}onPointerUp(t){!this.state.isActive||t.pointerId!==this.state.pointerId||(this.gesture.onPointerUp(),this.handleRelease());}onPointerCancel(){this.handleRelease();}reset(){this.gesture.reset(),this.emitter.reset(),this.handleRelease();}updateConfig(t){super.updateConfig(t),this.emitter.update(this.config.targetStageId,this.config.mapping);}handleRelease(){this.setState(tt);}};var Ue={ActionTypes:chunk4J2ZANLB_cjs.d,Context:chunk4J2ZANLB_cjs.f,Keys:chunk4J2ZANLB_cjs.b,Types:chunk4J2ZANLB_cjs.c};Object.defineProperty(exports,"ACTION_TYPES",{enumerable:true,get:function(){return chunk4J2ZANLB_cjs.d}});Object.defineProperty(exports,"CMP_TYPES",{enumerable:true,get:function(){return chunk4J2ZANLB_cjs.c}});Object.defineProperty(exports,"CONTEXT",{enumerable:true,get:function(){return chunk4J2ZANLB_cjs.f}});Object.defineProperty(exports,"KEYS",{enumerable:true,get:function(){return chunk4J2ZANLB_cjs.b}});Object.defineProperty(exports,"Registry",{enumerable:true,get:function(){return chunk4J2ZANLB_cjs.h}});Object.defineProperty(exports,"VALID_UNITS",{enumerable:true,get:function(){return chunk4J2ZANLB_cjs.e}});Object.defineProperty(exports,"setGlobalSignalHandler",{enumerable:true,get:function(){return chunk4J2ZANLB_cjs.g}});exports.BaseEntity=d;exports.ButtonCore=B;exports.DPadCore=G;exports.ElementObserver=k;exports.GamepadManager=M;exports.InputZoneCore=H;exports.JoystickCore=L;exports.OmniPad=Ue;exports.RootLayerCore=F;exports.TargetZoneCore=N;exports.TrackpadCore=W;exports.WindowManager=Y;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as ICoreEntity, V as Vec2, G as GamepadMappingConfig,
|
|
2
|
-
export { o as ACTION_TYPES, p as ActionMapping, q as AnchorPoint, r as AnyConfig, s as AnyEntityType, t as BuiltInActionType, C as CMP_TYPES, u as CONTEXT, v as ConfigTreeNode, F as FlatConfigItem,
|
|
1
|
+
import { I as ICoreEntity, a as InputActionSignal, V as Vec2, G as GamepadMappingConfig, b as ISpatial, c as IResettable, d as IConfigurable, e as IStateful, E as EntityType, A as AbstractRect, B as ButtonConfig, f as IPointerHandler, g as IProgrammatic, h as AbstractPointerEvent, D as DPadConfig, i as InputZoneConfig, j as IDependencyBindable, k as AnyFunction, J as JoystickConfig, l as BaseConfig, T as TargetZoneConfig, m as ISignalReceiver, n as TrackpadConfig } from './index-CT1fDlB9.cjs';
|
|
2
|
+
export { o as ACTION_TYPES, p as ActionMapping, q as AnchorPoint, r as AnyConfig, s as AnyEntityType, t as BuiltInActionType, C as CMP_TYPES, u as CONTEXT, v as ConfigTreeNode, w as CssUnit, F as FlatConfigItem, x as FlexibleLength, y as GamepadProfile, z as IIdentifiable, H as ILifecycle, K as InputActionType, L as KEYS, M as KeyMapping, N as LayoutBox, P as ParsedLength, S as StageId, O as StandardButton, Q as VALID_UNITS, W as WidgetId, R as WidgetType, Z as ZoneId, U as ZoneType } from './index-CT1fDlB9.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Interface for the global Registry singleton.
|
|
@@ -55,11 +55,26 @@ interface IRegistry {
|
|
|
55
55
|
* Essential for cutting off active input signals (e.g., stuck keys) during profile reloads.
|
|
56
56
|
*/
|
|
57
57
|
resetAll(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Triggers the markRectDirty() method on all compatible entities.
|
|
60
|
+
* Essential for calibrating logical position during window resizes or scrolls.
|
|
61
|
+
*/
|
|
62
|
+
markAllRectDirty(): void;
|
|
58
63
|
/**
|
|
59
64
|
* Clears all registered entities.
|
|
60
65
|
* Used for system resets or full application unmounts.
|
|
61
66
|
*/
|
|
62
67
|
clear(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Dispatches an input action signal to a specific target entity or a global handler.
|
|
70
|
+
*
|
|
71
|
+
* @param signal - The action signal object containing the target ID and payload data.
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* dispatcher.broadcastSignal({ targetStageId: 'player_1', type: 'KEYDOWN' });
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
broadcastSignal(signal: InputActionSignal): void;
|
|
63
78
|
}
|
|
64
79
|
|
|
65
80
|
/**
|
|
@@ -218,6 +233,76 @@ declare class GamepadManager {
|
|
|
218
233
|
private triggerVirtualEntity;
|
|
219
234
|
}
|
|
220
235
|
|
|
236
|
+
/**
|
|
237
|
+
* A centralized observation pool for DOM elements.
|
|
238
|
+
*
|
|
239
|
+
* This class provides a high-performance wrapper around `ResizeObserver` (RO) and
|
|
240
|
+
* `IntersectionObserver` (IO). By pooling all element observations into single
|
|
241
|
+
* native observer instances and utilizing `requestAnimationFrame` (rAF) throttling,
|
|
242
|
+
* it significantly reduces memory footprint and prevents layout thrashing.
|
|
243
|
+
*
|
|
244
|
+
* It supports deterministic unregistration via UIDs, making it ideal for
|
|
245
|
+
* framework adapters (like Vue or React) where DOM references may become unstable
|
|
246
|
+
* during unmounting.
|
|
247
|
+
*/
|
|
248
|
+
declare class ElementObserver {
|
|
249
|
+
private _ro;
|
|
250
|
+
private _roRegistry;
|
|
251
|
+
private _elToRoCb;
|
|
252
|
+
private _io;
|
|
253
|
+
private _ioRegistry;
|
|
254
|
+
private _elToIoCb;
|
|
255
|
+
private constructor();
|
|
256
|
+
static getInstance(): ElementObserver;
|
|
257
|
+
/**
|
|
258
|
+
* Starts observing size changes for a specific element.
|
|
259
|
+
*
|
|
260
|
+
* @param uid - The unique entity ID associated with the observation.
|
|
261
|
+
* @param el - The target DOM element to observe.
|
|
262
|
+
* @param cb - Callback triggered when the element's size changes.
|
|
263
|
+
*/
|
|
264
|
+
observeResize(uid: string, el: Element, cb: () => void): void;
|
|
265
|
+
/**
|
|
266
|
+
* Stops observing size changes for the entity identified by the UID.
|
|
267
|
+
*
|
|
268
|
+
* @param uid - The unique entity ID to unregister.
|
|
269
|
+
*/
|
|
270
|
+
unobserveResize(uid: string): void;
|
|
271
|
+
/**
|
|
272
|
+
* Starts observing visibility (intersection) changes for a specific element.
|
|
273
|
+
*
|
|
274
|
+
* @param uid - The unique entity ID associated with the observation.
|
|
275
|
+
* @param el - The target DOM element to observe.
|
|
276
|
+
* @param cb - Callback triggered when visibility enters or exits the viewport.
|
|
277
|
+
*/
|
|
278
|
+
observeIntersect(uid: string, el: Element, cb: (isIntersecting: boolean) => void): void;
|
|
279
|
+
/**
|
|
280
|
+
* Stops observing intersection changes for the entity identified by the UID.
|
|
281
|
+
*
|
|
282
|
+
* @param uid - The unique entity ID to unregister.
|
|
283
|
+
*/
|
|
284
|
+
unobserveIntersect(uid: string): void;
|
|
285
|
+
/**
|
|
286
|
+
* Disconnects all observers (RO and IO) associated with a specific UID.
|
|
287
|
+
* Usually called during component destruction for thorough cleanup.
|
|
288
|
+
*
|
|
289
|
+
* @param uid - The unique entity ID to fully disconnect.
|
|
290
|
+
*/
|
|
291
|
+
disconnect(uid: string): void;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Configures the global fallback handler for action signals.
|
|
296
|
+
*
|
|
297
|
+
* @param handler - A callback function that processes signals when no specific
|
|
298
|
+
* entity target is found.
|
|
299
|
+
* @example
|
|
300
|
+
* ```typescript
|
|
301
|
+
* // In a browser environment:
|
|
302
|
+
* setGlobalSignalHandler((signal) => window.postMessage(signal, '*'));
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
declare function setGlobalSignalHandler(handler: (signal: InputActionSignal) => void): void;
|
|
221
306
|
/**
|
|
222
307
|
* Global Registry Singleton.
|
|
223
308
|
*
|
|
@@ -245,7 +330,8 @@ declare class Registry implements IRegistry {
|
|
|
245
330
|
destroyByRoot(rootUid: string): void;
|
|
246
331
|
clear(): void;
|
|
247
332
|
resetAll(): void;
|
|
248
|
-
|
|
333
|
+
markAllRectDirty(): void;
|
|
334
|
+
broadcastSignal(signal: InputActionSignal): void;
|
|
249
335
|
}
|
|
250
336
|
|
|
251
337
|
/**
|
|
@@ -332,7 +418,7 @@ declare class SimpleEmitter<T> {
|
|
|
332
418
|
* Base abstract class for all logic entities in the system.
|
|
333
419
|
* Provides fundamental identity management, state subscription, and spatial awareness.
|
|
334
420
|
*/
|
|
335
|
-
declare abstract class BaseEntity<TConfig, TState> implements ICoreEntity, ISpatial, IResettable, IConfigurable<TConfig>,
|
|
421
|
+
declare abstract class BaseEntity<TConfig, TState> implements ICoreEntity, ISpatial, IResettable, IConfigurable<TConfig>, IStateful<TState> {
|
|
336
422
|
readonly uid: string;
|
|
337
423
|
readonly type: EntityType;
|
|
338
424
|
protected config: TConfig;
|
|
@@ -340,22 +426,19 @@ declare abstract class BaseEntity<TConfig, TState> implements ICoreEntity, ISpat
|
|
|
340
426
|
protected rectProvider: (() => AbstractRect) | null;
|
|
341
427
|
private _onMarkDirtyCb;
|
|
342
428
|
protected stateEmitter: SimpleEmitter<TState>;
|
|
429
|
+
protected configEmitter: SimpleEmitter<TConfig>;
|
|
343
430
|
constructor(uid: string, type: EntityType, initialConfig: TConfig, initialState: TState);
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
protected setState(partialState: Partial<TState>): void;
|
|
431
|
+
getConfig(): Readonly<TConfig>;
|
|
432
|
+
subscribeConfig(cb: (config: TConfig) => void): () => void;
|
|
433
|
+
updateConfig(newConfig: Partial<TConfig>): void;
|
|
434
|
+
getState(): Readonly<TState>;
|
|
435
|
+
setState(partialState: Partial<TState>): void;
|
|
436
|
+
subscribeState(cb: (state: TState) => void): () => void;
|
|
351
437
|
destroy(): void;
|
|
352
438
|
abstract reset(): void;
|
|
353
439
|
get rect(): AbstractRect | null;
|
|
354
440
|
bindRectProvider(provider: () => AbstractRect, onMarkDirty?: () => void): void;
|
|
355
441
|
markRectDirty(): void;
|
|
356
|
-
updateConfig(newConfig: Partial<TConfig>): void;
|
|
357
|
-
getState(): Readonly<TState>;
|
|
358
|
-
getConfig(): Readonly<TConfig>;
|
|
359
442
|
}
|
|
360
443
|
|
|
361
444
|
/**
|
|
@@ -370,7 +453,7 @@ declare class ButtonCore extends BaseEntity<ButtonConfig, ButtonState> implement
|
|
|
370
453
|
* @param uid - The unique entity ID.
|
|
371
454
|
* @param config - The flat configuration object for the button.
|
|
372
455
|
*/
|
|
373
|
-
constructor(uid: string, config: ButtonConfig);
|
|
456
|
+
constructor(uid: string, config: ButtonConfig, customTypeName?: EntityType);
|
|
374
457
|
get activePointerId(): number | null;
|
|
375
458
|
onPointerDown(e: AbstractPointerEvent): void;
|
|
376
459
|
onPointerUp(e: AbstractPointerEvent): void;
|
|
@@ -394,7 +477,7 @@ declare class ButtonCore extends BaseEntity<ButtonConfig, ButtonState> implement
|
|
|
394
477
|
*/
|
|
395
478
|
declare class DPadCore extends BaseEntity<DPadConfig, DPadState> implements IPointerHandler, IProgrammatic {
|
|
396
479
|
private emitters;
|
|
397
|
-
constructor(uid: string, config: DPadConfig);
|
|
480
|
+
constructor(uid: string, config: DPadConfig, customTypeName?: EntityType);
|
|
398
481
|
get activePointerId(): number | null;
|
|
399
482
|
onPointerDown(e: AbstractPointerEvent): void;
|
|
400
483
|
onPointerMove(e: AbstractPointerEvent): void;
|
|
@@ -422,7 +505,7 @@ declare class DPadCore extends BaseEntity<DPadConfig, DPadState> implements IPoi
|
|
|
422
505
|
*/
|
|
423
506
|
declare class InputZoneCore extends BaseEntity<InputZoneConfig, InputZoneState> implements IPointerHandler, IDependencyBindable {
|
|
424
507
|
private delegates;
|
|
425
|
-
constructor(uid: string, config: InputZoneConfig);
|
|
508
|
+
constructor(uid: string, config: InputZoneConfig, customTypeName?: EntityType);
|
|
426
509
|
bindDelegate(key: string, delegate: AnyFunction): void;
|
|
427
510
|
get activePointerId(): number | null;
|
|
428
511
|
onPointerDown(e: AbstractPointerEvent): void;
|
|
@@ -453,7 +536,7 @@ declare class JoystickCore extends BaseEntity<JoystickConfig, JoystickState> imp
|
|
|
453
536
|
private cursorEmitter;
|
|
454
537
|
private gesture;
|
|
455
538
|
private ticker;
|
|
456
|
-
constructor(uid: string, config: JoystickConfig);
|
|
539
|
+
constructor(uid: string, config: JoystickConfig, customTypeName?: EntityType);
|
|
457
540
|
get activePointerId(): number | null;
|
|
458
541
|
onPointerDown(e: AbstractPointerEvent): void;
|
|
459
542
|
onPointerMove(e: AbstractPointerEvent): void;
|
|
@@ -489,7 +572,7 @@ declare class JoystickCore extends BaseEntity<JoystickConfig, JoystickState> imp
|
|
|
489
572
|
* identity (UID) and coordinate reference for all descendant components.
|
|
490
573
|
*/
|
|
491
574
|
declare class RootLayerCore extends BaseEntity<BaseConfig, LayerState> {
|
|
492
|
-
constructor(uid: string, config: BaseConfig);
|
|
575
|
+
constructor(uid: string, config: BaseConfig, customTypeName?: EntityType);
|
|
493
576
|
reset(): void;
|
|
494
577
|
}
|
|
495
578
|
|
|
@@ -504,7 +587,7 @@ declare class TargetZoneCore extends BaseEntity<TargetZoneConfig, CursorState> i
|
|
|
504
587
|
private focusFeedbackTimer;
|
|
505
588
|
private throttledMoveExecution;
|
|
506
589
|
private delegates;
|
|
507
|
-
constructor(uid: string, config: TargetZoneConfig);
|
|
590
|
+
constructor(uid: string, config: TargetZoneConfig, customTypeName?: EntityType);
|
|
508
591
|
bindDelegate(key: string, delegate: AnyFunction): void;
|
|
509
592
|
get activePointerId(): number | null;
|
|
510
593
|
onPointerDown(e: AbstractPointerEvent): void;
|
|
@@ -566,7 +649,7 @@ declare class TrackpadCore extends BaseEntity<TrackpadConfig, TrackpadState> imp
|
|
|
566
649
|
* @param uid - Unique entity ID.
|
|
567
650
|
* @param config - Configuration for the trackpad.
|
|
568
651
|
*/
|
|
569
|
-
constructor(uid: string, config: TrackpadConfig);
|
|
652
|
+
constructor(uid: string, config: TrackpadConfig, customTypeName?: EntityType);
|
|
570
653
|
get activePointerId(): number | null;
|
|
571
654
|
onPointerDown(e: AbstractPointerEvent): void;
|
|
572
655
|
onPointerMove(e: AbstractPointerEvent): void;
|
|
@@ -1115,4 +1198,4 @@ declare const OmniPad: {
|
|
|
1115
1198
|
};
|
|
1116
1199
|
};
|
|
1117
1200
|
|
|
1118
|
-
export { AbstractPointerEvent, AbstractRect, AnyFunction, type AxisLogicState, BaseConfig, BaseEntity, ButtonConfig, ButtonCore, type ButtonLogicState, type ButtonState, type CursorState, DPadConfig, DPadCore, type DPadState, EntityType, GamepadManager, GamepadMappingConfig, IConfigurable, ICoreEntity, IDependencyBindable,
|
|
1201
|
+
export { AbstractPointerEvent, AbstractRect, AnyFunction, type AxisLogicState, BaseConfig, BaseEntity, ButtonConfig, ButtonCore, type ButtonLogicState, type ButtonState, type CursorState, DPadConfig, DPadCore, type DPadState, ElementObserver, EntityType, GamepadManager, GamepadMappingConfig, IConfigurable, ICoreEntity, IDependencyBindable, IPointerHandler, IProgrammatic, type IRegistry, IResettable, ISignalReceiver, ISpatial, IStateful, InputActionSignal, InputZoneConfig, InputZoneCore, type InputZoneState, type InteractionState, JoystickConfig, JoystickCore, type JoystickState, type KeyboardButtonState, type LayerState, type MouseButtonState, OmniPad, Registry, RootLayerCore, TargetZoneConfig, TargetZoneCore, TrackpadConfig, TrackpadCore, type TrackpadState, Vec2, WindowManager, setGlobalSignalHandler };
|