@picked/react 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/component.js +1 -1
- package/dist/context.js +1 -1
- package/dist/form/index.d.ts +23 -11
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +1 -1
- package/dist/hooks/client.d.ts +8 -8
- package/dist/hooks/client.d.ts.map +1 -1
- package/dist/hooks/client.js +1 -1
- package/dist/hooks/field.d.ts +1 -1
- package/dist/hooks/field.d.ts.map +1 -1
- package/dist/hooks/field.js +1 -1
- package/dist/hooks/index.d.ts +1 -6
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/step.d.ts +2 -17
- package/dist/hooks/step.d.ts.map +1 -1
- package/dist/hooks/step.js +1 -1
- package/dist/hooks/storage.js +1 -1
- package/dist/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.js +1 -1
- package/dist/router/StepRouter.js +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/package.json +8 -25
package/dist/component.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e=(e,t)=>({frameworkName:`react`,component:e,style:t}),t=e=>e.frameworkName===`react`;export{e as adaptReactComponent,t as isValidAdaptedComponent};
|
package/dist/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext as e}from"react";
|
|
1
|
+
import{createContext as e}from"react";var t=e(null),n=t.Provider,r=e(null),i=r.Provider;export{t as ClientContext,n as ClientProvider,r as ExperienceContext,i as ExperienceProvider};
|
package/dist/form/index.d.ts
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
interface
|
|
3
|
-
|
|
1
|
+
import { FormInstance as CoreFormInstance, ErrorCallback, SubmitCallback, SuccessCallback } from '@picked/client/form';
|
|
2
|
+
interface UseFormOptions {
|
|
3
|
+
formId: string;
|
|
4
4
|
title: string;
|
|
5
|
-
|
|
6
|
-
onError?: (errors: ValidationError[]) => void | Promise<void>;
|
|
5
|
+
fieldIds: string[];
|
|
7
6
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
/**
|
|
8
|
+
* React FormInstance — identical to core but callback registration returns void
|
|
9
|
+
* (cleanup is handled automatically via useEffect, not by the consumer).
|
|
10
|
+
*/
|
|
11
|
+
interface FormInstance<TFieldIds extends string = string> extends Omit<CoreFormInstance<TFieldIds>, 'form'> {
|
|
12
|
+
form: Omit<CoreFormInstance<TFieldIds>['form'], 'onSubmit' | 'onSuccess' | 'onError'> & {
|
|
13
|
+
onSubmit: (callback: SubmitCallback<TFieldIds>) => void;
|
|
14
|
+
onSuccess: (callback: SuccessCallback<TFieldIds>) => void;
|
|
15
|
+
onError: (callback: ErrorCallback) => void;
|
|
13
16
|
};
|
|
14
|
-
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* React hook wrapping the framework-agnostic createForm from @picked/client/form.
|
|
20
|
+
*
|
|
21
|
+
* - Injects client and experienceInstance from React context
|
|
22
|
+
* - Collects unsubscribe functions from callback registration and cleans them
|
|
23
|
+
* up on unmount via a single useEffect
|
|
24
|
+
* - Consumer DX: `form.onSuccess(cb)` — no hooks or lifecycle awareness needed
|
|
25
|
+
*/
|
|
26
|
+
export declare function useForm({ formId, title, fieldIds }: UseFormOptions): FormInstance;
|
|
15
27
|
export {};
|
|
16
28
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/form/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,YAAY,IAAI,gBAAgB,EACrC,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAA;AAG5B,UAAU,cAAc;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED;;;GAGG;AACH,UAAU,YAAY,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,CACtD,SAAQ,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IACjD,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC,GAAG;QACtF,QAAQ,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC,SAAS,CAAC,KAAK,IAAI,CAAA;QACvD,SAAS,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,SAAS,CAAC,KAAK,IAAI,CAAA;QACzD,OAAO,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAA;KAC3C,CAAA;CACF;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,cAAc,GAAG,YAAY,CAyCjF"}
|
package/dist/form/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{useExperience as e,usePicked as t}from"../hooks/client.js";import"../hooks/index.js";import{useEffect as n,useMemo as r,useRef as i}from"react";import{createStore as a}from"effector";import{createForm as o}from"@picked/client/form";function s({formId:s,title:c,fieldIds:l}){let u=t(),d=e(),f=r(()=>a(c),[c]),p=r(()=>a(l),[l]),m=r(()=>o({client:u,experienceInstance:d},s,f,p),[u,d,s,f,p]),h=i([]);return n(()=>()=>{h.current.forEach(e=>e()),h.current=[]},[]),{form:r(()=>({...m.form,onSubmit:e=>{h.current.push(m.form.onSubmit(e))},onSuccess:e=>{h.current.push(m.form.onSuccess(e))},onError:e=>{h.current.push(m.form.onError(e))}}),[m]),fields:m.fields}}export{s as useForm};
|
package/dist/hooks/client.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ExperienceInstance, Picked } from '@picked/client';
|
|
2
2
|
/**
|
|
3
|
-
* Retrieves the Picked Client for the Experience Instance
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
6
|
-
* const client = usePicked()
|
|
3
|
+
* Retrieves the Picked Client for the Experience Instance
|
|
4
|
+
*
|
|
5
|
+
* @returns The Picked client instance that provides access to experiences, steps, and other Picked functionality
|
|
7
6
|
*/
|
|
8
7
|
export declare function usePicked(): Picked;
|
|
9
8
|
/**
|
|
10
|
-
* Retrieves the Experience Store for the current Experience Instance
|
|
11
|
-
*
|
|
12
|
-
* @
|
|
13
|
-
* const experience = useExperience()
|
|
9
|
+
* Retrieves the Experience Store for the current Experience Instance
|
|
10
|
+
*
|
|
11
|
+
* @returns The Experience store instance that provides access to experience configuration and state
|
|
14
12
|
*/
|
|
15
13
|
export declare function useExperience(): ExperienceInstance;
|
|
14
|
+
export declare const getPicked: typeof usePicked;
|
|
15
|
+
export declare const getExperience: typeof useExperience;
|
|
16
16
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/hooks/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/hooks/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGhE;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAOlC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,kBAAkB,CAOlD;AAGD,eAAO,MAAM,SAAS,kBAAY,CAAA;AAClC,eAAO,MAAM,aAAa,sBAAgB,CAAA"}
|
package/dist/hooks/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ClientContext as e,ExperienceContext as t}from"../context.js";import{useContext as n}from"react";function r(){let t=n(e);if(!t)throw Error(`usePicked must be used within a ClientProvider`);return t}function i(){let e=n(t);if(!e)throw Error(`useExperience must be used within an ExperienceProvider`);return e}var a=r,o=i;export{o as getExperience,a as getPicked,i as useExperience,r as usePicked};
|
package/dist/hooks/field.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/hooks/field.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/hooks/field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAGrC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,CAAA;IACxB,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAA;CAC3B;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,CAQrD"}
|
package/dist/hooks/field.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
* @file Public re-exports for the hooks entry point.
|
|
3
|
-
*/
|
|
4
|
-
export { usePicked, useExperience } from './client';
|
|
1
|
+
export { usePicked, useExperience, getPicked, getExperience } from './client';
|
|
5
2
|
export { useStep, useSetStepContext } from './step';
|
|
6
|
-
export type { StepContext } from './step';
|
|
7
3
|
export { useSessionStorage, useLocalStorage } from './storage';
|
|
8
|
-
export type { UseStorageOptions } from './storage';
|
|
9
4
|
export * from './field';
|
|
10
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7E,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC9D,cAAc,SAAS,CAAA"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getExperience as e,getPicked as t,useExperience as n,usePicked as r}from"./client.js";import{useSetStepContext as i,useStep as a}from"./step.js";import{useLocalStorage as o,useSessionStorage as s}from"./storage.js";import{getField as c}from"./field.js";export{e as getExperience,c as getField,t as getPicked,n as useExperience,o as useLocalStorage,r as usePicked,s as useSessionStorage,i as useSetStepContext,a as useStep};
|
package/dist/hooks/step.d.ts
CHANGED
|
@@ -2,36 +2,21 @@ import { Field, Response } from '@picked/client';
|
|
|
2
2
|
type FieldWithValue = Field & {
|
|
3
3
|
value: Response | undefined;
|
|
4
4
|
};
|
|
5
|
-
|
|
5
|
+
type StepWithLabel = {
|
|
6
6
|
id: string;
|
|
7
7
|
label: string;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
export interface StepContext {
|
|
10
10
|
step: StepWithLabel;
|
|
11
11
|
fields: FieldWithValue[];
|
|
12
12
|
isActiveStep?: boolean;
|
|
13
13
|
}
|
|
14
14
|
export declare const StepContextProvider: import('react').Context<StepContext | null>;
|
|
15
|
-
/**
|
|
16
|
-
* Returns the current step context, including step metadata and evaluated fields.
|
|
17
|
-
* Must be used within a component wrapped by `StepContextProvider`.
|
|
18
|
-
* @returns The step, its evaluated fields, and whether this is the active step.
|
|
19
|
-
* @example
|
|
20
|
-
* const { step, fields, isActiveStep } = useStep()
|
|
21
|
-
*/
|
|
22
15
|
export declare function useStep(): {
|
|
23
16
|
step: StepWithLabel;
|
|
24
17
|
fields: FieldWithValue[];
|
|
25
18
|
isActiveStep: boolean;
|
|
26
19
|
};
|
|
27
|
-
/**
|
|
28
|
-
* Creates and returns step context stores for the given step ID.
|
|
29
|
-
* Evaluates field conditions reactively whenever fields or responses change.
|
|
30
|
-
* @param stepId - The ID of the step to set context for.
|
|
31
|
-
* @returns The step metadata, evaluated fields, and active step indicator.
|
|
32
|
-
* @example
|
|
33
|
-
* const { step, fields, isActiveStep } = useSetStepContext('step-123')
|
|
34
|
-
*/
|
|
35
20
|
export declare function useSetStepContext(stepId: string): {
|
|
36
21
|
step: StepWithLabel;
|
|
37
22
|
fields: FieldWithValue[];
|
package/dist/hooks/step.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/hooks/step.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/hooks/step.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAoC,MAAM,gBAAgB,CAAA;AAMvF,KAAK,cAAc,GAAG,KAAK,GAAG;IAAE,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAE,CAAA;AAC7D,KAAK,aAAa,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAOlD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,aAAa,CAAA;IACnB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,eAAO,MAAM,mBAAmB,6CAA0C,CAAA;AAE1E,wBAAgB,OAAO;;;;EAWtB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM;;;;EA+F/C"}
|
package/dist/hooks/step.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{useExperience as e,usePicked as t}from"./client.js";import{useStepRouter as n}from"../router/context.js";import{createContext as r,useContext as i,useMemo as a}from"react";import{attach as o,combine as s,createEffect as c,createStore as l,sample as u}from"effector";import{evaluateRuleLogic as d}from"@picked/client";import{useUnit as f}from"effector-react";var p=r(null);function m(){let e=i(p);if(!e)throw Error(`useStep must be used within a StepContextProvider`);return{step:e.step,fields:e.fields,isActiveStep:e.isActiveStep??!1}}function h(r){let i=e(),p=t(),{activeStep:m}=n(),h=a(()=>m?.id===r,[m?.id,r]),{stepContext:g}=a(()=>{let e=o({source:s({steps:i.treeStore.map(e=>e.steps),fields:p.fields.listStore,responses:p.responses.listStore}),effect:c(async({steps:e,fields:t,responses:n})=>{let i=e.find(e=>e.id===r);if(!i)throw Error(`Step with id "${r}" not found in the experience tree.`);let a=t.filter(e=>i.fieldIds.includes(e.id)),o=[];for(let e of a)e.condition?await d(p,e.condition)&&o.push(e):o.push(e);let s=o.map(e=>{let t=n.find(t=>t.fieldId===e.id)?.value;return{...e,value:t}});return{step:{id:i.id,label:i.label},fields:s}})}),t=l({step:{id:r,label:``},fields:[]});return t.on(e.doneData,(e,t)=>t),u({clock:[p.fields.listStore,p.responses.listStore],target:e}),e(),{stepContextFx:e,stepContext:t}},[r,p,i]),_=f(g);return{step:_?.step,fields:_?.fields||[],isActiveStep:h}}export{p as StepContextProvider,h as useSetStepContext,m as useStep};
|
package/dist/hooks/storage.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{useExperience as e}from"./client.js";import{useCallback as t,useEffect as n,useState as r}from"react";import{createStorageKey as i,localStore as a,sessionStore as o,supportsLocalStorage as s,supportsSessionStorage as c}from"@picked/client";var l={fallback:null,scope:`global`};function u(u,d,f){let{fallback:p,scope:m}={...l,...f},h=e(),g=u===`session`?o:a,_=u===`session`?c:s,[v,y]=r(p??null),b=i(d,m,h);return n(()=>{if(_()){let e=g.get(b).text();e!==null&&y(e)}},[g,b,_]),n(()=>{if(!_())return;let e=g.subscribe(b,e=>{y(e.text())});return()=>{e()}},[g,b,_]),[v,t(e=>{y(e),_()&&(e?g.set(b,e):g.remove(b))},[g,b,_])]}function d(e,t){return u(`session`,e,t)}function f(e,t){return u(`local`,e,t)}export{f as useLocalStorage,d as useSessionStorage};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{adaptReactComponent as
|
|
1
|
+
import{adaptReactComponent as e,isValidAdaptedComponent as t}from"./component.js";export{e as adaptReactComponent,t as isValidAdaptedComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{reactFrameworkPlugin as
|
|
1
|
+
import{reactFrameworkPlugin as e}from"./plugin.js";export{e as reactFrameworkPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{adaptReactComponent as
|
|
1
|
+
import{adaptReactComponent as e}from"../../component.js";import{renderReactComponent as t}from"../../render/browser.js";var n=n=>({name:`react-framework`,setup:r=>{r.registerFramework({name:`react`,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 reactFrameworkPlugin};
|
package/dist/render/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{isValidAdaptedComponent as e}from"../component.js";import{ClientProvider as t,ExperienceProvider as n}from"../context.js";import{mergeArrays as r}from"../utils/array.js";import i from"react";import{isLazyLoader as a}from"@picked/client";import{createRoot as o}from"react-dom/client";var s=new WeakMap,c=async(c,l,u,d,f)=>{if(!e(l))throw Error(`The component is invalid.`);let p=r(l.style?.sheets,f.stylesheets),m=r(l.style?.css,f.css);p.length&&p.forEach(e=>{let t=document.createElement(`link`);t.setAttribute(`rel`,`stylesheet`),t.setAttribute(`href`,e),t.setAttribute(`type`,`text/css`),t.setAttribute(`picked-injected`,`true`),c.appendChild(t)}),m.length&&m.forEach(e=>{let t=document.createElement(`style`);t.textContent=e,t.setAttribute(`type`,`text/css`),t.setAttribute(`picked-injected`,`true`),c.appendChild(t)});let h=document.createElement(`div`);c.appendChild(h);let g=o(h);s.set(c,g);let _;_=a(l.component)?(await l.component.load()).default:l.component instanceof Promise?(await l.component).default:l.component,g.render(i.createElement(t,{value:u},i.createElement(n,{value:d},i.createElement(_,{client:u,experience:d}))))},l=e=>{let t=s.get(e);t&&(t.unmount(),s.delete(e))};export{c as renderReactComponent,l as unRenderReactComponent};
|
package/dist/render/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{isValidAdaptedComponent as e}from"../component.js";import{ClientProvider as t,ExperienceProvider as n}from"../context.js";import{mergeArrays as r}from"../utils/array.js";import i from"react";import{isLazyLoader as a}from"@picked/client";import{renderToString as o}from"react-dom/server";var s=async(s,c,l,u)=>{if(!e(s))throw Error(`The component is invalid.`);let d=r(s.style?.sheets,u.stylesheets),f=r(s.style?.css,u.css),p;return p=a(s.component)?(await s.component.load()).default:s.component instanceof Promise?(await s.component).default:s.component,{stylesheets:d,css:f,body:o(i.createElement(t,{value:c},i.createElement(n,{value:l},i.createElement(p,{client:c,experience:l})))),head:``}};export{s as staticRenderReactComponent};
|
package/dist/router/Step.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{useStepRouter as e}from"./context.js";import{StepContextProvider as t,useSetStepContext as n}from"../hooks/step.js";import{useEffect as r,useState as i}from"react";import{jsx as a}from"react/jsx-runtime";var o=({id:o,component:s,children:c})=>{let l={id:o},{registerStep:u,unregisterStep:d}=e(),[f,p]=i(null),m=n(o);return r(()=>(u(l),()=>d(l)),[u,d,l]),r(()=>{s&&typeof s!=`function`?Promise.resolve(s).then(e=>{typeof e==`object`&&`default`in e?p(()=>e.default):p(()=>e)}):typeof s==`function`&&p(()=>s)},[s]),s?f?a(t.Provider,{value:m,children:a(f,{})}):null:a(t.Provider,{value:m,children:c})};export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{useExperience as e}from"../hooks/client.js";import{StepRouterProvider as t}from"./context.js";import"../hooks/index.js";import{useCallback as n,useEffect as r,useRef as i,useState as a}from"react";import{supportsWindow as o}from"@picked/client";import{useUnit as s}from"effector-react";import{jsx as c}from"react/jsx-runtime";var l=({children:l})=>{let{currentStepStore:u}=e(),d=s(u),[f,p]=a(null),m=i(!1),[h,g]=a([]),_=n(e=>{if(o())g(t=>[...t,e]);else{if(m.current)return;e.id===d?.id&&(p(e),m.current=!0)}},[d?.id]),v=n(e=>{g(t=>t.filter(t=>t!==e))},[]);r(()=>{p(h.find(e=>e.id===d?.id)||null)},[h,d?.id]);let y={activeStep:f,registerStep:_,unregisterStep:v};return d?.id?c(t,{value:y,children:l}):null};export{l as default};
|
package/dist/router/context.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext as
|
|
1
|
+
import{createContext as e,useContext as t}from"react";var n=e(null),r=n.Provider,i=()=>{let e=t(n);if(!e)throw Error(`useStepRouter must be used within a StepRouterProvider`);return e};export{r as StepRouterProvider,i as useStepRouter};
|
package/dist/router/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{StepRouterProvider as e,useStepRouter as t}from"./context.js";import n from"./StepRouter.js";import r from"./Step.js";export{r as Step,n as StepRouter,e as StepRouterProvider,t as useStepRouter};
|
package/dist/server/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isValidAdaptedComponent as
|
|
1
|
+
import{isValidAdaptedComponent as e}from"../component.js";import{staticRenderReactComponent 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/react",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.1774224866171",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@picked/client": "workspace:*",
|
|
6
6
|
"@repo/eslint-config": "workspace:*",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"@types/node": "^22",
|
|
11
11
|
"@types/react": "19.2.4",
|
|
12
12
|
"@types/react-dom": "19.2.3",
|
|
13
|
-
"@vitejs/plugin-react": "^
|
|
14
|
-
"@vitest/coverage-v8": "^4.0
|
|
13
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
14
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
15
15
|
"effector": "^23.3.0",
|
|
16
16
|
"effector-react": "^23.3.0",
|
|
17
17
|
"fast-glob": "^3.3.3",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"size-limit": "^12.0.0",
|
|
20
20
|
"typedoc": "^0.28.5",
|
|
21
21
|
"typedoc-plugin-markdown": "^4.6.3",
|
|
22
|
-
"vite": "^
|
|
22
|
+
"vite": "^8.0.1",
|
|
23
23
|
"vite-plugin-dts": "^4.5.4",
|
|
24
|
-
"vitest": "^4.0
|
|
24
|
+
"vitest": "^4.1.0"
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
@@ -59,33 +59,16 @@
|
|
|
59
59
|
"dist"
|
|
60
60
|
],
|
|
61
61
|
"knip": {
|
|
62
|
-
"entry": [
|
|
63
|
-
"src/index.ts",
|
|
64
|
-
"src/server/index.ts",
|
|
65
|
-
"src/router/index.ts",
|
|
66
|
-
"src/form/index.ts",
|
|
67
|
-
"src/hooks/index.ts",
|
|
68
|
-
"src/plugins/framework/index.ts"
|
|
69
|
-
],
|
|
70
|
-
"ignore": [
|
|
71
|
-
"eslint.config.js"
|
|
72
|
-
],
|
|
73
62
|
"ignoreBinaries": [
|
|
74
|
-
"attw",
|
|
75
63
|
"knip",
|
|
76
64
|
"jscpd",
|
|
77
65
|
"eslint",
|
|
78
|
-
"
|
|
79
|
-
],
|
|
80
|
-
"ignoreDependencies": [
|
|
81
|
-
"@picked/client",
|
|
82
|
-
"@repo/eslint-config",
|
|
83
|
-
"@repo/typescript-config"
|
|
66
|
+
"tsgo"
|
|
84
67
|
]
|
|
85
68
|
},
|
|
86
69
|
"module": "./dist/index.js",
|
|
87
70
|
"peerDependencies": {
|
|
88
|
-
"@picked/client": "0.0.1-dev.
|
|
71
|
+
"@picked/client": "0.0.1-dev.1774224866171",
|
|
89
72
|
"effector": "^23.3.0",
|
|
90
73
|
"effector-react": "^23.3.0",
|
|
91
74
|
"react": "19.2.2",
|
|
@@ -108,7 +91,7 @@
|
|
|
108
91
|
"test:coverage": "vitest run --coverage",
|
|
109
92
|
"test:packaged-types": "attw --pack",
|
|
110
93
|
"test:watch": "vitest",
|
|
111
|
-
"type-check": "
|
|
94
|
+
"type-check": "tsgo -p . --noEmit"
|
|
112
95
|
},
|
|
113
96
|
"size-limit": [
|
|
114
97
|
{
|