@picked/svelte 0.0.1-dev.1788925875333 → 0.0.1-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.
- package/dist/component.d.ts +5 -5
- package/dist/component.js +1 -1
- package/dist/context.js +1 -1
- package/dist/form/index.d.ts +15 -3
- package/dist/form/index.js +1 -1
- package/dist/hooks/client.d.ts +1 -1
- package/dist/hooks/client.js +1 -1
- package/dist/hooks/field.d.ts +5 -16
- package/dist/hooks/field.js +1 -1
- package/dist/hooks/index.d.ts +1 -9
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/step.d.ts +15 -93
- package/dist/hooks/step.js +1 -1
- package/dist/hooks/storage.d.ts +2 -2
- package/dist/hooks/storage.js +1 -1
- package/dist/hooks/stores.d.ts +1 -1
- package/dist/hooks/stores.js +1 -1
- package/dist/index.d.ts +1 -8
- package/dist/index.js +1 -1
- package/dist/plugins/devtools/DevToolsExperience.svelte +53 -355
- package/dist/plugins/devtools/PickedLogo.svelte +58 -0
- package/dist/plugins/devtools/components/ExperienceInstanceListItem.svelte +4 -17
- package/dist/plugins/devtools/components/ExperienceInstancesTable.svelte +19 -26
- package/dist/plugins/devtools/components/Tabs.svelte +12 -69
- package/dist/plugins/devtools/experience.d.ts +1 -0
- package/dist/plugins/devtools/experience.js +1 -0
- package/dist/plugins/devtools/index.d.ts +0 -2
- package/dist/plugins/devtools/index.js +1 -1
- package/dist/plugins/devtools/plugin.d.ts +5 -37
- package/dist/plugins/devtools/plugin.js +1 -1
- package/dist/plugins/devtools/screens/components/ComponentsListScreen.svelte +14 -18
- package/dist/plugins/devtools/screens/experience-instances/ExperienceInstancesListScreen.svelte +3 -1
- package/dist/plugins/devtools/screens/experiences/ExperienceDetailsScreen.svelte +33 -31
- package/dist/plugins/devtools/screens/experiences/ExperienceExperienceInstancesListScreen.svelte +3 -1
- package/dist/plugins/devtools/screens/experiences/ExperienceTreeScreen.svelte +103 -293
- package/dist/plugins/devtools/screens/experiences/ExperiencesListScreen.svelte +1 -2
- package/dist/plugins/devtools/screens/frameworks/FrameworksListScreen.svelte +13 -15
- package/dist/plugins/devtools/screens/history/HistoryEntriesTable.svelte +16 -22
- package/dist/plugins/devtools/screens/history/HistoryEntryListItem.svelte +1 -7
- package/dist/plugins/devtools/screens/predicates/PredicatesListScreen.svelte +13 -15
- package/dist/plugins/devtools/screens/project/ProjectScreen.svelte +1 -46
- package/dist/plugins/framework/index.js +1 -1
- package/dist/plugins/framework/plugin.d.ts +4 -4
- package/dist/plugins/framework/plugin.js +1 -1
- package/dist/render/browser.d.ts +2 -35
- package/dist/render/browser.js +1 -1
- package/dist/render/server.d.ts +8 -22
- package/dist/render/server.js +1 -1
- package/dist/router/Step.svelte +4 -6
- package/dist/router/StepRouter.svelte +33 -14
- package/dist/router/context.d.ts +3 -3
- package/dist/router/context.js +1 -1
- package/dist/router/index.js +1 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +1 -1
- package/dist/utils/array.js +1 -1
- package/dist/vite-env.d.js +1 -0
- package/package.json +33 -106
- package/dist/.tsbuildinfo +0 -1
- package/dist/_virtual/_vite/preload-helper.js +0 -1
- package/dist/components/LazyImage.svelte +0 -192
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +0 -1
- package/dist/experience/ExperienceHost.svelte +0 -112
- package/dist/experience/ExperienceSlot.svelte +0 -154
- package/dist/experience/HtmlRender.svelte +0 -52
- package/dist/experience/set-picked-context.d.ts +0 -29
- package/dist/experience/set-picked-context.js +0 -1
- package/dist/form/__tests__/CreateFormHarness.svelte +0 -30
- package/dist/form/create-form.js +0 -1
- package/dist/form/create-form.svelte.d.ts +0 -40
- package/dist/form/create-form.svelte.js +0 -1
- package/dist/form/get-form.d.ts +0 -30
- package/dist/form/get-form.js +0 -1
- package/dist/hooks/action.d.ts +0 -40
- package/dist/hooks/action.js +0 -1
- package/dist/hooks/content.d.ts +0 -18
- package/dist/hooks/content.js +0 -1
- package/dist/hooks/create-query/index.d.ts +0 -145
- package/dist/hooks/create-query/index.js +0 -1
- package/dist/hooks/events.d.ts +0 -2
- package/dist/hooks/events.js +0 -1
- package/dist/hooks/feature.d.ts +0 -47
- package/dist/hooks/feature.js +0 -1
- package/dist/hooks/predicate.d.ts +0 -3
- package/dist/hooks/predicate.js +0 -1
- package/dist/hooks/reference.d.ts +0 -61
- package/dist/hooks/reference.js +0 -1
- package/dist/plugins/devtools/PickedIcon.svelte +0 -19
- package/dist/plugins/devtools/components/AdaptedToolHost.svelte +0 -103
- package/dist/plugins/devtools/customTools.d.ts +0 -27
- package/dist/plugins/devtools/customTools.js +0 -1
- package/dist/plugins/devtools/screens/config/ConfigScreen.svelte +0 -160
- package/dist/plugins/devtools/screens/content/ContentListScreen.svelte +0 -89
- package/dist/plugins/devtools/screens/custom-tools/CustomToolsScreen.svelte +0 -29
- package/dist/plugins/devtools/screens/events/EventListItem.svelte +0 -216
- package/dist/plugins/devtools/screens/events/EventsListScreen.svelte +0 -18
- package/dist/plugins/devtools/screens/events/EventsTable.svelte +0 -76
- package/dist/plugins/devtools/screens/features/FeaturesListScreen.svelte +0 -239
- package/dist/plugins/devtools/screens/fields/FieldTableRow.svelte +0 -276
- package/dist/plugins/devtools/screens/fields/FieldsListScreen.svelte +0 -12
- package/dist/plugins/devtools/screens/fields/FieldsTable.svelte +0 -78
- package/dist/plugins/devtools/screens/identity/IdentityScreen.svelte +0 -66
- package/dist/plugins/devtools/screens/responses/ResponseTableRow.svelte +0 -280
- package/dist/plugins/devtools/screens/responses/ResponsesListScreen.svelte +0 -12
- package/dist/plugins/devtools/screens/responses/ResponsesTable.svelte +0 -88
- package/dist/plugins/devtools/ui/actions/Button.svelte +0 -175
- package/dist/plugins/devtools/ui/actions/CopyButton.svelte +0 -88
- package/dist/plugins/devtools/ui/data/Badge.svelte +0 -62
- package/dist/plugins/devtools/ui/data/CodeBlock.svelte +0 -38
- package/dist/plugins/devtools/ui/data/DataTable.svelte +0 -144
- package/dist/plugins/devtools/ui/data/EmptyState.svelte +0 -26
- package/dist/plugins/devtools/ui/data/ExpandableRow.svelte +0 -66
- package/dist/plugins/devtools/ui/data/VisualizationContainer.svelte +0 -55
- package/dist/plugins/devtools/ui/feedback/Banner.svelte +0 -116
- package/dist/plugins/devtools/ui/feedback/Spinner.svelte +0 -79
- package/dist/plugins/devtools/ui/forms/Checkbox.svelte +0 -139
- package/dist/plugins/devtools/ui/forms/RadioGroup.svelte +0 -218
- package/dist/plugins/devtools/ui/forms/Select.svelte +0 -137
- package/dist/plugins/devtools/ui/forms/Switch.svelte +0 -158
- package/dist/plugins/devtools/ui/forms/TextField.svelte +0 -125
- package/dist/plugins/devtools/ui/index.d.ts +0 -22
- package/dist/plugins/devtools/ui/index.js +0 -1
- package/dist/plugins/devtools/ui/layout/Card.svelte +0 -55
- package/dist/plugins/devtools/ui/layout/Divider.svelte +0 -34
- package/dist/plugins/devtools/ui/layout/Spacer.svelte +0 -11
- package/dist/plugins/devtools/ui/layout/Stack.svelte +0 -129
- package/dist/plugins/devtools/ui/overlays/Tooltip.svelte +0 -90
- package/dist/plugins/devtools/ui/tokens.css +0 -144
- package/dist/plugins/devtools/ui/typography/Heading.svelte +0 -55
- package/dist/plugins/devtools/ui/typography/Text.svelte +0 -93
- package/dist/utils/ErrorBoundary.svelte +0 -27
package/dist/component.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { AdaptedComponent, AdaptedComponentStyle } from '@picked/client';
|
|
2
|
+
import { Component } from 'svelte';
|
|
3
3
|
export type ComponentWithProps = Component<any>;
|
|
4
4
|
export declare const adaptSvelteComponent: (component: ComponentWithProps | Promise<{
|
|
5
5
|
default: ComponentWithProps;
|
|
6
|
-
}
|
|
6
|
+
}>, style?: AdaptedComponentStyle) => AdaptedComponent<"svelte", ComponentWithProps | Promise<{
|
|
7
7
|
default: ComponentWithProps;
|
|
8
|
-
}
|
|
9
|
-
export declare const isValidAdaptedComponent: (component: AdaptedComponent<string, unknown>) => component is AdaptedComponent<
|
|
8
|
+
}>>;
|
|
9
|
+
export declare const isValidAdaptedComponent: (component: AdaptedComponent<string, unknown>) => component is AdaptedComponent<"svelte", ComponentWithProps>;
|
package/dist/component.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const o=(e,t)=>({frameworkName:"svelte",component:e,style:t}),r=e=>e.frameworkName==="svelte";export{o as adaptSvelteComponent,r as isValidAdaptedComponent};
|
package/dist/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const E=Symbol("picked-client"),e=Symbol("picked-experience-instance"),c=Symbol("picked-scope"),o=Symbol("picked-step");export{E as CLIENT_CONTEXT_KEY,e as EXPERIENCE_CONTEXT_KEY,c as SCOPE_CONTEXT_KEY,o as STEP_CONTEXT_KEY};
|
package/dist/form/index.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
+
export declare function getForm(options: GetFormOptions): {
|
|
9
|
+
form: {
|
|
10
|
+
onsubmit: (event: SubmitEvent & {
|
|
11
|
+
currentTarget: EventTarget & HTMLFormElement;
|
|
12
|
+
}) => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export {};
|
package/dist/form/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getPicked as v,getExperience as y}from"../hooks/client.js";import"svelte";import"effector";import"svelte/store";import"@picked/client";function B(a){const s=v();y();const{id:n,title:o}=a;async function d(c){var f,m;c.preventDefault(),s.eventBus({type:"form_submit",form:{id:n,title:o}});const p=new FormData(c.currentTarget),i={data:{},push(t){const r=t.questionId,e=this.data[r];e?Array.isArray(e)&&Array.isArray(t.value)?Array.isArray(e)&&Array.isArray(t.value)&&(typeof e[0]=="string"?this.data[r]=[...e,...t.value].map(String):typeof e[0]=="number"?this.data[r]=[...e,...t.value].map(Number):typeof e[0]=="boolean"?this.data[r]=[...e,...t.value].map(u=>!!u):this.data[r]=t.value):this.data[r]=t.value:this.data[r]=t.value}};for(const[t,r]of p.entries()){const e=s.fields.getById(t).getState();if(!e)continue;const u=e.id;switch(e.type){case"text":i.push({questionId:u,value:e.multiple?[String(r)]:String(r)});break;case"number":i.push({questionId:u,value:e.multiple?[Number(r)]:Number(r)});break;case"boolean":i.push({questionId:u,value:e.multiple?[r==="true"]:r==="true"});break}}const{errors:l}=await s.responses.commit(i.data);if(l.length>0){s.eventBus({type:"form_submit_error",form:{id:n,title:o},exception:"Form validation error"}),l.forEach(t=>{s.eventBus({type:"field_validation_error",exception:t})}),await((f=a.onError)==null?void 0:f.call(a,l));return}s.eventBus({type:"form_submit_success",form:{id:n,title:o}}),await((m=a.onSuccess)==null?void 0:m.call(a))}return{form:{onsubmit:d}}}export{B as getForm};
|
package/dist/hooks/client.d.ts
CHANGED
package/dist/hooks/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CLIENT_CONTEXT_KEY as e,EXPERIENCE_CONTEXT_KEY as
|
|
1
|
+
import{getContext as t}from"svelte";import{CLIENT_CONTEXT_KEY as e,EXPERIENCE_CONTEXT_KEY as r}from"../context.js";function o(){return t(e)}function i(){return t(r)}export{i as getExperience,o as getPicked};
|
package/dist/hooks/field.d.ts
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: Store<FieldValueFor<K>>;
|
|
1
|
+
import { Field, FieldValue } from '@picked/client';
|
|
2
|
+
import { Store } from 'effector';
|
|
3
|
+
export interface GetFieldResponse {
|
|
4
|
+
value: Store<FieldValue>;
|
|
6
5
|
field: Store<Field | null>;
|
|
7
6
|
}
|
|
8
|
-
|
|
9
|
-
* Returns reactive stores for a field definition and its current response value.
|
|
10
|
-
*
|
|
11
|
-
* @template K
|
|
12
|
-
* @param {K} key - Field key from the workspace schema.
|
|
13
|
-
* @returns {GetFieldResponse<K>} Field metadata and value stores.
|
|
14
|
-
* @example
|
|
15
|
-
* const { value } = getField('email')
|
|
16
|
-
*/
|
|
17
|
-
export declare function getField<K extends FieldKeys>(key: K): GetFieldResponse<K>;
|
|
18
|
-
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 s}from"./client.js";function r(e){const t=s(),n=t.fields.getById(e),o=t.responses.getByFieldId(e);return{field:n,value:o}}export{r as getField};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
/** @file Public re-exports for Svelte hook utilities. */
|
|
2
1
|
export { getPicked, getExperience } from './client';
|
|
3
|
-
export {
|
|
4
|
-
export { getFeature, getFeatureResult, getFeatureEnabled } from './feature';
|
|
5
|
-
export { getAction, getActionResult } from './action';
|
|
6
|
-
export { getStep, setStepContext, getStepContent } from './step';
|
|
7
|
-
export { getContent } from './content';
|
|
8
|
-
export { getReference, getReferences } from './reference';
|
|
2
|
+
export { getStep, setStepContext } from './step';
|
|
9
3
|
export { useUnit, getContextScope, setContextScope } from './stores';
|
|
10
4
|
export { createSessionStorageStore, createLocalStorageStore } from './storage.js';
|
|
11
|
-
export { getTrackRecommendationPresentEvent } from './events';
|
|
12
|
-
export { createQuery, queryCache, queryPresets, type QueryResult, type QueryFactory, } from './create-query';
|
package/dist/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getExperience as
|
|
1
|
+
import{getExperience as o,getPicked as r}from"./client.js";import{getStep as S,setStepContext as x}from"./step.js";import{getContextScope as g,setContextScope as n,useUnit as a}from"./stores.js";import{createLocalStorageStore as f,createSessionStorageStore as i}from"./storage.js";export{f as createLocalStorageStore,i as createSessionStorageStore,g as getContextScope,o as getExperience,r as getPicked,S as getStep,n as setContextScope,x as setStepContext,a as useUnit};
|
package/dist/hooks/step.d.ts
CHANGED
|
@@ -1,94 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
export interface StepContext
|
|
5
|
-
step: Store<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* Reactive store of the current step's CMS content `data`, or `null` when the step
|
|
15
|
-
* has no `layoutContentId` or the referenced content is not yet registered. Derived
|
|
16
|
-
* from `layoutContentStore`; stays reactive to late content registration. This is the
|
|
17
|
-
* same value `getStepContent()` yields, exposed here so a step can read everything it
|
|
18
|
-
* needs from a single `getStep()` call.
|
|
19
|
-
*/
|
|
20
|
-
content: Store<StepLayoutContent | null>;
|
|
21
|
-
isActive: Store<boolean>;
|
|
22
|
-
/** @deprecated Use `isActive` instead. */
|
|
23
|
-
isActiveStep: Store<boolean>;
|
|
1
|
+
import { Store } from 'effector';
|
|
2
|
+
import { Readable } from 'svelte/store';
|
|
3
|
+
import { Field, Response } from '@picked/client';
|
|
4
|
+
export interface StepContext {
|
|
5
|
+
step: Store<{
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
}>;
|
|
9
|
+
fields: Store<{
|
|
10
|
+
field: Field | undefined;
|
|
11
|
+
value: Response | undefined;
|
|
12
|
+
}[]>;
|
|
13
|
+
isActiveStep?: Readable<boolean>;
|
|
24
14
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
* @param {StepKeys} stepKey - Step key from the workspace schema.
|
|
29
|
-
* @param {FormCallbackOptions} [options] - Submit callback slots for the step's form.
|
|
30
|
-
* @returns {StepContext} The created step context.
|
|
31
|
-
* @example setStepContext('step-1', { onSuccess: ({ data }) => track(data) })
|
|
32
|
-
*/
|
|
33
|
-
export declare function setStepContext(stepKey: StepKeys, options?: FormCallbackOptions): StepContext;
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves the step context from the Svelte context tree.
|
|
36
|
-
*
|
|
37
|
-
* Passing `options` registers those callbacks for the calling component's
|
|
38
|
-
* lifetime. It is sugar over `form.onSuccess(cb)` and friends, which already
|
|
39
|
-
* manage their own teardown via `$effect` — the value is symmetry with
|
|
40
|
-
* `useStep(options)` in `@picked/react`, where the options form is what makes
|
|
41
|
-
* render-body registration safe.
|
|
42
|
-
*
|
|
43
|
-
* Must be called during component initialisation, like any other rune-backed
|
|
44
|
-
* helper.
|
|
45
|
-
*
|
|
46
|
-
* @param {FormCallbackOptions} [options] - Submit callback slots for this component.
|
|
47
|
-
* @returns {StepContext} The current step context, loosely typed.
|
|
48
|
-
* @example const { form, fields } = getStep({ onSuccess: ({ data }) => track(data) })
|
|
49
|
-
* @design-parity Mirrors `useStep(options)` in `@picked/react`.
|
|
50
|
-
*/
|
|
51
|
-
export declare function getStep(options?: FormCallbackOptions): StepContext;
|
|
52
|
-
/**
|
|
53
|
-
* Retrieves the step context narrowed by an asserted step key.
|
|
54
|
-
*
|
|
55
|
-
* The `K` type argument is compile-time narrowing only. It asserts which step the caller
|
|
56
|
-
* renders, so `content` resolves to that step's content model and the `form`/field callbacks
|
|
57
|
-
* type against that step's field keys. Runtime data always comes from the current step
|
|
58
|
-
* context, exactly as the no-argument overload.
|
|
59
|
-
*
|
|
60
|
-
* @template K
|
|
61
|
-
* @param {FormCallbackOptions} [options] - Submit callback slots, typed to that step's field keys.
|
|
62
|
-
* @returns {StepContext} The current step context with `content` narrowed to `ContentForStep<K>`.
|
|
63
|
-
* @example
|
|
64
|
-
* ```svelte
|
|
65
|
-
* const { form, content } = getStep<'lead-capture-form'>()
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
export declare function getStep<K extends StepKeys>(options?: FormCallbackOptions<FieldKeysForStep<K>>): Omit<StepContext<FieldKeysForStep<K>>, 'content'> & {
|
|
69
|
-
content: Store<ContentForStep<K> | null>;
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Returns a Svelte/Effector store that yields the current step's resolved CMS content data.
|
|
73
|
-
*
|
|
74
|
-
* The optional `K` type argument is compile-time narrowing only. It asserts which step the
|
|
75
|
-
* caller renders; runtime data always comes from the current step context.
|
|
76
|
-
*
|
|
77
|
-
* @returns {Store<StepLayoutContent | null>} A store of the Content record's `data`.
|
|
78
|
-
* @example
|
|
79
|
-
* ```svelte
|
|
80
|
-
* const content = getStepContent()
|
|
81
|
-
* ```
|
|
82
|
-
*/
|
|
83
|
-
export declare function getStepContent(): Store<StepLayoutContent | null>;
|
|
84
|
-
/**
|
|
85
|
-
* Returns step content narrowed by an asserted step key.
|
|
86
|
-
*
|
|
87
|
-
* @template K
|
|
88
|
-
* @returns {Store<ContentForStep<K> | null>} Narrowed content data store.
|
|
89
|
-
* @example
|
|
90
|
-
* ```svelte
|
|
91
|
-
* const content = getStepContent<'main'>()
|
|
92
|
-
* ```
|
|
93
|
-
*/
|
|
94
|
-
export declare function getStepContent<K extends keyof StepContentModelsMap>(): Store<ContentForStep<K> | null>;
|
|
15
|
+
export declare function getStep(): StepContext;
|
|
16
|
+
export declare function setStepContext(stepId: string): StepContext;
|
package/dist/hooks/step.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getContext as g,setContext as C}from"svelte";import{combine as E}from"effector";import{derived as b}from"svelte/store";import{STEP_CONTEXT_KEY as f}from"../context.js";import{getStepRouter as h}from"../router/context.js";import{getExperience as w,getPicked as T}from"./client.js";function K(){return g(f)}function N(r){const l=w(),n=T(),{activeStep:s}=h(),m=s?b(s,e=>(e==null?void 0:e.id)===r):void 0,p=E({tree:l.treeStore,fields:n.fields.listStore,responses:n.responses.listStore},({tree:e,fields:c,responses:u})=>{const t=e.steps.find(o=>o.id===r);if(!t)throw new Error(`Step with id "${r}" not found in the experience tree.`);const x=t.fieldIds.map(o=>{var d;const a=c.find(i=>i.id===o),S=(d=u.find(i=>i.fieldId===o))==null?void 0:d.value;return{field:a,value:S}});return{step:{id:t.id,label:t.label},fields:x}});return C(f,{step:p.map(e=>e.step),fields:p.map(e=>e.fields),isActiveStep:m})}export{K as getStep,N as setStepContext};
|
package/dist/hooks/storage.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { Writable } from 'svelte/store';
|
|
2
|
+
import { StorageScope } from '@picked/client';
|
|
3
3
|
export interface UseStorageOptions {
|
|
4
4
|
fallback: string | undefined | null;
|
|
5
5
|
scope: StorageScope;
|
package/dist/hooks/storage.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{writable as b}from"svelte/store";import{supportsSessionStorage as m,supportsLocalStorage as d,createStorageKey as x,sessionStore as y,localStore as k}from"@picked/client";import{getExperience as K}from"./client.js";const L={fallback:null,scope:"global"};function a(e,t,i){const{fallback:l,scope:u}={...L,...i},s=e==="session"?y:k,p=e==="session"?m:d,o=b(l);if(p()){const S=K(),r=x(t,u,S),c=s.get(r).text();c!==null&&o.set(c),o.subscribe(n=>{n?s.set(r,n):s.remove(r)});const f=n=>{o.set(n.text())},g=s.subscribe(r,f);return{...o,destroy:()=>{g()}}}return{...o,destroy:()=>{}}}function I(e,t){return a("session",e,t)}function O(e,t){return a("local",e,t)}export{O as createLocalStorageStore,I as createSessionStorageStore};
|
package/dist/hooks/stores.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Effect, EventCallable, Handlers, LegacyMap, Scope, SerializedState, Store, StorePair } from 'effector';
|
|
2
2
|
/**
|
|
3
3
|
* Sets the scope to context for isolating effector stores
|
|
4
4
|
*/
|
package/dist/hooks/stores.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getContext as f,setContext as s}from"svelte";import{is as r,scopeBind as n,createWatch as p,fork as m}from"effector";import{SCOPE_CONTEXT_KEY as c}from"../context.js";const g=e=>{const t=m(e);return s(c,t)},C=()=>f(c);function u(e){const t=C();return t?r.effect(e)?n(e,{scope:t}):r.event(e)&&typeof e=="function"?n(e,{scope:t}):{subscribe:o=>(o(t.getState(e)),p({unit:e,fn:o,scope:t}))}:e}export{C as getContextScope,g as setContextScope,u as useUnit};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Public entry for the `@picked/svelte` package.
|
|
3
|
-
*/
|
|
4
1
|
export { adaptSvelteComponent, isValidAdaptedComponent } from './component';
|
|
5
|
-
export type
|
|
6
|
-
export { LazyImage } from './components';
|
|
7
|
-
export { setPickedContext } from './experience/set-picked-context';
|
|
8
|
-
export { default as ExperienceSlot } from './experience/ExperienceSlot.svelte';
|
|
9
|
-
export { default as HtmlRender } from './experience/HtmlRender.svelte';
|
|
2
|
+
export type * from './component';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{adaptSvelteComponent as
|
|
1
|
+
import{adaptSvelteComponent as t,isValidAdaptedComponent as p}from"./component.js";export{t as adaptSvelteComponent,p as isValidAdaptedComponent};
|