@buoy-gg/redux 2.1.1 → 2.1.2
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/lib/commonjs/index.js +1 -1
- package/lib/commonjs/redux/components/ReduxModal.js +1 -1
- package/lib/commonjs/redux/hooks/index.js +1 -1
- package/lib/commonjs/redux/hooks/useAutoInstrumentRedux.js +1 -0
- package/lib/commonjs/redux/utils/autoInstrument.js +1 -0
- package/lib/commonjs/redux/utils/buoyReduxMiddleware.js +1 -1
- package/lib/commonjs/redux/utils/index.js +1 -1
- package/lib/commonjs/redux/utils/reduxActionStore.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/redux/components/ReduxModal.js +1 -1
- package/lib/module/redux/hooks/index.js +1 -1
- package/lib/module/redux/hooks/useAutoInstrumentRedux.js +1 -0
- package/lib/module/redux/utils/autoInstrument.js +1 -0
- package/lib/module/redux/utils/buoyReduxMiddleware.js +1 -1
- package/lib/module/redux/utils/index.js +1 -1
- package/lib/module/redux/utils/reduxActionStore.js +1 -1
- package/lib/typescript/index.d.ts +28 -10
- package/lib/typescript/preset.d.ts +23 -8
- package/lib/typescript/redux/components/ReduxModal.d.ts +3 -0
- package/lib/typescript/redux/hooks/index.d.ts +2 -0
- package/lib/typescript/redux/hooks/useAutoInstrumentRedux.d.ts +64 -0
- package/lib/typescript/redux/utils/autoInstrument.d.ts +62 -0
- package/lib/typescript/redux/utils/buoyReduxMiddleware.d.ts +5 -0
- package/lib/typescript/redux/utils/index.d.ts +2 -0
- package/package.json +4 -4
package/lib/commonjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"BUOY_JUMP_TO_STATE",{enumerable:!0,get:function(){return _buoyReduxMiddleware.BUOY_JUMP_TO_STATE}}),Object.defineProperty(exports,"BUOY_REPLAY_ACTION",{enumerable:!0,get:function(){return _buoyReduxMiddleware.BUOY_REPLAY_ACTION}}),Object.defineProperty(exports,"FREE_TIER_ACTION_LIMIT",{enumerable:!0,get:function(){return _ReduxModal.FREE_TIER_ACTION_LIMIT}}),Object.defineProperty(exports,"ReduxActionDetailContent",{enumerable:!0,get:function(){return _ReduxActionDetailContent.ReduxActionDetailContent}}),Object.defineProperty(exports,"ReduxActionDetailFooter",{enumerable:!0,get:function(){return _ReduxActionDetailContent.ReduxActionDetailFooter}}),Object.defineProperty(exports,"ReduxActionDetailView",{enumerable:!0,get:function(){return _ReduxActionDetailView.ReduxActionDetailView}}),Object.defineProperty(exports,"ReduxActionItem",{enumerable:!0,get:function(){return _ReduxActionItem.ReduxActionItem}}),Object.defineProperty(exports,"ReduxIcon",{enumerable:!0,get:function(){return _ReduxIcon.ReduxIcon}}),Object.defineProperty(exports,"ReduxModal",{enumerable:!0,get:function(){return _ReduxModal.ReduxModal}}),Object.defineProperty(exports,"buoyReduxMiddleware",{enumerable:!0,get:function(){return _buoyReduxMiddleware.buoyReduxMiddleware}}),Object.defineProperty(exports,"createBuoyReduxMiddleware",{enumerable:!0,get:function(){return _buoyReduxMiddleware.createBuoyReduxMiddleware}}),Object.defineProperty(exports,"createReduxHistoryAdapter",{enumerable:!0,get:function(){return _createReduxHistoryAdapter.createReduxHistoryAdapter}}),Object.defineProperty(exports,"createReduxTool",{enumerable:!0,get:function(){return _preset.createReduxTool}}),Object.defineProperty(exports,"jumpToState",{enumerable:!0,get:function(){return _buoyReduxMiddleware.jumpToState}}),Object.defineProperty(exports,"reduxActionStore",{enumerable:!0,get:function(){return _reduxActionStore.reduxActionStore}}),Object.defineProperty(exports,"reduxHistoryAdapter",{enumerable:!0,get:function(){return _createReduxHistoryAdapter.reduxHistoryAdapter}}),Object.defineProperty(exports,"reduxToolPreset",{enumerable:!0,get:function(){return _preset.reduxToolPreset}}),Object.defineProperty(exports,"replayAction",{enumerable:!0,get:function(){return _buoyReduxMiddleware.replayAction}}),Object.defineProperty(exports,"useReduxActions",{enumerable:!0,get:function(){return _useReduxActions.useReduxActions}}),Object.defineProperty(exports,"withBuoyDevTools",{enumerable:!0,get:function(){return _buoyReduxMiddleware.withBuoyDevTools}});var _preset=require("./preset"),_buoyReduxMiddleware=require("./redux/utils/buoyReduxMiddleware"),_createReduxHistoryAdapter=require("./redux/utils/createReduxHistoryAdapter"),_useReduxActions=require("./redux/hooks/useReduxActions"),_ReduxModal=require("./redux/components/ReduxModal"),_ReduxActionItem=require("./redux/components/ReduxActionItem"),_ReduxActionDetailView=require("./redux/components/ReduxActionDetailView"),_ReduxActionDetailContent=require("./redux/components/ReduxActionDetailContent"),_ReduxIcon=require("./redux/components/ReduxIcon"),_reduxActionStore=require("./redux/utils/reduxActionStore");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"BUOY_JUMP_TO_STATE",{enumerable:!0,get:function(){return _buoyReduxMiddleware.BUOY_JUMP_TO_STATE}}),Object.defineProperty(exports,"BUOY_REPLAY_ACTION",{enumerable:!0,get:function(){return _buoyReduxMiddleware.BUOY_REPLAY_ACTION}}),Object.defineProperty(exports,"FREE_TIER_ACTION_LIMIT",{enumerable:!0,get:function(){return _ReduxModal.FREE_TIER_ACTION_LIMIT}}),Object.defineProperty(exports,"ReduxActionDetailContent",{enumerable:!0,get:function(){return _ReduxActionDetailContent.ReduxActionDetailContent}}),Object.defineProperty(exports,"ReduxActionDetailFooter",{enumerable:!0,get:function(){return _ReduxActionDetailContent.ReduxActionDetailFooter}}),Object.defineProperty(exports,"ReduxActionDetailView",{enumerable:!0,get:function(){return _ReduxActionDetailView.ReduxActionDetailView}}),Object.defineProperty(exports,"ReduxActionItem",{enumerable:!0,get:function(){return _ReduxActionItem.ReduxActionItem}}),Object.defineProperty(exports,"ReduxIcon",{enumerable:!0,get:function(){return _ReduxIcon.ReduxIcon}}),Object.defineProperty(exports,"ReduxModal",{enumerable:!0,get:function(){return _ReduxModal.ReduxModal}}),Object.defineProperty(exports,"buoyReduxMiddleware",{enumerable:!0,get:function(){return _buoyReduxMiddleware.buoyReduxMiddleware}}),Object.defineProperty(exports,"createBuoyReduxMiddleware",{enumerable:!0,get:function(){return _buoyReduxMiddleware.createBuoyReduxMiddleware}}),Object.defineProperty(exports,"createReduxHistoryAdapter",{enumerable:!0,get:function(){return _createReduxHistoryAdapter.createReduxHistoryAdapter}}),Object.defineProperty(exports,"createReduxTool",{enumerable:!0,get:function(){return _preset.createReduxTool}}),Object.defineProperty(exports,"getActiveStore",{enumerable:!0,get:function(){return _autoInstrument.getActiveStore}}),Object.defineProperty(exports,"instrumentStore",{enumerable:!0,get:function(){return _autoInstrument.instrumentStore}}),Object.defineProperty(exports,"isAutoInstrumentActive",{enumerable:!0,get:function(){return _autoInstrument.isAutoInstrumentActive}}),Object.defineProperty(exports,"isStoreInstrumented",{enumerable:!0,get:function(){return _autoInstrument.isStoreInstrumented}}),Object.defineProperty(exports,"jumpToState",{enumerable:!0,get:function(){return _buoyReduxMiddleware.jumpToState}}),Object.defineProperty(exports,"reduxActionStore",{enumerable:!0,get:function(){return _reduxActionStore.reduxActionStore}}),Object.defineProperty(exports,"reduxHistoryAdapter",{enumerable:!0,get:function(){return _createReduxHistoryAdapter.reduxHistoryAdapter}}),Object.defineProperty(exports,"reduxToolPreset",{enumerable:!0,get:function(){return _preset.reduxToolPreset}}),Object.defineProperty(exports,"replayAction",{enumerable:!0,get:function(){return _buoyReduxMiddleware.replayAction}}),Object.defineProperty(exports,"uninstrumentStore",{enumerable:!0,get:function(){return _autoInstrument.uninstrumentStore}}),Object.defineProperty(exports,"useAutoInstrumentRedux",{enumerable:!0,get:function(){return _useAutoInstrumentRedux.useAutoInstrumentRedux}}),Object.defineProperty(exports,"useReduxActions",{enumerable:!0,get:function(){return _useReduxActions.useReduxActions}}),Object.defineProperty(exports,"useReduxAvailability",{enumerable:!0,get:function(){return _useAutoInstrumentRedux.useReduxAvailability}}),Object.defineProperty(exports,"withBuoyDevTools",{enumerable:!0,get:function(){return _buoyReduxMiddleware.withBuoyDevTools}});var _preset=require("./preset"),_buoyReduxMiddleware=require("./redux/utils/buoyReduxMiddleware"),_autoInstrument=require("./redux/utils/autoInstrument"),_createReduxHistoryAdapter=require("./redux/utils/createReduxHistoryAdapter"),_useReduxActions=require("./redux/hooks/useReduxActions"),_useAutoInstrumentRedux=require("./redux/hooks/useAutoInstrumentRedux"),_ReduxModal=require("./redux/components/ReduxModal"),_ReduxActionItem=require("./redux/components/ReduxActionItem"),_ReduxActionDetailView=require("./redux/components/ReduxActionDetailView"),_ReduxActionDetailContent=require("./redux/components/ReduxActionDetailContent"),_ReduxIcon=require("./redux/components/ReduxIcon"),_reduxActionStore=require("./redux/utils/reduxActionStore");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FREE_TIER_ACTION_LIMIT=void 0,exports.ReduxModal=ReduxModal;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_license=require("@buoy-gg/license"),_useReduxActions=require("../hooks/useReduxActions"),_ReduxActionItem=require("./ReduxActionItem"),_ReduxActionDetailContent=require("./ReduxActionDetailContent"),_jsxRuntime=require("react/jsx-runtime");const FREE_TIER_ACTION_LIMIT=exports.FREE_TIER_ACTION_LIMIT=25;function EmptyState({isEnabled:e}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyState,children:[(0,_jsxRuntime.jsx)(_sharedUi.Zap,{size:32,color:_sharedUi.macOSColors.text.muted}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyTitle,children:"No Redux actions"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyText,children:e?"Actions will appear here as they are dispatched":"Enable capture to start recording actions"})]})}function ReduxModal({visible:e,onClose:t,onBack:a,onMinimize:r,enableSharedModalDimensions:s=!1}){const i=(0,_license.useIsPro)(),[o,n]=(0,_react.useState)(!1),{filteredActions:l,filter:c,setFilter:d,stats:h,clearActions:u,isEnabled:_,toggleCapture:x}=(0,_useReduxActions.useReduxActions)(),m=(0,_react.useMemo)(()=>i?l:l.slice(0,FREE_TIER_ACTION_LIMIT),[l,i]),C=(0,_react.useMemo)(()=>i?0:Math.max(0,l.length-FREE_TIER_ACTION_LIMIT),[l.length,i]),y=C>0,[g,p]=(0,_react.useState)(null),j=(0,_react.useRef)([]);j.current=m;const R=null!==g?m[g]:null,[b,S]=(0,_react.useState)(""),[U,T]=(0,_react.useState)(!1),f=(0,_react.useRef)(null),O=(0,_react.useRef)(null),v=(0,_react.useCallback)(e=>{},[]),I=e=>{S(e),d(t=>({...t,searchText:e}))},A=(0,_react.useCallback)(e=>{const t=j.current.findIndex(t=>t.id===e.id);p(t>=0?t:0)},[]),N=(0,_react.useCallback)(()=>{n(!0)},[]),k=(0,_react.useCallback)(()=>{p(null)},[]),B=(0,_react.useCallback)(e=>{p(e)},[]),w=(0,_react.useCallback)(e=>e.id,[]),z=(0,_react.useCallback)(({item:e})=>(0,_jsxRuntime.jsx)(_ReduxActionItem.ReduxActionItem,{action:e,onPress:A}),[A]),E=s?_sharedUi.devToolsStorageKeys.modal.root():"buoy-redux-modal";if(!e)return null;const M=R&&null!==g?(0,_jsxRuntime.jsx)(_ReduxActionDetailContent.ReduxActionDetailFooter,{action:R,actions:m,selectedIndex:g,onIndexChange:B}):null,P=R&&m.length>1?68:0;return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{visible:e,onClose:t,onMinimize:r,persistenceKey:E,header:{showToggleButton:!0,customContent:R?(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:k}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:R.type,centered:!0})]}):(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[a&&(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:a}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"",children:U?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.headerSearchContainer,children:[(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:14,color:_sharedUi.macOSColors.text.secondary}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:f,style:styles.headerSearchInput,placeholder:"Search action types...",placeholderTextColor:_sharedUi.macOSColors.text.muted,value:b,onChangeText:I,onSubmitEditing:()=>T(!1),onBlur:()=>T(!1),autoCapitalize:"none",autoCorrect:!1,returnKeyType:"search"}),b.length>0&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>{I(""),T(!1)},style:styles.headerSearchClear,children:(0,_jsxRuntime.jsx)(_sharedUi.X,{size:14,color:_sharedUi.macOSColors.text.secondary})})]}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.headerChipRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.headerChip,!c.onlyWithChanges&&styles.headerChipActive],onPress:()=>d(e=>({...e,onlyWithChanges:!1})),children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.headerChipLabel,children:"ALL"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.headerChipValue,{color:_sharedUi.macOSColors.text.primary}],children:h.totalActions})]}),(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.headerChip,c.onlyWithChanges&&styles.headerChipActive],onPress:()=>d(e=>({...e,onlyWithChanges:!0})),children:[(0,_jsxRuntime.jsx)(_sharedUi.Zap,{size:12,color:_sharedUi.macOSColors.semantic.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.headerChipValue,{color:_sharedUi.macOSColors.semantic.warning}],children:h.actionsWithChanges})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.headerChip,children:[(0,_jsxRuntime.jsx)(_sharedUi.CheckCircle,{size:12,color:_sharedUi.macOSColors.semantic.success}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.headerChipValue,{color:_sharedUi.macOSColors.semantic.success}],children:h.uniqueActionTypes})]})]})}),(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader.Actions,{children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>T(!0),style:styles.headerActionButton,children:(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:14,color:_sharedUi.macOSColors.text.secondary})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:async()=>{if(!i)return void n(!0);const e=l.map(e=>({id:e.id,type:e.type,...void 0!==e.payload&&{payload:e.payload},timestamp:e.timestamp,prevState:e.prevState,nextState:e.nextState,hasStateChange:e.hasStateChange}));await(0,_sharedUi.copyToClipboard)(e)},style:[styles.headerActionButton,0===l.length&&styles.headerActionButtonDisabled],disabled:0===l.length,children:(0,_jsxRuntime.jsx)(_sharedUi.Copy,{size:14,color:l.length>0?_sharedUi.macOSColors.text.secondary:_sharedUi.macOSColors.text.disabled})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:x,style:[styles.headerActionButton,_?styles.startButton:styles.stopButton],children:(0,_jsxRuntime.jsx)(_sharedUi.Power,{size:14,color:_?_sharedUi.macOSColors.semantic.success:_sharedUi.macOSColors.semantic.error})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:u,style:[styles.headerActionButton,0===l.length&&styles.headerActionButtonDisabled],disabled:0===l.length,children:(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:14,color:l.length>0?_sharedUi.macOSColors.text.muted:_sharedUi.macOSColors.text.disabled})})]})]})},onModeChange:v,enablePersistence:!0,initialMode:"bottomSheet",enableGlitchEffects:!0,styles:{},footer:M,footerHeight:P,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,children:R&&null!==g?(0,_jsxRuntime.jsx)(_ReduxActionDetailContent.ReduxActionDetailContent,{action:R,actions:m,selectedIndex:g,onIndexChange:B,disableInternalFooter:!0}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[!_&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.disabledBanner,children:[(0,_jsxRuntime.jsx)(_sharedUi.Power,{size:14,color:_sharedUi.macOSColors.semantic.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.disabledText,children:"Action capture is disabled"})]}),y&&(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.lockedBanner,onPress:N,activeOpacity:.8,children:[(0,_jsxRuntime.jsx)(_sharedUi.Lock,{size:14,color:_sharedUi.buoyColors.primary}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.lockedText,children:[C," older ",1===C?"action":"actions"," locked"]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.upgradeBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.upgradeBadgeText,children:"UPGRADE"})})]}),m.length>0?(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:O,data:m,renderItem:z,keyExtractor:w,contentContainerStyle:styles.listContent,showsVerticalScrollIndicator:!0,removeClippedSubviews:!0,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:!1}):(0,_jsxRuntime.jsx)(EmptyState,{isEnabled:_})]})})}),(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:o,onClose:()=>n(!1),featureName:"Full Action History"})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:_sharedUi.macOSColors.background.base},headerSearchContainer:{flexDirection:"row",alignItems:"center",backgroundColor:_sharedUi.macOSColors.background.input,borderRadius:10,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default,paddingHorizontal:12,paddingVertical:5},headerSearchInput:{flex:1,color:_sharedUi.macOSColors.text.primary,fontSize:13,marginLeft:6,paddingVertical:2},headerSearchClear:{marginLeft:6,padding:4},headerChipRow:{flexDirection:"row",alignItems:"center",gap:8},headerChip:{flexDirection:"row",alignItems:"center",gap:4,backgroundColor:_sharedUi.macOSColors.background.hover,paddingHorizontal:10,paddingVertical:5,borderRadius:12,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default},headerChipActive:{backgroundColor:_sharedUi.macOSColors.semantic.infoBackground,borderColor:_sharedUi.macOSColors.semantic.info+"50"},headerChipLabel:{fontSize:10,fontWeight:"700",color:_sharedUi.macOSColors.text.muted},headerChipValue:{fontSize:12,fontWeight:"600",fontFamily:"monospace"},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:_sharedUi.macOSColors.background.hover,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default,alignItems:"center",justifyContent:"center"},headerActionButtonDisabled:{opacity:.55},startButton:{backgroundColor:_sharedUi.macOSColors.semantic.successBackground,borderColor:_sharedUi.macOSColors.semantic.success+"40"},stopButton:{backgroundColor:_sharedUi.macOSColors.semantic.errorBackground,borderColor:_sharedUi.macOSColors.semantic.error+"40"},disabledBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:_sharedUi.macOSColors.semantic.warningBackground,borderRadius:8,borderWidth:1,borderColor:_sharedUi.macOSColors.semantic.warning+"20"},disabledText:{color:_sharedUi.macOSColors.semantic.warning,fontSize:11,flex:1},listContent:{paddingTop:8,paddingBottom:20},emptyState:{alignItems:"center",paddingVertical:40},emptyTitle:{color:_sharedUi.macOSColors.text.primary,fontSize:14,fontWeight:"600",marginTop:12,marginBottom:6},emptyText:{color:_sharedUi.macOSColors.text.muted,fontSize:12,textAlign:"center"},lockedBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:_sharedUi.buoyColors.primary+"15",borderRadius:8,borderWidth:1,borderColor:_sharedUi.buoyColors.primary+"33"},lockedText:{color:_sharedUi.buoyColors.primary,fontSize:11,fontWeight:"500",flex:1},upgradeBadge:{backgroundColor:_sharedUi.buoyColors.primary,paddingHorizontal:8,paddingVertical:3,borderRadius:4},upgradeBadgeText:{color:"#fff",fontSize:9,fontWeight:"700",letterSpacing:.5}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FREE_TIER_ACTION_LIMIT=void 0,exports.ReduxModal=ReduxModal;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_license=require("@buoy-gg/license"),_useReduxActions=require("../hooks/useReduxActions"),_useAutoInstrumentRedux=require("../hooks/useAutoInstrumentRedux"),_ReduxActionItem=require("./ReduxActionItem"),_ReduxActionDetailContent=require("./ReduxActionDetailContent"),_jsxRuntime=require("react/jsx-runtime");const FREE_TIER_ACTION_LIMIT=exports.FREE_TIER_ACTION_LIMIT=25;function EmptyState({isEnabled:e}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyState,children:[(0,_jsxRuntime.jsx)(_sharedUi.Zap,{size:32,color:_sharedUi.macOSColors.text.muted}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyTitle,children:"No Redux actions"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyText,children:e?"Actions will appear here as they are dispatched":"Enable capture to start recording actions"})]})}function ReduxModal({visible:e,onClose:t,onBack:r,onMinimize:a,enableSharedModalDimensions:s=!1}){const i=(0,_license.useIsPro)(),[o,n]=(0,_react.useState)(!1),{isInstrumented:l,isLoading:d,error:c,isReactReduxAvailable:u}=(0,_useAutoInstrumentRedux.useAutoInstrumentRedux)(),{filteredActions:h,filter:x,setFilter:_,stats:m,clearActions:C,isEnabled:g,toggleCapture:y}=(0,_useReduxActions.useReduxActions)(),p=(0,_react.useMemo)(()=>i?h:h.slice(0,FREE_TIER_ACTION_LIMIT),[h,i]),j=(0,_react.useMemo)(()=>i?0:Math.max(0,h.length-FREE_TIER_ACTION_LIMIT),[h.length,i]),R=j>0,[b,S]=(0,_react.useState)(null),U=(0,_react.useRef)([]);U.current=p;const T=null!==b?p[b]:null,[f,v]=(0,_react.useState)(""),[O,I]=(0,_react.useState)(!1),A=(0,_react.useRef)(null),k=(0,_react.useRef)(null),N=(0,_react.useCallback)(e=>{},[]),w=e=>{v(e),_(t=>({...t,searchText:e}))},B=(0,_react.useCallback)(e=>{const t=U.current.findIndex(t=>t.id===e.id);S(t>=0?t:0)},[]),z=(0,_react.useCallback)(()=>{n(!0)},[]),E=(0,_react.useCallback)(()=>{S(null)},[]),M=(0,_react.useCallback)(e=>{S(e)},[]),P=(0,_react.useCallback)(e=>e.id,[]),V=(0,_react.useCallback)(({item:e})=>(0,_jsxRuntime.jsx)(_ReduxActionItem.ReduxActionItem,{action:e,onPress:B}),[B]),D=s?_sharedUi.devToolsStorageKeys.modal.root():"buoy-redux-modal";if(!e)return null;const W=T&&null!==b?(0,_jsxRuntime.jsx)(_ReduxActionDetailContent.ReduxActionDetailFooter,{action:T,actions:p,selectedIndex:b,onIndexChange:M}):null,H=T&&p.length>1?68:0;return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{visible:e,onClose:t,onMinimize:a,persistenceKey:D,header:{showToggleButton:!0,customContent:T?(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:E}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:T.type,centered:!0})]}):(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[r&&(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:r}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"",children:O?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.headerSearchContainer,children:[(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:14,color:_sharedUi.macOSColors.text.secondary}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{ref:A,style:styles.headerSearchInput,placeholder:"Search action types...",placeholderTextColor:_sharedUi.macOSColors.text.muted,value:f,onChangeText:w,onSubmitEditing:()=>I(!1),onBlur:()=>I(!1),autoCapitalize:"none",autoCorrect:!1,returnKeyType:"search"}),f.length>0&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>{w(""),I(!1)},style:styles.headerSearchClear,children:(0,_jsxRuntime.jsx)(_sharedUi.X,{size:14,color:_sharedUi.macOSColors.text.secondary})})]}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.headerChipRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.headerChip,!x.onlyWithChanges&&styles.headerChipActive],onPress:()=>_(e=>({...e,onlyWithChanges:!1})),children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.headerChipLabel,children:"ALL"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.headerChipValue,{color:_sharedUi.macOSColors.text.primary}],children:m.totalActions})]}),(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.headerChip,x.onlyWithChanges&&styles.headerChipActive],onPress:()=>_(e=>({...e,onlyWithChanges:!0})),children:[(0,_jsxRuntime.jsx)(_sharedUi.Zap,{size:12,color:_sharedUi.macOSColors.semantic.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.headerChipValue,{color:_sharedUi.macOSColors.semantic.warning}],children:m.actionsWithChanges})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.headerChip,children:[(0,_jsxRuntime.jsx)(_sharedUi.CheckCircle,{size:12,color:_sharedUi.macOSColors.semantic.success}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.headerChipValue,{color:_sharedUi.macOSColors.semantic.success}],children:m.uniqueActionTypes})]})]})}),(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader.Actions,{children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>I(!0),style:styles.headerActionButton,children:(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:14,color:_sharedUi.macOSColors.text.secondary})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:async()=>{if(!i)return void n(!0);const e=h.map(e=>({id:e.id,type:e.type,...void 0!==e.payload&&{payload:e.payload},timestamp:e.timestamp,prevState:e.prevState,nextState:e.nextState,hasStateChange:e.hasStateChange}));await(0,_sharedUi.copyToClipboard)(e)},style:[styles.headerActionButton,0===h.length&&styles.headerActionButtonDisabled],disabled:0===h.length,children:(0,_jsxRuntime.jsx)(_sharedUi.Copy,{size:14,color:h.length>0?_sharedUi.macOSColors.text.secondary:_sharedUi.macOSColors.text.disabled})}),(0,_jsxRuntime.jsx)(_sharedUi.PowerToggleButton,{isEnabled:g,onToggle:y,accessibilityLabel:"Toggle Redux action capture"}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:C,style:[styles.headerActionButton,0===h.length&&styles.headerActionButtonDisabled],disabled:0===h.length,children:(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:14,color:h.length>0?_sharedUi.macOSColors.text.muted:_sharedUi.macOSColors.text.disabled})})]})]})},onModeChange:N,enablePersistence:!0,initialMode:"bottomSheet",enableGlitchEffects:!0,styles:{},footer:W,footerHeight:H,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,children:T&&null!==b?(0,_jsxRuntime.jsx)(_ReduxActionDetailContent.ReduxActionDetailContent,{action:T,actions:p,selectedIndex:b,onIndexChange:M,disableInternalFooter:!0}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[c&&!l&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.errorBanner,children:[(0,_jsxRuntime.jsx)(_sharedUi.AlertTriangle,{size:14,color:_sharedUi.macOSColors.semantic.error}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.errorText,children:u?"Not inside a Redux Provider. Wrap your app with <Provider store={store}>.":"react-redux not installed. Run: npm install react-redux"})]}),!g&&l&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.disabledBanner,children:[(0,_jsxRuntime.jsx)(_sharedUi.Power,{size:14,color:_sharedUi.macOSColors.semantic.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.disabledText,children:"Action capture is disabled"})]}),R&&(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.lockedBanner,onPress:z,activeOpacity:.8,children:[(0,_jsxRuntime.jsx)(_sharedUi.Lock,{size:14,color:_sharedUi.buoyColors.primary}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.lockedText,children:[j," older ",1===j?"action":"actions"," locked"]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.upgradeBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.upgradeBadgeText,children:"UPGRADE"})})]}),p.length>0?(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:k,data:p,renderItem:V,keyExtractor:P,contentContainerStyle:styles.listContent,showsVerticalScrollIndicator:!0,removeClippedSubviews:!0,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:!1}):(0,_jsxRuntime.jsx)(EmptyState,{isEnabled:g})]})})}),(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:o,onClose:()=>n(!1),featureName:"Full Action History"})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:_sharedUi.macOSColors.background.base},headerSearchContainer:{flexDirection:"row",alignItems:"center",backgroundColor:_sharedUi.macOSColors.background.input,borderRadius:10,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default,paddingHorizontal:12,paddingVertical:5},headerSearchInput:{flex:1,color:_sharedUi.macOSColors.text.primary,fontSize:13,marginLeft:6,paddingVertical:2},headerSearchClear:{marginLeft:6,padding:4},headerChipRow:{flexDirection:"row",alignItems:"center",gap:8},headerChip:{flexDirection:"row",alignItems:"center",gap:4,backgroundColor:_sharedUi.macOSColors.background.hover,paddingHorizontal:10,paddingVertical:5,borderRadius:12,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default},headerChipActive:{backgroundColor:_sharedUi.macOSColors.semantic.infoBackground,borderColor:_sharedUi.macOSColors.semantic.info+"50"},headerChipLabel:{fontSize:10,fontWeight:"700",color:_sharedUi.macOSColors.text.muted},headerChipValue:{fontSize:12,fontWeight:"600",fontFamily:"monospace"},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:_sharedUi.macOSColors.background.hover,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default,alignItems:"center",justifyContent:"center"},headerActionButtonDisabled:{opacity:.55},startButton:{backgroundColor:_sharedUi.macOSColors.semantic.successBackground,borderColor:_sharedUi.macOSColors.semantic.success+"40"},stopButton:{backgroundColor:_sharedUi.macOSColors.semantic.errorBackground,borderColor:_sharedUi.macOSColors.semantic.error+"40"},errorBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:_sharedUi.macOSColors.semantic.errorBackground,borderRadius:8,borderWidth:1,borderColor:_sharedUi.macOSColors.semantic.error+"20"},errorText:{color:_sharedUi.macOSColors.semantic.error,fontSize:11,flex:1},disabledBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:_sharedUi.macOSColors.semantic.warningBackground,borderRadius:8,borderWidth:1,borderColor:_sharedUi.macOSColors.semantic.warning+"20"},disabledText:{color:_sharedUi.macOSColors.semantic.warning,fontSize:11,flex:1},listContent:{paddingTop:8,paddingBottom:20},emptyState:{alignItems:"center",paddingVertical:40},emptyTitle:{color:_sharedUi.macOSColors.text.primary,fontSize:14,fontWeight:"600",marginTop:12,marginBottom:6},emptyText:{color:_sharedUi.macOSColors.text.muted,fontSize:12,textAlign:"center"},lockedBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:_sharedUi.buoyColors.primary+"15",borderRadius:8,borderWidth:1,borderColor:_sharedUi.buoyColors.primary+"33"},lockedText:{color:_sharedUi.buoyColors.primary,fontSize:11,fontWeight:"500",flex:1},upgradeBadge:{backgroundColor:_sharedUi.buoyColors.primary,paddingHorizontal:8,paddingVertical:3,borderRadius:4},upgradeBadgeText:{color:"#fff",fontSize:9,fontWeight:"700",letterSpacing:.5}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"useReduxActions",{enumerable:!0,get:function(){return _useReduxActions.useReduxActions}});var _useReduxActions=require("./useReduxActions");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"useAutoInstrumentRedux",{enumerable:!0,get:function(){return _useAutoInstrumentRedux.useAutoInstrumentRedux}}),Object.defineProperty(exports,"useReduxActions",{enumerable:!0,get:function(){return _useReduxActions.useReduxActions}}),Object.defineProperty(exports,"useReduxAvailability",{enumerable:!0,get:function(){return _useAutoInstrumentRedux.useReduxAvailability}});var _useReduxActions=require("./useReduxActions"),_useAutoInstrumentRedux=require("./useAutoInstrumentRedux");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useAutoInstrumentRedux=useAutoInstrumentRedux,exports.useReduxAvailability=useReduxAvailability;var _react=require("react"),_autoInstrument=require("../utils/autoInstrument");function getReactReduxUseStore(){try{return require("react-redux").useStore}catch{return null}}function useAutoInstrumentRedux(e={}){const{autoStart:t=!0,...r}=e,[u,n]=(0,_react.useState)(!1),[a,s]=(0,_react.useState)(!0),[l,i]=(0,_react.useState)(null),[o,c]=(0,_react.useState)(null),d=(0,_react.useRef)(null),x=getReactReduxUseStore(),R=null!==x;let m=null,f=null;if(x)try{m=x()}catch(e){f=e instanceof Error?e.message:"Failed to access Redux store. Make sure your app is wrapped in a Redux Provider."}else f="react-redux is not installed or not available";const v=(0,_react.useCallback)(()=>{if(!m)return i(f||"No Redux store available"),void s(!1);if((0,_autoInstrument.isStoreInstrumented)(m))return n(!0),c(m),s(!1),void i(null);try{const e=(0,_autoInstrument.instrumentStore)(m,r);d.current=e,n(!0),c(m),i(null)}catch(e){i(e instanceof Error?e.message:"Failed to instrument Redux store"),n(!1)}finally{s(!1)}},[m,f,r]),_=(0,_react.useCallback)(()=>{d.current&&(d.current(),d.current=null),o&&(0,_autoInstrument.uninstrumentStore)(o),n(!1),c(null)},[o]);return(0,_react.useEffect)(()=>(t?v():s(!1),()=>{}),[t,v]),{isInstrumented:u,isLoading:a,error:l,isReactReduxAvailable:R,startInstrumentation:v,stopInstrumentation:_,store:o}}function useReduxAvailability(){const e=getReactReduxUseStore();if(!e)return{isAvailable:!1,error:"react-redux is not installed"};try{return{isAvailable:null!=e(),error:null}}catch(e){return{isAvailable:!1,error:e instanceof Error?e.message:"Not inside a Redux Provider"}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getActiveStore=getActiveStore,exports.instrumentStore=instrumentStore,exports.isAutoInstrumentActive=isAutoInstrumentActive,exports.isStoreInstrumented=isStoreInstrumented,exports.isTimeTravelEnabled=isTimeTravelEnabled,exports.jumpToState=jumpToState,exports.replayAction=replayAction,exports.uninstrumentStore=uninstrumentStore;var _reduxActionStore=require("./reduxActionStore"),_buoyReduxMiddleware=require("./buoyReduxMiddleware");const INSTRUMENTED_SYMBOL=Symbol.for("@@buoy/instrumented"),ORIGINAL_DISPATCH_SYMBOL=Symbol.for("@@buoy/originalDispatch"),ORIGINAL_REDUCER_SYMBOL=Symbol.for("@@buoy/originalReducer");let activeStore=null,timeTravelEnabled=!1;function isStoreInstrumented(e){return!0===e[INSTRUMENTED_SYMBOL]}function instrumentStore(e,t={}){const r=e;if((0,_buoyReduxMiddleware.isMiddlewareActive)())return activeStore=e,()=>{};if(r[INSTRUMENTED_SYMBOL])return activeStore=e,()=>{};const{enableTimeTravel:n=!1,maxActions:o=200,ignoreActions:i=[]}=t;_reduxActionStore.reduxActionStore.setMaxActions(o);const u=e.dispatch.bind(e);return r[ORIGINAL_DISPATCH_SYMBOL]=u,e.dispatch=t=>{if("object"!=typeof t||null===t||"string"!=typeof t.type)return u(t);const r=t.type;if(r.startsWith("@@buoy/"))return u(t);if(r.startsWith("@@redux/"))return u(t);if(i.includes(r))return u(t);const n=performance.now(),o=e.getState(),a=u(t),c=e.getState(),s=performance.now()-n;return _reduxActionStore.reduxActionStore.addAction(t,o,c,s),a},r[INSTRUMENTED_SYMBOL]=!0,activeStore=e,n&&"function"==typeof e.replaceReducer&&enableTimeTravelSupport(e),()=>{uninstrumentStore(e)}}function uninstrumentStore(e){const t=e;if(!t[INSTRUMENTED_SYMBOL])return;const r=t[ORIGINAL_DISPATCH_SYMBOL];r&&(e.dispatch=r);const n=t[ORIGINAL_REDUCER_SYMBOL];n&&"function"==typeof e.replaceReducer&&(e.replaceReducer(n),timeTravelEnabled=!1),delete t[INSTRUMENTED_SYMBOL],delete t[ORIGINAL_DISPATCH_SYMBOL],delete t[ORIGINAL_REDUCER_SYMBOL],activeStore===e&&(activeStore=null)}function enableTimeTravelSupport(e){const t=e,r=e.getState();t[ORIGINAL_REDUCER_SYMBOL]=(e=r,t)=>t.type===_buoyReduxMiddleware.BUOY_JUMP_TO_STATE?t.payload:e,timeTravelEnabled=!0}function jumpToState(e){activeStore?activeStore.dispatch({type:_buoyReduxMiddleware.BUOY_JUMP_TO_STATE,payload:e}):console.warn("[BuoyRedux] Cannot jump to state - no store instrumented")}function replayAction(e){activeStore?activeStore.dispatch(e):console.warn("[BuoyRedux] Cannot replay action - no store instrumented")}function getActiveStore(){return activeStore}function isAutoInstrumentActive(){return null!==activeStore&&isStoreInstrumented(activeStore)}function isTimeTravelEnabled(){return timeTravelEnabled}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buoyReduxMiddleware=exports.BUOY_REPLAY_ACTION=exports.BUOY_JUMP_TO_STATE=void 0,exports.createBuoyReduxMiddleware=createBuoyReduxMiddleware,exports.jumpToState=jumpToState,exports.replayAction=replayAction,exports.withBuoyDevTools=withBuoyDevTools;var _reduxActionStore=require("./reduxActionStore");const BUOY_JUMP_TO_STATE=exports.BUOY_JUMP_TO_STATE="@@buoy/JUMP_TO_STATE",BUOY_REPLAY_ACTION=exports.BUOY_REPLAY_ACTION="@@buoy/REPLAY_ACTION";let storeDispatch=null;function jumpToState(e){storeDispatch?storeDispatch({type:BUOY_JUMP_TO_STATE,payload:e}):console.warn("[BuoyRedux] Cannot jump to state - middleware not initialized")}function replayAction(e){storeDispatch?storeDispatch(e):console.warn("[BuoyRedux] Cannot replay action - middleware not initialized")}function withBuoyDevTools(e){return(t,o)=>o.type===BUOY_JUMP_TO_STATE?o.payload:e(t,o)}const buoyReduxMiddleware=e=>(storeDispatch=e.dispatch,t=>o=>{const r=o,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buoyReduxMiddleware=exports.BUOY_REPLAY_ACTION=exports.BUOY_JUMP_TO_STATE=void 0,exports.createBuoyReduxMiddleware=createBuoyReduxMiddleware,exports.isMiddlewareActive=isMiddlewareActive,exports.jumpToState=jumpToState,exports.replayAction=replayAction,exports.withBuoyDevTools=withBuoyDevTools;var _reduxActionStore=require("./reduxActionStore");let middlewareActive=!1;function isMiddlewareActive(){return middlewareActive}const BUOY_JUMP_TO_STATE=exports.BUOY_JUMP_TO_STATE="@@buoy/JUMP_TO_STATE",BUOY_REPLAY_ACTION=exports.BUOY_REPLAY_ACTION="@@buoy/REPLAY_ACTION";let storeDispatch=null;function jumpToState(e){storeDispatch?storeDispatch({type:BUOY_JUMP_TO_STATE,payload:e}):console.warn("[BuoyRedux] Cannot jump to state - middleware not initialized")}function replayAction(e){storeDispatch?storeDispatch(e):console.warn("[BuoyRedux] Cannot replay action - middleware not initialized")}function withBuoyDevTools(e){return(t,o)=>o.type===BUOY_JUMP_TO_STATE?o.payload:e(t,o)}const buoyReduxMiddleware=e=>(middlewareActive=!0,storeDispatch=e.dispatch,t=>o=>{const r=o,i=r.type;if(i?.startsWith("@@buoy/"))return t(o);const n=performance.now(),a=e.getState(),d=t(o),c=e.getState(),s=performance.now()-n;return _reduxActionStore.reduxActionStore.addAction(r,a,c,s),d});function createBuoyReduxMiddleware(e={}){const{maxActions:t=200,ignoreActions:o=[]}=e;return _reduxActionStore.reduxActionStore.setMaxActions(t),e=>(middlewareActive=!0,storeDispatch=e.dispatch,t=>r=>{const i=r,n=i.type||"";if(n?.startsWith("@@buoy/"))return t(r);if(o.includes(n))return t(r);const a=performance.now(),d=e.getState(),c=t(r),s=e.getState(),u=performance.now()-a;return _reduxActionStore.reduxActionStore.addAction(i,d,s,u),c})}exports.buoyReduxMiddleware=buoyReduxMiddleware;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"BUOY_JUMP_TO_STATE",{enumerable:!0,get:function(){return _buoyReduxMiddleware.BUOY_JUMP_TO_STATE}}),Object.defineProperty(exports,"BUOY_REPLAY_ACTION",{enumerable:!0,get:function(){return _buoyReduxMiddleware.BUOY_REPLAY_ACTION}}),Object.defineProperty(exports,"buoyReduxMiddleware",{enumerable:!0,get:function(){return _buoyReduxMiddleware.buoyReduxMiddleware}}),Object.defineProperty(exports,"createBuoyReduxMiddleware",{enumerable:!0,get:function(){return _buoyReduxMiddleware.createBuoyReduxMiddleware}}),Object.defineProperty(exports,"createReduxHistoryAdapter",{enumerable:!0,get:function(){return _createReduxHistoryAdapter.createReduxHistoryAdapter}}),Object.defineProperty(exports,"jumpToState",{enumerable:!0,get:function(){return _buoyReduxMiddleware.jumpToState}}),Object.defineProperty(exports,"reduxActionStore",{enumerable:!0,get:function(){return _reduxActionStore.reduxActionStore}}),Object.defineProperty(exports,"reduxHistoryAdapter",{enumerable:!0,get:function(){return _createReduxHistoryAdapter.reduxHistoryAdapter}}),Object.defineProperty(exports,"replayAction",{enumerable:!0,get:function(){return _buoyReduxMiddleware.replayAction}}),Object.defineProperty(exports,"withBuoyDevTools",{enumerable:!0,get:function(){return _buoyReduxMiddleware.withBuoyDevTools}});var _reduxActionStore=require("./reduxActionStore"),_buoyReduxMiddleware=require("./buoyReduxMiddleware"),_createReduxHistoryAdapter=require("./createReduxHistoryAdapter");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"BUOY_JUMP_TO_STATE",{enumerable:!0,get:function(){return _buoyReduxMiddleware.BUOY_JUMP_TO_STATE}}),Object.defineProperty(exports,"BUOY_REPLAY_ACTION",{enumerable:!0,get:function(){return _buoyReduxMiddleware.BUOY_REPLAY_ACTION}}),Object.defineProperty(exports,"autoJumpToState",{enumerable:!0,get:function(){return _autoInstrument.jumpToState}}),Object.defineProperty(exports,"autoReplayAction",{enumerable:!0,get:function(){return _autoInstrument.replayAction}}),Object.defineProperty(exports,"buoyReduxMiddleware",{enumerable:!0,get:function(){return _buoyReduxMiddleware.buoyReduxMiddleware}}),Object.defineProperty(exports,"createBuoyReduxMiddleware",{enumerable:!0,get:function(){return _buoyReduxMiddleware.createBuoyReduxMiddleware}}),Object.defineProperty(exports,"createReduxHistoryAdapter",{enumerable:!0,get:function(){return _createReduxHistoryAdapter.createReduxHistoryAdapter}}),Object.defineProperty(exports,"getActiveStore",{enumerable:!0,get:function(){return _autoInstrument.getActiveStore}}),Object.defineProperty(exports,"instrumentStore",{enumerable:!0,get:function(){return _autoInstrument.instrumentStore}}),Object.defineProperty(exports,"isAutoInstrumentActive",{enumerable:!0,get:function(){return _autoInstrument.isAutoInstrumentActive}}),Object.defineProperty(exports,"isStoreInstrumented",{enumerable:!0,get:function(){return _autoInstrument.isStoreInstrumented}}),Object.defineProperty(exports,"jumpToState",{enumerable:!0,get:function(){return _buoyReduxMiddleware.jumpToState}}),Object.defineProperty(exports,"reduxActionStore",{enumerable:!0,get:function(){return _reduxActionStore.reduxActionStore}}),Object.defineProperty(exports,"reduxHistoryAdapter",{enumerable:!0,get:function(){return _createReduxHistoryAdapter.reduxHistoryAdapter}}),Object.defineProperty(exports,"replayAction",{enumerable:!0,get:function(){return _buoyReduxMiddleware.replayAction}}),Object.defineProperty(exports,"uninstrumentStore",{enumerable:!0,get:function(){return _autoInstrument.uninstrumentStore}}),Object.defineProperty(exports,"withBuoyDevTools",{enumerable:!0,get:function(){return _buoyReduxMiddleware.withBuoyDevTools}});var _reduxActionStore=require("./reduxActionStore"),_buoyReduxMiddleware=require("./buoyReduxMiddleware"),_createReduxHistoryAdapter=require("./createReduxHistoryAdapter"),_autoInstrument=require("./autoInstrument");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function getActionCategory(t){return t.startsWith("@@")?"internal":t.includes("/pending")?"pending":t.includes("/fulfilled")?"fulfilled":t.includes("/rejected")?"rejected":t.includes("/executeQuery")?"query":t.includes("/executeMutation")?"mutation":"action"}function parseActionType(t){if(t.startsWith("@@")){const e=t.split("/");return{sliceName:null,actionName:e[e.length-1]||t}}const e=t.split("/");if(e.length>=2){const t=e[0];let n=e[1];return e.length>=3&&["pending","fulfilled","rejected"].includes(e[e.length-1])&&(n=e.slice(1,-1).join("/")),{sliceName:t,actionName:n.toUpperCase()}}return{sliceName:null,actionName:t.toUpperCase()}}function formatPayloadPreview(t,e=40){if(void 0===t)return"";if(null===t)return"null";try{if("string"==typeof t)return t.length>e?`"${t.slice(0,e-3)}..."`:`"${t}"`;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t)){if(0===t.length)return"[]";const n=JSON.stringify(t);return n.length>e?`[${t.length} items]`:n}if("object"==typeof t){const n=Object.keys(t);if(0===n.length)return"{}";const i=JSON.stringify(t);return i.length<=e?i:`{ ${n.length} keys }`}return String(t).slice(0,e)}catch{return"[complex]"}}function getStateDiffSummary(t,e){if(t===e)return{summary:"no change",changedCount:0};if("object"!=typeof t||"object"!=typeof e||null===t||null===e)return{summary:"changed",changedCount:1};const n=Object.keys(t),i=Object.keys(e),s=i.filter(t=>!n.includes(t)).length,r=n.filter(t=>!i.includes(t)).length;let o=0;for(const s of n)i.includes(s)&&t[s]!==e[s]&&o++;const a=[];s>0&&a.push(`+${s}`),r>0&&a.push(`-${r}`),o>0&&a.push(`~${o}`);const c=s+r+o;return 0===a.length?{summary:"nested change",changedCount:1}:{summary:`${a.join(" ")} ${1===c?"key":"keys"}`,changedCount:c}}function extractMeta(t){const e=t.meta;if(e)return{requestId:e.requestId,requestStatus:e.requestStatus,arg:e.arg,rejectedWithValue:e.rejectedWithValue,aborted:e.aborted,condition:e.condition}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.reduxActionStore=void 0;class ReduxActionStore{actions=[];listeners=new Set;maxActions=200;idCounter=0;isEnabled=!0;addAction(t,e,n,i){if(!this.isEnabled)return;const s=
|
|
1
|
+
"use strict";function getActionCategory(t){return t.startsWith("@@")?"internal":t.includes("/pending")?"pending":t.includes("/fulfilled")?"fulfilled":t.includes("/rejected")?"rejected":t.includes("/executeQuery")?"query":t.includes("/executeMutation")?"mutation":"action"}function parseActionType(t){if(t.startsWith("@@")){const e=t.split("/");return{sliceName:null,actionName:e[e.length-1]||t}}const e=t.split("/");if(e.length>=2){const t=e[0];let n=e[1];return e.length>=3&&["pending","fulfilled","rejected"].includes(e[e.length-1])&&(n=e.slice(1,-1).join("/")),{sliceName:t,actionName:n.toUpperCase()}}return{sliceName:null,actionName:t.toUpperCase()}}function formatPayloadPreview(t,e=40){if(void 0===t)return"";if(null===t)return"null";try{if("string"==typeof t)return t.length>e?`"${t.slice(0,e-3)}..."`:`"${t}"`;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t)){if(0===t.length)return"[]";const n=JSON.stringify(t);return n.length>e?`[${t.length} items]`:n}if("object"==typeof t){const n=Object.keys(t);if(0===n.length)return"{}";const i=JSON.stringify(t);return i.length<=e?i:`{ ${n.length} keys }`}return String(t).slice(0,e)}catch{return"[complex]"}}function getStateDiffSummary(t,e){if(t===e)return{summary:"no change",changedCount:0};if("object"!=typeof t||"object"!=typeof e||null===t||null===e)return{summary:"changed",changedCount:1};const n=Object.keys(t),i=Object.keys(e),s=i.filter(t=>!n.includes(t)).length,r=n.filter(t=>!i.includes(t)).length;let o=0;for(const s of n)i.includes(s)&&t[s]!==e[s]&&o++;const a=[];s>0&&a.push(`+${s}`),r>0&&a.push(`-${r}`),o>0&&a.push(`~${o}`);const c=s+r+o;return 0===a.length?{summary:"nested change",changedCount:1}:{summary:`${a.join(" ")} ${1===c?"key":"keys"}`,changedCount:c}}function extractMeta(t){const e=t.meta;if(e)return{requestId:e.requestId,requestStatus:e.requestStatus,arg:e.arg,rejectedWithValue:e.rejectedWithValue,aborted:e.aborted,condition:e.condition}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.reduxActionStore=void 0;class ReduxActionStore{actions=[];listeners=new Set;maxActions=200;idCounter=0;isEnabled=!0;addAction(t,e,n,i){if(!this.isEnabled)return;const s=t.type||"";if(!s)return;const r=e!==n,o=getActionCategory(s),{sliceName:a,actionName:c}=parseActionType(s),u=extractMeta(t),l=formatPayloadPreview(t.payload),{summary:d,changedCount:h}=getStateDiffSummary(e,n),f=(i??0)>16,g={id:`${Date.now()}-${++this.idCounter}`,type:s,payload:t.payload,action:t,timestamp:Date.now(),prevState:e,nextState:n,duration:i,hasStateChange:r,category:o,sliceName:a,actionName:c,meta:u,error:t.error,payloadPreview:l,diffSummary:d,changedKeysCount:h,isSlowAction:f};this.actions=[g,...this.actions].slice(0,this.maxActions),this.notifyListeners()}getActions(){return[...this.actions]}getActionById(t){return this.actions.find(e=>e.id===t)}clearActions(){this.actions=[],this.notifyListeners()}setEnabled(t){this.isEnabled=t}getEnabled(){return this.isEnabled}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notifyListeners(){const t=this.getActions();this.listeners.forEach(e=>e(t))}setMaxActions(t){this.maxActions=t,this.actions.length>t&&(this.actions=this.actions.slice(0,t),this.notifyListeners())}getStats(){const t=this.actions.length,e=this.actions.filter(t=>t.hasStateChange).length,n=new Set(this.actions.map(t=>t.type)),i=this.actions.filter(t=>void 0!==t.duration).map(t=>t.duration),s=i.length>0?i.reduce((t,e)=>t+e,0)/i.length:0;return{totalActions:t,actionsWithChanges:e,actionsWithoutChanges:t-e,uniqueActionTypes:n.size,averageDuration:Math.round(100*s)/100}}filterActions(t){let e=[...this.actions];if(t.searchText){const n=t.searchText.toLowerCase();e=e.filter(t=>t.type.toLowerCase().includes(n))}return t.actionTypes&&t.actionTypes.length>0&&(e=e.filter(e=>t.actionTypes.includes(e.type))),t.onlyWithChanges&&(e=e.filter(t=>t.hasStateChange)),e}getUniqueActionTypes(){return Array.from(new Set(this.actions.map(t=>t.type))).sort()}getRelatedActions(t){return this.actions.filter(e=>e.meta?.requestId===t).sort((t,e)=>t.timestamp-e.timestamp)}getLinkedActions(t){return t.meta?.requestId?this.getRelatedActions(t.meta.requestId):[]}getLinkedActionsCount(t){return t.meta?.requestId?this.actions.filter(e=>e.meta?.requestId===t.meta?.requestId).length:0}getAsyncOperationDuration(t){const e=this.getRelatedActions(t);if(e.length<2)return null;const n=e.find(t=>"pending"===t.category),i=e.find(t=>"fulfilled"===t.category||"rejected"===t.category);return n&&i?i.timestamp-n.timestamp:null}getBaseActionType(t){const e=t.split("/");if(e.length>=2){const t=e[e.length-1];if(["pending","fulfilled","rejected"].includes(t))return e.slice(0,-1).join("/")}return t}getAsyncOperationIndex(t){const e=new Map;for(const t of this.actions)t.meta?.requestId&&!e.has(t.meta.requestId)&&e.set(t.meta.requestId,t.timestamp);const n=Array.from(e.entries()).sort((t,e)=>t[1]-e[1]).map(([t])=>t).indexOf(t);return n>=0?n+1:0}}const reduxActionStore=exports.reduxActionStore=new ReduxActionStore;
|
package/lib/module/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{reduxToolPreset,createReduxTool}from"./preset";export{buoyReduxMiddleware,createBuoyReduxMiddleware,withBuoyDevTools,jumpToState,replayAction,BUOY_JUMP_TO_STATE,BUOY_REPLAY_ACTION}from"./redux/utils/buoyReduxMiddleware";export{createReduxHistoryAdapter,reduxHistoryAdapter}from"./redux/utils/createReduxHistoryAdapter";export{useReduxActions}from"./redux/hooks/useReduxActions";export{ReduxModal,FREE_TIER_ACTION_LIMIT}from"./redux/components/ReduxModal";export{ReduxActionItem}from"./redux/components/ReduxActionItem";export{ReduxActionDetailView}from"./redux/components/ReduxActionDetailView";export{ReduxActionDetailContent,ReduxActionDetailFooter}from"./redux/components/ReduxActionDetailContent";export{ReduxIcon}from"./redux/components/ReduxIcon";export{reduxActionStore}from"./redux/utils/reduxActionStore";
|
|
1
|
+
"use strict";export{reduxToolPreset,createReduxTool}from"./preset";export{buoyReduxMiddleware,createBuoyReduxMiddleware,withBuoyDevTools,jumpToState,replayAction,BUOY_JUMP_TO_STATE,BUOY_REPLAY_ACTION}from"./redux/utils/buoyReduxMiddleware";export{instrumentStore,uninstrumentStore,isStoreInstrumented,isAutoInstrumentActive,getActiveStore}from"./redux/utils/autoInstrument";export{createReduxHistoryAdapter,reduxHistoryAdapter}from"./redux/utils/createReduxHistoryAdapter";export{useReduxActions}from"./redux/hooks/useReduxActions";export{useAutoInstrumentRedux,useReduxAvailability}from"./redux/hooks/useAutoInstrumentRedux";export{ReduxModal,FREE_TIER_ACTION_LIMIT}from"./redux/components/ReduxModal";export{ReduxActionItem}from"./redux/components/ReduxActionItem";export{ReduxActionDetailView}from"./redux/components/ReduxActionDetailView";export{ReduxActionDetailContent,ReduxActionDetailFooter}from"./redux/components/ReduxActionDetailContent";export{ReduxIcon}from"./redux/components/ReduxIcon";export{reduxActionStore}from"./redux/utils/reduxActionStore";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useState,useMemo,useRef,useCallback}from"react";import{View,Text,StyleSheet,FlatList,TextInput,TouchableOpacity}from"react-native";import{JsModal,ModalHeader,macOSColors,buoyColors,Search,Trash2,Power,X,Zap,CheckCircle,Copy,Lock,devToolsStorageKeys,copyToClipboard,ProUpgradeModal}from"@buoy-gg/shared-ui";import{useIsPro}from"@buoy-gg/license";import{useReduxActions}from"../hooks/useReduxActions";import{ReduxActionItem}from"./ReduxActionItem";import{ReduxActionDetailContent,ReduxActionDetailFooter}from"./ReduxActionDetailContent";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";export const FREE_TIER_ACTION_LIMIT=25;function EmptyState({isEnabled:e}){return _jsxs(View,{style:styles.emptyState,children:[_jsx(Zap,{size:32,color:macOSColors.text.muted}),_jsx(Text,{style:styles.emptyTitle,children:"No Redux actions"}),_jsx(Text,{style:styles.emptyText,children:e?"Actions will appear here as they are dispatched":"Enable capture to start recording actions"})]})}export function ReduxModal({visible:e,onClose:o,onBack:t,onMinimize:r,enableSharedModalDimensions:
|
|
1
|
+
"use strict";import{useState,useMemo,useRef,useCallback}from"react";import{View,Text,StyleSheet,FlatList,TextInput,TouchableOpacity}from"react-native";import{JsModal,ModalHeader,macOSColors,buoyColors,Search,Trash2,Power,X,Zap,CheckCircle,Copy,Lock,AlertTriangle,devToolsStorageKeys,copyToClipboard,ProUpgradeModal,PowerToggleButton}from"@buoy-gg/shared-ui";import{useIsPro}from"@buoy-gg/license";import{useReduxActions}from"../hooks/useReduxActions";import{useAutoInstrumentRedux}from"../hooks/useAutoInstrumentRedux";import{ReduxActionItem}from"./ReduxActionItem";import{ReduxActionDetailContent,ReduxActionDetailFooter}from"./ReduxActionDetailContent";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";export const FREE_TIER_ACTION_LIMIT=25;function EmptyState({isEnabled:e}){return _jsxs(View,{style:styles.emptyState,children:[_jsx(Zap,{size:32,color:macOSColors.text.muted}),_jsx(Text,{style:styles.emptyTitle,children:"No Redux actions"}),_jsx(Text,{style:styles.emptyText,children:e?"Actions will appear here as they are dispatched":"Enable capture to start recording actions"})]})}export function ReduxModal({visible:e,onClose:o,onBack:t,onMinimize:r,enableSharedModalDimensions:a=!1}){const s=useIsPro(),[l,n]=useState(!1),{isInstrumented:i,isLoading:c,error:d,isReactReduxAvailable:u}=useAutoInstrumentRedux(),{filteredActions:h,filter:m,setFilter:x,stats:g,clearActions:C,isEnabled:p,toggleCapture:y}=useReduxActions(),b=useMemo(()=>s?h:h.slice(0,25),[h,s]),S=useMemo(()=>s?0:Math.max(0,h.length-25),[h.length,s]),f=S>0,[T,_]=useState(null),j=useRef([]);j.current=b;const O=null!==T?b[T]:null,[k,A]=useState(""),[R,w]=useState(!1),B=useRef(null),I=useRef(null),z=useCallback(e=>{},[]),v=e=>{A(e),x(o=>({...o,searchText:e}))},M=useCallback(e=>{const o=j.current.findIndex(o=>o.id===e.id);_(o>=0?o:0)},[]),P=useCallback(()=>{n(!0)},[]),V=useCallback(()=>{_(null)},[]),W=useCallback(e=>{_(e)},[]),D=useCallback(e=>e.id,[]),E=useCallback(({item:e})=>_jsx(ReduxActionItem,{action:e,onPress:M}),[M]),H=a?devToolsStorageKeys.modal.root():"buoy-redux-modal";if(!e)return null;const F=O&&null!==T?_jsx(ReduxActionDetailFooter,{action:O,actions:b,selectedIndex:T,onIndexChange:W}):null,L=O&&b.length>1?68:0;return _jsxs(_Fragment,{children:[_jsx(JsModal,{visible:e,onClose:o,onMinimize:r,persistenceKey:H,header:{showToggleButton:!0,customContent:_jsxs(ModalHeader,O?{children:[_jsx(ModalHeader.Navigation,{onBack:V}),_jsx(ModalHeader.Content,{title:O.type,centered:!0})]}:{children:[t&&_jsx(ModalHeader.Navigation,{onBack:t}),_jsx(ModalHeader.Content,{title:"",children:_jsxs(View,R?{style:styles.headerSearchContainer,children:[_jsx(Search,{size:14,color:macOSColors.text.secondary}),_jsx(TextInput,{ref:B,style:styles.headerSearchInput,placeholder:"Search action types...",placeholderTextColor:macOSColors.text.muted,value:k,onChangeText:v,onSubmitEditing:()=>w(!1),onBlur:()=>w(!1),autoCapitalize:"none",autoCorrect:!1,returnKeyType:"search"}),k.length>0&&_jsx(TouchableOpacity,{onPress:()=>{v(""),w(!1)},style:styles.headerSearchClear,children:_jsx(X,{size:14,color:macOSColors.text.secondary})})]}:{style:styles.headerChipRow,children:[_jsxs(TouchableOpacity,{style:[styles.headerChip,!m.onlyWithChanges&&styles.headerChipActive],onPress:()=>x(e=>({...e,onlyWithChanges:!1})),children:[_jsx(Text,{style:styles.headerChipLabel,children:"ALL"}),_jsx(Text,{style:[styles.headerChipValue,{color:macOSColors.text.primary}],children:g.totalActions})]}),_jsxs(TouchableOpacity,{style:[styles.headerChip,m.onlyWithChanges&&styles.headerChipActive],onPress:()=>x(e=>({...e,onlyWithChanges:!0})),children:[_jsx(Zap,{size:12,color:macOSColors.semantic.warning}),_jsx(Text,{style:[styles.headerChipValue,{color:macOSColors.semantic.warning}],children:g.actionsWithChanges})]}),_jsxs(View,{style:styles.headerChip,children:[_jsx(CheckCircle,{size:12,color:macOSColors.semantic.success}),_jsx(Text,{style:[styles.headerChipValue,{color:macOSColors.semantic.success}],children:g.uniqueActionTypes})]})]})}),_jsxs(ModalHeader.Actions,{children:[_jsx(TouchableOpacity,{onPress:()=>w(!0),style:styles.headerActionButton,children:_jsx(Search,{size:14,color:macOSColors.text.secondary})}),_jsx(TouchableOpacity,{onPress:async()=>{if(!s)return void n(!0);const e=h.map(e=>({id:e.id,type:e.type,...void 0!==e.payload&&{payload:e.payload},timestamp:e.timestamp,prevState:e.prevState,nextState:e.nextState,hasStateChange:e.hasStateChange}));await copyToClipboard(e)},style:[styles.headerActionButton,0===h.length&&styles.headerActionButtonDisabled],disabled:0===h.length,children:_jsx(Copy,{size:14,color:h.length>0?macOSColors.text.secondary:macOSColors.text.disabled})}),_jsx(PowerToggleButton,{isEnabled:p,onToggle:y,accessibilityLabel:"Toggle Redux action capture"}),_jsx(TouchableOpacity,{onPress:C,style:[styles.headerActionButton,0===h.length&&styles.headerActionButtonDisabled],disabled:0===h.length,children:_jsx(Trash2,{size:14,color:h.length>0?macOSColors.text.muted:macOSColors.text.disabled})})]})]})},onModeChange:z,enablePersistence:!0,initialMode:"bottomSheet",enableGlitchEffects:!0,styles:{},footer:F,footerHeight:L,children:_jsx(View,{style:styles.container,children:O&&null!==T?_jsx(ReduxActionDetailContent,{action:O,actions:b,selectedIndex:T,onIndexChange:W,disableInternalFooter:!0}):_jsxs(_Fragment,{children:[d&&!i&&_jsxs(View,{style:styles.errorBanner,children:[_jsx(AlertTriangle,{size:14,color:macOSColors.semantic.error}),_jsx(Text,{style:styles.errorText,children:u?"Not inside a Redux Provider. Wrap your app with <Provider store={store}>.":"react-redux not installed. Run: npm install react-redux"})]}),!p&&i&&_jsxs(View,{style:styles.disabledBanner,children:[_jsx(Power,{size:14,color:macOSColors.semantic.warning}),_jsx(Text,{style:styles.disabledText,children:"Action capture is disabled"})]}),f&&_jsxs(TouchableOpacity,{style:styles.lockedBanner,onPress:P,activeOpacity:.8,children:[_jsx(Lock,{size:14,color:buoyColors.primary}),_jsxs(Text,{style:styles.lockedText,children:[S," older ",1===S?"action":"actions"," locked"]}),_jsx(View,{style:styles.upgradeBadge,children:_jsx(Text,{style:styles.upgradeBadgeText,children:"UPGRADE"})})]}),b.length>0?_jsx(FlatList,{ref:I,data:b,renderItem:E,keyExtractor:D,contentContainerStyle:styles.listContent,showsVerticalScrollIndicator:!0,removeClippedSubviews:!0,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:!1}):_jsx(EmptyState,{isEnabled:p})]})})}),_jsx(ProUpgradeModal,{visible:l,onClose:()=>n(!1),featureName:"Full Action History"})]})}const styles=StyleSheet.create({container:{flex:1,backgroundColor:macOSColors.background.base},headerSearchContainer:{flexDirection:"row",alignItems:"center",backgroundColor:macOSColors.background.input,borderRadius:10,borderWidth:1,borderColor:macOSColors.border.default,paddingHorizontal:12,paddingVertical:5},headerSearchInput:{flex:1,color:macOSColors.text.primary,fontSize:13,marginLeft:6,paddingVertical:2},headerSearchClear:{marginLeft:6,padding:4},headerChipRow:{flexDirection:"row",alignItems:"center",gap:8},headerChip:{flexDirection:"row",alignItems:"center",gap:4,backgroundColor:macOSColors.background.hover,paddingHorizontal:10,paddingVertical:5,borderRadius:12,borderWidth:1,borderColor:macOSColors.border.default},headerChipActive:{backgroundColor:macOSColors.semantic.infoBackground,borderColor:macOSColors.semantic.info+"50"},headerChipLabel:{fontSize:10,fontWeight:"700",color:macOSColors.text.muted},headerChipValue:{fontSize:12,fontWeight:"600",fontFamily:"monospace"},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:macOSColors.background.hover,borderWidth:1,borderColor:macOSColors.border.default,alignItems:"center",justifyContent:"center"},headerActionButtonDisabled:{opacity:.55},startButton:{backgroundColor:macOSColors.semantic.successBackground,borderColor:macOSColors.semantic.success+"40"},stopButton:{backgroundColor:macOSColors.semantic.errorBackground,borderColor:macOSColors.semantic.error+"40"},errorBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:macOSColors.semantic.errorBackground,borderRadius:8,borderWidth:1,borderColor:macOSColors.semantic.error+"20"},errorText:{color:macOSColors.semantic.error,fontSize:11,flex:1},disabledBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:macOSColors.semantic.warningBackground,borderRadius:8,borderWidth:1,borderColor:macOSColors.semantic.warning+"20"},disabledText:{color:macOSColors.semantic.warning,fontSize:11,flex:1},listContent:{paddingTop:8,paddingBottom:20},emptyState:{alignItems:"center",paddingVertical:40},emptyTitle:{color:macOSColors.text.primary,fontSize:14,fontWeight:"600",marginTop:12,marginBottom:6},emptyText:{color:macOSColors.text.muted,fontSize:12,textAlign:"center"},lockedBanner:{flexDirection:"row",alignItems:"center",gap:8,padding:10,marginHorizontal:12,marginTop:8,backgroundColor:buoyColors.primary+"15",borderRadius:8,borderWidth:1,borderColor:buoyColors.primary+"33"},lockedText:{color:buoyColors.primary,fontSize:11,fontWeight:"500",flex:1},upgradeBadge:{backgroundColor:buoyColors.primary,paddingHorizontal:8,paddingVertical:3,borderRadius:4},upgradeBadgeText:{color:"#fff",fontSize:9,fontWeight:"700",letterSpacing:.5}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{useReduxActions}from"./useReduxActions";
|
|
1
|
+
"use strict";export{useReduxActions}from"./useReduxActions";export{useAutoInstrumentRedux,useReduxAvailability}from"./useAutoInstrumentRedux";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{useEffect,useState,useRef,useCallback}from"react";import{instrumentStore,uninstrumentStore,isStoreInstrumented}from"../utils/autoInstrument";function getReactReduxUseStore(){try{return require("react-redux").useStore}catch{return null}}export function useAutoInstrumentRedux(e={}){const{autoStart:t=!0,...r}=e,[u,n]=useState(!1),[s,a]=useState(!0),[l,o]=useState(null),[i,c]=useState(null),d=useRef(null),f=getReactReduxUseStore(),m=null!==f;let R=null,x=null;if(f)try{R=f()}catch(e){x=e instanceof Error?e.message:"Failed to access Redux store. Make sure your app is wrapped in a Redux Provider."}else x="react-redux is not installed or not available";const S=useCallback(()=>{if(!R)return o(x||"No Redux store available"),void a(!1);if(isStoreInstrumented(R))return n(!0),c(R),a(!1),void o(null);try{const e=instrumentStore(R,r);d.current=e,n(!0),c(R),o(null)}catch(e){o(e instanceof Error?e.message:"Failed to instrument Redux store"),n(!1)}finally{a(!1)}},[R,x,r]),v=useCallback(()=>{d.current&&(d.current(),d.current=null),i&&uninstrumentStore(i),n(!1),c(null)},[i]);return useEffect(()=>(t?S():a(!1),()=>{}),[t,S]),{isInstrumented:u,isLoading:s,error:l,isReactReduxAvailable:m,startInstrumentation:S,stopInstrumentation:v,store:i}}export function useReduxAvailability(){const e=getReactReduxUseStore();if(!e)return{isAvailable:!1,error:"react-redux is not installed"};try{return{isAvailable:null!=e(),error:null}}catch(e){return{isAvailable:!1,error:e instanceof Error?e.message:"Not inside a Redux Provider"}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{reduxActionStore}from"./reduxActionStore";import{BUOY_JUMP_TO_STATE,isMiddlewareActive}from"./buoyReduxMiddleware";const INSTRUMENTED_SYMBOL=Symbol.for("@@buoy/instrumented"),ORIGINAL_DISPATCH_SYMBOL=Symbol.for("@@buoy/originalDispatch"),ORIGINAL_REDUCER_SYMBOL=Symbol.for("@@buoy/originalReducer");let activeStore=null,timeTravelEnabled=!1;export function isStoreInstrumented(e){return!0===e[INSTRUMENTED_SYMBOL]}export function instrumentStore(e,t={}){const r=e;if(isMiddlewareActive())return activeStore=e,()=>{};if(r[INSTRUMENTED_SYMBOL])return activeStore=e,()=>{};const{enableTimeTravel:o=!1,maxActions:n=200,ignoreActions:i=[]}=t;reduxActionStore.setMaxActions(n);const c=e.dispatch.bind(e);return r[ORIGINAL_DISPATCH_SYMBOL]=c,e.dispatch=t=>{if("object"!=typeof t||null===t||"string"!=typeof t.type)return c(t);const r=t.type;if(r.startsWith("@@buoy/"))return c(t);if(r.startsWith("@@redux/"))return c(t);if(i.includes(r))return c(t);const o=performance.now(),n=e.getState(),a=c(t),u=e.getState(),S=performance.now()-o;return reduxActionStore.addAction(t,n,u,S),a},r[INSTRUMENTED_SYMBOL]=!0,activeStore=e,o&&"function"==typeof e.replaceReducer&&enableTimeTravelSupport(e),()=>{uninstrumentStore(e)}}export function uninstrumentStore(e){const t=e;if(!t[INSTRUMENTED_SYMBOL])return;const r=t[ORIGINAL_DISPATCH_SYMBOL];r&&(e.dispatch=r);const o=t[ORIGINAL_REDUCER_SYMBOL];o&&"function"==typeof e.replaceReducer&&(e.replaceReducer(o),timeTravelEnabled=!1),delete t[INSTRUMENTED_SYMBOL],delete t[ORIGINAL_DISPATCH_SYMBOL],delete t[ORIGINAL_REDUCER_SYMBOL],activeStore===e&&(activeStore=null)}function enableTimeTravelSupport(e){const t=e,r=e.getState();t[ORIGINAL_REDUCER_SYMBOL]=(e=r,t)=>t.type===BUOY_JUMP_TO_STATE?t.payload:e,timeTravelEnabled=!0}export function jumpToState(e){activeStore?activeStore.dispatch({type:BUOY_JUMP_TO_STATE,payload:e}):console.warn("[BuoyRedux] Cannot jump to state - no store instrumented")}export function replayAction(e){activeStore?activeStore.dispatch(e):console.warn("[BuoyRedux] Cannot replay action - no store instrumented")}export function getActiveStore(){return activeStore}export function isAutoInstrumentActive(){return null!==activeStore&&isStoreInstrumented(activeStore)}export function isTimeTravelEnabled(){return timeTravelEnabled}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{reduxActionStore}from"./reduxActionStore";export const BUOY_JUMP_TO_STATE="@@buoy/JUMP_TO_STATE";export const BUOY_REPLAY_ACTION="@@buoy/REPLAY_ACTION";let storeDispatch=null;export function jumpToState(t){storeDispatch?storeDispatch({type:BUOY_JUMP_TO_STATE,payload:t}):console.warn("[BuoyRedux] Cannot jump to state - middleware not initialized")}export function replayAction(t){storeDispatch?storeDispatch(t):console.warn("[BuoyRedux] Cannot replay action - middleware not initialized")}export function withBuoyDevTools(t){return(e,o)=>o.type===BUOY_JUMP_TO_STATE?o.payload:t(e,o)}export const buoyReduxMiddleware=t=>(storeDispatch=t.dispatch,e=>o=>{const r=o,n=r.type;if(n?.startsWith("@@buoy/"))return e(o);const i=performance.now(),a=t.getState(),c=e(o),s=t.getState(),
|
|
1
|
+
"use strict";import{reduxActionStore}from"./reduxActionStore";let middlewareActive=!1;export function isMiddlewareActive(){return middlewareActive}export const BUOY_JUMP_TO_STATE="@@buoy/JUMP_TO_STATE";export const BUOY_REPLAY_ACTION="@@buoy/REPLAY_ACTION";let storeDispatch=null;export function jumpToState(t){storeDispatch?storeDispatch({type:BUOY_JUMP_TO_STATE,payload:t}):console.warn("[BuoyRedux] Cannot jump to state - middleware not initialized")}export function replayAction(t){storeDispatch?storeDispatch(t):console.warn("[BuoyRedux] Cannot replay action - middleware not initialized")}export function withBuoyDevTools(t){return(e,o)=>o.type===BUOY_JUMP_TO_STATE?o.payload:t(e,o)}export const buoyReduxMiddleware=t=>(middlewareActive=!0,storeDispatch=t.dispatch,e=>o=>{const r=o,n=r.type;if(n?.startsWith("@@buoy/"))return e(o);const i=performance.now(),a=t.getState(),c=e(o),s=t.getState(),d=performance.now()-i;return reduxActionStore.addAction(r,a,s,d),c});export function createBuoyReduxMiddleware(t={}){const{maxActions:e=200,ignoreActions:o=[]}=t;return reduxActionStore.setMaxActions(e),t=>(middlewareActive=!0,storeDispatch=t.dispatch,e=>r=>{const n=r,i=n.type||"";if(i?.startsWith("@@buoy/"))return e(r);if(o.includes(i))return e(r);const a=performance.now(),c=t.getState(),s=e(r),d=t.getState(),u=performance.now()-a;return reduxActionStore.addAction(n,c,d,u),s})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{reduxActionStore}from"./reduxActionStore";export{buoyReduxMiddleware,createBuoyReduxMiddleware,withBuoyDevTools,jumpToState,replayAction,BUOY_JUMP_TO_STATE,BUOY_REPLAY_ACTION}from"./buoyReduxMiddleware";export{createReduxHistoryAdapter,reduxHistoryAdapter}from"./createReduxHistoryAdapter";
|
|
1
|
+
"use strict";export{reduxActionStore}from"./reduxActionStore";export{buoyReduxMiddleware,createBuoyReduxMiddleware,withBuoyDevTools,jumpToState,replayAction,BUOY_JUMP_TO_STATE,BUOY_REPLAY_ACTION}from"./buoyReduxMiddleware";export{createReduxHistoryAdapter,reduxHistoryAdapter}from"./createReduxHistoryAdapter";export{instrumentStore,uninstrumentStore,isStoreInstrumented,isAutoInstrumentActive,getActiveStore,jumpToState as autoJumpToState,replayAction as autoReplayAction}from"./autoInstrument";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function getActionCategory(t){return t.startsWith("@@")?"internal":t.includes("/pending")?"pending":t.includes("/fulfilled")?"fulfilled":t.includes("/rejected")?"rejected":t.includes("/executeQuery")?"query":t.includes("/executeMutation")?"mutation":"action"}function parseActionType(t){if(t.startsWith("@@")){const e=t.split("/");return{sliceName:null,actionName:e[e.length-1]||t}}const e=t.split("/");if(e.length>=2){const t=e[0];let n=e[1];return e.length>=3&&["pending","fulfilled","rejected"].includes(e[e.length-1])&&(n=e.slice(1,-1).join("/")),{sliceName:t,actionName:n.toUpperCase()}}return{sliceName:null,actionName:t.toUpperCase()}}function formatPayloadPreview(t,e=40){if(void 0===t)return"";if(null===t)return"null";try{if("string"==typeof t)return t.length>e?`"${t.slice(0,e-3)}..."`:`"${t}"`;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t)){if(0===t.length)return"[]";const n=JSON.stringify(t);return n.length>e?`[${t.length} items]`:n}if("object"==typeof t){const n=Object.keys(t);if(0===n.length)return"{}";const i=JSON.stringify(t);return i.length<=e?i:`{ ${n.length} keys }`}return String(t).slice(0,e)}catch{return"[complex]"}}function getStateDiffSummary(t,e){if(t===e)return{summary:"no change",changedCount:0};if("object"!=typeof t||"object"!=typeof e||null===t||null===e)return{summary:"changed",changedCount:1};const n=Object.keys(t),i=Object.keys(e),s=i.filter(t=>!n.includes(t)).length,r=n.filter(t=>!i.includes(t)).length;let a=0;for(const s of n)i.includes(s)&&t[s]!==e[s]&&a++;const o=[];s>0&&o.push(`+${s}`),r>0&&o.push(`-${r}`),a>0&&o.push(`~${a}`);const c=s+r+a;return 0===o.length?{summary:"nested change",changedCount:1}:{summary:`${o.join(" ")} ${1===c?"key":"keys"}`,changedCount:c}}function extractMeta(t){const e=t.meta;if(e)return{requestId:e.requestId,requestStatus:e.requestStatus,arg:e.arg,rejectedWithValue:e.rejectedWithValue,aborted:e.aborted,condition:e.condition}}class ReduxActionStore{actions=[];listeners=new Set;maxActions=200;idCounter=0;isEnabled=!0;addAction(t,e,n,i){if(!this.isEnabled)return;const s=
|
|
1
|
+
"use strict";function getActionCategory(t){return t.startsWith("@@")?"internal":t.includes("/pending")?"pending":t.includes("/fulfilled")?"fulfilled":t.includes("/rejected")?"rejected":t.includes("/executeQuery")?"query":t.includes("/executeMutation")?"mutation":"action"}function parseActionType(t){if(t.startsWith("@@")){const e=t.split("/");return{sliceName:null,actionName:e[e.length-1]||t}}const e=t.split("/");if(e.length>=2){const t=e[0];let n=e[1];return e.length>=3&&["pending","fulfilled","rejected"].includes(e[e.length-1])&&(n=e.slice(1,-1).join("/")),{sliceName:t,actionName:n.toUpperCase()}}return{sliceName:null,actionName:t.toUpperCase()}}function formatPayloadPreview(t,e=40){if(void 0===t)return"";if(null===t)return"null";try{if("string"==typeof t)return t.length>e?`"${t.slice(0,e-3)}..."`:`"${t}"`;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t)){if(0===t.length)return"[]";const n=JSON.stringify(t);return n.length>e?`[${t.length} items]`:n}if("object"==typeof t){const n=Object.keys(t);if(0===n.length)return"{}";const i=JSON.stringify(t);return i.length<=e?i:`{ ${n.length} keys }`}return String(t).slice(0,e)}catch{return"[complex]"}}function getStateDiffSummary(t,e){if(t===e)return{summary:"no change",changedCount:0};if("object"!=typeof t||"object"!=typeof e||null===t||null===e)return{summary:"changed",changedCount:1};const n=Object.keys(t),i=Object.keys(e),s=i.filter(t=>!n.includes(t)).length,r=n.filter(t=>!i.includes(t)).length;let a=0;for(const s of n)i.includes(s)&&t[s]!==e[s]&&a++;const o=[];s>0&&o.push(`+${s}`),r>0&&o.push(`-${r}`),a>0&&o.push(`~${a}`);const c=s+r+a;return 0===o.length?{summary:"nested change",changedCount:1}:{summary:`${o.join(" ")} ${1===c?"key":"keys"}`,changedCount:c}}function extractMeta(t){const e=t.meta;if(e)return{requestId:e.requestId,requestStatus:e.requestStatus,arg:e.arg,rejectedWithValue:e.rejectedWithValue,aborted:e.aborted,condition:e.condition}}class ReduxActionStore{actions=[];listeners=new Set;maxActions=200;idCounter=0;isEnabled=!0;addAction(t,e,n,i){if(!this.isEnabled)return;const s=t.type||"";if(!s)return;const r=e!==n,a=getActionCategory(s),{sliceName:o,actionName:c}=parseActionType(s),u=extractMeta(t),l=formatPayloadPreview(t.payload),{summary:d,changedCount:h}=getStateDiffSummary(e,n),g=(i??0)>16,f={id:`${Date.now()}-${++this.idCounter}`,type:s,payload:t.payload,action:t,timestamp:Date.now(),prevState:e,nextState:n,duration:i,hasStateChange:r,category:a,sliceName:o,actionName:c,meta:u,error:t.error,payloadPreview:l,diffSummary:d,changedKeysCount:h,isSlowAction:g};this.actions=[f,...this.actions].slice(0,this.maxActions),this.notifyListeners()}getActions(){return[...this.actions]}getActionById(t){return this.actions.find(e=>e.id===t)}clearActions(){this.actions=[],this.notifyListeners()}setEnabled(t){this.isEnabled=t}getEnabled(){return this.isEnabled}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notifyListeners(){const t=this.getActions();this.listeners.forEach(e=>e(t))}setMaxActions(t){this.maxActions=t,this.actions.length>t&&(this.actions=this.actions.slice(0,t),this.notifyListeners())}getStats(){const t=this.actions.length,e=this.actions.filter(t=>t.hasStateChange).length,n=new Set(this.actions.map(t=>t.type)),i=this.actions.filter(t=>void 0!==t.duration).map(t=>t.duration),s=i.length>0?i.reduce((t,e)=>t+e,0)/i.length:0;return{totalActions:t,actionsWithChanges:e,actionsWithoutChanges:t-e,uniqueActionTypes:n.size,averageDuration:Math.round(100*s)/100}}filterActions(t){let e=[...this.actions];if(t.searchText){const n=t.searchText.toLowerCase();e=e.filter(t=>t.type.toLowerCase().includes(n))}return t.actionTypes&&t.actionTypes.length>0&&(e=e.filter(e=>t.actionTypes.includes(e.type))),t.onlyWithChanges&&(e=e.filter(t=>t.hasStateChange)),e}getUniqueActionTypes(){return Array.from(new Set(this.actions.map(t=>t.type))).sort()}getRelatedActions(t){return this.actions.filter(e=>e.meta?.requestId===t).sort((t,e)=>t.timestamp-e.timestamp)}getLinkedActions(t){return t.meta?.requestId?this.getRelatedActions(t.meta.requestId):[]}getLinkedActionsCount(t){return t.meta?.requestId?this.actions.filter(e=>e.meta?.requestId===t.meta?.requestId).length:0}getAsyncOperationDuration(t){const e=this.getRelatedActions(t);if(e.length<2)return null;const n=e.find(t=>"pending"===t.category),i=e.find(t=>"fulfilled"===t.category||"rejected"===t.category);return n&&i?i.timestamp-n.timestamp:null}getBaseActionType(t){const e=t.split("/");if(e.length>=2){const t=e[e.length-1];if(["pending","fulfilled","rejected"].includes(t))return e.slice(0,-1).join("/")}return t}getAsyncOperationIndex(t){const e=new Map;for(const t of this.actions)t.meta?.requestId&&!e.has(t.meta.requestId)&&e.set(t.meta.requestId,t.timestamp);const n=Array.from(e.entries()).sort((t,e)=>t[1]-e[1]).map(([t])=>t).indexOf(t);return n>=0?n+1:0}}export const reduxActionStore=new ReduxActionStore;
|
|
@@ -7,29 +7,47 @@
|
|
|
7
7
|
* Internal stores are not exported to prevent bypassing the tool's
|
|
8
8
|
* intended usage patterns.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* ZERO-CONFIG: Just install this package - that's it!
|
|
11
|
+
* The Redux DevTools automatically instruments your store when
|
|
12
|
+
* FloatingDevTools mounts. No middleware, no configuration needed.
|
|
13
|
+
*
|
|
14
|
+
* @example Zero-config setup (just install and use!)
|
|
11
15
|
* ```tsx
|
|
12
|
-
* // 1.
|
|
13
|
-
*
|
|
14
|
-
*
|
|
16
|
+
* // 1. Install: npm install @buoy-gg/redux
|
|
17
|
+
*
|
|
18
|
+
* // 2. Your existing Redux setup (NO CHANGES NEEDED!)
|
|
19
|
+
* const store = configureStore({ reducer: rootReducer });
|
|
20
|
+
*
|
|
21
|
+
* // 3. Your app with FloatingDevTools (Redux tool auto-detected!)
|
|
22
|
+
* <Provider store={store}>
|
|
23
|
+
* <App />
|
|
24
|
+
* <FloatingDevTools /> // Redux tool appears automatically!
|
|
25
|
+
* </Provider>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* That's it! The Redux tool will auto-detect your store and capture actions.
|
|
29
|
+
*
|
|
30
|
+
* @example Advanced: Manual middleware (only if you need more control)
|
|
31
|
+
* ```tsx
|
|
32
|
+
* // For time-travel or custom options, you can optionally use middleware:
|
|
33
|
+
* import { buoyReduxMiddleware, withBuoyDevTools } from '@buoy-gg/redux';
|
|
15
34
|
*
|
|
16
35
|
* const store = configureStore({
|
|
17
|
-
* reducer: rootReducer,
|
|
36
|
+
* reducer: withBuoyDevTools(rootReducer), // Enables time-travel
|
|
18
37
|
* middleware: (getDefaultMiddleware) =>
|
|
19
38
|
* getDefaultMiddleware().concat(buoyReduxMiddleware),
|
|
20
39
|
* });
|
|
21
|
-
*
|
|
22
|
-
* // 2. Add the preset to FloatingDevTools
|
|
23
|
-
* import { reduxToolPreset } from '@buoy-gg/redux';
|
|
24
|
-
*
|
|
25
|
-
* <FloatingDevTools apps={[reduxToolPreset]} />
|
|
26
40
|
* ```
|
|
27
41
|
*/
|
|
28
42
|
export { reduxToolPreset, createReduxTool } from "./preset";
|
|
29
43
|
export { buoyReduxMiddleware, createBuoyReduxMiddleware, withBuoyDevTools, jumpToState, replayAction, BUOY_JUMP_TO_STATE, BUOY_REPLAY_ACTION, } from "./redux/utils/buoyReduxMiddleware";
|
|
44
|
+
export { instrumentStore, uninstrumentStore, isStoreInstrumented, isAutoInstrumentActive, getActiveStore, } from "./redux/utils/autoInstrument";
|
|
45
|
+
export type { AutoInstrumentOptions } from "./redux/utils/autoInstrument";
|
|
30
46
|
export { createReduxHistoryAdapter, reduxHistoryAdapter, type ReduxHistoryAdapterOptions, } from "./redux/utils/createReduxHistoryAdapter";
|
|
31
47
|
export { useReduxActions } from "./redux/hooks/useReduxActions";
|
|
32
48
|
export type { UseReduxActionsResult } from "./redux/hooks/useReduxActions";
|
|
49
|
+
export { useAutoInstrumentRedux, useReduxAvailability, } from "./redux/hooks/useAutoInstrumentRedux";
|
|
50
|
+
export type { UseAutoInstrumentReduxOptions, UseAutoInstrumentReduxResult, } from "./redux/hooks/useAutoInstrumentRedux";
|
|
33
51
|
export { ReduxModal, FREE_TIER_ACTION_LIMIT } from "./redux/components/ReduxModal";
|
|
34
52
|
export { ReduxActionItem } from "./redux/components/ReduxActionItem";
|
|
35
53
|
export { ReduxActionDetailView } from "./redux/components/ReduxActionDetailView";
|
|
@@ -1,17 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pre-configured Redux DevTools preset for FloatingDevTools
|
|
3
3
|
*
|
|
4
|
-
* This preset
|
|
5
|
-
*
|
|
4
|
+
* ZERO-CONFIG: This preset is auto-discovered by FloatingDevTools!
|
|
5
|
+
* You do NOT need to import or configure anything - just install @buoy-gg/redux
|
|
6
|
+
* and the Redux tool will appear automatically in your FloatingDevTools.
|
|
6
7
|
*
|
|
7
|
-
* @example
|
|
8
|
+
* @example Automatic (recommended - no code needed!)
|
|
9
|
+
* ```tsx
|
|
10
|
+
* // Just install: npm install @buoy-gg/redux
|
|
11
|
+
* // The Redux tool appears automatically in FloatingDevTools!
|
|
12
|
+
*
|
|
13
|
+
* <Provider store={store}>
|
|
14
|
+
* <App />
|
|
15
|
+
* <FloatingDevTools /> // Redux tool is auto-detected
|
|
16
|
+
* </Provider>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example Manual (only for custom configuration)
|
|
8
20
|
* ```tsx
|
|
9
|
-
* import {
|
|
21
|
+
* import { createReduxTool } from '@buoy-gg/redux';
|
|
22
|
+
*
|
|
23
|
+
* // Only use this if you need to customize the tool
|
|
24
|
+
* const customReduxTool = createReduxTool({
|
|
25
|
+
* name: "STATE",
|
|
26
|
+
* iconColor: "#9945FF",
|
|
27
|
+
* });
|
|
10
28
|
*
|
|
11
|
-
*
|
|
12
|
-
* reduxToolPreset, // That's it!
|
|
13
|
-
* // ...other tools
|
|
14
|
-
* ];
|
|
29
|
+
* <FloatingDevTools apps={[customReduxTool]} />
|
|
15
30
|
* ```
|
|
16
31
|
*/
|
|
17
32
|
import { ReduxModal } from "./redux/components/ReduxModal";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { useReduxActions } from "./useReduxActions";
|
|
2
2
|
export type { UseReduxActionsResult } from "./useReduxActions";
|
|
3
|
+
export { useAutoInstrumentRedux, useReduxAvailability, } from "./useAutoInstrumentRedux";
|
|
4
|
+
export type { UseAutoInstrumentReduxOptions, UseAutoInstrumentReduxResult, } from "./useAutoInstrumentRedux";
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React hook for auto-instrumenting Redux stores
|
|
3
|
+
*
|
|
4
|
+
* This hook automatically patches the Redux store when the component mounts,
|
|
5
|
+
* providing zero-config action capture for the Redux DevTools.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* - The hook attempts to use react-redux's useStore() to get the store
|
|
9
|
+
* - If successful, it instruments the store automatically
|
|
10
|
+
* - If react-redux is not available or not in a Provider, it fails gracefully
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* function ReduxDevTools() {
|
|
15
|
+
* const { isInstrumented, error } = useAutoInstrumentRedux();
|
|
16
|
+
*
|
|
17
|
+
* if (error) {
|
|
18
|
+
* return <Text>Redux not available: {error}</Text>;
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* return <ReduxActionList />;
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
import type { Store } from "@reduxjs/toolkit";
|
|
26
|
+
import { type AutoInstrumentOptions } from "../utils/autoInstrument";
|
|
27
|
+
export interface UseAutoInstrumentReduxOptions extends AutoInstrumentOptions {
|
|
28
|
+
/** Whether to auto-start instrumentation (default: true) */
|
|
29
|
+
autoStart?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface UseAutoInstrumentReduxResult {
|
|
32
|
+
/** Whether the store is currently instrumented */
|
|
33
|
+
isInstrumented: boolean;
|
|
34
|
+
/** Whether instrumentation is in progress */
|
|
35
|
+
isLoading: boolean;
|
|
36
|
+
/** Error message if instrumentation failed */
|
|
37
|
+
error: string | null;
|
|
38
|
+
/** Whether react-redux is available */
|
|
39
|
+
isReactReduxAvailable: boolean;
|
|
40
|
+
/** Manually start instrumentation */
|
|
41
|
+
startInstrumentation: () => void;
|
|
42
|
+
/** Manually stop instrumentation */
|
|
43
|
+
stopInstrumentation: () => void;
|
|
44
|
+
/** Reference to the instrumented store */
|
|
45
|
+
store: Store | null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Hook to automatically instrument Redux store for DevTools
|
|
49
|
+
*
|
|
50
|
+
* This provides zero-config Redux action capture by:
|
|
51
|
+
* 1. Using react-redux's useStore() to get the Redux store
|
|
52
|
+
* 2. Automatically patching store.dispatch to capture actions
|
|
53
|
+
* 3. Cleaning up when the component unmounts
|
|
54
|
+
*/
|
|
55
|
+
export declare function useAutoInstrumentRedux(options?: UseAutoInstrumentReduxOptions): UseAutoInstrumentReduxResult;
|
|
56
|
+
/**
|
|
57
|
+
* Lightweight hook to just check if Redux is available
|
|
58
|
+
* without auto-instrumenting
|
|
59
|
+
*/
|
|
60
|
+
export declare function useReduxAvailability(): {
|
|
61
|
+
isAvailable: boolean;
|
|
62
|
+
error: string | null;
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=useAutoInstrumentRedux.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-instrumentation for Redux stores
|
|
3
|
+
*
|
|
4
|
+
* This module provides zero-config Redux DevTools integration by automatically
|
|
5
|
+
* patching the store's dispatch method when the DevTools component mounts.
|
|
6
|
+
*
|
|
7
|
+
* Similar to how @buoy-gg/network patches globalThis.fetch, this patches
|
|
8
|
+
* store.dispatch to capture all Redux actions without requiring manual
|
|
9
|
+
* middleware configuration.
|
|
10
|
+
*/
|
|
11
|
+
import type { Store, UnknownAction } from "@reduxjs/toolkit";
|
|
12
|
+
export interface AutoInstrumentOptions {
|
|
13
|
+
/** Enable time-travel support (requires replaceReducer) */
|
|
14
|
+
enableTimeTravel?: boolean;
|
|
15
|
+
/** Maximum number of actions to store */
|
|
16
|
+
maxActions?: number;
|
|
17
|
+
/** Action types to ignore */
|
|
18
|
+
ignoreActions?: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Check if a store has already been instrumented
|
|
22
|
+
*/
|
|
23
|
+
export declare function isStoreInstrumented(store: Store): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Instrument a Redux store for action capture
|
|
26
|
+
*
|
|
27
|
+
* This function patches store.dispatch to capture all actions without
|
|
28
|
+
* requiring the user to configure middleware manually.
|
|
29
|
+
*
|
|
30
|
+
* @param store - The Redux store to instrument
|
|
31
|
+
* @param options - Configuration options
|
|
32
|
+
* @returns Cleanup function to restore original dispatch
|
|
33
|
+
*/
|
|
34
|
+
export declare function instrumentStore(store: Store, options?: AutoInstrumentOptions): () => void;
|
|
35
|
+
/**
|
|
36
|
+
* Remove instrumentation from a store
|
|
37
|
+
*/
|
|
38
|
+
export declare function uninstrumentStore(store: Store): void;
|
|
39
|
+
/**
|
|
40
|
+
* Jump to a specific state (time-travel)
|
|
41
|
+
*
|
|
42
|
+
* For full time-travel support, users should use withBuoyDevTools.
|
|
43
|
+
* This limited version attempts to work with auto-instrumentation.
|
|
44
|
+
*/
|
|
45
|
+
export declare function jumpToState(state: unknown): void;
|
|
46
|
+
/**
|
|
47
|
+
* Replay an action (dispatch it again)
|
|
48
|
+
*/
|
|
49
|
+
export declare function replayAction(action: UnknownAction): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get the currently active (instrumented) store
|
|
52
|
+
*/
|
|
53
|
+
export declare function getActiveStore(): Store | null;
|
|
54
|
+
/**
|
|
55
|
+
* Check if auto-instrumentation is active
|
|
56
|
+
*/
|
|
57
|
+
export declare function isAutoInstrumentActive(): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Check if time-travel support is enabled
|
|
60
|
+
*/
|
|
61
|
+
export declare function isTimeTravelEnabled(): boolean;
|
|
62
|
+
//# sourceMappingURL=autoInstrument.d.ts.map
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { Middleware, Reducer, UnknownAction } from "@reduxjs/toolkit";
|
|
17
17
|
import type { BuoyReduxMiddlewareOptions } from "../types";
|
|
18
|
+
/**
|
|
19
|
+
* Check if the explicit middleware is active
|
|
20
|
+
* Used by auto-instrument to avoid duplicate capture
|
|
21
|
+
*/
|
|
22
|
+
export declare function isMiddlewareActive(): boolean;
|
|
18
23
|
export declare const BUOY_JUMP_TO_STATE = "@@buoy/JUMP_TO_STATE";
|
|
19
24
|
export declare const BUOY_REPLAY_ACTION = "@@buoy/REPLAY_ACTION";
|
|
20
25
|
/**
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { reduxActionStore } from "./reduxActionStore";
|
|
2
2
|
export { buoyReduxMiddleware, createBuoyReduxMiddleware, withBuoyDevTools, jumpToState, replayAction, BUOY_JUMP_TO_STATE, BUOY_REPLAY_ACTION, } from "./buoyReduxMiddleware";
|
|
3
3
|
export { createReduxHistoryAdapter, reduxHistoryAdapter, type ReduxHistoryAdapterOptions, } from "./createReduxHistoryAdapter";
|
|
4
|
+
export { instrumentStore, uninstrumentStore, isStoreInstrumented, isAutoInstrumentActive, getActiveStore, jumpToState as autoJumpToState, replayAction as autoReplayAction, } from "./autoInstrument";
|
|
5
|
+
export type { AutoInstrumentOptions } from "./autoInstrument";
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/redux",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Redux Toolkit DevTools for React Native",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
],
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@buoy-gg/shared-ui": "2.1.
|
|
30
|
-
"@buoy-gg/floating-tools-core": "2.1.
|
|
31
|
-
"@buoy-gg/license": "2.1.
|
|
29
|
+
"@buoy-gg/shared-ui": "2.1.2",
|
|
30
|
+
"@buoy-gg/floating-tools-core": "2.1.2",
|
|
31
|
+
"@buoy-gg/license": "2.1.2"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@reduxjs/toolkit": ">=2.0.0",
|