@tunjiadeyemi/sveltool
v0.0.1
Published
A powerful collection of interactive Svelte components for building modern web applications. Sveltool provides drag-and-drop functionality, magnification tools, note-taking capabilities, and advanced UI components with built-in styling.
Downloads
2
Maintainers
Readme
🔧 Sveltool
A powerful collection of interactive Svelte components for building modern web applications. Sveltool provides drag-and-drop functionality, magnification tools, note-taking capabilities, and advanced UI components with built-in styling.
✨ Features
- 🎯 Interactive Components: Drag-and-drop, resizable, and interactive UI elements
- 🔍 Magnifier Tool: Zoom and magnify content with customizable lens
- 📝 Notepad Component: Draggable notepad with persistent storage
- 📊 Graph Selector: Interactive graph selection component
- 📏 Line Reader: Customizable line reading tool with background colors
- 🎨 Built-in Styling: Pre-styled with Tailwind CSS
- 🚀 Svelte 5 Ready: Built for the latest Svelte version
- 📦 TypeScript Support: Full TypeScript support included
📦 Installation
npm install @tunjiadeyemi/sveltoolyarn add @tunjiadeyemi/sveltoolpnpm add @tunjiadeyemi/sveltool🚀 Quick Start
Basic Usage
<script>
import { Notepad, Magnifier, LineReader } from '@tunjiadeyemi/sveltool';
// Styles are automatically included
</script>
<!-- Draggable Notepad -->
<Notepad open={true} />
<!-- Magnifier with custom zoom -->
<Magnifier open={true} zoom={2} lensSize={250}>
<p>Your content to magnify goes here...</p>
</Magnifier>
<!-- Line Reader with blue background -->
<LineReader backgroundColor="blue" />Manual Style Import (if needed)
If styles don't load automatically, you can import them manually:
import '@tunjiadeyemi/sveltool/styles';📚 Components
🗒️ Notepad
A draggable notepad component with persistent storage.
<script>
import { Notepad } from '@tunjiadeyemi/sveltool';
let isOpen = true;
function handleClose() {
isOpen = false;
}
</script>
<Notepad
open={isOpen}
handleClose={handleClose}
/>Props:
open(boolean): Controls visibility of the notepadhandleClose(function): Callback function when close button is clicked
🔍 Magnifier
Interactive magnification tool with draggable lens.
<script>
import { Magnifier } from '@tunjiadeyemi/sveltool';
</script>
<Magnifier
open={true}
zoom={3}
lensSize={200}
borderRadius={50}
>
<img src="your-image.jpg" alt="Content to magnify" />
<p>Any content can be magnified...</p>
</Magnifier>Props:
open(boolean): Controls visibility of the magnifierzoom(number): Magnification level (default: 2)lensSize(number): Size of the magnification lens in pixels (default: 250)borderRadius(number): Border radius of the lens as percentage (default: 10)
📏 LineReader
Customizable line reading tool with draggable and resizable functionality.
<script>
import { LineReader } from '@tunjiadeyemi/sveltool';
</script>
<LineReader backgroundColor="rgba(255, 255, 0, 0.3)" />Props:
backgroundColor(string): Background color of the reading line
📊 GraphSelector
Interactive graph selection component for data visualization.
<script>
import { GraphSelector } from '@tunjiadeyemi/sveltool';
</script>
<GraphSelector />🎯 RaySelector
Advanced ray selection tool for precise interactions.
<script>
import { RaySelector } from '@tunjiadeyemi/sveltool';
</script>
<RaySelector />🎨 Styling
Sveltool comes with built-in Tailwind CSS styling. The styles are automatically included when you import any component.
Custom Styling
You can override the default styles by targeting the component classes:
/* Override notepad styles */
.sveltool-notepad {
/* Your custom styles */
}
/* Override magnifier styles */
.magnifier-lens {
/* Your custom styles */
}🔧 Development
Prerequisites
- Node.js 18+
- npm, yarn, or pnpm
Setup
- Clone the repository:
git clone https://github.com/tunjiadeyemi/sveltool.git
cd sveltool- Install dependencies:
npm installDevelopment Commands
🚀 For Regular Development
npm run devUse this when working on components without adding new Tailwind CSS classes.
⚡ For Development with New Styles (Recommended)
npm run dev:fullThis is the recommended command for development! It automatically:
- ✅ Watches for CSS changes and rebuilds Tailwind automatically
- ✅ Runs the development server
- ✅ Auto-reloads when you add new Tailwind classes
🎨 Manual CSS Commands
# Build CSS once (when you add new Tailwind classes)
npm run build:css
# Watch and rebuild CSS automatically
npm run build:css:watch📦 Package for Distribution
npm run packageAutomatically builds CSS before packaging the library.
Development Workflow
Option A: Automated (Recommended)
# Single command that handles everything
npm run dev:fullOption B: Manual Control
# Terminal 1: Watch CSS changes
npm run build:css:watch
# Terminal 2: Run dev server
npm run devAdding New Components
Create your component in
src/lib/components/YourComponent.svelteUse Tailwind classes freely in your component
If using
npm run dev:full→ CSS rebuilds automatically ✨If using
npm run dev→ Runnpm run build:csswhen you add new classesExport your component in
src/lib/index.tsTest in the demo by importing in
src/routes/+page.svelteOpen http://localhost:5174 to view the demo
Building
Build the library:
npm run packageBuild and preview:
npm run build
npm run previewTesting
Run type checking:
npm run checkRun continuous type checking:
npm run check:watch🤝 Contributing
We welcome contributions! Please see our Contributing Guidelines below.
Contributing Guidelines
- Fork the repository and create your feature branch from
main - Install dependencies:
npm install - Start development with automated CSS building:
npm run dev:full - Make your changes in the
src/lib/components/directory - Add/update tests if applicable
- Run type checking:
npm run check - Build the library:
npm run package(CSS builds automatically) - Test your changes in the demo app
- Commit your changes with descriptive commit messages
- Push to your fork and submit a pull request
Development Workflow
# 1. Start development with auto CSS building
npm run dev:full
# 2. Create a new component
touch src/lib/components/MyNewComponent.svelte
# 3. Export it in the main index
# Add to src/lib/index.ts
# 4. Add TypeScript types if needed
# Add to src/lib/types/index.ts
# 5. Test your component in the demo
# Edit src/routes/+page.svelte
# (CSS rebuilds automatically when you save!)
# 6. Build and test
npm run package📋 Quick Reference - Available Commands
| Command | Purpose | When to Use |
| ------------------------- | ---------------------------------------------- | ------------------------------------ |
| npm run dev | Standard development server | Working without new Tailwind classes |
| npm run dev:full | Recommended: Dev server + auto CSS rebuild | Adding new components/styles |
| npm run build:css | Build CSS once | After adding new Tailwind classes |
| npm run build:css:watch | Watch and rebuild CSS | Manual control over CSS building |
| npm run package | Build library for distribution | Before publishing/testing |
| npm run check | TypeScript type checking | Before committing |
Component Development Guidelines
- Use TypeScript for all component props
- Include JSDoc comments for all props
- Follow Svelte 5 best practices
- Use Tailwind CSS for styling
- Ensure components are accessible
- Add proper event handling
- Include error boundaries where needed
Code Style
- Use Prettier for formatting
- Follow ESLint rules
- Use meaningful variable names
- Add comments for complex logic
- Keep components small and focused
📝 Changelog
v0.0.1 (Current)
- Initial release
- Added Notepad component with drag functionality
- Added Magnifier component with zoom controls
- Added LineReader component with customizable background
- Added GraphSelector and RaySelector components
- Integrated Tailwind CSS styling
- TypeScript support
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
👨💻 Author
Tunji Adeyemi
- Website: https://tunny.netlify.app/
- GitHub: @tunjiadeyemi
- Email: [email protected]
🙏 Acknowledgments
- Built with SvelteKit
- Styled with Tailwind CSS
- Powered by Vite
📞 Support
If you have any questions or need help:
- Check the documentation above
- Look through existing issues
- Create a new issue if needed
Made with ❤️ by Tunji Adeyemi
