@picked/svelte 0.0.1-dev.1767836126674 → 0.0.1-dev.1767845350659
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.js +1 -1
- package/dist/hooks/action.d.ts +2 -0
- package/dist/hooks/action.js +1 -0
- package/dist/hooks/feature.d.ts +5 -0
- package/dist/hooks/feature.js +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/predicate.d.ts +3 -0
- package/dist/hooks/predicate.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/picked-elements.d.js +1 -0
- package/dist/picked-elements.d.ts +10 -0
- package/dist/picked-elements.js +1 -0
- package/dist/vite-env.d.ts +2 -0
- package/package.json +7 -2
package/dist/form/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createEvent as k,createEffect as m,attach as b,sample as g,split as D}from"effector";import{getPicked as F,getExperience as S}from"../hooks/client.js";import{getStep as B}from"../hooks/step.js";import"svelte";import"svelte/store";import"@picked/
|
|
1
|
+
import{createEvent as k,createEffect as m,attach as b,sample as g,split as D}from"effector";import{getPicked as F,getExperience as S}from"../hooks/client.js";import"@picked/client";import{getStep as B}from"../hooks/step.js";import"svelte";import"svelte/store";import"@picked/analytics";function z({id:f,title:l,onError:d,onSuccess:h}){const o=F(),x=B(),n=S(),{currentStepStore:u}=n,v=k(),y=m(r=>o.responses.commit(r)),A=b({source:{step:u},effect:m(({step:r})=>{o.eventBus({type:"form_submit_success",form:{id:f,title:l},experience:n,step:r??void 0}),h==null||h()})}),_=b({source:{step:u},mapParams:(r,a)=>({step:a.step,errors:r.errors}),effect:m(({step:r,errors:a})=>{o.eventBus({type:"form_submit_error",form:{id:f,title:l},exception:{reason:a},experience:n,step:r??void 0}),a.forEach(p=>{o.eventBus({type:"field_validation_error",exception:{reason:[p]},experience:n,step:r??void 0})}),d==null||d(a)})});return g({clock:v,source:{step:u},fn:({step:r})=>({formId:f,title:l,step:r}),target:m(({formId:r,title:a,step:p})=>{o.eventBus({type:"form_submit",form:{id:r,title:a},experience:n,step:p??void 0})})}),g({clock:v,source:{fields:o.fields.listStore,stepFields:x.fields,step:u},fn:({stepFields:r},a)=>{a.preventDefault();const p=new FormData(a.currentTarget),E=Array.from(p.entries()),c={data:{},push(t){const s=t.questionId,e=this.data[s];e?Array.isArray(e)&&Array.isArray(t.value)?Array.isArray(e)&&Array.isArray(t.value)&&(typeof e[0]=="string"?this.data[s]=[...e,...t.value].map(String):typeof e[0]=="number"?this.data[s]=[...e,...t.value].map(Number):typeof e[0]=="boolean"?this.data[s]=[...e,...t.value].map(i=>!!i):this.data[s]=t.value):this.data[s]=t.value:this.data[s]=t.value}};return r.forEach(t=>{let s=E.filter(([e])=>e===t.id);s.length===0&&(s=[[t.id,""]]),s.forEach(([,e])=>{const i=t.id;if(e===""){c.push({questionId:i,value:null});return}switch(t.type){case"text":c.push({questionId:i,value:t.multiple?[String(e)]:String(e)});break;case"number":c.push({questionId:i,value:t.multiple?[Number(e)]:Number(e)});break;case"boolean":c.push({questionId:i,value:t.multiple?[e==="true"]:e==="true"});break}})}),c.data},target:y}),D({source:y.doneData,match:{hasErrors:({errors:r})=>r.length>0},cases:{hasErrors:_,__:A}}),{form:{onsubmit:v}}}export{z as getForm};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createStore as s,createEvent as f,attach as l,createEffect as u,sample as a}from"effector";import{getPicked as m}from"./client.js";function g(t){return m().actions.getEvokableAction(t)}function v(t){const c=g(t),o=s(void 0,{skipVoid:!1}),n=f(),r=l({source:c,mapParams:(e,i)=>i,effect:u(async e=>{if(e)return e()})});return a({clock:n,target:r}),a({clock:r.doneData,target:o}),n(),o}export{g as getAction,v as getActionResult};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function getFeature(featureName: string): import('effector').Store<() => Promise<boolean | string | undefined>>;
|
|
2
|
+
export declare function getFeatureResult(featureName: string): import('effector').StoreWritable<{
|
|
3
|
+
id: string;
|
|
4
|
+
bucket: string | boolean;
|
|
5
|
+
} | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createStore as i,createEvent as s,attach as f,createEffect as l,sample as o}from"effector";import{getPicked as v}from"./client.js";function d(t){return v().features.getEvokableFeature(t)}function m(t){const r=d(t),c=i(void 0,{skipVoid:!1}),a=s(),n=f({source:r,mapParams:(e,u)=>u,effect:l(async e=>await e())});return o({clock:a,target:n}),o({clock:n.doneData,fn:e=>{if(e!==void 0)return{id:t,bucket:e}},target:c}),a(),o({clock:r,target:a}),c}export{d as getFeature,m as getFeatureResult};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { getPicked, getExperience } from './client';
|
|
2
|
+
export { getPredicate, getPredicateResult } from './predicate';
|
|
3
|
+
export { getFeature, getFeatureResult } from './feature';
|
|
4
|
+
export { getAction, getActionResult } from './action';
|
|
2
5
|
export { getStep, setStepContext } from './step';
|
|
3
6
|
export { useUnit, getContextScope, setContextScope } from './stores';
|
|
4
7
|
export { createSessionStorageStore, createLocalStorageStore } from './storage.js';
|
package/dist/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getExperience as r,getPicked as o}from"./client.js";import{
|
|
1
|
+
import{getExperience as r,getPicked as o}from"./client.js";import{getPredicate as p,getPredicateResult as a}from"./predicate.js";import{getFeature as x,getFeatureResult as n}from"./feature.js";import{getAction as s,getActionResult as f}from"./action.js";import{getStep as u,setStepContext as S}from"./step.js";import{getContextScope as d,setContextScope as l,useUnit as C}from"./stores.js";import{createLocalStorageStore as y,createSessionStorageStore as k}from"./storage.js";import{getTrackRecommendationPresentEvent as A}from"./events.js";import{createQuery as F,queryCache as h,queryPresets as v}from"./create-query/index.js";export{y as createLocalStorageStore,F as createQuery,k as createSessionStorageStore,s as getAction,f as getActionResult,d as getContextScope,r as getExperience,x as getFeature,n as getFeatureResult,o as getPicked,p as getPredicate,a as getPredicateResult,u as getStep,A as getTrackRecommendationPresentEvent,h as queryCache,v as queryPresets,l as setContextScope,S as setStepContext,C as useUnit};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Predicate } from '@picked/client';
|
|
2
|
+
export declare function getPredicate(predicateName: string): import('effector').Store<() => ReturnType<Predicate>>;
|
|
3
|
+
export declare function getPredicateResult(predicateName: string): import('effector').StoreWritable<string | boolean | string[] | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"@picked/client";import{createStore as s,createEvent as d,attach as l,createEffect as f,sample as a}from"effector";import{getPicked as u}from"./client.js";function m(e){return u().predicates.getEvokablePredicate(e)}function v(e){const t=m(e),o=s(void 0,{skipVoid:!1}),r=d(),i=l({source:t,mapParams:(c,n)=>n,effect:f(async c=>{if(c)return await c()})});return a({clock:r,target:i}),a({clock:i.doneData,target:o}),r(),a({clock:t,target:r}),o}export{m as getPredicate,v as getPredicateResult};
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PickedHTMLAttributes } from '@picked/client'
|
|
2
|
+
|
|
3
|
+
declare module 'svelte/elements' {
|
|
4
|
+
// Augment the base HTMLAttributes interface to include Picked custom attributes
|
|
5
|
+
// This makes picked-click, picked-scroll, etc. available on all HTML elements
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
7
|
+
interface HTMLAttributes<T> extends PickedHTMLAttributes {}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/svelte",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.1767845350659",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"d3": "^7.9.0"
|
|
6
6
|
},
|
|
@@ -68,6 +68,11 @@
|
|
|
68
68
|
"import": "./dist/plugins/devtools/index.js",
|
|
69
69
|
"svelte": "./dist/plugins/devtools/index.js",
|
|
70
70
|
"default": "./dist/plugins/devtools/index.js"
|
|
71
|
+
},
|
|
72
|
+
"./elements": {
|
|
73
|
+
"types": "./dist/picked-elements.d.ts",
|
|
74
|
+
"import": "./dist/picked-elements.js",
|
|
75
|
+
"default": "./dist/picked-elements.js"
|
|
71
76
|
}
|
|
72
77
|
},
|
|
73
78
|
"files": [
|
|
@@ -75,7 +80,7 @@
|
|
|
75
80
|
],
|
|
76
81
|
"module": "./dist/index.js",
|
|
77
82
|
"peerDependencies": {
|
|
78
|
-
"@picked/client": "0.0.1-dev.
|
|
83
|
+
"@picked/client": "0.0.1-dev.1767845350659",
|
|
79
84
|
"effector": "^23.3.0",
|
|
80
85
|
"svelte": "^5.34.3"
|
|
81
86
|
},
|