@omnipad/core 0.4.4 → 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.
- package/dist/chunk-FSJTQU4W.cjs +1 -0
- package/dist/chunk-MKVX5ALC.mjs +1 -0
- package/dist/{chunk-ETLJK7NP.mjs → chunk-PACTGVBB.mjs} +1 -1
- package/dist/chunk-U52W5J3K.cjs +1 -0
- package/dist/chunk-V7AHGFPB.mjs +1 -0
- package/dist/chunk-VHF3K5X6.cjs +1 -0
- package/dist/{chunk-FAVAOSNA.cjs → chunk-ZHPNS73J.cjs} +1 -1
- package/dist/chunk-ZM2LX5IW.mjs +1 -0
- package/dist/dom/index.cjs +1 -0
- package/dist/dom/index.d.cts +306 -0
- package/dist/dom/index.d.ts +306 -0
- package/dist/dom/index.mjs +1 -0
- package/dist/{index-CTJog5sj.d.cts → index-DVegtw8s.d.cts} +14 -155
- package/dist/{index-CTJog5sj.d.ts → index-DVegtw8s.d.ts} +14 -155
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +31 -109
- package/dist/index.d.ts +31 -109
- package/dist/index.mjs +1 -1
- package/dist/sticky-4yk5DLzG.d.cts +59 -0
- package/dist/sticky-CLBq1EPa.d.ts +59 -0
- package/dist/traits-D6ePqSA6.d.cts +152 -0
- package/dist/traits-dAndzyWS.d.ts +152 -0
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.cts +45 -125
- package/dist/utils/index.d.ts +45 -125
- package/dist/utils/index.mjs +1 -1
- package/package.json +9 -1
package/dist/utils/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{b as addVec,v as applyAxialDeadzone,u as applyRadialDeadzone,d as clamp,k as clampVector,j as degToRad,h as getAngle,t as getDeadzoneScalar,g as getDistance,s as isVec2Equal,e as lerp,m as lockTo4Directions,l as lockTo8Directions,p as normalizeVec,n as percentToPx,o as pxToPercent,i as radToDeg,q as radToVec,r as remap,f as roundTo,c as scaleVec,a as subVec}from'../chunk-V7AHGFPB.mjs';import {d,h,i}from'../chunk-MKVX5ALC.mjs';export{b as DANGEROUS_KEYWORDS,k as StickyProvider,i as compressLayoutBox,a as createCachedProvider,g as lengthToCss,e as parseLength,j as resolveLayoutStyle,l as resolveStickyLayout,d as sanitizeCssClass,c as sanitizeDomString,f as sanitizeParsedLength,h as validateLayoutBox}from'../chunk-MKVX5ALC.mjs';import {h as h$1}from'../chunk-PACTGVBB.mjs';function tt(r,a){let s={};return r?(Object.keys(a).forEach(i=>{let e=a[i],o=r[i];typeof e=="object"&&e!==null?JSON.stringify(e)!==JSON.stringify(o)&&(s[i]=e):e!==o&&(s[i]=e);}),s):{...a}}var P=(r="omnipad")=>{let a=Date.now().toString(36),s=Math.random().toString(36).substring(2,6);return `${r}-${a}-${s}`};function l(r){return r.startsWith("$")}function st(r){if(!r||typeof r!="object")throw new Error("[OmniPad-Validation] Profile must be a valid JSON object.");if(!Array.isArray(r.items))throw new Error('[OmniPad-Validation] "items" must be an array.');let a={name:r.meta?.name||"Untitled Profile",version:r.meta?.version||"1.0.0",author:r.meta?.author||"Unknown"},s=r.items.map((e,o)=>{if(!e.id||!e.type)throw new Error(`[OmniPad-Validation] Item at index ${o} is missing "id" or "type".`);return {id:String(e.id),type:String(e.type),parentId:e.parentId?String(e.parentId):void 0,config:{...e.config,layout:h(e.config.layout),cssClass:d(e.config.cssClass)}}}),i=r.gamepadMappings;return {meta:a,items:s,gamepadMappings:i}}function dt(r){let{items:a,gamepadMappings:s}=r,i=new Map,e=(t,n="node")=>l(t)?t:(i.has(t)||i.set(t,P(n)),i.get(t));a.forEach(t=>e(t.id,t.type));let o=[];s&&s.forEach(t=>{let n={};if(t.buttons){n.buttons={};for(let[f,d]of Object.entries(t.buttons))n.buttons[f]=e(d);}t.dpad&&(n.dpad=e(t.dpad)),t.leftStick&&(n.leftStick=e(t.leftStick)),t.rightStick&&(n.rightStick=e(t.rightStick)),o.push(n);});let p=new Map,g=[];a.forEach(t=>{t.parentId?(p.has(t.parentId)||p.set(t.parentId,[]),p.get(t.parentId).push(t)):g.push(t);});let u=(t,n)=>{if(n.has(t.id))throw new Error(`[OmniPad-Core] Circular dependency detected at node: ${t.id}`);n.add(t.id);let f={...t.config};f?.targetStageId&&(f.targetStageId=e(f.targetStageId)),f?.dynamicWidgetId&&(f.dynamicWidgetId=e(f.dynamicWidgetId));let y=(p.get(t.id)||[]).map(m=>u(m,new Set(n)));return {uid:e(t.id),type:t.type,config:f,children:y}},c={};return g.forEach(t=>{c[t.id]=u(t,new Set);}),{roots:c,runtimeGamepadMappings:o}}function ft(r,a,s){let i$1=h$1.getInstance(),e=[];if(!a||a.length===0)e=i$1.getAllEntities();else {let t=new Set;a.forEach(n=>{i$1.getEntitiesByRoot(n).forEach(d=>t.add(d));}),e=Array.from(t);}let o=new Map,p=0,g=t=>l(t)?t:(o.has(t)||o.set(t,`node_${++p}`),o.get(t)),u=e.map(t=>{let n=t.getConfig(),f=t.uid,d={...n};d.targetStageId&&(d.targetStageId=g(d.targetStageId)),d.dynamicWidgetId&&(d.dynamicWidgetId=g(d.dynamicWidgetId));let{id:y,parentId:m,...h}=d;return {id:g(f),type:t.type,parentId:n.parentId?g(n.parentId):void 0,config:{...h,layout:i(h.layout)}}}),c=[];return s&&s.forEach(t=>{let n={};if(t.buttons){n.buttons={};for(let[f,d]of Object.entries(t.buttons))o.has(d)&&(n.buttons[f]=o.get(d));}t.dpad&&o.has(t.dpad)&&(n.dpad=o.get(t.dpad)),t.leftStick&&o.has(t.leftStick)&&(n.leftStick=o.get(t.leftStick)),t.rightStick&&o.has(t.rightStick)&&(n.rightStick=o.get(t.rightStick)),Object.keys(n).length>0?c.push(n):c.push({});}),{meta:r,items:u,gamepadMappings:Object.keys(c).length>0?c:void 0}}function gt(r,a){let s={};for(let i in r)r[i]!==void 0&&!a.has(i)&&(s[i]=r[i]);return s}export{ft as exportProfile,P as generateUID,gt as getBusinessProps,tt as getObjectDiff,l as isGlobalID,st as parseProfileJson,dt as parseProfileTrees};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnipad/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
"types": "./dist/utils/index.d.ts",
|
|
17
17
|
"import": "./dist/utils/index.mjs",
|
|
18
18
|
"require": "./dist/utils/index.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./dom": {
|
|
21
|
+
"types": "./dist/dom/index.d.ts",
|
|
22
|
+
"import": "./dist/dom/index.mjs",
|
|
23
|
+
"require": "./dist/dom/index.cjs"
|
|
19
24
|
}
|
|
20
25
|
},
|
|
21
26
|
"typesVersions": {
|
|
@@ -25,6 +30,9 @@
|
|
|
25
30
|
],
|
|
26
31
|
"utils": [
|
|
27
32
|
"./dist/utils/index.d.ts"
|
|
33
|
+
],
|
|
34
|
+
"dom": [
|
|
35
|
+
"./dist/dom/index.d.ts"
|
|
28
36
|
]
|
|
29
37
|
}
|
|
30
38
|
},
|