@shadow-garden/bapbong-selection
v0.6.0
Published
bapbong — caret/selection math over ResolvedLayout (hit-test, caret rect, selection rects)
Downloads
1,073
Readme
@shadow-garden/bapbong-selection
Pure caret/selection math over a ResolvedLayout. No DOM, no ProseMirror
dependency — positions come from the layout (LayoutSegment.pos,
LayoutLine.from/to) and text widths from an injected MeasureText.
- Scope:
scope:selection - Depends on:
@shadow-garden/bapbong-contracts
Public API
hitTest(layout, point, measure)— page-local(x, y)→ ProseMirror positioncaretRect(layout, pos, measure)— PM position → caret rectangle (with page index)selectionRects(layout, from, to, measure)— selection range → highlight rectsverticalCaret(layout, pos, dir, goalX, measure)— Up/Down caret motion
Build / test
pnpm nx build @shadow-garden/bapbong-selection
pnpm nx test @shadow-garden/bapbong-selection