Repository navigation
Modernize the toolchain and add a test suite - #3
Merged
Merged
Conversation
Drop the Babel config so Next can use SWC/Turbopack, upgrade to Next 16 and React 19, swap microbundle for tsup with a proper exports map, move to ESLint flat config, and add vitest coverage for the machine, utils and component. Replaces the vendored @reach/portal copy with a portal that renders into a detached node, avoiding an extra render and a placeholder element.
The published stylesheet no longer runs through Tailwind, and the docs no longer pull in the library's custom property fallbacks by accident. The docs theme moves from tailwind.config.js to CSS-first tokens, which also drops a dead Tailwind 2 variants block.
# Conflicts: # package.json
|
🎉 This PR is included in version 3.9.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Stacked on #2 — review that one first.
Summary
Brings the toolchain up to date and adds the test suite the project never had. No API change.
Build tooling
.babelrc. It existed only fortransform-remove-console, and there are noconsolecalls left in the library. Its real effect was disabling SWC, so every Next build ran through Babel/webpack.exportsmap with a real.mjsbuild../dist/style.cssis kept as an export so existingimport 'guiw5-bottom-sheet/dist/style.css'does not break;./style.cssis the new shorter path.eslint-config-react-appis unmaintained and pins ESLint 8; replaced withtypescript-eslint+eslint-plugin-react-hooksv7 +jsx-a11y+@next/eslint-plugin-next.POSTCSS_TARGET=library.tailwind.config.jsto CSS-first tokens indocs/theme.css. The old config still used the v2purgekey and avariantsblock that has been dead since v3, and aliasedgrayto a colour (blueGray) removed in v3.huskykey in package.json was v4 format, so the pre-commit hook has not been running at all; hooks now live in.husky/.@types/node14 → 24.trailingCommapinned toes5to avoid reformatting the whole repo.rimraf,postcss-svgo,svgoand@types/classnames— all unreferenced.CI
actions/checkoutandsetup-nodev4 → v5, Node 20 → 22 and 24, npm caching enabled.permissionsblocks, and npm build provenance on release.Tests
25 tests, ~3s. Covers
utils, the XState machine, and the component in happy-dom, including regression tests for the bugs fixed in #2:initialState: 'OPEN'must take the immediate branch and never render visually hidden (this is whatskipInitialTransitiondrives).CLOSEwhile already closed is a no-op.SNAPpayload reaches the spring actor.deactivateruns before the close animation.StrictMode— the exact case where react-spring v8 left the springs dead.Portal
Replaced the vendored
@reach/portalcopy (4 files) with a ~30 linesrc/Portal.tsx. It renders into a detached node and attaches it in a layout effect, which removes the extra render and the placeholder<span>the create-then-forceUpdate approach needed. It also applies thedata-rsbs-portalattribute, which the vendored copy silently dropped.Deliberately not upgraded
eslint-plugin-jsx-a11yhas no ESLint 10 support, and a11y linting is worth keeping hererollup-plugin-dtsis built against TS 5.7). Verified: the JS builds, the types do notKnown warnings (not new)
Lint reports 8 warnings from the React Compiler era rules, all pre-existing patterns: reading refs during render in
useSnapPointsanduseReducedMotion, andsetStatein an effect inuseReady. They are warnings rather than errors on purpose —useReadyin particular causes several cascading renders on mount, and reworking it belongs in the performance PR.Test plan
npm test: lint, 25 unit tests, library build, docs buildexportspaths resolvefixtures/simple,fixtures/sticky,fixtures/scrollable— open, drag, snap, content resize, Escape dismiss, unmount, scroll-lock and aria-hidden restore