@picked/svelte 0.0.1-dev.1773807602703 → 0.0.1-dev.1774224866171
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/_virtual/_vite/preload-helper.js +1 -0
- package/dist/component.js +1 -1
- package/dist/components/LazyImage.svelte +1 -0
- package/dist/components/index.js +1 -1
- package/dist/context.js +1 -1
- package/dist/form/create-form.js +1 -0
- package/dist/form/create-form.svelte.d.ts +24 -0
- package/dist/form/create-form.svelte.js +1 -0
- package/dist/form/get-form.d.ts +16 -0
- package/dist/form/get-form.js +1 -0
- package/dist/form/index.d.ts +2 -25
- package/dist/form/index.js +1 -1
- package/dist/hooks/action.js +1 -1
- package/dist/hooks/client.js +1 -1
- package/dist/hooks/create-query/index.js +1 -1
- package/dist/hooks/events.js +1 -1
- package/dist/hooks/feature.js +1 -1
- package/dist/hooks/field.d.ts +2 -3
- package/dist/hooks/field.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/predicate.js +1 -1
- package/dist/hooks/step.d.ts +8 -8
- package/dist/hooks/step.js +1 -1
- package/dist/hooks/storage.js +1 -1
- package/dist/hooks/stores.js +1 -1
- package/dist/index.js +1 -1
- package/dist/plugins/devtools/components/ExperienceInstanceListItem.svelte +4 -17
- package/dist/plugins/devtools/components/ExperienceInstancesTable.svelte +1 -1
- package/dist/plugins/devtools/index.js +1 -1
- package/dist/plugins/devtools/plugin.js +1 -1
- package/dist/plugins/devtools/screens/events/EventListItem.svelte +47 -47
- package/dist/plugins/devtools/screens/experiences/ExperienceDetailsScreen.svelte +1 -1
- package/dist/plugins/devtools/screens/experiences/ExperienceTreeScreen.svelte +11 -10
- package/dist/plugins/devtools/screens/experiences/ExperiencesListScreen.svelte +1 -1
- package/dist/plugins/devtools/screens/history/HistoryEntryListItem.svelte +1 -6
- package/dist/plugins/devtools/screens/responses/ResponseTableRow.svelte +11 -10
- package/dist/plugins/devtools/screens/responses/ResponsesTable.svelte +1 -1
- package/dist/plugins/devtools/ui/index.js +1 -1
- package/dist/plugins/framework/index.js +1 -1
- package/dist/plugins/framework/plugin.js +1 -1
- package/dist/render/browser.js +1 -1
- package/dist/render/server.js +1 -1
- package/dist/router/Step.svelte +0 -1
- package/dist/router/StepRouter.svelte +1 -1
- package/dist/router/context.js +1 -1
- package/dist/router/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/utils/array.js +1 -1
- package/dist/vite-env.d.js +0 -1
- package/package.json +10 -10
- package/dist/_virtual/preload-helper.js +0 -1
- package/dist/utils/get-step-fields.d.ts +0 -2
- package/dist/utils/get-step-fields.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`modulepreload`,t=function(e){return`/`+e},n={},r=function(r,i,a){let o=Promise.resolve();if(i&&i.length>0){let r=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}o=l(i.map(i=>{if(i=t(i,a),i in n)return;n[i]=!0;let o=i.endsWith(`.css`),s=o?`[rel="stylesheet"]`:``;if(a)for(let e=r.length-1;e>=0;e--){let t=r[e];if(t.href===i&&(!o||t.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${i}"]${s}`))return;let l=document.createElement(`link`);if(l.rel=o?`stylesheet`:e,o||(l.as=`script`),l.crossOrigin=``,l.href=i,c&&l.setAttribute(`nonce`,c),document.head.appendChild(l),o)return new Promise((e,t)=>{l.addEventListener(`load`,e),l.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${i}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(e=>{for(let t of e||[])t.status===`rejected`&&s(t.reason);return r().catch(s)})};export{r as __vitePreload};
|
package/dist/component.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e=(e,t)=>({frameworkName:`svelte`,component:e,style:t}),t=e=>e.frameworkName===`svelte`;export{e as adaptSvelteComponent,t as isValidAdaptedComponent};
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"./LazyImage.svelte";export{e as LazyImage};
|
package/dist/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e=Symbol(`picked-client`),t=Symbol(`picked-experience-instance`),n=Symbol(`picked-scope`),r=Symbol(`picked-step`);export{e as CLIENT_CONTEXT_KEY,t as EXPERIENCE_CONTEXT_KEY,n as SCOPE_CONTEXT_KEY,r as STEP_CONTEXT_KEY};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getExperience as e,getPicked as t}from"../hooks/client.js";import{createForm as n}from"@picked/client/form";import*as r from"svelte/internal/client";function i(i,a,o){let s=n({client:t(),experienceInstance:e()},i,a,o);return{...s,form:{...s.form,onSubmit:e=>{r.user_effect(()=>s.form.onSubmit(e))},onSuccess:e=>{r.user_effect(()=>s.form.onSuccess(e))},onError:e=>{r.user_effect(()=>s.form.onError(e))}}}}export{i as createForm};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Store } from 'effector';
|
|
2
|
+
import { FormInstance as CoreFormInstance, ErrorCallback, SubmitCallback, SuccessCallback } from '@picked/client/form';
|
|
3
|
+
export type { FormField } from '@picked/client/form';
|
|
4
|
+
/**
|
|
5
|
+
* Svelte FormInstance — identical to core but callback registration returns void
|
|
6
|
+
* (cleanup is handled automatically via $effect, not by the consumer).
|
|
7
|
+
*/
|
|
8
|
+
export interface FormInstance<TFieldIds extends string = string> extends Omit<CoreFormInstance<TFieldIds>, 'form'> {
|
|
9
|
+
form: Omit<CoreFormInstance<TFieldIds>['form'], 'onSubmit' | 'onSuccess' | 'onError'> & {
|
|
10
|
+
onSubmit: (callback: SubmitCallback<TFieldIds>) => void;
|
|
11
|
+
onSuccess: (callback: SuccessCallback<TFieldIds>) => void;
|
|
12
|
+
onError: (callback: ErrorCallback) => void;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates a form instance with Svelte lifecycle management.
|
|
17
|
+
*
|
|
18
|
+
* Wraps the framework-agnostic createForm from @picked/client/form:
|
|
19
|
+
* - Injects client and experienceInstance from Svelte context
|
|
20
|
+
* - Auto-wires callback cleanup via $effect so consumers don't need to manage lifecycle
|
|
21
|
+
*
|
|
22
|
+
* Used internally by setStepContext — access via getStep() in components.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createForm(formId: string, title: Store<string>, fieldIds: Store<string[]>): FormInstance;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './create-form.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ValidationError } from '@picked/client';
|
|
2
|
+
interface GetFormOptions {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
onSuccess?: () => void | Promise<void>;
|
|
6
|
+
onError?: (errors: ValidationError[]) => void | Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
type SubmitEventWithCurrentTarget = SubmitEvent & {
|
|
9
|
+
currentTarget: EventTarget & HTMLFormElement;
|
|
10
|
+
};
|
|
11
|
+
export declare function getForm({ id: formId, title, onError, onSuccess }: GetFormOptions): {
|
|
12
|
+
form: {
|
|
13
|
+
onsubmit: import('effector').EventCallable<SubmitEventWithCurrentTarget>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getExperience as e,getPicked as t}from"../hooks/client.js";import{getStep as n}from"../hooks/step.js";import"../hooks/index.js";import{buildResponsesFromFormData as r}from"@picked/client/form";import{attach as i,createEffect as a,createEvent as o,sample as s,split as c}from"effector";function l({id:l,title:u,onError:d,onSuccess:f}){let p=t(),m=n(),h=e(),{currentStepStore:g}=h,_=o(),v=a(e=>p.responses.commit(e)),y=i({source:{step:g},effect:a(({step:e})=>{p.eventBus({type:`form_submit_success`,form:{id:l,title:u},experience:h,step:e??void 0}),f?.()})}),b=i({source:{step:g},mapParams:(e,t)=>({step:t.step,errors:e.errors}),effect:a(({step:e,errors:t})=>{p.eventBus({type:`form_submit_error`,form:{id:l,title:u},exception:{reason:t},experience:h,step:e??void 0}),t.forEach(t=>{p.eventBus({type:`field_validation_error`,exception:{reason:[t]},experience:h,step:e??void 0})}),d?.(t)})});return s({clock:_,source:{step:g},fn:({step:e})=>({formId:l,title:u,step:e}),target:a(({formId:e,title:t,step:n})=>{p.eventBus({type:`form_submit`,form:{id:e,title:t},experience:h,step:n??void 0})})}),s({clock:_,source:{fields:p.fields.listStore,stepFields:m.fields,step:g},fn:({stepFields:e},t)=>(t.preventDefault(),r(e,new FormData(t.currentTarget))),target:v}),c({source:v.doneData,match:{hasErrors:({errors:e})=>e.length>0},cases:{hasErrors:b,__:y}}),{form:{onsubmit:_}}}export{l as getForm};
|
package/dist/form/index.d.ts
CHANGED
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
id: string;
|
|
4
|
-
title: string;
|
|
5
|
-
onSuccess?: () => void | Promise<void>;
|
|
6
|
-
onError?: (errors: ValidationError[]) => void | Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
type SubmitEventWithCurrentTarget = SubmitEvent & {
|
|
9
|
-
currentTarget: EventTarget & HTMLFormElement;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param root0
|
|
14
|
-
* @param root0.id
|
|
15
|
-
* @param root0.title
|
|
16
|
-
* @param root0.onError
|
|
17
|
-
* @param root0.onSuccess
|
|
18
|
-
* @example
|
|
19
|
-
*/
|
|
20
|
-
export declare function getForm({ id: formId, title, onError, onSuccess }: GetFormOptions): {
|
|
21
|
-
form: {
|
|
22
|
-
onsubmit: import('effector').EventCallable<SubmitEventWithCurrentTarget>;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export {};
|
|
1
|
+
export type { FormField } from '@picked/client/form';
|
|
2
|
+
export { getForm } from './get-form';
|
package/dist/form/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getForm as e}from"./get-form.js";export{e as getForm};
|
package/dist/hooks/action.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getPicked as e}from"./client.js";import{attach as t,createEffect as n,createEvent as r,createStore as i,sample as a}from"effector";function o(t){return e().actions.getEvokableAction(t)}function s(e){let s=o(e),c=i(void 0,{skipVoid:!1}),l=r(),u=t({source:s,mapParams:(e,t)=>t,effect:n(async e=>{if(e)return e()})});return a({clock:l,target:u}),a({clock:u.doneData,target:c}),l(),c}export{o as getAction,s as getActionResult};
|
package/dist/hooks/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{CLIENT_CONTEXT_KEY as e,EXPERIENCE_CONTEXT_KEY as t}from"../context.js";import{getContext as n}from"svelte";function r(){return n(e)}function i(){return n(t)}export{i as getExperience,r as getPicked};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createEffect as
|
|
1
|
+
import{createEffect as e,createStore as t,sample as n}from"effector";var r=new Map;function i(e){return r.has(e)||r.set(e,new Map),r.get(e)}function a(e,t){let n=i(e).get(t);n&&(n.promise=null,n.timestamp=0)}function o(e){i(e).forEach(e=>{e.promise=null,e.timestamp=0})}function s(){r.clear()}function c(r,o,s={}){let{namespace:c=`default`,defaultStaleTime:u=300*1e3,defaultRetry:d=3,defaultRetryDelay:f=1e3}=s,p=i(c),m=e(async e=>{let{key:t,params:n,options:i}=e,a=p.get(t)?.promise,o=p.get(t),s=i.refetch||!a||o&&Date.now()-o.timestamp>(i.staleTime??o.staleTime);if(!a||s){a=l(()=>r(n),i.retry??d,i.retryDelay??f);let e=p.get(t);e&&(e.promise=a,e.timestamp=Date.now(),e.staleTime=i.staleTime??u)}return{key:t,promise:a,result:await a}});return(r,i={})=>{let s=o(r),l=p.get(s);l||(l={promise:null,data:t(null),error:t(null),isLoading:t(!1),timestamp:0,staleTime:i.staleTime??u},p.set(s,l));let d=e(e=>e);return n({source:m.doneData,filter:e=>e.key===s,fn:e=>e.promise,target:d}),l.isLoading.on(m.pending,(e,t)=>t),l.isLoading.on(d.pending,(e,t)=>t),l.data.on(d.doneData,(e,t)=>t),l.error.on(d.doneData,()=>null),l.error.on(d.failData,(e,t)=>t),l.error.on(m.failData,(e,t)=>t),(!l.promise||Date.now()-l.timestamp>l.staleTime)&&m({key:s,params:r,options:i}),{data:l.data,error:l.error,isLoading:l.isLoading,refetch:()=>m({key:s,params:r,options:{...i,refetch:!0}}).then(({result:e})=>e),invalidate:()=>a(c,s)}}}async function l(e,t,n){let r;for(let i=0;i<=t;i++)try{return await e()}catch(e){r=e instanceof Error?e:Error(String(e)),i<t&&await new Promise(e=>{setTimeout(e,n*2**i)})}throw r}var u={invalidate:(e,t)=>{t?a(e,t):o(e)},clear:()=>s()},d={realtime:{defaultStaleTime:5*1e3,defaultRetry:1},standard:{defaultStaleTime:300*1e3,defaultRetry:3},static:{defaultStaleTime:3600*1e3,defaultRetry:2}};export{c as createQuery,u as queryCache,d as queryPresets};
|
package/dist/hooks/events.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getExperience as e,getPicked as t}from"./client.js";import{attach as n}from"effector";import{trackRecommendationPresentEvent as r}from"@picked/analytics";var i=()=>{let{session:i,projectId:a,organizationId:o}=t(),s=e();return n({source:{config:s.configStore,step:s.currentStepStore},async effect({config:e,step:t},n){if(!i||!t)throw Error(`Cannot track recommendation present event: missing session or experience data.`);return r({organizationId:o,projectId:a,experience:{id:s.experienceId,title:e.name},sessionId:i.id,identifiers:i.identifiers,isUser:i.isUser,step:t,productList:n})}})};export{i as getTrackRecommendationPresentEvent};
|
package/dist/hooks/feature.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getPicked as e}from"./client.js";import{attach as t,createEffect as n,createEvent as r,createStore as i,sample as a}from"effector";function o(t){return e().features.getEvokableFeature(t)}function s(e){let s=o(e),c=i(void 0,{skipVoid:!1}),l=r(),u=t({source:s,mapParams:(e,t)=>t,effect:n(async e=>await e())});return a({clock:l,target:u}),a({clock:u.doneData,fn:t=>{if(t!==void 0)return{id:e,bucket:t}},target:c}),l(),a({clock:s,target:l}),c}export{o as getFeature,s as getFeatureResult};
|
package/dist/hooks/field.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Field, FieldValue } from '@picked/client';
|
|
2
2
|
import { Store } from 'effector';
|
|
3
|
-
interface GetFieldResponse {
|
|
3
|
+
export interface GetFieldResponse {
|
|
4
4
|
value: Store<FieldValue>;
|
|
5
5
|
field: Store<Field | null>;
|
|
6
6
|
}
|
|
7
|
-
export declare function getField(
|
|
8
|
-
export {};
|
|
7
|
+
export declare function getField(id: string): GetFieldResponse;
|
package/dist/hooks/field.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getPicked as
|
|
1
|
+
import{getPicked as e}from"./client.js";function t(t){let n=e();return{field:n.fields.getById(t),value:n.responses.getByFieldId(t)}}export{t as getField};
|
package/dist/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getExperience as
|
|
1
|
+
import{getExperience as e,getPicked as t}from"./client.js";import{getPredicate as n,getPredicateResult as r}from"./predicate.js";import{getFeature as i,getFeatureResult as a}from"./feature.js";import{getAction as o,getActionResult as s}from"./action.js";import{getStep as c,setStepContext as l}from"./step.js";import{getContextScope as u,setContextScope as d,useUnit as f}from"./stores.js";import{createLocalStorageStore as p,createSessionStorageStore as m}from"./storage.js";import{getTrackRecommendationPresentEvent as h}from"./events.js";import{createQuery as g,queryCache as _,queryPresets as v}from"./create-query/index.js";export{p as createLocalStorageStore,g as createQuery,m as createSessionStorageStore,o as getAction,s as getActionResult,u as getContextScope,e as getExperience,i as getFeature,a as getFeatureResult,t as getPicked,n as getPredicate,r as getPredicateResult,c as getStep,h as getTrackRecommendationPresentEvent,_ as queryCache,v as queryPresets,d as setContextScope,l as setStepContext,f as useUnit};
|
package/dist/hooks/predicate.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"
|
|
1
|
+
import{getPicked as e}from"./client.js";import{attach as t,createEffect as n,createEvent as r,createStore as i,sample as a}from"effector";import"@picked/client";function o(t){return e().predicates.getEvokablePredicate(t)}function s(e){let s=o(e),c=i(void 0,{skipVoid:!1}),l=r(),u=t({source:s,mapParams:(e,t)=>t,effect:n(async e=>{if(e)return await e()})});return a({clock:l,target:u}),a({clock:u.doneData,target:c}),l(),a({clock:s,target:l}),c}export{o as getPredicate,s as getPredicateResult};
|
package/dist/hooks/step.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Store } from 'effector';
|
|
2
|
-
import { ExperienceStep
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
export interface StepContext {
|
|
2
|
+
import { ExperienceStep } from '@picked/client';
|
|
3
|
+
import { FormInstance, FormField } from '../form/create-form.svelte';
|
|
4
|
+
export interface StepContext extends FormInstance {
|
|
7
5
|
step: Store<ExperienceStep>;
|
|
8
|
-
fields
|
|
6
|
+
/** Directly accessible fields with current response values — usable without a form */
|
|
7
|
+
fields: Store<FormField[]>;
|
|
8
|
+
isActive: Store<boolean>;
|
|
9
|
+
/** @deprecated Use `isActive` instead */
|
|
9
10
|
isActiveStep: Store<boolean>;
|
|
10
11
|
}
|
|
11
|
-
export declare function getStep(): StepContext;
|
|
12
12
|
export declare function setStepContext(stepId: string): StepContext;
|
|
13
|
-
export
|
|
13
|
+
export declare function getStep(): StepContext;
|
package/dist/hooks/step.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{STEP_CONTEXT_KEY as e}from"../context.js";import{getExperience 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(e){let n=t().treeStore.map(t=>{let n=t.steps.find(t=>t.id===e);if(!n)throw Error(`Step with id "${e}" not found in the experience tree.`);return n});return{stepStore:n,form:a(e,n.map(e=>e.label),n.map(e=>e.fieldIds))}}function s(t){let{activeStep:r}=n(),a=r.map(e=>e?.id===t),{stepStore:s,form:c}=o(t);return i(e,{step:s,isActive:a,isActiveStep:a,...c})}function c(){return r(e)}export{c as getStep,s as setStepContext};
|
package/dist/hooks/storage.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getExperience as e}from"./client.js";import{createStorageKey as t,localStore as n,sessionStore as r,supportsLocalStorage as i,supportsSessionStorage as a}from"@picked/client";import{writable as o}from"svelte/store";var s={fallback:null,scope:`global`};function c(c,l,u){let{fallback:d,scope:f}={...s,...u},p=c===`session`?r:n,m=c===`session`?a:i,h=o(d);if(m()){let n=t(l,f,e()),r=p.get(n).text();r!==null&&h.set(r),h.subscribe(e=>{e?p.set(n,e):p.remove(n)});let i=p.subscribe(n,e=>{h.set(e.text())});return{...h,destroy:()=>{i()}}}return{...h,destroy:()=>{}}}function l(e,t){return c(`session`,e,t)}function u(e,t){return c(`local`,e,t)}export{u as createLocalStorageStore,l as createSessionStorageStore};
|
package/dist/hooks/stores.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{SCOPE_CONTEXT_KEY as e}from"../context.js";import{createWatch as t,fork as n,is as r,scopeBind as i}from"effector";import{getContext as a,setContext as o}from"svelte";var s=t=>o(e,n(t)),c=()=>a(e);function l(e){let n=c();return n?r.effect(e)||r.event(e)&&typeof e==`function`?i(e,{scope:n}):{subscribe:r=>(r(n.getState(e)),t({unit:e,fn:r,scope:n}))}:e}export{c as getContextScope,s as setContextScope,l as useUnit};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{adaptSvelteComponent as
|
|
1
|
+
import{adaptSvelteComponent as e,isValidAdaptedComponent as t}from"./component.js";import{LazyImage as n}from"./components/index.js";export{n as LazyImage,e as adaptSvelteComponent,t as isValidAdaptedComponent};
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { ExperienceInstance } from '@picked/client'
|
|
3
3
|
import { Button } from '../ui'
|
|
4
|
-
import { getPicked } from '../../../hooks'
|
|
5
4
|
|
|
6
5
|
export let experienceInstance: ExperienceInstance
|
|
7
6
|
|
|
8
|
-
const client = getPicked()
|
|
9
|
-
const experienceLookup = client.experiences.get(experienceInstance.experienceId)
|
|
10
|
-
|
|
11
7
|
const currentNode = experienceInstance.currentNodeStore
|
|
12
8
|
const currentStep = experienceInstance.currentStepStore
|
|
13
9
|
const nextStepNodes = experienceInstance.nextReachableStepNodesStore
|
|
@@ -16,24 +12,15 @@
|
|
|
16
12
|
const isOpen = experienceInstance.isOpenStore
|
|
17
13
|
|
|
18
14
|
$: totalNextStepNodes = $nextStepNodes.length
|
|
19
|
-
$: experienceName = $experienceLookup?.name ?? $experienceLookup?.key ?? experienceInstance.experienceId
|
|
20
|
-
$: currentNodeDisplay = $currentNode
|
|
21
|
-
? (('name' in $currentNode && $currentNode.name) ||
|
|
22
|
-
('stepKey' in $currentNode && $currentNode.stepKey) ||
|
|
23
|
-
$currentNode.id)
|
|
24
|
-
: ''
|
|
25
|
-
$: currentStepDisplay = $currentStep
|
|
26
|
-
? ($currentStep.name ?? $currentStep.key ?? $currentStep.id)
|
|
27
|
-
: ''
|
|
28
15
|
</script>
|
|
29
16
|
|
|
30
17
|
<tr>
|
|
31
|
-
<td>{
|
|
18
|
+
<td>{experienceInstance.experienceId}</td>
|
|
32
19
|
<td><Button variant="ghost" size="small" onclick={() => experienceInstance.toggleOpen()}>{$isOpen}</Button></td>
|
|
33
|
-
<td>{
|
|
20
|
+
<td>{$currentNode?.id || ''}</td>
|
|
34
21
|
<td>{$currentNode?.type || ''}</td>
|
|
35
|
-
<td>{
|
|
36
|
-
<td>{$currentStep?.
|
|
22
|
+
<td>{$currentStep?.id || ''}</td>
|
|
23
|
+
<td>{$currentStep?.label || ''}</td>
|
|
37
24
|
<td>{totalNextStepNodes}</td>
|
|
38
25
|
<td>{$stepsToOrigin[0]} - {$stepsToOrigin[1]}</td>
|
|
39
26
|
<td>{$stepsToLeaf[0]} - {$stepsToLeaf[1]}</td>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
export let experienceInstances: ExperienceInstance[]
|
|
7
7
|
|
|
8
8
|
const columns = [
|
|
9
|
-
{ key: 'experience', header: '
|
|
9
|
+
{ key: 'experience', header: 'Experience' },
|
|
10
10
|
{ key: 'isOpen', header: 'Is Open' },
|
|
11
11
|
{ key: 'currentNodeId', header: 'Current node ID' },
|
|
12
12
|
{ key: 'currentNodeType', header: 'Current node Type' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{svelteDevtoolsPlugin as
|
|
1
|
+
import{svelteDevtoolsPlugin as e}from"./plugin.js";export{e as svelteDevtoolsPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__vitePreload as
|
|
1
|
+
import{adaptSvelteComponent as e}from"../../component.js";import{__vitePreload as t}from"../../_virtual/_vite/preload-helper.js";import{lazyComponent as n}from"@picked/client";import{createExperience as r,createExperiencePlugin as i}from"@picked/client/plugins/create-experience";var a=a=>{let o=r({id:`devtools`,name:`Picked Devtools`,condition:!1,initializeOpen:!1,targets:[{selector:`body`,placement:`append`}],component:e(n(()=>t(()=>import(`./DevToolsExperience.svelte`),[])))});return o.addStep({label:`Tools`}),[{name:`svelte-devtools`,setup:e=>{a?.enabled&&e.eventBus.watch(t=>{t.type===`ready`&&e.experiences.launch({id:o.id,options:{bypassCondition:!0}})})}},i({experiences:[o]})]};export{a as svelteDevtoolsPlugin};
|
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { EventBusPayload, EventHistoryEntry } from '@picked/client'
|
|
3
3
|
import { Badge, Card, CodeBlock, Stack, Text } from '../../ui'
|
|
4
|
-
import { getPicked } from '../../../../hooks'
|
|
5
4
|
|
|
6
5
|
export let event: EventHistoryEntry
|
|
7
6
|
export let isExpanded: boolean
|
|
8
7
|
export let onToggle: () => void
|
|
9
8
|
|
|
10
|
-
const client = getPicked()
|
|
11
|
-
|
|
12
|
-
const eventExpId =
|
|
13
|
-
'experience' in event.payload && event.payload.experience
|
|
14
|
-
? event.payload.experience.experienceId
|
|
15
|
-
: undefined
|
|
16
|
-
const eventExpLookup = client.experiences.get(eventExpId ?? '')
|
|
17
|
-
$: eventExpName = eventExpId
|
|
18
|
-
? ($eventExpLookup?.name ?? $eventExpLookup?.key ?? eventExpId)
|
|
19
|
-
: '-'
|
|
20
|
-
|
|
21
9
|
function formatTime(date: Date): string {
|
|
22
10
|
return date.toLocaleTimeString('en-US', {
|
|
23
11
|
hour12: false,
|
|
@@ -33,49 +21,59 @@
|
|
|
33
21
|
value: unknown
|
|
34
22
|
}
|
|
35
23
|
|
|
36
|
-
function
|
|
37
|
-
if (!exp || typeof exp !== 'object') return []
|
|
24
|
+
function getPayloadFields(payload: EventBusPayload): PayloadField[] {
|
|
38
25
|
const fields: PayloadField[] = []
|
|
39
|
-
if ('id' in exp && exp.id) fields.push({ label: 'Experience ID', value: exp.id })
|
|
40
|
-
if ('experienceId' in exp && exp.experienceId)
|
|
41
|
-
fields.push({ label: 'Experience Type', value: exp.experienceId })
|
|
42
|
-
return fields
|
|
43
|
-
}
|
|
44
26
|
|
|
45
|
-
|
|
46
|
-
if (!step || typeof step !== 'object') return []
|
|
47
|
-
const fields: PayloadField[] = []
|
|
48
|
-
if ('id' in step && step.id) fields.push({ label: 'Step ID', value: step.id })
|
|
49
|
-
// eslint-disable-next-line sonarjs/deprecation -- backwards-compat fallback for label
|
|
50
|
-
const stepName = ('name' in step && step.name) || ('label' in step && step.label)
|
|
51
|
-
if (stepName) fields.push({ label: 'Step Name', value: stepName })
|
|
52
|
-
return fields
|
|
53
|
-
}
|
|
27
|
+
fields.push({ label: 'Type', value: payload.type })
|
|
54
28
|
|
|
55
|
-
|
|
56
|
-
const fields: PayloadField[] = []
|
|
57
|
-
if ('value' in payload && payload.value !== undefined)
|
|
29
|
+
if ('value' in payload && payload.value !== undefined) {
|
|
58
30
|
fields.push({ label: 'Value', value: payload.value })
|
|
59
|
-
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if ('experience' in payload && payload.experience) {
|
|
34
|
+
const exp = payload.experience
|
|
35
|
+
if (exp && typeof exp === 'object') {
|
|
36
|
+
if ('id' in exp && exp.id) {
|
|
37
|
+
fields.push({ label: 'Experience ID', value: exp.id })
|
|
38
|
+
}
|
|
39
|
+
if ('experienceId' in exp && exp.experienceId) {
|
|
40
|
+
fields.push({ label: 'Experience Type', value: exp.experienceId })
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if ('step' in payload && payload.step) {
|
|
46
|
+
const step = payload.step
|
|
47
|
+
if (step && typeof step === 'object') {
|
|
48
|
+
if ('id' in step && step.id) {
|
|
49
|
+
fields.push({ label: 'Step ID', value: step.id })
|
|
50
|
+
}
|
|
51
|
+
if ('label' in step && step.label) {
|
|
52
|
+
fields.push({ label: 'Step Label', value: step.label })
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if ('form' in payload && payload.form) {
|
|
60
58
|
fields.push({ label: 'Form', value: JSON.stringify(payload.form) })
|
|
61
|
-
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if ('feature' in payload && payload.feature) {
|
|
62
62
|
fields.push({ label: 'Feature', value: JSON.stringify(payload.feature) })
|
|
63
|
-
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if ('exception' in payload && payload.exception) {
|
|
64
66
|
fields.push({ label: 'Exception', value: JSON.stringify(payload.exception) })
|
|
65
|
-
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if ('version' in payload && payload.version) {
|
|
66
70
|
fields.push({ label: 'Version', value: payload.version })
|
|
67
|
-
|
|
68
|
-
}
|
|
71
|
+
}
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
const fields: PayloadField[] = [{ label: 'Type', value: payload.type }]
|
|
72
|
-
fields.push(...getScalarFields(payload))
|
|
73
|
-
if ('experience' in payload && payload.experience)
|
|
74
|
-
fields.push(...getExperienceFields(payload.experience))
|
|
75
|
-
if ('step' in payload && payload.step)
|
|
76
|
-
fields.push(...getStepFields(payload.step))
|
|
77
|
-
if ('id' in payload && payload.id && payload.type === 'session')
|
|
73
|
+
if ('id' in payload && payload.id && payload.type === 'session') {
|
|
78
74
|
fields.push({ label: 'Session ID', value: payload.id })
|
|
75
|
+
}
|
|
76
|
+
|
|
79
77
|
return fields
|
|
80
78
|
}
|
|
81
79
|
|
|
@@ -99,7 +97,9 @@
|
|
|
99
97
|
<Badge status="info">{event.payload.type}</Badge>
|
|
100
98
|
</td>
|
|
101
99
|
<td>
|
|
102
|
-
<Text size="small">
|
|
100
|
+
<Text size="small">
|
|
101
|
+
{'experience' in event.payload && event.payload.experience ? event.payload.experience.experienceId : '-'}
|
|
102
|
+
</Text>
|
|
103
103
|
</td>
|
|
104
104
|
<td>
|
|
105
105
|
<Text size="caption" color="subdued">
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
<Text size="small" weight="semibold">Event Payload</Text>
|
|
115
115
|
<Card>
|
|
116
116
|
<Stack direction="vertical" gap="small">
|
|
117
|
-
{#each getPayloadFields(event.payload) as field
|
|
117
|
+
{#each getPayloadFields(event.payload) as field}
|
|
118
118
|
<Text size="caption" inline>
|
|
119
119
|
<Text size="caption" weight="semibold" color="subdued" inline>{field.label}:</Text>
|
|
120
120
|
<CodeBlock code={formatValue(field.value)} inline />
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
<Stack direction="vertical" gap="medium" padding="medium">
|
|
13
13
|
<Stack direction="horizontal" gap="small">
|
|
14
|
-
<Button variant="primary" size="small" onclick={() => client.
|
|
14
|
+
<Button variant="primary" size="small" onclick={() => client.launchExperienceById(experience.id)}>
|
|
15
15
|
Launch experience
|
|
16
16
|
</Button>
|
|
17
17
|
</Stack>
|
|
@@ -9,16 +9,17 @@
|
|
|
9
9
|
let zoom = 1
|
|
10
10
|
let selectedNode = null
|
|
11
11
|
let highlightedPath: string[][] = []
|
|
12
|
-
let error = null
|
|
12
|
+
let error: string | null = null
|
|
13
13
|
const loading = false
|
|
14
14
|
|
|
15
15
|
let treeRenderingDone = false
|
|
16
16
|
|
|
17
17
|
const tree = experience.treeStore
|
|
18
18
|
|
|
19
|
+
$: steps = $tree.steps
|
|
19
20
|
$: nodes = $tree.nodes
|
|
20
21
|
$: edges = $tree.edges
|
|
21
|
-
$:
|
|
22
|
+
$: conditionals = $tree.conditionals
|
|
22
23
|
|
|
23
24
|
let zoomBehavior: d3.ZoomBehavior<SVGSVGElement, unknown>
|
|
24
25
|
|
|
@@ -88,7 +89,8 @@
|
|
|
88
89
|
function renderGraph() {
|
|
89
90
|
d3.select(svgEl).selectAll('*').remove()
|
|
90
91
|
|
|
91
|
-
const
|
|
92
|
+
const stepsMap = new Map(steps.map((s) => [s.id, s]))
|
|
93
|
+
const conditionalsMap = new Map(conditionals.map((c) => [c.id, c]))
|
|
92
94
|
const outgoingEdges = new Map<string, ExperienceEdge[]>()
|
|
93
95
|
edges.forEach((e) => {
|
|
94
96
|
if (!outgoingEdges.has(e.sourceNodeId)) outgoingEdges.set(e.sourceNodeId, [])
|
|
@@ -97,13 +99,12 @@
|
|
|
97
99
|
|
|
98
100
|
const getNodeLabel = (node: ExperienceNode): string => {
|
|
99
101
|
if (node.type === 'origin') return 'Start'
|
|
100
|
-
if (node.type === 'step')
|
|
101
|
-
return
|
|
102
|
-
if (node.type === 'conditional') {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
if (conditionItem?.condition) return formatLogicRule(conditionItem.condition)
|
|
102
|
+
if (node.type === 'step' && node.stepId)
|
|
103
|
+
return stepsMap.get(node.stepId)?.label ?? 'Unknown Step'
|
|
104
|
+
if (node.type === 'conditional' && node.conditionalId) {
|
|
105
|
+
const conditional = conditionalsMap.get(node.conditionalId)
|
|
106
|
+
if (conditional?.label) return conditional.label
|
|
107
|
+
if (conditional?.condition) return formatLogicRule(conditional.condition)
|
|
107
108
|
return 'Condition'
|
|
108
109
|
}
|
|
109
110
|
return 'Unknown Node'
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { HistoryEntry } from '@picked/client'
|
|
3
|
-
import { getPicked } from '../../../../hooks'
|
|
4
3
|
|
|
5
4
|
export let historyEntry: HistoryEntry
|
|
6
|
-
|
|
7
|
-
const client = getPicked()
|
|
8
|
-
const experienceLookup = client.experiences.get(historyEntry.experienceId)
|
|
9
|
-
$: experienceName = $experienceLookup?.name ?? $experienceLookup?.key ?? historyEntry.experienceId
|
|
10
5
|
</script>
|
|
11
6
|
|
|
12
7
|
<tr>
|
|
13
8
|
<td>{historyEntry.id}</td>
|
|
14
|
-
<td>{
|
|
9
|
+
<td>{historyEntry.experienceId}</td>
|
|
15
10
|
<td>{historyEntry.node.id}</td>
|
|
16
11
|
<td>{historyEntry.node.type}</td>
|
|
17
12
|
<td>{historyEntry.at}</td>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ResponseListItem, PrimitiveFieldValue, Field } from '@picked/client'
|
|
2
|
+
import type { ResponseListItem, PrimitiveFieldValue, Field, FieldValue } from '@picked/client'
|
|
3
3
|
import { getPicked } from '../../../../hooks'
|
|
4
4
|
import { Button, Text, CodeBlock, Banner, Stack } from '../../ui'
|
|
5
5
|
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
let isEditing = false
|
|
12
12
|
let editValue = ''
|
|
13
13
|
let editError = ''
|
|
14
|
-
let selectedOptions: Set<
|
|
14
|
+
let selectedOptions: Set<FieldValue> = new Set()
|
|
15
15
|
|
|
16
|
-
$: hasOptions = field?.options && field.options.length > 0
|
|
16
|
+
$: hasOptions = Array.isArray(field?.options) && field.options.length > 0
|
|
17
|
+
$: staticOptions = Array.isArray(field?.options) ? field.options : null
|
|
17
18
|
$: currentValue = response?.value ?? null
|
|
18
19
|
|
|
19
20
|
function formatValue(value: unknown): string {
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
selectedOptions = new Set()
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
function toggleOption(optionValue:
|
|
56
|
+
function toggleOption(optionValue: FieldValue) {
|
|
56
57
|
if (field?.multiple) {
|
|
57
58
|
if (selectedOptions.has(optionValue)) {
|
|
58
59
|
selectedOptions.delete(optionValue)
|
|
@@ -65,7 +66,7 @@
|
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
function parseValue(input: string):
|
|
69
|
+
function parseValue(input: string): FieldValue {
|
|
69
70
|
input = input.trim()
|
|
70
71
|
|
|
71
72
|
if (input === '' || input === '-') {
|
|
@@ -99,14 +100,14 @@
|
|
|
99
100
|
|
|
100
101
|
async function saveEdit() {
|
|
101
102
|
try {
|
|
102
|
-
let newValue:
|
|
103
|
+
let newValue: FieldValue
|
|
103
104
|
|
|
104
105
|
if (hasOptions) {
|
|
105
106
|
const values = Array.from(selectedOptions)
|
|
106
107
|
if (field?.multiple) {
|
|
107
108
|
newValue = values
|
|
108
109
|
} else {
|
|
109
|
-
newValue = values
|
|
110
|
+
newValue = values.at(0) ?? null
|
|
110
111
|
}
|
|
111
112
|
} else {
|
|
112
113
|
newValue = parseValue(editValue)
|
|
@@ -134,7 +135,7 @@
|
|
|
134
135
|
|
|
135
136
|
<tr>
|
|
136
137
|
<td>
|
|
137
|
-
<CodeBlock code={field.
|
|
138
|
+
<CodeBlock code={field.name} inline />
|
|
138
139
|
</td>
|
|
139
140
|
<td>
|
|
140
141
|
<Text size="small" weight="semibold">{field.label}</Text>
|
|
@@ -142,9 +143,9 @@
|
|
|
142
143
|
<td>
|
|
143
144
|
{#if isEditing}
|
|
144
145
|
<Stack direction="vertical" gap="small">
|
|
145
|
-
{#if hasOptions &&
|
|
146
|
+
{#if hasOptions && staticOptions}
|
|
146
147
|
<Stack direction="vertical" gap="small">
|
|
147
|
-
{#each
|
|
148
|
+
{#each staticOptions as option (option.id)}
|
|
148
149
|
<label class="option-label">
|
|
149
150
|
{#if field.multiple}
|
|
150
151
|
<input
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"./actions/Button.svelte";import t from"./actions/CopyButton.svelte";import n from"./typography/Heading.svelte";import r from"./typography/Text.svelte";import i from"./layout/Card.svelte";import a from"./layout/Divider.svelte";import o from"./layout/Spacer.svelte";import s from"./layout/Stack.svelte";import c from"./forms/Checkbox.svelte";import l from"./forms/RadioGroup.svelte";import u from"./forms/Select.svelte";import d from"./forms/Switch.svelte";import f from"./forms/TextField.svelte";import p from"./feedback/Banner.svelte";import m from"./feedback/Spinner.svelte";import h from"./overlays/Tooltip.svelte";import g from"./data/Badge.svelte";import _ from"./data/CodeBlock.svelte";import v from"./data/DataTable.svelte";import y from"./data/EmptyState.svelte";import b from"./data/ExpandableRow.svelte";import x from"./data/VisualizationContainer.svelte";export{g as Badge,p as Banner,e as Button,i as Card,c as Checkbox,_ as CodeBlock,t as CopyButton,v as DataTable,a as Divider,y as EmptyState,b as ExpandableRow,n as Heading,l as RadioGroup,u as Select,o as Spacer,m as Spinner,s as Stack,d as Switch,r as Text,f as TextField,h as Tooltip,x as VisualizationContainer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{svelteFrameworkPlugin as
|
|
1
|
+
import{svelteFrameworkPlugin as e}from"./plugin.js";export{e as svelteFrameworkPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{adaptSvelteComponent as
|
|
1
|
+
import{adaptSvelteComponent as e}from"../../component.js";import{renderSvelteComponent as t}from"../../render/browser.js";var n=n=>({name:`svelte-framework`,setup:r=>{r.registerFramework({name:`svelte`,render(...e){return t(...e,{stylesheets:n.stylesheets,css:n.css})}});let i=n.components.experience;i&&r.registerComponent(`experience`,e(i.component,i.style))}});export{n as svelteFrameworkPlugin};
|
package/dist/render/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isValidAdaptedComponent as e}from"../component.js";import{CLIENT_CONTEXT_KEY as t,EXPERIENCE_CONTEXT_KEY as n}from"../context.js";import{mergeArrays as r}from"../utils/array.js";import{mount as i}from"svelte";import{isLazyLoader as a}from"@picked/client";import o from"../utils/ErrorBoundary.svelte";function s(e,r){return new Map([[t,e],[n,r]])}var c=async(t,n,c,l,u)=>{if(!e(n))throw Error(`The component is invalid.`);let d=r(n.style?.sheets,u.stylesheets),f=r(n.style?.css,u.css);d.length&&d.forEach(e=>{let n=document.createElement(`link`);n.setAttribute(`rel`,`stylesheet`),n.setAttribute(`href`,e),n.setAttribute(`type`,`text/css`),n.setAttribute(`picked-injected`,`true`),t.appendChild(n)}),f.length&&f.forEach(e=>{let n=document.createElement(`style`);n.textContent=e,n.setAttribute(`type`,`text/css`),n.setAttribute(`picked-injected`,`true`),t.appendChild(n)});let p=e=>{i(o,{target:t,props:{component:e,componentProps:{client:c,experience:l}},context:s(c,l)})};if(a(n.component)){let{default:e}=await n.component.load();p(e);return}if(n.component instanceof Promise){let{default:e}=await n.component;p(e);return}p(n.component)},l=e=>{};export{s as createContext,c as renderSvelteComponent,l as unRenderSvelteComponent};
|
package/dist/render/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isValidAdaptedComponent as e}from"../component.js";import{CLIENT_CONTEXT_KEY as t,EXPERIENCE_CONTEXT_KEY as n}from"../context.js";import{mergeArrays as r}from"../utils/array.js";import{isLazyLoader as i}from"@picked/client";import{render as a}from"svelte/server";function o(e,r){return new Map([[t,e],[n,r]])}var s=async(t,n,s,c)=>{if(!e(t))throw Error(`The component is invalid.`);let l=r(t.style?.sheets,c.stylesheets),u=r(t.style?.css,c.css),d;d=i(t.component)?(await t.component.load()).default:t.component instanceof Promise?(await t.component).default:t.component;let f=a(d,{props:{client:n,experience:s},context:o(n,s)});return{stylesheets:l,css:u,head:f.head,html:f.html,body:f.body,hashes:f.hashes}};export{o as createContext,s as staticRenderSvelteComponent};
|
package/dist/router/Step.svelte
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
|
|
52
52
|
sample({
|
|
53
53
|
source: { steps: stepsStore, currentStep: currentStepStore },
|
|
54
|
-
fn: ({ steps, currentStep }) => steps.find((s) => s.id ===
|
|
54
|
+
fn: ({ steps, currentStep }) => steps.find((s) => s.id === currentStep?.id) || null,
|
|
55
55
|
target: setActiveStepEvent,
|
|
56
56
|
})
|
|
57
57
|
|
package/dist/router/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getContext as
|
|
1
|
+
import{getContext as e,setContext as t}from"svelte";var n=Symbol(`router`),r=e=>t(n,e),i=()=>e(n);export{i as getStepRouter,r as setStepRouter};
|
package/dist/router/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"./StepRouter.svelte";import t from"./Step.svelte";export{t as Step,e as StepRouter};
|
package/dist/server/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isValidAdaptedComponent as
|
|
1
|
+
import{isValidAdaptedComponent as e}from"../component.js";import{staticRenderSvelteComponent as t}from"../render/server.js";var n={isValidComponent:e,render:async(e,n,r)=>{let i=await t(e,n,r,{});return{head:i.head,body:i.body}}};export{n as renderer};
|
package/dist/utils/array.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e=(e,t)=>[...e||[],...t||[]];export{e as mergeArrays};
|
package/dist/vite-env.d.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
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.1774224866171",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"d3": "^7.9.0"
|
|
6
6
|
},
|
|
@@ -11,22 +11,22 @@
|
|
|
11
11
|
"@repo/typescript-config": "workspace:*",
|
|
12
12
|
"@size-limit/file": "^12.0.0",
|
|
13
13
|
"@sveltejs/package": "^2.3.11",
|
|
14
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
14
|
+
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
15
15
|
"@tsconfig/svelte": "^5.0.4",
|
|
16
16
|
"@types/d3": "^7.4.3",
|
|
17
17
|
"@types/node": "^22",
|
|
18
|
-
"@vitest/coverage-v8": "^4.0
|
|
18
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
19
19
|
"effector": "^23.3.0",
|
|
20
20
|
"fast-glob": "^3.3.3",
|
|
21
21
|
"happy-dom": "^20.0.2",
|
|
22
22
|
"size-limit": "^12.0.0",
|
|
23
|
-
"svelte": "^5.
|
|
23
|
+
"svelte": "^5.46.4",
|
|
24
24
|
"svelte-check": "^4.2.2",
|
|
25
25
|
"typedoc": "^0.28.5",
|
|
26
26
|
"typedoc-plugin-markdown": "^4.6.3",
|
|
27
|
-
"vite": "^
|
|
27
|
+
"vite": "^8.0.1",
|
|
28
28
|
"vite-plugin-dts": "^4.5.4",
|
|
29
|
-
"vitest": "^4.0
|
|
29
|
+
"vitest": "^4.1.0"
|
|
30
30
|
},
|
|
31
31
|
"exports": {
|
|
32
32
|
".": {
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"knip",
|
|
81
81
|
"jscpd",
|
|
82
82
|
"eslint",
|
|
83
|
-
"
|
|
83
|
+
"tsgo"
|
|
84
84
|
],
|
|
85
85
|
"entry": [
|
|
86
86
|
"src/plugins/devtools/ui/index.ts"
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
},
|
|
89
89
|
"module": "./dist/index.js",
|
|
90
90
|
"peerDependencies": {
|
|
91
|
-
"@picked/client": "0.0.1-dev.
|
|
91
|
+
"@picked/client": "0.0.1-dev.1774224866171",
|
|
92
92
|
"effector": "^23.3.0",
|
|
93
|
-
"svelte": "^5.
|
|
93
|
+
"svelte": "^5.46.4"
|
|
94
94
|
},
|
|
95
95
|
"private": false,
|
|
96
96
|
"scripts": {
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"test:coverage": "vitest run --coverage",
|
|
112
112
|
"test:packaged-types": "attw --pack",
|
|
113
113
|
"test:watch": "vitest",
|
|
114
|
-
"type-check": "
|
|
114
|
+
"type-check": "tsgo -p . --noEmit"
|
|
115
115
|
},
|
|
116
116
|
"size-limit": [
|
|
117
117
|
{
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const p="modulepreload",v=function(l){return"/"+l},u={},y=function(d,c,E){let i=Promise.resolve();if(c&&c.length>0){let f=function(e){return Promise.all(e.map(o=>Promise.resolve(o).then(s=>({status:"fulfilled",value:s}),s=>({status:"rejected",reason:s}))))};document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),t=r?.nonce||r?.getAttribute("nonce");i=f(c.map(e=>{if(e=v(e),e in u)return;u[e]=!0;const o=e.endsWith(".css"),s=o?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${s}`))return;const n=document.createElement("link");if(n.rel=o?"stylesheet":p,o||(n.as="script"),n.crossOrigin="",n.href=e,t&&n.setAttribute("nonce",t),document.head.appendChild(n),o)return new Promise((m,h)=>{n.addEventListener("load",m),n.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${e}`)))})}))}function a(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return i.then(r=>{for(const t of r||[])t.status==="rejected"&&a(t.reason);return d().catch(a)})};export{y as __vitePreload};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{evaluateRuleLogic as s}from"@picked/client";function u(o){return o.options?.some(n=>"condition"in n)??!1}function l(o){return o.some(n=>n.condition||n.conditionKey||u(n))}async function a(o,n){return n.conditionKey?o.conditions.getByKey(n.conditionKey).getState()?.condition??null:n.condition??null}async function g(o,n){return n.length===0||!l(n)?n:(await Promise.all(n.map(async t=>{const r=await a(o,t);if(!(r?await s(o,r):!0))return null;if(!t.options||!u(t))return t;const e=(await Promise.all(t.options.map(async i=>i.condition?await s(o,i.condition)?i:null:i))).filter(i=>i!==null);return e.length===t.options.length?t:e.length===0?null:{...t,options:e}}))).filter(t=>t!==null)}export{g as getStepFields};
|