Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stackflow/react

Package Overview
Dependencies
Maintainers
1
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stackflow/react - npm Package Compare versions

Comparing version 0.16.1-alpha.21 to 0.16.1-alpha.22

2

dist/index.js

@@ -1,2 +0,2 @@

"use strict";var At=Object.create;var h=Object.defineProperty,Pt=Object.defineProperties,xt=Object.getOwnPropertyDescriptor,St=Object.getOwnPropertyDescriptors,kt=Object.getOwnPropertyNames,X=Object.getOwnPropertySymbols,gt=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable;var Y=(t,e,i)=>e in t?h(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,u=(t,e)=>{for(var i in e||(e={}))Z.call(e,i)&&Y(t,i,e[i]);if(X)for(var i of X(e))Ct.call(e,i)&&Y(t,i,e[i]);return t},v=(t,e)=>Pt(t,St(e));var Tt=(t,e)=>{for(var i in e)h(t,i,{get:e[i],enumerable:!0})},_=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of kt(e))!Z.call(t,s)&&s!==i&&h(t,s,{get:()=>e[s],enumerable:!(n=xt(e,s))||n.enumerable});return t};var m=(t,e,i)=>(i=t!=null?At(gt(t)):{},_(e||!t||!t.__esModule?h(i,"default",{value:t,enumerable:!0}):i,t)),ht=t=>_(h({},"__esModule",{value:!0}),t);var Nt={};Tt(Nt,{stackflow:()=>bt,useActions:()=>$,useActivity:()=>wt,useActivityParams:()=>Rt,useStack:()=>Et,useStepActions:()=>G});module.exports=ht(Nt);var it=require("react");var U=m(require("react"));var O=require("react"),tt=m(require("react-fast-compare"));function I(t){let e=(0,O.useRef)(t),i=e.current,n=(0,tt.default)(i,t);return(0,O.useEffect)(()=>{n||(e.current=t)}),n?i:t}var w=(0,U.createContext)(null),et=({children:t,value:e})=>U.default.createElement(w.Provider,{value:I(e)},t);var wt=()=>(0,it.useContext)(w);var ot=require("react");function Rt(){return(0,ot.useContext)(w).params}var nt=require("react");var B=m(require("react"));var q=(0,B.createContext)(null),rt=({children:t,value:e})=>B.default.createElement(q.Provider,{value:I(e)},t);var Et=()=>(0,nt.useContext)(q);var T=require("@stackflow/core"),l=m(require("react"));var at=require("@stackflow/core");function d(){return(0,at.id)()}var st=require("@stackflow/core");function g(){return(0,st.id)()}var P=m(require("react")),W=(0,P.createContext)(null),z=(0,P.createContext)(null),ct=({coreStore:t,children:e})=>{let i=(0,P.useSyncExternalStore)(t.subscribe,t.actions.getStack,t.actions.getStack);return P.default.createElement(z.Provider,{value:i},P.default.createElement(W.Provider,{value:t.actions},e))};var pt=m(require("react"));var b=()=>pt.default.useContext(W);var ut=m(require("react"));var N=()=>ut.default.useContext(z);var C=m(require("react"));var R=m(require("react"));var D=m(require("react")),V=(0,D.createContext)(null),mt=({children:t,value:e})=>D.default.createElement(V.Provider,{value:e},t);var lt=require("react");function F(){return(0,lt.useContext)(V)}var Ot=({activities:t,plugin:e})=>{let i=N(),n=F();return e.render({stack:v(u({},i),{render(s){let c=u(u({},i),s);return{activities:c.activities.map(o=>v(u({},o),{key:o.id,render(f){let E=t[o.name],x;if("component"in E){let{component:y}=E;x=R.default.createElement(y,{params:o.params})}else x=R.default.createElement(E,{params:o.params});return n.forEach(y=>{var r,a;x=(a=(r=y.wrapActivity)==null?void 0:r.call(y,{activity:v(u({},o),{render:()=>x})}))!=null?a:x}),R.default.createElement(rt,{value:c},R.default.createElement(et,{key:o.id,value:u(u({},o),f)},x))}}))}}})})},ft=Ot;var It=({activities:t})=>{let e=N(),i=F(),n=i.filter(c=>!!c.render);(0,C.useEffect)(()=>{n.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.`)},[n]);let s=C.default.createElement(C.default.Fragment,null,n.map(c=>C.default.createElement(ft,{key:c.key,activities:t,plugin:c})));return i.forEach(c=>{var o,f;s=(f=(o=c.wrapStack)==null?void 0:o.call(c,{stack:v(u({},e),{render(){return s}})}))!=null?f:s}),s},vt=It;var M=m(require("react"));function j(t){return t?t.animate===void 0||t.animate==null?{skipActiveState:!1}:{skipActiveState:!t.animate}:{skipActiveState:!1}}var dt,Ut=(dt=M.default.useTransition)!=null?dt:()=>[!1,t=>t()];function $(){let t=b(),[e,i]=Ut();return(0,M.useMemo)(()=>({pending:e,push(n,s,c){let o=d();return i(()=>{t.push({activityId:o,activityName:n,activityParams:s,skipEnterActiveState:j(c).skipActiveState})}),{activityId:o}},replace(n,s,c){let o=d();return i(()=>{var f;t.replace({activityId:(f=c==null?void 0:c.activityId)!=null?f:d(),activityName:n,activityParams:s,skipEnterActiveState:j(c).skipActiveState})}),{activityId:o}},pop(n){i(()=>{t.pop({skipExitActiveState:j(n).skipActiveState})})}}),[t.push,t.replace,t.pop,e,i])}var K=m(require("react"));var yt,Bt=(yt=K.default.useTransition)!=null?yt:()=>[!1,t=>t()],G=()=>{let t=b(),[e,i]=Bt();return(0,K.useMemo)(()=>({pending:e,stepPush(n){let s=g();i(()=>{t.stepPush({stepId:s,stepParams:n})})},stepReplace(n){let s=g();i(()=>{t.stepReplace({stepId:s,stepParams:n})})},stepPop(){i(()=>{t.stepPop({})})}}),[t.stepPush,t.stepReplace,t.stepPop,e,i])};function H(t){return t?t.animate===void 0||t.animate==null?{skipActiveState:!1}:{skipActiveState:!t.animate}:{skipActiveState:!1}}function bt(t){var y;let e=((y=t.plugins)!=null?y:[]).flat(1/0).map(r=>r),i=e.map(r=>r()),n=new Date().getTime()-t.transitionDuration,s=(0,T.makeEvent)("Initialized",{transitionDuration:t.transitionDuration,eventDate:n}),c=Object.entries(t.activities).map(([r,a])=>(0,T.makeEvent)("ActivityRegistered",u({activityName:r,eventDate:n},"component"in a?{activityParamsSchema:a.paramsSchema}:null))),o=(0,T.createCoreStore)({initialEvents:[s,...c],plugins:e}),f=Object.entries(t.activities).reduce((r,[a,p])=>"component"in p?v(u({},r),{[a]:{paramsSchema:p.paramsSchema,component:p.component}}):v(u({},r),{[a]:l.default.memo(p)}),{});return typeof window!="undefined"&&window.document.documentElement.style.setProperty("--stackflow-transition-duration",`${t.transitionDuration}ms`),{Stack:r=>{let a=(0,l.useMemo)(()=>t.initialActivity?[(0,T.makeEvent)("Pushed",{activityId:d(),activityName:t.initialActivity(),activityParams:{},eventDate:n,skipEnterActiveState:!1})]:[],[]),p=(0,l.useMemo)(()=>i.reduce((A,k)=>{var J,L,Q;return(Q=(L=k.overrideInitialEvents)==null?void 0:L.call(k,{initialEvents:A,initialContext:(J=r.initialContext)!=null?J:{}}))!=null?Q:A},a),[]);(0,l.useMemo)(()=>{p.forEach(A=>{o.actions.dispatchEvent(A.name,A)})},[]);let S=!!p&&!!a&&p!==a;return(0,l.useEffect)(()=>{S&&console.warn(`Stackflow - Some plugin overrides an "initialActivity" option. The "initialActivity" option you set to "${a[0].activityName}" in the "stackflow" is ignored.`),p.length===0&&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`)")},[]),(0,l.useEffect)(()=>{o.initialize()},[]),l.default.createElement(mt,{value:i},l.default.createElement(ct,{coreStore:o},l.default.createElement(vt,{activities:f})))},useFlow:$,useStepFlow:G,actions:{dispatchEvent(r,a){return o.actions.dispatchEvent(r,a)},getStack(){return o.actions.getStack()},push(r,a,p){let S=d();return o.actions.push({activityId:S,activityName:r,activityParams:a,skipEnterActiveState:H(p).skipActiveState}),{activityId:S}},replace(r,a,p){var A,k;let S=(A=p==null?void 0:p.activityId)!=null?A:d();return o.actions.replace({activityId:(k=p==null?void 0:p.activityId)!=null?k:d(),activityName:r,activityParams:a,skipEnterActiveState:H(p).skipActiveState}),{activityId:S}},pop(r){return o.actions.pop({skipExitActiveState:H(r).skipActiveState})},stepPush(r){let a=g();return o.actions.stepPush({stepId:a,stepParams:r})},stepReplace(r){let a=g();return o.actions.stepReplace({stepId:a,stepParams:r})},stepPop(){return o.actions.stepPop({})}}}}
"use strict";var At=Object.create;var h=Object.defineProperty,Pt=Object.defineProperties,xt=Object.getOwnPropertyDescriptor,St=Object.getOwnPropertyDescriptors,kt=Object.getOwnPropertyNames,X=Object.getOwnPropertySymbols,gt=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable;var Y=(t,e,i)=>e in t?h(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,u=(t,e)=>{for(var i in e||(e={}))Z.call(e,i)&&Y(t,i,e[i]);if(X)for(var i of X(e))Ct.call(e,i)&&Y(t,i,e[i]);return t},v=(t,e)=>Pt(t,St(e));var Tt=(t,e)=>{for(var i in e)h(t,i,{get:e[i],enumerable:!0})},_=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of kt(e))!Z.call(t,s)&&s!==i&&h(t,s,{get:()=>e[s],enumerable:!(n=xt(e,s))||n.enumerable});return t};var m=(t,e,i)=>(i=t!=null?At(gt(t)):{},_(e||!t||!t.__esModule?h(i,"default",{value:t,enumerable:!0}):i,t)),ht=t=>_(h({},"__esModule",{value:!0}),t);var Nt={};Tt(Nt,{stackflow:()=>bt,useActions:()=>$,useActivity:()=>wt,useActivityParams:()=>Rt,useStack:()=>Et,useStepActions:()=>G});module.exports=ht(Nt);var it=require("react");var U=m(require("react"));var O=require("react"),tt=m(require("react-fast-compare"));function I(t){let e=(0,O.useRef)(t),i=e.current,n=(0,tt.default)(i,t);return(0,O.useEffect)(()=>{n||(e.current=t)}),n?i:t}var w=(0,U.createContext)(null),et=({children:t,value:e})=>U.default.createElement(w.Provider,{value:I(e)},t);var wt=()=>(0,it.useContext)(w);var ot=require("react");function Rt(){return(0,ot.useContext)(w).params}var nt=require("react");var B=m(require("react"));var q=(0,B.createContext)(null),rt=({children:t,value:e})=>B.default.createElement(q.Provider,{value:I(e)},t);var Et=()=>(0,nt.useContext)(q);var T=require("@stackflow/core"),l=m(require("react"));var at=require("@stackflow/core");function d(){return(0,at.id)()}var st=require("@stackflow/core");function g(){return(0,st.id)()}var P=m(require("react")),W=(0,P.createContext)(null),z=(0,P.createContext)(null),ct=({coreStore:t,children:e})=>{let i=(0,P.useSyncExternalStore)(t.subscribe,t.actions.getStack,t.actions.getStack);return P.default.createElement(z.Provider,{value:i},P.default.createElement(W.Provider,{value:t.actions},e))};var pt=m(require("react"));var b=()=>pt.default.useContext(W);var ut=m(require("react"));var N=()=>ut.default.useContext(z);var C=m(require("react"));var R=m(require("react"));var D=m(require("react")),V=(0,D.createContext)(null),mt=({children:t,value:e})=>D.default.createElement(V.Provider,{value:e},t);var lt=require("react");function F(){return(0,lt.useContext)(V)}var Ot=({activities:t,plugin:e})=>{let i=N(),n=F();return e.render({stack:v(u({},i),{render(s){let c=u(u({},i),s);return{activities:c.activities.map(o=>v(u({},o),{key:o.id,render(f){let E=t[o.name],x;if("component"in E){let{component:y}=E;x=R.default.createElement(y,{params:o.params})}else x=R.default.createElement(E,{params:o.params});return n.forEach(y=>{var r,a;x=(a=(r=y.wrapActivity)==null?void 0:r.call(y,{activity:v(u({},o),{render:()=>x})}))!=null?a:x}),R.default.createElement(rt,{value:c},R.default.createElement(et,{key:o.id,value:u(u({},o),f)},x))}}))}}})})},ft=Ot;var It=({activities:t})=>{let e=N(),i=F(),n=i.filter(c=>!!c.render);(0,C.useEffect)(()=>{n.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.`)},[n]);let s=C.default.createElement(C.default.Fragment,null,n.map(c=>C.default.createElement(ft,{key:c.key,activities:t,plugin:c})));return i.forEach(c=>{var o,f;s=(f=(o=c.wrapStack)==null?void 0:o.call(c,{stack:v(u({},e),{render(){return s}})}))!=null?f:s}),s},vt=It;var M=m(require("react"));function j(t){return t?t.animate===void 0||t.animate==null?{skipActiveState:!1}:{skipActiveState:!t.animate}:{skipActiveState:!1}}var dt,Ut=(dt=M.default.useTransition)!=null?dt:()=>[!1,t=>t()];function $(){let t=b(),[e,i]=Ut();return(0,M.useMemo)(()=>({pending:e,push(n,s,c){let o=d();return i(()=>{t.push({activityId:o,activityName:n,activityParams:s,skipEnterActiveState:j(c).skipActiveState})}),{activityId:o}},replace(n,s,c){let o=d();return i(()=>{var f;t.replace({activityId:(f=c==null?void 0:c.activityId)!=null?f:d(),activityName:n,activityParams:s,skipEnterActiveState:j(c).skipActiveState})}),{activityId:o}},pop(n){i(()=>{t.pop({skipExitActiveState:j(n).skipActiveState})})}}),[t.push,t.replace,t.pop,e,i])}var K=m(require("react"));var yt,Bt=(yt=K.default.useTransition)!=null?yt:()=>[!1,t=>t()],G=()=>{let t=b(),[e,i]=Bt();return(0,K.useMemo)(()=>({pending:e,stepPush(n){let s=g();i(()=>{t.stepPush({stepId:s,stepParams:n})})},stepReplace(n){let s=g();i(()=>{t.stepReplace({stepId:s,stepParams:n})})},stepPop(){i(()=>{t.stepPop({})})}}),[t.stepPush,t.stepReplace,t.stepPop,e,i])};function H(t){return t?t.animate===void 0||t.animate==null?{skipActiveState:!1}:{skipActiveState:!t.animate}:{skipActiveState:!1}}function bt(t){var y;let e=((y=t.plugins)!=null?y:[]).flat(1/0).map(r=>r),i=e.map(r=>r()),n=new Date().getTime()-t.transitionDuration,s=(0,T.makeEvent)("Initialized",{transitionDuration:t.transitionDuration,eventDate:n}),c=Object.entries(t.activities).map(([r,a])=>(0,T.makeEvent)("ActivityRegistered",u({activityName:r,eventDate:n},"component"in a?{activityParamsSchema:a.paramsSchema}:null))),o=(0,T.createCoreStore)({initialEvents:[s,...c],plugins:e}),f=Object.entries(t.activities).reduce((r,[a,p])=>"component"in p?v(u({},r),{[a]:{paramsSchema:p.paramsSchema,component:p.component}}):v(u({},r),{[a]:l.default.memo(p)}),{});return typeof window!="undefined"&&window.document.documentElement.style.setProperty("--stackflow-transition-duration",`${t.transitionDuration}ms`),{Stack:r=>{let a=(0,l.useMemo)(()=>t.initialActivity?[(0,T.makeEvent)("Pushed",{activityId:d(),activityName:t.initialActivity(),activityParams:{},eventDate:n,skipEnterActiveState:!1})]:[],[]),p=(0,l.useMemo)(()=>i.reduce((A,k)=>{var J,L,Q;return(Q=(L=k.overrideInitialEvents)==null?void 0:L.call(k,{initialEvents:A,initialContext:(J=r.initialContext)!=null?J:{}}))!=null?Q:A},a),[]);(0,l.useMemo)(()=>{p.forEach(A=>{o.actions.dispatchEvent(A.name,A)})},[]);let S=p.length>0&&a.length>0&&p!==a;return(0,l.useEffect)(()=>{S&&console.warn(`Stackflow - Some plugin overrides an "initialActivity" option. The "initialActivity" option you set to "${a[0].activityName}" in the "stackflow" is ignored.`),p.length===0&&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`)")},[]),(0,l.useEffect)(()=>{o.initialize()},[]),l.default.createElement(mt,{value:i},l.default.createElement(ct,{coreStore:o},l.default.createElement(vt,{activities:f})))},useFlow:$,useStepFlow:G,actions:{dispatchEvent(r,a){return o.actions.dispatchEvent(r,a)},getStack(){return o.actions.getStack()},push(r,a,p){let S=d();return o.actions.push({activityId:S,activityName:r,activityParams:a,skipEnterActiveState:H(p).skipActiveState}),{activityId:S}},replace(r,a,p){var A,k;let S=(A=p==null?void 0:p.activityId)!=null?A:d();return o.actions.replace({activityId:(k=p==null?void 0:p.activityId)!=null?k:d(),activityName:r,activityParams:a,skipEnterActiveState:H(p).skipActiveState}),{activityId:S}},pop(r){return o.actions.pop({skipExitActiveState:H(r).skipActiveState})},stepPush(r){let a=g();return o.actions.stepPush({stepId:a,stepParams:r})},stepReplace(r){let a=g();return o.actions.stepReplace({stepId:a,stepParams:r})},stepPop(){return o.actions.stepPop({})}}}}
//# sourceMappingURL=index.js.map
{
"name": "@stackflow/react",
"version": "0.16.1-alpha.21+1fef4caf",
"version": "0.16.1-alpha.22+822eeda0",
"license": "MIT",

@@ -30,3 +30,3 @@ "exports": {

"devDependencies": {
"@stackflow/core": "^0.16.1-alpha.21+1fef4caf",
"@stackflow/core": "^0.16.0",
"@stackflow/esbuild-config": "^0.16.0",

@@ -65,3 +65,3 @@ "@stackflow/eslint-config": "^0.16.0",

},
"gitHead": "1fef4cafc455604904c1afe6176e89e06919a29a"
"gitHead": "822eeda0deea6d2790b4b39de36df9e7c8afea76"
}

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc