[READ-ONLY] Mirror of https://github.com/danielroe/zero-vue. Vue bindings for Zero
sync vue zero
0

Configure Feed

Select the types of activity you want to include in your feed.

TypeScript 81.5%
Vue 13.5%
CSS 3.0%
HTML 0.3%
Shell 0.3%
JavaScript 0.2%
Other 1.2%
289 11 16

Clone this repository

https://git.vm.fail/danielroe.dev/zero-vue https://git.vm.fail/did:plc:55nydp3zzdiqly2hbr7yqyfp
ssh://git@knot1.tangled.sh:2222/danielroe.dev/zero-vue ssh://git@knot1.tangled.sh:2222/did:plc:55nydp3zzdiqly2hbr7yqyfp

For self-hosted knots, clone URLs may differ based on your setup.


README.md

zero-vue#

npm version npm downloads Github Actions Codecov

Vue bindings for Zero

Usage#

Install package:

# npm
npm install zero-vue

# pnpm
pnpm install zero-vue

Creating useZero and useQuery composables:

import { createZeroComposables } from 'zero-vue'
import { mutators } from './mutators.ts'
import { schema } from './schema.ts'

// see docs for all options: https://zero.rocicorp.dev/docs/introduction
const { useZero, useQuery } = createZeroComposables({
  userID,
  server: import.meta.env.VITE_PUBLIC_SERVER,
  schema,
  mutators,
  kvStore: 'mem',
})

// OR with computed options:
const { useZero, useQuery } = createZeroComposables(() => ({
  userID: userID.value,
  server: import.meta.env.VITE_PUBLIC_SERVER,
  schema,
  mutators,
  kvStore: 'mem',
}))

// OR with a Zero instance:
const { useZero, useQuery } = createZeroComposables({
  zero: new Zero({
    userID,
    server: import.meta.env.VITE_PUBLIC_SERVER,
    schema,
    mutators,
    kvStore: 'mem',
  }),
})

To query data:

import { useQuery, useZero } from './use-zero.ts'

const zero = useZero()
const { data: users } = useQuery(() => zero.value.query.user)
TIP

See the Vue fixture or the Nuxt fixture for full working examples based on rocicorp/hello-zero.

💻 Development#

  • Clone this repository
  • Enable Corepack using corepack enable
  • Install dependencies using pnpm install
  • Run interactive tests using pnpm dev

Credits#

The implementation here was based on zero-solid. You can also check out hello-zero-nuxt to see the original implementation and history of this project.

License#

Made with ❤️

Published under MIT License.