feat: add useMousePosition utility#406
Open
hugentobler wants to merge 1 commit intosvecosystem:mainfrom
Open
Conversation
Reactive cursor position tracking in viewport coordinates and relative to an optional target element. Follows the onClickOutside pattern with start()/stop()/enabled listener control. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add
useMousePosition— a reactive utility that tracks cursor position in viewport coordinates and optionally relative to a target element. Follows theonClickOutsidepattern withstart()/stop()/enabledlistener control.PR Checklist
Code is formatted and linted (
pnpm lint,pnpm format)pnpm format— all files unchanged (clean)pnpm lint— 0 errors, 0 warningsTypes pass (
pnpm check)svelte-check— 0 errors, 0 warnings across both packagesTests pass locally (
pnpm test)immediateoption (4 tests)Docs updated (content + demo)
Files Added
packages/runed/src/lib/utilities/use-mouse-position/use-mouse-position.svelte.ts— implementationpackages/runed/src/lib/utilities/use-mouse-position/index.ts— barrel exportpackages/runed/src/lib/utilities/use-mouse-position/use-mouse-position.test.svelte.ts— unit testssites/docs/src/content/utilities/use-mouse-position.md— docs pagesites/docs/src/lib/components/demos/use-mouse-position.svelte— demo componentFiles Modified
packages/runed/src/lib/utilities/index.ts— addeduse-mouse-positionexport🤖 Generated with Claude Code