@buoy-gg/zustand 2.1.12 → 2.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/index.js +1 -91
- package/lib/commonjs/preset.js +1 -102
- package/lib/commonjs/zustand/components/ZustandActionButton.js +1 -116
- package/lib/commonjs/zustand/components/ZustandDetailViewToggle.js +1 -134
- package/lib/commonjs/zustand/components/ZustandEventFilterView.js +1 -291
- package/lib/commonjs/zustand/components/ZustandIcon.js +1 -35
- package/lib/commonjs/zustand/components/ZustandModal.js +1 -603
- package/lib/commonjs/zustand/components/ZustandStateChangeItem.js +1 -165
- package/lib/commonjs/zustand/components/ZustandStateDetailContent.js +1 -352
- package/lib/commonjs/zustand/components/ZustandStateInfoView.js +1 -508
- package/lib/commonjs/zustand/components/ZustandStoreBrowser.js +1 -307
- package/lib/commonjs/zustand/components/index.js +1 -73
- package/lib/commonjs/zustand/hooks/index.js +1 -12
- package/lib/commonjs/zustand/hooks/useZustandStateChanges.js +1 -92
- package/lib/commonjs/zustand/index.js +1 -99
- package/lib/commonjs/zustand/utils/buoyZustandMiddleware.js +1 -220
- package/lib/commonjs/zustand/utils/index.js +1 -31
- package/lib/commonjs/zustand/utils/zustandStateStore.js +1 -361
- package/lib/module/index.js +1 -80
- package/lib/module/preset.js +1 -98
- package/lib/module/zustand/components/ZustandActionButton.js +1 -112
- package/lib/module/zustand/components/ZustandDetailViewToggle.js +1 -129
- package/lib/module/zustand/components/ZustandEventFilterView.js +1 -287
- package/lib/module/zustand/components/ZustandIcon.js +1 -32
- package/lib/module/zustand/components/ZustandModal.js +1 -599
- package/lib/module/zustand/components/ZustandStateChangeItem.js +1 -161
- package/lib/module/zustand/components/ZustandStateDetailContent.js +1 -348
- package/lib/module/zustand/components/ZustandStateInfoView.js +1 -503
- package/lib/module/zustand/components/ZustandStoreBrowser.js +1 -303
- package/lib/module/zustand/components/index.js +1 -10
- package/lib/module/zustand/hooks/index.js +1 -3
- package/lib/module/zustand/hooks/useZustandStateChanges.js +1 -88
- package/lib/module/zustand/index.js +1 -12
- package/lib/module/zustand/utils/buoyZustandMiddleware.js +1 -214
- package/lib/module/zustand/utils/index.js +1 -4
- package/lib/module/zustand/utils/zustandStateStore.js +1 -357
- package/package.json +3 -3
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandActionButton.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandDetailViewToggle.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandEventFilterView.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandIcon.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandModal.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandStateChangeItem.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandStateDetailContent.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandStateInfoView.d.ts.map +0 -1
- package/lib/typescript/zustand/components/ZustandStoreBrowser.d.ts.map +0 -1
- package/lib/typescript/zustand/components/index.d.ts.map +0 -1
- package/lib/typescript/zustand/hooks/index.d.ts.map +0 -1
- package/lib/typescript/zustand/hooks/useZustandStateChanges.d.ts.map +0 -1
- package/lib/typescript/zustand/index.d.ts.map +0 -1
- package/lib/typescript/zustand/types/index.d.ts.map +0 -1
- package/lib/typescript/zustand/utils/buoyZustandMiddleware.d.ts.map +0 -1
- package/lib/typescript/zustand/utils/index.d.ts.map +0 -1
- package/lib/typescript/zustand/utils/zustandStateStore.d.ts.map +0 -1
package/lib/module/index.js
CHANGED
|
@@ -1,80 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @buoy-gg/zustand
|
|
5
|
-
*
|
|
6
|
-
* Zustand Store DevTools for React Native
|
|
7
|
-
*
|
|
8
|
-
* PUBLIC API - Only these exports are supported for external use.
|
|
9
|
-
*
|
|
10
|
-
* @example Recommended setup (one line, zero store modifications)
|
|
11
|
-
* ```tsx
|
|
12
|
-
* import { watchStores } from '@buoy-gg/zustand';
|
|
13
|
-
* import { useCounterStore } from './stores/counter';
|
|
14
|
-
* import { useAuthStore } from './stores/auth';
|
|
15
|
-
*
|
|
16
|
-
* // One call, anywhere at module scope or in your root layout:
|
|
17
|
-
* watchStores({
|
|
18
|
-
* counterStore: useCounterStore,
|
|
19
|
-
* authStore: useAuthStore,
|
|
20
|
-
* });
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* @example Advanced: middleware for extra detail (partial + timing)
|
|
24
|
-
* ```tsx
|
|
25
|
-
* import { create } from 'zustand';
|
|
26
|
-
* import { buoyDevTools } from '@buoy-gg/zustand';
|
|
27
|
-
*
|
|
28
|
-
* const useCounterStore = create(
|
|
29
|
-
* buoyDevTools(
|
|
30
|
-
* (set) => ({
|
|
31
|
-
* count: 0,
|
|
32
|
-
* increment: () => set((s) => ({ count: s.count + 1 })),
|
|
33
|
-
* }),
|
|
34
|
-
* { name: 'counterStore' }
|
|
35
|
-
* )
|
|
36
|
-
* );
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
// =============================================================================
|
|
41
|
-
// PRESET (Primary entry point for FloatingDevTools)
|
|
42
|
-
// =============================================================================
|
|
43
|
-
export { zustandToolPreset, createZustandTool } from "./preset";
|
|
44
|
-
|
|
45
|
-
// =============================================================================
|
|
46
|
-
// WATCH STORES (Recommended — non-intrusive, subscribe-only)
|
|
47
|
-
// =============================================================================
|
|
48
|
-
export { watchStores } from "./zustand/utils/buoyZustandMiddleware";
|
|
49
|
-
|
|
50
|
-
// =============================================================================
|
|
51
|
-
// MIDDLEWARE (Advanced — wraps setState for partial + timing capture)
|
|
52
|
-
// =============================================================================
|
|
53
|
-
export { buoyDevTools } from "./zustand/utils/buoyZustandMiddleware";
|
|
54
|
-
|
|
55
|
-
// =============================================================================
|
|
56
|
-
// UTILITIES
|
|
57
|
-
// =============================================================================
|
|
58
|
-
export { isStoreInstrumented } from "./zustand/utils/buoyZustandMiddleware";
|
|
59
|
-
|
|
60
|
-
// =============================================================================
|
|
61
|
-
// HOOKS (For consuming Zustand state data)
|
|
62
|
-
// =============================================================================
|
|
63
|
-
export { useZustandStateChanges } from "./zustand/hooks/useZustandStateChanges";
|
|
64
|
-
// =============================================================================
|
|
65
|
-
// COMPONENTS (For custom UI implementations)
|
|
66
|
-
// =============================================================================
|
|
67
|
-
export { ZustandModal } from "./zustand/components/ZustandModal";
|
|
68
|
-
export { ZustandStateChangeItem } from "./zustand/components/ZustandStateChangeItem";
|
|
69
|
-
export { ZustandStateDetailContent, ZustandStateDetailFooter } from "./zustand/components/ZustandStateDetailContent";
|
|
70
|
-
export { ZustandIcon, ZUSTAND_ICON_COLOR } from "./zustand/components/ZustandIcon";
|
|
71
|
-
|
|
72
|
-
// =============================================================================
|
|
73
|
-
// TYPES
|
|
74
|
-
// =============================================================================
|
|
75
|
-
|
|
76
|
-
// =============================================================================
|
|
77
|
-
// INTERNAL EXPORTS (For @buoy-gg/* packages only - not part of public API)
|
|
78
|
-
// =============================================================================
|
|
79
|
-
/** @internal */
|
|
80
|
-
export { zustandStateStore } from "./zustand/utils/zustandStateStore";
|
|
1
|
+
"use strict";export{zustandToolPreset,createZustandTool}from"./preset";export{watchStores}from"./zustand/utils/buoyZustandMiddleware";export{buoyDevTools}from"./zustand/utils/buoyZustandMiddleware";export{isStoreInstrumented}from"./zustand/utils/buoyZustandMiddleware";export{useZustandStateChanges}from"./zustand/hooks/useZustandStateChanges";export{ZustandModal}from"./zustand/components/ZustandModal";export{ZustandStateChangeItem}from"./zustand/components/ZustandStateChangeItem";export{ZustandStateDetailContent,ZustandStateDetailFooter}from"./zustand/components/ZustandStateDetailContent";export{ZustandIcon,ZUSTAND_ICON_COLOR}from"./zustand/components/ZustandIcon";export{zustandStateStore}from"./zustand/utils/zustandStateStore";
|
package/lib/module/preset.js
CHANGED
|
@@ -1,98 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Pre-configured Zustand DevTools preset for FloatingDevTools
|
|
5
|
-
*
|
|
6
|
-
* ZERO-CONFIG: This preset is auto-discovered by FloatingDevTools!
|
|
7
|
-
* Just install @buoy-gg/zustand and wrap your stores with buoyDevTools().
|
|
8
|
-
*
|
|
9
|
-
* @example Automatic (recommended)
|
|
10
|
-
* ```tsx
|
|
11
|
-
* import { create } from 'zustand';
|
|
12
|
-
* import { buoyDevTools } from '@buoy-gg/zustand';
|
|
13
|
-
*
|
|
14
|
-
* const useCounterStore = create(
|
|
15
|
-
* buoyDevTools(
|
|
16
|
-
* (set) => ({ count: 0, increment: () => set((s) => ({ count: s.count + 1 })) }),
|
|
17
|
-
* { name: 'counterStore' }
|
|
18
|
-
* )
|
|
19
|
-
* );
|
|
20
|
-
*
|
|
21
|
-
* // The Zustand tool appears automatically in FloatingDevTools!
|
|
22
|
-
* <FloatingDevTools />
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* @example Manual (only for custom configuration)
|
|
26
|
-
* ```tsx
|
|
27
|
-
* import { createZustandTool } from '@buoy-gg/zustand';
|
|
28
|
-
*
|
|
29
|
-
* const customZustandTool = createZustandTool({
|
|
30
|
-
* name: "STATE",
|
|
31
|
-
* iconColor: "#463B3F",
|
|
32
|
-
* });
|
|
33
|
-
*
|
|
34
|
-
* <FloatingDevTools apps={[customZustandTool]} />
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
import { ZustandModal } from "./zustand/components/ZustandModal";
|
|
39
|
-
import { ZustandIcon } from "./zustand/components/ZustandIcon";
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Pre-configured Zustand DevTools preset for FloatingDevTools.
|
|
43
|
-
* Includes:
|
|
44
|
-
* - Live state change monitoring
|
|
45
|
-
* - State inspection (JSON viewer)
|
|
46
|
-
* - State diff visualization (tree + split)
|
|
47
|
-
* - Filter by store name
|
|
48
|
-
* - Changed keys tracking
|
|
49
|
-
*/
|
|
50
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
51
|
-
export const zustandToolPreset = {
|
|
52
|
-
id: "zustand",
|
|
53
|
-
name: "ZUSTAND",
|
|
54
|
-
description: "Zustand store & state inspector",
|
|
55
|
-
slot: "both",
|
|
56
|
-
icon: ({
|
|
57
|
-
size
|
|
58
|
-
}) => /*#__PURE__*/_jsx(ZustandIcon, {
|
|
59
|
-
size: size
|
|
60
|
-
}),
|
|
61
|
-
component: ZustandModal,
|
|
62
|
-
props: {
|
|
63
|
-
enableSharedModalDimensions: false
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Create a custom Zustand DevTools configuration.
|
|
69
|
-
* Use this if you want to override default settings.
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* ```tsx
|
|
73
|
-
* import { createZustandTool } from '@buoy-gg/zustand';
|
|
74
|
-
*
|
|
75
|
-
* const myZustandTool = createZustandTool({
|
|
76
|
-
* name: "STATE",
|
|
77
|
-
* iconColor: "#463B3F",
|
|
78
|
-
* });
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
export function createZustandTool(options) {
|
|
82
|
-
return {
|
|
83
|
-
id: options?.id || "zustand",
|
|
84
|
-
name: options?.name || "ZUSTAND",
|
|
85
|
-
description: options?.description || "Zustand store & state inspector",
|
|
86
|
-
slot: "both",
|
|
87
|
-
icon: ({
|
|
88
|
-
size
|
|
89
|
-
}) => /*#__PURE__*/_jsx(ZustandIcon, {
|
|
90
|
-
size: size,
|
|
91
|
-
color: options?.iconColor
|
|
92
|
-
}),
|
|
93
|
-
component: ZustandModal,
|
|
94
|
-
props: {
|
|
95
|
-
enableSharedModalDimensions: options?.enableSharedModalDimensions !== undefined ? options.enableSharedModalDimensions : false
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
}
|
|
1
|
+
"use strict";import{ZustandModal}from"./zustand/components/ZustandModal";import{ZustandIcon}from"./zustand/components/ZustandIcon";import{jsx as _jsx}from"react/jsx-runtime";export const zustandToolPreset={id:"zustand",name:"ZUSTAND",description:"Zustand store & state inspector",slot:"both",icon:({size:o})=>_jsx(ZustandIcon,{size:o}),component:ZustandModal,props:{enableSharedModalDimensions:!1}};export function createZustandTool(o){return{id:o?.id||"zustand",name:o?.name||"ZUSTAND",description:o?.description||"Zustand store & state inspector",slot:"both",icon:({size:n})=>_jsx(ZustandIcon,{size:n,color:o?.iconColor}),component:ZustandModal,props:{enableSharedModalDimensions:void 0!==o?.enableSharedModalDimensions&&o.enableSharedModalDimensions}}}
|
|
@@ -1,112 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ZustandActionButton
|
|
5
|
-
*
|
|
6
|
-
* Generic action button for Zustand DevTools footer.
|
|
7
|
-
* Mirrors ReduxActionButton.tsx
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { TouchableOpacity, Text, View, StyleSheet } from "react-native";
|
|
11
|
-
import { buoyColors } from "@buoy-gg/shared-ui";
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
const buttonConfigs = {
|
|
14
|
-
copy: {
|
|
15
|
-
color: buoyColors.primary,
|
|
16
|
-
backgroundColor: buoyColors.primary + "15",
|
|
17
|
-
borderColor: buoyColors.primary + "40",
|
|
18
|
-
textColor: buoyColors.primary
|
|
19
|
-
},
|
|
20
|
-
reset: {
|
|
21
|
-
color: buoyColors.warning,
|
|
22
|
-
backgroundColor: buoyColors.warning + "15",
|
|
23
|
-
borderColor: buoyColors.warning + "40",
|
|
24
|
-
textColor: buoyColors.warning
|
|
25
|
-
},
|
|
26
|
-
clear: {
|
|
27
|
-
color: buoyColors.error,
|
|
28
|
-
backgroundColor: buoyColors.error + "15",
|
|
29
|
-
borderColor: buoyColors.error + "40",
|
|
30
|
-
textColor: buoyColors.error
|
|
31
|
-
},
|
|
32
|
-
jump: {
|
|
33
|
-
color: buoyColors.warning,
|
|
34
|
-
backgroundColor: buoyColors.warning + "15",
|
|
35
|
-
borderColor: buoyColors.warning + "40",
|
|
36
|
-
textColor: buoyColors.warning
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export function ZustandActionButton({
|
|
40
|
-
onPress,
|
|
41
|
-
text,
|
|
42
|
-
type,
|
|
43
|
-
disabled = false
|
|
44
|
-
}) {
|
|
45
|
-
const config = buttonConfigs[type];
|
|
46
|
-
return /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
47
|
-
disabled: disabled,
|
|
48
|
-
onPress: onPress,
|
|
49
|
-
style: [styles.button, {
|
|
50
|
-
backgroundColor: disabled ? buoyColors.textMuted + "1A" : config.backgroundColor,
|
|
51
|
-
borderColor: disabled ? buoyColors.textMuted + "33" : config.borderColor,
|
|
52
|
-
opacity: disabled ? 0.5 : 1
|
|
53
|
-
}],
|
|
54
|
-
activeOpacity: 0.7,
|
|
55
|
-
accessibilityRole: "button",
|
|
56
|
-
accessibilityLabel: text,
|
|
57
|
-
accessibilityState: {
|
|
58
|
-
disabled
|
|
59
|
-
},
|
|
60
|
-
children: [/*#__PURE__*/_jsx(View, {
|
|
61
|
-
style: [styles.dot, {
|
|
62
|
-
backgroundColor: disabled ? buoyColors.textMuted : config.color
|
|
63
|
-
}]
|
|
64
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
65
|
-
style: [styles.text, {
|
|
66
|
-
color: disabled ? buoyColors.textMuted : config.textColor
|
|
67
|
-
}],
|
|
68
|
-
children: text
|
|
69
|
-
})]
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
const styles = StyleSheet.create({
|
|
73
|
-
button: {
|
|
74
|
-
flexDirection: "row",
|
|
75
|
-
alignItems: "center",
|
|
76
|
-
justifyContent: "center",
|
|
77
|
-
borderRadius: 6,
|
|
78
|
-
borderWidth: 1,
|
|
79
|
-
paddingHorizontal: 12,
|
|
80
|
-
paddingVertical: 6,
|
|
81
|
-
height: 25,
|
|
82
|
-
minWidth: 80,
|
|
83
|
-
shadowOffset: {
|
|
84
|
-
width: 0,
|
|
85
|
-
height: 1
|
|
86
|
-
},
|
|
87
|
-
shadowOpacity: 0.2,
|
|
88
|
-
shadowRadius: 2,
|
|
89
|
-
elevation: 2
|
|
90
|
-
},
|
|
91
|
-
dot: {
|
|
92
|
-
width: 5,
|
|
93
|
-
height: 5,
|
|
94
|
-
borderRadius: 3,
|
|
95
|
-
marginRight: 6,
|
|
96
|
-
shadowColor: buoyColors.text,
|
|
97
|
-
shadowOffset: {
|
|
98
|
-
width: 0,
|
|
99
|
-
height: 0
|
|
100
|
-
},
|
|
101
|
-
shadowOpacity: 0.6,
|
|
102
|
-
shadowRadius: 2
|
|
103
|
-
},
|
|
104
|
-
text: {
|
|
105
|
-
fontSize: 10,
|
|
106
|
-
fontWeight: "600",
|
|
107
|
-
letterSpacing: 0.5,
|
|
108
|
-
textTransform: "uppercase",
|
|
109
|
-
fontFamily: "monospace",
|
|
110
|
-
height: 12
|
|
111
|
-
}
|
|
112
|
-
});
|
|
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={copy:{color:buoyColors.primary,backgroundColor:buoyColors.primary+"15",borderColor:buoyColors.primary+"40",textColor:buoyColors.primary},reset:{color:buoyColors.warning,backgroundColor:buoyColors.warning+"15",borderColor:buoyColors.warning+"40",textColor:buoyColors.warning},clear:{color:buoyColors.error,backgroundColor:buoyColors.error+"15",borderColor:buoyColors.error+"40",textColor:buoyColors.error},jump:{color:buoyColors.warning,backgroundColor:buoyColors.warning+"15",borderColor:buoyColors.warning+"40",textColor:buoyColors.warning}};export function ZustandActionButton({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}});
|
|
@@ -1,129 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ZustandDetailViewToggle
|
|
5
|
-
*
|
|
6
|
-
* Three-card toggle for switching between Change, State, and Diff views.
|
|
7
|
-
* Mirrors ReduxDetailViewToggle.tsx
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import React, { memo } from "react";
|
|
11
|
-
import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
|
|
12
|
-
import { macOSColors, FileText, Database, GitBranch } from "@buoy-gg/shared-ui";
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
const VIEW_CONFIGS = [{
|
|
15
|
-
key: "change",
|
|
16
|
-
label: "CHANGE",
|
|
17
|
-
description: "View change details",
|
|
18
|
-
icon: FileText,
|
|
19
|
-
activeColor: macOSColors.semantic.warning
|
|
20
|
-
}, {
|
|
21
|
-
key: "state",
|
|
22
|
-
label: "STATE",
|
|
23
|
-
description: "View current state",
|
|
24
|
-
icon: Database,
|
|
25
|
-
activeColor: macOSColors.semantic.info
|
|
26
|
-
}, {
|
|
27
|
-
key: "diff",
|
|
28
|
-
label: "DIFF",
|
|
29
|
-
description: "Compare changes",
|
|
30
|
-
icon: GitBranch,
|
|
31
|
-
activeColor: macOSColors.semantic.success
|
|
32
|
-
}];
|
|
33
|
-
export const ZustandDetailViewToggle = /*#__PURE__*/memo(function ZustandDetailViewToggle({
|
|
34
|
-
activeView,
|
|
35
|
-
onViewChange,
|
|
36
|
-
diffDisabled = false
|
|
37
|
-
}) {
|
|
38
|
-
return /*#__PURE__*/_jsx(View, {
|
|
39
|
-
style: styles.container,
|
|
40
|
-
children: VIEW_CONFIGS.map(config => {
|
|
41
|
-
const isActive = activeView === config.key;
|
|
42
|
-
const isDisabled = config.key === "diff" && diffDisabled;
|
|
43
|
-
const IconComponent = config.icon;
|
|
44
|
-
return /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
45
|
-
style: [styles.card, isActive && [styles.cardActive, {
|
|
46
|
-
borderColor: config.activeColor
|
|
47
|
-
}], isDisabled && styles.cardDisabled],
|
|
48
|
-
onPress: () => !isDisabled && onViewChange(config.key),
|
|
49
|
-
activeOpacity: isDisabled ? 1 : 0.8,
|
|
50
|
-
disabled: isDisabled,
|
|
51
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
52
|
-
style: styles.cardContent,
|
|
53
|
-
children: [/*#__PURE__*/_jsx(IconComponent, {
|
|
54
|
-
size: 14,
|
|
55
|
-
color: isActive ? config.activeColor : isDisabled ? macOSColors.text.muted : macOSColors.text.secondary
|
|
56
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
57
|
-
style: [styles.cardLabel, isActive && [styles.cardLabelActive, {
|
|
58
|
-
color: config.activeColor
|
|
59
|
-
}], isDisabled && styles.cardLabelDisabled],
|
|
60
|
-
children: config.label
|
|
61
|
-
})]
|
|
62
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
63
|
-
style: [styles.cardDescription, isActive && styles.cardDescriptionActive, isDisabled && styles.cardDescriptionDisabled],
|
|
64
|
-
children: config.description
|
|
65
|
-
})]
|
|
66
|
-
}, config.key);
|
|
67
|
-
})
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
const styles = StyleSheet.create({
|
|
71
|
-
container: {
|
|
72
|
-
flexDirection: "row",
|
|
73
|
-
gap: 8,
|
|
74
|
-
padding: 14,
|
|
75
|
-
backgroundColor: macOSColors.background.base
|
|
76
|
-
},
|
|
77
|
-
card: {
|
|
78
|
-
flex: 1,
|
|
79
|
-
backgroundColor: macOSColors.background.card,
|
|
80
|
-
borderRadius: 12,
|
|
81
|
-
borderWidth: 1,
|
|
82
|
-
borderColor: macOSColors.border.default,
|
|
83
|
-
padding: 10,
|
|
84
|
-
gap: 4
|
|
85
|
-
},
|
|
86
|
-
cardActive: {
|
|
87
|
-
borderWidth: 1.5,
|
|
88
|
-
backgroundColor: "rgba(0, 184, 230, 0.05)",
|
|
89
|
-
shadowColor: macOSColors.semantic.info,
|
|
90
|
-
shadowOffset: {
|
|
91
|
-
width: 0,
|
|
92
|
-
height: 2
|
|
93
|
-
},
|
|
94
|
-
shadowOpacity: 0.1,
|
|
95
|
-
shadowRadius: 8,
|
|
96
|
-
elevation: 3
|
|
97
|
-
},
|
|
98
|
-
cardDisabled: {
|
|
99
|
-
opacity: 0.5
|
|
100
|
-
},
|
|
101
|
-
cardContent: {
|
|
102
|
-
flexDirection: "row",
|
|
103
|
-
alignItems: "center",
|
|
104
|
-
gap: 6
|
|
105
|
-
},
|
|
106
|
-
cardLabel: {
|
|
107
|
-
fontSize: 10,
|
|
108
|
-
fontWeight: "700",
|
|
109
|
-
letterSpacing: 0.5,
|
|
110
|
-
color: macOSColors.text.secondary
|
|
111
|
-
},
|
|
112
|
-
cardLabelActive: {
|
|
113
|
-
color: macOSColors.text.primary
|
|
114
|
-
},
|
|
115
|
-
cardLabelDisabled: {
|
|
116
|
-
color: macOSColors.text.muted
|
|
117
|
-
},
|
|
118
|
-
cardDescription: {
|
|
119
|
-
fontSize: 9,
|
|
120
|
-
color: macOSColors.text.muted,
|
|
121
|
-
lineHeight: 12
|
|
122
|
-
},
|
|
123
|
-
cardDescriptionActive: {
|
|
124
|
-
color: macOSColors.text.secondary
|
|
125
|
-
},
|
|
126
|
-
cardDescriptionDisabled: {
|
|
127
|
-
color: macOSColors.text.muted
|
|
128
|
-
}
|
|
129
|
-
});
|
|
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:"change",label:"CHANGE",description:"View change 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 ZustandDetailViewToggle=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,s=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(s,{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}});
|