Guidelines for AI assistants working on this repository.
This is a lightweight dropdown positioning library for input/textarea elements. The codebase is intentionally minimal.
Tech Stack:
- TypeScript
- tsup (bundler)
- semantic-release (automated releases)
src/
index.ts # Main library - all exports
demo/
index.html # Interactive demo
dist/ # Built output (gitignored)
.github/
workflows/
ci.yml # Build/test on PRs
release.yml # Semantic release on main
npm install # Install dependencies
npm run build # Build library
npm run dev # Build with watch mode
npm run demo # Serve demo at localhost:3000- Keep it minimal - This library is intentionally small (~4KB). Avoid adding dependencies.
- Type everything - All exports must have TypeScript types.
- Test in demo - Run
npm run demoand test changes at/demo/.
This repo uses semantic-release with Conventional Commits. Commit messages determine version bumps automatically.
| Type | Description | Version Bump |
|---|---|---|
fix |
Bug fixes | Patch (1.0.0 → 1.0.1) |
feat |
New features | Minor (1.0.0 → 1.1.0) |
feat! |
Breaking changes | Major (1.0.0 → 2.0.0) |
docs |
Documentation only | No release |
chore |
Maintenance tasks | No release |
refactor |
Code refactoring | No release |
style |
Formatting changes | No release |
test |
Adding tests | No release |
# Bug fix - triggers patch release
git commit -m "fix: correct dropdown position when parent is scrollable"
# New feature - triggers minor release
git commit -m "feat: add maxHeight option to limit dropdown height"
# Breaking change - triggers major release
git commit -m "feat!: rename computePosition to getPosition"
# Or with body for breaking change
git commit -m "feat: change API signature
BREAKING CHANGE: computePosition now requires options object"
# No release
git commit -m "docs: update README examples"
git commit -m "chore: update dev dependencies"You can add a scope for clarity:
git commit -m "fix(position): handle RTL layouts correctly"
git commit -m "feat(auto-update): add animationFrame option"- Create feature branch from
main - Make changes with conventional commits
- Push and create PR
- CI runs on PR (build + type check)
- Merge to
maintriggers semantic-release
computePosition(reference, floating, config)- Calculate dropdown positionapplyPosition(floating, position)- Apply styles to elementautoUpdate(reference, floating, update, options)- Handle scroll/resizecreateDropdown(reference, floating, config)- High-level API with show/hide
When adding new options:
- Add to the appropriate interface (
PositionConfigorAutoUpdateOptions) - Implement in the relevant function
- Update demo to showcase the feature
- Use a
feat:commit message