@stackflow/react
Advanced tools
Comparing version 0.18.0 to 0.19.0
@@ -1,2 +0,2 @@ | ||
import type { ActivityRegisteredEvent } from "@stackflow/core/dist/event-types"; | ||
import type { ActivityRegisteredEvent } from "@stackflow/core"; | ||
import type { ActivityComponentType } from "./activity"; | ||
@@ -3,0 +3,0 @@ export declare type BaseActivities = { |
@@ -1,9 +0,9 @@ | ||
import type { AggregateOutput, CreateCoreStoreOutput } from "@stackflow/core"; | ||
import type { CoreStore, Stack } from "@stackflow/core"; | ||
import React from "react"; | ||
export declare const CoreActionsContext: React.Context<import("@stackflow/core").StackflowActions>; | ||
export declare const CoreStateContext: React.Context<AggregateOutput>; | ||
export declare const CoreStateContext: React.Context<Stack>; | ||
export interface CoreProviderProps { | ||
coreStore: CreateCoreStoreOutput; | ||
coreStore: CoreStore; | ||
children: React.ReactNode; | ||
} | ||
export declare const CoreProvider: React.FC<CoreProviderProps>; |
@@ -1,1 +0,1 @@ | ||
export declare const useCoreState: () => import("@stackflow/core").AggregateOutput; | ||
export declare const useCoreState: () => import("@stackflow/core").Stack; |
@@ -1,2 +0,2 @@ | ||
"use strict";var Rt=Object.create;var w=Object.defineProperty,ht=Object.defineProperties,wt=Object.getOwnPropertyDescriptor,Et=Object.getOwnPropertyDescriptors,Ot=Object.getOwnPropertyNames,_=Object.getOwnPropertySymbols,It=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable;var tt=(t,e,i)=>e in t?w(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,m=(t,e)=>{for(var i in e||(e={}))et.call(e,i)&&tt(t,i,e[i]);if(_)for(var i of _(e))Ut.call(e,i)&&tt(t,i,e[i]);return t},v=(t,e)=>ht(t,Et(e));var Bt=(t,e)=>{for(var i in e)w(t,i,{get:e[i],enumerable:!0})},it=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Ot(e))!et.call(t,s)&&s!==i&&w(t,s,{get:()=>e[s],enumerable:!(n=wt(e,s))||n.enumerable});return t};var l=(t,e,i)=>(i=t!=null?Rt(It(t)):{},it(e||!t||!t.__esModule?w(i,"default",{value:t,enumerable:!0}):i,t)),Dt=t=>it(w({},"__esModule",{value:!0}),t);var jt={};Bt(jt,{stackflow:()=>Wt,useActions:()=>J,useActivity:()=>bt,useActivityParams:()=>Nt,useStack:()=>Ft,useStepActions:()=>L});module.exports=Dt(jt);var nt=require("react");var D=l(require("react"));var U=require("react"),ot=l(require("react-fast-compare"));function B(t){let e=(0,U.useRef)(t),i=e.current,n=(0,ot.default)(i,t);return(0,U.useEffect)(()=>{n||(e.current=t)}),n?i:t}var E=(0,D.createContext)(null),rt=({children:t,value:e})=>D.default.createElement(E.Provider,{value:B(e)},t);var bt=()=>(0,nt.useContext)(E);var at=require("react");function Nt(){return(0,at.useContext)(E).params}var ct=require("react");var b=l(require("react"));var j=(0,b.createContext)(null),st=({children:t,value:e})=>b.default.createElement(j.Provider,{value:B(e)},t);var Ft=()=>(0,ct.useContext)(j);var A=require("@stackflow/core"),y=l(require("react"));var pt=require("@stackflow/core");function d(){return(0,pt.id)()}var ut=require("@stackflow/core");function k(){return(0,ut.id)()}var C=l(require("react"));var lt=l(require("react")),mt,ft=(mt=lt.default.useDeferredValue)!=null?mt:t=>t;var g=l(require("react")),vt,dt=(vt=g.default.useSyncExternalStore)!=null?vt:(t,e)=>{let[i,n]=(0,g.useState)(()=>e());return(0,g.useEffect)(()=>t(()=>{n(()=>e())})),i};var z=(0,C.createContext)(null),$=(0,C.createContext)(null),yt=({coreStore:t,children:e})=>{let i=dt(t.subscribe,t.actions.getStack,t.actions.getStack),n=ft(i);return C.default.createElement($.Provider,{value:n},C.default.createElement(z.Provider,{value:t.actions},e))};var St=l(require("react"));var N=()=>St.default.useContext(z);var At=l(require("react"));var F=()=>At.default.useContext($);var T=l(require("react"));var O=l(require("react"));var M=l(require("react")),G=(0,M.createContext)(null),xt=({children:t,value:e})=>M.default.createElement(G.Provider,{value:e},t);var Pt=require("react");function K(){return(0,Pt.useContext)(G)}var Mt=({activities:t,plugin:e})=>{let i=F(),n=K();return e.render({stack:v(m({},i),{render(s){let c=m(m({},i),s);return{activities:c.activities.map(p=>v(m({},p),{key:p.id,render(u){let I=t[p.name],x;if("component"in I){let{component:S}=I;x=O.default.createElement(S,{params:p.params})}else x=O.default.createElement(I,{params:p.params});return n.forEach(S=>{var o,a;x=(a=(o=S.wrapActivity)==null?void 0:o.call(S,{activity:v(m({},p),{render:()=>x})}))!=null?a:x}),O.default.createElement(st,{value:c},O.default.createElement(rt,{key:p.id,value:m(m({},p),u)},x))}}))}}})})},kt=Mt;var Kt=({activities:t})=>{let e=F(),i=K(),n=i.filter(c=>!!c.render);(0,T.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=T.default.createElement(T.default.Fragment,null,n.map(c=>T.default.createElement(kt,{key:c.key,activities:t,plugin:c})));return i.forEach(c=>{var p,u;s=(u=(p=c.wrapStack)==null?void 0:p.call(c,{stack:v(m({},e),{render(){return s}})}))!=null?u:s}),s},gt=Kt;var V=l(require("react"));function H(t){return t?t.animate===void 0||t.animate==null?{skipActiveState:!1}:{skipActiveState:!t.animate}:{skipActiveState:!1}}var Ct,Vt=(Ct=V.default.useTransition)!=null?Ct:()=>[!1,t=>t()];function J(){let t=N(),[e,i]=Vt();return(0,V.useMemo)(()=>({pending:e,push(n,s,c){let p=d();return t.push({activityId:p,activityName:n,activityParams:s,skipEnterActiveState:H(c).skipActiveState}),{activityId:p}},replace(n,s,c){var u;let p=d();return t.replace({activityId:(u=c==null?void 0:c.activityId)!=null?u:d(),activityName:n,activityParams:s,skipEnterActiveState:H(c).skipActiveState}),{activityId:p}},pop(n){t.pop({skipExitActiveState:H(n).skipActiveState})}}),[t.push,t.replace,t.pop,e,i])}var q=l(require("react"));var Tt,qt=(Tt=q.default.useTransition)!=null?Tt:()=>[!1,t=>t()],L=()=>{let t=N(),[e,i]=qt();return(0,q.useMemo)(()=>({pending:e,stepPush(n){let s=k();t.stepPush({stepId:s,stepParams:n})},stepReplace(n){let s=k();t.stepReplace({stepId:s,stepParams:n})},stepPop(){t.stepPop({})}}),[t.stepPush,t.stepReplace,t.stepPop,e,i])};function Q(t){return t?t.animate===void 0||t.animate==null?{skipActiveState:!1}:{skipActiveState:!t.animate}:{skipActiveState:!1}}function Wt(t){var S;let e=((S=t.plugins)!=null?S:[]).flat(1/0).map(o=>o),i=e.map(o=>o()),n=Object.entries(t.activities).reduce((o,[a,r])=>"component"in r?v(m({},o),{[a]:{paramsSchema:r.paramsSchema,component:r.component}}):v(m({},o),{[a]:y.default.memo(r)}),{}),s=()=>new Date().getTime()-t.transitionDuration,c=()=>{let o=(0,A.makeEvent)("Initialized",{transitionDuration:t.transitionDuration,eventDate:s()}),a=Object.entries(n).map(([r,f])=>(0,A.makeEvent)("ActivityRegistered",m({activityName:r,eventDate:s()},"component"in f?{activityParamsSchema:f.paramsSchema}:null)));return[o,...a]},p=(0,A.aggregate)(c(),new Date().getTime()),u={value:null};return typeof window!="undefined"&&window.document.documentElement.style.setProperty("--stackflow-transition-duration",`${t.transitionDuration}ms`),{Stack:o=>{let a=(0,y.useMemo)(()=>{let r=t.initialActivity?[(0,A.makeEvent)("Pushed",{activityId:d(),activityName:t.initialActivity(),activityParams:{},eventDate:s(),skipEnterActiveState:!1})]:[],f=i.reduce((h,W)=>{var X,Y,Z;return(Z=(Y=W.overrideInitialEvents)==null?void 0:Y.call(W,{initialEvents:h,initialContext:(X=o.initialContext)!=null?X:{}}))!=null?Z:h},r);f.length>0&&r.length>0&&f!==r&&console.warn(`Stackflow - Some plugin overrides an "initialActivity" option. The "initialActivity" option you set to "${r[0].activityName}" in the "stackflow" is ignored.`),f.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`)");let R=(0,A.createCoreStore)({initialEvents:[...c(),...f],plugins:e});return u.value=R,R},[]);return(0,y.useEffect)(()=>{a.init()},[a]),y.default.createElement(xt,{value:i},y.default.createElement(yt,{coreStore:a},y.default.createElement(gt,{activities:n})))},useFlow:J,useStepFlow:L,actions:{dispatchEvent(o,a){var r;return(r=u.value)==null?void 0:r.actions.dispatchEvent(o,a)},getStack(){var o,a;return(a=(o=u.value)==null?void 0:o.actions.getStack())!=null?a:p},push(o,a,r){var P;let f=d();return(P=u.value)==null||P.actions.push({activityId:f,activityName:o,activityParams:a,skipEnterActiveState:Q(r).skipActiveState}),{activityId:f}},replace(o,a,r){var P,R,h;let f=(P=r==null?void 0:r.activityId)!=null?P:d();return(h=u.value)==null||h.actions.replace({activityId:(R=r==null?void 0:r.activityId)!=null?R:d(),activityName:o,activityParams:a,skipEnterActiveState:Q(r).skipActiveState}),{activityId:f}},pop(o){var a;return(a=u.value)==null?void 0:a.actions.pop({skipExitActiveState:Q(o).skipActiveState})},stepPush(o){var r;let a=k();return(r=u.value)==null?void 0:r.actions.stepPush({stepId:a,stepParams:o})},stepReplace(o){var r;let a=k();return(r=u.value)==null?void 0:r.actions.stepReplace({stepId:a,stepParams:o})},stepPop(){var o;return(o=u.value)==null?void 0:o.actions.stepPop({})}},activities:n}} | ||
"use strict";var ht=Object.create;var R=Object.defineProperty,Rt=Object.defineProperties,wt=Object.getOwnPropertyDescriptor,Et=Object.getOwnPropertyDescriptors,It=Object.getOwnPropertyNames,Z=Object.getOwnPropertySymbols,bt=Object.getPrototypeOf,tt=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable;var _=(t,e,i)=>e in t?R(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,u=(t,e)=>{for(var i in e||(e={}))tt.call(e,i)&&_(t,i,e[i]);if(Z)for(var i of Z(e))Ut.call(e,i)&&_(t,i,e[i]);return t},y=(t,e)=>Rt(t,Et(e));var Ot=(t,e)=>{for(var i in e)R(t,i,{get:e[i],enumerable:!0})},et=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of It(e))!tt.call(t,s)&&s!==i&&R(t,s,{get:()=>e[s],enumerable:!(n=wt(e,s))||n.enumerable});return t};var m=(t,e,i)=>(i=t!=null?ht(bt(t)):{},et(e||!t||!t.__esModule?R(i,"default",{value:t,enumerable:!0}):i,t)),Dt=t=>et(R({},"__esModule",{value:!0}),t);var jt={};Ot(jt,{stackflow:()=>Wt,useActions:()=>H,useActivity:()=>Mt,useActivityParams:()=>Nt,useStack:()=>Bt,useStepActions:()=>J});module.exports=Dt(jt);var nt=require("react");var b=m(require("react"));function it(){let t={value:null};function e(){return t.value}function i(n){t.value=n}return[e,i]}var E=require("react"),ot=m(require("react-fast-compare"));function I(t){let e=(0,E.useRef)(t),i=e.current,n=(0,ot.default)(i,t);return(0,E.useEffect)(()=>{n||(e.current=t)}),n?i:t}var w=(0,b.createContext)(null),rt=({children:t,value:e})=>b.default.createElement(w.Provider,{value:I(e)},t);var Mt=()=>(0,nt.useContext)(w);var at=require("react");function Nt(){return(0,at.useContext)(w).params}var ct=require("react");var U=m(require("react"));var W=(0,U.createContext)(null),st=({children:t,value:e})=>U.default.createElement(W.Provider,{value:I(e)},t);var Bt=()=>(0,ct.useContext)(W);var P=require("@stackflow/core"),l=m(require("react"));var pt=require("@stackflow/core");function d(){return(0,pt.id)()}var mt=require("@stackflow/core");function k(){return(0,mt.id)()}var C=m(require("react"));var lt=m(require("react")),ut,ft=(ut=lt.default.useDeferredValue)!=null?ut:t=>t;var x=m(require("react")),vt,dt=(vt=x.default.useSyncExternalStore)!=null?vt:(t,e)=>{let[i,n]=(0,x.useState)(()=>e());return(0,x.useEffect)(()=>t(()=>{n(()=>e())})),i};var j=(0,C.createContext)(null),$=(0,C.createContext)(null),yt=({coreStore:t,children:e})=>{let i=dt(t.subscribe,t.actions.getStack,t.actions.getStack),n=ft(i);return C.default.createElement($.Provider,{value:n},C.default.createElement(j.Provider,{value:t.actions},e))};var St=m(require("react"));var O=()=>St.default.useContext(j);var Pt=m(require("react"));var D=()=>Pt.default.useContext($);var g=m(require("react"));var B=m(require("react"));var M=m(require("react")),z=(0,M.createContext)(null),At=({children:t,value:e})=>M.default.createElement(z.Provider,{value:e},t);var kt=require("react");function N(){return(0,kt.useContext)(z)}var Ft=({activityComponentMap:t,plugin:e})=>{let i=D(),n=N();return e.render({stack:y(u({},i),{render(s){let p=u(u({},i),s);return{activities:p.activities.map(c=>y(u({},c),{key:c.id,render(f){let V=t[c.name],S=B.default.createElement(V,{params:c.params});return n.forEach(o=>{var r,a;S=(a=(r=o.wrapActivity)==null?void 0:r.call(o,{activity:y(u({},c),{render:()=>S})}))!=null?a:S}),B.default.createElement(st,{value:p},B.default.createElement(rt,{key:c.id,value:u(u({},c),f)},S))}}))}}})})},xt=Ft;var Kt=({activityComponentMap:t})=>{let e=D(),i=N(),n=i.filter(p=>!!p.render);(0,g.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=g.default.createElement(g.default.Fragment,null,n.map(p=>g.default.createElement(xt,{key:p.key,activityComponentMap:t,plugin:p})));return i.forEach(p=>{var c,f;s=(f=(c=p.wrapStack)==null?void 0:c.call(p,{stack:y(u({},e),{render(){return s}})}))!=null?f:s}),s},Ct=Kt;var F=m(require("react"));function G(t){return t?t.animate===void 0||t.animate==null?{skipActiveState:!1}:{skipActiveState:!t.animate}:{skipActiveState:!1}}var gt,Vt=(gt=F.default.useTransition)!=null?gt:()=>[!1,t=>t()];function H(){let t=O(),[e,i]=Vt();return(0,F.useMemo)(()=>({pending:e,push(n,s,p){let c=d();return t.push({activityId:c,activityName:n,activityParams:s,skipEnterActiveState:G(p).skipActiveState}),{activityId:c}},replace(n,s,p){var f;let c=d();return t.replace({activityId:(f=p==null?void 0:p.activityId)!=null?f:d(),activityName:n,activityParams:s,skipEnterActiveState:G(p).skipActiveState}),{activityId:c}},pop(n){t.pop({skipExitActiveState:G(n).skipActiveState})}}),[t.push,t.replace,t.pop,e,i])}var K=m(require("react"));var Tt,qt=(Tt=K.default.useTransition)!=null?Tt:()=>[!1,t=>t()],J=()=>{let t=O(),[e,i]=qt();return(0,K.useMemo)(()=>({pending:e,stepPush(n){let s=k();t.stepPush({stepId:s,stepParams:n})},stepReplace(n){let s=k();t.stepReplace({stepId:s,stepParams:n})},stepPop(){t.stepPop({})}}),[t.stepPush,t.stepReplace,t.stepPop,e,i])};function L(t){return t?t.animate===void 0||t.animate==null?{skipActiveState:!1}:{skipActiveState:!t.animate}:{skipActiveState:!1}}function Wt(t){var S;typeof window!="undefined"&&window.document.documentElement.style.setProperty("--stackflow-transition-duration",`${t.transitionDuration}ms`);let e=((S=t.plugins)!=null?S:[]).flat(1/0).map(o=>o),i=e.map(o=>o()),n=Object.entries(t.activities).reduce((o,[r,a])=>y(u({},o),{[r]:"component"in a?l.default.memo(a.component):l.default.memo(a)}),{}),s=()=>new Date().getTime()-t.transitionDuration*2,p=(0,P.makeCoreStore)({initialEvents:[(0,P.makeEvent)("Initialized",{transitionDuration:t.transitionDuration,eventDate:s()}),...Object.entries(t.activities).map(([o,r])=>(0,P.makeEvent)("ActivityRegistered",u({activityName:o,eventDate:s()},"component"in r?{activityParamsSchema:r.paramsSchema}:null)))],plugins:[]}),[c,f]=it(),V=o=>{let r=(0,l.useMemo)(()=>{let a=t.initialActivity?[(0,P.makeEvent)("Pushed",{activityId:d(),activityName:t.initialActivity(),activityParams:{},eventDate:s(),skipEnterActiveState:!1})]:[],v=i.reduce((h,q)=>{var Q,X,Y;return(Y=(X=q.overrideInitialEvents)==null?void 0:X.call(q,{initialEvents:h,initialContext:(Q=o.initialContext)!=null?Q:{}}))!=null?Y:h},a);v.length>0&&a.length>0&&v!==a&&console.warn(`Stackflow - Some plugin overrides an "initialActivity" option. The "initialActivity" option you set to "${a[0].activityName}" in the "stackflow" is ignored.`),v.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`)");let T=(0,P.makeCoreStore)({initialEvents:[...p.pullEvents(),...v],plugins:e});return f(T),T},[]);return(0,l.useEffect)(()=>{r.init()},[r]),l.default.createElement(At,{value:i},l.default.createElement(yt,{coreStore:r},l.default.createElement(Ct,{activityComponentMap:n})))};return{activities:t.activities,Stack:V,useFlow:H,useStepFlow:J,addActivity(o){if(c()){console.warn("Stackflow - `addActivity()` API cannot be called after a `<Stack />` component has been rendered");return}n[o.name]=l.default.memo(o.component),p.actions.dispatchEvent("ActivityRegistered",{activityName:o.name,activityParamsSchema:o.paramsSchema,eventDate:s()})},addPlugin(o){if(c()){console.warn("Stackflow - `addPlugin()` API cannot be called after a `<Stack />` component has been rendered");return}[o].flat(1/0).map(r=>r).forEach(r=>{e.push(r),i.push(r())})},actions:{getStack(){var o,r;return(r=(o=c())==null?void 0:o.actions.getStack())!=null?r:p.actions.getStack()},dispatchEvent(o,r){var a;return(a=c())==null?void 0:a.actions.dispatchEvent(o,r)},push(o,r,a){var A;let v=d();return(A=c())==null||A.actions.push({activityId:v,activityName:o,activityParams:r,skipEnterActiveState:L(a).skipActiveState}),{activityId:v}},replace(o,r,a){var A,T,h;let v=(A=a==null?void 0:a.activityId)!=null?A:d();return(h=c())==null||h.actions.replace({activityId:(T=a==null?void 0:a.activityId)!=null?T:d(),activityName:o,activityParams:r,skipEnterActiveState:L(a).skipActiveState}),{activityId:v}},pop(o){var r;return(r=c())==null?void 0:r.actions.pop({skipExitActiveState:L(o).skipActiveState})},stepPush(o){var a;let r=k();return(a=c())==null?void 0:a.actions.stepPush({stepId:r,stepParams:o})},stepReplace(o){var a;let r=k();return(a=c())==null?void 0:a.actions.stepReplace({stepId:r,stepParams:o})},stepPop(){var o;return(o=c())==null?void 0:o.actions.stepPop({})}}}} | ||
//# sourceMappingURL=index.js.map |
import React from "react"; | ||
import type { BaseActivities } from "./BaseActivities"; | ||
import type { ActivityComponentType } from "./activity"; | ||
interface MainRendererProps { | ||
activities: BaseActivities; | ||
activityComponentMap: { | ||
[key: string]: ActivityComponentType; | ||
}; | ||
} | ||
declare const MainRenderer: React.FC<MainRendererProps>; | ||
export default MainRenderer; |
import React from "react"; | ||
import type { BaseActivities } from "./BaseActivities"; | ||
import type { ActivityComponentType } from "./activity"; | ||
import type { StackflowReactPlugin } from "./StackflowReactPlugin"; | ||
import type { WithRequired } from "./utils"; | ||
interface PluginRendererProps { | ||
activities: BaseActivities; | ||
activityComponentMap: { | ||
[key: string]: ActivityComponentType; | ||
}; | ||
plugin: WithRequired<ReturnType<StackflowReactPlugin>, "render">; | ||
@@ -8,0 +10,0 @@ } |
@@ -1,9 +0,9 @@ | ||
import type { AggregateOutput } from "@stackflow/core"; | ||
import type { Stack } from "@stackflow/core"; | ||
import React from "react"; | ||
export declare const StackContext: React.Context<AggregateOutput>; | ||
export declare const StackContext: React.Context<Stack>; | ||
interface StackProviderProps { | ||
children: React.ReactNode; | ||
value: AggregateOutput; | ||
value: Stack; | ||
} | ||
export declare const StackProvider: React.FC<StackProviderProps>; | ||
export {}; |
/** | ||
* Get overall stack state | ||
*/ | ||
export declare const useStack: () => import("@stackflow/core").AggregateOutput; | ||
export declare const useStack: () => import("@stackflow/core").Stack; |
@@ -1,3 +0,4 @@ | ||
import type { StackflowActions } from "@stackflow/core"; | ||
import type { ActivityRegisteredEvent, StackflowActions } from "@stackflow/core"; | ||
import React from "react"; | ||
import type { ActivityComponentType } from "./activity"; | ||
import type { BaseActivities } from "./BaseActivities"; | ||
@@ -32,2 +33,6 @@ import type { StackflowReactPlugin } from "./StackflowReactPlugin"; | ||
/** | ||
* Return activities | ||
*/ | ||
activities: T; | ||
/** | ||
* Created `<Stack />` component | ||
@@ -45,9 +50,17 @@ */ | ||
/** | ||
* Add activity imperatively | ||
*/ | ||
addActivity: (options: { | ||
name: string; | ||
component: ActivityComponentType<any>; | ||
paramsSchema?: ActivityRegisteredEvent["activityParamsSchema"]; | ||
}) => void; | ||
/** | ||
* Add plugin imperatively | ||
*/ | ||
addPlugin: (plugin: StackflowPluginsEntry<T>) => void; | ||
/** | ||
* Created action triggers | ||
*/ | ||
actions: Pick<StackflowActions, "dispatchEvent" | "getStack"> & Pick<UseActionsOutputType<T>, "push" | "pop" | "replace"> & Pick<UseStepActionsOutputType<{}>, "stepPush" | "stepReplace" | "stepPop">; | ||
/** | ||
* Return activities | ||
*/ | ||
activities: T; | ||
}; | ||
@@ -54,0 +67,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import type { Activity, AggregateOutput, StackflowPlugin } from "@stackflow/core"; | ||
import type { Activity, Stack, StackflowPlugin } from "@stackflow/core"; | ||
import type React from "react"; | ||
@@ -8,4 +8,4 @@ export declare type StackflowReactPlugin<T = never> = () => { | ||
render?: (args: { | ||
stack: AggregateOutput & { | ||
render: (overrideStack?: Partial<AggregateOutput>) => { | ||
stack: Stack & { | ||
render: (overrideStack?: Partial<Stack>) => { | ||
activities: Array<Activity & { | ||
@@ -22,3 +22,3 @@ key: string; | ||
wrapStack?: (args: { | ||
stack: AggregateOutput & { | ||
stack: Stack & { | ||
render: () => React.ReactNode; | ||
@@ -25,0 +25,0 @@ }; |
@@ -0,2 +1,3 @@ | ||
export * from "./makeRef"; | ||
export * from "./useMemoDeep"; | ||
export * from "./WithRequired"; |
{ | ||
"name": "@stackflow/react", | ||
"version": "0.18.0", | ||
"version": "0.19.0", | ||
"license": "MIT", | ||
@@ -30,5 +30,5 @@ "exports": { | ||
"devDependencies": { | ||
"@stackflow/core": "^0.18.0", | ||
"@stackflow/esbuild-config": "^0.18.0", | ||
"@stackflow/eslint-config": "^0.18.0", | ||
"@stackflow/core": "^0.19.0", | ||
"@stackflow/esbuild-config": "^0.19.0", | ||
"@stackflow/eslint-config": "^0.19.0", | ||
"@types/react": "^18.0.9", | ||
@@ -65,3 +65,3 @@ "@typescript-eslint/eslint-plugin": "^5.32.0", | ||
}, | ||
"gitHead": "8a147a81f13944ecbbbd36cbfc385b59aaf1a68e" | ||
"gitHead": "06479b635f1fe01c501af726c32f04c1f3b9f69c" | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { ActivityRegisteredEvent } from "@stackflow/core/dist/event-types"; | ||
import type { ActivityRegisteredEvent } from "@stackflow/core"; | ||
@@ -3,0 +3,0 @@ import type { ActivityComponentType } from "./activity"; |
@@ -1,6 +0,2 @@ | ||
import type { | ||
Activity, | ||
AggregateOutput, | ||
StackflowPlugin, | ||
} from "@stackflow/core"; | ||
import type { Activity, Stack, StackflowPlugin } from "@stackflow/core"; | ||
import type React from "react"; | ||
@@ -13,4 +9,4 @@ | ||
render?: (args: { | ||
stack: AggregateOutput & { | ||
render: (overrideStack?: Partial<AggregateOutput>) => { | ||
stack: Stack & { | ||
render: (overrideStack?: Partial<Stack>) => { | ||
activities: Array< | ||
@@ -30,3 +26,3 @@ Activity & { | ||
wrapStack?: (args: { | ||
stack: AggregateOutput & { | ||
stack: Stack & { | ||
render: () => React.ReactNode; | ||
@@ -33,0 +29,0 @@ }; |
@@ -0,2 +1,3 @@ | ||
export * from "./makeRef"; | ||
export * from "./useMemoDeep"; | ||
export * from "./WithRequired"; |
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
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
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
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
128205
71
1178