Fix bugs, complete resize features, add lifecycle API, docs, tests, and harden packaging/CI#2
Merged
Stephen10121 merged 2 commits intoStephen10121:mainfrom Mar 20, 2026
Conversation
Bug fixes: - Fix iframeWindowClickedSubscribe unsubscribe targeting wrong map (was deleting from activeWindowSubscribers instead of iframeWindowClickedListeners, causing memory leaks) - Replace hardcoded sentinel string with exported INACTIVE_MOUSE_ID constant across utils.ts, Window.svelte, and WindowManager.svelte - Fix stale basicStyling prop and invalid style prop in playground Dead code cleanup: - Remove empty src/lib/helper.ts - Remove unused .cover CSS class from Window.svelte - Remove commented-out IE scroll code from utils.ts and WindowDragger - Remove unused WithoutChild/WithoutChildren/WithoutChildrenOrChild types - Delete static/style.css (all CSS commented out) and its app.html link Touch resize support: - Add ontouchstart + preventScroll to all four edge resize components (TopResize, BottomResize, LeftResize, RightResize) matching the existing pattern from WindowDragger Corner resize handles: - Add TopLeftResize, TopRightResize, BottomLeftResize, BottomRightResize components with both mouse and touch support - Each adjusts two axes simultaneously with minWidth/minHeight enforcement - Wire into Window.svelte alongside existing edge handles Lifecycle callbacks: - Add onDragStart, onDragEnd, onResizeStart, onResizeEnd to ActualWindowProps with WindowPosition and WindowDimensions payload types - Wire drag callbacks through WindowDragger - Wire resize callbacks through all edge and corner resize components - Detect interaction end via INACTIVE_MOUSE_ID broadcast in Window.svelte Public API expansion: - Export INACTIVE_MOUSE_ID, WindowPosition, WindowDimensions from index.ts Documentation: - Replace /docs stub with full docs page (quick start, API reference, props table, lifecycle callbacks, styling guide, exports) - Expand README with badges, install, usage, feature list, callback docs, exports, and links to docs/playground Testing infrastructure: - Add vitest, @testing-library/svelte, @testing-library/jest-dom, jsdom - Add vitest.config.ts with browser resolve conditions for Svelte 5 - Add test and test:watch scripts to package.json - Write MouseContext tests (subscription, dispatch, touch, sentinel) - Write WindowContext tests (registration, stacking, iframe unsub fix) - Write Window.svelte tests (drag regions, conditional resize handles) - Write WindowDragger tests (mousedown activation, coordinate updates) Made-with: Cursor
Package hygiene -- stop shipping non-library files to npm: - Move src/lib/homepage/ to src/homepage/ (site-only components) - Move src/lib/components/ui/button/ to src/components/ui/button/ - Move src/lib/tailwindutils.ts to src/tailwindutils.ts - Move src/lib/test-harnesses/ to src/test/harnesses/ - Move test files from src/lib/*.test.ts to src/test/lib/*.test.ts - Update all import paths in routes, homepage, button, and test files - dist/ now contains only library code (verified: no homepage, button, tailwindutils, test-harnesses, or test files in output) Repo hygiene: - Add .cursor/ to .gitignore - Remove stray console.log button handler from Demo.svelte Documentation accuracy: - Fix onActiveStateChanged payload: documented as object but actual callback receives a plain boolean - Add children prop to Window props table (was missing) - Add WindowManager props section (children, mouseContext, windowContext were completely undocumented) - Add WindowDragConfig reference (top/bottom and left/right mutual exclusivity, color debug option, required width+height, example) CI/CD hardening: - Upgrade actions/checkout@v1 to v4 (v1 uses deprecated Node 12) - Add setup-node@v4 with Node 22 and npm cache - Add npm run check and npm run test steps before Docker build - Gate Docker push behind github.event_name == 'push' so PRs from forks don't fail on missing secrets Docker hardening: - Pin base images to node:22-slim instead of unpinned node:slim - Replace deprecated npm prune --production with npm ci --omit=dev - Add .dockerignore to exclude node_modules, .git, .svelte-kit, dist, .cursor, and markdown files from build context Made-with: Cursor
Owner
|
Hey. This looks amazing. Just merged the changes. I will add a contributor section to give credit. The website already has been updated with the CD pipeline but I'll have to update the npm package manually. Should be updated in no time. Thank you for your contributions. |
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.
Summary
Two commits that bring the library from WIP to release-ready quality:
Commit 1 -- Feature & bug fix pass:
iframeWindowClickedSubscribeunsubscribe targeting wrong map (memory leak)INACTIVE_MOUSE_IDconstantonDragStart/onDragEnd/onResizeStart/onResizeEndlifecycle callbacksWindowPosition,WindowDimensions,INACTIVE_MOUSE_IDCommit 2 -- Hardening pass:
src/lib/sodist/only ships library files.cursor/to.gitignoreconsole.loghandler from DemoonActiveStateChangedpayload documented as object (actual: boolean)childrenprop to docsactions/checkout@v4, add Node setup + check/test steps, gate Docker push on push eventsnode:22-slim, replace deprecatednpm prune, add.dockerignoreTest plan
npm run checkpasses (0 errors)npm run testpasses (9/9 tests)npm run buildpasses (vite build + svelte-package + publint)dist/contains only library components (no homepage, button, tailwindutils, tests)/docsroute renders full documentation/playgroundroute still worksMade with Cursor