notform 2.1.0-alpha.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -6
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -1,15 +1,93 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>notform</h1>
|
|
3
|
+
<p><strong>Vue Forms Without the Friction</strong></p>
|
|
4
|
+
<p>
|
|
5
|
+
<a href="https://npmx.dev/package/notform"><img src="https://img.shields.io/npm/v/notform.svg?style=plastic&label=NPM%20Version&color=blue" alt="NPM Version"></a>
|
|
6
|
+
<a href="https://npmx.dev/package/notform"><img src="https://img.shields.io/npm/dw/notform.svg?style=plastic&label=NPM%20Downloads&color=blue" alt="NPM Downloads"></a>
|
|
7
|
+
<a href="https://npmx.dev/package/notform"><img src="https://img.shields.io/npm/unpacked-size/notform?style=plastic&label=NPM%20Unpacked%20Size&color=blue" alt="NPM Unpacked Size"></a>
|
|
8
|
+
</p>
|
|
9
|
+
</div>
|
|
2
10
|
|
|
3
|
-
|
|
4
|
-
[](https://npmx.dev/package/notform)
|
|
5
|
-
[](https://npmx.dev/package/notform)
|
|
11
|
+
<br>
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
`notform` is the core package of the NotForm ecosystem. It provides type-safe form validation and state management for Vue 3 applications with minimal boilerplate. Built with TypeScript from the ground up, it offers a composable API that integrates perfectly with Vue 3's Composition API.
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add notform
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## How It Works
|
|
22
|
+
|
|
23
|
+
NotForm follows a **composable-first** approach. Forms are managed through the `useNotForm` composable which handles validation, state, and submission logic in a type-safe manner.
|
|
24
|
+
|
|
25
|
+
Each form consists of:
|
|
26
|
+
|
|
27
|
+
- **A schema** — Defined using any validation library that supports [Standard Schema](https://standard-schema.dev/) (Zod, Yup, etc.)
|
|
28
|
+
- **Form state** — Managed reactively with full TypeScript support
|
|
29
|
+
- **Validation** — Automatic validation based on your schema with error messages
|
|
30
|
+
- **Submission handling** — Built-in submission lifecycle with loading states
|
|
31
|
+
|
|
32
|
+
### Basic Usage
|
|
33
|
+
|
|
34
|
+
```vue
|
|
35
|
+
<script setup lang="ts">
|
|
36
|
+
import { z } from 'zod'
|
|
37
|
+
import { useNotForm, NotForm, NotField, NotMessage } from 'notform'
|
|
38
|
+
|
|
39
|
+
const schema = z.object({
|
|
40
|
+
name: z.string().min(1, 'Name is required'),
|
|
41
|
+
email: z.string().email('Invalid email'),
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const form = useNotForm({
|
|
45
|
+
schema,
|
|
46
|
+
onSubmit: (values) => {
|
|
47
|
+
console.log('Form submitted:', values)
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<NotForm :form="form" @submit="form.submit">
|
|
54
|
+
<NotField path="name">
|
|
55
|
+
<input v-model="form.values.name" type="text" />
|
|
56
|
+
<NotMessage path="name" />
|
|
57
|
+
</NotField>
|
|
58
|
+
<NotField path="email">
|
|
59
|
+
<input v-model="form.values.email" type="email" />
|
|
60
|
+
<NotMessage path="email" />
|
|
61
|
+
</NotField>
|
|
62
|
+
<button type="submit">Submit</button>
|
|
63
|
+
</NotForm>
|
|
64
|
+
</template>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Validation Libraries
|
|
68
|
+
|
|
69
|
+
NotForm works with any validation library that implements the Standard Schema interface:
|
|
70
|
+
|
|
71
|
+
- **Zod** — TypeScript-first schema validation
|
|
72
|
+
- **Yup** — JavaScript schema builder
|
|
73
|
+
- **Valibot** — Modular and type-safe schema validation
|
|
74
|
+
- And any other Standard Schema-compatible library
|
|
75
|
+
|
|
76
|
+
## Features
|
|
77
|
+
|
|
78
|
+
- **Type-safe** — Full TypeScript support with inferred types from your schema
|
|
79
|
+
- **Composable** — Use with Vue 3 Composition API for flexible form management
|
|
80
|
+
- **Lightweight** — Tiny footprint with tree-shaking support
|
|
81
|
+
- **Flexible** — Works with any Standard Schema-compatible validation library
|
|
82
|
+
- **Array fields** — Built-in support for dynamic array fields with add/remove operations
|
|
83
|
+
- **Minimal boilerplate** — Get started quickly with simple, intuitive APIs
|
|
10
84
|
|
|
11
85
|
## Documentation
|
|
12
86
|
|
|
13
87
|
For detailed guides, API reference, and examples, visit:
|
|
14
88
|
**[notformdocs.vercel.app](https://notformdocs.vercel.app/)**
|
|
15
89
|
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
[MIT](../../LICENSE) © [Favour Emeka](https://github.com/favorodera)
|
|
93
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "notform",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Vue Forms Without the Friction",
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
"vue": "^3.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@types/node": "^25.
|
|
34
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
33
|
+
"@types/node": "^25.6.0",
|
|
34
|
+
"@vitejs/plugin-vue": "^6.0.6",
|
|
35
35
|
"@vitest/ui": "^4.1.4",
|
|
36
36
|
"@vue/test-utils": "^2.4.6",
|
|
37
37
|
"happy-dom": "^20.8.9",
|
|
38
38
|
"tsdown": "^0.21.7",
|
|
39
39
|
"type-fest": "^5.5.0",
|
|
40
|
-
"vite": "^8.0.
|
|
40
|
+
"vite": "^8.0.8",
|
|
41
41
|
"vitest": "^4.1.2",
|
|
42
|
-
"vue": "^3.5.
|
|
42
|
+
"vue": "^3.5.34",
|
|
43
43
|
"vue-tsc": "^3.2.6"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
"vue form validator"
|
|
58
58
|
],
|
|
59
59
|
"engines": {
|
|
60
|
-
"node": ">=22.0.0"
|
|
60
|
+
"node": ">=22.0.0",
|
|
61
|
+
"pnpm": ">=11.0.0"
|
|
61
62
|
},
|
|
62
63
|
"scripts": {
|
|
63
64
|
"build": "tsdown",
|