@picked/react 0.0.64-next.5 → 0.0.64-next.7

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.
@@ -13,6 +13,14 @@ export interface StepContext {
13
13
  * `layoutContentId` or the referenced content has not been registered yet.
14
14
  */
15
15
  layoutContentStore: Store<Content | null>;
16
+ /**
17
+ * Reactive store of the current step's CMS content `data`, or `null` when the step has
18
+ * no `layoutContentId` or the referenced content is not yet registered. Derived from
19
+ * `layoutContentStore`; subscribe with `useStoreGlobal(content)`. This is the value
20
+ * `useStepContent()` yields, exposed here so a step can read everything it needs from a
21
+ * single `useStep()` call.
22
+ */
23
+ content: Store<Record<string, unknown> | null>;
16
24
  isActive: boolean;
17
25
  /** @deprecated Use `isActive` instead. */
18
26
  isActiveStep: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/hooks/step.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC7D,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAIjE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC,CAAA;IAC3B,kFAAkF;IAClF,MAAM,EAAE,KAAK,CAAC,cAAc,EAAE,CAAC,CAAA;IAC/B;;;;;OAKG;IACH,kBAAkB,EAAE,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IACzC,QAAQ,EAAE,OAAO,CAAA;IACjB,0CAA0C;IAC1C,YAAY,EAAE,OAAO,CAAA;IACrB,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAA;CAC3B;AAED,eAAO,MAAM,mBAAmB,6CAA0C,CAAA;AAE1E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,wBAAgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAM/D"}
@@ -1 +1 @@
1
- import{useExperience as e,usePicked as t}from"./client.js";import{useStoreGlobal as n}from"./use-store-global.js";import{useForm as r}from"../form/index.js";import{useStepRouter as i}from"../router/context.js";import{createContext as a,useContext as o,useMemo as s}from"react";import{combine as c}from"effector";var l=a(null);function u(){let e=o(l);if(!e)throw Error(`useStep must be used within a StepContextProvider`);return e}function d(n){let a=e(),o=t(),{activeStep:l}=i(),u=s(()=>l?.key===n,[l?.key,n]),d=s(()=>a.treeStore.map(e=>e.steps.find(e=>e.key===n)??{id:n,key:n,name:``,fieldKeys:[]},{skipVoid:!1}),[a,n]),{form:f,fields:p}=r(n,s(()=>d.map(e=>e.name,{skipVoid:!1}),[d]),s(()=>d.map(e=>e.fieldKeys,{skipVoid:!1}),[d]));return{step:d,fields:p,layoutContentStore:s(()=>c(d,o.contents.indexStore,(e,t)=>e.layoutContentId?t[e.layoutContentId]??null:null,{skipVoid:!1}),[d,o]),isActive:u,isActiveStep:u,form:f}}function f(){let n=e(),r=t();return s(()=>c(n.treeStore,r.contents.indexStore,(e,t)=>{let n=e.steps.find(e=>e.layoutContentId);return n?.layoutContentId?t[n.layoutContentId]??null:null}),[n,r])}function p(){let e=o(l),t=f();return n(e?.layoutContentStore??t)?.data??null}export{l as StepContextProvider,d as useSetStepContext,u as useStep,p as useStepContent};
1
+ import{useExperience as e,usePicked as t}from"./client.js";import{useStoreGlobal as n}from"./use-store-global.js";import{useForm as r}from"../form/index.js";import{useStepRouter as i}from"../router/context.js";import{createContext as a,useContext as o,useMemo as s}from"react";import{combine as c}from"effector";var l=a(null);function u(){let e=o(l);if(!e)throw Error(`useStep must be used within a StepContextProvider`);return e}function d(n){let a=e(),o=t(),{activeStep:l}=i(),u=s(()=>l?.key===n,[l?.key,n]),d=s(()=>a.treeStore.map(e=>e.steps.find(e=>e.key===n)??{id:n,key:n,name:``,fieldKeys:[]},{skipVoid:!1}),[a,n]),{form:f,fields:p}=r(n,s(()=>d.map(e=>e.name,{skipVoid:!1}),[d]),s(()=>d.map(e=>e.fieldKeys,{skipVoid:!1}),[d])),m=s(()=>c(d,o.contents.indexStore,(e,t)=>e.layoutContentId?t[e.layoutContentId]??null:null,{skipVoid:!1}),[d,o]);return{step:d,fields:p,layoutContentStore:m,content:s(()=>m.map(e=>e?.data??null,{skipVoid:!1}),[m]),isActive:u,isActiveStep:u,form:f}}function f(){let n=e(),r=t();return s(()=>c(n.treeStore,r.contents.indexStore,(e,t)=>{let n=e.steps.find(e=>e.layoutContentId);return n?.layoutContentId?t[n.layoutContentId]??null:null}),[n,r])}function p(){let e=o(l),t=f();return n(e?.layoutContentStore??t)?.data??null}export{l as StepContextProvider,d as useSetStepContext,u as useStep,p as useStepContent};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picked/react",
3
- "version": "0.0.64-next.5",
3
+ "version": "0.0.64-next.7",
4
4
  "devDependencies": {
5
5
  "@picked/client": "workspace:*",
6
6
  "@repo/eslint-config": "workspace:*",
@@ -85,7 +85,7 @@
85
85
  },
86
86
  "module": "./dist/index.js",
87
87
  "peerDependencies": {
88
- "@picked/client": "0.0.64-next.5",
88
+ "@picked/client": "0.0.64-next.7",
89
89
  "effector": "^23.3.0",
90
90
  "react": "19.2.2",
91
91
  "react-dom": "19.2.2"