Home
Softono
svelte-legos

svelte-legos

Open source MIT TypeScript
810
Stars
30
Forks
52
Issues
8
Watchers
10 months
Last Commit

About svelte-legos

# Svelte Legos Collection of essential Svelte Composition Utilities

## πŸš€ Features - πŸŽͺ [**Interactive docs & demos**](https://svelte-legos.surge.sh) - ⚑ **Fully tree shakeable**: Only take what you want, [bundle size] - 🦾 **Type Strong**: Written in [TypeScript](https://www.typescriptlang.org/), with [TS Docs](https://github.com/microsoft/tsdoc) - πŸ”‹ **SSR Friendly** - 🌎 **No bundler required**: Usable via CDN - πŸ”© **Flexible**: Configurable event filters and targets ## πŸ¦„ Usage ```svelte {counter} ``` ```svelte

Platforms

Web Self-hosted

Languages

TypeScript

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