@stackflow/react
Advanced tools
Comparing version 0.15.1 to 0.15.2-alpha.7
@@ -1,2 +0,2 @@ | ||
"use strict";var Mt=Object.create;var b=Object.defineProperty,Nt=Object.defineProperties,Ut=Object.getOwnPropertyDescriptor,Ft=Object.getOwnPropertyDescriptors,Ht=Object.getOwnPropertyNames,Y=Object.getOwnPropertySymbols,Vt=Object.getPrototypeOf,tt=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable;var Z=(t,o,e)=>o in t?b(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,f=(t,o)=>{for(var e in o||(o={}))tt.call(o,e)&&Z(t,e,o[e]);if(Y)for(var e of Y(o))qt.call(o,e)&&Z(t,e,o[e]);return t},k=(t,o)=>Nt(t,Ft(o));var Kt=(t,o)=>{for(var e in o)b(t,e,{get:o[e],enumerable:!0})},et=(t,o,e,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of Ht(o))!tt.call(t,p)&&p!==e&&b(t,p,{get:()=>o[p],enumerable:!(a=Ut(o,p))||a.enumerable});return t};var d=(t,o,e)=>(e=t!=null?Mt(Vt(t)):{},et(o||!t||!t.__esModule?b(e,"default",{value:t,enumerable:!0}):e,t)),_t=t=>et(b({},"__esModule",{value:!0}),t);var te={};Kt(te,{stackflow:()=>Zt,useActions:()=>N,useActivity:()=>Gt,useActivityParams:()=>Lt,useInitContext:()=>M,useStack:()=>Wt});module.exports=_t(te);var rt=require("react");var ot=require("react"),R=(0,ot.createContext)(null);var Gt=()=>(0,rt.useContext)(R);var it=require("react");function Lt(){return(0,it.useContext)(R).params}var at=d(require("react"));var nt=require("react"),F=(0,nt.createContext)({});function M(){return at.default.useContext(F)}var st=require("react");var ct=require("react"),H=(0,ct.createContext)(null);var Wt=()=>(0,st.useContext)(H);var C=d(require("react"));var pt=require("react"),V=(0,pt.createContext)(null);var g=require("@stackflow/core"),v=d(require("react")),Ct=d(require("react-fast-compare"));var ft=d(require("react"));var q=require("react"),mt=d(require("react-fast-compare"));function K(t){let o=(0,q.useRef)(t),e=o.current,a=(0,mt.default)(e,t);return(0,q.useEffect)(()=>{a||(o.current=t)}),a?e:t}var ut=({children:t,value:o})=>ft.default.createElement(R.Provider,{value:K(o)},t);var lt=require("@stackflow/core");function T(){return(0,lt.id)()}var vt=d(require("react"));var dt=({children:t,value:o})=>vt.default.createElement(F.Provider,{value:o},t);var Pt=require("react"),_=(0,Pt.createContext)(null);var yt=d(require("react"));var xt=({children:t,value:o})=>yt.default.createElement(_.Provider,{value:o},t);var kt=require("react");function A(){return(0,kt.useContext)(_)}var At=require("react"),G=(0,At.createContext)(null);var jt=1e3,$t=jt/60,St=({transitionDuration:t,initialActivity:o,activities:e,children:a})=>{let p=A(),s=M(),r=(0,v.useMemo)(()=>{let x=new Date().getTime()-t,l=o?(0,g.makeEvent)("Pushed",{activityId:T(),activityName:o({initContext:s}),activityParams:{},eventDate:x,skipEnterActiveState:!1}):null,P=p.reduce((U,j)=>{var Q,X;return(X=(Q=j.overrideInitialPushedEvent)==null?void 0:Q.call(j,{pushedEvent:U}))!=null?X:U},l);!!P&&!!l&&P.id!==l.id&&console.warn(`Stackflow - Some plugin overrides an "initialActivity" option. The "initialActivity" option you set to "${l.activityName}" in the "stackflow" is ignored.`);let S=P;S||console.warn("Stackflow - There is no initial activity. If you want to set the initial activity, add the `initialActivity` option of the `stackflow()` function or add a plugin that sets the initial activity. (e.g. `@stackflow/plugin-history-sync`)");let bt=Object.keys(e).map(U=>(0,g.makeEvent)("ActivityRegistered",{activityName:U,eventDate:x})),z=[(0,g.makeEvent)("Initialized",{transitionDuration:t,eventDate:x}),...bt];return S&&z.push(S),z},[]),n=(0,v.useMemo)(()=>(0,g.aggregate)(r,new Date().getTime()),[]),[i,c]=(0,v.useState)(()=>n),m=(0,v.useRef)(r),u=(0,v.useRef)(n),y=(0,v.useCallback)(()=>u.current,[u]),h=(0,v.useCallback)((x,l)=>{let P=[...m.current,(0,g.makeEvent)(x,l)],B=new Date().getTime(),S=(0,g.aggregate)(P,B);c(S),m.current=P,u.current=S},[m,c]);return(0,v.useEffect)(()=>{let x=setInterval(()=>{let l=m.current,P=(0,g.aggregate)(l,new Date().getTime());(0,Ct.default)(i,P)||(c(P),u.current=P),P.globalTransitionState==="idle"&&clearInterval(x)},$t);return()=>{clearInterval(x)}},[m,i,c]),v.default.createElement(G.Provider,{value:i},v.default.createElement(V.Provider,{value:(0,v.useMemo)(()=>({getStack:y,dispatchEvent:h}),[y,h])},a))};var E=d(require("react"));var gt=t=>JSON.parse(JSON.stringify(t)),D=()=>{let t=A(),o=M(),{dispatchEvent:e,getStack:a}=E.default.useContext(V),p=(0,E.useCallback)(c=>{let{isPrevented:m,params:u}=i("PUSHED",c);m||e("Pushed",f({},u))},[e]),s=(0,E.useCallback)(c=>{let{isPrevented:m,params:u}=i("REPLACED",c);m||e("Replaced",f({},u))},[e]),r=(0,E.useCallback)(c=>{let m=c!=null?c:{},{isPrevented:u,params:y}=i("POPPED",m);u||e("Popped",f({},y))},[e]),n=(0,E.useMemo)(()=>({dispatchEvent:e,getStack:a,push:p,replace:s,pop:r}),[e,a,p,s,r]),i=(0,E.useCallback)((c,m)=>{let u=!1,y=gt(m),h=()=>{u=!0},x=l=>{y=gt(l)};return t.forEach(l=>{var P,B,S;switch(c){case"PUSHED":(P=l.onBeforePush)==null||P.call(l,{actionParams:y,actions:k(f({},n),{preventDefault:h,overrideActionParams:x})});break;case"REPLACED":(B=l.onBeforeReplace)==null||B.call(l,{actionParams:y,actions:k(f({},n),{preventDefault:h,overrideActionParams:x})});break;case"POPPED":(S=l.onBeforePop)==null||S.call(l,{actionParams:y,actions:k(f({},n),{preventDefault:h,overrideActionParams:x})});break;default:break}}),{isPrevented:u,params:y}},[t,o]);return n};var Et=d(require("react"));var I=()=>Et.default.useContext(G);var wt=require("@stackflow/core"),w=require("react");var Jt=()=>{let t=A(),o=I(),e=D(),a=(0,w.useCallback)(r=>{t.forEach(n=>{var i;(i=n.onInit)==null||i.call(n,r)})},[]),p=(0,w.useCallback)(({actions:r,effect:n})=>{switch(n._TAG){case"PUSHED":{t.forEach(i=>{var c;return(c=i.onPushed)==null?void 0:c.call(i,{actions:r,effect:n})});break}case"POPPED":{t.forEach(i=>{var c;return(c=i.onPopped)==null?void 0:c.call(i,{actions:r,effect:n})});break}case"REPLACED":{t.forEach(i=>{var c;return(c=i.onReplaced)==null?void 0:c.call(i,{actions:r,effect:n})});break}case"%SOMETHING_CHANGED%":{t.forEach(i=>{var c;return(c=i.onChanged)==null?void 0:c.call(i,{actions:r,effect:n})});break}default:break}},[]);(0,w.useEffect)(()=>{a==null||a({actions:e})},[]);let s=(0,w.useRef)(o);return(0,w.useEffect)(()=>{let r=s.current;(r?(0,wt.produceEffects)(r,o):[]).forEach(i=>{p({actions:e,effect:i})}),s.current=f({},o)},[o]),null},ht=Jt;var O=d(require("react"));var L=d(require("react"));var Rt=d(require("react"));var Tt=({children:t,value:o})=>Rt.default.createElement(H.Provider,{value:K(o)},t);var zt=({activities:t,plugin:o})=>{let e=I(),a=A();return o.render({stack:k(f({},e),{render(p){let s=f(f({},e),p);return{activities:s.activities.map(r=>k(f({},r),{key:r.id,render(n){let i=t[r.name],c=L.default.createElement(i,{params:r.params});return a.forEach(m=>{var u,y;c=(y=(u=m.wrapActivity)==null?void 0:u.call(m,{activity:k(f({},r),{render:()=>c})}))!=null?y:c}),L.default.createElement(Tt,{value:s},L.default.createElement(ut,{key:r.id,value:f(f({},r),n)},c))}}))}}})})},Dt=zt;var Qt=({activities:t})=>{let o=I(),e=A(),a=e.filter(s=>!!s.render);(0,O.useEffect)(()=>{a.length===0&&console.warn(`Stackflow - There is no rendering plugin, so "<Stack />" doesn't render anything. If you want to render some UI, use "@stackflow/plugin-renderer-basic" or add another rendering plugin.`)},[a]);let p=O.default.createElement(O.default.Fragment,null,a.map(s=>O.default.createElement(Dt,{activities:t,key:s.key,plugin:s})));return e.forEach(s=>{var r,n;p=(n=(r=s.wrapStack)==null?void 0:r.call(s,{stack:k(f({},o),{render(){return p}})}))!=null?n:p}),p},It=Qt;var J=d(require("react"));var W=d(require("react"));function $(t){return t?t.animate===void 0||t.animate==null?{skipActiveState:!1}:{skipActiveState:!t.animate}:{skipActiveState:!1}}var Ot,Xt=(Ot=W.default.useTransition)!=null?Ot:()=>[!1,t=>t()];function N(){let t=D(),[o,e]=Xt();return(0,W.useMemo)(()=>({pending:o,push(a,p,s){let r=T();return e(()=>{t.push({activityId:r,activityName:a,activityParams:p,skipEnterActiveState:$(s).skipActiveState})}),{activityId:r}},replace(a,p,s){let r=T();return e(()=>{var n;t.replace({activityId:(n=s==null?void 0:s.activityId)!=null?n:T(),activityName:a,activityParams:p,skipEnterActiveState:$(s).skipActiveState})}),{activityId:r}},pop(a){e(()=>{t.pop({skipExitActiveState:$(a).skipActiveState})})}}),[t.push,t.replace,t.pop,o,e])}var Yt=J.default.forwardRef((t,o)=>{let{dispatchEvent:e,getStack:a}=D(),{push:p,pop:s,replace:r}=N();return J.default.useImperativeHandle(o,()=>({actions:{dispatchEvent:e,getStack:a,push:p,pop:s,replace:r}})),null}),Bt=Yt;function Zt(t){let o=Object.entries(t.activities).reduce((r,[n,i])=>k(f({},r),{[n]:C.default.memo(i)}),{});typeof window!="undefined"&&window.document.documentElement.style.setProperty("--stackflow-transition-duration",`${t.transitionDuration}ms`);let e={current:null},a=r=>`\`<Stack />\` component has not been mounted. Make sure you include \`<Stack />\` within your React tree. Or, make sure you call \`${r}()\` after it is rendered.`;return{Stack:r=>{var i;let n=(0,C.useMemo)(()=>{var c;return((c=t.plugins)!=null?c:[]).reduce((m,u)=>[...m,...Array.isArray(u)?u:[u]],[]).map(m=>m({initContext:r.initContext}))},[]);return C.default.createElement(dt,{value:(i=r.initContext)!=null?i:{}},C.default.createElement(xt,{value:n},C.default.createElement(St,{activities:o,initialActivity:t.initialActivity,transitionDuration:t.transitionDuration},C.default.createElement(It,{activities:o}),C.default.createElement(ht,null),C.default.createElement(Bt,{ref:e}))))},useFlow:N,actions:{dispatchEvent(r,n){if(!e.current)throw new Error(a("dispatchEvent"));return e.current.actions.dispatchEvent(r,n)},getStack(){if(!e.current)throw new Error(a("getStack"));return e.current.actions.getStack()},push(r,n,i){if(!e.current)throw new Error(a("push"));return e.current.actions.push(r,n,i)},pop(r){if(!e.current)throw new Error(a("pop"));return e.current.actions.pop(r)},replace(r,n,i){if(!e.current)throw new Error(a("replace"));return e.current.actions.replace(r,n,i)}}}} | ||
"use strict";var bt=Object.create;var b=Object.defineProperty,Mt=Object.defineProperties,Nt=Object.getOwnPropertyDescriptor,Ut=Object.getOwnPropertyDescriptors,Ft=Object.getOwnPropertyNames,Y=Object.getOwnPropertySymbols,Ht=Object.getPrototypeOf,tt=Object.prototype.hasOwnProperty,Vt=Object.prototype.propertyIsEnumerable;var Z=(t,o,e)=>o in t?b(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,m=(t,o)=>{for(var e in o||(o={}))tt.call(o,e)&&Z(t,e,o[e]);if(Y)for(var e of Y(o))Vt.call(o,e)&&Z(t,e,o[e]);return t},k=(t,o)=>Mt(t,Ut(o));var qt=(t,o)=>{for(var e in o)b(t,e,{get:o[e],enumerable:!0})},et=(t,o,e,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of Ft(o))!tt.call(t,p)&&p!==e&&b(t,p,{get:()=>o[p],enumerable:!(a=Nt(o,p))||a.enumerable});return t};var d=(t,o,e)=>(e=t!=null?bt(Ht(t)):{},et(o||!t||!t.__esModule?b(e,"default",{value:t,enumerable:!0}):e,t)),Kt=t=>et(b({},"__esModule",{value:!0}),t);var Zt={};qt(Zt,{stackflow:()=>Yt,useActions:()=>N,useActivity:()=>_t,useActivityParams:()=>Gt,useInitContext:()=>M,useStack:()=>Lt});module.exports=Kt(Zt);var rt=require("react");var ot=require("react"),R=(0,ot.createContext)(null);var _t=()=>(0,rt.useContext)(R);var it=require("react");function Gt(){return(0,it.useContext)(R).params}var at=d(require("react"));var nt=require("react"),F=(0,nt.createContext)({});function M(){return at.default.useContext(F)}var st=require("react");var ct=require("react"),H=(0,ct.createContext)(null);var Lt=()=>(0,st.useContext)(H);var C=d(require("react"));var pt=require("react"),V=(0,pt.createContext)(null);var g=require("@stackflow/core"),v=d(require("react")),Ct=d(require("react-fast-compare"));var ft=d(require("react"));var q=require("react"),mt=d(require("react-fast-compare"));function K(t){let o=(0,q.useRef)(t),e=o.current,a=(0,mt.default)(e,t);return(0,q.useEffect)(()=>{a||(o.current=t)}),a?e:t}var ut=({children:t,value:o})=>ft.default.createElement(R.Provider,{value:K(o)},t);var lt=require("@stackflow/core");function T(){return(0,lt.id)()}var vt=d(require("react"));var dt=({children:t,value:o})=>vt.default.createElement(F.Provider,{value:o},t);var Pt=require("react"),_=(0,Pt.createContext)(null);var yt=d(require("react"));var xt=({children:t,value:o})=>yt.default.createElement(_.Provider,{value:o},t);var kt=require("react");function A(){return(0,kt.useContext)(_)}var At=require("react"),G=(0,At.createContext)(null);var Wt=1e3,jt=Wt/60,St=({transitionDuration:t,initialActivity:o,activities:e,children:a})=>{let p=A(),s=M(),r=(0,v.useMemo)(()=>{let x=new Date().getTime()-t,l=o?(0,g.makeEvent)("Pushed",{activityId:T(),activityName:o({initContext:s}),activityParams:{},eventDate:x,skipEnterActiveState:!1}):null,y=p.reduce((U,j)=>{var Q,X;return(X=(Q=j.overrideInitialPushedEvent)==null?void 0:Q.call(j,{pushedEvent:U}))!=null?X:U},l);!!y&&!!l&&y.id!==l.id&&console.warn(`Stackflow - Some plugin overrides an "initialActivity" option. The "initialActivity" option you set to "${l.activityName}" in the "stackflow" is ignored.`);let S=y;S||console.warn("Stackflow - There is no initial activity. If you want to set the initial activity, add the `initialActivity` option of the `stackflow()` function or add a plugin that sets the initial activity. (e.g. `@stackflow/plugin-history-sync`)");let Bt=Object.keys(e).map(U=>(0,g.makeEvent)("ActivityRegistered",{activityName:U,eventDate:x})),J=[(0,g.makeEvent)("Initialized",{transitionDuration:t,eventDate:x}),...Bt];return S&&J.push(S),J},[]),n=(0,v.useMemo)(()=>(0,g.aggregate)(r,new Date().getTime()),[]),[i,c]=(0,v.useState)(()=>n),f=(0,v.useRef)(r),u=(0,v.useRef)(n),P=(0,v.useCallback)(()=>u.current,[u]),w=(0,v.useCallback)((x,l)=>{let y=[...f.current,(0,g.makeEvent)(x,l)],B=new Date().getTime(),S=(0,g.aggregate)(y,B);c(S),f.current=y,u.current=S},[f,c]);return(0,v.useEffect)(()=>{let x=setInterval(()=>{let l=f.current,y=(0,g.aggregate)(l,new Date().getTime());(0,Ct.default)(i,y)||(c(y),u.current=y),y.globalTransitionState==="idle"&&clearInterval(x)},jt);return()=>{clearInterval(x)}},[f,i,c]),v.default.createElement(G.Provider,{value:i},v.default.createElement(V.Provider,{value:(0,v.useMemo)(()=>({getStack:P,dispatchEvent:w}),[P,w])},a))};var E=d(require("react"));var D=()=>{let t=A(),o=M(),{dispatchEvent:e,getStack:a}=E.default.useContext(V),p=(0,E.useCallback)(c=>{let{isPrevented:f,params:u}=i("PUSHED",c);f||e("Pushed",m({},u))},[e]),s=(0,E.useCallback)(c=>{let{isPrevented:f,params:u}=i("REPLACED",c);f||e("Replaced",m({},u))},[e]),r=(0,E.useCallback)(c=>{let f=c!=null?c:{},{isPrevented:u,params:P}=i("POPPED",f);u||e("Popped",m({},P))},[e]),n=(0,E.useMemo)(()=>({dispatchEvent:e,getStack:a,push:p,replace:s,pop:r}),[e,a,p,s,r]),i=(0,E.useCallback)((c,f)=>{let u=!1,P=m({},f),w=()=>{u=!0},x=l=>{P=m(m({},P),l)};return t.forEach(l=>{var y,B,S;switch(c){case"PUSHED":(y=l.onBeforePush)==null||y.call(l,{actionParams:P,actions:k(m({},n),{preventDefault:w,overrideActionParams:x})});break;case"REPLACED":(B=l.onBeforeReplace)==null||B.call(l,{actionParams:P,actions:k(m({},n),{preventDefault:w,overrideActionParams:x})});break;case"POPPED":(S=l.onBeforePop)==null||S.call(l,{actionParams:P,actions:k(m({},n),{preventDefault:w,overrideActionParams:x})});break;default:break}}),{isPrevented:u,params:P}},[t,o]);return n};var gt=d(require("react"));var I=()=>gt.default.useContext(G);var Et=require("@stackflow/core"),h=require("react");var $t=()=>{let t=A(),o=I(),e=D(),a=(0,h.useCallback)(r=>{t.forEach(n=>{var i;(i=n.onInit)==null||i.call(n,r)})},[]),p=(0,h.useCallback)(({actions:r,effect:n})=>{switch(n._TAG){case"PUSHED":{t.forEach(i=>{var c;return(c=i.onPushed)==null?void 0:c.call(i,{actions:r,effect:n})});break}case"POPPED":{t.forEach(i=>{var c;return(c=i.onPopped)==null?void 0:c.call(i,{actions:r,effect:n})});break}case"REPLACED":{t.forEach(i=>{var c;return(c=i.onReplaced)==null?void 0:c.call(i,{actions:r,effect:n})});break}case"%SOMETHING_CHANGED%":{t.forEach(i=>{var c;return(c=i.onChanged)==null?void 0:c.call(i,{actions:r,effect:n})});break}default:break}},[]);(0,h.useEffect)(()=>{a==null||a({actions:e})},[]);let s=(0,h.useRef)(o);return(0,h.useEffect)(()=>{let r=s.current;(r?(0,Et.produceEffects)(r,o):[]).forEach(i=>{p({actions:e,effect:i})}),s.current=m({},o)},[o]),null},ht=$t;var O=d(require("react"));var L=d(require("react"));var wt=d(require("react"));var Rt=({children:t,value:o})=>wt.default.createElement(H.Provider,{value:K(o)},t);var zt=({activities:t,plugin:o})=>{let e=I(),a=A();return o.render({stack:k(m({},e),{render(p){let s=m(m({},e),p);return{activities:s.activities.map(r=>k(m({},r),{key:r.id,render(n){let i=t[r.name],c=L.default.createElement(i,{params:r.params});return a.forEach(f=>{var u,P;c=(P=(u=f.wrapActivity)==null?void 0:u.call(f,{activity:k(m({},r),{render:()=>c})}))!=null?P:c}),L.default.createElement(Rt,{value:s},L.default.createElement(ut,{key:r.id,value:m(m({},r),n)},c))}}))}}})})},Tt=zt;var Jt=({activities:t})=>{let o=I(),e=A(),a=e.filter(s=>!!s.render);(0,O.useEffect)(()=>{a.length===0&&console.warn(`Stackflow - There is no rendering plugin, so "<Stack />" doesn't render anything. If you want to render some UI, use "@stackflow/plugin-renderer-basic" or add another rendering plugin.`)},[a]);let p=O.default.createElement(O.default.Fragment,null,a.map(s=>O.default.createElement(Tt,{activities:t,key:s.key,plugin:s})));return e.forEach(s=>{var r,n;p=(n=(r=s.wrapStack)==null?void 0:r.call(s,{stack:k(m({},o),{render(){return p}})}))!=null?n:p}),p},Dt=Jt;var z=d(require("react"));var W=d(require("react"));function $(t){return t?t.animate===void 0||t.animate==null?{skipActiveState:!1}:{skipActiveState:!t.animate}:{skipActiveState:!1}}var It,Qt=(It=W.default.useTransition)!=null?It:()=>[!1,t=>t()];function N(){let t=D(),[o,e]=Qt();return(0,W.useMemo)(()=>({pending:o,push(a,p,s){let r=T();return e(()=>{t.push({activityId:r,activityName:a,activityParams:p,skipEnterActiveState:$(s).skipActiveState})}),{activityId:r}},replace(a,p,s){let r=T();return e(()=>{var n;t.replace({activityId:(n=s==null?void 0:s.activityId)!=null?n:T(),activityName:a,activityParams:p,skipEnterActiveState:$(s).skipActiveState})}),{activityId:r}},pop(a){e(()=>{t.pop({skipExitActiveState:$(a).skipActiveState})})}}),[t.push,t.replace,t.pop,o,e])}var Xt=z.default.forwardRef((t,o)=>{let{dispatchEvent:e,getStack:a}=D(),{push:p,pop:s,replace:r}=N();return z.default.useImperativeHandle(o,()=>({actions:{dispatchEvent:e,getStack:a,push:p,pop:s,replace:r}})),null}),Ot=Xt;function Yt(t){let o=Object.entries(t.activities).reduce((r,[n,i])=>k(m({},r),{[n]:C.default.memo(i)}),{});typeof window!="undefined"&&window.document.documentElement.style.setProperty("--stackflow-transition-duration",`${t.transitionDuration}ms`);let e={current:null},a=r=>`\`<Stack />\` component has not been mounted. Make sure you include \`<Stack />\` within your React tree. Or, make sure you call \`${r}()\` after it is rendered.`;return{Stack:r=>{var i;let n=(0,C.useMemo)(()=>{var c;return((c=t.plugins)!=null?c:[]).reduce((f,u)=>[...f,...Array.isArray(u)?u:[u]],[]).map(f=>f({initContext:r.initContext}))},[]);return C.default.createElement(dt,{value:(i=r.initContext)!=null?i:{}},C.default.createElement(xt,{value:n},C.default.createElement(St,{activities:o,initialActivity:t.initialActivity,transitionDuration:t.transitionDuration},C.default.createElement(Dt,{activities:o}),C.default.createElement(ht,null),C.default.createElement(Ot,{ref:e}))))},useFlow:N,actions:{dispatchEvent(r,n){if(!e.current)throw new Error(a("dispatchEvent"));return e.current.actions.dispatchEvent(r,n)},getStack(){if(!e.current)throw new Error(a("getStack"));return e.current.actions.getStack()},push(r,n,i){if(!e.current)throw new Error(a("push"));return e.current.actions.push(r,n,i)},pop(r){if(!e.current)throw new Error(a("pop"));return e.current.actions.pop(r)},replace(r,n,i){if(!e.current)throw new Error(a("replace"));return e.current.actions.replace(r,n,i)}}}} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@stackflow/react", | ||
"version": "0.15.1", | ||
"version": "0.15.2-alpha.7+f879af5e", | ||
"license": "MIT", | ||
@@ -52,3 +52,3 @@ "exports": { | ||
}, | ||
"gitHead": "4f43068146a37120517919462fe4bbcd2c7aa3f8" | ||
"gitHead": "f879af5e2d48fc8437480af7d87d106bb0ab2b12" | ||
} |
@@ -14,4 +14,2 @@ import type { Effect } from "@stackflow/core"; | ||
const copy = (obj: unknown) => JSON.parse(JSON.stringify(obj)); | ||
export const useCoreActions = () => { | ||
@@ -86,5 +84,7 @@ const plugins = usePlugins(); | ||
const triggerPreEffectHook = useCallback( | ||
(preEffect: Effect["_TAG"], initialActionParams: unknown) => { | ||
(preEffect: Effect["_TAG"], initialActionParams: any) => { | ||
let isPrevented = false; | ||
let actionParams = copy(initialActionParams); | ||
let actionParams = { | ||
...initialActionParams, | ||
}; | ||
@@ -94,4 +94,7 @@ const preventDefault = () => { | ||
}; | ||
const overrideActionParams = (newActionParams: unknown) => { | ||
actionParams = copy(newActionParams); | ||
const overrideActionParams = (newActionParams: any) => { | ||
actionParams = { | ||
...actionParams, | ||
...newActionParams, | ||
}; | ||
}; | ||
@@ -98,0 +101,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1315
150362
1