Home
Softono

Svelte Legos

Open source MIT TypeScript
810
Stars
30
Forks
52
Issues
8
Watchers
1 year
Last Commit

 About Svelte Legos

Svelte Legos is a comprehensive collection of essential composition utilities designed for the Svelte framework. This library currently offers 87 distinct utilities aimed at simplifying common development tasks such as state management, event handling, and DOM interaction. The project is fully tree-shakeable, ensuring that only the specific functions you import are included in your final bundle, which helps maintain optimal application performance. Written in TypeScript, it provides strong type safety and includes TSDocs for improved developer experience. The utilities are server-side rendering friendly and can be used in environments without a bundler via CDN. Key features include flexible configurations for event filters and targets, making it adaptable to various use cases. For example, developers can easily create reactive counters or implement click-outside detection for modals using simple imports. While the project notes that it is no longer being actively maintained, it remains a valuable resource ins

Platforms

Web Self-hosted

Languages

TypeScript

Need Help Installing Svelte Legos?

We provide expert installation service for this software. Our team will install, configure, and secure Svelte Legos on your server. plans start at just $30.

Svelte Legos

View on GitHub

Svelte Legos

Collection of essential Svelte Composition Utilities

πŸš€ Features

  • πŸŽͺ Interactive docs & demos
  • ⚑ Fully tree shakeable: Only take what you want, [bundle size]
  • 🦾 Type Strong: Written in TypeScript, with TS Docs
  • πŸ”‹ SSR Friendly
  • 🌎 No bundler required: Usable via CDN
  • πŸ”© Flexible: Configurable event filters and targets

πŸ¦„ Usage

<script lang="ts">
import { counterStore } from "svelte-legos";

const { counter, inc, dec, set, reset } = counterStore();
</script>

<button on:click={() => inc()}>Increment</button>

{counter}

<button on:click={() => dec()}>Decrement</button>
<script lang="ts">
import { clickOutsideAction } from "svelte-legos";

let hidden = false;

function handleClickOutside() {
	hidden = !hidden;
}
</script>

<div class="modal" use:clickOutsideAction on:clickoutside={handleClickOutside} />

Refer to functions list or documentations for more details.

πŸ“¦ Install

npm i svelte-legos

Local setup

npm run start:dev

🌸 Thanks

This project is heavily inspired by the following awesome projects.

License

MIT