The best way to control Claude Code, Codex and more from any computer or phone

main
ts 17 lines 677 Bytes
Raw
1 const COMPACT_EDITOR_SLOT_INSET = 4;
2
3 /**
4 * Places the floating editor over its slot. Layout x is measured from the left,
5 * but React Native swaps left and right styles in RTL, so the insets trade places.
6 */
7 export function compactEditorInsets(input: {
8 readonly slotX: number;
9 readonly slotWidth: number;
10 readonly rowWidth: number;
11 readonly isRTL: boolean;
12 }): { left: number; right: number } {
13 "worklet";
14 const fromLeft = input.slotX + COMPACT_EDITOR_SLOT_INSET;
15 const fromRight = input.rowWidth - input.slotX - input.slotWidth + COMPACT_EDITOR_SLOT_INSET;
16 return input.isRTL ? { left: fromRight, right: fromLeft } : { left: fromLeft, right: fromRight };
17 }