@buoy-gg/redux 0.1.1
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/LICENSE +58 -0
- package/README.md +55 -0
- package/lib/commonjs/index.js +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/preset.js +1 -0
- package/lib/commonjs/redux/components/ReduxActionButton.js +1 -0
- package/lib/commonjs/redux/components/ReduxActionDetailContent.js +1 -0
- package/lib/commonjs/redux/components/ReduxActionDetailView.js +1 -0
- package/lib/commonjs/redux/components/ReduxActionInfoView.js +1 -0
- package/lib/commonjs/redux/components/ReduxActionItem.js +1 -0
- package/lib/commonjs/redux/components/ReduxDetailViewToggle.js +1 -0
- package/lib/commonjs/redux/components/ReduxIcon.js +1 -0
- package/lib/commonjs/redux/components/ReduxModal.js +1 -0
- package/lib/commonjs/redux/components/index.js +1 -0
- package/lib/commonjs/redux/hooks/index.js +1 -0
- package/lib/commonjs/redux/hooks/useReduxActions.js +1 -0
- package/lib/commonjs/redux/index.js +1 -0
- package/lib/commonjs/redux/types/index.js +1 -0
- package/lib/commonjs/redux/utils/buoyReduxMiddleware.js +1 -0
- package/lib/commonjs/redux/utils/createReduxHistoryAdapter.js +1 -0
- package/lib/commonjs/redux/utils/index.js +1 -0
- package/lib/commonjs/redux/utils/reduxActionStore.js +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/preset.js +1 -0
- package/lib/module/redux/components/ReduxActionButton.js +1 -0
- package/lib/module/redux/components/ReduxActionDetailContent.js +1 -0
- package/lib/module/redux/components/ReduxActionDetailView.js +1 -0
- package/lib/module/redux/components/ReduxActionInfoView.js +1 -0
- package/lib/module/redux/components/ReduxActionItem.js +1 -0
- package/lib/module/redux/components/ReduxDetailViewToggle.js +1 -0
- package/lib/module/redux/components/ReduxIcon.js +1 -0
- package/lib/module/redux/components/ReduxModal.js +1 -0
- package/lib/module/redux/components/index.js +1 -0
- package/lib/module/redux/hooks/index.js +1 -0
- package/lib/module/redux/hooks/useReduxActions.js +1 -0
- package/lib/module/redux/index.js +1 -0
- package/lib/module/redux/types/index.js +1 -0
- package/lib/module/redux/utils/buoyReduxMiddleware.js +1 -0
- package/lib/module/redux/utils/createReduxHistoryAdapter.js +1 -0
- package/lib/module/redux/utils/index.js +1 -0
- package/lib/module/redux/utils/reduxActionStore.js +1 -0
- package/lib/typescript/index.d.ts +28 -0
- package/lib/typescript/preset.d.ts +77 -0
- package/lib/typescript/redux/components/ReduxActionButton.d.ts +54 -0
- package/lib/typescript/redux/components/ReduxActionDetailContent.d.ts +33 -0
- package/lib/typescript/redux/components/ReduxActionDetailView.d.ts +10 -0
- package/lib/typescript/redux/components/ReduxActionInfoView.d.ts +18 -0
- package/lib/typescript/redux/components/ReduxActionItem.d.ts +12 -0
- package/lib/typescript/redux/components/ReduxDetailViewToggle.d.ts +16 -0
- package/lib/typescript/redux/components/ReduxIcon.d.ts +6 -0
- package/lib/typescript/redux/components/ReduxModal.d.ts +15 -0
- package/lib/typescript/redux/components/index.d.ts +5 -0
- package/lib/typescript/redux/hooks/index.d.ts +3 -0
- package/lib/typescript/redux/hooks/useReduxActions.d.ts +38 -0
- package/lib/typescript/redux/index.d.ts +5 -0
- package/lib/typescript/redux/types/index.d.ts +82 -0
- package/lib/typescript/redux/utils/buoyReduxMiddleware.d.ts +48 -0
- package/lib/typescript/redux/utils/createReduxHistoryAdapter.d.ts +33 -0
- package/lib/typescript/redux/utils/index.d.ts +4 -0
- package/lib/typescript/redux/utils/reduxActionStore.d.ts +57 -0
- package/package.json +71 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
PROPRIETARY SOFTWARE LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-present Buoy. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This software and its source code are proprietary and confidential.
|
|
6
|
+
|
|
7
|
+
NOTICE: This is NOT open source software. This software is licensed,
|
|
8
|
+
not sold, and is protected by copyright laws and international treaties.
|
|
9
|
+
|
|
10
|
+
TERMS AND CONDITIONS:
|
|
11
|
+
|
|
12
|
+
1. LICENSE GRANT
|
|
13
|
+
Subject to the terms of this Agreement and payment of applicable fees,
|
|
14
|
+
Buoy grants you a limited, non-exclusive, non-transferable license
|
|
15
|
+
to use the compiled software packages in your applications.
|
|
16
|
+
|
|
17
|
+
2. RESTRICTIONS
|
|
18
|
+
You may NOT:
|
|
19
|
+
- Copy, modify, or distribute the source code
|
|
20
|
+
- Reverse engineer, decompile, or disassemble the software
|
|
21
|
+
- Remove or alter any proprietary notices or labels
|
|
22
|
+
- Sublicense, rent, lease, or lend the software
|
|
23
|
+
- Use the software to create competing products
|
|
24
|
+
- Share access credentials with unauthorized parties
|
|
25
|
+
|
|
26
|
+
3. OWNERSHIP
|
|
27
|
+
React Buoy retains all right, title, and interest in the software,
|
|
28
|
+
including all intellectual property rights. This license does not
|
|
29
|
+
grant you any rights to trademarks or service marks.
|
|
30
|
+
|
|
31
|
+
4. TERMINATION
|
|
32
|
+
This license is effective until terminated. Your rights under this
|
|
33
|
+
license will terminate automatically without notice if you fail to
|
|
34
|
+
comply with any of its terms. Upon termination, you must cease all
|
|
35
|
+
use and destroy all copies of the software.
|
|
36
|
+
|
|
37
|
+
5. DISCLAIMER OF WARRANTIES
|
|
38
|
+
THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
|
|
39
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
40
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
|
|
41
|
+
|
|
42
|
+
6. LIMITATION OF LIABILITY
|
|
43
|
+
IN NO EVENT SHALL BUOY BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
|
|
44
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR IN
|
|
45
|
+
CONNECTION WITH THIS LICENSE OR THE USE OF THE SOFTWARE.
|
|
46
|
+
|
|
47
|
+
7. GOVERNING LAW
|
|
48
|
+
This Agreement shall be governed by and construed in accordance with
|
|
49
|
+
the laws of the United States, without regard to its conflict of
|
|
50
|
+
law provisions.
|
|
51
|
+
|
|
52
|
+
For licensing inquiries and subscription information:
|
|
53
|
+
- Website: https://buoy.gg
|
|
54
|
+
- Email: AustinLovesWorking@gmail.com
|
|
55
|
+
|
|
56
|
+
Unauthorized reproduction or distribution of this software, or any
|
|
57
|
+
portion of it, may result in severe civil and criminal penalties,
|
|
58
|
+
and will be prosecuted to the maximum extent possible under the law.
|
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @buoy-gg/redux
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
redux package for the monorepo.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
This package is part of the monorepo and is automatically available to other packages and the example app.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { ReduxComponent } from '@buoy-gg/redux';
|
|
15
|
+
|
|
16
|
+
// Use in your component
|
|
17
|
+
<ReduxComponent title="Hello World" />
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Development
|
|
21
|
+
|
|
22
|
+
### Building
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm build
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Type Checking
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm typecheck
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Clean Build
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pnpm clean
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Structure
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
redux/
|
|
44
|
+
├── src/
|
|
45
|
+
│ └── index.ts # Main export file
|
|
46
|
+
├── lib/ # Built output (git ignored)
|
|
47
|
+
├── package.json
|
|
48
|
+
├── tsconfig.json
|
|
49
|
+
└── README.md
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Dependencies
|
|
53
|
+
|
|
54
|
+
- Uses `@buoy-gg/shared-ui` for common components and utilities
|
|
55
|
+
- React and React Native as peer dependencies
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _exportNames={reduxToolPreset:!0,createReduxTool:!0,buoyReduxMiddleware:!0,createBuoyReduxMiddleware:!0,createReduxHistoryAdapter:!0,reduxHistoryAdapter:!0};Object.defineProperty(exports,"buoyReduxMiddleware",{enumerable:!0,get:function(){return _utils.buoyReduxMiddleware}}),Object.defineProperty(exports,"createBuoyReduxMiddleware",{enumerable:!0,get:function(){return _utils.createBuoyReduxMiddleware}}),Object.defineProperty(exports,"createReduxHistoryAdapter",{enumerable:!0,get:function(){return _utils.createReduxHistoryAdapter}}),Object.defineProperty(exports,"createReduxTool",{enumerable:!0,get:function(){return _preset.createReduxTool}}),Object.defineProperty(exports,"reduxHistoryAdapter",{enumerable:!0,get:function(){return _utils.reduxHistoryAdapter}}),Object.defineProperty(exports,"reduxToolPreset",{enumerable:!0,get:function(){return _preset.reduxToolPreset}});var _preset=require("./preset"),_utils=require("./redux/utils"),_redux=require("./redux");Object.keys(_redux).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(_exportNames,e)||e in exports&&exports[e]===_redux[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _redux[e]}}))});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createReduxTool=createReduxTool,exports.reduxToolPreset=void 0;var _ReduxModal=require("./redux/components/ReduxModal"),_ReduxIcon=require("./redux/components/ReduxIcon"),_jsxRuntime=require("react/jsx-runtime");const reduxToolPreset=exports.reduxToolPreset={id:"redux",name:"REDUX",description:"Redux action & state inspector",slot:"both",icon:({size:e})=>(0,_jsxRuntime.jsx)(_ReduxIcon.ReduxIcon,{size:e}),component:_ReduxModal.ReduxModal,props:{enableSharedModalDimensions:!1}};function createReduxTool(e){return{id:e?.id||"redux",name:e?.name||"REDUX",description:e?.description||"Redux action & state inspector",slot:"both",icon:({size:o})=>(0,_jsxRuntime.jsx)(_ReduxIcon.ReduxIcon,{size:o,color:e?.iconColor}),component:_ReduxModal.ReduxModal,props:{enableSharedModalDimensions:void 0!==e?.enableSharedModalDimensions&&e.enableSharedModalDimensions}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReduxActionButton=ReduxActionButton;var _reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_jsxRuntime=require("react/jsx-runtime");const buttonConfigs={replay:{color:_sharedUi.buoyColors.success,backgroundColor:_sharedUi.buoyColors.success+"15",borderColor:_sharedUi.buoyColors.success+"40",textColor:_sharedUi.buoyColors.success},copy:{color:_sharedUi.buoyColors.primary,backgroundColor:_sharedUi.buoyColors.primary+"15",borderColor:_sharedUi.buoyColors.primary+"40",textColor:_sharedUi.buoyColors.primary},jump:{color:_sharedUi.buoyColors.warning,backgroundColor:_sharedUi.buoyColors.warning+"15",borderColor:_sharedUi.buoyColors.warning+"40",textColor:_sharedUi.buoyColors.warning},skip:{color:_sharedUi.buoyColors.textSecondary,backgroundColor:_sharedUi.buoyColors.textSecondary+"26",borderColor:_sharedUi.buoyColors.textSecondary+"59",textColor:_sharedUi.buoyColors.textSecondary},clear:{color:_sharedUi.buoyColors.error,backgroundColor:_sharedUi.buoyColors.error+"15",borderColor:_sharedUi.buoyColors.error+"40",textColor:_sharedUi.buoyColors.error},diff:{color:_sharedUi.buoyColors.info,backgroundColor:_sharedUi.buoyColors.info+"15",borderColor:_sharedUi.buoyColors.info+"40",textColor:_sharedUi.buoyColors.info}};function ReduxActionButton({onPress:o,text:r,type:e,disabled:t=!1}){const s=buttonConfigs[e];return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{disabled:t,onPress:o,style:[styles.button,{backgroundColor:t?_sharedUi.buoyColors.textMuted+"1A":s.backgroundColor,borderColor:t?_sharedUi.buoyColors.textMuted+"33":s.borderColor,opacity:t?.5:1}],activeOpacity:.7,accessibilityRole:"button",accessibilityLabel:r,accessibilityState:{disabled:t},children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.dot,{backgroundColor:t?_sharedUi.buoyColors.textMuted:s.color}]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.text,{color:t?_sharedUi.buoyColors.textMuted:s.textColor}],children:r})]})}const styles=_reactNative.StyleSheet.create({button:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:6,borderWidth:1,paddingHorizontal:12,paddingVertical:6,height:25,minWidth:80,shadowOffset:{width:0,height:1},shadowOpacity:.2,shadowRadius:2,elevation:2},dot:{width:5,height:5,borderRadius:3,marginRight:6,shadowColor:_sharedUi.buoyColors.text,shadowOffset:{width:0,height:0},shadowOpacity:.6,shadowRadius:2},text:{fontSize:10,fontWeight:"600",letterSpacing:.5,textTransform:"uppercase",fontFamily:"monospace",height:12}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReduxActionDetailContent=ReduxActionDetailContent,exports.ReduxActionDetailFooter=ReduxActionDetailFooter;var _reactNative=require("react-native"),_react=require("react"),_sharedUi=require("@buoy-gg/shared-ui"),_dataViewer=require("@buoy-gg/shared-ui/dataViewer"),_ReduxDetailViewToggle=require("./ReduxDetailViewToggle"),_ReduxActionInfoView=require("./ReduxActionInfoView"),_jsxRuntime=require("react/jsx-runtime");function getActionColor(e){return e.includes("/pending")?_sharedUi.macOSColors.semantic.warning:e.includes("/fulfilled")?_sharedUi.macOSColors.semantic.success:e.includes("/rejected")?_sharedUi.macOSColors.semantic.error:e.startsWith("@@")?_sharedUi.macOSColors.text.muted:_sharedUi.macOSColors.semantic.info}function getActionLabel(e){if(e.includes("/pending"))return"PENDING";if(e.includes("/fulfilled"))return"FULFILLED";if(e.includes("/rejected"))return"REJECTED";if(e.startsWith("@@"))return"INTERNAL";const t=e.split("/");return t[t.length-1]?.toUpperCase()||"ACTION"}function getValueType(e){return null===e?"null":void 0===e?"undefined":Array.isArray(e)?"array":typeof e}function formatTimestamp(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}const DIFF_MODE_TABS=[{key:"tree",label:"TREE VIEW"},{key:"split",label:"SPLIT VIEW"}];function ReduxActionDetailContent({action:e,actions:t,selectedIndex:a,onIndexChange:i,disableInternalFooter:r=!1}){const[n,o]=(0,_react.useState)("action"),[s,l]=(0,_react.useState)("tree"),d=t.length,c=getActionColor(e.type),u=getActionLabel(e.type),m=getValueType(e.nextState),x=d-a,_=x-1,g=a<d-1?a+1:null,f=null!==g?t[g]:null,h=(0,_react.useMemo)(()=>({index:g??0,label:_>0?`#${_}`:"Initial",timestamp:f?formatTimestamp(f.timestamp):"",relativeTime:f?(0,_sharedUi.formatRelativeTime)(new Date(f.timestamp)):"state",badge:f?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.actionBadgeSmall,{backgroundColor:`${getActionColor(f.type)}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionTextSmall,{color:getActionColor(f.type)}],children:getActionLabel(f.type)})}):void 0}),[g,f,_]),p=(0,_react.useMemo)(()=>({index:a,label:`#${x}`,timestamp:formatTimestamp(e.timestamp),relativeTime:(0,_sharedUi.formatRelativeTime)(new Date(e.timestamp)),badge:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.actionBadgeSmall,{backgroundColor:`${c}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionTextSmall,{color:c}],children:u})})}),[a,e.timestamp,c,u,x]),y=(0,_react.useCallback)(()=>{const t=(0,_sharedUi.parseValue)(e.nextState);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.contentCard,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.valueHeader,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.valueLabel,children:"STATE AFTER ACTION"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.valueHeaderBadges,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.actionBadge,{backgroundColor:`${c}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionText,{color:c}],children:u})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.typeBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.typeText,children:m.toUpperCase()})})]})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.valueBox,children:"object"!==m&&"array"!==m||!t?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.valueText,children:null===t?"null":void 0===t?"undefined":"string"===m?`"${t}"`:String(t)}):(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"",data:t,showTypeFilter:!1})})]})},[e.nextState,c,u,m]),j=(0,_react.useCallback)(()=>{const t=(0,_sharedUi.parseValue)(e.prevState),a=(0,_sharedUi.parseValue)(e.nextState);return"split"===s?(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:{flex:1},showsVerticalScrollIndicator:!0,children:(0,_jsxRuntime.jsx)(_dataViewer.SplitDiffViewer,{oldValue:t,newValue:a,theme:_dataViewer.diffThemes.devToolsDefault,options:{hideLineNumbers:!1,disableWordDiff:!1,showDiffOnly:!1,compareMethod:"words",contextLines:3},showThemeName:!1})}):(0,_jsxRuntime.jsx)(_dataViewer.TreeDiffViewer,{oldValue:t,newValue:a})},[e.prevState,e.nextState,s]),b=(0,_react.useCallback)(()=>{i(Math.min(d-1,a+1))},[a,d,i]),R=(0,_react.useCallback)(()=>{i(Math.max(0,a-1))},[a,i]),v=d<=1;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsx)(_ReduxDetailViewToggle.ReduxDetailViewToggle,{activeView:n,onViewChange:o,diffDisabled:v}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.contentArea,children:["action"===n&&(0,_jsxRuntime.jsx)(_ReduxActionInfoView.ReduxActionInfoView,{action:e}),"state"===n&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.stateContainer,children:y()}),"diff"===n&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffContainer,children:[(0,_jsxRuntime.jsx)(_sharedUi.DiffModeTabs,{tabs:DIFF_MODE_TABS,activeTab:s,onTabChange:l}),(0,_jsxRuntime.jsx)(_sharedUi.CompareBar,{leftEvent:h,rightEvent:p}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.diffContent,children:j()})]})]}),!r&&d>1&&(0,_jsxRuntime.jsx)(_sharedUi.EventStepperFooter,{currentIndex:x-1,totalItems:d,onPrevious:b,onNext:R,itemLabel:"Action",subtitle:(0,_sharedUi.formatRelativeTime)(new Date(e.timestamp)),absolute:!0})]})}function ReduxActionDetailFooter({action:e,actions:t,selectedIndex:a,onIndexChange:i}){const r=t.length;if(r<=1)return null;const n=r-a;return(0,_jsxRuntime.jsx)(_sharedUi.EventStepperFooter,{currentIndex:n-1,totalItems:r,onPrevious:()=>i(Math.min(r-1,a+1)),onNext:()=>i(Math.max(0,a-1)),itemLabel:"Action",subtitle:(0,_sharedUi.formatRelativeTime)(new Date(e.timestamp))})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:_sharedUi.macOSColors.background.base},contentArea:{flex:1,paddingBottom:96},stateContainer:{flex:1,padding:14},contentCard:{backgroundColor:_sharedUi.macOSColors.background.card,borderRadius:14,padding:14,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default},valueHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},valueLabel:{fontSize:10,color:_sharedUi.macOSColors.text.secondary,fontFamily:"monospace",letterSpacing:.5,fontWeight:"600"},valueHeaderBadges:{flexDirection:"row",alignItems:"center",gap:6},actionBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4},actionText:{fontSize:9,fontWeight:"700",fontFamily:"monospace",letterSpacing:.3},typeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4,backgroundColor:_sharedUi.macOSColors.background.input},typeText:{fontSize:9,fontWeight:"600",color:_sharedUi.macOSColors.text.muted,fontFamily:"monospace"},valueBox:{backgroundColor:_sharedUi.macOSColors.background.base,borderRadius:6,borderWidth:1,borderColor:_sharedUi.macOSColors.border.input,padding:8},valueText:{fontSize:12,color:_sharedUi.macOSColors.text.primary,fontFamily:"monospace",lineHeight:18},diffContainer:{flex:1},diffContent:{flex:1,paddingHorizontal:14},actionBadgeSmall:{paddingHorizontal:6,paddingVertical:1,borderRadius:3},actionTextSmall:{fontSize:8,fontWeight:"700",fontFamily:"monospace"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReduxActionDetailView=ReduxActionDetailView;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_jsxRuntime=require("react/jsx-runtime");function ReduxActionDetailView({action:e}){const[t,a]=(0,_react.useState)("action"),i=new Date(e.timestamp).toLocaleTimeString();return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.header,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.headerContent,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionType,numberOfLines:2,children:e.type}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.headerMeta,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.metaText,children:i}),void 0!==e.duration&&(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.durationText,children:[e.duration.toFixed(2),"ms"]}),e.hasStateChange&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.changeBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.changeBadgeText,children:"State Changed"})})]})]}),(0,_jsxRuntime.jsx)(_sharedUi.CopyButton,{value:JSON.stringify({type:e.type,payload:e.payload,timestamp:e.timestamp,duration:e.duration,hasStateChange:e.hasStateChange},null,2),size:16})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tabContainer,children:(0,_jsxRuntime.jsx)(_sharedUi.TabSelector,{tabs:[{key:"action",label:"Action"},{key:"state",label:"State"},{key:"diff",label:"Diff"}],activeTab:t,onTabChange:e=>a(e)})}),(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.content,showsVerticalScrollIndicator:!0,children:["action"===t&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsx)(_sharedUi.CollapsibleSection,{title:"Payload",defaultOpen:!0,children:void 0!==e.payload?(0,_jsxRuntime.jsx)(_sharedUi.DataInspector,{data:e.payload}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyText,children:"No payload"})}),(0,_jsxRuntime.jsx)(_sharedUi.CollapsibleSection,{title:"Full Action",defaultOpen:!1,children:(0,_jsxRuntime.jsx)(_sharedUi.DataInspector,{data:e.action})})]}),"state"===t&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsx)(_sharedUi.CollapsibleSection,{title:"Previous State",defaultOpen:!1,children:(0,_jsxRuntime.jsx)(_sharedUi.DataInspector,{data:e.prevState})}),(0,_jsxRuntime.jsx)(_sharedUi.CollapsibleSection,{title:"Next State",defaultOpen:!0,children:(0,_jsxRuntime.jsx)(_sharedUi.DataInspector,{data:e.nextState})})]}),"diff"===t&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.section,children:e.hasStateChange?(0,_jsxRuntime.jsx)(StateDiff,{prevState:e.prevState,nextState:e.nextState}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.noChangeContainer,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noChangeText,children:"No state changes from this action"})})})]})]})}function StateDiff({prevState:e,nextState:t}){const a=findChanges(e,t);return 0===a.length?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.noChangeContainer,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noChangeText,children:"No differences detected"})}):(0,_jsxRuntime.jsx)(_reactNative.View,{children:a.map((e,t)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffItem,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffHeader,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.diffTypeBadge,{backgroundColor:"added"===e.type?_sharedUi.macOSColors.semantic.successBackground:"removed"===e.type?_sharedUi.macOSColors.semantic.errorBackground:_sharedUi.macOSColors.semantic.warningBackground}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.diffTypeText,{color:"added"===e.type?_sharedUi.macOSColors.semantic.success:"removed"===e.type?_sharedUi.macOSColors.semantic.error:_sharedUi.macOSColors.semantic.warning}],children:e.type.toUpperCase()})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffPath,children:e.path})]}),"modified"===e.type&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffValues,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffValue,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffLabel,children:"Before:"}),(0,_jsxRuntime.jsx)(_sharedUi.DataInspector,{data:e.oldValue})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffValue,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffLabel,children:"After:"}),(0,_jsxRuntime.jsx)(_sharedUi.DataInspector,{data:e.newValue})]})]}),"added"===e.type&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.diffValue,children:(0,_jsxRuntime.jsx)(_sharedUi.DataInspector,{data:e.newValue})}),"removed"===e.type&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.diffValue,children:(0,_jsxRuntime.jsx)(_sharedUi.DataInspector,{data:e.oldValue})})]},t))})}function findChanges(e,t,a=""){const i=[];if("object"!=typeof e||"object"!=typeof t)return e!==t&&i.push({type:"modified",path:a||"root",oldValue:e,newValue:t}),i;if(null===e||null===t)return e!==t&&i.push({type:"modified",path:a||"root",oldValue:e,newValue:t}),i;const s=e,n=t,r=new Set([...Object.keys(s),...Object.keys(n)]);for(const e of r){const t=a?`${a}.${e}`:e,r=s[e],o=n[e];e in s?e in n?r!==o&&("object"!=typeof r||"object"!=typeof o||null===r||null===o||Array.isArray(r)||Array.isArray(o)?i.push({type:"modified",path:t,oldValue:r,newValue:o}):t.split(".").length<3?i.push(...findChanges(r,o,t)):i.push({type:"modified",path:t,oldValue:r,newValue:o})):i.push({type:"removed",path:t,oldValue:r}):i.push({type:"added",path:t,newValue:o})}return i}const styles=_reactNative.StyleSheet.create({container:{flex:1},header:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:12,backgroundColor:_sharedUi.macOSColors.background.card,borderBottomWidth:1,borderBottomColor:_sharedUi.macOSColors.border.default},headerContent:{flex:1,marginRight:12},actionType:{fontSize:14,fontWeight:"600",color:_sharedUi.macOSColors.text.primary,fontFamily:"monospace",marginBottom:6},headerMeta:{flexDirection:"row",alignItems:"center",gap:12},metaText:{fontSize:11,color:_sharedUi.macOSColors.text.muted},durationText:{fontSize:11,color:_sharedUi.macOSColors.text.muted,fontFamily:"monospace"},changeBadge:{backgroundColor:_sharedUi.macOSColors.semantic.warningBackground,paddingHorizontal:6,paddingVertical:2,borderRadius:4},changeBadgeText:{fontSize:10,color:_sharedUi.macOSColors.semantic.warning,fontWeight:"600"},tabContainer:{paddingHorizontal:12,paddingVertical:8},content:{flex:1},section:{paddingHorizontal:12,paddingBottom:20},emptyText:{fontSize:12,color:_sharedUi.macOSColors.text.muted,fontStyle:"italic",padding:8},noChangeContainer:{padding:20,alignItems:"center"},noChangeText:{fontSize:13,color:_sharedUi.macOSColors.text.muted},diffItem:{marginBottom:12,backgroundColor:_sharedUi.macOSColors.background.card,borderRadius:8,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default,overflow:"hidden"},diffHeader:{flexDirection:"row",alignItems:"center",gap:8,padding:8,borderBottomWidth:1,borderBottomColor:_sharedUi.macOSColors.border.default},diffTypeBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},diffTypeText:{fontSize:10,fontWeight:"700"},diffPath:{fontSize:12,color:_sharedUi.macOSColors.text.primary,fontFamily:"monospace"},diffValues:{padding:8,gap:8},diffValue:{padding:8},diffLabel:{fontSize:11,color:_sharedUi.macOSColors.text.muted,marginBottom:4,fontWeight:"600"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReduxActionInfoView=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),Clipboard=_interopRequireWildcard(require("expo-clipboard")),_sharedUi=require("@buoy-gg/shared-ui"),_license=require("@buoy-gg/license"),_dataViewer=require("@buoy-gg/shared-ui/dataViewer"),_reduxActionStore=require("../utils/reduxActionStore"),_buoyReduxMiddleware=require("../utils/buoyReduxMiddleware"),_ReduxActionButton=require("./ReduxActionButton"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var o=new WeakMap,r=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(i=t?r:o){if(i.has(e))return i.get(e);i.set(e,s)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(s,t,a):s[t]=e[t]);return s})(e,t)}function getCategoryInfo(e){switch(e){case"pending":return{label:"PENDING",color:_sharedUi.buoyColors.warning,bgColor:_sharedUi.buoyColors.warning+"26"};case"fulfilled":return{label:"FULFILLED",color:_sharedUi.buoyColors.success,bgColor:_sharedUi.buoyColors.success+"26"};case"rejected":return{label:"REJECTED",color:_sharedUi.buoyColors.error,bgColor:_sharedUi.buoyColors.error+"26"};case"internal":return{label:"INTERNAL",color:_sharedUi.buoyColors.textMuted,bgColor:_sharedUi.buoyColors.textMuted+"26"};case"query":return{label:"QUERY",color:_sharedUi.buoyColors.info,bgColor:_sharedUi.buoyColors.info+"26"};case"mutation":return{label:"MUTATION",color:_sharedUi.buoyColors.info,bgColor:_sharedUi.buoyColors.info+"26"};default:return{label:"ACTION",color:_sharedUi.buoyColors.info,bgColor:_sharedUi.buoyColors.info+"26"}}}function formatDuration(e){return void 0===e?"N/A":e<1?"<1ms":`${e.toFixed(1)}ms`}function SectionHeader({icon:e,title:t,badge:o}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sectionHeader,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sectionHeaderLeft,children:[(0,_jsxRuntime.jsx)(e,{size:14,color:_sharedUi.buoyColors.primary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:t})]}),o]})}function InfoRow({label:e,value:t,valueColor:o,mono:r=!1}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:e}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.infoValue,r&&styles.infoValueMono,o&&{color:o}],numberOfLines:1,ellipsizeMode:"middle",children:t})]})}function formatTime(e){const t=new Date(e);return`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}.${t.getMilliseconds().toString().padStart(3,"0")}`}const ReduxActionInfoView=exports.ReduxActionInfoView=(0,_react.memo)(function({action:e,onNavigateToAction:t}){const o=(0,_license.useIsPro)(),[r,i]=(0,_react.useState)(!1);(0,_react.useEffect)(()=>{r&&o&&i(!1)},[r,o]);const a=getCategoryInfo(e.category),s=void 0!==e.payload,n=e.meta&&Object.keys(e.meta).length>0,l=void 0!==e.error,d=(0,_react.useMemo)(()=>_reduxActionStore.reduxActionStore.getLinkedActions(e),[e]),c=d.length>1,u=c?_reduxActionStore.reduxActionStore.getBaseActionType(e.type):null,y=e.meta?.requestId?_reduxActionStore.reduxActionStore.getAsyncOperationDuration(e.meta.requestId):null,x=(0,_react.useCallback)(async()=>{if(o)try{const t=JSON.stringify(e.action,null,2);await Clipboard.setStringAsync(t)}catch(e){console.warn("Failed to copy action:",e)}else i(!0)},[e,o]),_=(0,_react.useCallback)(async()=>{if(o)try{const t=JSON.stringify(e.payload,null,2);await Clipboard.setStringAsync(t)}catch(e){console.warn("Failed to copy payload:",e)}else i(!0)},[e.payload,o]),g=(0,_react.useCallback)(()=>{e.action&&"object"==typeof e.action&&"type"in e.action&&(0,_buoyReduxMiddleware.replayAction)(e.action)},[e]),m=(0,_react.useCallback)(()=>{void 0!==e.nextState&&(0,_buoyReduxMiddleware.jumpToState)(e.nextState)},[e]);return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.container,contentContainerStyle:styles.contentContainer,showsVerticalScrollIndicator:!1,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.card,children:[(0,_jsxRuntime.jsx)(SectionHeader,{icon:_sharedUi.Info,title:"ACTION INFO"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardContent,children:[(0,_jsxRuntime.jsx)(InfoRow,{label:"Type",value:e.type,mono:!0}),e.sliceName&&(0,_jsxRuntime.jsx)(InfoRow,{label:"Slice",value:e.sliceName,mono:!0}),(0,_jsxRuntime.jsx)(InfoRow,{label:"Action",value:e.actionName,mono:!0}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.badgeRow,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.categoryBadge,{backgroundColor:a.bgColor}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.categoryText,{color:a.color}],children:a.label})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.durationBadge,e.isSlowAction&&styles.durationBadgeSlow],children:[(0,_jsxRuntime.jsx)(_sharedUi.Clock,{size:10,color:e.isSlowAction?_sharedUi.buoyColors.error:_sharedUi.buoyColors.textSecondary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.durationText,e.isSlowAction&&styles.durationTextSlow],children:formatDuration(e.duration)}),e.isSlowAction&&(0,_jsxRuntime.jsx)(_sharedUi.AlertTriangle,{size:10,color:_sharedUi.buoyColors.error})]}),e.hasStateChange?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.changesBadge,children:[(0,_jsxRuntime.jsx)(_sharedUi.Zap,{size:10,color:_sharedUi.buoyColors.success}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.changesText,children:e.diffSummary||"changed"})]}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.noChangesBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noChangesText,children:"no change"})})]})]})]}),c&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.card,children:[(0,_jsxRuntime.jsx)(SectionHeader,{icon:_sharedUi.Hash,title:"ASYNC FLOW",badge:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.asyncBadge,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.asyncBadgeText,children:[d.length," ACTIONS"]})})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardContent,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.baseActionType,children:u}),null!==y&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.totalDurationRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.totalDurationLabel,children:"Total Duration"}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.totalDurationValue,children:[y,"ms"]})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.timeline,children:d.map((o,r)=>{const i=getCategoryInfo(o.category),a=o.id===e.id;return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.timelineItem,a&&styles.timelineItemCurrent],onPress:()=>t?.(o),disabled:a||!t,activeOpacity:.7,children:[r<d.length-1&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.timelineConnector}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.timelineDot,{backgroundColor:i.color}]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.timelineContent,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.timelineHeader,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.timelineStatusBadge,{backgroundColor:i.bgColor}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.timelineStatusText,{color:i.color}],children:i.label})}),a&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.currentBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.currentBadgeText,children:"CURRENT"})})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.timelineTime,children:formatTime(o.timestamp)})]})]},o.id)})})]})]}),s&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.card,children:[(0,_jsxRuntime.jsx)(SectionHeader,{icon:_sharedUi.Box,title:"PAYLOAD",badge:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.typeBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.typeText,children:Array.isArray(e.payload)?"ARRAY":"object"==typeof e.payload?"OBJECT":typeof e.payload?.toString().toUpperCase()})})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dataViewerContainer,children:(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"",data:(0,_sharedUi.parseValue)(e.payload),showTypeFilter:!1})})]}),n&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.card,children:[(0,_jsxRuntime.jsx)(SectionHeader,{icon:_sharedUi.Hash,title:"ASYNC METADATA",badge:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.categoryBadge,{backgroundColor:a.bgColor}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.categoryText,{color:a.color}],children:"RTK THUNK"})})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardContent,children:[e.meta?.requestId&&(0,_jsxRuntime.jsx)(InfoRow,{label:"Request ID",value:e.meta.requestId,mono:!0}),e.meta?.requestStatus&&(0,_jsxRuntime.jsx)(InfoRow,{label:"Status",value:e.meta.requestStatus.toUpperCase(),valueColor:a.color}),void 0!==e.meta?.arg&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.argSection,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.argLabel,children:"Original Argument"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.argValueContainer,children:"object"==typeof e.meta.arg?(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"",data:(0,_sharedUi.parseValue)(e.meta.arg),showTypeFilter:!1}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.argValue,children:JSON.stringify(e.meta.arg)})})]}),e.meta?.rejectedWithValue&&(0,_jsxRuntime.jsx)(InfoRow,{label:"Rejected With Value",value:"true",valueColor:_sharedUi.buoyColors.error}),e.meta?.aborted&&(0,_jsxRuntime.jsx)(InfoRow,{label:"Aborted",value:"true",valueColor:_sharedUi.buoyColors.warning}),e.meta?.condition&&(0,_jsxRuntime.jsx)(InfoRow,{label:"Condition",value:"true",valueColor:_sharedUi.buoyColors.textMuted})]})]}),l&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.card,styles.errorCard],children:[(0,_jsxRuntime.jsx)(SectionHeader,{icon:_sharedUi.AlertCircle,title:"ERROR",badge:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.errorBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.errorBadgeText,children:"REJECTED"})})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dataViewerContainer,children:"object"==typeof e.error?(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"",data:(0,_sharedUi.parseValue)(e.error),showTypeFilter:!1}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.errorText,children:String(e.error)})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.card,children:[(0,_jsxRuntime.jsx)(SectionHeader,{icon:_sharedUi.FileText,title:"FULL ACTION OBJECT"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dataViewerContainer,children:(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"",data:(0,_sharedUi.parseValue)(e.action),showTypeFilter:!1})})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.actionFooter,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionsGrid,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionButtonWrapper,children:[(0,_jsxRuntime.jsx)(_ReduxActionButton.ReduxActionButton,{type:"replay",text:"REPLAY",onPress:g}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionDescription,children:"Dispatch again"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionButtonWrapper,children:[(0,_jsxRuntime.jsx)(_ReduxActionButton.ReduxActionButton,{type:"jump",text:"JUMP",onPress:m}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionDescription,children:"Restore this state"})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionButtonWrapper,children:[(0,_jsxRuntime.jsx)(_ReduxActionButton.ReduxActionButton,{type:"copy",text:"COPY ACTION",onPress:x}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionDescription,children:o?"Copy to clipboard":"Pro feature"})]}),s&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionButtonWrapper,children:[(0,_jsxRuntime.jsx)(_ReduxActionButton.ReduxActionButton,{type:"copy",text:"COPY PAYLOAD",onPress:_}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.actionDescription,children:o?"Copy payload only":"Pro feature"})]})]})}),(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:r,onClose:()=>i(!1),featureName:"Copy"})]})}),styles=_reactNative.StyleSheet.create({container:{flex:1},contentContainer:{padding:8,paddingBottom:100,gap:16},card:{backgroundColor:_sharedUi.buoyColors.card,borderRadius:6,borderWidth:1,borderColor:_sharedUi.buoyColors.primary+"4D",overflow:"hidden",shadowColor:_sharedUi.buoyColors.primary,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},errorCard:{borderColor:_sharedUi.buoyColors.error+"4D",shadowColor:_sharedUi.buoyColors.error},sectionHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:_sharedUi.buoyColors.primary+"33",backgroundColor:_sharedUi.buoyColors.primary+"15"},sectionHeaderLeft:{flexDirection:"row",alignItems:"center",gap:6},sectionTitle:{fontSize:12,fontWeight:"600",letterSpacing:.5,color:_sharedUi.buoyColors.primary,fontFamily:"monospace"},cardContent:{padding:14,gap:10},infoRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},infoLabel:{fontSize:11,color:_sharedUi.buoyColors.textMuted,fontWeight:"500"},infoValue:{fontSize:11,color:_sharedUi.buoyColors.text,fontWeight:"500",flex:1,textAlign:"right",marginLeft:12},infoValueMono:{fontFamily:"monospace"},badgeRow:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:6},categoryBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4},categoryText:{fontSize:9,fontWeight:"700",letterSpacing:.3},durationBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:_sharedUi.buoyColors.input},durationBadgeSlow:{backgroundColor:_sharedUi.buoyColors.error+"26"},durationText:{fontSize:9,fontWeight:"600",color:_sharedUi.buoyColors.textSecondary,fontFamily:"monospace"},durationTextSlow:{color:_sharedUi.buoyColors.error},changesBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:_sharedUi.buoyColors.success+"26"},changesText:{fontSize:9,fontWeight:"600",color:_sharedUi.buoyColors.success},noChangesBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:_sharedUi.buoyColors.input},noChangesText:{fontSize:9,fontWeight:"600",color:_sharedUi.buoyColors.textMuted},typeBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:3,backgroundColor:_sharedUi.buoyColors.input},typeText:{fontSize:8,fontWeight:"600",color:_sharedUi.buoyColors.textMuted,fontFamily:"monospace"},dataViewerContainer:{backgroundColor:_sharedUi.buoyColors.base,minHeight:60},argSection:{marginTop:4},argLabel:{fontSize:11,color:_sharedUi.buoyColors.textMuted,fontWeight:"500",marginBottom:6},argValueContainer:{backgroundColor:_sharedUi.buoyColors.base,borderRadius:6,borderWidth:1,borderColor:_sharedUi.buoyColors.border,overflow:"hidden"},argValue:{fontSize:11,color:_sharedUi.buoyColors.text,fontFamily:"monospace",padding:10},errorBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:_sharedUi.buoyColors.error+"26"},errorBadgeText:{fontSize:9,fontWeight:"700",color:_sharedUi.buoyColors.error,letterSpacing:.3},errorText:{fontSize:12,color:_sharedUi.buoyColors.error,fontFamily:"monospace",padding:14},asyncBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:_sharedUi.buoyColors.primary+"26"},asyncBadgeText:{fontSize:9,fontWeight:"700",color:_sharedUi.buoyColors.primary,letterSpacing:.3},baseActionType:{fontSize:12,fontWeight:"600",color:_sharedUi.buoyColors.text,fontFamily:"monospace",marginBottom:8},totalDurationRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:12,paddingBottom:12,borderBottomWidth:1,borderBottomColor:_sharedUi.buoyColors.border},totalDurationLabel:{fontSize:11,color:_sharedUi.buoyColors.textMuted,fontWeight:"500"},totalDurationValue:{fontSize:14,fontWeight:"700",color:_sharedUi.buoyColors.success,fontFamily:"monospace"},timeline:{gap:0},timelineItem:{flexDirection:"row",alignItems:"flex-start",paddingVertical:8,paddingHorizontal:8,borderRadius:8,position:"relative"},timelineItemCurrent:{backgroundColor:_sharedUi.buoyColors.primary+"15"},timelineConnector:{position:"absolute",left:13,top:24,bottom:-8,width:2,backgroundColor:_sharedUi.buoyColors.border},timelineDot:{width:12,height:12,borderRadius:6,marginRight:10,marginTop:2},timelineContent:{flex:1},timelineHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:2},timelineStatusBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},timelineStatusText:{fontSize:9,fontWeight:"700",letterSpacing:.3},currentBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4,backgroundColor:_sharedUi.buoyColors.primary},currentBadgeText:{fontSize:8,fontWeight:"700",color:"#fff",letterSpacing:.3},timelineTime:{fontSize:10,color:_sharedUi.buoyColors.textMuted,fontFamily:"monospace"},actionFooter:{backgroundColor:_sharedUi.buoyColors.card,borderRadius:6,borderWidth:1,borderColor:_sharedUi.buoyColors.primary+"4D",paddingVertical:12,paddingHorizontal:12,shadowColor:_sharedUi.buoyColors.primary,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},actionsGrid:{flexDirection:"row",flexWrap:"wrap",gap:12,justifyContent:"flex-start"},actionButtonWrapper:{alignItems:"center",gap:4},actionDescription:{fontSize:9,color:_sharedUi.buoyColors.textMuted,textAlign:"center"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReduxActionItem=ReduxActionItem;var _reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_reduxActionStore=require("../utils/reduxActionStore"),_jsxRuntime=require("react/jsx-runtime");const OPERATION_COLORS=[{bg:"rgba(99, 102, 241, 0.25)",text:"#818CF8"},{bg:"rgba(236, 72, 153, 0.25)",text:"#F472B6"},{bg:"rgba(14, 165, 233, 0.25)",text:"#38BDF8"},{bg:"rgba(245, 158, 11, 0.25)",text:"#FBBF24"},{bg:"rgba(16, 185, 129, 0.25)",text:"#34D399"},{bg:"rgba(168, 85, 247, 0.25)",text:"#C084FC"},{bg:"rgba(239, 68, 68, 0.25)",text:"#F87171"},{bg:"rgba(20, 184, 166, 0.25)",text:"#2DD4BF"}];function getOperationColor(e){return e<=0?{bg:"rgba(142, 142, 147, 0.2)",text:_sharedUi.buoyColors.textSecondary}:OPERATION_COLORS[(e-1)%OPERATION_COLORS.length]}function formatRelativeTime(e){const t=Date.now()-e;return t<1e3?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:`${Math.floor(t/36e5)}h ago`}function getStatusLabel(e){switch(e){case"pending":return"Pending";case"fulfilled":return"Fulfilled";case"rejected":return"Rejected";case"internal":return"Internal";case"query":return"Query";case"mutation":return"Mutation";default:return"Action"}}function getStatusColor(e,t){switch(e){case"pending":return _sharedUi.buoyColors.warning;case"fulfilled":return _sharedUi.buoyColors.success;case"rejected":return _sharedUi.buoyColors.error;case"internal":return _sharedUi.buoyColors.textMuted;case"query":case"mutation":return _sharedUi.buoyColors.info;default:return t?_sharedUi.buoyColors.success:_sharedUi.buoyColors.textSecondary}}function getSublabel(e){const t=[];return void 0!==e.duration&&e.duration>0&&t.push(`${e.duration.toFixed(1)}ms`),e.hasStateChange?t.push(e.diffSummary||"changed"):t.push("no change"),t.join(" · ")}function getPrimaryText(e){return"internal"===e.category?e.type:e.sliceName?`${e.sliceName}/${e.actionName.toLowerCase()}`:e.type}function ReduxActionItem({action:e,onPress:t}){const r=getStatusColor(e.category,e.hasStateChange),a=getStatusLabel(e.category),s=getSublabel(e),n=getPrimaryText(e),o=_reduxActionStore.reduxActionStore.getLinkedActions(e),i=o.length,c=i>1,u=c?o.findIndex(t=>t.id===e.id)+1:0,l=c&&e.meta?.requestId?_reduxActionStore.reduxActionStore.getAsyncOperationIndex(e.meta.requestId):0,d=getOperationColor(l);let g;return e.isSlowAction?g=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.badgeContainer,children:[c&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.asyncSequenceBadge,{backgroundColor:d.bg}],children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[styles.asyncSequenceText,{color:d.text}],children:[u,"/",i," #",l]})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.slowBadge,children:(0,_jsxRuntime.jsx)(_sharedUi.Clock,{size:12,color:_sharedUi.buoyColors.error})})]}):"rejected"===e.category?g=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.badgeContainer,children:[c&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.asyncSequenceBadge,{backgroundColor:d.bg}],children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[styles.asyncSequenceText,{color:d.text}],children:[u,"/",i," #",l]})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.errorBadge,children:(0,_jsxRuntime.jsx)(_sharedUi.AlertCircle,{size:12,color:_sharedUi.buoyColors.error})})]}):c?g=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.badgeContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.asyncSequenceBadge,{backgroundColor:d.bg}],children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[styles.asyncSequenceText,{color:d.text}],children:[u,"/",i," #",l]})}),e.hasStateChange&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.changeBadge,children:(0,_jsxRuntime.jsx)(_sharedUi.Zap,{size:12,color:_sharedUi.buoyColors.warning})})]}):e.hasStateChange&&(g=(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.changeBadge,children:(0,_jsxRuntime.jsx)(_sharedUi.Zap,{size:12,color:_sharedUi.buoyColors.warning})})),(0,_jsxRuntime.jsx)(_sharedUi.CompactRow,{statusDotColor:r,statusLabel:a,statusSublabel:s,primaryText:n,bottomRightText:formatRelativeTime(e.timestamp),customBadge:g,showChevron:!0,onPress:()=>t(e)})}const styles=_reactNative.StyleSheet.create({badgeContainer:{flexDirection:"row",alignItems:"center",gap:4},changeBadge:{paddingHorizontal:4},slowBadge:{paddingHorizontal:4},errorBadge:{paddingHorizontal:4},asyncSequenceBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},asyncSequenceText:{fontSize:10,fontWeight:"600",fontFamily:"monospace"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReduxDetailViewToggle=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(e,r){if("function"==typeof WeakMap)var t=new WeakMap,a=new WeakMap;return(_interopRequireWildcard=function(e,r){if(!r&&e&&e.__esModule)return e;var i,o,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(i=r?a:t){if(i.has(e))return i.get(e);i.set(e,s)}for(const r in e)"default"!==r&&{}.hasOwnProperty.call(e,r)&&((o=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,r))&&(o.get||o.set)?i(s,r,o):s[r]=e[r]);return s})(e,r)}const VIEW_CONFIGS=[{key:"action",label:"ACTION",description:"View action details",icon:_sharedUi.FileText,activeColor:_sharedUi.macOSColors.semantic.warning},{key:"state",label:"STATE",description:"View current state",icon:_sharedUi.Database,activeColor:_sharedUi.macOSColors.semantic.info},{key:"diff",label:"DIFF",description:"Compare changes",icon:_sharedUi.GitBranch,activeColor:_sharedUi.macOSColors.semantic.success}],ReduxDetailViewToggle=exports.ReduxDetailViewToggle=(0,_react.memo)(function({activeView:e,onViewChange:r,diffDisabled:t=!1}){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,children:VIEW_CONFIGS.map(a=>{const i=e===a.key,o="diff"===a.key&&t,s=a.icon;return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.card,i&&[styles.cardActive,{borderColor:a.activeColor}],o&&styles.cardDisabled],onPress:()=>!o&&r(a.key),activeOpacity:o?1:.8,disabled:o,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardContent,children:[(0,_jsxRuntime.jsx)(s,{size:14,color:i?a.activeColor:o?_sharedUi.macOSColors.text.muted:_sharedUi.macOSColors.text.secondary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.cardLabel,i&&[styles.cardLabelActive,{color:a.activeColor}],o&&styles.cardLabelDisabled],children:a.label})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.cardDescription,i&&styles.cardDescriptionActive,o&&styles.cardDescriptionDisabled],children:a.description})]},a.key)})})}),styles=_reactNative.StyleSheet.create({container:{flexDirection:"row",gap:8,padding:14,backgroundColor:_sharedUi.macOSColors.background.base},card:{flex:1,backgroundColor:_sharedUi.macOSColors.background.card,borderRadius:12,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default,padding:10,gap:4},cardActive:{borderWidth:1.5,backgroundColor:"rgba(0, 184, 230, 0.05)",shadowColor:_sharedUi.macOSColors.semantic.info,shadowOffset:{width:0,height:2},shadowOpacity:.1,shadowRadius:8,elevation:3},cardDisabled:{opacity:.5},cardContent:{flexDirection:"row",alignItems:"center",gap:6},cardLabel:{fontSize:10,fontWeight:"700",letterSpacing:.5,color:_sharedUi.macOSColors.text.secondary},cardLabelActive:{color:_sharedUi.macOSColors.text.primary},cardLabelDisabled:{color:_sharedUi.macOSColors.text.muted},cardDescription:{fontSize:9,color:_sharedUi.macOSColors.text.muted,lineHeight:12},cardDescriptionActive:{color:_sharedUi.macOSColors.text.secondary},cardDescriptionDisabled:{color:_sharedUi.macOSColors.text.muted}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"REDUX_ICON_COLOR",{enumerable:!0,get:function(){return _floatingToolsCore.REDUX_ICON_COLOR}}),Object.defineProperty(exports,"ReduxIcon",{enumerable:!0,get:function(){return _floatingToolsCore.ReduxIcon}});var _floatingToolsCore=require("@buoy-gg/floating-tools-core");
|
|
@@ -0,0 +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}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"FREE_TIER_ACTION_LIMIT",{enumerable:!0,get:function(){return _ReduxModal.FREE_TIER_ACTION_LIMIT}}),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}});var _ReduxModal=require("./ReduxModal"),_ReduxActionItem=require("./ReduxActionItem"),_ReduxActionDetailView=require("./ReduxActionDetailView"),_ReduxIcon=require("./ReduxIcon");
|
|
@@ -0,0 +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");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useReduxActions=useReduxActions;var _react=require("react"),_reduxActionStore=require("../utils/reduxActionStore");function useReduxActions(){const[e,t]=(0,_react.useState)(()=>_reduxActionStore.reduxActionStore.getActions()),[r,o]=(0,_react.useState)({}),[c,u]=(0,_react.useState)(()=>_reduxActionStore.reduxActionStore.getEnabled()),[n,i]=(0,_react.useState)(null);(0,_react.useEffect)(()=>{const e=_reduxActionStore.reduxActionStore.subscribe(e=>{t(e)});return()=>{e()}},[]);const s=(0,_react.useMemo)(()=>_reduxActionStore.reduxActionStore.filterActions(r),[e,r]),a=(0,_react.useMemo)(()=>_reduxActionStore.reduxActionStore.getStats(),[e]),d=(0,_react.useMemo)(()=>_reduxActionStore.reduxActionStore.getUniqueActionTypes(),[e]),A=(0,_react.useCallback)(()=>{_reduxActionStore.reduxActionStore.clearActions(),i(null)},[]),S=(0,_react.useCallback)(()=>{const e=!c;_reduxActionStore.reduxActionStore.setEnabled(e),u(e)},[c]),l=(0,_react.useCallback)(e=>_reduxActionStore.reduxActionStore.getActionById(e),[]);return{actions:e,filteredActions:s,filter:r,setFilter:o,stats:a,clearActions:A,isEnabled:c,toggleCapture:S,actionTypes:d,getActionById:l,selectedAction:n,setSelectedAction:i}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _types=require("./types");Object.keys(_types).forEach(function(e){"default"!==e&&"__esModule"!==e&&(e in exports&&exports[e]===_types[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _types[e]}}))});var _utils=require("./utils");Object.keys(_utils).forEach(function(e){"default"!==e&&"__esModule"!==e&&(e in exports&&exports[e]===_utils[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _utils[e]}}))});var _hooks=require("./hooks");Object.keys(_hooks).forEach(function(e){"default"!==e&&"__esModule"!==e&&(e in exports&&exports[e]===_hooks[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _hooks[e]}}))});var _components=require("./components");Object.keys(_components).forEach(function(e){"default"!==e&&"__esModule"!==e&&(e in exports&&exports[e]===_components[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return _components[e]}}))});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +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,n=r.type;if(n?.startsWith("@@buoy/"))return t(o);const i=performance.now(),a=e.getState(),u=t(o),s=e.getState(),c=performance.now()-i;return _reduxActionStore.reduxActionStore.addAction(r,a,s,c),u});function createBuoyReduxMiddleware(e={}){const{maxActions:t=200,ignoreActions:o=[]}=e;return _reduxActionStore.reduxActionStore.setMaxActions(t),e=>(storeDispatch=e.dispatch,t=>r=>{const n=r,i=n.type||"";if(i?.startsWith("@@buoy/"))return t(r);if(o.includes(i))return t(r);const a=performance.now(),u=e.getState(),s=t(r),c=e.getState(),d=performance.now()-a;return _reduxActionStore.reduxActionStore.addAction(n,u,c,d),s})}exports.buoyReduxMiddleware=buoyReduxMiddleware;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createReduxHistoryAdapter=createReduxHistoryAdapter,exports.reduxHistoryAdapter=void 0;var _reduxActionStore=require("./reduxActionStore"),_ReduxIcon=require("../components/ReduxIcon");const REDUX_CAPABILITIES={timeTravel:!1,toggle:!1,edit:!1,diff:!0,export:!0,import:!1,reset:!0,recording:!0};function toHistoryEntry(t,e,r){return{id:t.id,label:t.type,timestamp:t.timestamp,data:t.payload??t.action,prevState:t.prevState,nextState:t.nextState,hasStateChange:t.hasStateChange,duration:t.duration,source:"redux",isCurrent:0===e,isInFuture:!1,isSkipped:!1,meta:{fullAction:t.action}}}function createReduxHistoryAdapter(t){const{icon:e=_ReduxIcon.ReduxIcon,color:r="#764ABC",name:o="Redux"}=t??{};let n=0;return{id:"redux",name:o,icon:e,color:r,capabilities:REDUX_CAPABILITIES,subscribe:t=>_reduxActionStore.reduxActionStore.subscribe(()=>{t()}),getEntries:()=>{const t=_reduxActionStore.reduxActionStore.getActions();return t.map((e,r)=>toHistoryEntry(e,r,t.length))},getEntryCount:()=>_reduxActionStore.reduxActionStore.getActions().length,getCurrentState:()=>{const t=_reduxActionStore.reduxActionStore.getActions();if(0!==t.length)return t[0].nextState},getStateAtEntry:t=>{const e=_reduxActionStore.reduxActionStore.getActionById(String(t));return e?.nextState},get currentIndex(){return n},jumpTo:t=>{const e=_reduxActionStore.reduxActionStore.getActions().findIndex(e=>e.id===String(t));-1!==e&&(n=e)},get isRecording(){return _reduxActionStore.reduxActionStore.getEnabled()},setRecording:t=>{_reduxActionStore.reduxActionStore.setEnabled(t)},reset:()=>{_reduxActionStore.reduxActionStore.clearActions(),n=0},exportHistory:()=>{const t=_reduxActionStore.reduxActionStore.getActions();return JSON.stringify(t,null,2)}}}const reduxHistoryAdapter=exports.reduxHistoryAdapter=createReduxHistoryAdapter();
|
|
@@ -0,0 +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");
|
|
@@ -0,0 +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=e!==n,r=t.type||"UNKNOWN_ACTION",o=getActionCategory(r),{sliceName:a,actionName:c}=parseActionType(r),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:r,payload:t.payload,action:t,timestamp:Date.now(),prevState:e,nextState:n,duration:i,hasStateChange:s,category:o,sliceName:a,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}}const reduxActionStore=exports.reduxActionStore=new ReduxActionStore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export{reduxToolPreset,createReduxTool}from"./preset";export{buoyReduxMiddleware,createBuoyReduxMiddleware}from"./redux/utils";export{createReduxHistoryAdapter,reduxHistoryAdapter}from"./redux/utils";export*from"./redux";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{ReduxModal}from"./redux/components/ReduxModal";import{ReduxIcon}from"./redux/components/ReduxIcon";import{jsx as _jsx}from"react/jsx-runtime";export const reduxToolPreset={id:"redux",name:"REDUX",description:"Redux action & state inspector",slot:"both",icon:({size:e})=>_jsx(ReduxIcon,{size:e}),component:ReduxModal,props:{enableSharedModalDimensions:!1}};export function createReduxTool(e){return{id:e?.id||"redux",name:e?.name||"REDUX",description:e?.description||"Redux action & state inspector",slot:"both",icon:({size:o})=>_jsx(ReduxIcon,{size:o,color:e?.iconColor}),component:ReduxModal,props:{enableSharedModalDimensions:void 0!==e?.enableSharedModalDimensions&&e.enableSharedModalDimensions}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{TouchableOpacity,Text,View,StyleSheet}from"react-native";import{buoyColors}from"@buoy-gg/shared-ui";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const buttonConfigs={replay:{color:buoyColors.success,backgroundColor:buoyColors.success+"15",borderColor:buoyColors.success+"40",textColor:buoyColors.success},copy:{color:buoyColors.primary,backgroundColor:buoyColors.primary+"15",borderColor:buoyColors.primary+"40",textColor:buoyColors.primary},jump:{color:buoyColors.warning,backgroundColor:buoyColors.warning+"15",borderColor:buoyColors.warning+"40",textColor:buoyColors.warning},skip:{color:buoyColors.textSecondary,backgroundColor:buoyColors.textSecondary+"26",borderColor:buoyColors.textSecondary+"59",textColor:buoyColors.textSecondary},clear:{color:buoyColors.error,backgroundColor:buoyColors.error+"15",borderColor:buoyColors.error+"40",textColor:buoyColors.error},diff:{color:buoyColors.info,backgroundColor:buoyColors.info+"15",borderColor:buoyColors.info+"40",textColor:buoyColors.info}};export function ReduxActionButton({onPress:o,text:r,type:t,disabled:e=!1}){const s=buttonConfigs[t];return _jsxs(TouchableOpacity,{disabled:e,onPress:o,style:[styles.button,{backgroundColor:e?buoyColors.textMuted+"1A":s.backgroundColor,borderColor:e?buoyColors.textMuted+"33":s.borderColor,opacity:e?.5:1}],activeOpacity:.7,accessibilityRole:"button",accessibilityLabel:r,accessibilityState:{disabled:e},children:[_jsx(View,{style:[styles.dot,{backgroundColor:e?buoyColors.textMuted:s.color}]}),_jsx(Text,{style:[styles.text,{color:e?buoyColors.textMuted:s.textColor}],children:r})]})}const styles=StyleSheet.create({button:{flexDirection:"row",alignItems:"center",justifyContent:"center",borderRadius:6,borderWidth:1,paddingHorizontal:12,paddingVertical:6,height:25,minWidth:80,shadowOffset:{width:0,height:1},shadowOpacity:.2,shadowRadius:2,elevation:2},dot:{width:5,height:5,borderRadius:3,marginRight:6,shadowColor:buoyColors.text,shadowOffset:{width:0,height:0},shadowOpacity:.6,shadowRadius:2},text:{fontSize:10,fontWeight:"600",letterSpacing:.5,textTransform:"uppercase",fontFamily:"monospace",height:12}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{View,Text,StyleSheet,ScrollView}from"react-native";import{useState,useCallback,useMemo}from"react";import{macOSColors,EventStepperFooter,formatRelativeTime,parseValue}from"@buoy-gg/shared-ui";import{DataViewer,SplitDiffViewer,TreeDiffViewer,diffThemes}from"@buoy-gg/shared-ui/dataViewer";import{ReduxDetailViewToggle}from"./ReduxDetailViewToggle";import{ReduxActionInfoView}from"./ReduxActionInfoView";import{DiffModeTabs,CompareBar}from"@buoy-gg/shared-ui";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";function getActionColor(e){return e.includes("/pending")?macOSColors.semantic.warning:e.includes("/fulfilled")?macOSColors.semantic.success:e.includes("/rejected")?macOSColors.semantic.error:e.startsWith("@@")?macOSColors.text.muted:macOSColors.semantic.info}function getActionLabel(e){if(e.includes("/pending"))return"PENDING";if(e.includes("/fulfilled"))return"FULFILLED";if(e.includes("/rejected"))return"REJECTED";if(e.startsWith("@@"))return"INTERNAL";const t=e.split("/");return t[t.length-1]?.toUpperCase()||"ACTION"}function getValueType(e){return null===e?"null":void 0===e?"undefined":Array.isArray(e)?"array":typeof e}function formatTimestamp(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}const DIFF_MODE_TABS=[{key:"tree",label:"TREE VIEW"},{key:"split",label:"SPLIT VIEW"}];export function ReduxActionDetailContent({action:e,actions:t,selectedIndex:o,onIndexChange:a,disableInternalFooter:i=!1}){const[n,l]=useState("action"),[r,s]=useState("tree"),d=t.length,c=getActionColor(e.type),m=getActionLabel(e.type),u=getValueType(e.nextState),f=d-o,x=f-1,p=o<d-1?o+1:null,g=null!==p?t[p]:null,y=useMemo(()=>({index:p??0,label:x>0?`#${x}`:"Initial",timestamp:g?formatTimestamp(g.timestamp):"",relativeTime:g?formatRelativeTime(new Date(g.timestamp)):"state",badge:g?_jsx(View,{style:[styles.actionBadgeSmall,{backgroundColor:`${getActionColor(g.type)}20`}],children:_jsx(Text,{style:[styles.actionTextSmall,{color:getActionColor(g.type)}],children:getActionLabel(g.type)})}):void 0}),[p,g,x]),b=useMemo(()=>({index:o,label:`#${f}`,timestamp:formatTimestamp(e.timestamp),relativeTime:formatRelativeTime(new Date(e.timestamp)),badge:_jsx(View,{style:[styles.actionBadgeSmall,{backgroundColor:`${c}20`}],children:_jsx(Text,{style:[styles.actionTextSmall,{color:c}],children:m})})}),[o,e.timestamp,c,m,f]),h=useCallback(()=>{const t=parseValue(e.nextState);return _jsxs(View,{style:styles.contentCard,children:[_jsxs(View,{style:styles.valueHeader,children:[_jsx(Text,{style:styles.valueLabel,children:"STATE AFTER ACTION"}),_jsxs(View,{style:styles.valueHeaderBadges,children:[_jsx(View,{style:[styles.actionBadge,{backgroundColor:`${c}20`}],children:_jsx(Text,{style:[styles.actionText,{color:c}],children:m})}),_jsx(View,{style:styles.typeBadge,children:_jsx(Text,{style:styles.typeText,children:u.toUpperCase()})})]})]}),_jsx(View,{style:styles.valueBox,children:"object"!==u&&"array"!==u||!t?_jsx(Text,{style:styles.valueText,children:null===t?"null":void 0===t?"undefined":"string"===u?`"${t}"`:String(t)}):_jsx(DataViewer,{title:"",data:t,showTypeFilter:!1})})]})},[e.nextState,c,m,u]),S=useCallback(()=>{const t=parseValue(e.prevState),o=parseValue(e.nextState);return"split"===r?_jsx(ScrollView,{style:{flex:1},showsVerticalScrollIndicator:!0,children:_jsx(SplitDiffViewer,{oldValue:t,newValue:o,theme:diffThemes.devToolsDefault,options:{hideLineNumbers:!1,disableWordDiff:!1,showDiffOnly:!1,compareMethod:"words",contextLines:3},showThemeName:!1})}):_jsx(TreeDiffViewer,{oldValue:t,newValue:o})},[e.prevState,e.nextState,r]),C=useCallback(()=>{a(Math.min(d-1,o+1))},[o,d,a]),T=useCallback(()=>{a(Math.max(0,o-1))},[o,a]),w=d<=1;return _jsxs(View,{style:styles.container,children:[_jsx(ReduxDetailViewToggle,{activeView:n,onViewChange:l,diffDisabled:w}),_jsxs(View,{style:styles.contentArea,children:["action"===n&&_jsx(ReduxActionInfoView,{action:e}),"state"===n&&_jsx(View,{style:styles.stateContainer,children:h()}),"diff"===n&&_jsxs(View,{style:styles.diffContainer,children:[_jsx(DiffModeTabs,{tabs:DIFF_MODE_TABS,activeTab:r,onTabChange:s}),_jsx(CompareBar,{leftEvent:y,rightEvent:b}),_jsx(View,{style:styles.diffContent,children:S()})]})]}),!i&&d>1&&_jsx(EventStepperFooter,{currentIndex:f-1,totalItems:d,onPrevious:C,onNext:T,itemLabel:"Action",subtitle:formatRelativeTime(new Date(e.timestamp)),absolute:!0})]})}export function ReduxActionDetailFooter({action:e,actions:t,selectedIndex:o,onIndexChange:a}){const i=t.length;return i<=1?null:_jsx(EventStepperFooter,{currentIndex:i-o-1,totalItems:i,onPrevious:()=>a(Math.min(i-1,o+1)),onNext:()=>a(Math.max(0,o-1)),itemLabel:"Action",subtitle:formatRelativeTime(new Date(e.timestamp))})}const styles=StyleSheet.create({container:{flex:1,backgroundColor:macOSColors.background.base},contentArea:{flex:1,paddingBottom:96},stateContainer:{flex:1,padding:14},contentCard:{backgroundColor:macOSColors.background.card,borderRadius:14,padding:14,borderWidth:1,borderColor:macOSColors.border.default},valueHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},valueLabel:{fontSize:10,color:macOSColors.text.secondary,fontFamily:"monospace",letterSpacing:.5,fontWeight:"600"},valueHeaderBadges:{flexDirection:"row",alignItems:"center",gap:6},actionBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4},actionText:{fontSize:9,fontWeight:"700",fontFamily:"monospace",letterSpacing:.3},typeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4,backgroundColor:macOSColors.background.input},typeText:{fontSize:9,fontWeight:"600",color:macOSColors.text.muted,fontFamily:"monospace"},valueBox:{backgroundColor:macOSColors.background.base,borderRadius:6,borderWidth:1,borderColor:macOSColors.border.input,padding:8},valueText:{fontSize:12,color:macOSColors.text.primary,fontFamily:"monospace",lineHeight:18},diffContainer:{flex:1},diffContent:{flex:1,paddingHorizontal:14},actionBadgeSmall:{paddingHorizontal:6,paddingVertical:1,borderRadius:3},actionTextSmall:{fontSize:8,fontWeight:"700",fontFamily:"monospace"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{useState}from"react";import{View,Text,StyleSheet,ScrollView}from"react-native";import{macOSColors,TabSelector,DataInspector,CollapsibleSection,CopyButton}from"@buoy-gg/shared-ui";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export function ReduxActionDetailView({action:e}){const[t,a]=useState("action"),o=new Date(e.timestamp).toLocaleTimeString();return _jsxs(View,{style:styles.container,children:[_jsxs(View,{style:styles.header,children:[_jsxs(View,{style:styles.headerContent,children:[_jsx(Text,{style:styles.actionType,numberOfLines:2,children:e.type}),_jsxs(View,{style:styles.headerMeta,children:[_jsx(Text,{style:styles.metaText,children:o}),void 0!==e.duration&&_jsxs(Text,{style:styles.durationText,children:[e.duration.toFixed(2),"ms"]}),e.hasStateChange&&_jsx(View,{style:styles.changeBadge,children:_jsx(Text,{style:styles.changeBadgeText,children:"State Changed"})})]})]}),_jsx(CopyButton,{value:JSON.stringify({type:e.type,payload:e.payload,timestamp:e.timestamp,duration:e.duration,hasStateChange:e.hasStateChange},null,2),size:16})]}),_jsx(View,{style:styles.tabContainer,children:_jsx(TabSelector,{tabs:[{key:"action",label:"Action"},{key:"state",label:"State"},{key:"diff",label:"Diff"}],activeTab:t,onTabChange:e=>a(e)})}),_jsxs(ScrollView,{style:styles.content,showsVerticalScrollIndicator:!0,children:["action"===t&&_jsxs(View,{style:styles.section,children:[_jsx(CollapsibleSection,{title:"Payload",defaultOpen:!0,children:void 0!==e.payload?_jsx(DataInspector,{data:e.payload}):_jsx(Text,{style:styles.emptyText,children:"No payload"})}),_jsx(CollapsibleSection,{title:"Full Action",defaultOpen:!1,children:_jsx(DataInspector,{data:e.action})})]}),"state"===t&&_jsxs(View,{style:styles.section,children:[_jsx(CollapsibleSection,{title:"Previous State",defaultOpen:!1,children:_jsx(DataInspector,{data:e.prevState})}),_jsx(CollapsibleSection,{title:"Next State",defaultOpen:!0,children:_jsx(DataInspector,{data:e.nextState})})]}),"diff"===t&&_jsx(View,{style:styles.section,children:e.hasStateChange?_jsx(StateDiff,{prevState:e.prevState,nextState:e.nextState}):_jsx(View,{style:styles.noChangeContainer,children:_jsx(Text,{style:styles.noChangeText,children:"No state changes from this action"})})})]})]})}function StateDiff({prevState:e,nextState:t}){const a=findChanges(e,t);return 0===a.length?_jsx(View,{style:styles.noChangeContainer,children:_jsx(Text,{style:styles.noChangeText,children:"No differences detected"})}):_jsx(View,{children:a.map((e,t)=>_jsxs(View,{style:styles.diffItem,children:[_jsxs(View,{style:styles.diffHeader,children:[_jsx(View,{style:[styles.diffTypeBadge,{backgroundColor:"added"===e.type?macOSColors.semantic.successBackground:"removed"===e.type?macOSColors.semantic.errorBackground:macOSColors.semantic.warningBackground}],children:_jsx(Text,{style:[styles.diffTypeText,{color:"added"===e.type?macOSColors.semantic.success:"removed"===e.type?macOSColors.semantic.error:macOSColors.semantic.warning}],children:e.type.toUpperCase()})}),_jsx(Text,{style:styles.diffPath,children:e.path})]}),"modified"===e.type&&_jsxs(View,{style:styles.diffValues,children:[_jsxs(View,{style:styles.diffValue,children:[_jsx(Text,{style:styles.diffLabel,children:"Before:"}),_jsx(DataInspector,{data:e.oldValue})]}),_jsxs(View,{style:styles.diffValue,children:[_jsx(Text,{style:styles.diffLabel,children:"After:"}),_jsx(DataInspector,{data:e.newValue})]})]}),"added"===e.type&&_jsx(View,{style:styles.diffValue,children:_jsx(DataInspector,{data:e.newValue})}),"removed"===e.type&&_jsx(View,{style:styles.diffValue,children:_jsx(DataInspector,{data:e.oldValue})})]},t))})}function findChanges(e,t,a=""){const o=[];if("object"!=typeof e||"object"!=typeof t)return e!==t&&o.push({type:"modified",path:a||"root",oldValue:e,newValue:t}),o;if(null===e||null===t)return e!==t&&o.push({type:"modified",path:a||"root",oldValue:e,newValue:t}),o;const s=e,n=t,l=new Set([...Object.keys(s),...Object.keys(n)]);for(const e of l){const t=a?`${a}.${e}`:e,l=s[e],i=n[e];e in s?e in n?l!==i&&("object"!=typeof l||"object"!=typeof i||null===l||null===i||Array.isArray(l)||Array.isArray(i)?o.push({type:"modified",path:t,oldValue:l,newValue:i}):t.split(".").length<3?o.push(...findChanges(l,i,t)):o.push({type:"modified",path:t,oldValue:l,newValue:i})):o.push({type:"removed",path:t,oldValue:l}):o.push({type:"added",path:t,newValue:i})}return o}const styles=StyleSheet.create({container:{flex:1},header:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:12,backgroundColor:macOSColors.background.card,borderBottomWidth:1,borderBottomColor:macOSColors.border.default},headerContent:{flex:1,marginRight:12},actionType:{fontSize:14,fontWeight:"600",color:macOSColors.text.primary,fontFamily:"monospace",marginBottom:6},headerMeta:{flexDirection:"row",alignItems:"center",gap:12},metaText:{fontSize:11,color:macOSColors.text.muted},durationText:{fontSize:11,color:macOSColors.text.muted,fontFamily:"monospace"},changeBadge:{backgroundColor:macOSColors.semantic.warningBackground,paddingHorizontal:6,paddingVertical:2,borderRadius:4},changeBadgeText:{fontSize:10,color:macOSColors.semantic.warning,fontWeight:"600"},tabContainer:{paddingHorizontal:12,paddingVertical:8},content:{flex:1},section:{paddingHorizontal:12,paddingBottom:20},emptyText:{fontSize:12,color:macOSColors.text.muted,fontStyle:"italic",padding:8},noChangeContainer:{padding:20,alignItems:"center"},noChangeText:{fontSize:13,color:macOSColors.text.muted},diffItem:{marginBottom:12,backgroundColor:macOSColors.background.card,borderRadius:8,borderWidth:1,borderColor:macOSColors.border.default,overflow:"hidden"},diffHeader:{flexDirection:"row",alignItems:"center",gap:8,padding:8,borderBottomWidth:1,borderBottomColor:macOSColors.border.default},diffTypeBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},diffTypeText:{fontSize:10,fontWeight:"700"},diffPath:{fontSize:12,color:macOSColors.text.primary,fontFamily:"monospace"},diffValues:{padding:8,gap:8},diffValue:{padding:8},diffLabel:{fontSize:11,color:macOSColors.text.muted,marginBottom:4,fontWeight:"600"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import React,{memo,useMemo,useCallback,useState,useEffect}from"react";import{View,Text,StyleSheet,ScrollView,TouchableOpacity}from"react-native";import*as Clipboard from"expo-clipboard";import{buoyColors,Clock,AlertTriangle,Zap,Hash,Info,Box,AlertCircle,FileText,parseValue,ProUpgradeModal}from"@buoy-gg/shared-ui";import{useIsPro}from"@buoy-gg/license";import{DataViewer}from"@buoy-gg/shared-ui/dataViewer";import{reduxActionStore}from"../utils/reduxActionStore";import{jumpToState,replayAction}from"../utils/buoyReduxMiddleware";import{ReduxActionButton}from"./ReduxActionButton";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";function getCategoryInfo(e){switch(e){case"pending":return{label:"PENDING",color:buoyColors.warning,bgColor:buoyColors.warning+"26"};case"fulfilled":return{label:"FULFILLED",color:buoyColors.success,bgColor:buoyColors.success+"26"};case"rejected":return{label:"REJECTED",color:buoyColors.error,bgColor:buoyColors.error+"26"};case"internal":return{label:"INTERNAL",color:buoyColors.textMuted,bgColor:buoyColors.textMuted+"26"};case"query":return{label:"QUERY",color:buoyColors.info,bgColor:buoyColors.info+"26"};case"mutation":return{label:"MUTATION",color:buoyColors.info,bgColor:buoyColors.info+"26"};default:return{label:"ACTION",color:buoyColors.info,bgColor:buoyColors.info+"26"}}}function formatDuration(e){return void 0===e?"N/A":e<1?"<1ms":`${e.toFixed(1)}ms`}function SectionHeader({icon:e,title:o,badge:t}){return _jsxs(View,{style:styles.sectionHeader,children:[_jsxs(View,{style:styles.sectionHeaderLeft,children:[_jsx(e,{size:14,color:buoyColors.primary}),_jsx(Text,{style:styles.sectionTitle,children:o})]}),t]})}function InfoRow({label:e,value:o,valueColor:t,mono:r=!1}){return _jsxs(View,{style:styles.infoRow,children:[_jsx(Text,{style:styles.infoLabel,children:e}),_jsx(Text,{style:[styles.infoValue,r&&styles.infoValueMono,t&&{color:t}],numberOfLines:1,ellipsizeMode:"middle",children:o})]})}function formatTime(e){const o=new Date(e);return`${o.getHours().toString().padStart(2,"0")}:${o.getMinutes().toString().padStart(2,"0")}:${o.getSeconds().toString().padStart(2,"0")}.${o.getMilliseconds().toString().padStart(3,"0")}`}export const ReduxActionInfoView=memo(function({action:e,onNavigateToAction:o}){const t=useIsPro(),[r,l]=useState(!1);useEffect(()=>{r&&t&&l(!1)},[r,t]);const s=getCategoryInfo(e.category),i=void 0!==e.payload,a=e.meta&&Object.keys(e.meta).length>0,n=void 0!==e.error,c=useMemo(()=>reduxActionStore.getLinkedActions(e),[e]),d=c.length>1,y=d?reduxActionStore.getBaseActionType(e.type):null,u=e.meta?.requestId?reduxActionStore.getAsyncOperationDuration(e.meta.requestId):null,g=useCallback(async()=>{if(t)try{const o=JSON.stringify(e.action,null,2);await Clipboard.setStringAsync(o)}catch(e){console.warn("Failed to copy action:",e)}else l(!0)},[e,t]),x=useCallback(async()=>{if(t)try{const o=JSON.stringify(e.payload,null,2);await Clipboard.setStringAsync(o)}catch(e){console.warn("Failed to copy payload:",e)}else l(!0)},[e.payload,t]),p=useCallback(()=>{e.action&&"object"==typeof e.action&&"type"in e.action&&replayAction(e.action)},[e]),b=useCallback(()=>{void 0!==e.nextState&&jumpToState(e.nextState)},[e]);return _jsxs(ScrollView,{style:styles.container,contentContainerStyle:styles.contentContainer,showsVerticalScrollIndicator:!1,children:[_jsxs(View,{style:styles.card,children:[_jsx(SectionHeader,{icon:Info,title:"ACTION INFO"}),_jsxs(View,{style:styles.cardContent,children:[_jsx(InfoRow,{label:"Type",value:e.type,mono:!0}),e.sliceName&&_jsx(InfoRow,{label:"Slice",value:e.sliceName,mono:!0}),_jsx(InfoRow,{label:"Action",value:e.actionName,mono:!0}),_jsxs(View,{style:styles.badgeRow,children:[_jsx(View,{style:[styles.categoryBadge,{backgroundColor:s.bgColor}],children:_jsx(Text,{style:[styles.categoryText,{color:s.color}],children:s.label})}),_jsxs(View,{style:[styles.durationBadge,e.isSlowAction&&styles.durationBadgeSlow],children:[_jsx(Clock,{size:10,color:e.isSlowAction?buoyColors.error:buoyColors.textSecondary}),_jsx(Text,{style:[styles.durationText,e.isSlowAction&&styles.durationTextSlow],children:formatDuration(e.duration)}),e.isSlowAction&&_jsx(AlertTriangle,{size:10,color:buoyColors.error})]}),e.hasStateChange?_jsxs(View,{style:styles.changesBadge,children:[_jsx(Zap,{size:10,color:buoyColors.success}),_jsx(Text,{style:styles.changesText,children:e.diffSummary||"changed"})]}):_jsx(View,{style:styles.noChangesBadge,children:_jsx(Text,{style:styles.noChangesText,children:"no change"})})]})]})]}),d&&_jsxs(View,{style:styles.card,children:[_jsx(SectionHeader,{icon:Hash,title:"ASYNC FLOW",badge:_jsx(View,{style:styles.asyncBadge,children:_jsxs(Text,{style:styles.asyncBadgeText,children:[c.length," ACTIONS"]})})}),_jsxs(View,{style:styles.cardContent,children:[_jsx(Text,{style:styles.baseActionType,children:y}),null!==u&&_jsxs(View,{style:styles.totalDurationRow,children:[_jsx(Text,{style:styles.totalDurationLabel,children:"Total Duration"}),_jsxs(Text,{style:styles.totalDurationValue,children:[u,"ms"]})]}),_jsx(View,{style:styles.timeline,children:c.map((t,r)=>{const l=getCategoryInfo(t.category),s=t.id===e.id;return _jsxs(TouchableOpacity,{style:[styles.timelineItem,s&&styles.timelineItemCurrent],onPress:()=>o?.(t),disabled:s||!o,activeOpacity:.7,children:[r<c.length-1&&_jsx(View,{style:styles.timelineConnector}),_jsx(View,{style:[styles.timelineDot,{backgroundColor:l.color}]}),_jsxs(View,{style:styles.timelineContent,children:[_jsxs(View,{style:styles.timelineHeader,children:[_jsx(View,{style:[styles.timelineStatusBadge,{backgroundColor:l.bgColor}],children:_jsx(Text,{style:[styles.timelineStatusText,{color:l.color}],children:l.label})}),s&&_jsx(View,{style:styles.currentBadge,children:_jsx(Text,{style:styles.currentBadgeText,children:"CURRENT"})})]}),_jsx(Text,{style:styles.timelineTime,children:formatTime(t.timestamp)})]})]},t.id)})})]})]}),i&&_jsxs(View,{style:styles.card,children:[_jsx(SectionHeader,{icon:Box,title:"PAYLOAD",badge:_jsx(View,{style:styles.typeBadge,children:_jsx(Text,{style:styles.typeText,children:Array.isArray(e.payload)?"ARRAY":"object"==typeof e.payload?"OBJECT":typeof e.payload?.toString().toUpperCase()})})}),_jsx(View,{style:styles.dataViewerContainer,children:_jsx(DataViewer,{title:"",data:parseValue(e.payload),showTypeFilter:!1})})]}),a&&_jsxs(View,{style:styles.card,children:[_jsx(SectionHeader,{icon:Hash,title:"ASYNC METADATA",badge:_jsx(View,{style:[styles.categoryBadge,{backgroundColor:s.bgColor}],children:_jsx(Text,{style:[styles.categoryText,{color:s.color}],children:"RTK THUNK"})})}),_jsxs(View,{style:styles.cardContent,children:[e.meta?.requestId&&_jsx(InfoRow,{label:"Request ID",value:e.meta.requestId,mono:!0}),e.meta?.requestStatus&&_jsx(InfoRow,{label:"Status",value:e.meta.requestStatus.toUpperCase(),valueColor:s.color}),void 0!==e.meta?.arg&&_jsxs(View,{style:styles.argSection,children:[_jsx(Text,{style:styles.argLabel,children:"Original Argument"}),_jsx(View,{style:styles.argValueContainer,children:"object"==typeof e.meta.arg?_jsx(DataViewer,{title:"",data:parseValue(e.meta.arg),showTypeFilter:!1}):_jsx(Text,{style:styles.argValue,children:JSON.stringify(e.meta.arg)})})]}),e.meta?.rejectedWithValue&&_jsx(InfoRow,{label:"Rejected With Value",value:"true",valueColor:buoyColors.error}),e.meta?.aborted&&_jsx(InfoRow,{label:"Aborted",value:"true",valueColor:buoyColors.warning}),e.meta?.condition&&_jsx(InfoRow,{label:"Condition",value:"true",valueColor:buoyColors.textMuted})]})]}),n&&_jsxs(View,{style:[styles.card,styles.errorCard],children:[_jsx(SectionHeader,{icon:AlertCircle,title:"ERROR",badge:_jsx(View,{style:styles.errorBadge,children:_jsx(Text,{style:styles.errorBadgeText,children:"REJECTED"})})}),_jsx(View,{style:styles.dataViewerContainer,children:"object"==typeof e.error?_jsx(DataViewer,{title:"",data:parseValue(e.error),showTypeFilter:!1}):_jsx(Text,{style:styles.errorText,children:String(e.error)})})]}),_jsxs(View,{style:styles.card,children:[_jsx(SectionHeader,{icon:FileText,title:"FULL ACTION OBJECT"}),_jsx(View,{style:styles.dataViewerContainer,children:_jsx(DataViewer,{title:"",data:parseValue(e.action),showTypeFilter:!1})})]}),_jsx(View,{style:styles.actionFooter,children:_jsxs(View,{style:styles.actionsGrid,children:[_jsxs(View,{style:styles.actionButtonWrapper,children:[_jsx(ReduxActionButton,{type:"replay",text:"REPLAY",onPress:p}),_jsx(Text,{style:styles.actionDescription,children:"Dispatch again"})]}),_jsxs(View,{style:styles.actionButtonWrapper,children:[_jsx(ReduxActionButton,{type:"jump",text:"JUMP",onPress:b}),_jsx(Text,{style:styles.actionDescription,children:"Restore this state"})]}),_jsxs(View,{style:styles.actionButtonWrapper,children:[_jsx(ReduxActionButton,{type:"copy",text:"COPY ACTION",onPress:g}),_jsx(Text,{style:styles.actionDescription,children:t?"Copy to clipboard":"Pro feature"})]}),i&&_jsxs(View,{style:styles.actionButtonWrapper,children:[_jsx(ReduxActionButton,{type:"copy",text:"COPY PAYLOAD",onPress:x}),_jsx(Text,{style:styles.actionDescription,children:t?"Copy payload only":"Pro feature"})]})]})}),_jsx(ProUpgradeModal,{visible:r,onClose:()=>l(!1),featureName:"Copy"})]})});const styles=StyleSheet.create({container:{flex:1},contentContainer:{padding:8,paddingBottom:100,gap:16},card:{backgroundColor:buoyColors.card,borderRadius:6,borderWidth:1,borderColor:buoyColors.primary+"4D",overflow:"hidden",shadowColor:buoyColors.primary,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},errorCard:{borderColor:buoyColors.error+"4D",shadowColor:buoyColors.error},sectionHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:10,borderBottomWidth:1,borderBottomColor:buoyColors.primary+"33",backgroundColor:buoyColors.primary+"15"},sectionHeaderLeft:{flexDirection:"row",alignItems:"center",gap:6},sectionTitle:{fontSize:12,fontWeight:"600",letterSpacing:.5,color:buoyColors.primary,fontFamily:"monospace"},cardContent:{padding:14,gap:10},infoRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},infoLabel:{fontSize:11,color:buoyColors.textMuted,fontWeight:"500"},infoValue:{fontSize:11,color:buoyColors.text,fontWeight:"500",flex:1,textAlign:"right",marginLeft:12},infoValueMono:{fontFamily:"monospace"},badgeRow:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:6},categoryBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4},categoryText:{fontSize:9,fontWeight:"700",letterSpacing:.3},durationBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:buoyColors.input},durationBadgeSlow:{backgroundColor:buoyColors.error+"26"},durationText:{fontSize:9,fontWeight:"600",color:buoyColors.textSecondary,fontFamily:"monospace"},durationTextSlow:{color:buoyColors.error},changesBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:buoyColors.success+"26"},changesText:{fontSize:9,fontWeight:"600",color:buoyColors.success},noChangesBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:buoyColors.input},noChangesText:{fontSize:9,fontWeight:"600",color:buoyColors.textMuted},typeBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:3,backgroundColor:buoyColors.input},typeText:{fontSize:8,fontWeight:"600",color:buoyColors.textMuted,fontFamily:"monospace"},dataViewerContainer:{backgroundColor:buoyColors.base,minHeight:60},argSection:{marginTop:4},argLabel:{fontSize:11,color:buoyColors.textMuted,fontWeight:"500",marginBottom:6},argValueContainer:{backgroundColor:buoyColors.base,borderRadius:6,borderWidth:1,borderColor:buoyColors.border,overflow:"hidden"},argValue:{fontSize:11,color:buoyColors.text,fontFamily:"monospace",padding:10},errorBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:buoyColors.error+"26"},errorBadgeText:{fontSize:9,fontWeight:"700",color:buoyColors.error,letterSpacing:.3},errorText:{fontSize:12,color:buoyColors.error,fontFamily:"monospace",padding:14},asyncBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:buoyColors.primary+"26"},asyncBadgeText:{fontSize:9,fontWeight:"700",color:buoyColors.primary,letterSpacing:.3},baseActionType:{fontSize:12,fontWeight:"600",color:buoyColors.text,fontFamily:"monospace",marginBottom:8},totalDurationRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:12,paddingBottom:12,borderBottomWidth:1,borderBottomColor:buoyColors.border},totalDurationLabel:{fontSize:11,color:buoyColors.textMuted,fontWeight:"500"},totalDurationValue:{fontSize:14,fontWeight:"700",color:buoyColors.success,fontFamily:"monospace"},timeline:{gap:0},timelineItem:{flexDirection:"row",alignItems:"flex-start",paddingVertical:8,paddingHorizontal:8,borderRadius:8,position:"relative"},timelineItemCurrent:{backgroundColor:buoyColors.primary+"15"},timelineConnector:{position:"absolute",left:13,top:24,bottom:-8,width:2,backgroundColor:buoyColors.border},timelineDot:{width:12,height:12,borderRadius:6,marginRight:10,marginTop:2},timelineContent:{flex:1},timelineHeader:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:2},timelineStatusBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},timelineStatusText:{fontSize:9,fontWeight:"700",letterSpacing:.3},currentBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4,backgroundColor:buoyColors.primary},currentBadgeText:{fontSize:8,fontWeight:"700",color:"#fff",letterSpacing:.3},timelineTime:{fontSize:10,color:buoyColors.textMuted,fontFamily:"monospace"},actionFooter:{backgroundColor:buoyColors.card,borderRadius:6,borderWidth:1,borderColor:buoyColors.primary+"4D",paddingVertical:12,paddingHorizontal:12,shadowColor:buoyColors.primary,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},actionsGrid:{flexDirection:"row",flexWrap:"wrap",gap:12,justifyContent:"flex-start"},actionButtonWrapper:{alignItems:"center",gap:4},actionDescription:{fontSize:9,color:buoyColors.textMuted,textAlign:"center"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{View,Text,StyleSheet}from"react-native";import{CompactRow,buoyColors,Zap,AlertCircle,Clock}from"@buoy-gg/shared-ui";import{reduxActionStore}from"../utils/reduxActionStore";import{jsxs as _jsxs,jsx as _jsx}from"react/jsx-runtime";const OPERATION_COLORS=[{bg:"rgba(99, 102, 241, 0.25)",text:"#818CF8"},{bg:"rgba(236, 72, 153, 0.25)",text:"#F472B6"},{bg:"rgba(14, 165, 233, 0.25)",text:"#38BDF8"},{bg:"rgba(245, 158, 11, 0.25)",text:"#FBBF24"},{bg:"rgba(16, 185, 129, 0.25)",text:"#34D399"},{bg:"rgba(168, 85, 247, 0.25)",text:"#C084FC"},{bg:"rgba(239, 68, 68, 0.25)",text:"#F87171"},{bg:"rgba(20, 184, 166, 0.25)",text:"#2DD4BF"}];function getOperationColor(e){return e<=0?{bg:"rgba(142, 142, 147, 0.2)",text:buoyColors.textSecondary}:OPERATION_COLORS[(e-1)%OPERATION_COLORS.length]}function formatRelativeTime(e){const t=Date.now()-e;return t<1e3?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:`${Math.floor(t/36e5)}h ago`}function getStatusLabel(e){switch(e){case"pending":return"Pending";case"fulfilled":return"Fulfilled";case"rejected":return"Rejected";case"internal":return"Internal";case"query":return"Query";case"mutation":return"Mutation";default:return"Action"}}function getStatusColor(e,t){switch(e){case"pending":return buoyColors.warning;case"fulfilled":return buoyColors.success;case"rejected":return buoyColors.error;case"internal":return buoyColors.textMuted;case"query":case"mutation":return buoyColors.info;default:return t?buoyColors.success:buoyColors.textSecondary}}function getSublabel(e){const t=[];return void 0!==e.duration&&e.duration>0&&t.push(`${e.duration.toFixed(1)}ms`),e.hasStateChange?t.push(e.diffSummary||"changed"):t.push("no change"),t.join(" · ")}function getPrimaryText(e){return"internal"===e.category?e.type:e.sliceName?`${e.sliceName}/${e.actionName.toLowerCase()}`:e.type}export function ReduxActionItem({action:e,onPress:t}){const r=getStatusColor(e.category,e.hasStateChange),o=getStatusLabel(e.category),s=getSublabel(e),n=getPrimaryText(e),a=reduxActionStore.getLinkedActions(e),l=a.length,i=l>1,c=i?a.findIndex(t=>t.id===e.id)+1:0,u=i&&e.meta?.requestId?reduxActionStore.getAsyncOperationIndex(e.meta.requestId):0,g=getOperationColor(u);let d;return e.isSlowAction?d=_jsxs(View,{style:styles.badgeContainer,children:[i&&_jsx(View,{style:[styles.asyncSequenceBadge,{backgroundColor:g.bg}],children:_jsxs(Text,{style:[styles.asyncSequenceText,{color:g.text}],children:[c,"/",l," #",u]})}),_jsx(View,{style:styles.slowBadge,children:_jsx(Clock,{size:12,color:buoyColors.error})})]}):"rejected"===e.category?d=_jsxs(View,{style:styles.badgeContainer,children:[i&&_jsx(View,{style:[styles.asyncSequenceBadge,{backgroundColor:g.bg}],children:_jsxs(Text,{style:[styles.asyncSequenceText,{color:g.text}],children:[c,"/",l," #",u]})}),_jsx(View,{style:styles.errorBadge,children:_jsx(AlertCircle,{size:12,color:buoyColors.error})})]}):i?d=_jsxs(View,{style:styles.badgeContainer,children:[_jsx(View,{style:[styles.asyncSequenceBadge,{backgroundColor:g.bg}],children:_jsxs(Text,{style:[styles.asyncSequenceText,{color:g.text}],children:[c,"/",l," #",u]})}),e.hasStateChange&&_jsx(View,{style:styles.changeBadge,children:_jsx(Zap,{size:12,color:buoyColors.warning})})]}):e.hasStateChange&&(d=_jsx(View,{style:styles.changeBadge,children:_jsx(Zap,{size:12,color:buoyColors.warning})})),_jsx(CompactRow,{statusDotColor:r,statusLabel:o,statusSublabel:s,primaryText:n,bottomRightText:formatRelativeTime(e.timestamp),customBadge:d,showChevron:!0,onPress:()=>t(e)})}const styles=StyleSheet.create({badgeContainer:{flexDirection:"row",alignItems:"center",gap:4},changeBadge:{paddingHorizontal:4},slowBadge:{paddingHorizontal:4},errorBadge:{paddingHorizontal:4},asyncSequenceBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},asyncSequenceText:{fontSize:10,fontWeight:"600",fontFamily:"monospace"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import React,{memo}from"react";import{View,Text,TouchableOpacity,StyleSheet}from"react-native";import{macOSColors,FileText,Database,GitBranch}from"@buoy-gg/shared-ui";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const VIEW_CONFIGS=[{key:"action",label:"ACTION",description:"View action details",icon:FileText,activeColor:macOSColors.semantic.warning},{key:"state",label:"STATE",description:"View current state",icon:Database,activeColor:macOSColors.semantic.info},{key:"diff",label:"DIFF",description:"Compare changes",icon:GitBranch,activeColor:macOSColors.semantic.success}];export const ReduxDetailViewToggle=memo(function({activeView:e,onViewChange:o,diffDisabled:t=!1}){return _jsx(View,{style:styles.container,children:VIEW_CONFIGS.map(a=>{const r=e===a.key,c="diff"===a.key&&t,i=a.icon;return _jsxs(TouchableOpacity,{style:[styles.card,r&&[styles.cardActive,{borderColor:a.activeColor}],c&&styles.cardDisabled],onPress:()=>!c&&o(a.key),activeOpacity:c?1:.8,disabled:c,children:[_jsxs(View,{style:styles.cardContent,children:[_jsx(i,{size:14,color:r?a.activeColor:c?macOSColors.text.muted:macOSColors.text.secondary}),_jsx(Text,{style:[styles.cardLabel,r&&[styles.cardLabelActive,{color:a.activeColor}],c&&styles.cardLabelDisabled],children:a.label})]}),_jsx(Text,{style:[styles.cardDescription,r&&styles.cardDescriptionActive,c&&styles.cardDescriptionDisabled],children:a.description})]},a.key)})})});const styles=StyleSheet.create({container:{flexDirection:"row",gap:8,padding:14,backgroundColor:macOSColors.background.base},card:{flex:1,backgroundColor:macOSColors.background.card,borderRadius:12,borderWidth:1,borderColor:macOSColors.border.default,padding:10,gap:4},cardActive:{borderWidth:1.5,backgroundColor:"rgba(0, 184, 230, 0.05)",shadowColor:macOSColors.semantic.info,shadowOffset:{width:0,height:2},shadowOpacity:.1,shadowRadius:8,elevation:3},cardDisabled:{opacity:.5},cardContent:{flexDirection:"row",alignItems:"center",gap:6},cardLabel:{fontSize:10,fontWeight:"700",letterSpacing:.5,color:macOSColors.text.secondary},cardLabelActive:{color:macOSColors.text.primary},cardLabelDisabled:{color:macOSColors.text.muted},cardDescription:{fontSize:9,color:macOSColors.text.muted,lineHeight:12},cardDescriptionActive:{color:macOSColors.text.secondary},cardDescriptionDisabled:{color:macOSColors.text.muted}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export{ReduxIcon,REDUX_ICON_COLOR}from"@buoy-gg/floating-tools-core";
|
|
@@ -0,0 +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:s=!1}){const a=useIsPro(),[l,n]=useState(!1),{filteredActions:i,filter:c,setFilter:d,stats:h,clearActions:u,isEnabled:m,toggleCapture:y}=useReduxActions(),x=useMemo(()=>a?i:i.slice(0,25),[i,a]),C=useMemo(()=>a?0:Math.max(0,i.length-25),[i.length,a]),p=C>0,[g,b]=useState(null),S=useRef([]);S.current=x;const f=null!==g?x[g]:null,[_,j]=useState(""),[T,O]=useState(!1),k=useRef(null),A=useRef(null),B=useCallback(e=>{},[]),w=e=>{j(e),d(o=>({...o,searchText:e}))},R=useCallback(e=>{const o=S.current.findIndex(o=>o.id===e.id);b(o>=0?o:0)},[]),z=useCallback(()=>{n(!0)},[]),I=useCallback(()=>{b(null)},[]),M=useCallback(e=>{b(e)},[]),v=useCallback(e=>e.id,[]),P=useCallback(({item:e})=>_jsx(ReduxActionItem,{action:e,onPress:R}),[R]),V=s?devToolsStorageKeys.modal.root():"buoy-redux-modal";if(!e)return null;const D=f&&null!==g?_jsx(ReduxActionDetailFooter,{action:f,actions:x,selectedIndex:g,onIndexChange:M}):null,W=f&&x.length>1?68:0;return _jsxs(_Fragment,{children:[_jsx(JsModal,{visible:e,onClose:o,onMinimize:r,persistenceKey:V,header:{showToggleButton:!0,customContent:_jsxs(ModalHeader,f?{children:[_jsx(ModalHeader.Navigation,{onBack:I}),_jsx(ModalHeader.Content,{title:f.type,centered:!0})]}:{children:[t&&_jsx(ModalHeader.Navigation,{onBack:t}),_jsx(ModalHeader.Content,{title:"",children:_jsxs(View,T?{style:styles.headerSearchContainer,children:[_jsx(Search,{size:14,color:macOSColors.text.secondary}),_jsx(TextInput,{ref:k,style:styles.headerSearchInput,placeholder:"Search action types...",placeholderTextColor:macOSColors.text.muted,value:_,onChangeText:w,onSubmitEditing:()=>O(!1),onBlur:()=>O(!1),autoCapitalize:"none",autoCorrect:!1,returnKeyType:"search"}),_.length>0&&_jsx(TouchableOpacity,{onPress:()=>{w(""),O(!1)},style:styles.headerSearchClear,children:_jsx(X,{size:14,color:macOSColors.text.secondary})})]}:{style:styles.headerChipRow,children:[_jsxs(TouchableOpacity,{style:[styles.headerChip,!c.onlyWithChanges&&styles.headerChipActive],onPress:()=>d(e=>({...e,onlyWithChanges:!1})),children:[_jsx(Text,{style:styles.headerChipLabel,children:"ALL"}),_jsx(Text,{style:[styles.headerChipValue,{color:macOSColors.text.primary}],children:h.totalActions})]}),_jsxs(TouchableOpacity,{style:[styles.headerChip,c.onlyWithChanges&&styles.headerChipActive],onPress:()=>d(e=>({...e,onlyWithChanges:!0})),children:[_jsx(Zap,{size:12,color:macOSColors.semantic.warning}),_jsx(Text,{style:[styles.headerChipValue,{color:macOSColors.semantic.warning}],children:h.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:h.uniqueActionTypes})]})]})}),_jsxs(ModalHeader.Actions,{children:[_jsx(TouchableOpacity,{onPress:()=>O(!0),style:styles.headerActionButton,children:_jsx(Search,{size:14,color:macOSColors.text.secondary})}),_jsx(TouchableOpacity,{onPress:async()=>{if(!a)return void n(!0);const e=i.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===i.length&&styles.headerActionButtonDisabled],disabled:0===i.length,children:_jsx(Copy,{size:14,color:i.length>0?macOSColors.text.secondary:macOSColors.text.disabled})}),_jsx(TouchableOpacity,{onPress:y,style:[styles.headerActionButton,m?styles.startButton:styles.stopButton],children:_jsx(Power,{size:14,color:m?macOSColors.semantic.success:macOSColors.semantic.error})}),_jsx(TouchableOpacity,{onPress:u,style:[styles.headerActionButton,0===i.length&&styles.headerActionButtonDisabled],disabled:0===i.length,children:_jsx(Trash2,{size:14,color:i.length>0?macOSColors.text.muted:macOSColors.text.disabled})})]})]})},onModeChange:B,enablePersistence:!0,initialMode:"bottomSheet",enableGlitchEffects:!0,styles:{},footer:D,footerHeight:W,children:_jsx(View,{style:styles.container,children:f&&null!==g?_jsx(ReduxActionDetailContent,{action:f,actions:x,selectedIndex:g,onIndexChange:M,disableInternalFooter:!0}):_jsxs(_Fragment,{children:[!m&&_jsxs(View,{style:styles.disabledBanner,children:[_jsx(Power,{size:14,color:macOSColors.semantic.warning}),_jsx(Text,{style:styles.disabledText,children:"Action capture is disabled"})]}),p&&_jsxs(TouchableOpacity,{style:styles.lockedBanner,onPress:z,activeOpacity:.8,children:[_jsx(Lock,{size:14,color:buoyColors.primary}),_jsxs(Text,{style:styles.lockedText,children:[C," older ",1===C?"action":"actions"," locked"]}),_jsx(View,{style:styles.upgradeBadge,children:_jsx(Text,{style:styles.upgradeBadgeText,children:"UPGRADE"})})]}),x.length>0?_jsx(FlatList,{ref:A,data:x,renderItem:P,keyExtractor:v,contentContainerStyle:styles.listContent,showsVerticalScrollIndicator:!0,removeClippedSubviews:!0,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:!1}):_jsx(EmptyState,{isEnabled:m})]})})}),_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"},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}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export{ReduxModal,FREE_TIER_ACTION_LIMIT}from"./ReduxModal";export{ReduxActionItem}from"./ReduxActionItem";export{ReduxActionDetailView}from"./ReduxActionDetailView";export{ReduxIcon}from"./ReduxIcon";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export{useReduxActions}from"./useReduxActions";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{useState,useEffect,useMemo,useCallback}from"react";import{reduxActionStore}from"../utils/reduxActionStore";export function useReduxActions(){const[e,t]=useState(()=>reduxActionStore.getActions()),[o,c]=useState({}),[s,r]=useState(()=>reduxActionStore.getEnabled()),[n,u]=useState(null);useEffect(()=>{const e=reduxActionStore.subscribe(e=>{t(e)});return()=>{e()}},[]);const i=useMemo(()=>reduxActionStore.filterActions(o),[e,o]),l=useMemo(()=>reduxActionStore.getStats(),[e]),a=useMemo(()=>reduxActionStore.getUniqueActionTypes(),[e]),A=useCallback(()=>{reduxActionStore.clearActions(),u(null)},[]),d=useCallback(()=>{const e=!s;reduxActionStore.setEnabled(e),r(e)},[s]),S=useCallback(e=>reduxActionStore.getActionById(e),[]);return{actions:e,filteredActions:i,filter:o,setFilter:c,stats:l,clearActions:A,isEnabled:s,toggleCapture:d,actionTypes:a,getActionById:S,selectedAction:n,setSelectedAction:u}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export*from"./types";export*from"./utils";export*from"./hooks";export*from"./components";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +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(),u=performance.now()-i;return reduxActionStore.addAction(r,a,s,u),c});export function createBuoyReduxMiddleware(t={}){const{maxActions:e=200,ignoreActions:o=[]}=t;return reduxActionStore.setMaxActions(e),t=>(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),u=t.getState(),p=performance.now()-a;return reduxActionStore.addAction(n,c,u,p),s})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{reduxActionStore}from"./reduxActionStore";import{ReduxIcon}from"../components/ReduxIcon";const REDUX_CAPABILITIES={timeTravel:!1,toggle:!1,edit:!1,diff:!0,export:!0,import:!1,reset:!0,recording:!0};function toHistoryEntry(t,e,r){return{id:t.id,label:t.type,timestamp:t.timestamp,data:t.payload??t.action,prevState:t.prevState,nextState:t.nextState,hasStateChange:t.hasStateChange,duration:t.duration,source:"redux",isCurrent:0===e,isInFuture:!1,isSkipped:!1,meta:{fullAction:t.action}}}export function createReduxHistoryAdapter(t){const{icon:e=ReduxIcon,color:r="#764ABC",name:n="Redux"}=t??{};let o=0;return{id:"redux",name:n,icon:e,color:r,capabilities:REDUX_CAPABILITIES,subscribe:t=>reduxActionStore.subscribe(()=>{t()}),getEntries:()=>{const t=reduxActionStore.getActions();return t.map((e,r)=>toHistoryEntry(e,r,t.length))},getEntryCount:()=>reduxActionStore.getActions().length,getCurrentState:()=>{const t=reduxActionStore.getActions();if(0!==t.length)return t[0].nextState},getStateAtEntry:t=>{const e=reduxActionStore.getActionById(String(t));return e?.nextState},get currentIndex(){return o},jumpTo:t=>{const e=reduxActionStore.getActions().findIndex(e=>e.id===String(t));-1!==e&&(o=e)},get isRecording(){return reduxActionStore.getEnabled()},setRecording:t=>{reduxActionStore.setEnabled(t)},reset:()=>{reduxActionStore.clearActions(),o=0},exportHistory:()=>{const t=reduxActionStore.getActions();return JSON.stringify(t,null,2)}}}export const reduxHistoryAdapter=createReduxHistoryAdapter();
|
|
@@ -0,0 +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";
|
|
@@ -0,0 +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=e!==n,r=t.type||"UNKNOWN_ACTION",a=getActionCategory(r),{sliceName:o,actionName:c}=parseActionType(r),l=extractMeta(t),u=formatPayloadPreview(t.payload),{summary:d,changedCount:h}=getStateDiffSummary(e,n),g=(i??0)>16,f={id:`${Date.now()}-${++this.idCounter}`,type:r,payload:t.payload,action:t,timestamp:Date.now(),prevState:e,nextState:n,duration:i,hasStateChange:s,category:a,sliceName:o,actionName:c,meta:l,error:t.error,payloadPreview:u,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;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @buoy-gg/redux
|
|
3
|
+
*
|
|
4
|
+
* Redux Toolkit DevTools for React Native
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* // 1. Add middleware to your Redux Toolkit store
|
|
9
|
+
* import { configureStore } from '@reduxjs/toolkit';
|
|
10
|
+
* import { buoyReduxMiddleware } from '@buoy-gg/redux';
|
|
11
|
+
*
|
|
12
|
+
* const store = configureStore({
|
|
13
|
+
* reducer: rootReducer,
|
|
14
|
+
* middleware: (getDefaultMiddleware) =>
|
|
15
|
+
* getDefaultMiddleware().concat(buoyReduxMiddleware),
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* // 2. Add the preset to FloatingDevTools
|
|
19
|
+
* import { reduxToolPreset } from '@buoy-gg/redux';
|
|
20
|
+
*
|
|
21
|
+
* <FloatingDevTools apps={[reduxToolPreset]} />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export { reduxToolPreset, createReduxTool } from "./preset";
|
|
25
|
+
export { buoyReduxMiddleware, createBuoyReduxMiddleware } from "./redux/utils";
|
|
26
|
+
export { createReduxHistoryAdapter, reduxHistoryAdapter, type ReduxHistoryAdapterOptions, } from "./redux/utils";
|
|
27
|
+
export * from "./redux";
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|