@picked/svelte 0.0.55 → 0.0.56-next.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.
|
@@ -5,13 +5,13 @@ export type { FormField } from '@picked/client/form';
|
|
|
5
5
|
* Svelte FormInstance — identical to core but callback registration returns void
|
|
6
6
|
* (cleanup is handled automatically via $effect, not by the consumer).
|
|
7
7
|
*/
|
|
8
|
-
export interface FormInstance<
|
|
9
|
-
form: Omit<CoreFormInstance<
|
|
8
|
+
export interface FormInstance<TFieldKeys extends string = string> extends Omit<CoreFormInstance<TFieldKeys>, 'form'> {
|
|
9
|
+
form: Omit<CoreFormInstance<TFieldKeys>['form'], 'onBeforeSubmit' | 'onSuccess' | 'onError' | 'props'> & {
|
|
10
10
|
props: {
|
|
11
11
|
onsubmit: (e: SubmitEventWithCurrentTarget) => void;
|
|
12
12
|
};
|
|
13
|
-
onBeforeSubmit: (callback: SubmitCallback<
|
|
14
|
-
onSuccess: (callback: SuccessCallback<
|
|
13
|
+
onBeforeSubmit: (callback: SubmitCallback<TFieldKeys>) => void;
|
|
14
|
+
onSuccess: (callback: SuccessCallback<TFieldKeys>) => void;
|
|
15
15
|
onError: (callback: ErrorCallback) => void;
|
|
16
16
|
};
|
|
17
17
|
}
|
|
@@ -27,11 +27,11 @@ export interface FormInstance<TFieldIds extends string = string> extends Omit<Co
|
|
|
27
27
|
*
|
|
28
28
|
* @param {string} formId - Unique identifier for this form instance.
|
|
29
29
|
* @param {Store<string>} title - Reactive store holding the form/step title.
|
|
30
|
-
* @param {Store<string[]>}
|
|
30
|
+
* @param {Store<string[]>} fieldKeys - Reactive store of field keys that belong to this form.
|
|
31
31
|
* @returns {FormInstance} A form instance with reactive field stores, submission handlers, and callback registration.
|
|
32
32
|
* @example
|
|
33
33
|
* ```ts
|
|
34
|
-
* const { form, fields } = createForm('lead-capture', $title, $
|
|
34
|
+
* const { form, fields } = createForm('lead-capture', $title, $fieldKeys)
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
export declare function createForm(formId: string, title: Store<string>,
|
|
37
|
+
export declare function createForm(formId: string, title: Store<string>, fieldKeys: Store<string[]>): FormInstance;
|
package/dist/hooks/step.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{STEP_CONTEXT_KEY as e}from"../context.js";import{getPicked as t}from"./client.js";import{getStepRouter as n}from"../router/context.js";import{getContext as r,setContext as i}from"svelte";import{createForm as a}from"../form/create-form.svelte";function o(r){let o=t(),{activeStep:s}=n(),c=s.map(e=>e?.key===r),l=o.steps.listStore.map(e=>e.find(e=>e.key===r)??{id:r,key:r,name:``,
|
|
1
|
+
import{STEP_CONTEXT_KEY as e}from"../context.js";import{getPicked as t}from"./client.js";import{getStepRouter as n}from"../router/context.js";import{getContext as r,setContext as i}from"svelte";import{createForm as a}from"../form/create-form.svelte";function o(r){let o=t(),{activeStep:s}=n(),c=s.map(e=>e?.key===r),l=o.steps.listStore.map(e=>e.find(e=>e.key===r)??{id:r,key:r,name:``,fieldKeys:[]});return i(e,{step:l,isActive:c,isActiveStep:c,...a(r,l.map(e=>e.name),l.map(e=>e.fieldKeys))})}function s(){return r(e)}export{s as getStep,o as setStepContext};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/svelte",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.56-next.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"d3": "^7.9.0"
|
|
6
6
|
},
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"module": "./dist/index.js",
|
|
90
90
|
"peerDependencies": {
|
|
91
|
-
"@picked/client": "0.0.
|
|
91
|
+
"@picked/client": "0.0.56-next.1",
|
|
92
92
|
"effector": "^23.3.0",
|
|
93
93
|
"svelte": "^5.46.4"
|
|
94
94
|
},
|