1const 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 */
7export 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}