@picked/react 0.0.1-dev.1780617185476 → 0.0.1-dev.1783393641770
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/experience/ExperienceSlot.d.ts.map +1 -1
- package/dist/experience/ExperienceSlot.js +1 -1
- package/dist/hooks/step.d.ts +8 -0
- package/dist/hooks/step.d.ts.map +1 -1
- package/dist/hooks/step.js +1 -1
- package/dist/utils/map-field-to-react.js +1 -1
- package/dist/utils/restore-current-target.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExperienceSlot.d.ts","sourceRoot":"","sources":["../../src/experience/ExperienceSlot.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"ExperienceSlot.d.ts","sourceRoot":"","sources":["../../src/experience/ExperienceSlot.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAA6B,MAAM,OAAO,CAAA;AAQjD,UAAU,mBAAmB;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAyFD;;;;;;;;;;;;;;;GAeG;AACH,iBAAS,cAAc,CAAC,EAAE,IAAI,EAAE,EAAE,mBAAmB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA4DxE;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{usePicked as e}from"../hooks/client.js";import{useStoreGlobal as t}from"../hooks/use-store-global.js";import"../hooks/index.js";import n from"./ExperienceHost.js";import{useEffect as r}from"react";import{supportsWindow as
|
|
1
|
+
import{usePicked as e}from"../hooks/client.js";import{useStoreGlobal as t}from"../hooks/use-store-global.js";import"../hooks/index.js";import n from"./ExperienceHost.js";import{useEffect as r,useMemo as i}from"react";import{supportsWindow as a}from"@picked/client";import{evaluateConditionMemo as o,hashRule as s,ruleReferencesActionDeep as c}from"@picked/client/server";import{Fragment as l,jsx as u}from"react/jsx-runtime";var d=[`replace`,`before`,`prepend`,`append`,`after`];function f(e){let t=d.indexOf(e);return t===-1?d.length:t}function p(e,t,n){let r=e.configStore.getState(),i=r.targetSelectors.find(e=>e.selector===t);return!i||c(r.decisionLogic,n)?null:{experience:e,placement:i.placement,condition:r.decisionLogic,hash:s(r.decisionLogic)}}function m(){let{href:e,pathname:t,search:n,hostname:r,origin:i,protocol:a,port:o,host:s,hash:c}=globalThis.location;return{href:e,pathname:t,search:n,hostname:r,origin:i,protocol:a,port:o,host:s,hash:c}}function h({name:s}){let c=e(),d=`.picked-slot-${s}`,h=t(c.experiences.listStore);t(c.conditionResults.store);let g=t(c.conditions.listStore),_=i(()=>{let e={};for(let t of g)e[t.key]=t;return e},[g]),v=h.map(e=>p(e,d,_)).filter(e=>e!==null).sort((e,t)=>f(e.placement)-f(t.placement)),y=v.filter(e=>c.conditionResults.peek(e.hash)===!0),b=y.find(e=>e.placement===`replace`),x=b?[b]:y;return r(()=>{if(a())for(let e of v)c.conditionResults.peek(e.hash)===void 0&&o(c,e.condition,{context:{location:m()}})}),u(l,{children:x.map(e=>u(n,{experience:e.experience,client:c},e.experience.id))})}export{h as default};
|
package/dist/hooks/step.d.ts
CHANGED
|
@@ -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;
|
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":"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;;;;;GAKG;AACH,wBAAgB,OAAO,IAAI,WAAW,CAOrC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,
|
|
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;;;;;;OAMG;IACH,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAA;IAC9C,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;;;;;GAKG;AACH,wBAAgB,OAAO,IAAI,WAAW,CAOrC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAmE9D;AAgCD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAM/D"}
|
package/dist/hooks/step.js
CHANGED
|
@@ -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]))
|
|
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{restoreCurrentTarget as e}from"./restore-current-target.js";function t(t){return n=>{e(n.nativeEvent,n.currentTarget),t(n.nativeEvent)}}function n(t,n){return r=>{e(r.nativeEvent,r.currentTarget),t.multiple&&r.currentTarget instanceof HTMLInputElement&&r.currentTarget.type===`checkbox`&&Object.defineProperty(r.nativeEvent
|
|
1
|
+
import{restoreCurrentTarget as e}from"./restore-current-target.js";function t(t){return n=>{e(n.nativeEvent,n.currentTarget),t(n.nativeEvent)}}function n(t,n){return r=>{e(r.nativeEvent,r.currentTarget),t.multiple&&r.currentTarget instanceof HTMLInputElement&&r.currentTarget.type===`checkbox`&&Object.defineProperty(r.nativeEvent,"type",{value:`change`,configurable:!0}),n(r.nativeEvent)}}function r(e){let{oninput:r,onchange:i,onblur:a,...o}=e.props;return{...e,props:{...o,onInput:t(r),onChange:n(e,i),onBlur:t(a)}}}export{r as mapFieldToReact};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){Object.defineProperty(e
|
|
1
|
+
function e(e,t){Object.defineProperty(e,"currentTarget",{value:t,configurable:!0,writable:!0})}export{e as restoreCurrentTarget};
|
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.1783393641770",
|
|
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.1-dev.
|
|
88
|
+
"@picked/client": "0.0.1-dev.1783393641770",
|
|
89
89
|
"effector": "^23.3.0",
|
|
90
90
|
"react": "19.2.2",
|
|
91
91
|
"react-dom": "19.2.2"
|