feat: add withResizeObserver reusable - #17
Open
Guria wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new Reatom extension withResizeObserver for Atom<HTMLElement | null> that exposes the latest ResizeObserverEntry via a lazy .sizeEntry computed, along with docs, an example, browser tests, and registry metadata to publish it as a reusable.
Changes:
- Added
withResizeObserver()extension that wires anHTMLElement | nullatom to a lazily-connectedResizeObserver. - Added documentation, example usage, and headless-browser test coverage for observation behavior and computed naming.
- Registered the reusable in
registry.jsonand via ajsrepometa descriptor.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/reusables/resize-observer/with-resize-observer.ts | Implements the withResizeObserver extension and .sizeEntry computed. |
| src/reusables/resize-observer/with-resize-observer.meta.ts | Declares registry metadata for the reusable and its doc/test/example files. |
| src/reusables/resize-observer/with-resize-observer.md | Documents API, behavior, and usage example. |
| src/reusables/resize-observer/with-resize-observer.example.ts | Provides a minimal usage example for the extension. |
| src/reusables/resize-observer/with-resize-observer.browser.test.ts | Adds browser tests covering resize updates, null target, element switching, and naming. |
| registry.json | Registers withResizeObserver as a new reatom:extension entry and its associated files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+41
to
+51
| subscribe: (set) => { | ||
| const observer = new ResizeObserver( | ||
| wrap((entries) => { | ||
| set(entries.find((entry) => entry.target === node)) | ||
| }), | ||
| ) | ||
|
|
||
| observer.observe(node) | ||
|
|
||
| return () => observer.disconnect() | ||
| }, |
Add a ResizeObserver extension with docs, browser tests, example, and registry entry.
Guria
force-pushed
the
feat/with-resize-observer
branch
from
July 13, 2026 23:48
ff7db0b to
aa25369
Compare
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.
Adds
withResizeObserver— an extension forAtom<HTMLElement | null>that adds asizeEntrycomputed exposing the latestResizeObserverEntryfor the current element.memo+reatomObservableonly whilesizeEntryis connected, and disconnects automatically on element change/disconnect.src/shared/reatom/resize-observer.ts) where it backs responsive component measurements.nullelement, switching elements, and trace naming.🤖 Generated with Claude Code