npm.io
0.16.1 • Published yesterday

seitu

Licence
MIT
Version
0.16.1
Deps
1
Size
154 kB
Vulns
0
Weekly
0
Stars
23

Seitu

npm version You need Seitu

Seitu is a lightweight, framework-agnostic, type-safe utilities library for JavaScript applications on the client and server sides.

Documentation

You can find the documentation here.

Example

To quick start you only need to write the following code:

import { useSubscription } from 'seitu/react'
import { createWebStorageValue } from 'seitu/web'
import * as z from 'zod'

const value = createWebStorageValue({
  type: 'sessionStorage',
  key: 'test',
  defaultValue: 0,
  schema: z.number(),
})

value.get() // 0
value.set(1)
value.remove()
value.subscribe(v => console.log(v))

function Counter() {
  const count = useSubscription(value)

  return (
    <div>
      <span>{count}</span>
      <button onClick={() => value.set(c => c + 1)}>Increment</button>
    </div>
  )
}

Seitu has other powerful features, so check out the docs or the playground directory.

Agent skills (TanStack Intent)

Seitu ships versioned agent skills inside the npm package. Install seitu, then run:

pnpm add seitu
pnpm dlx @tanstack/intent@latest install
pnpm dlx @tanstack/intent@latest list
pnpm dlx @tanstack/intent@latest load seitu#create-store

Skills are indexed on the Agent Skills Registry and update when you update the package.

License

MIT License - see the LICENSE file for details

Keywords