Svultimate Svelte(Kit) Svutilities

Overview

/svu

/svu is a collection of Svelte(Kit) utillities that make developing webapps even more easy and fun.

Read the docs at http://svu.vercel.app

Why

Svelte and SvelteKit make web development easy and fun. No wonder it’s the most loved web framework in the world. Although Svelte, especially in conjunction with SvelteKit is fairly batteries-included, there are a bunch of small things they rightfully leave up to the developer.

This package aims to be a collection of all of those small things that bring a little spark of joy to your next Svelte(Kit) app.

Features

Check out the various parts of the docs:

Principles

Some design principles:

  • πŸ₯‡ One dependency

    The utilities by themselves are too small to warrant their own package. In the past, I have manually copied them from project to project for exactly that reason.

  • πŸ”‹ Batteries Included

    svu comes with a actions, stores, utility-functions and more. The real value is in the fact that everything you need is at your fingertips.

  • πŸͺΆ Small sizes please

    The library is fully tree shakeable so it's safe too include even if you need just one utillity. It won't harm your bundle size.

  • ❀️ Pareto Principle

    These utilities are designed to solve 80% of usecases with 20% of the code. It might well be that your specific use-case outgrows the capabilities of a specific svu. No hard feelings! The docs will tell you were to find more elaborate packages, if applicable.

Status

svu started out as a collection of Svelte stuff I often use. svu is currently in alpha, while the API settles.

Feel free to take it for a test drive! Be aware that some svus are not fully production ready, and the API may change in the near future.

If you run into any issues, or have any questions or suggestions, feel free to open an issue on GitHub.

Comments
  • [chore] first steps for getting a test setup

    [chore] first steps for getting a test setup

    Setup

    • Unit/Svelte tests are done with Playwright: npm run playwright
    • Code tests are done with Vitest: npm run vitest
    • Testing everything: npm run test

    We need to differentiate what testing library should be used based on what type of test is written. I propose the following naming convention:

    *.spec.ts == test with Playwright *.test.ts == test with Vitest

    Please let me know if you have any thoughts here!

    Tests written

    I've written the following tests as a MVP check:

    • clickoutside action
    • random meta utility method
    • resettable store

    How we test Svelte stuff

    We need the ability to have test-components when testing things like actions. There is a lot of annoying pitfalls regarding the import of a Svelte component into a TypeScript file (which playwright uses). Playwright also looks for some stuff in .svelte-kit/output when running the tests (not exactly yet sure why, not really that interesting).

    To solve these issues I've created a setup script which does the following:

    1. Build the project if .svelte-kit/output is empty
    2. Compile all *.svelte files in /test to their JS output. Compiling /test/clickoutside/Component.svelte will create a /test/clickoutside/Component.svelte.js file. This is somewhat elegant because the import Component from ./Component.svelte statement in the test file will then point to the JS file instead of the Svelte file. These autogenerated *.svelte.js are currently gitignored.

    This setup script runs once before every npm run playwright call.

    A challenge we need to fix

    I have not yet found a way to support Svelte-kit in the tests. Imports like import { page } from "$app/stores" doesn't make any sense in a normal TypeScript context, and the stores also won't work unless we are in a Svelte-kit context. I'm not sure what the best way is to solve this issue. In the Vitest tests i think the easiest solution is to mock the imports (haven't tried, but Vitest has a great API for mocking imports). It's a little but tricker in the Playwright tests, but there should be a way to solve this.

    opened by MathiasWP 8
  • [perf] refactoring

    [perf] refactoring

    I wanted to take a deeper look at the codebase, and while i did that i applied some refactorings.

    This pr includes:

    • style changes, e.g. removing variable/function names in snake_case instead of camelCase
    • refactoring/enhancements, e.g. updated the clone function, refactored localstorage.ts
    • fixes, e.g. a store leak
    • fixing some ts definitions
    opened by MathiasWP 3
  • chore: fix typo

    chore: fix typo

    Great work on the testing implementation! I fixed a couple typos that I encountered while reading the README and added a word ("and") that I think is missing.

    opened by buhodev 2
  • Copy from textarea does not work

    Copy from textarea does not work

    I've tried a couple of ways but none copies the content of textarea. copy works fine with other elements (div, p, pre, etc).

    <textarea
    id="copyArea"
    bind:value={fixedCopy}
    />
    
    <textarea
    id="copyArea">
    {fixedCopy}
    </textarea>
    
    <button use:copy={'#copyArea'}>	Copy </button>
    
    🐞 bug 
    opened by phenomen 2
  • bug in portal

    bug in portal

    When you pass in portal with an HTMLElement rather than id reference, the code does not mount.

    steps to repro:

    <div bind:this={target} />
    <p use:portal={target} />
    

    Also the docstring is incorrect.

    🐞 bug 
    opened by nikolai-cc 0
  • move repo to org

    move repo to org

    Checklist to prevent unintended side events:

    • [x] create org in GitHub
    • update repo link in package.json
    • update links in docs
    • update reddit post, update discord post
    • update links in README.md
    • update Vercel repo link
    πŸ—„ org 
    opened by nikolai-cc 0
  • Add tests

    Add tests

    Definitely something that should be added as early as possible, will make the library a lot more appealing, and it's a lot easier beginning with it from the get-go instead of having it as a technical debt. Also makes it easier for other people to contribute/fix issues.

    opened by MathiasWP 9
  • Discussing the potential of a library like this

    Discussing the potential of a library like this

    Hi Nikolai, great work setting up this library!

    The community definitely deserves a utility library like this, and to me it seems like the obvious solution for "extending" the behaviour of Svelte. Here's a couple of reasons why i believe a library like this is a good idea:

    • The Svelte API is by design as lean and extensible as possible - so the framework will never be filled with tons of utility functions.
    • It follows the philosophy of having as few dependencies as possible. 1 big utility library with no other dependencies > 10+ small utility libraries with no other dependencies
    • A lot of people will end up writing the same utility functions just to avoid installing other packages. I have a hypothesis that people will eventually get bored of this, and developers will begin looking after libraries that deliver solutions to this, e.g svelteui

    Making an open source project popular is no easy job, and it requires a lot of marketing work. The code obviously has to be well written, but looking at the source code i have no doubt that this will be a problem. However, there are a couple of issues that I'd like to address:

    • The docs. I'm not sure if this is the place to be experimental and create something "completely new". The docs page is cool and all, but users don't want a funky docs page. They want something familiar, easy to navigate and dead-simple to use. Search-functionality is also a must.
    • The name/branding. This may just be a personal preference, but i feel like svelte libraries that try to integrate the "sv" prefix into their names sound a little corny. Even Rich Harris himself does not do this. A good open source project needs its own brand, and should tell its own story. The readme is important here.
    • Personal vs organisation. There is nothing wrong with this project being on your personal account, but I believe that others are more likely to engage the project if they work for an organisation instead of a person. This also makes it easier to develop other tools in the organisation and expand if necessary.
    • Other stuff for scaling; changelogs, pr-templates, issue-templates etc. Not the most important stuff in the beginning, but getting these right is a big, big plus.

    The job you've done here is amazing Nikolai, you should be proud! You've caught my attention, and i have a feeling this can be the start of something great for the community!

    πŸ€” meta 
    opened by MathiasWP 5
  • Add actions

    Add actions

    transform actions (from svelte-transform lib) lazyload (but good) pannable / touch actions scrolldrag (for horizontal scrolling on carousels) dnd (dragging between multiple containers)

    πŸ’» feat 
    opened by nikolai-cc 1
Owner
Nikolai
Design Engineering & Creative Development of Interactive Products, Installations and Artworks
Nikolai
This is a starter templete for svelte kit and maplibre.

This is a starter template for maplibre and svelte Clone this application by running git clone https://github.com/Thuhaa/svelte-maplibre-starter.git A

Joseph Thuha 4 Nov 28, 2022
A Svelte parser that compiles to Mitosis JSON, allowing you to write Svelte components once and compile to every framework.

Sveltosis Still in development A Svelte parser that compiles to Mitosis JSON, allowing you to write Svelte components once and compile to every framew

sveltosis 70 Nov 24, 2022
Fully dockered starter kit for Elm with Hasura

elm-hasura-dockered This repo contains a Elm-Hasura starter kit for rapid+typesafe web application development on open source foundations. Elm is grea

Cies Breijs 41 Dec 9, 2022
A homebridge plugin to display the current consumption from your Tibber pulse as lux in Home kit.

homebridge-tibber-lightsensor Tibber lightsensor is a plugin for Homebridge. It fetches the current watt usage of your house and displays it as a ligh

Johan Runbert 2 Oct 11, 2022
Node-cli-starter - Basic starter kit for building Node CLI applications with TypeScript.

node-cli-starter Minimal starter kit for building Node CLI applications with TypeScript. Getting Started To get started clone repo locally and run npm

Cory Rylan 7 May 17, 2022
BOOTFLAT is an open source Flat UI KIT based on Bootstrap 3.3.0 CSS framework

BOOTFLAT is an open source Flat UI KIT based on Bootstrap 3.3.0 CSS framework. It provides a faster, easier and less repetitive way for web developers to create elegant web apps.

bootflat 4.3k Dec 25, 2022
The PatternFly Design Kit is a Sketch library used for creating PatternFly accurate design mockups

PatternFly Design Kit The PatternFly Design Kit is a collection of Sketch assets that make it easy for designers to create high-fidelity design mockup

PatternFly 44 Jan 2, 2023
Web UI kit following simply superb.'s design system, based on Tailwind CSS.

ui-kit TailwindCSS powered UI kit following simply superb.'s design system. ➑️ Demo available here Why I am building few applications (iOS / Android /

simply superb. 8 Mar 4, 2022
The best Nodejs price kit you need when working with cryptocurrencies with multiple providers support

Cryptocurrency Price Kit STAGE: RFC The best Nodejs price kit you need when working with cryptocurrencies with multiple providers support. Goal To pro

TrapCode 6 Sep 7, 2022
This repository serves as a starter kit for doing simple TDD exercise

This repository serves as a starter kit for doing simple TDD exercise

adylanrff 3 Feb 19, 2022
Remix starter kit with Tailwind CSS family of libraries: Headless UI, Radix UI, VechaiUI, daisyUI, and more

Remix Tailwind Starter Kit Remix starter kit with Tailwind CSS v3 family of libraries. Example demo to combine the best Tailwind-related ecosystem suc

M Haidar Hanif 80 Dec 18, 2022
Cloudy is a set of constructs for the AWS Cloud Development Kit that aim to improve the DX by providing a faster and type-safe code environment.

cloudy-ts These packages aren't yet published on npm. This is still highly experimental. Need to figure out a few things before releasing the first ve

Cristian PallarΓ©s 5 Nov 3, 2022
awsrun 189 Jan 3, 2023
A starter kit for beginners to obsidian

This is a starter kit for beginners to obsidian. It is a simplified version of my vault with my daily and weekly note templates, the folder structure for my periodic notes (daily, weekly, monthly etc) and the plugin settings I use.

Pamela Wang 53 Dec 21, 2022
βͺ Rewinds – Remix Tailwind Starter Kit with Tailwind CSS, Headless UI, Radix UI, and more

βͺ Rewinds – Remix Tailwind Starter Kit Rewinds is a Remix starter kit with Tailwind CSS v3 family of libraries. This is an example demo to combine the

M Haidar Hanif 81 Dec 24, 2022
Node starter kit for semantic-search. Uses Mighty Inference Server with Qdrant vector search.

Mighty Starter This project provides a complete and working semantic search application, using Mighty Inference Server, Qdrant Vector Search, and an e

MAX.IO LLC 8 Oct 18, 2022
A monorepo that uses the AWS Cloud Development Kit to deploy and configure nanomdm on AWS lambda.

NanoMDM on AWS This repo builds and configures a nanomdm server to run on AWS lambda. It uses the Cloud Development Kit and tries to follow best pract

Stevie Clifton 4 May 26, 2022
A starter kit for scaffold-eth projects

?? scaffold-eth-cli As simple as running this in your terminal: npx scaffold-eth Clones scaffold-eth into the current folder as fast as possible ⚑️ ⁉

qedk 3 Jun 11, 2022
starter kit for interacting with zora api, protocol, and creator toolkit

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

tranqui.eth 40 Oct 20, 2022