Widgets: reflow floating cards when the desktop resizes - #914
Open
juanlentino wants to merge 1 commit into
Open
juanlentino wants to merge 1 commit into
juanlentino wants to merge 1 commit into
Conversation
Touching floating cards form one arrangement that keeps its distance to the nearest edge per axis, so a grid parked beside the docked column follows it when the window widens. The saved area size is stored so a session opened at another size reflows on boot too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Po8uLv2drpnsAWMkNmG2Tf
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.
Fixes #913
Floating widgets stored a fixed left/top offset, so when the window got wider, the docked column moved right with the edge and the cards lined up next to it stayed behind.
What changed
src/widgets/reflow.ts(new, pure): cards within 32 px of each other form one group. Each group keeps its distance to whichever edge it's nearest to, on each axis (a right-leaning group follows the right edge, a left one stays, a centered one stays centered). Cards never move relative to their own group, so a hand-built grid survives any resize.src/widgets/layer.ts: reflows on area resize (the existing ResizeObserver /resizepath) and on boot, then runs the existing work-area clamp.src/widgets/state.ts: newopenstation-widgets-geometry-framelocalStorage key storing the area size the geometry was saved against, so a session opened at another size reflows on load. Existing frozendesktop-mode-*keys are untouched.docs/javascript-reference.md(widget geometry section) anddocs/data-model.md(web-storage row).tests/vitest/widgets-reflow.test.ts.Testing
npm run build,npm run lint,npm run typecheck, andnpm run test:jsall pass.🤖 Generated with Claude Code