@omnipad/core 0.4.5 → 0.5.0

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.
@@ -0,0 +1 @@
1
+ 'use strict';var chunkZHPNS73J_cjs=require('./chunk-ZHPNS73J.cjs');function x(t){let e=null,n=true;return {get:()=>((n||!e)&&(e=t(),n=false),e),markDirty:()=>{n=true;}}}var C=/^[a-zA-Z0-9\s._#$\-*>+~]+$/,y=Object.freeze(["script","onerror","eval","onload","javascript"]);function L(t,e=""){if(!t)return e;let n=t.trim();return n.length>256?e:C.test(n)?y.some(i=>n.toLowerCase().includes(i))?e:n:(undefined?.DEV&&console.warn(`[OmniPad-Core] Unsafe DOM string blocked: "${n}"`),e)}var P=/^[a-zA-Z0-9\-_]+$/;function A(t){return t?t.split(/\s+/).filter(e=>P.test(e)).join(" "):""}function r(t){if(t==null)return;if(typeof t=="object"&&"unit"in t&&"value"in t)return v(t);if(typeof t=="number")return {value:Number.isFinite(t)?t:0,unit:"px"};let e=t.trim().toLowerCase(),n=parseFloat(e);if(isNaN(n))return {value:0,unit:"px"};let i=e.slice(String(n).length).trim();return v({value:n,unit:i})}var v=t=>{let{value:e,unit:n}=t;return !isNaN(e)&&chunkZHPNS73J_cjs.e.includes(n)?{value:e,unit:n}:(console.warn(`[OmniPad-Core] Blocked invalid CSS unit: ${n}`),{value:isNaN(e)?0:e,unit:"px"})},a=t=>t==null?void 0:`${t.value}${t.unit}`;function I(t){return {...t,left:r(t.left),top:r(t.top),right:r(t.right),bottom:r(t.bottom),width:r(t.width),height:r(t.height),stickySelector:L(t.stickySelector)}}function j(t){return {...t,left:a(t.left),top:a(t.top),right:a(t.right),bottom:a(t.bottom),width:a(t.width),height:a(t.height)}}var w=t=>{if(Object.keys(t??{}).length===0)return {};let e={};e.position=t.stickySelector?"fixed":"absolute",t.isSquare&&(e.aspectRatio="1/1"),["left","top","right","bottom","width","height"].forEach(l=>{let o=t[l];if(o!=null){let h=r(o);h!=null&&(e[l]=a(h));}}),t.zIndex!==void 0&&(e.zIndex=t.zIndex);let i={"top-left":"translate(0, 0)","top-center":"translate(-50%, 0)","top-right":"translate(-100%, 0)","center-left":"translate(0, -50%)",center:"translate(-50%, -50%)","center-right":"translate(-100%, -50%)","bottom-left":"translate(0, -100%)","bottom-center":"translate(-50%, -100%)","bottom-right":"translate(-100%, -100%)"};return t.anchor&&(e.transform=i[t.anchor]),e};var T=class{constructor(e,n,i,l){this.finder=n;this.rectProvider=i;this.presenceChecker=l;chunkZHPNS73J_cjs.a(this,"_selector");chunkZHPNS73J_cjs.a(this,"_cachedTarget",null);chunkZHPNS73J_cjs.a(this,"_rectCache");this._selector=e,this._rectCache=x(()=>{let o=this.getTarget();return o?this.rectProvider(o):null});}getTarget(){return this._cachedTarget&&this.presenceChecker(this._cachedTarget)?this._cachedTarget:(this._cachedTarget=this.finder(this._selector),this._cachedTarget)}getRect(){return this._rectCache.get()}markDirty(){this._rectCache.markDirty();}updateSelector(e){return this._selector===e?false:(this._selector=e,this._cachedTarget=null,this.markDirty(),true)}};function W(t,e){let n=t.left!==void 0?r(t.left):null,i=t.right!==void 0?r(t.right):null,l=t.top!==void 0?r(t.top):null,o=t.bottom!==void 0?r(t.bottom):null,h=t.width!==void 0?r(t.width):null,f=t.height!==void 0?r(t.height):null,s=(d,_)=>d?d.unit==="%"?d.value/100*_:d.value:0,g,u;n!==null&&i!==null&&h===null?(u=e.left+s(n,e.width),g=e.right-s(i,e.width)-u):(g=h?s(h,e.width):0,n!==null?u=e.left+s(n,e.width):i!==null?u=e.right-s(i,e.width)-g:u=e.left);let p,c;return l!==null&&o!==null&&f===null?(c=e.top+s(l,e.height),p=e.bottom-s(o,e.height)-c):(p=f?s(f,e.height):0,l!==null?c=e.top+s(l,e.height):o!==null?c=e.bottom-s(o,e.height)-p:c=e.top),{...t,left:`${u}px`,top:`${c}px`,width:h||n&&i?`${g}px`:t.width,height:f||l&&o?`${p}px`:t.height,right:void 0,bottom:void 0}}exports.a=x;exports.b=y;exports.c=L;exports.d=A;exports.e=r;exports.f=v;exports.g=a;exports.h=I;exports.i=j;exports.j=w;exports.k=T;exports.l=W;
@@ -0,0 +1 @@
1
+ import {e,a as a$1}from'./chunk-PACTGVBB.mjs';function x(t){let e=null,n=true;return {get:()=>((n||!e)&&(e=t(),n=false),e),markDirty:()=>{n=true;}}}var C=/^[a-zA-Z0-9\s._#$\-*>+~]+$/,y=Object.freeze(["script","onerror","eval","onload","javascript"]);function L(t,e=""){if(!t)return e;let n=t.trim();return n.length>256?e:C.test(n)?y.some(i=>n.toLowerCase().includes(i))?e:n:(import.meta.env?.DEV&&console.warn(`[OmniPad-Core] Unsafe DOM string blocked: "${n}"`),e)}var P=/^[a-zA-Z0-9\-_]+$/;function A(t){return t?t.split(/\s+/).filter(e=>P.test(e)).join(" "):""}function r(t){if(t==null)return;if(typeof t=="object"&&"unit"in t&&"value"in t)return v(t);if(typeof t=="number")return {value:Number.isFinite(t)?t:0,unit:"px"};let e=t.trim().toLowerCase(),n=parseFloat(e);if(isNaN(n))return {value:0,unit:"px"};let i=e.slice(String(n).length).trim();return v({value:n,unit:i})}var v=t=>{let{value:e$1,unit:n}=t;return !isNaN(e$1)&&e.includes(n)?{value:e$1,unit:n}:(console.warn(`[OmniPad-Core] Blocked invalid CSS unit: ${n}`),{value:isNaN(e$1)?0:e$1,unit:"px"})},a=t=>t==null?void 0:`${t.value}${t.unit}`;function I(t){return {...t,left:r(t.left),top:r(t.top),right:r(t.right),bottom:r(t.bottom),width:r(t.width),height:r(t.height),stickySelector:L(t.stickySelector)}}function j(t){return {...t,left:a(t.left),top:a(t.top),right:a(t.right),bottom:a(t.bottom),width:a(t.width),height:a(t.height)}}var w=t=>{if(Object.keys(t??{}).length===0)return {};let e={};e.position=t.stickySelector?"fixed":"absolute",t.isSquare&&(e.aspectRatio="1/1"),["left","top","right","bottom","width","height"].forEach(l=>{let o=t[l];if(o!=null){let h=r(o);h!=null&&(e[l]=a(h));}}),t.zIndex!==void 0&&(e.zIndex=t.zIndex);let i={"top-left":"translate(0, 0)","top-center":"translate(-50%, 0)","top-right":"translate(-100%, 0)","center-left":"translate(0, -50%)",center:"translate(-50%, -50%)","center-right":"translate(-100%, -50%)","bottom-left":"translate(0, -100%)","bottom-center":"translate(-50%, -100%)","bottom-right":"translate(-100%, -100%)"};return t.anchor&&(e.transform=i[t.anchor]),e};var T=class{constructor(e,n,i,l){this.finder=n;this.rectProvider=i;this.presenceChecker=l;a$1(this,"_selector");a$1(this,"_cachedTarget",null);a$1(this,"_rectCache");this._selector=e,this._rectCache=x(()=>{let o=this.getTarget();return o?this.rectProvider(o):null});}getTarget(){return this._cachedTarget&&this.presenceChecker(this._cachedTarget)?this._cachedTarget:(this._cachedTarget=this.finder(this._selector),this._cachedTarget)}getRect(){return this._rectCache.get()}markDirty(){this._rectCache.markDirty();}updateSelector(e){return this._selector===e?false:(this._selector=e,this._cachedTarget=null,this.markDirty(),true)}};function W(t,e){let n=t.left!==void 0?r(t.left):null,i=t.right!==void 0?r(t.right):null,l=t.top!==void 0?r(t.top):null,o=t.bottom!==void 0?r(t.bottom):null,h=t.width!==void 0?r(t.width):null,f=t.height!==void 0?r(t.height):null,s=(d,_)=>d?d.unit==="%"?d.value/100*_:d.value:0,g,u;n!==null&&i!==null&&h===null?(u=e.left+s(n,e.width),g=e.right-s(i,e.width)-u):(g=h?s(h,e.width):0,n!==null?u=e.left+s(n,e.width):i!==null?u=e.right-s(i,e.width)-g:u=e.left);let p,c;return l!==null&&o!==null&&f===null?(c=e.top+s(l,e.height),p=e.bottom-s(o,e.height)-c):(p=f?s(f,e.height):0,l!==null?c=e.top+s(l,e.height):o!==null?c=e.bottom-s(o,e.height)-p:c=e.top),{...t,left:`${u}px`,top:`${c}px`,width:h||n&&i?`${g}px`:t.width,height:f||l&&o?`${p}px`:t.height,right:void 0,bottom:void 0}}export{x as a,y as b,L as c,A as d,r as e,v as f,a as g,I as h,j as i,w as j,T as k,W as l};
@@ -1 +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};
1
+ var l=Object.defineProperty;var m=(t,e,o)=>e in t?l(t,e,{enumerable:true,configurable:true,writable:true,value:o}):t[e]=o;var C=(t,e,o)=>m(t,typeof e!="symbol"?e+"":e,o);var f={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}},T=f;var P={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"},S={KEYDOWN:"keydown",KEYUP:"keyup",POINTER:"pointer",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",MOUSE:"mouse",MOUSEMOVE:"mousemove",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",CLICK:"click"},A=["px","%","vh","vw","rem","em"],N={PARENT_ID_KEY:"omnipad-parent-id-link"};var a=Symbol.for("omnipad.registry.instance"),p=null;function F(t){p=t;}var u=class t{constructor(){C(this,"entities",new Map);import.meta.env?.DEV&&console.log("[OmniPad-Core] Registry initialized.");}static getInstance(){let e=globalThis;return e[a]||(e[a]=new t),e[a]}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 y=new Map;o.forEach(d=>{let n=d;if(typeof n.getConfig=="function"){let i=n.getConfig();i.parentId&&(y.has(i.parentId)||y.set(i.parentId,[]),y.get(i.parentId).push(d));}});let c=[],k=[e],s=new Set;for(;k.length>0;){let d=k.shift();if(s.has(d))continue;s.add(d);let n=this.entities.get(d);if(n){c.push(n);let i=y.get(d);i&&i.forEach(g=>k.push(g.uid));}}return c}destroyByRoot(e){let o=this.getEntitiesByRoot(e);for(let r=o.length-1;r>=0;r--){let y=o[r];try{y.destroy();}catch(c){console.error(`[OmniPad-Core] Error during destroyByRoot at ${y.uid}:`,c);}}}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):p&&p(e);}};export{C as a,T as b,P as c,S as d,A as e,N as f,F as g,u as h};
@@ -0,0 +1 @@
1
+ 'use strict';var y=(e,n)=>({x:e.x-n.x,y:e.y-n.y}),p=(e,n)=>({x:e.x+n.x,y:e.y+n.y}),b=(e,n)=>({x:e.x*n,y:e.y*n}),a=(e,n,r)=>Math.max(n,Math.min(r,e)),s=(e,n,r)=>e+(n-e)*r,m=(e,n=2)=>{let r=Math.pow(10,n);return Math.round(e*r)/r},V=(e,n)=>Math.hypot(n.x-e.x,n.y-e.y),h=(e,n)=>Math.atan2(n.y-e.y,n.x-e.x),M=e=>e*180/Math.PI,d=e=>e*Math.PI/180,l=(e,n,r)=>{let t=n.x-e.x,c=n.y-e.y;if(Math.hypot(t,c)<=r)return n;let u=Math.atan2(c,t);return {x:e.x+Math.cos(u)*r,y:e.y+Math.sin(u)*r}},i=e=>{let n=Math.PI/4;return Math.round(e/n)*n},T=e=>{let n=Math.PI/2;return Math.round(e/n)*n},D=(e,n)=>m(e*n/100),f=(e,n)=>n===0?0:m(e*100/n),g=e=>{let n=Math.hypot(e.x,e.y);return n===0?{x:0,y:0}:{x:e.x/n,y:e.y/n}},P=e=>({x:Math.cos(e),y:Math.sin(e)}),z=(e,n,r,t,c)=>{let o=(e-n)/(r-n);return s(t,c,a(o,0,1))},I=(e,n,r=1e-4)=>Math.abs(e.x-n.x)<r&&Math.abs(e.y-n.y)<r,x=(e,n,r)=>{if(e<n)return 0;let t=(e-n)/(r-n);return a(t,0,1)},k=(e,n,r)=>{let t=Math.hypot(e.x,e.y),c=n*r,o=x(t,c,n);if(o===0)return {x:0,y:0};let u={x:e.x/t,y:e.y/t};return b(u,o)},A=(e,n,r)=>({x:x(Math.abs(e.x),n,r)*Math.sign(e.x),y:x(Math.abs(e.y),n,r)*Math.sign(e.y)});exports.a=y;exports.b=p;exports.c=b;exports.d=a;exports.e=s;exports.f=m;exports.g=V;exports.h=h;exports.i=M;exports.j=d;exports.k=l;exports.l=i;exports.m=T;exports.n=D;exports.o=f;exports.p=g;exports.q=P;exports.r=z;exports.s=I;exports.t=x;exports.u=k;exports.v=A;
@@ -0,0 +1 @@
1
+ var y=(e,n)=>({x:e.x-n.x,y:e.y-n.y}),p=(e,n)=>({x:e.x+n.x,y:e.y+n.y}),b=(e,n)=>({x:e.x*n,y:e.y*n}),a=(e,n,r)=>Math.max(n,Math.min(r,e)),s=(e,n,r)=>e+(n-e)*r,m=(e,n=2)=>{let r=Math.pow(10,n);return Math.round(e*r)/r},V=(e,n)=>Math.hypot(n.x-e.x,n.y-e.y),h=(e,n)=>Math.atan2(n.y-e.y,n.x-e.x),M=e=>e*180/Math.PI,d=e=>e*Math.PI/180,l=(e,n,r)=>{let t=n.x-e.x,c=n.y-e.y;if(Math.hypot(t,c)<=r)return n;let u=Math.atan2(c,t);return {x:e.x+Math.cos(u)*r,y:e.y+Math.sin(u)*r}},i=e=>{let n=Math.PI/4;return Math.round(e/n)*n},T=e=>{let n=Math.PI/2;return Math.round(e/n)*n},D=(e,n)=>m(e*n/100),f=(e,n)=>n===0?0:m(e*100/n),g=e=>{let n=Math.hypot(e.x,e.y);return n===0?{x:0,y:0}:{x:e.x/n,y:e.y/n}},P=e=>({x:Math.cos(e),y:Math.sin(e)}),z=(e,n,r,t,c)=>{let o=(e-n)/(r-n);return s(t,c,a(o,0,1))},I=(e,n,r=1e-4)=>Math.abs(e.x-n.x)<r&&Math.abs(e.y-n.y)<r,x=(e,n,r)=>{if(e<n)return 0;let t=(e-n)/(r-n);return a(t,0,1)},k=(e,n,r)=>{let t=Math.hypot(e.x,e.y),c=n*r,o=x(t,c,n);if(o===0)return {x:0,y:0};let u={x:e.x/t,y:e.y/t};return b(u,o)},A=(e,n,r)=>({x:x(Math.abs(e.x),n,r)*Math.sign(e.x),y:x(Math.abs(e.y),n,r)*Math.sign(e.y)});export{y as a,p as b,b as c,a as d,s as e,m as f,V as g,h,M as i,d as j,l as k,i as l,T as m,D as n,f as o,g as p,P as q,z as r,I as s,x as t,k as u,A as v};
@@ -0,0 +1 @@
1
+ 'use strict';var l=typeof globalThis<"u"&&globalThis.requestAnimationFrame?globalThis.requestAnimationFrame.bind(globalThis):n=>setTimeout(n,16),i=typeof globalThis<"u"&&globalThis.cancelAnimationFrame?globalThis.cancelAnimationFrame.bind(globalThis):n=>clearTimeout(n);function a(n){let e=false,t;return function(o){t=o,e||(e=true,l(()=>{n(t),e=false;}));}}function r(n){let e=null,t=()=>{n(),e=l(t);};return {start:()=>{e===null&&t();},stop:()=>{e!==null&&(i(e),e=null);}}}var s=(n=2)=>new Promise(e=>{let t=0,o=()=>{++t>=n?e():l(o);};l(o);});exports.a=a;exports.b=r;exports.c=s;
@@ -1 +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;
1
+ 'use strict';var l=Object.defineProperty;var m=(t,e,o)=>e in t?l(t,e,{enumerable:true,configurable:true,writable:true,value:o}):t[e]=o;var C=(t,e,o)=>m(t,typeof e!="symbol"?e+"":e,o);var f={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}},T=f;var P={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"},S={KEYDOWN:"keydown",KEYUP:"keyup",POINTER:"pointer",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",MOUSE:"mouse",MOUSEMOVE:"mousemove",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",CLICK:"click"},A=["px","%","vh","vw","rem","em"],N={PARENT_ID_KEY:"omnipad-parent-id-link"};var a=Symbol.for("omnipad.registry.instance"),p=null;function F(t){p=t;}var u=class t{constructor(){C(this,"entities",new Map);undefined?.DEV&&console.log("[OmniPad-Core] Registry initialized.");}static getInstance(){let e=globalThis;return e[a]||(e[a]=new t),e[a]}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 y=new Map;o.forEach(d=>{let n=d;if(typeof n.getConfig=="function"){let i=n.getConfig();i.parentId&&(y.has(i.parentId)||y.set(i.parentId,[]),y.get(i.parentId).push(d));}});let c=[],k=[e],s=new Set;for(;k.length>0;){let d=k.shift();if(s.has(d))continue;s.add(d);let n=this.entities.get(d);if(n){c.push(n);let i=y.get(d);i&&i.forEach(g=>k.push(g.uid));}}return c}destroyByRoot(e){let o=this.getEntitiesByRoot(e);for(let r=o.length-1;r>=0;r--){let y=o[r];try{y.destroy();}catch(c){console.error(`[OmniPad-Core] Error during destroyByRoot at ${y.uid}:`,c);}}}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):p&&p(e);}};exports.a=C;exports.b=T;exports.c=P;exports.d=S;exports.e=A;exports.f=N;exports.g=F;exports.h=u;
@@ -0,0 +1 @@
1
+ var l=typeof globalThis<"u"&&globalThis.requestAnimationFrame?globalThis.requestAnimationFrame.bind(globalThis):n=>setTimeout(n,16),i=typeof globalThis<"u"&&globalThis.cancelAnimationFrame?globalThis.cancelAnimationFrame.bind(globalThis):n=>clearTimeout(n);function a(n){let e=false,t;return function(o){t=o,e||(e=true,l(()=>{n(t),e=false;}));}}function r(n){let e=null,t=()=>{n(),e=l(t);};return {start:()=>{e===null&&t();},stop:()=>{e!==null&&(i(e),e=null);}}}var s=(n=2)=>new Promise(e=>{let t=0,o=()=>{++t>=n?e():l(o);};l(o);});export{a,r as b,s as c};
@@ -0,0 +1 @@
1
+ 'use strict';var chunkVHF3K5X6_cjs=require('../chunk-VHF3K5X6.cjs'),chunkFSJTQU4W_cjs=require('../chunk-FSJTQU4W.cjs'),chunkZHPNS73J_cjs=require('../chunk-ZHPNS73J.cjs');var m=(n,t,e="omnipad-prevent")=>{let i=document.elementsFromPoint(n,t).find(s=>!s.classList.contains(e));if(!i)return null;for(;i&&i.shadowRoot;){let a=i.shadowRoot.elementsFromPoint(n,t).find(l=>!l.classList.contains(e));if(!a||a===i)break;i=a;}return i},g=()=>{let n=document.activeElement;for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n},R=n=>{if(!n)return null;if(n.startsWith("#")){let t=n.slice(1),e=document.getElementById(t);if(e)return e}try{return document.querySelector(n)}catch{return null}};var x=n=>{g()!==n&&(n.hasAttribute("tabindex")||n.setAttribute("tabindex","-1"),n.focus());},M=(n,t)=>{let e=new KeyboardEvent(n,{...t,which:t.keyCode,bubbles:true,cancelable:true,view:window});window.dispatchEvent(e);},D=(n,t,e,r)=>{let i=m(t,e);if(!i)return;let s={bubbles:true,cancelable:true,composed:true,clientX:t,clientY:e,view:window,...r};if(n.startsWith("pointer")){i.dispatchEvent(new PointerEvent(n,{isPrimary:true,pointerId:9999,pointerType:"mouse",...s}));let a=n.replace("pointer","mouse");i.dispatchEvent(new MouseEvent(a,s));}else i.dispatchEvent(new MouseEvent(n,s));},L=(n,t,e)=>{let r=m(n,t);if(!r)return;g()!==r&&(x(r),e());};var w=(n,t)=>{if(n instanceof Element)try{n.setPointerCapture(t);}catch(e){undefined?.DEV&&console.warn("[OmniPad-DOM] Failed to set pointer capture:",e);}},f=(n,t)=>{if(n instanceof Element&&n.hasPointerCapture(t))try{n.releasePointerCapture(t);}catch{}};function O(n,t={}){return {onPointerDown(e){if(!e.isTrusted||t?.requireDirectHit&&e.target!==e.currentTarget||n.activePointerId!=null)return;e.cancelable&&e.preventDefault(),e.stopPropagation();let r=e.currentTarget;r&&w(r,e.pointerId),n.onPointerDown(e);},onPointerMove(e){e.isTrusted&&(n.activePointerId!=null&&n.activePointerId!==e.pointerId||(e.cancelable&&e.preventDefault(),n.onPointerMove(e)));},onPointerUp(e){if(!e.isTrusted||n.activePointerId!=null&&n.activePointerId!==e.pointerId)return;e.cancelable&&e.preventDefault();let r=e.currentTarget;r&&f(r,e.pointerId),n.onPointerUp(e);},onPointerCancel(e){if(!e.isTrusted||n.activePointerId!=null&&n.activePointerId!==e.pointerId)return;let r=e.currentTarget;r&&f(r,e.pointerId),n.onPointerCancel(e);}}}var p,z=()=>(p!==void 0||(p=typeof window<"u"&&!!window.CSS?.supports?.("width: 1cqw")),p);var U=n=>new chunkFSJTQU4W_cjs.k(n,t=>R(t),t=>t.getBoundingClientRect(),t=>document.contains(t));var h=Symbol.for("omnipad.element_observer.instance"),y=class n{constructor(){chunkZHPNS73J_cjs.a(this,"_ro");chunkZHPNS73J_cjs.a(this,"_roRegistry",new Map);chunkZHPNS73J_cjs.a(this,"_elToRoCb",new WeakMap);chunkZHPNS73J_cjs.a(this,"_io");chunkZHPNS73J_cjs.a(this,"_ioRegistry",new Map);chunkZHPNS73J_cjs.a(this,"_elToIoCb",new WeakMap);let t=chunkVHF3K5X6_cjs.a(e=>{for(let r of e)this._elToRoCb.get(r.target)?.();});this._ro=new ResizeObserver(e=>{t(e);}),this._io=new IntersectionObserver(e=>{for(let r of e)this._elToIoCb.get(r.target)?.(r.isIntersecting);},{threshold:0});}static getInstance(){let t=globalThis;return t[h]||(t[h]=new n),t[h]}observeResize(t,e,r){this.unobserveResize(t),this._roRegistry.set(t,e),this._elToRoCb.set(e,r),this._ro.observe(e);}unobserveResize(t){let e=this._roRegistry.get(t);e&&(this._ro.unobserve(e),this._elToRoCb.delete(e),this._roRegistry.delete(t));}observeIntersect(t,e,r){this.unobserveIntersect(t),this._ioRegistry.set(t,e),this._elToIoCb.set(e,r),this._io.observe(e);}unobserveIntersect(t){let e=this._ioRegistry.get(t);e&&(this._io.unobserve(e),this._elToIoCb.delete(e),this._ioRegistry.delete(t));}disconnect(t){this.unobserveResize(t),this.unobserveIntersect(t);}};var v=Symbol.for("omnipad.gamepad_manager.instance"),_={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},P=class n{constructor(){chunkZHPNS73J_cjs.a(this,"isRunning",false);chunkZHPNS73J_cjs.a(this,"config",null);chunkZHPNS73J_cjs.a(this,"lastButtonStates",[]);chunkZHPNS73J_cjs.a(this,"loop",()=>{if(!this.isRunning)return;let t=navigator.getGamepads();this.config?.forEach((e,r)=>{let i=t[r];i&&i.connected&&e&&(this.lastButtonStates[r]||(this.lastButtonStates[r]=[]),this.processButtons(i,e,r),this.processDPad(i,e),this.processAxes(i,e));}),requestAnimationFrame(this.loop);});}static getInstance(){let t=globalThis;return t[v]||(t[v]=new n),t[v]}setConfig(t){this.config=t;}getConfig(){return this.config}start(){this.isRunning||(this.isRunning=true,window.addEventListener("gamepadconnected",t=>{undefined?.DEV&&console.log("[OmniPad-DOM] Gamepad Connected:",t.gamepad.id);}),window.addEventListener("gamepaddisconnected",()=>{undefined?.DEV&&console.log("[OmniPad-DOM] Gamepad disconnected.");}),this.loop());}stop(){this.isRunning=false;}processButtons(t,e,r){e.buttons&&Object.entries(e.buttons).forEach(([i,s])=>{let a=_[i];if(a===void 0||!t.buttons[a])return;let l=t.buttons[a].pressed,u=this.lastButtonStates[r][a]||false;l&&!u?this.triggerVirtualEntity(s,"down"):!l&&u&&this.triggerVirtualEntity(s,"up"),this.lastButtonStates[r][a]=l;});}processDPad(t,e){let r=e?.dpad;if(!r)return;let i=t.buttons[12]?.pressed?-1:0,s=t.buttons[13]?.pressed?1:0,a=t.buttons[14]?.pressed?-1:0,l=t.buttons[15]?.pressed?1:0,u=a+l,C=i+s;this.triggerVirtualEntity(r,"vector",{x:u,y:C});}processAxes(t,e){let r=e?.deadzone??.1;if(e?.leftStick){let i=Math.abs(t.axes[0])>r?t.axes[0]:0,s=Math.abs(t.axes[1])>r?t.axes[1]:0;this.triggerVirtualEntity(e.leftStick,"vector",{x:i,y:s});}if(e?.rightStick){let i=Math.abs(t.axes[2])>r?t.axes[2]:0,s=Math.abs(t.axes[3])>r?t.axes[3]:0;this.triggerVirtualEntity(e.rightStick,"vector",{x:i,y:s});}}triggerVirtualEntity(t,e,r){let i=chunkZHPNS73J_cjs.h.getInstance().getEntity(t);!i||i.activePointerId!=null||(e==="down"&&typeof i.triggerDown=="function"&&i.triggerDown(),e==="up"&&typeof i.triggerUp=="function"&&i.triggerUp(),e==="vector"&&typeof i.triggerVector=="function"&&r&&i.triggerVector(r.x,r.y));}};var b=Symbol.for("omnipad.window_manager.instance"),I=class n{constructor(){chunkZHPNS73J_cjs.a(this,"_isListening",false);chunkZHPNS73J_cjs.a(this,"throttledReset");chunkZHPNS73J_cjs.a(this,"handleGlobalReset",()=>{undefined?.DEV&&console.debug("[OmniPad-Core] Safety reset triggered by environment change."),chunkZHPNS73J_cjs.h.getInstance().resetAll(),chunkZHPNS73J_cjs.h.getInstance().markAllRectDirty();});chunkZHPNS73J_cjs.a(this,"handleResizeReset",()=>{this.throttledReset(null);});chunkZHPNS73J_cjs.a(this,"handleBlurReset",()=>{this.handleGlobalReset();});chunkZHPNS73J_cjs.a(this,"handleScrollReset",()=>{this.throttledReset(null);});chunkZHPNS73J_cjs.a(this,"handleVisibilityChangeReset",()=>{document.visibilityState==="hidden"&&this.handleGlobalReset();});this.throttledReset=chunkVHF3K5X6_cjs.a(()=>{this.handleGlobalReset();});}static getInstance(){let t=globalThis;return t[b]||(t[b]=new n),t[b]}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(t){let e=t||document.documentElement;try{document.fullscreenElement?(this.handleGlobalReset(),await document.exitFullscreen()):(this.handleGlobalReset(),await e.requestFullscreen());}catch(r){console.error("[OmniPad-Core] Fullscreen toggle failed:",r);}}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;}};exports.ElementObserver=y;exports.GamepadManager=P;exports.WindowManager=I;exports.createPointerBridge=O;exports.createWebStickyProvider=U;exports.dispatchKeyboardEvent=M;exports.dispatchPointerEventAtPos=D;exports.focusElement=x;exports.getDeepActiveElement=g;exports.getDeepElement=m;exports.reclaimFocusAtPos=L;exports.safeReleaseCapture=f;exports.safeSetCapture=w;exports.smartQuerySelector=R;exports.supportsContainerQueries=z;
@@ -0,0 +1,306 @@
1
+ import { e as IPointerHandler } from '../traits-D6ePqSA6.cjs';
2
+ import { S as StickyProvider } from '../sticky-4yk5DLzG.cjs';
3
+ import { G as GamepadMappingConfig } from '../index-DVegtw8s.cjs';
4
+
5
+ /**
6
+ * Forcefully focuses an element.
7
+ * Automatically handles the 'tabindex' attribute to ensure non-focusable elements (like Canvas)
8
+ * can receive focus.
9
+ *
10
+ * @param el - The target HTMLElement to focus.
11
+ */
12
+ declare const focusElement: (el: HTMLElement) => void;
13
+ /**
14
+ * Dispatches a synthetic KeyboardEvent to the window object.
15
+ *
16
+ * @param type - The event type, e.g., 'keydown' or 'keyup'.
17
+ * @param payload - Key mapping data including key, code, and legacy keyCode.
18
+ */
19
+ declare const dispatchKeyboardEvent: (type: string, payload: {
20
+ key: string;
21
+ code: string;
22
+ keyCode: number;
23
+ }) => void;
24
+ /**
25
+ * Dispatches a high-fidelity sequence of Pointer and Mouse events at specific pixel coordinates.
26
+ * Finds the target element dynamically at the moment of dispatch.
27
+ *
28
+ * @param type - The event type (should start with 'pointer' for best compatibility).
29
+ * @param x - Viewport X coordinate (px).
30
+ * @param y - Viewport Y coordinate (px).
31
+ * @param opts - Additional PointerEvent options (button, pressure, etc.).
32
+ */
33
+ declare const dispatchPointerEventAtPos: (type: string, x: number, y: number, opts: {
34
+ button: number;
35
+ buttons: number;
36
+ pressure: number;
37
+ }) => void;
38
+ /**
39
+ * Reclaims browser focus for the element located at the specified viewport coordinates.
40
+ *
41
+ * This utility identifies the deepest element (penetrating Shadow DOM) at the given position
42
+ * and ensures it becomes the active element. It is essential for ensuring that
43
+ * game engines (like Ruffle) receive keyboard events immediately after a virtual interaction.
44
+ *
45
+ * @param x - The horizontal coordinate relative to the viewport.
46
+ * @param y - The vertical coordinate relative to the viewport.
47
+ * @returns True if the focus was successfully moved to the target; false if it was already focused or no target found.
48
+ */
49
+ declare const reclaimFocusAtPos: (x: number, y: number, callback: () => void) => void;
50
+
51
+ /**
52
+ * Creates a standardized bridge between native DOM PointerEvents and Core abstract handlers.
53
+ * Handles event prevention, stop propagation, pointer capture, and multi-touch filtering.
54
+ *
55
+ * @param coreHandler - The logic core instance that implements IPointerHandler.
56
+ * @param getElement - A getter function to retrieve the DOM element for pointer capture.
57
+ * @returns An object containing mapped event handlers for Vue/React template binding.
58
+ */
59
+ declare function createPointerBridge(coreHandler: IPointerHandler & {
60
+ activePointerId?: number | null;
61
+ }, options?: {
62
+ /** Respond only to direct clicks (without responding to events bubbled up from child elements) */
63
+ requireDirectHit?: boolean;
64
+ }): {
65
+ /**
66
+ * Entry point for a pointer interaction.
67
+ * Establishes capture and initializes core logic.
68
+ */
69
+ onPointerDown(e: PointerEvent): void;
70
+ /**
71
+ * Continuous movement handling.
72
+ * Throttling should be handled within the core implementation.
73
+ */
74
+ onPointerMove(e: PointerEvent): void;
75
+ /**
76
+ * Successful interaction completion.
77
+ * Filters by pointerId to ensure only the capturing finger triggers release.
78
+ */
79
+ onPointerUp(e: PointerEvent): void;
80
+ /**
81
+ * System-level interaction cancellation (e.g., alert popups, browser gestures).
82
+ */
83
+ onPointerCancel(e: PointerEvent): void;
84
+ };
85
+
86
+ /**
87
+ * Safely sets pointer capture on an element.
88
+ *
89
+ * @param el - The target element to capture the pointer.
90
+ * @param pointerId - The unique ID of the pointer (from PointerEvent).
91
+ */
92
+ declare const safeSetCapture: (el: EventTarget | null, pointerId: number) => void;
93
+ /**
94
+ * Safely releases pointer capture from an element.
95
+ * Checks for current capture state and wraps in try-catch to prevent crashes.
96
+ *
97
+ * @param el - The target element.
98
+ * @param pointerId - The unique ID of the pointer to release.
99
+ */
100
+ declare const safeReleaseCapture: (el: EventTarget | null, pointerId: number) => void;
101
+
102
+ declare const supportsContainerQueries: () => boolean;
103
+
104
+ /**
105
+ * Recursively penetrates Shadow DOM boundaries to find the deepest element at the
106
+ * specified viewport coordinates.
107
+ *
108
+ * @param x - Viewport X coordinate (px)
109
+ * @param y - Viewport Y coordinate (px)
110
+ * @param ignoreClass - Style class of DOM elements to be ignored
111
+ * @returns The deepmost Element or null if none found at the position.
112
+ */
113
+ declare const getDeepElement: (x: number, y: number, ignoreClass?: string) => Element | null;
114
+ /**
115
+ * Recursively finds the truly focused element by traversing Shadow DOM boundaries.
116
+ *
117
+ * @returns The deepmost active Element in focus or null.
118
+ */
119
+ declare const getDeepActiveElement: () => Element | null;
120
+ /**
121
+ * A robust wrapper for selecting a single DOM element.
122
+ *
123
+ *
124
+ * @param selector - A string containing one or more selectors to match.
125
+ * @returns The first {@link Element} that matches the specified selector, or `null` if no matches are found or the selector is invalid.
126
+ *
127
+ * @example
128
+ * // Handles special characters in IDs gracefully
129
+ * smartQuerySelector('#my.id$with:special-chars');
130
+ * // Falls back to standard CSS selectors
131
+ * smartQuerySelector('.container > div:first-child');
132
+ */
133
+ declare const smartQuerySelector: (selector: string) => Element | null;
134
+
135
+ /**
136
+ * Creates a StickyProvider pre-configured for the Web environment.
137
+ */
138
+ declare const createWebStickyProvider: (selector: string) => StickyProvider;
139
+
140
+ /**
141
+ * A centralized observation pool for DOM elements.
142
+ *
143
+ * This class provides a high-performance wrapper around `ResizeObserver` (RO) and
144
+ * `IntersectionObserver` (IO). By pooling all element observations into single
145
+ * native observer instances and utilizing `requestAnimationFrame` (rAF) throttling,
146
+ * it significantly reduces memory footprint and prevents layout thrashing.
147
+ *
148
+ * It supports deterministic unregistration via UIDs, making it ideal for
149
+ * framework adapters (like Vue or React) where DOM references may become unstable
150
+ * during unmounting.
151
+ */
152
+ declare class ElementObserver {
153
+ private _ro;
154
+ private _roRegistry;
155
+ private _elToRoCb;
156
+ private _io;
157
+ private _ioRegistry;
158
+ private _elToIoCb;
159
+ private constructor();
160
+ static getInstance(): ElementObserver;
161
+ /**
162
+ * Starts observing size changes for a specific element.
163
+ *
164
+ * @param uid - The unique entity ID associated with the observation.
165
+ * @param el - The target DOM element to observe.
166
+ * @param cb - Callback triggered when the element's size changes.
167
+ */
168
+ observeResize(uid: string, el: Element, cb: () => void): void;
169
+ /**
170
+ * Stops observing size changes for the entity identified by the UID.
171
+ *
172
+ * @param uid - The unique entity ID to unregister.
173
+ */
174
+ unobserveResize(uid: string): void;
175
+ /**
176
+ * Starts observing visibility (intersection) changes for a specific element.
177
+ *
178
+ * @param uid - The unique entity ID associated with the observation.
179
+ * @param el - The target DOM element to observe.
180
+ * @param cb - Callback triggered when visibility enters or exits the viewport.
181
+ */
182
+ observeIntersect(uid: string, el: Element, cb: (isIntersecting: boolean) => void): void;
183
+ /**
184
+ * Stops observing intersection changes for the entity identified by the UID.
185
+ *
186
+ * @param uid - The unique entity ID to unregister.
187
+ */
188
+ unobserveIntersect(uid: string): void;
189
+ /**
190
+ * Disconnects all observers (RO and IO) associated with a specific UID.
191
+ * Usually called during component destruction for thorough cleanup.
192
+ *
193
+ * @param uid - The unique entity ID to fully disconnect.
194
+ */
195
+ disconnect(uid: string): void;
196
+ }
197
+
198
+ /**
199
+ * GamepadManager
200
+ *
201
+ * A singleton service that polls the browser Gamepad API via requestAnimationFrame.
202
+ * It translates physical hardware inputs into programmatic signals sent to
203
+ * virtual entities registered in the system.
204
+ *
205
+ * Handles:
206
+ * 1. Button edge detection (Down/Up).
207
+ * 2. D-Pad to vector conversion.
208
+ * 3. Analog stick deadzone processing.
209
+ */
210
+ declare class GamepadManager {
211
+ private isRunning;
212
+ private config;
213
+ private lastButtonStates;
214
+ private constructor();
215
+ /**
216
+ * Retrieves the global singleton instance of the GamepadManager.
217
+ */
218
+ static getInstance(): GamepadManager;
219
+ /**
220
+ * Updates the current gamepad mapping configuration.
221
+ *
222
+ * @param config - The mapping of physical inputs to virtual component IDs (UID).
223
+ */
224
+ setConfig(config: GamepadMappingConfig[]): void;
225
+ /** Return the current gamepad mapping configuration. */
226
+ getConfig(): Readonly<GamepadMappingConfig[] | null>;
227
+ /**
228
+ * Starts the polling loop and listens for gamepad connection events.
229
+ */
230
+ start(): void;
231
+ /**
232
+ * Stops the polling loop.
233
+ */
234
+ stop(): void;
235
+ /**
236
+ * The core polling loop executing at the browser's refresh rate.
237
+ */
238
+ private loop;
239
+ /**
240
+ * Process binary button inputs with edge detection.
241
+ */
242
+ private processButtons;
243
+ /**
244
+ * Translates physical D-Pad buttons into a normalized vector.
245
+ */
246
+ private processDPad;
247
+ /**
248
+ * Process analog stick movements with deadzone logic.
249
+ */
250
+ private processAxes;
251
+ /**
252
+ * Locates a virtual entity and triggers its programmatic interface.
253
+ *
254
+ * @param uid - The Entity ID (UID) of the target.
255
+ * @param action - The type of trigger ('down', 'up', or 'vector').
256
+ * @param payload - Optional data for vector movements.
257
+ */
258
+ private triggerVirtualEntity;
259
+ }
260
+
261
+ /**
262
+ * Global Input Manager Singleton.
263
+ *
264
+ * Responsible for monitoring global browser events (resize, blur, visibility)
265
+ * and coordinating system-wide resets to prevent stuck inputs.
266
+ */
267
+ declare class WindowManager {
268
+ /** Internal flag to prevent multiple event registrations */
269
+ private _isListening;
270
+ /** A throttled version of the reset logic */
271
+ private throttledReset;
272
+ private constructor();
273
+ /**
274
+ * Retrieves the global instance of the WindowManager.
275
+ * Ensures uniqueness across multiple bundles or modules.
276
+ */
277
+ static getInstance(): WindowManager;
278
+ /**
279
+ * Manually triggers a system-wide input reset via Registry.
280
+ */
281
+ private handleGlobalReset;
282
+ private handleResizeReset;
283
+ private handleBlurReset;
284
+ private handleScrollReset;
285
+ private handleVisibilityChangeReset;
286
+ /**
287
+ * Initializes global safety listeners.
288
+ * Should be called once at the root component lifecycle (e.g., VirtualLayer).
289
+ */
290
+ init(): void;
291
+ /**
292
+ * Toggle full-screen state of the page.
293
+ * @param element Target HTMLElement
294
+ */
295
+ toggleFullscreen(element?: HTMLElement): Promise<void>;
296
+ /**
297
+ * Full-screen status query provided to the UI layer.
298
+ */
299
+ isFullscreen(): boolean;
300
+ /**
301
+ * Detaches all global listeners.
302
+ */
303
+ destroy(): void;
304
+ }
305
+
306
+ export { ElementObserver, GamepadManager, WindowManager, createPointerBridge, createWebStickyProvider, dispatchKeyboardEvent, dispatchPointerEventAtPos, focusElement, getDeepActiveElement, getDeepElement, reclaimFocusAtPos, safeReleaseCapture, safeSetCapture, smartQuerySelector, supportsContainerQueries };