Currently alignX and alignY take raw numbers that map to Clay's internal enum:
// alignX: LEFT=0, RIGHT=1, CENTER=2
// alignY: TOP=0, BOTTOM=1, CENTER=2
alignX: 2, alignY: 1 // what does this mean?
Change the type from number to string literal unions:
alignX?: "left" | "center" | "right";
alignY?: "top" | "center" | "bottom";
The conversion to 0/1/2 happens in pack(). Callers get readable code with zero helpers:
alignX: "center", alignY: "bottom"
V8 interns these short strings so there's no performance cost vs integers.
Files to change
ops.ts — update OpenElement interface and pack() function
validate.ts — update schema from u8 to string enum
Currently
alignXandalignYtake raw numbers that map to Clay's internal enum:Change the type from
numberto string literal unions:The conversion to
0/1/2happens inpack(). Callers get readable code with zero helpers:V8 interns these short strings so there's no performance cost vs integers.
Files to change
ops.ts— updateOpenElementinterface andpack()functionvalidate.ts— update schema fromu8to string enum