rustica 0.1.0
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/LICENSE +21 -0
- package/README.md +228 -0
- package/dist/form/index.d.ts +60 -0
- package/dist/form/index.d.ts.map +1 -0
- package/dist/form/index.js +186 -0
- package/dist/form/index.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.d.ts +55 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +120 -0
- package/dist/react/index.js.map +1 -0
- package/dist/schema/builders.d.ts +110 -0
- package/dist/schema/builders.d.ts.map +1 -0
- package/dist/schema/builders.js +183 -0
- package/dist/schema/builders.js.map +1 -0
- package/dist/schema/index.d.ts +35 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +42 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/types.d.ts +54 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +5 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/validator/index.d.ts +67 -0
- package/dist/validator/index.d.ts.map +1 -0
- package/dist/validator/index.js +118 -0
- package/dist/validator/index.js.map +1 -0
- package/package.json +72 -0
- package/pkg/README.md +228 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 rustica contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# Rust-JS Validator
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
5
|
+
[](https://www.rust-lang.org/)
|
|
6
|
+
[](https://webassembly.org/)
|
|
7
|
+
|
|
8
|
+
Production-grade Zod-like schema and form validation system powered by Rust and WebAssembly.
|
|
9
|
+
|
|
10
|
+
## ✨ Features
|
|
11
|
+
|
|
12
|
+
<table>
|
|
13
|
+
<tr>
|
|
14
|
+
<td width="50%">
|
|
15
|
+
|
|
16
|
+
### 🦀 Rust Core
|
|
17
|
+
|
|
18
|
+
- **WASM-powered** validation
|
|
19
|
+
- **Zero-copy** architecture
|
|
20
|
+
- **~0.1-0.5ms** per validation
|
|
21
|
+
- **Single call** per validation
|
|
22
|
+
|
|
23
|
+
</td>
|
|
24
|
+
<td width="50%">
|
|
25
|
+
|
|
26
|
+
### 📝 TypeScript API
|
|
27
|
+
|
|
28
|
+
- **Fluent API** like Zod
|
|
29
|
+
- **Full type inference**
|
|
30
|
+
- **Schema serialization**
|
|
31
|
+
- **Custom error messages**
|
|
32
|
+
- **UI metadata** support
|
|
33
|
+
|
|
34
|
+
</td>
|
|
35
|
+
</tr>
|
|
36
|
+
<tr>
|
|
37
|
+
<td width="50%">
|
|
38
|
+
|
|
39
|
+
### ⚛️ React Integration
|
|
40
|
+
|
|
41
|
+
- **useWasmForm** hook
|
|
42
|
+
- **Field registration**
|
|
43
|
+
- **Auto re-rendering**
|
|
44
|
+
- **RHF-compatible** API
|
|
45
|
+
|
|
46
|
+
</td>
|
|
47
|
+
<td width="50%">
|
|
48
|
+
|
|
49
|
+
### 🔧 Framework Agnostic
|
|
50
|
+
|
|
51
|
+
- **createForm** for any framework
|
|
52
|
+
- **Vanilla JS** support
|
|
53
|
+
- **Node.js** compatible
|
|
54
|
+
- **Browser** ready
|
|
55
|
+
|
|
56
|
+
</td>
|
|
57
|
+
</tr>
|
|
58
|
+
</table>
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm install rustica
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Quick Start
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { r, useWasmForm } from 'rustica';
|
|
70
|
+
|
|
71
|
+
// Define schema
|
|
72
|
+
const loginSchema = r.object({
|
|
73
|
+
email: r.string().min(3, 'Email must be at least 3 characters').email('Please enter a valid email').ui({ label: "Email" }),
|
|
74
|
+
password: r.string().min(8, 'Password must be at least 8 characters').ui({ label: "Password" })
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Infer types
|
|
78
|
+
type LoginForm = r.Infer<typeof loginSchema>;
|
|
79
|
+
|
|
80
|
+
// Use in React
|
|
81
|
+
function LoginForm() {
|
|
82
|
+
const form = useWasmForm({
|
|
83
|
+
schema: loginSchema,
|
|
84
|
+
defaultValues: { email: '', password: '' },
|
|
85
|
+
onSubmit: async (data) => {
|
|
86
|
+
console.log('Valid data:', data);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<form onSubmit={form.handleSubmit}>
|
|
92
|
+
<input {...form.register('email')} />
|
|
93
|
+
{form.errors.email && <span>{form.errors.email.message}</span>}
|
|
94
|
+
|
|
95
|
+
<input type="password" {...form.register('password')} />
|
|
96
|
+
{form.errors.password && <span>{form.errors.password.message}</span>}
|
|
97
|
+
|
|
98
|
+
<button type="submit">Login</button>
|
|
99
|
+
</form>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Building from Source
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Quick setup (recommended)
|
|
108
|
+
chmod +x scripts/setup.sh
|
|
109
|
+
./scripts/setup.sh
|
|
110
|
+
|
|
111
|
+
# Or manual setup
|
|
112
|
+
npm install
|
|
113
|
+
npm run build
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
See [Getting Started Guide](./docs/GETTING_STARTED.md) for detailed instructions.
|
|
117
|
+
|
|
118
|
+
## Architecture
|
|
119
|
+
|
|
120
|
+
- **Rust Core** (`src/lib.rs`, `src/schema.rs`, `src/validator.rs`) - Schema definitions and validation logic
|
|
121
|
+
- **WASM Interface** (`src/wasm.rs`) - WebAssembly bindings with wasm-bindgen
|
|
122
|
+
- **TypeScript Schema Builder** (`src/schema/`) - Fluent API for schema definition
|
|
123
|
+
- **Form Runtime** (`src/form/`) - Form state management
|
|
124
|
+
- **React Hook** (`src/react/`) - React integration
|
|
125
|
+
|
|
126
|
+
## Documentation
|
|
127
|
+
|
|
128
|
+
- 📖 **[Complete Documentation Index](./docs/INDEX.md)** - All docs in one place
|
|
129
|
+
- 🚀 **[Getting Started Guide](./docs/GETTING_STARTED.md)** - Quick start tutorial
|
|
130
|
+
- 📚 **[API Reference](./docs/API.md)** - Complete API documentation
|
|
131
|
+
- 💬 **[Custom Error Messages](./docs/custom-messages.md)** - User-friendly validation messages
|
|
132
|
+
- 🏗️ **[Architecture Guide](./docs/ARCHITECTURE.md)** - How it works
|
|
133
|
+
- 📊 **[Feature Comparison](./docs/COMPARISON.md)** - vs Zod, Yup, Joi
|
|
134
|
+
- 🤝 **[Contributing Guide](./CONTRIBUTING.md)** - How to contribute
|
|
135
|
+
|
|
136
|
+
## Project Structure
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
rustica/
|
|
140
|
+
├── src/ # Rust source (validation core)
|
|
141
|
+
│ ├── lib.rs # Module exports
|
|
142
|
+
│ ├── schema.rs # Schema AST types
|
|
143
|
+
│ ├── validator.rs # Validation engine
|
|
144
|
+
│ └── wasm.rs # WASM bindings
|
|
145
|
+
├── src/ # TypeScript source
|
|
146
|
+
│ ├── schema/ # Schema builders (r.string(), etc.)
|
|
147
|
+
│ ├── validator/ # WASM wrapper
|
|
148
|
+
│ ├── form/ # Form runtime
|
|
149
|
+
│ ├── react/ # React hooks
|
|
150
|
+
│ └── index.ts # Main entry point
|
|
151
|
+
├── examples/ # Usage examples
|
|
152
|
+
│ ├── quick-test.ts # Basic validation tests
|
|
153
|
+
│ ├── standalone.ts # Standalone examples
|
|
154
|
+
│ ├── forms.tsx # Form component examples
|
|
155
|
+
│ └── react-form-app/ # Full React app with API integration
|
|
156
|
+
├── tests/ # Test suite
|
|
157
|
+
├── docs/ # Documentation
|
|
158
|
+
└── scripts/ # Build scripts
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Commands
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Development
|
|
165
|
+
make install # Install dependencies
|
|
166
|
+
make build # Build WASM + TypeScript
|
|
167
|
+
make test # Run all tests
|
|
168
|
+
make dev # Watch mode
|
|
169
|
+
|
|
170
|
+
# Quick Commands
|
|
171
|
+
make example # Run quick test
|
|
172
|
+
make clean # Clean build artifacts
|
|
173
|
+
make help # Show all commands
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Performance
|
|
177
|
+
|
|
178
|
+
<table>
|
|
179
|
+
<tr>
|
|
180
|
+
<td><b>Metric</b></td>
|
|
181
|
+
<td><b>Value</b></td>
|
|
182
|
+
<td><b>Notes</b></td>
|
|
183
|
+
</tr>
|
|
184
|
+
<tr>
|
|
185
|
+
<td>Validation Speed</td>
|
|
186
|
+
<td>~0.1-0.5ms</td>
|
|
187
|
+
<td>Per validation (warm)</td>
|
|
188
|
+
</tr>
|
|
189
|
+
<tr>
|
|
190
|
+
<td>Throughput</td>
|
|
191
|
+
<td>5,000-10,000/sec</td>
|
|
192
|
+
<td>1000 validations in ~100-200ms</td>
|
|
193
|
+
</tr>
|
|
194
|
+
<tr>
|
|
195
|
+
<td>WASM Size</td>
|
|
196
|
+
<td>~15-20KB</td>
|
|
197
|
+
<td>Gzipped: ~8-10KB</td>
|
|
198
|
+
</tr>
|
|
199
|
+
<tr>
|
|
200
|
+
<td>Overhead</td>
|
|
201
|
+
<td>Single call</td>
|
|
202
|
+
<td>Zero-copy where possible</td>
|
|
203
|
+
</tr>
|
|
204
|
+
</table>
|
|
205
|
+
|
|
206
|
+
See [Performance Comparison](./docs/COMPARISON.md) for detailed benchmarks.
|
|
207
|
+
|
|
208
|
+
## Contributing
|
|
209
|
+
|
|
210
|
+
We welcome contributions! See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
|
|
211
|
+
|
|
212
|
+
## Roadmap
|
|
213
|
+
|
|
214
|
+
- [x] Core validation (string, number, boolean, object)
|
|
215
|
+
- [x] React hooks
|
|
216
|
+
- [x] Form runtime
|
|
217
|
+
- [x] Type inference
|
|
218
|
+
- [x] Custom error messages
|
|
219
|
+
- [ ] Array/tuple schemas
|
|
220
|
+
- [ ] Union/intersection types
|
|
221
|
+
- [ ] Async validation helpers
|
|
222
|
+
- [ ] i18n support
|
|
223
|
+
|
|
224
|
+
See [CHANGELOG.md](./CHANGELOG.md) for version history.
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
MIT
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Schema, ValidationError } from '../schema/types';
|
|
2
|
+
import type { SchemaBuilder } from '../schema/builders';
|
|
3
|
+
/**
|
|
4
|
+
* Form field state
|
|
5
|
+
*/
|
|
6
|
+
export interface FieldState {
|
|
7
|
+
value: any;
|
|
8
|
+
touched: boolean;
|
|
9
|
+
error: ValidationError | null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Form state
|
|
13
|
+
*/
|
|
14
|
+
export interface FormState<T extends Record<string, any>> {
|
|
15
|
+
values: T;
|
|
16
|
+
touched: Record<keyof T, boolean>;
|
|
17
|
+
errors: Record<keyof T, ValidationError | null>;
|
|
18
|
+
isSubmitting: boolean;
|
|
19
|
+
isValid: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Form configuration
|
|
23
|
+
*/
|
|
24
|
+
export interface FormConfig<T extends Record<string, any>> {
|
|
25
|
+
schema: SchemaBuilder<T> | Schema;
|
|
26
|
+
defaultValues: T;
|
|
27
|
+
onSubmit: (data: T) => void | Promise<void>;
|
|
28
|
+
validateOnBlur?: boolean;
|
|
29
|
+
validateOnChange?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Form instance API
|
|
33
|
+
*/
|
|
34
|
+
export interface Form<T extends Record<string, any>> {
|
|
35
|
+
values: T;
|
|
36
|
+
touched: Record<keyof T, boolean>;
|
|
37
|
+
errors: Record<keyof T, ValidationError | null>;
|
|
38
|
+
isSubmitting: boolean;
|
|
39
|
+
isValid: boolean;
|
|
40
|
+
setValue(field: keyof T, value: any): void;
|
|
41
|
+
setTouched(field: keyof T, touched: boolean): void;
|
|
42
|
+
validateField(field: keyof T): ValidationError | null;
|
|
43
|
+
validateForm(): Record<keyof T, ValidationError | null>;
|
|
44
|
+
handleBlur(field: keyof T): void;
|
|
45
|
+
handleChange(field: keyof T, value: any): void;
|
|
46
|
+
handleSubmit(event?: Event): Promise<void>;
|
|
47
|
+
reset(): void;
|
|
48
|
+
subscribe(listener: (state: FormState<T>) => void): () => void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Create a form instance with validation
|
|
52
|
+
*
|
|
53
|
+
* This is the core form runtime that manages:
|
|
54
|
+
* - Form values
|
|
55
|
+
* - Touch state
|
|
56
|
+
* - Validation errors
|
|
57
|
+
* - Submit handling
|
|
58
|
+
*/
|
|
59
|
+
export declare function createForm<T extends Record<string, any>>(config: FormConfig<T>): Form<T>;
|
|
60
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACtD,MAAM,EAAE,CAAC,CAAC;IACV,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC,CAAC;IAChD,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACvD,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAClC,aAAa,EAAE,CAAC,CAAC;IACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IA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AAC,CAAC,CAAC,GACpB,IAAI,CAAC,CAAC,CAAC,CA2NT"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Validator } from '../validator';
|
|
2
|
+
/**
|
|
3
|
+
* Create a form instance with validation
|
|
4
|
+
*
|
|
5
|
+
* This is the core form runtime that manages:
|
|
6
|
+
* - Form values
|
|
7
|
+
* - Touch state
|
|
8
|
+
* - Validation errors
|
|
9
|
+
* - Submit handling
|
|
10
|
+
*/
|
|
11
|
+
export function createForm(config) {
|
|
12
|
+
const { schema, defaultValues, onSubmit, validateOnBlur = true, validateOnChange = false, } = config;
|
|
13
|
+
// Internal state
|
|
14
|
+
let state = {
|
|
15
|
+
values: { ...defaultValues },
|
|
16
|
+
touched: Object.keys(defaultValues).reduce((acc, key) => ({ ...acc, [key]: false }), {}),
|
|
17
|
+
errors: Object.keys(defaultValues).reduce((acc, key) => ({ ...acc, [key]: null }), {}),
|
|
18
|
+
isSubmitting: false,
|
|
19
|
+
isValid: true,
|
|
20
|
+
};
|
|
21
|
+
// Subscribers for reactive updates
|
|
22
|
+
const listeners = new Set();
|
|
23
|
+
/**
|
|
24
|
+
* Notify all subscribers of state change
|
|
25
|
+
*/
|
|
26
|
+
function notify() {
|
|
27
|
+
listeners.forEach(listener => listener(state));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Update isValid flag based on errors
|
|
31
|
+
*/
|
|
32
|
+
function updateValidity() {
|
|
33
|
+
state.isValid = Object.values(state.errors).every(error => error === null);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Validate a single field
|
|
37
|
+
*/
|
|
38
|
+
function validateField(field) {
|
|
39
|
+
const path = [String(field)];
|
|
40
|
+
const result = Validator.validateAtPath(schema, state.values, path);
|
|
41
|
+
if (!result.success && result.errors && result.errors.length > 0) {
|
|
42
|
+
// Return the first error for this field
|
|
43
|
+
return result.errors[0];
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Validate entire form
|
|
49
|
+
*/
|
|
50
|
+
function validateForm() {
|
|
51
|
+
const result = Validator.validate(schema, state.values);
|
|
52
|
+
const fieldErrors = { ...state.errors };
|
|
53
|
+
// Clear all errors first
|
|
54
|
+
for (const key in fieldErrors) {
|
|
55
|
+
fieldErrors[key] = null;
|
|
56
|
+
}
|
|
57
|
+
// Populate errors from validation result
|
|
58
|
+
if (!result.success && result.errors) {
|
|
59
|
+
for (const error of result.errors) {
|
|
60
|
+
if (error.path.length > 0) {
|
|
61
|
+
const fieldName = error.path[0];
|
|
62
|
+
if (fieldName in fieldErrors) {
|
|
63
|
+
fieldErrors[fieldName] = error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return fieldErrors;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Set field value
|
|
72
|
+
*/
|
|
73
|
+
function setValue(field, value) {
|
|
74
|
+
state.values[field] = value;
|
|
75
|
+
if (validateOnChange) {
|
|
76
|
+
const error = validateField(field);
|
|
77
|
+
state.errors[field] = error;
|
|
78
|
+
updateValidity();
|
|
79
|
+
}
|
|
80
|
+
notify();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Set field touched state
|
|
84
|
+
*/
|
|
85
|
+
function setTouched(field, touched) {
|
|
86
|
+
state.touched[field] = touched;
|
|
87
|
+
notify();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Handle field blur event
|
|
91
|
+
*/
|
|
92
|
+
function handleBlur(field) {
|
|
93
|
+
state.touched[field] = true;
|
|
94
|
+
if (validateOnBlur) {
|
|
95
|
+
const error = validateField(field);
|
|
96
|
+
state.errors[field] = error;
|
|
97
|
+
updateValidity();
|
|
98
|
+
}
|
|
99
|
+
notify();
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Handle field change event
|
|
103
|
+
*/
|
|
104
|
+
function handleChange(field, value) {
|
|
105
|
+
setValue(field, value);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Handle form submission
|
|
109
|
+
*/
|
|
110
|
+
async function handleSubmit(event) {
|
|
111
|
+
if (event) {
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
}
|
|
114
|
+
// Mark all fields as touched
|
|
115
|
+
for (const key in state.values) {
|
|
116
|
+
state.touched[key] = true;
|
|
117
|
+
}
|
|
118
|
+
// Validate entire form
|
|
119
|
+
state.errors = validateForm();
|
|
120
|
+
updateValidity();
|
|
121
|
+
state.isSubmitting = true;
|
|
122
|
+
notify();
|
|
123
|
+
// If valid, call onSubmit
|
|
124
|
+
if (state.isValid) {
|
|
125
|
+
try {
|
|
126
|
+
await onSubmit(state.values);
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
console.error('Form submission error:', error);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
state.isSubmitting = false;
|
|
133
|
+
notify();
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Reset form to default values
|
|
137
|
+
*/
|
|
138
|
+
function reset() {
|
|
139
|
+
state = {
|
|
140
|
+
values: { ...defaultValues },
|
|
141
|
+
touched: Object.keys(defaultValues).reduce((acc, key) => ({ ...acc, [key]: false }), {}),
|
|
142
|
+
errors: Object.keys(defaultValues).reduce((acc, key) => ({ ...acc, [key]: null }), {}),
|
|
143
|
+
isSubmitting: false,
|
|
144
|
+
isValid: true,
|
|
145
|
+
};
|
|
146
|
+
notify();
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Subscribe to form state changes
|
|
150
|
+
*/
|
|
151
|
+
function subscribe(listener) {
|
|
152
|
+
listeners.add(listener);
|
|
153
|
+
// Return unsubscribe function
|
|
154
|
+
return () => {
|
|
155
|
+
listeners.delete(listener);
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
// Return form instance
|
|
159
|
+
return {
|
|
160
|
+
get values() {
|
|
161
|
+
return state.values;
|
|
162
|
+
},
|
|
163
|
+
get touched() {
|
|
164
|
+
return state.touched;
|
|
165
|
+
},
|
|
166
|
+
get errors() {
|
|
167
|
+
return state.errors;
|
|
168
|
+
},
|
|
169
|
+
get isSubmitting() {
|
|
170
|
+
return state.isSubmitting;
|
|
171
|
+
},
|
|
172
|
+
get isValid() {
|
|
173
|
+
return state.isValid;
|
|
174
|
+
},
|
|
175
|
+
setValue,
|
|
176
|
+
setTouched,
|
|
177
|
+
validateField,
|
|
178
|
+
validateForm,
|
|
179
|
+
handleBlur,
|
|
180
|
+
handleChange,
|
|
181
|
+
handleSubmit,
|
|
182
|
+
reset,
|
|
183
|
+
subscribe,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAwDzC;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CACxB,MAAqB;IAErB,MAAM,EACJ,MAAM,EACN,aAAa,EACb,QAAQ,EACR,cAAc,GAAG,IAAI,EACrB,gBAAgB,GAAG,KAAK,GACzB,GAAG,MAAM,CAAC;IAEX,iBAAiB;IACjB,IAAI,KAAK,GAAiB;QACxB,MAAM,EAAE,EAAE,GAAG,aAAa,EAAE;QAC5B,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,CACxC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EACxC,EAA8B,CAC/B;QACD,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,CACvC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,G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C/B;YACD,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,CACvC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,EACvC,EAA6C,CAC9C;YACD,YAAY,EAAE,KAAK;YACnB,OAAO,EAAE,IAAI;SACd,CAAC;QACF,MAAM,EAAE,CAAC;IACX,CAAC;IAED;;OAEG;IACH,SAAS,SAAS,CAAC,QAAuC;QACxD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAExB,8BAA8B;QAC9B,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC;IAED,uBAAuB;IACvB,OAAO;QACL,IAAI,MAAM;YACR,OAAO,KAAK,CAAC,MAAM,CAAC;QACtB,CAAC;QACD,IAAI,OAAO;YACT,OAAO,KAAK,CAAC,OAAO,CAAC;QACvB,CAAC;QACD,IAAI,MAAM;YACR,OAAO,KAAK,CAAC,MAAM,CAAC;QACtB,CAAC;QACD,IAAI,YAAY;YACd,OAAO,KAAK,CAAC,YAAY,CAAC;QAC5B,CAAC;QACD,IAAI,OAAO;YACT,OAAO,KAAK,CAAC,OAAO,CAAC;QACvB,CAAC;QACD,QAAQ;QACR,UAAU;QACV,aAAa;QACb,YAAY;QACZ,UAAU;QACV,YAAY;QACZ,YAAY;QACZ,KAAK;QACL,SAAS;KACV,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rustica
|
|
3
|
+
* Production-grade schema and form validation powered by Rust and WebAssembly
|
|
4
|
+
*/
|
|
5
|
+
export { r, type Infer, type UiConfig } from "./schema";
|
|
6
|
+
export type { Schema, StringSchema, NumberSchema, BooleanSchema, ObjectSchema, ValidationError, ValidationResult, } from "./schema/types";
|
|
7
|
+
export { ZString, ZNumber, ZBoolean, ZObject, SchemaBuilder, } from "./schema/builders";
|
|
8
|
+
export { Validator, ValidationException, initWasm, createValidator, } from "./validator";
|
|
9
|
+
export { createForm, type Form, type FormConfig, type FormState, type FieldState, } from "./form";
|
|
10
|
+
export { useWasmForm, useFieldError, useFieldHasError, type UseWasmFormReturn, type FieldRegistration, } from "./react";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,CAAC,EAAE,KAAK,KAAK,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AACxD,YAAY,EACV,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,eAAe,EACf,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,OAAO,EACP,OAAO,EACP,QAAQ,EACR,OAAO,EACP,aAAa,GACd,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,eAAe,GAChB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,UAAU,EACV,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACL,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rustica
|
|
3
|
+
* Production-grade schema and form validation powered by Rust and WebAssembly
|
|
4
|
+
*/
|
|
5
|
+
// Schema builder API
|
|
6
|
+
export { r } from "./schema";
|
|
7
|
+
export { ZString, ZNumber, ZBoolean, ZObject, SchemaBuilder, } from "./schema/builders";
|
|
8
|
+
// Validator
|
|
9
|
+
export { Validator, ValidationException, initWasm, createValidator, } from "./validator";
|
|
10
|
+
// Form runtime
|
|
11
|
+
export { createForm, } from "./form";
|
|
12
|
+
// React hooks (optional peer dependency)
|
|
13
|
+
export { useWasmForm, useFieldError, useFieldHasError, } from "./react";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,qBAAqB;AACrB,OAAO,EAAE,CAAC,EAA6B,MAAM,UAAU,CAAC;AAUxD,OAAO,EACL,OAAO,EACP,OAAO,EACP,QAAQ,EACR,OAAO,EACP,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,YAAY;AACZ,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,eAAe;AACf,OAAO,EACL,UAAU,GAKX,MAAM,QAAQ,CAAC;AAEhB,yCAAyC;AACzC,OAAO,EACL,WAAW,EACX,aAAa,EACb,gBAAgB,GAGjB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ValidationError } from "../schema/types";
|
|
2
|
+
import { type FormConfig } from "../form";
|
|
3
|
+
/**
|
|
4
|
+
* Form field registration return type
|
|
5
|
+
* Compatible with React Hook Form style
|
|
6
|
+
*/
|
|
7
|
+
export interface FieldRegistration {
|
|
8
|
+
name: string;
|
|
9
|
+
value: any;
|
|
10
|
+
onChange: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
11
|
+
onBlur: (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* React form hook return type
|
|
15
|
+
*/
|
|
16
|
+
export interface UseWasmFormReturn<T extends Record<string, any>> {
|
|
17
|
+
register: (name: keyof T) => FieldRegistration;
|
|
18
|
+
values: T;
|
|
19
|
+
errors: Record<keyof T, ValidationError | null>;
|
|
20
|
+
touched: Record<keyof T, boolean>;
|
|
21
|
+
isSubmitting: boolean;
|
|
22
|
+
isValid: boolean;
|
|
23
|
+
setValue: (field: keyof T, value: any) => void;
|
|
24
|
+
setError: (field: keyof T, error: ValidationError | null) => void;
|
|
25
|
+
handleSubmit: (event?: React.FormEvent<HTMLFormElement>) => Promise<void>;
|
|
26
|
+
reset: () => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* React hook for WASM-powered form validation
|
|
30
|
+
*
|
|
31
|
+
* Usage:
|
|
32
|
+
* ```tsx
|
|
33
|
+
* const form = useWasmForm({
|
|
34
|
+
* schema: loginSchema,
|
|
35
|
+
* defaultValues: { email: '', password: '' },
|
|
36
|
+
* onSubmit: async (data) => console.log(data)
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* <form onSubmit={form.handleSubmit}>
|
|
40
|
+
* <input {...form.register('email')} />
|
|
41
|
+
* {form.errors.email && <span>{form.errors.email.message}</span>}
|
|
42
|
+
* </form>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function useWasmForm<T extends Record<string, any>>(config: FormConfig<T>): UseWasmFormReturn<T>;
|
|
46
|
+
/**
|
|
47
|
+
* Hook to get field error message
|
|
48
|
+
* Returns error message if field is touched and has error
|
|
49
|
+
*/
|
|
50
|
+
export declare function useFieldError<T extends Record<string, any>>(form: UseWasmFormReturn<T>, field: keyof T): string | null;
|
|
51
|
+
/**
|
|
52
|
+
* Hook to check if field has error
|
|
53
|
+
*/
|
|
54
|
+
export declare function useFieldHasError<T extends Record<string, any>>(form: UseWasmFormReturn<T>, field: keyof T): boolean;
|
|
55
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot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