Skip to content

Commit 526f032

Browse files
Version Packages (#203)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 4de6500 commit 526f032

File tree

4 files changed

+56
-66
lines changed

4 files changed

+56
-66
lines changed

.changeset/polite-steaks-own.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/pre.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/formsnap/CHANGELOG.md

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# formsnap
22

3+
## 2.0.0
4+
5+
### Major Changes
6+
7+
- Formsnap v2 - See [Migration Guide](https://formsnap.dev/docs/v2-migration-guide) ([#177](https://github.com/svecosystem/formsnap/pull/177))
8+
39
## 2.0.0-next.1
410

511
### Patch Changes
@@ -102,7 +108,7 @@
102108

103109
### Minor Changes
104110

105-
- - Add utility function `getFormSchema()` ([#62](https://github.com/huntabyte/formsnap/pull/62))
111+
- - Add utility function `getFormSchema()` ([#62](https://github.com/huntabyte/formsnap/pull/62))
106112

107113
## 0.1.4
108114

@@ -135,7 +141,7 @@
135141
### Minor Changes
136142

137143
- 83dcbbd: - Add `getForm` helper
138-
- Fix bug which was creating large `.d.ts` files and crashing editors
144+
- Fix bug which was creating large `.d.ts` files and crashing editors
139145

140146
## 0.0.9
141147

@@ -180,61 +186,61 @@
180186
- 0801f7d: Add the `handlers` object containing the event handler helpers as well as the `setValue` helper function to the `getFormField` return object.
181187
- 748f8e8: #### Add a `getFormField` helper function
182188

183-
The `getFormField` helper function must be called upon component initialization and provides some useful stores, actions, etc. when composing your own forms.
184-
For example, if I wanted to create a reusable `Form.Label` with conditional styles applied to it depending on the error state of the field, I could do something like this:
185-
186-
```svelte
187-
<!-- CustomLabel.svelte -->
188-
<script lang="ts">
189-
import { Form, getFormField } from 'formsnap';
190-
const { errors } = getFormField();
191-
</script>
192-
193-
<Form.Label class={$errors ? 'text-red-500' : 'text-gray-800'}>
194-
<slot />
195-
</Form.Label>
196-
```
197-
198-
It returns the following type:
199-
200-
```ts
201-
export type FormFieldContext = {
202-
name: string;
203-
ids: {
204-
input: string;
205-
description: string;
206-
validation: string;
189+
The `getFormField` helper function must be called upon component initialization and provides some useful stores, actions, etc. when composing your own forms.
190+
For example, if I wanted to create a reusable `Form.Label` with conditional styles applied to it depending on the error state of the field, I could do something like this:
191+
192+
```svelte
193+
<!-- CustomLabel.svelte -->
194+
<script lang="ts">
195+
import { Form, getFormField } from "formsnap";
196+
const { errors } = getFormField();
197+
</script>
198+
199+
<Form.Label class={$errors ? "text-red-500" : "text-gray-800"}>
200+
<slot />
201+
</Form.Label>
202+
```
203+
204+
It returns the following type:
205+
206+
```ts
207+
export type FormFieldContext = {
208+
name: string;
209+
ids: {
210+
input: string;
211+
description: string;
212+
validation: string;
213+
};
214+
errors: Writable<string[] | undefined>;
215+
value: Writable<unknown>;
216+
hasDescription: Writable<boolean>;
217+
hasValidation: Writable<boolean>;
218+
attrStore: AttrStore;
219+
actions: ActionsObject;
207220
};
208-
errors: Writable<string[] | undefined>;
209-
value: Writable<unknown>;
210-
hasDescription: Writable<boolean>;
211-
hasValidation: Writable<boolean>;
212-
attrStore: AttrStore;
213-
actions: ActionsObject;
214-
};
215-
```
221+
```
216222
217223
## 0.0.2
218224
219225
### Patch Changes
220226
221227
- 8596892: Exposes the following additional values from superforms as slot props via the `<Form.Root/>` component.
222228
223-
- `allErrors`
224-
- `delayed`
225-
- `errors`
226-
- `submitting`
227-
- `tainted`
228-
- `timeout`
229-
- `validate`
230-
- `posted`
231-
- `fields`
232-
- `message`
233-
- `options`
234-
- `formId`
235-
- `restore`
236-
- `capture`
237-
- `constraints`
229+
- `allErrors`
230+
- `delayed`
231+
- `errors`
232+
- `submitting`
233+
- `tainted`
234+
- `timeout`
235+
- `validate`
236+
- `posted`
237+
- `fields`
238+
- `message`
239+
- `options`
240+
- `formId`
241+
- `restore`
242+
- `capture`
243+
- `constraints`
238244
239245
## 0.0.1
240246

packages/formsnap/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "formsnap",
3-
"version": "2.0.0-next.1",
3+
"version": "2.0.0",
44
"scripts": {
55
"dev": "pnpm watch",
66
"build": "pnpm run package",

0 commit comments

Comments
 (0)