@omnipad/core 0.5.0 → 0.6.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.
Files changed (45) hide show
  1. package/dist/chunk-42WBUPM3.cjs +1 -0
  2. package/dist/chunk-45F3BQT7.cjs +1 -0
  3. package/dist/chunk-52YF3VHH.cjs +1 -0
  4. package/dist/chunk-6XY2ZHZ3.mjs +1 -0
  5. package/dist/chunk-AK3RL7NL.mjs +1 -0
  6. package/dist/chunk-EYKCVOUA.mjs +1 -0
  7. package/dist/chunk-HCOFKHVV.cjs +1 -0
  8. package/dist/chunk-HQNUZXP5.mjs +1 -0
  9. package/dist/chunk-J5SVBM6K.mjs +1 -0
  10. package/dist/chunk-NB4FTDOP.cjs +1 -0
  11. package/dist/chunk-OVV5DKL6.cjs +1 -0
  12. package/dist/chunk-YAS6LFBF.mjs +1 -0
  13. package/dist/dom/index.cjs +1 -1
  14. package/dist/dom/index.d.cts +105 -36
  15. package/dist/dom/index.d.ts +105 -36
  16. package/dist/dom/index.mjs +1 -1
  17. package/dist/guest/index.cjs +1 -0
  18. package/dist/guest/index.d.cts +21 -0
  19. package/dist/guest/index.d.ts +21 -0
  20. package/dist/guest/index.mjs +1 -0
  21. package/dist/{index-DVegtw8s.d.cts → index-Dd0aHJaA.d.cts} +739 -27
  22. package/dist/{index-DVegtw8s.d.ts → index-Dd0aHJaA.d.ts} +739 -27
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.d.cts +282 -5
  25. package/dist/index.d.ts +282 -5
  26. package/dist/index.mjs +1 -1
  27. package/dist/sticky-CCj0ECTY.d.cts +285 -0
  28. package/dist/sticky-d_z_GU83.d.ts +285 -0
  29. package/dist/utils/index.cjs +1 -1
  30. package/dist/utils/index.d.cts +122 -69
  31. package/dist/utils/index.d.ts +122 -69
  32. package/dist/utils/index.mjs +1 -1
  33. package/package.json +9 -1
  34. package/dist/chunk-FSJTQU4W.cjs +0 -1
  35. package/dist/chunk-MKVX5ALC.mjs +0 -1
  36. package/dist/chunk-PACTGVBB.mjs +0 -1
  37. package/dist/chunk-U52W5J3K.cjs +0 -1
  38. package/dist/chunk-V7AHGFPB.mjs +0 -1
  39. package/dist/chunk-VHF3K5X6.cjs +0 -1
  40. package/dist/chunk-ZHPNS73J.cjs +0 -1
  41. package/dist/chunk-ZM2LX5IW.mjs +0 -1
  42. package/dist/sticky-4yk5DLzG.d.cts +0 -59
  43. package/dist/sticky-CLBq1EPa.d.ts +0 -59
  44. package/dist/traits-D6ePqSA6.d.cts +0 -152
  45. package/dist/traits-dAndzyWS.d.ts +0 -152
@@ -1 +1 @@
1
- 'use strict';var chunkU52W5J3K_cjs=require('../chunk-U52W5J3K.cjs'),chunkFSJTQU4W_cjs=require('../chunk-FSJTQU4W.cjs'),chunkZHPNS73J_cjs=require('../chunk-ZHPNS73J.cjs');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:chunkFSJTQU4W_cjs.h(e.config.layout),cssClass:chunkFSJTQU4W_cjs.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=chunkZHPNS73J_cjs.h.getInstance(),e=[];if(!a||a.length===0)e=i.getAllEntities();else {let t=new Set;a.forEach(n=>{i.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:chunkFSJTQU4W_cjs.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}Object.defineProperty(exports,"addVec",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.b}});Object.defineProperty(exports,"applyAxialDeadzone",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.v}});Object.defineProperty(exports,"applyRadialDeadzone",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.u}});Object.defineProperty(exports,"clamp",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.d}});Object.defineProperty(exports,"clampVector",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.k}});Object.defineProperty(exports,"degToRad",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.j}});Object.defineProperty(exports,"getAngle",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.h}});Object.defineProperty(exports,"getDeadzoneScalar",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.t}});Object.defineProperty(exports,"getDistance",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.g}});Object.defineProperty(exports,"isVec2Equal",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.s}});Object.defineProperty(exports,"lerp",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.e}});Object.defineProperty(exports,"lockTo4Directions",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.m}});Object.defineProperty(exports,"lockTo8Directions",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.l}});Object.defineProperty(exports,"normalizeVec",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.p}});Object.defineProperty(exports,"percentToPx",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.n}});Object.defineProperty(exports,"pxToPercent",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.o}});Object.defineProperty(exports,"radToDeg",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.i}});Object.defineProperty(exports,"radToVec",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.q}});Object.defineProperty(exports,"remap",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.r}});Object.defineProperty(exports,"roundTo",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.f}});Object.defineProperty(exports,"scaleVec",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.c}});Object.defineProperty(exports,"subVec",{enumerable:true,get:function(){return chunkU52W5J3K_cjs.a}});Object.defineProperty(exports,"DANGEROUS_KEYWORDS",{enumerable:true,get:function(){return chunkFSJTQU4W_cjs.b}});Object.defineProperty(exports,"StickyProvider",{enumerable:true,get:function(){return chunkFSJTQU4W_cjs.k}});Object.defineProperty(exports,"compressLayoutBox",{enumerable:true,get:function(){return chunkFSJTQU4W_cjs.i}});Object.defineProperty(exports,"createCachedProvider",{enumerable:true,get:function(){return chunkFSJTQU4W_cjs.a}});Object.defineProperty(exports,"lengthToCss",{enumerable:true,get:function(){return chunkFSJTQU4W_cjs.g}});Object.defineProperty(exports,"parseLength",{enumerable:true,get:function(){return chunkFSJTQU4W_cjs.e}});Object.defineProperty(exports,"resolveLayoutStyle",{enumerable:true,get:function(){return chunkFSJTQU4W_cjs.j}});Object.defineProperty(exports,"resolveStickyLayout",{enumerable:true,get:function(){return chunkFSJTQU4W_cjs.l}});Object.defineProperty(exports,"sanitizeCssClass",{enumerable:true,get:function(){return chunkFSJTQU4W_cjs.d}});Object.defineProperty(exports,"sanitizeDomString",{enumerable:true,get:function(){return chunkFSJTQU4W_cjs.c}});Object.defineProperty(exports,"sanitizeParsedLength",{enumerable:true,get:function(){return chunkFSJTQU4W_cjs.f}});Object.defineProperty(exports,"validateLayoutBox",{enumerable:true,get:function(){return chunkFSJTQU4W_cjs.h}});exports.exportProfile=ft;exports.generateUID=P;exports.getBusinessProps=gt;exports.getObjectDiff=tt;exports.isGlobalID=l;exports.parseProfileJson=st;exports.parseProfileTrees=dt;
1
+ 'use strict';var chunkOVV5DKL6_cjs=require('../chunk-OVV5DKL6.cjs'),chunk45F3BQT7_cjs=require('../chunk-45F3BQT7.cjs'),chunk52YF3VHH_cjs=require('../chunk-52YF3VHH.cjs');require('../chunk-HCOFKHVV.cjs');Object.defineProperty(exports,"filterObjectByKeys",{enumerable:true,get:function(){return chunkOVV5DKL6_cjs.a}});Object.defineProperty(exports,"getObjectDiff",{enumerable:true,get:function(){return chunkOVV5DKL6_cjs.b}});Object.defineProperty(exports,"mergeObjects",{enumerable:true,get:function(){return chunkOVV5DKL6_cjs.c}});Object.defineProperty(exports,"distillCustom",{enumerable:true,get:function(){return chunk45F3BQT7_cjs.c}});Object.defineProperty(exports,"distillPointer",{enumerable:true,get:function(){return chunk45F3BQT7_cjs.b}});Object.defineProperty(exports,"distillRect",{enumerable:true,get:function(){return chunk45F3BQT7_cjs.a}});Object.defineProperty(exports,"PROTO_POLLUTION_KEYS",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.i}});Object.defineProperty(exports,"XXS_DANGEROUS_KEYWORDS",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.j}});Object.defineProperty(exports,"addVec",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.o}});Object.defineProperty(exports,"applyAxialDeadzone",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.I}});Object.defineProperty(exports,"applyRadialDeadzone",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.H}});Object.defineProperty(exports,"clamp",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.q}});Object.defineProperty(exports,"clampVector",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.x}});Object.defineProperty(exports,"compressLayoutBox",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.N}});Object.defineProperty(exports,"createCachedProvider",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.f}});Object.defineProperty(exports,"degToRad",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.w}});Object.defineProperty(exports,"flattenRelativeLayout",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.O}});Object.defineProperty(exports,"generateUID",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.g}});Object.defineProperty(exports,"getAngle",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.u}});Object.defineProperty(exports,"getDeadzoneScalar",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.G}});Object.defineProperty(exports,"getDistance",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.t}});Object.defineProperty(exports,"isGlobalID",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.h}});Object.defineProperty(exports,"isVec2Equal",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.F}});Object.defineProperty(exports,"lengthToCss",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.L}});Object.defineProperty(exports,"lerp",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.r}});Object.defineProperty(exports,"lockTo4Directions",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.z}});Object.defineProperty(exports,"lockTo8Directions",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.y}});Object.defineProperty(exports,"normalizeVec",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.C}});Object.defineProperty(exports,"parseLength",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.J}});Object.defineProperty(exports,"percentToPx",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.A}});Object.defineProperty(exports,"projectPercentToBox",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.R}});Object.defineProperty(exports,"projectVectorToBox",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.Q}});Object.defineProperty(exports,"pxToPercent",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.B}});Object.defineProperty(exports,"radToDeg",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.v}});Object.defineProperty(exports,"radToVec",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.D}});Object.defineProperty(exports,"remap",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.E}});Object.defineProperty(exports,"resolveLayoutStyle",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.P}});Object.defineProperty(exports,"roundTo",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.s}});Object.defineProperty(exports,"sanitizeCssClass",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.l}});Object.defineProperty(exports,"sanitizeDomString",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.k}});Object.defineProperty(exports,"sanitizeParsedLength",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.K}});Object.defineProperty(exports,"sanitizePrototypePollution",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.m}});Object.defineProperty(exports,"scaleVec",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.p}});Object.defineProperty(exports,"subVec",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.n}});Object.defineProperty(exports,"validateLayoutBox",{enumerable:true,get:function(){return chunk52YF3VHH_cjs.M}});
@@ -1,22 +1,27 @@
1
- import { L as LayoutBox, P as ParsedLength, o as FlexibleLength, V as Vec2, m as ConfigTreeNode, G as GamepadMappingConfig, O as OmniPadProfile } from '../index-DVegtw8s.cjs';
2
- export { S as StickyProvider, r as resolveStickyLayout } from '../sticky-4yk5DLzG.cjs';
1
+ import { c as AbstractPointerEvent, a as AbstractRect, L as LayoutBox, P as ParsedLength, o as FlexibleLength, V as Vec2 } from '../index-Dd0aHJaA.cjs';
3
2
 
4
3
  /**
5
4
  * Creates a provider wrapper that caches the result of a value-producing function.
6
- * * This utility implements a lazy-loading pattern with manual invalidation. The
5
+ *
6
+ * This utility implements a lazy-loading pattern with manual invalidation. The
7
7
  * provided function is only executed when the cache is "dirty" or empty,
8
8
  * ensuring expensive operations aren't repeated unnecessarily.
9
- * * @template T - The type of the value returned by the provider.
9
+ *
10
+ * @template T - The type of the value returned by the provider.
10
11
  * @param provider - A function that computes or retrieves the value to be cached.
11
12
  * @returns An object containing methods to access the value and invalidate the cache.
12
- * * @example
13
+ *
14
+ * @example
13
15
  * ```typescript
14
16
  * const userProvider = createCachedProvider(() => fetchUserData());
15
- * * // First call executes the provider
17
+ *
18
+ * // First call executes the provider
16
19
  * const data = userProvider.get();
17
- * * // Subsequent calls return the cached version
20
+ *
21
+ * // Subsequent calls return the cached version
18
22
  * const cachedData = userProvider.get();
19
- * * // Forces the provider to re-run on the next .get()
23
+ *
24
+ * // Forces the provider to re-run on the next .get()
20
25
  * userProvider.markDirty();
21
26
  * ```
22
27
  */
@@ -26,30 +31,39 @@ declare function createCachedProvider<T>(provider: () => T): {
26
31
  };
27
32
 
28
33
  /**
29
- * Compares two objects and extracts the properties that have changed.
34
+ * Distills a raw Rect-like object into a clean AbstractRect.
35
+ * Useful for converting live DOMRects into serialization-friendly POJOs.
30
36
  *
31
- * This function performs a shallow comparison of keys. For nested objects,
32
- * it performs a structural check to determine if
33
- * the contents have changed.
37
+ * @param raw - Any object containing left, right, top, bottom, width, and height.
38
+ * @returns A sanitized AbstractRect object.
39
+ */
40
+ declare const distillRect: (raw: any) => AbstractRect;
41
+ /**
42
+ * Distills a PointerEvent-like object into a clean AbstractPointerEvent.
43
+ * Essential for stripping away heavy browser references before cross-origin postMessage transmission.
34
44
  *
35
- * @param oldObj - The previous state or snapshot of the object.
36
- * @param newObj - The new state of the object to compare against the old one.
37
- * @returns A partial record containing only the key-value pairs that differ from the original.
45
+ * @param raw - Any object containing pointerId, clientX, clientY, and button.
46
+ * @returns A sanitized AbstractPointerEvent object.
38
47
  */
39
- declare function getObjectDiff(oldObj: any, newObj: any): Record<string, any>;
40
-
48
+ declare const distillPointer: (raw: any) => AbstractPointerEvent;
41
49
  /**
42
- * Generates a globally unique identifier (UID) for runtime entity management and DOM keys.
50
+ * Dynamically distills a custom set of fields from a raw object.
43
51
  *
44
- * The generated ID follows the format: `[prefix]-[timestamp_base36]-[random_string]`.
45
- * This ensures that components generated at different times or across multiple sessions
46
- * remain unique within the current page instance.
52
+ * @template T - The target structure type.
53
+ * @param raw - The source data.
54
+ * @param fields - The list of fields to preserve.
55
+ * @returns The distilled object matching the target structure.
56
+ */
57
+ declare const distillCustom: <T extends object>(raw: any, fields: readonly (keyof T)[]) => T;
58
+
59
+ /**
60
+ * Generates a unique identifier (UID).
47
61
  *
48
- * @param prefix - A string prefix for the ID, typically the component type (e.g., 'btn', 'joy'). Defaults to 'omnipad'.
49
- * @returns A unique string identifier.
62
+ * Uses the Web Crypto API to ensure cryptographic randomness if available,
63
+ * falling back to Math.random() in insecure or legacy environments.
50
64
  *
51
- * @example
52
- * generateUID('button') // returns "button-m7x8k1p2-f4k2"
65
+ * @param prefix - A prefix string to identify the entity type (e.g., 'btn').
66
+ * @returns A unique string formatted as `prefix-timestamp-random`.
53
67
  */
54
68
  declare const generateUID: (prefix?: string) => string;
55
69
  /**
@@ -91,6 +105,19 @@ declare function validateLayoutBox(raw: LayoutBox): LayoutBox;
91
105
  * Compress layout properties into css strings.
92
106
  */
93
107
  declare function compressLayoutBox(raw: LayoutBox): LayoutBox;
108
+ /**
109
+ * Resolves a relative 'absolute' layout configuration into a 'fixed' pixel-based layout.
110
+ *
111
+ * **Transformation:**
112
+ * - **Input:** A `layout` defined relative to the `refRect` (similar to CSS `position: absolute`).
113
+ * - **Output:** A `layout` defined in the same coordinate space as the `refRect` (similar to CSS `position: fixed` or global coordinates).
114
+ *
115
+ * @param layout - The relative layout (e.g., `{ left: '10%' }` of the target).
116
+ * @param refRect - The reference rect used as the "container" for calculation.
117
+ * @param toPx - Optional converter for custom unit handling.
118
+ * @returns A normalized `LayoutBox` with fixed pixel strings.
119
+ */
120
+ declare function flattenRelativeLayout(layout: LayoutBox, refRect: AbstractRect, toPx?: (p: ParsedLength | undefined, base: number) => number): LayoutBox;
94
121
  /**
95
122
  * Converts a LayoutBox configuration into a CSS style object suitable for Vue/React.
96
123
  *
@@ -108,6 +135,26 @@ declare function compressLayoutBox(raw: LayoutBox): LayoutBox;
108
135
  * resolveLayoutStyle({ left: '50%', top: '50%', anchor: 'center' });
109
136
  */
110
137
  declare const resolveLayoutStyle: (layout: LayoutBox) => Record<string, string | number>;
138
+ /**
139
+ * Projects a normalized input vector (-1.0 to 1.0) onto a CSS layout box.
140
+ * Ideal for components that move relative to a center point, such as joystick handles.
141
+ *
142
+ * @param vec - The input vector where (0,0) is center and 1.0 is the boundary.
143
+ * @param size - The actual pixel dimensions of the container.
144
+ * @param useNativeCQ - If true, uses Container Query units (cqw/cqh) for responsive scaling.
145
+ * @returns A CSS-compatible object with width, height, x, and y properties.
146
+ */
147
+ declare const projectVectorToBox: (vec: Vec2, size: Vec2, useNativeCQ?: boolean) => Record<string, string>;
148
+ /**
149
+ * Projects percentage coordinates (0-100) onto a CSS layout box.
150
+ * Suitable for absolute positioning requirements like virtual cursors or stage markers.
151
+ *
152
+ * @param percent - The coordinate point in percentages.
153
+ * @param getSize - Lazy getter for current physical dimensions of the container.
154
+ * @param useNativeCQ - If true, returns responsive Container Query units.
155
+ * @returns A CSS-compatible object with width, height, x, and y properties.
156
+ */
157
+ declare const projectPercentToBox: (percent: Vec2, getSize: () => Vec2, useNativeCQ?: boolean) => Record<string, string>;
111
158
 
112
159
  /**
113
160
  * Subtracts vector v2 from v1.
@@ -210,73 +257,79 @@ declare const applyRadialDeadzone: (v: Vec2, radius: number, deadzonePercent: nu
210
257
  * Applies an axial deadzone to a vector.
211
258
  * Independently processes X and Y axes. Useful for D-Pads or precision directional inputs.
212
259
  * @param v - Input vector.
213
- * @param threshold - The deadzone threshold value.
214
260
  * @param max - Maximum value for the axis.
261
+ * @param threshold - The deadzone threshold value.
215
262
  */
216
- declare const applyAxialDeadzone: (v: Vec2, threshold: number, max: number) => Vec2;
263
+ declare const applyAxialDeadzone: (v: Vec2, max: number, threshold: number) => Vec2;
217
264
 
218
265
  /**
219
- * Validates and normalizes raw JSON data into a standard OmniPadProfile.
220
- * Performs structural checks and injects default metadata.
266
+ * Filters an object by removing undefined values and specific excluded keys.
221
267
  *
222
- * @param raw - The raw JSON object from disk or network.
223
- * @returns A validated OmniPadProfile object.
224
- * @throws Error if the core structure is invalid.
225
- */
226
- declare function parseProfileJson(raw: any): OmniPadProfile;
227
- /**
228
- * The resulting structure after parsing a OmniPadProfile.
229
- * Contains a map of root nodes and a runtime-ready gamepad mapping table.
230
- */
231
- interface ParsedProfileForest {
232
- /** Root nodes indexed by their original Config ID. */
233
- roots: Record<string, ConfigTreeNode>;
234
- /**
235
- * Processed gamepad mapping where all CIDs have been
236
- * translated into unique runtime UIDs.
237
- */
238
- runtimeGamepadMappings: GamepadMappingConfig[];
239
- }
240
- /**
241
- * Converts a flat OmniPadProfile into a forest of ConfigTreeNodes for runtime rendering.
242
- * Automatically identifies all items without a parentId as root nodes.
243
- *
244
- * @param profile - The normalized profile data.
245
- * @returns A record map of root nodes, keyed by their original configuration ID.
268
+ * @param obj - The source object.
269
+ * @param excludeKeys - A set of keys to be ignored.
270
+ * @returns A new object containing only allowed business properties.
246
271
  */
247
- declare function parseProfileTrees(profile: OmniPadProfile): ParsedProfileForest;
272
+ declare function filterObjectByKeys(obj: Record<string, any>, excludeKeys: Set<string>): Record<string, any>;
248
273
  /**
249
- * Serializes the specified runtime entities into a flat OmniPadProfile.
250
- * If no rootUids are provided, exports all entities currently in the registry.
274
+ * Compares two objects and extracts the properties that have changed.
275
+ *
276
+ * This function performs a shallow comparison of keys. For nested objects,
277
+ * it performs a structural check to determine if
278
+ * the contents have changed.
251
279
  *
252
- * @param meta - Metadata for the exported profile.
253
- * @param rootUid - The Entity ID of the node to be treated as the root.
254
- * @param runtimeGamepadMapping - The current mapping from GamepadManager (using UIDs).
255
- * @returns A flat OmniPadProfile ready for storage.
280
+ * @param oldObj - The previous state or snapshot of the object.
281
+ * @param newObj - The new state of the object to compare against the old one.
282
+ * @returns A partial record containing only the key-value pairs that differ from the original.
256
283
  */
257
- declare function exportProfile(meta: OmniPadProfile['meta'], rootUids?: string[], runtimeGamepadMappings?: Readonly<GamepadMappingConfig[]>): OmniPadProfile;
284
+ declare function getObjectDiff(oldObj: Record<string, any>, newObj: Record<string, any>): Record<string, any>;
258
285
  /**
259
- * Extract filtered business configurations.
260
- * @param props Original Props object (e.g. Vue's props)
261
- * @param skipKeys Ignore key set
286
+ * Merges multiple objects from left to right.
287
+ * Later objects will override properties of earlier ones.
288
+ *
289
+ * @template T - The expected return type.
290
+ * @param objects - A list of objects to merge.
291
+ * @returns The merged object as type T.
262
292
  */
263
- declare function getBusinessProps(props: Record<string, any>, skipKeys: Set<string>): Record<string, any>;
293
+ declare function mergeObjects<T>(...objects: (Record<string, any> | undefined | null)[]): T;
264
294
 
265
295
  /**
266
296
  * Simple DOM string sanitizer to prevent CSS/JS injection.
267
297
  * Validates selectors and class names.
268
298
  */
269
- declare const DANGEROUS_KEYWORDS: readonly ["script", "onerror", "eval", "onload", "javascript"];
299
+ declare const PROTO_POLLUTION_KEYS: readonly ["__proto__", "constructor", "prototype"];
300
+ declare const XXS_DANGEROUS_KEYWORDS: readonly ["script", "javascript:", "onerror", "onload", "eval", "expression"];
270
301
  /**
271
302
  * Sanitizes a string intended for DOM use (selectors, classes, etc.)
272
- * @param input - The raw string input
273
- * @param fallback - Returned if input is unsafe
303
+ * @param input - The raw string input to be sanitized.
304
+ * @param fallback - Returned if input is unsafe.
274
305
  */
275
306
  declare function sanitizeDomString(input: string | undefined, fallback?: string): string;
276
307
  /**
277
308
  * Specifically validates and cleans CSS class strings.
278
309
  * Ensures it's just a space-separated list of valid class names.
310
+ * @param input - The raw string input to be sanitized.
279
311
  */
280
312
  declare function sanitizeCssClass(input: string | undefined): string;
313
+ /**
314
+ * Recursively sanitizes an object by stripping dangerous prototype-pollution keys.
315
+ *
316
+ * @remarks
317
+ * This function performs a deep traversal of the input and removes keys such as
318
+ * `__proto__`, `constructor`, and `prototype`. It uses an internal closure-based
319
+ * recursion and a pre-allocated `Set` to ensure optimal performance and memory
320
+ * efficiency during deep-tree processing.
321
+ *
322
+ * @param input - The raw data (usually from an untrusted JSON source) to be sanitized.
323
+ * @returns A new object/array cloned from the input, guaranteed to be free of
324
+ * prototype pollution vectors at any depth.
325
+ *
326
+ * @example
327
+ * ```typescript
328
+ * const tainted = JSON.parse('{"__proto__": {"admin": true}, "config": {"prototype": "bad"}}');
329
+ * const safe = sanitizePrototypePollution(tainted);
330
+ * // safe => { config: {} }
331
+ * ```
332
+ */
333
+ declare function sanitizePrototypePollution<T>(input: T): T;
281
334
 
282
- export { DANGEROUS_KEYWORDS, type ParsedProfileForest, addVec, applyAxialDeadzone, applyRadialDeadzone, clamp, clampVector, compressLayoutBox, createCachedProvider, degToRad, exportProfile, generateUID, getAngle, getBusinessProps, getDeadzoneScalar, getDistance, getObjectDiff, isGlobalID, isVec2Equal, lengthToCss, lerp, lockTo4Directions, lockTo8Directions, normalizeVec, parseLength, parseProfileJson, parseProfileTrees, percentToPx, pxToPercent, radToDeg, radToVec, remap, resolveLayoutStyle, roundTo, sanitizeCssClass, sanitizeDomString, sanitizeParsedLength, scaleVec, subVec, validateLayoutBox };
335
+ export { PROTO_POLLUTION_KEYS, XXS_DANGEROUS_KEYWORDS, addVec, applyAxialDeadzone, applyRadialDeadzone, clamp, clampVector, compressLayoutBox, createCachedProvider, degToRad, distillCustom, distillPointer, distillRect, filterObjectByKeys, flattenRelativeLayout, generateUID, getAngle, getDeadzoneScalar, getDistance, getObjectDiff, isGlobalID, isVec2Equal, lengthToCss, lerp, lockTo4Directions, lockTo8Directions, mergeObjects, normalizeVec, parseLength, percentToPx, projectPercentToBox, projectVectorToBox, pxToPercent, radToDeg, radToVec, remap, resolveLayoutStyle, roundTo, sanitizeCssClass, sanitizeDomString, sanitizeParsedLength, sanitizePrototypePollution, scaleVec, subVec, validateLayoutBox };
@@ -1,22 +1,27 @@
1
- import { L as LayoutBox, P as ParsedLength, o as FlexibleLength, V as Vec2, m as ConfigTreeNode, G as GamepadMappingConfig, O as OmniPadProfile } from '../index-DVegtw8s.js';
2
- export { S as StickyProvider, r as resolveStickyLayout } from '../sticky-CLBq1EPa.js';
1
+ import { c as AbstractPointerEvent, a as AbstractRect, L as LayoutBox, P as ParsedLength, o as FlexibleLength, V as Vec2 } from '../index-Dd0aHJaA.js';
3
2
 
4
3
  /**
5
4
  * Creates a provider wrapper that caches the result of a value-producing function.
6
- * * This utility implements a lazy-loading pattern with manual invalidation. The
5
+ *
6
+ * This utility implements a lazy-loading pattern with manual invalidation. The
7
7
  * provided function is only executed when the cache is "dirty" or empty,
8
8
  * ensuring expensive operations aren't repeated unnecessarily.
9
- * * @template T - The type of the value returned by the provider.
9
+ *
10
+ * @template T - The type of the value returned by the provider.
10
11
  * @param provider - A function that computes or retrieves the value to be cached.
11
12
  * @returns An object containing methods to access the value and invalidate the cache.
12
- * * @example
13
+ *
14
+ * @example
13
15
  * ```typescript
14
16
  * const userProvider = createCachedProvider(() => fetchUserData());
15
- * * // First call executes the provider
17
+ *
18
+ * // First call executes the provider
16
19
  * const data = userProvider.get();
17
- * * // Subsequent calls return the cached version
20
+ *
21
+ * // Subsequent calls return the cached version
18
22
  * const cachedData = userProvider.get();
19
- * * // Forces the provider to re-run on the next .get()
23
+ *
24
+ * // Forces the provider to re-run on the next .get()
20
25
  * userProvider.markDirty();
21
26
  * ```
22
27
  */
@@ -26,30 +31,39 @@ declare function createCachedProvider<T>(provider: () => T): {
26
31
  };
27
32
 
28
33
  /**
29
- * Compares two objects and extracts the properties that have changed.
34
+ * Distills a raw Rect-like object into a clean AbstractRect.
35
+ * Useful for converting live DOMRects into serialization-friendly POJOs.
30
36
  *
31
- * This function performs a shallow comparison of keys. For nested objects,
32
- * it performs a structural check to determine if
33
- * the contents have changed.
37
+ * @param raw - Any object containing left, right, top, bottom, width, and height.
38
+ * @returns A sanitized AbstractRect object.
39
+ */
40
+ declare const distillRect: (raw: any) => AbstractRect;
41
+ /**
42
+ * Distills a PointerEvent-like object into a clean AbstractPointerEvent.
43
+ * Essential for stripping away heavy browser references before cross-origin postMessage transmission.
34
44
  *
35
- * @param oldObj - The previous state or snapshot of the object.
36
- * @param newObj - The new state of the object to compare against the old one.
37
- * @returns A partial record containing only the key-value pairs that differ from the original.
45
+ * @param raw - Any object containing pointerId, clientX, clientY, and button.
46
+ * @returns A sanitized AbstractPointerEvent object.
38
47
  */
39
- declare function getObjectDiff(oldObj: any, newObj: any): Record<string, any>;
40
-
48
+ declare const distillPointer: (raw: any) => AbstractPointerEvent;
41
49
  /**
42
- * Generates a globally unique identifier (UID) for runtime entity management and DOM keys.
50
+ * Dynamically distills a custom set of fields from a raw object.
43
51
  *
44
- * The generated ID follows the format: `[prefix]-[timestamp_base36]-[random_string]`.
45
- * This ensures that components generated at different times or across multiple sessions
46
- * remain unique within the current page instance.
52
+ * @template T - The target structure type.
53
+ * @param raw - The source data.
54
+ * @param fields - The list of fields to preserve.
55
+ * @returns The distilled object matching the target structure.
56
+ */
57
+ declare const distillCustom: <T extends object>(raw: any, fields: readonly (keyof T)[]) => T;
58
+
59
+ /**
60
+ * Generates a unique identifier (UID).
47
61
  *
48
- * @param prefix - A string prefix for the ID, typically the component type (e.g., 'btn', 'joy'). Defaults to 'omnipad'.
49
- * @returns A unique string identifier.
62
+ * Uses the Web Crypto API to ensure cryptographic randomness if available,
63
+ * falling back to Math.random() in insecure or legacy environments.
50
64
  *
51
- * @example
52
- * generateUID('button') // returns "button-m7x8k1p2-f4k2"
65
+ * @param prefix - A prefix string to identify the entity type (e.g., 'btn').
66
+ * @returns A unique string formatted as `prefix-timestamp-random`.
53
67
  */
54
68
  declare const generateUID: (prefix?: string) => string;
55
69
  /**
@@ -91,6 +105,19 @@ declare function validateLayoutBox(raw: LayoutBox): LayoutBox;
91
105
  * Compress layout properties into css strings.
92
106
  */
93
107
  declare function compressLayoutBox(raw: LayoutBox): LayoutBox;
108
+ /**
109
+ * Resolves a relative 'absolute' layout configuration into a 'fixed' pixel-based layout.
110
+ *
111
+ * **Transformation:**
112
+ * - **Input:** A `layout` defined relative to the `refRect` (similar to CSS `position: absolute`).
113
+ * - **Output:** A `layout` defined in the same coordinate space as the `refRect` (similar to CSS `position: fixed` or global coordinates).
114
+ *
115
+ * @param layout - The relative layout (e.g., `{ left: '10%' }` of the target).
116
+ * @param refRect - The reference rect used as the "container" for calculation.
117
+ * @param toPx - Optional converter for custom unit handling.
118
+ * @returns A normalized `LayoutBox` with fixed pixel strings.
119
+ */
120
+ declare function flattenRelativeLayout(layout: LayoutBox, refRect: AbstractRect, toPx?: (p: ParsedLength | undefined, base: number) => number): LayoutBox;
94
121
  /**
95
122
  * Converts a LayoutBox configuration into a CSS style object suitable for Vue/React.
96
123
  *
@@ -108,6 +135,26 @@ declare function compressLayoutBox(raw: LayoutBox): LayoutBox;
108
135
  * resolveLayoutStyle({ left: '50%', top: '50%', anchor: 'center' });
109
136
  */
110
137
  declare const resolveLayoutStyle: (layout: LayoutBox) => Record<string, string | number>;
138
+ /**
139
+ * Projects a normalized input vector (-1.0 to 1.0) onto a CSS layout box.
140
+ * Ideal for components that move relative to a center point, such as joystick handles.
141
+ *
142
+ * @param vec - The input vector where (0,0) is center and 1.0 is the boundary.
143
+ * @param size - The actual pixel dimensions of the container.
144
+ * @param useNativeCQ - If true, uses Container Query units (cqw/cqh) for responsive scaling.
145
+ * @returns A CSS-compatible object with width, height, x, and y properties.
146
+ */
147
+ declare const projectVectorToBox: (vec: Vec2, size: Vec2, useNativeCQ?: boolean) => Record<string, string>;
148
+ /**
149
+ * Projects percentage coordinates (0-100) onto a CSS layout box.
150
+ * Suitable for absolute positioning requirements like virtual cursors or stage markers.
151
+ *
152
+ * @param percent - The coordinate point in percentages.
153
+ * @param getSize - Lazy getter for current physical dimensions of the container.
154
+ * @param useNativeCQ - If true, returns responsive Container Query units.
155
+ * @returns A CSS-compatible object with width, height, x, and y properties.
156
+ */
157
+ declare const projectPercentToBox: (percent: Vec2, getSize: () => Vec2, useNativeCQ?: boolean) => Record<string, string>;
111
158
 
112
159
  /**
113
160
  * Subtracts vector v2 from v1.
@@ -210,73 +257,79 @@ declare const applyRadialDeadzone: (v: Vec2, radius: number, deadzonePercent: nu
210
257
  * Applies an axial deadzone to a vector.
211
258
  * Independently processes X and Y axes. Useful for D-Pads or precision directional inputs.
212
259
  * @param v - Input vector.
213
- * @param threshold - The deadzone threshold value.
214
260
  * @param max - Maximum value for the axis.
261
+ * @param threshold - The deadzone threshold value.
215
262
  */
216
- declare const applyAxialDeadzone: (v: Vec2, threshold: number, max: number) => Vec2;
263
+ declare const applyAxialDeadzone: (v: Vec2, max: number, threshold: number) => Vec2;
217
264
 
218
265
  /**
219
- * Validates and normalizes raw JSON data into a standard OmniPadProfile.
220
- * Performs structural checks and injects default metadata.
266
+ * Filters an object by removing undefined values and specific excluded keys.
221
267
  *
222
- * @param raw - The raw JSON object from disk or network.
223
- * @returns A validated OmniPadProfile object.
224
- * @throws Error if the core structure is invalid.
225
- */
226
- declare function parseProfileJson(raw: any): OmniPadProfile;
227
- /**
228
- * The resulting structure after parsing a OmniPadProfile.
229
- * Contains a map of root nodes and a runtime-ready gamepad mapping table.
230
- */
231
- interface ParsedProfileForest {
232
- /** Root nodes indexed by their original Config ID. */
233
- roots: Record<string, ConfigTreeNode>;
234
- /**
235
- * Processed gamepad mapping where all CIDs have been
236
- * translated into unique runtime UIDs.
237
- */
238
- runtimeGamepadMappings: GamepadMappingConfig[];
239
- }
240
- /**
241
- * Converts a flat OmniPadProfile into a forest of ConfigTreeNodes for runtime rendering.
242
- * Automatically identifies all items without a parentId as root nodes.
243
- *
244
- * @param profile - The normalized profile data.
245
- * @returns A record map of root nodes, keyed by their original configuration ID.
268
+ * @param obj - The source object.
269
+ * @param excludeKeys - A set of keys to be ignored.
270
+ * @returns A new object containing only allowed business properties.
246
271
  */
247
- declare function parseProfileTrees(profile: OmniPadProfile): ParsedProfileForest;
272
+ declare function filterObjectByKeys(obj: Record<string, any>, excludeKeys: Set<string>): Record<string, any>;
248
273
  /**
249
- * Serializes the specified runtime entities into a flat OmniPadProfile.
250
- * If no rootUids are provided, exports all entities currently in the registry.
274
+ * Compares two objects and extracts the properties that have changed.
275
+ *
276
+ * This function performs a shallow comparison of keys. For nested objects,
277
+ * it performs a structural check to determine if
278
+ * the contents have changed.
251
279
  *
252
- * @param meta - Metadata for the exported profile.
253
- * @param rootUid - The Entity ID of the node to be treated as the root.
254
- * @param runtimeGamepadMapping - The current mapping from GamepadManager (using UIDs).
255
- * @returns A flat OmniPadProfile ready for storage.
280
+ * @param oldObj - The previous state or snapshot of the object.
281
+ * @param newObj - The new state of the object to compare against the old one.
282
+ * @returns A partial record containing only the key-value pairs that differ from the original.
256
283
  */
257
- declare function exportProfile(meta: OmniPadProfile['meta'], rootUids?: string[], runtimeGamepadMappings?: Readonly<GamepadMappingConfig[]>): OmniPadProfile;
284
+ declare function getObjectDiff(oldObj: Record<string, any>, newObj: Record<string, any>): Record<string, any>;
258
285
  /**
259
- * Extract filtered business configurations.
260
- * @param props Original Props object (e.g. Vue's props)
261
- * @param skipKeys Ignore key set
286
+ * Merges multiple objects from left to right.
287
+ * Later objects will override properties of earlier ones.
288
+ *
289
+ * @template T - The expected return type.
290
+ * @param objects - A list of objects to merge.
291
+ * @returns The merged object as type T.
262
292
  */
263
- declare function getBusinessProps(props: Record<string, any>, skipKeys: Set<string>): Record<string, any>;
293
+ declare function mergeObjects<T>(...objects: (Record<string, any> | undefined | null)[]): T;
264
294
 
265
295
  /**
266
296
  * Simple DOM string sanitizer to prevent CSS/JS injection.
267
297
  * Validates selectors and class names.
268
298
  */
269
- declare const DANGEROUS_KEYWORDS: readonly ["script", "onerror", "eval", "onload", "javascript"];
299
+ declare const PROTO_POLLUTION_KEYS: readonly ["__proto__", "constructor", "prototype"];
300
+ declare const XXS_DANGEROUS_KEYWORDS: readonly ["script", "javascript:", "onerror", "onload", "eval", "expression"];
270
301
  /**
271
302
  * Sanitizes a string intended for DOM use (selectors, classes, etc.)
272
- * @param input - The raw string input
273
- * @param fallback - Returned if input is unsafe
303
+ * @param input - The raw string input to be sanitized.
304
+ * @param fallback - Returned if input is unsafe.
274
305
  */
275
306
  declare function sanitizeDomString(input: string | undefined, fallback?: string): string;
276
307
  /**
277
308
  * Specifically validates and cleans CSS class strings.
278
309
  * Ensures it's just a space-separated list of valid class names.
310
+ * @param input - The raw string input to be sanitized.
279
311
  */
280
312
  declare function sanitizeCssClass(input: string | undefined): string;
313
+ /**
314
+ * Recursively sanitizes an object by stripping dangerous prototype-pollution keys.
315
+ *
316
+ * @remarks
317
+ * This function performs a deep traversal of the input and removes keys such as
318
+ * `__proto__`, `constructor`, and `prototype`. It uses an internal closure-based
319
+ * recursion and a pre-allocated `Set` to ensure optimal performance and memory
320
+ * efficiency during deep-tree processing.
321
+ *
322
+ * @param input - The raw data (usually from an untrusted JSON source) to be sanitized.
323
+ * @returns A new object/array cloned from the input, guaranteed to be free of
324
+ * prototype pollution vectors at any depth.
325
+ *
326
+ * @example
327
+ * ```typescript
328
+ * const tainted = JSON.parse('{"__proto__": {"admin": true}, "config": {"prototype": "bad"}}');
329
+ * const safe = sanitizePrototypePollution(tainted);
330
+ * // safe => { config: {} }
331
+ * ```
332
+ */
333
+ declare function sanitizePrototypePollution<T>(input: T): T;
281
334
 
282
- export { DANGEROUS_KEYWORDS, type ParsedProfileForest, addVec, applyAxialDeadzone, applyRadialDeadzone, clamp, clampVector, compressLayoutBox, createCachedProvider, degToRad, exportProfile, generateUID, getAngle, getBusinessProps, getDeadzoneScalar, getDistance, getObjectDiff, isGlobalID, isVec2Equal, lengthToCss, lerp, lockTo4Directions, lockTo8Directions, normalizeVec, parseLength, parseProfileJson, parseProfileTrees, percentToPx, pxToPercent, radToDeg, radToVec, remap, resolveLayoutStyle, roundTo, sanitizeCssClass, sanitizeDomString, sanitizeParsedLength, scaleVec, subVec, validateLayoutBox };
335
+ export { PROTO_POLLUTION_KEYS, XXS_DANGEROUS_KEYWORDS, addVec, applyAxialDeadzone, applyRadialDeadzone, clamp, clampVector, compressLayoutBox, createCachedProvider, degToRad, distillCustom, distillPointer, distillRect, filterObjectByKeys, flattenRelativeLayout, generateUID, getAngle, getDeadzoneScalar, getDistance, getObjectDiff, isGlobalID, isVec2Equal, lengthToCss, lerp, lockTo4Directions, lockTo8Directions, mergeObjects, normalizeVec, parseLength, percentToPx, projectPercentToBox, projectVectorToBox, pxToPercent, radToDeg, radToVec, remap, resolveLayoutStyle, roundTo, sanitizeCssClass, sanitizeDomString, sanitizeParsedLength, sanitizePrototypePollution, scaleVec, subVec, validateLayoutBox };
@@ -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};
1
+ export{a as filterObjectByKeys,b as getObjectDiff,c as mergeObjects}from'../chunk-AK3RL7NL.mjs';export{c as distillCustom,b as distillPointer,a as distillRect}from'../chunk-J5SVBM6K.mjs';export{i as PROTO_POLLUTION_KEYS,j as XXS_DANGEROUS_KEYWORDS,o as addVec,I as applyAxialDeadzone,H as applyRadialDeadzone,q as clamp,x as clampVector,N as compressLayoutBox,f as createCachedProvider,w as degToRad,O as flattenRelativeLayout,g as generateUID,u as getAngle,G as getDeadzoneScalar,t as getDistance,h as isGlobalID,F as isVec2Equal,L as lengthToCss,r as lerp,z as lockTo4Directions,y as lockTo8Directions,C as normalizeVec,J as parseLength,A as percentToPx,R as projectPercentToBox,Q as projectVectorToBox,B as pxToPercent,v as radToDeg,D as radToVec,E as remap,P as resolveLayoutStyle,s as roundTo,l as sanitizeCssClass,k as sanitizeDomString,K as sanitizeParsedLength,m as sanitizePrototypePollution,p as scaleVec,n as subVec,M as validateLayoutBox}from'../chunk-EYKCVOUA.mjs';import'../chunk-HQNUZXP5.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnipad/core",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -21,6 +21,11 @@
21
21
  "types": "./dist/dom/index.d.ts",
22
22
  "import": "./dist/dom/index.mjs",
23
23
  "require": "./dist/dom/index.cjs"
24
+ },
25
+ "./guest": {
26
+ "types": "./dist/guest/index.d.ts",
27
+ "import": "./dist/guest/index.mjs",
28
+ "require": "./dist/guest/index.cjs"
24
29
  }
25
30
  },
26
31
  "typesVersions": {
@@ -33,6 +38,9 @@
33
38
  ],
34
39
  "dom": [
35
40
  "./dist/dom/index.d.ts"
41
+ ],
42
+ "guest": [
43
+ "./dist/guest/index.d.ts"
36
44
  ]
37
45
  }
38
46
  },