Skip to content

Feat: add bounds with offset support#253

Open
Arecsu wants to merge 2 commits intoPuruVJ:mainfrom
Arecsu:feat/bounds-with-offset
Open

Feat: add bounds with offset support#253
Arecsu wants to merge 2 commits intoPuruVJ:mainfrom
Arecsu:feat/bounds-with-offset

Conversation

@Arecsu
Copy link
Copy Markdown

@Arecsu Arecsu commented Sep 24, 2025

Summary

Adds DragBoundsWithOffset type that allows specifying an element as bounds container with optional offset values
applied to its boundaries. This was only achievable on the viewport using bounds. Now it can work with any arbitrary element.

Changes

  • Add DragBoundsWithOffset type to core package
  • Update compute_bound_rect function to handle element bounds with offsets
  • Export new type in all framework packages (React, Svelte, Solid, Vanilla, Vue)
  • Add documentation and interactive examples
  • Update JSDoc comments with usage examples
  • Backwards compatible

Usage

// Allow draggable to overflow parent by 30px on all sides
bounds: { element: 'parent', offsets: { top: -30, left: -30, bottom: -30, right: -30 } }

// Constrain within element with 20px padding
bounds: { element: '.container', offsets: { top: 20, left: 20, bottom: 20, right: 20 } }

Add DragBoundsWithOffset type that allows specifying an element as bounds container with optional offset values applied to its boundaries.

- Add DragBoundsWithOffset type to core package
- Update compute_bound_rect function to handle element bounds with offsets
- Export new type in all framework packages (React, Svelte, Solid, Vanilla, Vue)
- Update JSDoc comments with usage examples
- Add DragBoundsWithOffset type to exported types documentation
- Update bounds option documentation with offset functionality
- Add OffsetBounds.example.svelte component demonstrating negative offsets
- Update all framework code examples to show parent bounds with -30px offsets
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Sep 24, 2025

⚠️ No Changeset found

Latest commit: fcef9ea

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Sep 24, 2025

@Arecsu is attempting to deploy a commit to the Purus Projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant