@picked/svelte 0.0.12-next.8 → 0.0.12
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/dist/form/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ interface GetFormOptions {
|
|
|
8
8
|
type SubmitEventWithCurrentTarget = SubmitEvent & {
|
|
9
9
|
currentTarget: EventTarget & HTMLFormElement;
|
|
10
10
|
};
|
|
11
|
-
export declare function getForm({ id
|
|
11
|
+
export declare function getForm({ id, title, onError, onSuccess }: GetFormOptions): {
|
|
12
12
|
form: {
|
|
13
13
|
onsubmit: import('effector').EventCallable<SubmitEventWithCurrentTarget>;
|
|
14
14
|
};
|
package/dist/form/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createEvent as
|
|
1
|
+
import{createEvent as g,createEffect as c,sample as x,split as A}from"effector";import{getPicked as _}from"../hooks/client.js";import"svelte";import"@picked/client";import"svelte/store";function E({id:f,title:p,onError:u,onSuccess:l}){const r=_(),m=g(),d=c(s=>r.responses.commit(s)),v=c(()=>{r.eventBus({type:"form_submit_success",form:{id:f,title:p}}),l==null||l()}),h=c(({errors:s})=>{r.eventBus({type:"form_submit_error",form:{id:f,title:p},exception:{reason:s}}),s.forEach(i=>{r.eventBus({type:"field_validation_error",exception:{reason:[i]}})}),u==null||u(s)});return x({clock:m,source:{fields:r.fields.listStore},fn:({fields:s},i)=>{i.preventDefault();const y=new FormData(i.currentTarget),n={data:{},push(a){const t=a.questionId,e=this.data[t];e?Array.isArray(e)&&Array.isArray(a.value)?Array.isArray(e)&&Array.isArray(a.value)&&(typeof e[0]=="string"?this.data[t]=[...e,...a.value].map(String):typeof e[0]=="number"?this.data[t]=[...e,...a.value].map(Number):typeof e[0]=="boolean"?this.data[t]=[...e,...a.value].map(o=>!!o):this.data[t]=a.value):this.data[t]=a.value:this.data[t]=a.value}};for(const[a,t]of y.entries()){const e=s.find(b=>b.id===a);if(!e)continue;const o=e.id;switch(e.type){case"text":n.push({questionId:o,value:e.multiple?[String(t)]:String(t)});break;case"number":n.push({questionId:o,value:e.multiple?[Number(t)]:Number(t)});break;case"boolean":n.push({questionId:o,value:e.multiple?[t==="true"]:t==="true"});break}}return n.data},target:d}),A({source:d.doneData,match:{hasErrors:({errors:s})=>s.length>0},cases:{hasErrors:h,__:v}}),{form:{onsubmit:m}}}export{E as getForm};
|
package/dist/hooks/step.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { Store } from 'effector';
|
|
2
|
-
import {
|
|
2
|
+
import { Field, Response } from '@picked/client';
|
|
3
|
+
import { Step } from '../router/context';
|
|
3
4
|
type FieldWithValue = Field & {
|
|
4
5
|
value: Response | undefined;
|
|
5
6
|
};
|
|
7
|
+
type StepWithLabel = Step & {
|
|
8
|
+
label?: string;
|
|
9
|
+
};
|
|
6
10
|
export interface StepContext {
|
|
7
|
-
step: Store<
|
|
11
|
+
step: Store<StepWithLabel>;
|
|
8
12
|
fields: Store<FieldWithValue[]>;
|
|
9
13
|
isActiveStep: Store<boolean>;
|
|
10
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createExperience as e}from"@picked/client/plugins/create-experience";import{adaptSvelteComponent as o}from"../../component.js";import t from"./DevToolsExperience.svelte";const p=e({id:"svelte-devtools",name:"Picked Devtools",decide:{},targets:[{selector:"main",placement:"append"}],component:o(t)});p.addStep({label:"Tools"});export{p as devtoolsExperience};
|
|
1
|
+
import{createExperience as e}from"@picked/client/plugins/create-experience";import{adaptSvelteComponent as o}from"../../component.js";import t from"./DevToolsExperience.svelte";const p=e({id:"svelte-devtools",name:"Picked Devtools",decide:{},targets:[{selector:"main",placement:"append"}],type:"funnel",component:o(t)});p.addStep({label:"Tools"});export{p as devtoolsExperience};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/svelte",
|
|
3
|
-
"version": "0.0.12
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"d3": "^7.9.0"
|
|
6
6
|
},
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"svelte-check": "^4.2.2",
|
|
19
19
|
"typedoc": "^0.28.5",
|
|
20
20
|
"typedoc-plugin-markdown": "^4.6.3",
|
|
21
|
-
"vite": "^6.
|
|
21
|
+
"vite": "^6.3.5",
|
|
22
22
|
"vite-plugin-dts": "^4.5.4"
|
|
23
23
|
},
|
|
24
24
|
"exports": {
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
],
|
|
71
71
|
"module": "./dist/index.js",
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@picked/client": "0.0.12
|
|
73
|
+
"@picked/client": "0.0.12",
|
|
74
74
|
"effector": "^23.3.0",
|
|
75
75
|
"svelte": "^5.34.3"
|
|
76
76
|
},
|