npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jitforms/svelte

v0.1.0

Published

Svelte store and action for JitForms — auto-subscribe with $store syntax.

Readme

@jitforms/svelte

Svelte integration for JitForms -- wraps the @jitforms/js core SDK with a Svelte-compatible store and a form action.

Works with both Svelte 4 and Svelte 5.

Installation

npm install @jitforms/svelte @jitforms/js

Store Approach

Use createJitForm to get a Svelte-compatible store with $store auto-subscription syntax.

<script>
  import { createJitForm } from '@jitforms/svelte';

  const form = createJitForm('abc123');

  async function handleSubmit(e) {
    e.preventDefault();
    const data = new FormData(e.target);
    await $form.submit(Object.fromEntries(data));
  }
</script>

{#if $form.isSuccess}
  <p>Thank you! Your submission has been received.</p>
{:else}
  <form on:submit={handleSubmit}>
    <div>
      <label for="email">Email</label>
      <input id="email" name="email" type="email" />
      {#if $form.fieldError('email')}
        <span class="error">{$form.fieldError('email')}</span>
      {/if}
    </div>

    <div>
      <label for="message">Message</label>
      <textarea id="message" name="message"></textarea>
      {#if $form.fieldError('message')}
        <span class="error">{$form.fieldError('message')}</span>
      {/if}
    </div>

    <button type="submit" disabled={$form.isLoading}>
      {$form.isLoading ? 'Submitting...' : 'Submit'}
    </button>

    {#if $form.isError}
      <p class="error">{$form.error.message}</p>
    {/if}
  </form>
{/if}

Advanced Configuration

<script>
  import { createJitForm } from '@jitforms/svelte';

  const form = createJitForm({
    formHash: 'abc123',
    baseUrl: 'https://your-instance.jitforms.com',
    honeypot: true,
    timeout: 15000,
  });
</script>

Resetting State

<script>
  // After showing a success message, reset to show the form again
  function handleReset() {
    $form.reset();
  }
</script>

Action Approach

Use the jitform action for progressive form enhancement with zero boilerplate.

<script>
  import { jitform } from '@jitforms/svelte';

  function handleSuccess(e) {
    console.log('Submitted!', e.detail.submission);
    if (e.detail.redirectUrl) {
      window.location.href = e.detail.redirectUrl;
    }
  }

  function handleError(e) {
    console.error('Failed:', e.detail.message, e.detail.errors);
  }
</script>

<form
  use:jitform={'abc123'}
  on:jitform:success={handleSuccess}
  on:jitform:error={handleError}
>
  <input name="email" type="email" placeholder="Email" />
  <textarea name="message" placeholder="Message"></textarea>
  <button type="submit">Submit</button>
</form>

Action with Config Object

<form use:jitform={{ formHash: 'abc123', honeypot: true }}>
  <input name="email" type="email" />
  <button type="submit">Submit</button>
</form>

CSS Classes

The action automatically toggles CSS classes on the form element:

| Class | When | |---|---| | jf-loading | Submission is in progress | | jf-success | Submission succeeded | | jf-error | Submission failed |

form.jf-loading button[type="submit"] {
  opacity: 0.5;
  pointer-events: none;
}

form.jf-error {
  border-color: red;
}

Custom Events

| Event | Detail | |---|---| | jitform:loading | (none) | | jitform:success | { submission, redirectUrl } | | jitform:error | { message, errors, status } |

API Reference

createJitForm(formHashOrConfig)

Creates a Svelte-compatible store for form submission state management.

Parameters:

  • formHashOrConfig -- A form hash string or a JitFormConfig object.

Returns: JitFormStore with:

  • isLoading -- Whether a submission is in progress
  • isSuccess -- Whether the last submission succeeded
  • isError -- Whether the last submission failed
  • error -- Error details ({ message, errors }) or null
  • submission -- The submission data on success, or null
  • redirectUrl -- Optional redirect URL from the server
  • fieldErrors -- Shorthand for error.errors (always an object)
  • fieldError(field) -- Returns the first error message for a field, or undefined
  • submit(data) -- Submit form data
  • reset() -- Reset store to initial state
  • subscribe(fn) -- Svelte store contract

jitform(node, config)

Svelte action for declarative form enhancement.

Parameters:

  • node -- The <form> element
  • config -- A form hash string or a JitFormConfig object

License

MIT