Fat/selection#141
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| @@ -144,6 +168,7 @@ export function Annotations({ prerenderedDiff }: AnnotationsProps) { | |||
| backgroundColor: '#1a76d4', | |||
| transition: 'none', | |||
| cursor: 'pointer', | |||
| pointerEvents: 'none', | |||
There was a problem hiding this comment.
I changed the logic here so that this is really like a "fake" button and clicking it really clicks through to the line number which is what ultimately triggers the comment adding.
Number of benefits here imo (particularly fixes annoying thing with mouse over / highlight state, etc.
| @@ -155,6 +180,9 @@ export function Annotations({ prerenderedDiff }: AnnotationsProps) { | |||
| options={{ | |||
| ...prerenderedDiff.options, | |||
| onLineEnter: handleLineEnter, | |||
| enableLineSelection: !hasOpenCommentForm, | |||
There was a problem hiding this comment.
@amadeus i think this is the right place for this stuff to live, but lmk if you'd rather it be top level
| whiteSpace: 'normal', | ||
| margin: 20, | ||
| fontFamily: 'Geist', | ||
| marginLeft: -43, |
| @@ -0,0 +1,454 @@ | |||
| import type { AnnotationSide } from './types'; | |||
There was a problem hiding this comment.
I mostly tried to crib the logic from pierre.co for this guy – but follow existing code patterns. One thing to note is i ended up ripping out the url management… and just adding more event handers (assume people could wire that up + scroll to) themselves
| lineAnnotations: lineAnnotations, | ||
| }); | ||
| const instance = instanceRef.current; | ||
| const forceRender = !deepEqual(instance.options, options); |
There was a problem hiding this comment.
so the downside of this is that forceRender will become true when the selection updates, which will trickle down into the render step which is probably something we don't want.
We need to come up with a better way for these side-effecty things.
There was a problem hiding this comment.
yah that makes sense to me…
45e65ea to
0e2b3c7
Compare
0e2b3c7 to
e151d3a
Compare
e151d3a to
5c06598
Compare
5c06598 to
db09d87
Compare
* New blue, more cyan than indigo * mdo: wip * wowzers * Edit content, new design * Remove commented out blocks
3ebd0b5 to
1edae2d
Compare
* First pass at improved handling for selection related code
* Unify composedPath generation
* Adding `data-alt-line` property to context lines
This will make it much easier to mux selection types between unified and
split diffs
* Reworked LineSelectionManager
This commit accomplished quite a lote
* Simplified and improved SelectedLineRange API
* Much simpler interface with a more human API (similar in spirit to
LineAnnotations)
* Selected lines fully transition between 'split' and 'unified' diffs
* DOM updates from mouse events are now debounced through
requestAnimationFrame
* Rendering is now smarter to not actually perform dom node changes if
not necessary
* Improved some O(n) when it comes to processing/updating lines
* Update docs to fit new types
* Tweak documentation for `selectedLines` in react components * hopefully make it clearer * More docs content updates * consistency

This add a rich selection api to our diff and file components as well as implements a multi line comment ui in the comments and annotation example.
CleanShot.2025-11-07.at.17.30.39.mp4