@omnipad/core 0.2.0-alpha.3 → 0.3.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 g=Object.defineProperty;var f=(e,t,n)=>t in e?g(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n;var b=(e,t,n)=>f(e,typeof t!="symbol"?t+"":t,n);var m=Symbol.for("omnipad.registry.instance"),h=class e{constructor(){b(this,"entities",new Map);undefined?.DEV&&console.log("[OmniPad-Core] Registry initialized.");}static getInstance(){let t=globalThis;return t[m]||(t[m]=new e),t[m]}register(t){if(!t.uid){console.warn("[OmniPad-Core] Registry: Attempted to register entity without UID.",t);return}this.entities.has(t.uid),this.entities.set(t.uid,t);}unregister(t){this.entities.has(t)&&this.entities.delete(t);}getEntity(t){return this.entities.get(t)}getAllEntities(){return Array.from(this.entities.values())}getEntitiesByRoot(t){let n=this.getAllEntities();if(!t)return n;if(!this.entities.get(t))return console.warn(`[OmniPad-Core] Registry: Root entity ${t} not found.`),[];let o=new Map;n.forEach(c=>{let a=c;if(typeof a.getConfig=="function"){let u=a.getConfig();u.parentId&&(o.has(u.parentId)||o.set(u.parentId,[]),o.get(u.parentId).push(c));}});let i=[],s=[t],y=new Set;for(;s.length>0;){let c=s.shift();if(y.has(c))continue;y.add(c);let a=this.entities.get(c);if(a){i.push(a);let u=o.get(c);u&&u.forEach(d=>s.push(d.uid));}}return i}destroyByRoot(t){let n=this.getEntitiesByRoot(t);for(let r=n.length-1;r>=0;r--){let o=n[r];try{o.destroy();}catch(i){console.error(`[OmniPad-Core] Error during destroyByRoot at ${o.uid}:`,i);}}}clear(){this.entities.clear();}resetAll(){this.entities.forEach(t=>{"reset"in t&&t.reset();});}debugGetSnapshot(){return new Map(this.entities)}};var R=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),T=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),V=(e,t)=>({x:e.x*t,y:e.y*t}),x=(e,t,n)=>Math.max(t,Math.min(n,e)),M=(e,t,n)=>e+(t-e)*n,l=(e,t=2)=>{let n=Math.pow(10,t);return Math.round(e*n)/n},w=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y),D=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),P=e=>e*180/Math.PI,A=e=>e*Math.PI/180,O=(e,t,n)=>{let r=t.x-e.x,o=t.y-e.y;if(Math.hypot(r,o)<=n)return t;let s=Math.atan2(o,r);return {x:e.x+Math.cos(s)*n,y:e.y+Math.sin(s)*n}},z=e=>{let t=Math.PI/4;return Math.round(e/t)*t},B=e=>{let t=Math.PI/2;return Math.round(e/t)*t},S=(e,t)=>l(e*t/100),G=(e,t)=>t===0?0:l(e*100/t),k=e=>{let t=Math.hypot(e.x,e.y);return t===0?{x:0,y:0}:{x:e.x/t,y:e.y/t}},q=e=>({x:Math.cos(e),y:Math.sin(e)}),L=(e,t,n,r,o)=>{let i=(e-t)/(n-t);return M(r,o,x(i,0,1))},Y=(e,t,n=1e-4)=>Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n,p=(e,t,n)=>{if(e<t)return 0;let r=(e-t)/(n-t);return x(r,0,1)},$=(e,t,n)=>{let r=Math.hypot(e.x,e.y),o=t*n,i=p(r,o,t);if(i===0)return {x:0,y:0};let s={x:e.x/r,y:e.y/r};return V(s,i)},j=(e,t,n)=>({x:p(Math.abs(e.x),t,n)*Math.sign(e.x),y:p(Math.abs(e.y),t,n)*Math.sign(e.y)});exports.a=b;exports.b=h;exports.c=R;exports.d=T;exports.e=V;exports.f=x;exports.g=M;exports.h=l;exports.i=w;exports.j=D;exports.k=P;exports.l=A;exports.m=O;exports.n=z;exports.o=B;exports.p=S;exports.q=G;exports.r=k;exports.s=q;exports.t=L;exports.u=Y;exports.v=p;exports.w=$;exports.x=j;
@@ -0,0 +1 @@
1
+ var g=Object.defineProperty;var f=(e,t,n)=>t in e?g(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n;var b=(e,t,n)=>f(e,typeof t!="symbol"?t+"":t,n);var m=Symbol.for("omnipad.registry.instance"),h=class e{constructor(){b(this,"entities",new Map);import.meta.env?.DEV&&console.log("[OmniPad-Core] Registry initialized.");}static getInstance(){let t=globalThis;return t[m]||(t[m]=new e),t[m]}register(t){if(!t.uid){console.warn("[OmniPad-Core] Registry: Attempted to register entity without UID.",t);return}this.entities.has(t.uid),this.entities.set(t.uid,t);}unregister(t){this.entities.has(t)&&this.entities.delete(t);}getEntity(t){return this.entities.get(t)}getAllEntities(){return Array.from(this.entities.values())}getEntitiesByRoot(t){let n=this.getAllEntities();if(!t)return n;if(!this.entities.get(t))return console.warn(`[OmniPad-Core] Registry: Root entity ${t} not found.`),[];let o=new Map;n.forEach(c=>{let a=c;if(typeof a.getConfig=="function"){let u=a.getConfig();u.parentId&&(o.has(u.parentId)||o.set(u.parentId,[]),o.get(u.parentId).push(c));}});let i=[],s=[t],y=new Set;for(;s.length>0;){let c=s.shift();if(y.has(c))continue;y.add(c);let a=this.entities.get(c);if(a){i.push(a);let u=o.get(c);u&&u.forEach(d=>s.push(d.uid));}}return i}destroyByRoot(t){let n=this.getEntitiesByRoot(t);for(let r=n.length-1;r>=0;r--){let o=n[r];try{o.destroy();}catch(i){console.error(`[OmniPad-Core] Error during destroyByRoot at ${o.uid}:`,i);}}}clear(){this.entities.clear();}resetAll(){this.entities.forEach(t=>{"reset"in t&&t.reset();});}debugGetSnapshot(){return new Map(this.entities)}};var R=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),T=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),V=(e,t)=>({x:e.x*t,y:e.y*t}),x=(e,t,n)=>Math.max(t,Math.min(n,e)),M=(e,t,n)=>e+(t-e)*n,l=(e,t=2)=>{let n=Math.pow(10,t);return Math.round(e*n)/n},w=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y),D=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),P=e=>e*180/Math.PI,A=e=>e*Math.PI/180,O=(e,t,n)=>{let r=t.x-e.x,o=t.y-e.y;if(Math.hypot(r,o)<=n)return t;let s=Math.atan2(o,r);return {x:e.x+Math.cos(s)*n,y:e.y+Math.sin(s)*n}},z=e=>{let t=Math.PI/4;return Math.round(e/t)*t},B=e=>{let t=Math.PI/2;return Math.round(e/t)*t},S=(e,t)=>l(e*t/100),G=(e,t)=>t===0?0:l(e*100/t),k=e=>{let t=Math.hypot(e.x,e.y);return t===0?{x:0,y:0}:{x:e.x/t,y:e.y/t}},q=e=>({x:Math.cos(e),y:Math.sin(e)}),L=(e,t,n,r,o)=>{let i=(e-t)/(n-t);return M(r,o,x(i,0,1))},Y=(e,t,n=1e-4)=>Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n,p=(e,t,n)=>{if(e<t)return 0;let r=(e-t)/(n-t);return x(r,0,1)},$=(e,t,n)=>{let r=Math.hypot(e.x,e.y),o=t*n,i=p(r,o,t);if(i===0)return {x:0,y:0};let s={x:e.x/r,y:e.y/r};return V(s,i)},j=(e,t,n)=>({x:p(Math.abs(e.x),t,n)*Math.sign(e.x),y:p(Math.abs(e.y),t,n)*Math.sign(e.y)});export{b as a,h as b,R as c,T as d,V as e,x as f,M as g,l as h,w as i,D as j,P as k,A as l,O as m,z as n,B as o,S as p,G as q,k as r,q as s,L as t,Y as u,p as v,$ as w,j as x};