@buoy-gg/zustand 2.1.8

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.
Files changed (61) hide show
  1. package/LICENSE +58 -0
  2. package/README.md +138 -0
  3. package/lib/commonjs/index.js +1 -0
  4. package/lib/commonjs/package.json +1 -0
  5. package/lib/commonjs/preset.js +1 -0
  6. package/lib/commonjs/zustand/components/ZustandActionButton.js +1 -0
  7. package/lib/commonjs/zustand/components/ZustandDetailViewToggle.js +1 -0
  8. package/lib/commonjs/zustand/components/ZustandEventFilterView.js +1 -0
  9. package/lib/commonjs/zustand/components/ZustandIcon.js +1 -0
  10. package/lib/commonjs/zustand/components/ZustandModal.js +1 -0
  11. package/lib/commonjs/zustand/components/ZustandStateChangeItem.js +1 -0
  12. package/lib/commonjs/zustand/components/ZustandStateDetailContent.js +1 -0
  13. package/lib/commonjs/zustand/components/ZustandStateInfoView.js +1 -0
  14. package/lib/commonjs/zustand/components/ZustandStoreBrowser.js +1 -0
  15. package/lib/commonjs/zustand/components/index.js +1 -0
  16. package/lib/commonjs/zustand/hooks/index.js +1 -0
  17. package/lib/commonjs/zustand/hooks/useZustandStateChanges.js +1 -0
  18. package/lib/commonjs/zustand/index.js +1 -0
  19. package/lib/commonjs/zustand/types/index.js +1 -0
  20. package/lib/commonjs/zustand/utils/buoyZustandMiddleware.js +1 -0
  21. package/lib/commonjs/zustand/utils/index.js +1 -0
  22. package/lib/commonjs/zustand/utils/zustandStateStore.js +1 -0
  23. package/lib/module/index.js +1 -0
  24. package/lib/module/preset.js +1 -0
  25. package/lib/module/zustand/components/ZustandActionButton.js +1 -0
  26. package/lib/module/zustand/components/ZustandDetailViewToggle.js +1 -0
  27. package/lib/module/zustand/components/ZustandEventFilterView.js +1 -0
  28. package/lib/module/zustand/components/ZustandIcon.js +1 -0
  29. package/lib/module/zustand/components/ZustandModal.js +1 -0
  30. package/lib/module/zustand/components/ZustandStateChangeItem.js +1 -0
  31. package/lib/module/zustand/components/ZustandStateDetailContent.js +1 -0
  32. package/lib/module/zustand/components/ZustandStateInfoView.js +1 -0
  33. package/lib/module/zustand/components/ZustandStoreBrowser.js +1 -0
  34. package/lib/module/zustand/components/index.js +1 -0
  35. package/lib/module/zustand/hooks/index.js +1 -0
  36. package/lib/module/zustand/hooks/useZustandStateChanges.js +1 -0
  37. package/lib/module/zustand/index.js +1 -0
  38. package/lib/module/zustand/types/index.js +1 -0
  39. package/lib/module/zustand/utils/buoyZustandMiddleware.js +1 -0
  40. package/lib/module/zustand/utils/index.js +1 -0
  41. package/lib/module/zustand/utils/zustandStateStore.js +1 -0
  42. package/lib/typescript/index.d.ts +50 -0
  43. package/lib/typescript/preset.d.ts +96 -0
  44. package/lib/typescript/zustand/components/ZustandActionButton.d.ts +42 -0
  45. package/lib/typescript/zustand/components/ZustandDetailViewToggle.d.ts +16 -0
  46. package/lib/typescript/zustand/components/ZustandEventFilterView.d.ts +10 -0
  47. package/lib/typescript/zustand/components/ZustandIcon.d.ts +10 -0
  48. package/lib/typescript/zustand/components/ZustandModal.d.ts +10 -0
  49. package/lib/typescript/zustand/components/ZustandStateChangeItem.d.ts +13 -0
  50. package/lib/typescript/zustand/components/ZustandStateDetailContent.d.ts +30 -0
  51. package/lib/typescript/zustand/components/ZustandStateInfoView.d.ts +18 -0
  52. package/lib/typescript/zustand/components/ZustandStoreBrowser.d.ts +18 -0
  53. package/lib/typescript/zustand/components/index.d.ts +11 -0
  54. package/lib/typescript/zustand/hooks/index.d.ts +3 -0
  55. package/lib/typescript/zustand/hooks/useZustandStateChanges.d.ts +38 -0
  56. package/lib/typescript/zustand/index.d.ts +12 -0
  57. package/lib/typescript/zustand/types/index.d.ts +72 -0
  58. package/lib/typescript/zustand/utils/buoyZustandMiddleware.d.ts +84 -0
  59. package/lib/typescript/zustand/utils/index.d.ts +3 -0
  60. package/lib/typescript/zustand/utils/zustandStateStore.d.ts +55 -0
  61. package/package.json +81 -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,138 @@
1
+ # @buoy-gg/zustand
2
+
3
+ Zustand store DevTools for React Native. Live state change monitoring, state inspection, and diff visualization for your Zustand stores.
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ npm install @buoy-gg/zustand
9
+ ```
10
+
11
+ ### One line — zero store modifications
12
+
13
+ ```tsx
14
+ import { watchStores } from '@buoy-gg/zustand';
15
+ import { useCounterStore } from './stores/counter';
16
+ import { useAuthStore } from './stores/auth';
17
+ import { useCartStore } from './stores/cart';
18
+
19
+ // Call once at module scope (e.g. in _layout.tsx or App.tsx):
20
+ watchStores({
21
+ counterStore: useCounterStore,
22
+ authStore: useAuthStore,
23
+ cartStore: useCartStore,
24
+ });
25
+ ```
26
+
27
+ That's it. The Zustand tool appears automatically in FloatingDevTools.
28
+
29
+ Your stores stay completely untouched — `watchStores` uses Zustand's built-in `.subscribe()` to observe changes from the outside. It never modifies `setState` or any store internals.
30
+
31
+ ### Safe by design
32
+
33
+ - **Add in seconds** — one import, one function call
34
+ - **Remove in seconds** — delete those two lines, done
35
+ - **Cannot break your stores** — all listener code is wrapped in try/catch. Even if our code has a bug, your stores keep working normally
36
+ - **No monkey-patching** — we call `.subscribe()`, the same API your own components use
37
+
38
+ ### Cleanup (optional)
39
+
40
+ ```tsx
41
+ const cleanup = watchStores({ ... });
42
+
43
+ // Later, to stop watching:
44
+ cleanup();
45
+ ```
46
+
47
+ ## Advanced: middleware mode
48
+
49
+ If you want extra detail (the exact partial passed to `setState` and precise timing), you can opt into the middleware approach per-store:
50
+
51
+ ```tsx
52
+ import { create } from 'zustand';
53
+ import { buoyDevTools } from '@buoy-gg/zustand';
54
+
55
+ const useCounterStore = create(
56
+ buoyDevTools(
57
+ (set) => ({
58
+ count: 0,
59
+ increment: () => set((s) => ({ count: s.count + 1 })),
60
+ }),
61
+ { name: 'counterStore' }
62
+ )
63
+ );
64
+ ```
65
+
66
+ This wraps `setState` internally, so it captures what was passed and how long it took. Works with middleware chaining (persist, immer, etc.):
67
+
68
+ ```tsx
69
+ import { persist } from 'zustand/middleware';
70
+
71
+ const useAuthStore = create(
72
+ buoyDevTools(
73
+ persist(
74
+ (set) => ({ user: null, login: (u) => set({ user: u }) }),
75
+ { name: 'auth-storage' }
76
+ ),
77
+ { name: 'authStore' }
78
+ )
79
+ );
80
+ ```
81
+
82
+ ## Features
83
+
84
+ - **Live state change capture** — every state update is recorded with prev/next state
85
+ - **State inspection** — full JSON viewer for state after each change
86
+ - **State diffing** — tree view and split view comparing previous vs. next state
87
+ - **Changed keys tracking** — see exactly which top-level keys changed per update
88
+ - **Store color coding** — each store gets a consistent color for easy visual tracking
89
+ - **Performance monitoring** — updates slower than 16ms are flagged (middleware mode)
90
+ - **Persist awareness** — auto-detects stores using Zustand's persist middleware
91
+ - **Search & filter** — search by store name or changed keys, filter to only state-changing updates
92
+ - **Jump to state** — restore any store to a previously captured state
93
+ - **Reset store** — reset any store to its initial state
94
+ - **Copy to clipboard** — copy state data (Pro)
95
+
96
+ ## Comparison
97
+
98
+ | | `watchStores()` | `buoyDevTools()` middleware |
99
+ |---|---|---|
100
+ | Setup | One line, no store changes | Wrap each store's `create()` |
101
+ | Risk | Zero — uses subscribe only | Low — wraps setState |
102
+ | Captures partial | No | Yes |
103
+ | Captures timing | No | Yes |
104
+ | State diff | Yes | Yes |
105
+ | Changed keys | Yes | Yes |
106
+ | Persist detection | Yes | Yes |
107
+
108
+ ## Exports
109
+
110
+ ```tsx
111
+ // Primary — non-intrusive
112
+ import { watchStores } from '@buoy-gg/zustand';
113
+
114
+ // Advanced — middleware
115
+ import { buoyDevTools } from '@buoy-gg/zustand';
116
+
117
+ // Preset
118
+ import { zustandToolPreset, createZustandTool } from '@buoy-gg/zustand';
119
+
120
+ // Hook
121
+ import { useZustandStateChanges } from '@buoy-gg/zustand';
122
+
123
+ // Components (for custom UIs)
124
+ import {
125
+ ZustandModal,
126
+ ZustandStateChangeItem,
127
+ ZustandStateDetailContent,
128
+ ZustandIcon,
129
+ } from '@buoy-gg/zustand';
130
+
131
+ // Types
132
+ import type {
133
+ ZustandStateChange,
134
+ ZustandStoreInfo,
135
+ ZustandFilter,
136
+ StateChangeCategory,
137
+ } from '@buoy-gg/zustand';
138
+ ```
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ZUSTAND_ICON_COLOR",{enumerable:!0,get:function(){return _ZustandIcon.ZUSTAND_ICON_COLOR}}),Object.defineProperty(exports,"ZustandIcon",{enumerable:!0,get:function(){return _ZustandIcon.ZustandIcon}}),Object.defineProperty(exports,"ZustandModal",{enumerable:!0,get:function(){return _ZustandModal.ZustandModal}}),Object.defineProperty(exports,"ZustandStateChangeItem",{enumerable:!0,get:function(){return _ZustandStateChangeItem.ZustandStateChangeItem}}),Object.defineProperty(exports,"ZustandStateDetailContent",{enumerable:!0,get:function(){return _ZustandStateDetailContent.ZustandStateDetailContent}}),Object.defineProperty(exports,"ZustandStateDetailFooter",{enumerable:!0,get:function(){return _ZustandStateDetailContent.ZustandStateDetailFooter}}),Object.defineProperty(exports,"buoyDevTools",{enumerable:!0,get:function(){return _buoyZustandMiddleware.buoyDevTools}}),Object.defineProperty(exports,"createZustandTool",{enumerable:!0,get:function(){return _preset.createZustandTool}}),Object.defineProperty(exports,"isStoreInstrumented",{enumerable:!0,get:function(){return _buoyZustandMiddleware.isStoreInstrumented}}),Object.defineProperty(exports,"useZustandStateChanges",{enumerable:!0,get:function(){return _useZustandStateChanges.useZustandStateChanges}}),Object.defineProperty(exports,"watchStores",{enumerable:!0,get:function(){return _buoyZustandMiddleware.watchStores}}),Object.defineProperty(exports,"zustandStateStore",{enumerable:!0,get:function(){return _zustandStateStore.zustandStateStore}}),Object.defineProperty(exports,"zustandToolPreset",{enumerable:!0,get:function(){return _preset.zustandToolPreset}});var _preset=require("./preset"),_buoyZustandMiddleware=require("./zustand/utils/buoyZustandMiddleware"),_useZustandStateChanges=require("./zustand/hooks/useZustandStateChanges"),_ZustandModal=require("./zustand/components/ZustandModal"),_ZustandStateChangeItem=require("./zustand/components/ZustandStateChangeItem"),_ZustandStateDetailContent=require("./zustand/components/ZustandStateDetailContent"),_ZustandIcon=require("./zustand/components/ZustandIcon"),_zustandStateStore=require("./zustand/utils/zustandStateStore");
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createZustandTool=createZustandTool,exports.zustandToolPreset=void 0;var _ZustandModal=require("./zustand/components/ZustandModal"),_ZustandIcon=require("./zustand/components/ZustandIcon"),_jsxRuntime=require("react/jsx-runtime");const zustandToolPreset=exports.zustandToolPreset={id:"zustand",name:"ZUSTAND",description:"Zustand store & state inspector",slot:"both",icon:({size:e})=>(0,_jsxRuntime.jsx)(_ZustandIcon.ZustandIcon,{size:e}),component:_ZustandModal.ZustandModal,props:{enableSharedModalDimensions:!1}};function createZustandTool(e){return{id:e?.id||"zustand",name:e?.name||"ZUSTAND",description:e?.description||"Zustand store & state inspector",slot:"both",icon:({size:n})=>(0,_jsxRuntime.jsx)(_ZustandIcon.ZustandIcon,{size:n,color:e?.iconColor}),component:_ZustandModal.ZustandModal,props:{enableSharedModalDimensions:void 0!==e?.enableSharedModalDimensions&&e.enableSharedModalDimensions}}}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ZustandActionButton=ZustandActionButton;var _reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_jsxRuntime=require("react/jsx-runtime");const buttonConfigs={copy:{color:_sharedUi.buoyColors.primary,backgroundColor:_sharedUi.buoyColors.primary+"15",borderColor:_sharedUi.buoyColors.primary+"40",textColor:_sharedUi.buoyColors.primary},reset:{color:_sharedUi.buoyColors.warning,backgroundColor:_sharedUi.buoyColors.warning+"15",borderColor:_sharedUi.buoyColors.warning+"40",textColor:_sharedUi.buoyColors.warning},clear:{color:_sharedUi.buoyColors.error,backgroundColor:_sharedUi.buoyColors.error+"15",borderColor:_sharedUi.buoyColors.error+"40",textColor:_sharedUi.buoyColors.error},jump:{color:_sharedUi.buoyColors.warning,backgroundColor:_sharedUi.buoyColors.warning+"15",borderColor:_sharedUi.buoyColors.warning+"40",textColor:_sharedUi.buoyColors.warning}};function ZustandActionButton({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.ZustandDetailViewToggle=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:"change",label:"CHANGE",description:"View change 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}],ZustandDetailViewToggle=exports.ZustandDetailViewToggle=(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}),exports.ZustandEventFilterView=ZustandEventFilterView;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_zustandStateStore=require("../utils/zustandStateStore"),_jsxRuntime=require("react/jsx-runtime");function getStoreColorForPattern(e,t){const o=t.find(t=>t.name.toLowerCase()===e.toLowerCase());return o?_zustandStateStore.zustandStateStore.getStoreColor(o.name):null}function isStoreFiltered(e,t){return Array.from(t).some(t=>e.name.toLowerCase().includes(t.toLowerCase()))}function ZustandEventFilterView({ignoredPatterns:e,onTogglePattern:t,onAddPattern:o,stores:r}){const[s,i]=(0,_react.useState)(!1),[a,n]=(0,_react.useState)("");return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.container,contentContainerStyle:styles.scrollContent,showsVerticalScrollIndicator:!1,children:[r.length>0&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsxs)(_sharedUi.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.SectionHeader.Title,{children:"REGISTERED STORES"}),(0,_jsxRuntime.jsx)(_sharedUi.SectionHeader.Badge,{count:r.length,color:_sharedUi.buoyColors.primary})]}),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.storeList,contentContainerStyle:styles.storeListContent,showsVerticalScrollIndicator:!0,nestedScrollEnabled:!0,children:r.map(t=>{const r=_zustandStateStore.zustandStateStore.getStoreColor(t.name),s=isStoreFiltered(t,e);return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.storeRow,s&&styles.storeRowFiltered],onPress:()=>o(t.name),disabled:s,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.storeDot,{backgroundColor:s?_sharedUi.macOSColors.text.disabled:r}]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.storeRowText,s&&styles.storeRowTextFiltered,!s&&{color:r}],numberOfLines:1,children:t.name}),s?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.filteredLabel,children:"hidden"}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.addLabel,{color:r+"99"}],children:"+ hide"})]},t.name)})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsxs)(_sharedUi.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.SectionHeader.Icon,{icon:_sharedUi.Filter,color:_sharedUi.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_sharedUi.SectionHeader.Title,{children:"STORE NAME FILTERS"}),e.size>0&&(0,_jsxRuntime.jsx)(_sharedUi.SectionHeader.Badge,{count:e.size,color:_sharedUi.buoyColors.primary})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.addInputWrapper,children:s?(0,_jsxRuntime.jsx)(_sharedUi.AddFilterInput,{value:a,onChange:n,onSubmit:()=>{const e=a.trim();e&&(o(e),n(""),i(!1))},onCancel:()=>{i(!1),n("")},placeholder:"Enter store name pattern to hide...",color:_sharedUi.buoyColors.primary}):(0,_jsxRuntime.jsx)(_sharedUi.AddFilterButton,{onPress:()=>i(!0),color:_sharedUi.buoyColors.primary,label:"Add store name pattern"})}),e.size>0&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.patternList,children:Array.from(e).map(e=>{const o=getStoreColorForPattern(e,r);return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.patternRow,onPress:()=>t(e),activeOpacity:.8,children:[o?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.storeDot,{backgroundColor:o}]}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.patternText,o?{color:o}:null],numberOfLines:1,children:e}),(0,_jsxRuntime.jsx)(_sharedUi.X,{size:12,color:_sharedUi.buoyColors.primary+"80"})]},e)})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsxs)(_sharedUi.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.SectionHeader.Icon,{icon:_sharedUi.Filter,color:_sharedUi.buoyColors.textSecondary,size:12}),(0,_jsxRuntime.jsx)(_sharedUi.SectionHeader.Title,{children:"HOW EVENT FILTERS WORK"})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.howItWorksText,children:"Patterns hide matching stores from both the Stores tab and the Events tab. Tap a store above to quickly add it as a filter."}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.examplesContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.examplesTitle,children:"EXAMPLES:"}),["• auth → hides authStore from stores & events","• temp → hides tempStore, tempUserStore","• cart → hides cartStore from both tabs"].map(e=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.exampleItem,children:e},e))]})]})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:_sharedUi.buoyColors.base},scrollContent:{paddingTop:16,paddingHorizontal:16,paddingBottom:24,gap:16},section:{backgroundColor:_sharedUi.buoyColors.card,borderRadius:16,borderWidth:1,borderColor:_sharedUi.buoyColors.border,overflow:"hidden"},storeList:{maxHeight:180},storeListContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:16,gap:10},storeRow:{flexDirection:"row",alignItems:"center",gap:10,paddingVertical:10,paddingHorizontal:12,backgroundColor:_sharedUi.buoyColors.hover,borderRadius:8,borderWidth:1,borderColor:_sharedUi.buoyColors.border},storeRowFiltered:{opacity:.45},storeDot:{width:7,height:7,borderRadius:3.5},storeRowText:{flex:1,fontSize:12,fontWeight:"600",fontFamily:"monospace"},storeRowTextFiltered:{color:_sharedUi.macOSColors.text.muted,textDecorationLine:"line-through"},filteredLabel:{fontSize:10,fontWeight:"500",color:_sharedUi.macOSColors.text.disabled,fontFamily:"monospace"},addLabel:{fontSize:10,fontWeight:"600",fontFamily:"monospace"},addInputWrapper:{paddingHorizontal:16,paddingTop:8,paddingBottom:8},patternList:{paddingHorizontal:16,paddingBottom:16,gap:8},patternRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,paddingHorizontal:12,backgroundColor:_sharedUi.buoyColors.hover,borderRadius:8,borderWidth:1,borderColor:_sharedUi.buoyColors.border,gap:8},patternText:{flex:1,fontSize:12,fontFamily:"monospace",color:_sharedUi.buoyColors.text},howItWorksText:{fontSize:11,color:_sharedUi.buoyColors.textSecondary,lineHeight:16,marginTop:8,paddingHorizontal:16,fontFamily:"monospace"},examplesContainer:{paddingTop:8,paddingHorizontal:16,paddingBottom:16,borderTopWidth:1,borderTopColor:_sharedUi.buoyColors.border,marginTop:12},examplesTitle:{fontSize:10,fontWeight:"600",color:_sharedUi.buoyColors.textMuted,fontFamily:"monospace",letterSpacing:.5,marginBottom:6},exampleItem:{fontSize:10,color:_sharedUi.buoyColors.textMuted,fontFamily:"monospace",lineHeight:16}});
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ZUSTAND_ICON_COLOR=void 0,exports.ZustandIcon=ZustandIcon;var _reactNative=require("react-native"),_jsxRuntime=require("react/jsx-runtime");const ZUSTAND_ICON_COLOR=exports.ZUSTAND_ICON_COLOR="#463B3F";function ZustandIcon({size:e,color:t}){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:e,height:e,justifyContent:"center",alignItems:"center"},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{fontSize:.75*e,color:t||ZUSTAND_ICON_COLOR,fontWeight:"700"},children:"Z"})})}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ZustandModal=ZustandModal;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_license=require("@buoy-gg/license"),_useZustandStateChanges=require("../hooks/useZustandStateChanges"),_ZustandStateChangeItem=require("./ZustandStateChangeItem"),_ZustandStateDetailContent=require("./ZustandStateDetailContent"),_ZustandStoreBrowser=require("./ZustandStoreBrowser"),_ZustandEventFilterView=require("./ZustandEventFilterView"),_jsxRuntime=require("react/jsx-runtime");const FREE_TIER_CHANGE_LIMIT=25;function EventsEmptyState({isEnabled:e}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyState,children:[(0,_jsxRuntime.jsx)(_sharedUi.Box,{size:32,color:_sharedUi.macOSColors.text.muted}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyTitle,children:"No state changes"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyText,children:e?"State changes will appear here as stores update.":"Enable capture to start recording state changes"})]})}function ZustandModal({visible:e,onClose:t,onBack:a,onMinimize:s,enableSharedModalDimensions:r=!1}){const n=(0,_license.useIsPro)(),[i,o]=(0,_react.useState)(!1),[l,d]=(0,_react.useState)("stores"),[c,u]=(0,_react.useState)(null),[h,_]=(0,_react.useState)(!1),[m,x]=(0,_react.useState)(new Set),{filteredChanges:g,filter:j,setFilter:y,stats:C,stores:S,clearChanges:b,isEnabled:p,toggleCapture:R}=(0,_useZustandStateChanges.useZustandStateChanges)(),U=(0,_react.useMemo)(()=>0===m.size?g:g.filter(e=>!Array.from(m).some(t=>e.storeName.toLowerCase().includes(t.toLowerCase()))),[g,m]),v=(0,_react.useMemo)(()=>0===m.size?S:S.filter(e=>!Array.from(m).some(t=>e.name.toLowerCase().includes(t.toLowerCase()))),[S,m]),T=(0,_react.useMemo)(()=>n?U:U.slice(0,FREE_TIER_CHANGE_LIMIT),[U,n]),f=(0,_react.useMemo)(()=>n?0:Math.max(0,U.length-FREE_TIER_CHANGE_LIMIT),[U.length,n]),k=f>0,w=(0,_react.useMemo)(()=>c?T.filter(e=>e.storeName===c):T,[T,c]),[B,N]=(0,_react.useState)(null),M=(0,_react.useMemo)(()=>{if(null===B)return null;const e=w.findIndex(e=>e.id===B);return e>=0?e:null},[B,w]),E=null!==M?w[M]:null,[I,O]=(0,_react.useState)(""),[z,H]=(0,_react.useState)(!1),Z=(0,_react.useRef)(null),P=(0,_react.useRef)(null),A=(0,_react.useCallback)(e=>{},[]),F=e=>{O(e),"events"===l&&y(t=>({...t,searchText:e}))},V=(0,_react.useCallback)(e=>{N(e.id)},[]),L=(0,_react.useCallback)(()=>{o(!0)},[]),D=(0,_react.useCallback)(()=>{N(null)},[]),q=(0,_react.useCallback)(e=>{const t=w[e];t&&N(t.id)},[w]),K=(0,_react.useCallback)(e=>{u(e),N(null)},[]),W=(0,_react.useCallback)(()=>{u(null),N(null)},[]),G=(0,_react.useCallback)(()=>v.reduce((e,t)=>{try{const a=t.api.getState();if(a&&"object"==typeof a){const s={};for(const[e,t]of Object.entries(a))"function"!=typeof t&&(s[e]=(0,_sharedUi.truncatePayload)(t));e[t.name]=s}else e[t.name]=(0,_sharedUi.truncatePayload)(a)}catch{e[t.name]=null}return e},{}),[v]),$=(0,_react.useCallback)(()=>U.map(e=>({id:e.id,storeName:e.storeName,timestamp:e.timestamp,prevState:(0,_sharedUi.truncatePayload)(e.prevState),nextState:(0,_sharedUi.truncatePayload)(e.nextState),hasStateChange:e.hasStateChange,changedKeys:e.changedKeys})),[U]),J=(0,_react.useCallback)(()=>w.map(e=>({id:e.id,storeName:e.storeName,timestamp:e.timestamp,prevState:(0,_sharedUi.truncatePayload)(e.prevState),nextState:(0,_sharedUi.truncatePayload)(e.nextState),hasStateChange:e.hasStateChange,changedKeys:e.changedKeys})),[w]),Q=(0,_react.useCallback)(e=>{x(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),X=(0,_react.useCallback)(e=>{x(t=>new Set([...t,e]))},[]),Y=(0,_react.useCallback)(e=>{d(e),u(null),N(null),_(!1),I&&(O(""),y(e=>({...e,searchText:""}))),H(!1)},[I,y]),ee=(0,_react.useCallback)(e=>e.id,[]),te=(0,_react.useCallback)(({item:e})=>(0,_jsxRuntime.jsx)(_ZustandStateChangeItem.ZustandStateChangeItem,{change:e,onPress:V}),[V]),ae=m.size>0,se=r?_sharedUi.devToolsStorageKeys.modal.root():"buoy-zustand-modal";if(!e)return null;const re=E&&null!==M?(0,_jsxRuntime.jsx)(_ZustandStateDetailContent.ZustandStateDetailFooter,{change:E,changes:w,selectedIndex:M,onIndexChange:q}):null,ne=E&&w.length>1?68:0;return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_sharedUi.JsModal,{visible:e,onClose:t,onMinimize:s,persistenceKey:se,header:{showToggleButton:!0,customContent:h?(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:()=>_(!1)}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"Filters",centered:!0})]}):E?(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:D}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:`${E.storeName}/setState`,centered:!0})]}):c?(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:W}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:`${c} History`,centered:!0}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Actions,{children:(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{value:J,disabled:0===w.length,buttonStyle:styles.headerActionButton})})]}):(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader,{children:[a&&(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Navigation,{onBack:a}),(0,_jsxRuntime.jsx)(_sharedUi.ModalHeader.Content,{title:"",children:z?(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:Z,style:styles.headerSearchInput,placeholder:"stores"===l?"Search stores...":"Search events...",placeholderTextColor:_sharedUi.macOSColors.text.muted,value:I,onChangeText:F,onSubmitEditing:()=>H(!1),onBlur:()=>H(!1),autoCapitalize:"none",autoCorrect:!1,returnKeyType:"search"}),I.length>0&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>{F(""),H(!1)},style:styles.headerSearchClear,children:(0,_jsxRuntime.jsx)(_sharedUi.X,{size:14,color:_sharedUi.macOSColors.text.secondary})})]}):(0,_jsxRuntime.jsx)(_sharedUi.TabSelector,{tabs:[{key:"stores",label:"Stores"+(v.length>0?` (${v.length})`:"")},{key:"events",label:"Events"+(U.length>0?` (${U.length})`:"")}],activeTab:l,onTabChange:Y})}),(0,_jsxRuntime.jsxs)(_sharedUi.ModalHeader.Actions,{children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>H(!0),style:styles.headerActionButton,children:(0,_jsxRuntime.jsx)(_sharedUi.Search,{size:14,color:_sharedUi.macOSColors.text.secondary})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>_(!0),style:[styles.headerActionButton,ae&&styles.headerActionButtonActive],children:(0,_jsxRuntime.jsx)(_sharedUi.Filter,{size:14,color:ae?_sharedUi.macOSColors.semantic.debug:_sharedUi.macOSColors.text.secondary})}),"stores"===l&&(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{value:G,disabled:0===v.length,buttonStyle:styles.headerActionButton}),"events"===l&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_sharedUi.ToolbarCopyButton,{value:$,disabled:0===U.length,buttonStyle:styles.headerActionButton}),(0,_jsxRuntime.jsx)(_sharedUi.PowerToggleButton,{isEnabled:p,onToggle:R,accessibilityLabel:"Toggle Zustand state capture"}),(0,_jsxRuntime.jsx)(_sharedUi.ToolbarClearButton,{onPress:b,disabled:0===U.length,buttonStyle:styles.headerActionButton})]})]})]})},onModeChange:A,enablePersistence:!0,initialMode:"bottomSheet",enableGlitchEffects:!0,styles:{},footer:re,footerHeight:ne,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,children:h?(0,_jsxRuntime.jsx)(_ZustandEventFilterView.ZustandEventFilterView,{ignoredPatterns:m,onTogglePattern:Q,onAddPattern:X,stores:S}):E&&null!==M?(0,_jsxRuntime.jsx)(_ZustandStateDetailContent.ZustandStateDetailContent,{change:E,changes:w,selectedIndex:M,onIndexChange:q,disableInternalFooter:!0}):c?w.length>0?(0,_jsxRuntime.jsx)(_reactNative.FlatList,{data:w,renderItem:te,keyExtractor:ee,contentContainerStyle:styles.listContent,showsVerticalScrollIndicator:!0,removeClippedSubviews:!0,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:!1}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyState,children:[(0,_jsxRuntime.jsx)(_sharedUi.Box,{size:32,color:_sharedUi.macOSColors.text.muted}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyTitle,children:"No history yet"}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.emptyText,children:["State changes for ",c," will appear here."]})]}):"stores"===l?(0,_jsxRuntime.jsx)(_ZustandStoreBrowser.ZustandStoreBrowser,{stores:v,searchQuery:I,onViewHistory:K}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[!p&&(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:"State capture is disabled"})]}),k&&(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.lockedBanner,onPress:L,activeOpacity:.8,children:[(0,_jsxRuntime.jsx)(_sharedUi.Lock,{size:14,color:_sharedUi.buoyColors.primary}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.lockedText,children:[f," older"," ",1===f?"change":"changes"," locked"]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.upgradeBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.upgradeBadgeText,children:"UPGRADE"})})]}),T.length>0?(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:P,data:T,renderItem:te,keyExtractor:ee,contentContainerStyle:styles.listContent,showsVerticalScrollIndicator:!0,removeClippedSubviews:!0,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:!1}):(0,_jsxRuntime.jsx)(EventsEmptyState,{isEnabled:p})]})})}),(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:i,onClose:()=>o(!1),featureName:"Full State 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},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},headerActionButtonActive:{backgroundColor:_sharedUi.macOSColors.semantic.infoBackground},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",lineHeight:18},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}),exports.ZustandStateChangeItem=ZustandStateChangeItem;var _reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_zustandStateStore=require("../utils/zustandStateStore"),_jsxRuntime=require("react/jsx-runtime");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,t){switch(e){case"replace":return"Replace";case"persist":return"Hydrate";case"initial":return"Initial";default:return t.charAt(0).toUpperCase()+t.slice(1)}}function getCategoryColor(e,t){switch(e){case"replace":return _sharedUi.buoyColors.warning;case"persist":return _sharedUi.buoyColors.info;case"initial":return _sharedUi.buoyColors.textMuted;default:return _zustandStateStore.zustandStateStore.getStoreColor(t)}}function getSublabel(e){const t=[];return void 0!==e.duration&&e.duration>=.1&&t.push(`${e.duration.toFixed(1)}ms`),e.hasStateChange?e.changedKeysCount>0?t.push(`${e.changedKeysCount} key${e.changedKeysCount>1?"s":""} changed`):t.push(e.diffSummary||"state changed"):t.push("no state change"),t.join(" · ")}function getBadgeText(e){return"replace"===e.category?"REPLACE":"persist"===e.category?"HYDRATE":"initial"===e.category?"INIT":"SET"}function getPrimaryText(e){return e.changedKeys.length>0&&e.changedKeys.length<=3?e.changedKeys.join(", "):e.changedKeys.length>3?`${e.changedKeys.slice(0,2).join(", ")} +${e.changedKeys.length-2}`:e.partialPreview||"setState()"}function ZustandStateChangeItem({change:e,onPress:t}){const a=getCategoryColor(e.category,e.storeName),r=getStatusLabel(e.category,e.storeName),s=getSublabel(e),n=getPrimaryText(e),o=getBadgeText(e);let i;return e.isSlowUpdate?i=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.badgeContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.badgeText,{color:a}],children:o}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.slowBadge,children:(0,_jsxRuntime.jsx)(_sharedUi.Clock,{size:12,color:_sharedUi.buoyColors.error})})]}):e.hasStateChange&&(i=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.badgeContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.badgeText,{color:a}],children:o}),(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:a,statusLabel:r,statusSublabel:s,primaryText:n,bottomRightText:formatRelativeTime(e.timestamp),customBadge:i,badgeText:i?void 0:o,badgeColor:a,showChevron:!0,onPress:()=>t(e)})}const styles=_reactNative.StyleSheet.create({badgeContainer:{flexDirection:"row",alignItems:"center",gap:4},badgeText:{fontSize:11,fontWeight:"600",fontFamily:"monospace"},changeBadge:{paddingHorizontal:4},slowBadge:{paddingHorizontal:4}});
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ZustandStateDetailContent=ZustandStateDetailContent,exports.ZustandStateDetailFooter=ZustandStateDetailFooter;var _reactNative=require("react-native"),_react=require("react"),_sharedUi=require("@buoy-gg/shared-ui"),_dataViewer=require("@buoy-gg/shared-ui/dataViewer"),_ZustandDetailViewToggle=require("./ZustandDetailViewToggle"),_ZustandStateInfoView=require("./ZustandStateInfoView"),_zustandStateStore=require("../utils/zustandStateStore"),_jsxRuntime=require("react/jsx-runtime");function getChangeColor(e){return _zustandStateStore.zustandStateStore.getStoreColor(e.storeName)}function getChangeLabel(e){switch(e.category){case"replace":return"REPLACE";case"persist":return"HYDRATE";case"initial":return"INIT";default:return"SET"}}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 ZustandStateDetailContent({change:e,changes:t,selectedIndex:a,onIndexChange:i,disableInternalFooter:r=!1}){const[n,s]=(0,_react.useState)("change"),[l,o]=(0,_react.useState)("tree"),d=t.length,c=getChangeColor(e),u=getChangeLabel(e),m=getValueType(e.nextState),x=d-a,g=x-1,h=a<d-1?a+1:null,_=null!==h?t[h]:null,f=(0,_react.useMemo)(()=>({index:h??0,label:g>0?`#${g}`:"Initial",timestamp:_?formatTimestamp(_.timestamp):"",relativeTime:_?(0,_sharedUi.formatRelativeTime)(new Date(_.timestamp)):"state",badge:_?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.changeBadgeSmall,{backgroundColor:`${getChangeColor(_)}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.changeTextSmall,{color:getChangeColor(_)}],children:getChangeLabel(_)})}):void 0}),[h,_,g]),y=(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.changeBadgeSmall,{backgroundColor:`${c}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.changeTextSmall,{color:c}],children:u})})}),[a,e.timestamp,c,u,x]),p=(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 CHANGE"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.valueHeaderBadges,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.changeBadge,{backgroundColor:`${c}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.changeText,{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]),S=(0,_react.useCallback)(()=>{const t=(0,_sharedUi.parseValue)(e.prevState),a=(0,_sharedUi.parseValue)(e.nextState);return"split"===l?(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,l]),j=(0,_react.useCallback)(()=>{i(Math.min(d-1,a+1))},[a,d,i]),b=(0,_react.useCallback)(()=>{i(Math.max(0,a-1))},[a,i]),C=d<=1;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsx)(_ZustandDetailViewToggle.ZustandDetailViewToggle,{activeView:n,onViewChange:s,diffDisabled:C}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.contentArea,children:["change"===n&&(0,_jsxRuntime.jsx)(_ZustandStateInfoView.ZustandStateInfoView,{change:e}),"state"===n&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.stateContainer,children:p()}),"diff"===n&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffContainer,children:[(0,_jsxRuntime.jsx)(_sharedUi.DiffModeTabs,{tabs:DIFF_MODE_TABS,activeTab:l,onTabChange:o}),(0,_jsxRuntime.jsx)(_sharedUi.CompareBar,{leftEvent:f,rightEvent:y}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.diffContent,children:S()})]})]}),!r&&d>1&&(0,_jsxRuntime.jsx)(_sharedUi.EventStepperFooter,{currentIndex:x-1,totalItems:d,onPrevious:j,onNext:b,itemLabel:"Change",subtitle:(0,_sharedUi.formatRelativeTime)(new Date(e.timestamp)),absolute:!0})]})}function ZustandStateDetailFooter({change:e,changes: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:"Change",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},changeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4},changeText:{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},changeBadgeSmall:{paddingHorizontal:6,paddingVertical:1,borderRadius:3},changeTextSmall:{fontSize:8,fontWeight:"700",fontFamily:"monospace"}});
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ZustandStateInfoView=void 0;var _react=_interopRequireWildcard(require("react")),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_license=require("@buoy-gg/license"),_dataViewer=require("@buoy-gg/shared-ui/dataViewer"),_ZustandActionButton=require("./ZustandActionButton"),_zustandStateStore=require("../utils/zustandStateStore"),_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 a,i,s={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return s;if(a=t?r:o){if(a.has(e))return a.get(e);a.set(e,s)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=(a=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?a(s,t,i):s[t]=e[t]);return s})(e,t)}function getCategoryInfo(e){switch(e){case"replace":return{label:"REPLACE",color:_sharedUi.buoyColors.warning,bgColor:_sharedUi.buoyColors.warning+"26"};case"persist":return{label:"PERSIST",color:_sharedUi.buoyColors.info,bgColor:_sharedUi.buoyColors.info+"26"};case"initial":return{label:"INITIAL",color:_sharedUi.buoyColors.textMuted,bgColor:_sharedUi.buoyColors.textMuted+"26"};default:return{label:"SET STATE",color:_sharedUi.buoyColors.success,bgColor:_sharedUi.buoyColors.success+"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}:void 0],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 ZustandStateInfoView=exports.ZustandStateInfoView=(0,_react.memo)(function({change:e}){const t=(0,_license.useIsPro)(),[o,r]=(0,_react.useState)(!1);(0,_react.useEffect)(()=>{o&&t&&r(!1)},[o,t]);const a=getCategoryInfo(e.category),i=void 0!==e.partial&&"(updater fn)"!==e.partial,s=e.changedKeys.length>0,n=_zustandStateStore.zustandStateStore.getStoreColor(e.storeName),l=(0,_react.useCallback)(async()=>{t?await(0,_sharedUi.copyToClipboard)(e.nextState):r(!0)},[e.nextState,t]),d=(0,_react.useCallback)(()=>{const t=_zustandStateStore.zustandStateStore.getStore(e.storeName);if(t?.api.getInitialState){const e=t.api.getInitialState();t.api.setState(e,!0)}},[e.storeName]),c=(0,_react.useCallback)(()=>{const t=_zustandStateStore.zustandStateStore.getStore(e.storeName);t&&t.api.setState(e.nextState,!0)},[e.storeName,e.nextState]);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:"CHANGE INFO"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardContent,children:[(0,_jsxRuntime.jsx)(InfoRow,{label:"Store",value:e.storeName,mono:!0,valueColor:n}),(0,_jsxRuntime.jsx)(InfoRow,{label:"Time",value:formatTime(e.timestamp),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.isSlowUpdate&&styles.durationBadgeSlow],children:[(0,_jsxRuntime.jsx)(_sharedUi.Clock,{size:10,color:e.isSlowUpdate?_sharedUi.buoyColors.error:_sharedUi.buoyColors.textSecondary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.durationText,e.isSlowUpdate&&styles.durationTextSlow],children:formatDuration(e.duration)}),e.isSlowUpdate&&(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"})}),e.isPersisted&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.persistBadge,children:[(0,_jsxRuntime.jsx)(_sharedUi.Database,{size:10,color:_sharedUi.buoyColors.info}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.persistText,children:"PERSISTED"})]})]})]})]}),s&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.card,children:[(0,_jsxRuntime.jsx)(SectionHeader,{icon:_sharedUi.Zap,title:"CHANGED KEYS",badge:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.countBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.countText,children:e.changedKeys.length})})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.cardContent,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.keysContainer,children:e.changedKeys.map(e=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.keyBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.keyText,children:e})},e))})})]}),i&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.card,children:[(0,_jsxRuntime.jsx)(SectionHeader,{icon:_sharedUi.Box,title:"PARTIAL (setState argument)",badge:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.typeBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.typeText,children:Array.isArray(e.partial)?"ARRAY":"object"==typeof e.partial?"OBJECT":String(typeof e.partial).toUpperCase()})})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dataViewerContainer,children:(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"",data:(0,_sharedUi.parseValue)(e.partial),showTypeFilter:!1})})]}),"(updater fn)"===e.partial&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.card,children:[(0,_jsxRuntime.jsx)(SectionHeader,{icon:_sharedUi.Box,title:"SET STATE CALL"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardContent,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.updaterText,children:"Called with an updater function: set((state) => ...)"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.updaterSubtext,children:"The partial value is computed at runtime from the previous state. See the DIFF tab to view the resulting changes."})]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionsGrid,children:[(0,_jsxRuntime.jsx)(_ZustandActionButton.ZustandActionButton,{type:"jump",text:"JUMP",onPress:c}),(0,_jsxRuntime.jsx)(_ZustandActionButton.ZustandActionButton,{type:"reset",text:"RESET STORE",onPress:d}),(0,_jsxRuntime.jsx)(_ZustandActionButton.ZustandActionButton,{type:"copy",text:"COPY STATE",onPress:l})]}),(0,_jsxRuntime.jsx)(_sharedUi.ProUpgradeModal,{visible:o,onClose:()=>r(!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},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},persistBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:_sharedUi.buoyColors.info+"26"},persistText:{fontSize:9,fontWeight:"700",color:_sharedUi.buoyColors.info,letterSpacing:.3},keysContainer:{flexDirection:"row",flexWrap:"wrap",gap:6},keyBadge:{paddingHorizontal:8,paddingVertical:4,borderRadius:4,backgroundColor:_sharedUi.buoyColors.primary+"20",borderWidth:1,borderColor:_sharedUi.buoyColors.primary+"40"},keyText:{fontSize:11,fontWeight:"600",color:_sharedUi.buoyColors.primary,fontFamily:"monospace"},countBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:_sharedUi.buoyColors.primary+"26"},countText:{fontSize:9,fontWeight:"700",color:_sharedUi.buoyColors.primary,fontFamily:"monospace"},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},updaterText:{fontSize:12,color:_sharedUi.buoyColors.text,fontFamily:"monospace"},updaterSubtext:{fontSize:11,color:_sharedUi.buoyColors.textMuted,lineHeight:16,marginTop:4},actionsGrid:{flexDirection:"row",flexWrap:"wrap",gap:12,justifyContent:"flex-start"}});
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ZustandStoreBrowser=ZustandStoreBrowser;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_dataViewer=require("@buoy-gg/shared-ui/dataViewer"),_zustandStateStore=require("../utils/zustandStateStore"),_jsxRuntime=require("react/jsx-runtime");function getKeysPreview(e){try{const t=e.api.getState();if(t&&"object"==typeof t){const e=Object.keys(t).filter(e=>"function"!=typeof t[e]);return 0===e.length?"no data keys":e.length<=3?e.join(", "):`${e.slice(0,2).join(", ")} +${e.length-2}`}return""}catch{return""}}function StoreExpandedContent({store:e,onViewHistory:t}){const s=e.api.getState(),r=(0,_react.useMemo)(()=>{if(s&&"object"==typeof s){const e={};for(const[t,r]of Object.entries(s))"function"!=typeof r&&(e[t]=r);return(0,_sharedUi.parseValue)(e)}return(0,_sharedUi.parseValue)(s)},[s]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:expandedStyles.container,children:[(0,_jsxRuntime.jsx)(_sharedUi.ExpandedInfoRow,{label:"Type",children:(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:e.color,children:"ZUSTAND"})}),e.stateChangeCount>0&&(0,_jsxRuntime.jsxs)(_sharedUi.ExpandedInfoRow,{label:"Changes",children:[(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:_sharedUi.buoyColors.warning,children:String(e.stateChangeCount)}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>t(e.name),style:expandedStyles.viewHistoryButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[expandedStyles.viewHistoryText,{color:e.color}],children:"view history →"})})]}),e.isPersisted&&(0,_jsxRuntime.jsx)(_sharedUi.ExpandedInfoRow,{label:"Persist",children:(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:_sharedUi.buoyColors.info,icon:(0,_jsxRuntime.jsx)(_sharedUi.Database,{size:9,color:_sharedUi.buoyColors.info}),children:e.persistName||"persisted"})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:expandedStyles.dataContainer,children:r&&"object"==typeof r?(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"",data:r,showTypeFilter:!0}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:expandedStyles.emptyText,children:"Empty state"})})]})}function EmptyBrowserState(){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyState,children:[(0,_jsxRuntime.jsx)(_sharedUi.Box,{size:32,color:_sharedUi.macOSColors.text.muted}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyTitle,children:"No stores registered"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyText,children:"Use watchStores() to register your Zustand stores.\nThey will appear here with their current state."})]})}function ZustandStoreBrowser({stores:e,searchQuery:t,onViewHistory:s}){const[r,i]=(0,_react.useState)(null),o=(0,_react.useMemo)(()=>{if(!t)return e;const s=t.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(s)||e.persistName&&e.persistName.toLowerCase().includes(s))},[e,t]),n=(0,_react.useCallback)(e=>{i(t=>t===e.name?null:e.name)},[]);return 0!==o.length||t?0===o.length&&t?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyState,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyTitle,children:"No matching stores"}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.emptyText,children:['No stores match "',t,'"']})]}):(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.container,contentContainerStyle:styles.scrollContent,showsVerticalScrollIndicator:!0,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sectionHeader,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"STORES"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.sectionCountBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionCountText,children:o.length})})]}),o.map(e=>{const t=r===e.name,i=getKeysPreview(e),o=_zustandStateStore.zustandStateStore.getStoreColor(e.name);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.storeRowWrapper,children:[(0,_jsxRuntime.jsx)(_sharedUi.CompactRow,{statusDotColor:o,statusLabel:e.name,statusSublabel:e.isPersisted?"persisted":"in-memory",primaryText:i,showChevron:!0,isExpanded:t,onPress:()=>n(e),expandedContent:t?(0,_jsxRuntime.jsx)(StoreExpandedContent,{store:e,onViewHistory:s}):void 0}),e.stateChangeCount>0&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.absCountBadge,{backgroundColor:o+"22",borderColor:o+"55"}],pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.absCountText,{color:o}],children:String(e.stateChangeCount)})})]},e.name)})]}):(0,_jsxRuntime.jsx)(EmptyBrowserState,{})}const styles=_reactNative.StyleSheet.create({container:{flex:1},storeRowWrapper:{position:"relative"},absCountBadge:{position:"absolute",top:4,right:10,paddingHorizontal:5,paddingVertical:1,borderRadius:4,borderWidth:1,zIndex:1},absCountText:{fontSize:9,fontWeight:"700",fontFamily:"monospace"},scrollContent:{paddingTop:8,paddingBottom:20},sectionHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:8,gap:8},sectionTitle:{fontSize:11,fontWeight:"700",letterSpacing:.5,color:_sharedUi.macOSColors.text.muted},sectionCountBadge:{backgroundColor:_sharedUi.buoyColors.primary+"26",paddingHorizontal:8,paddingVertical:2,borderRadius:4},sectionCountText:{fontSize:10,fontWeight:"700",color:_sharedUi.buoyColors.primary,fontFamily:"monospace"},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",lineHeight:18}}),expandedStyles=_reactNative.StyleSheet.create({container:{gap:10},viewHistoryButton:{marginLeft:4},viewHistoryText:{fontSize:10,fontWeight:"600",fontFamily:"monospace"},dataContainer:{backgroundColor:_sharedUi.buoyColors.base,borderRadius:6,borderWidth:1,borderColor:_sharedUi.buoyColors.border,overflow:"hidden",minHeight:60},emptyText:{color:_sharedUi.buoyColors.textMuted,fontSize:12,padding:14,fontStyle:"italic"}});
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ZUSTAND_ICON_COLOR",{enumerable:!0,get:function(){return _ZustandIcon.ZUSTAND_ICON_COLOR}}),Object.defineProperty(exports,"ZustandActionButton",{enumerable:!0,get:function(){return _ZustandActionButton.ZustandActionButton}}),Object.defineProperty(exports,"ZustandDetailViewToggle",{enumerable:!0,get:function(){return _ZustandDetailViewToggle.ZustandDetailViewToggle}}),Object.defineProperty(exports,"ZustandIcon",{enumerable:!0,get:function(){return _ZustandIcon.ZustandIcon}}),Object.defineProperty(exports,"ZustandModal",{enumerable:!0,get:function(){return _ZustandModal.ZustandModal}}),Object.defineProperty(exports,"ZustandStateChangeItem",{enumerable:!0,get:function(){return _ZustandStateChangeItem.ZustandStateChangeItem}}),Object.defineProperty(exports,"ZustandStateDetailContent",{enumerable:!0,get:function(){return _ZustandStateDetailContent.ZustandStateDetailContent}}),Object.defineProperty(exports,"ZustandStateDetailFooter",{enumerable:!0,get:function(){return _ZustandStateDetailContent.ZustandStateDetailFooter}}),Object.defineProperty(exports,"ZustandStateInfoView",{enumerable:!0,get:function(){return _ZustandStateInfoView.ZustandStateInfoView}}),Object.defineProperty(exports,"ZustandStoreBrowser",{enumerable:!0,get:function(){return _ZustandStoreBrowser.ZustandStoreBrowser}});var _ZustandModal=require("./ZustandModal"),_ZustandIcon=require("./ZustandIcon"),_ZustandStateChangeItem=require("./ZustandStateChangeItem"),_ZustandStateDetailContent=require("./ZustandStateDetailContent"),_ZustandStateInfoView=require("./ZustandStateInfoView"),_ZustandDetailViewToggle=require("./ZustandDetailViewToggle"),_ZustandActionButton=require("./ZustandActionButton"),_ZustandStoreBrowser=require("./ZustandStoreBrowser");
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"useZustandStateChanges",{enumerable:!0,get:function(){return _useZustandStateChanges.useZustandStateChanges}});var _useZustandStateChanges=require("./useZustandStateChanges");
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useZustandStateChanges=useZustandStateChanges;var _react=require("react"),_zustandStateStore=require("../utils/zustandStateStore");function useZustandStateChanges(){const[t,e]=(0,_react.useState)(()=>_zustandStateStore.zustandStateStore.getStateChanges()),[a,s]=(0,_react.useState)(()=>_zustandStateStore.zustandStateStore.getStores()),[r,n]=(0,_react.useState)({}),[o,u]=(0,_react.useState)(()=>_zustandStateStore.zustandStateStore.getEnabled());(0,_react.useEffect)(()=>{const t=_zustandStateStore.zustandStateStore.subscribe(t=>{e(t)}),a=_zustandStateStore.zustandStateStore.subscribeToStores(t=>{s(t)});return()=>{t(),a()}},[]);const S=(0,_react.useMemo)(()=>{let e=t;if(r.searchText){const t=r.searchText.toLowerCase();e=e.filter(e=>e.storeName.toLowerCase().includes(t)||e.partialPreview.toLowerCase().includes(t)||e.changedKeys.some(e=>e.toLowerCase().includes(t)))}return r.storeNames&&r.storeNames.length>0&&(e=e.filter(t=>r.storeNames.includes(t.storeName))),r.onlyWithChanges&&(e=e.filter(t=>t.hasStateChange)),e},[t,r]),c=(0,_react.useMemo)(()=>{const e=t.length,s=t.filter(t=>t.hasStateChange).length;return{totalChanges:e,changesWithStateChange:s,changesWithoutStateChange:e-s,storeCount:a.length,averageDuration:0}},[t,a]),d=(0,_react.useMemo)(()=>_zustandStateStore.zustandStateStore.getUniqueStoreNames(),[a]),l=(0,_react.useCallback)(()=>{_zustandStateStore.zustandStateStore.clearStateChanges()},[]),g=(0,_react.useCallback)(()=>{const t=!o;_zustandStateStore.zustandStateStore.setEnabled(t),u(t)},[o]),h=(0,_react.useCallback)(t=>_zustandStateStore.zustandStateStore.getStateChangeById(t),[]);return{stateChanges:t,filteredChanges:S,filter:r,setFilter:n,stats:c,stores:a,clearChanges:l,isEnabled:o,toggleCapture:g,storeNames:d,getChangeById:h}}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ZUSTAND_ICON_COLOR",{enumerable:!0,get:function(){return _ZustandIcon.ZUSTAND_ICON_COLOR}}),Object.defineProperty(exports,"ZustandActionButton",{enumerable:!0,get:function(){return _ZustandActionButton.ZustandActionButton}}),Object.defineProperty(exports,"ZustandDetailViewToggle",{enumerable:!0,get:function(){return _ZustandDetailViewToggle.ZustandDetailViewToggle}}),Object.defineProperty(exports,"ZustandIcon",{enumerable:!0,get:function(){return _ZustandIcon.ZustandIcon}}),Object.defineProperty(exports,"ZustandModal",{enumerable:!0,get:function(){return _ZustandModal.ZustandModal}}),Object.defineProperty(exports,"ZustandStateChangeItem",{enumerable:!0,get:function(){return _ZustandStateChangeItem.ZustandStateChangeItem}}),Object.defineProperty(exports,"ZustandStateDetailContent",{enumerable:!0,get:function(){return _ZustandStateDetailContent.ZustandStateDetailContent}}),Object.defineProperty(exports,"ZustandStateDetailFooter",{enumerable:!0,get:function(){return _ZustandStateDetailContent.ZustandStateDetailFooter}}),Object.defineProperty(exports,"ZustandStateInfoView",{enumerable:!0,get:function(){return _ZustandStateInfoView.ZustandStateInfoView}}),Object.defineProperty(exports,"buoyDevTools",{enumerable:!0,get:function(){return _buoyZustandMiddleware.buoyDevTools}}),Object.defineProperty(exports,"isStoreInstrumented",{enumerable:!0,get:function(){return _buoyZustandMiddleware.isStoreInstrumented}}),Object.defineProperty(exports,"useZustandStateChanges",{enumerable:!0,get:function(){return _useZustandStateChanges.useZustandStateChanges}}),Object.defineProperty(exports,"watchStores",{enumerable:!0,get:function(){return _buoyZustandMiddleware.watchStores}}),Object.defineProperty(exports,"zustandStateStore",{enumerable:!0,get:function(){return _zustandStateStore.zustandStateStore}});var _ZustandModal=require("./components/ZustandModal"),_ZustandIcon=require("./components/ZustandIcon"),_ZustandStateChangeItem=require("./components/ZustandStateChangeItem"),_ZustandStateDetailContent=require("./components/ZustandStateDetailContent"),_ZustandStateInfoView=require("./components/ZustandStateInfoView"),_ZustandDetailViewToggle=require("./components/ZustandDetailViewToggle"),_ZustandActionButton=require("./components/ZustandActionButton"),_zustandStateStore=require("./utils/zustandStateStore"),_buoyZustandMiddleware=require("./utils/buoyZustandMiddleware"),_useZustandStateChanges=require("./hooks/useZustandStateChanges");
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buoyDevTools=buoyDevTools,exports.isStoreInstrumented=isStoreInstrumented,exports.watchStores=watchStores;var _zustandStateStore=require("./zustandStateStore");const WATCHED_SYMBOL=Symbol.for("@@buoy-zustand/watched");function detectPersist(t){const e=t.persist;if(e&&"function"==typeof e.getOptions){const t=e.getOptions();return{isPersisted:!0,persistName:t?.name}}return{isPersisted:!1}}function watchStores(t){const e=[];for(const[s,r]of Object.entries(t)){const t=r;if(t[WATCHED_SYMBOL])continue;t[WATCHED_SYMBOL]=!0;const{isPersisted:n,persistName:a}=detectPersist(r);_zustandStateStore.zustandStateStore.registerStore(s,{getState:r.getState,getInitialState:r.getInitialState,setState:r.setState,subscribe:r.subscribe},{isPersisted:n,persistName:a});const o=r.subscribe((t,e)=>{try{_zustandStateStore.zustandStateStore.addStateChange({storeName:s,partial:void 0,replace:!1,prevState:e,nextState:t,duration:void 0,isPersisted:n})}catch{}});e.push(()=>{o(),delete r[WATCHED_SYMBOL],_zustandStateStore.zustandStateStore.unregisterStore(s)})}return()=>{e.forEach(t=>t())}}let unnamedCounter=0;function buoyDevTools(t,e){return(s,r,n)=>{const a=e?.name??"store-"+ ++unnamedCounter,o=!1!==e?.enabled,i=t((t,e)=>{if(!o)return s(t,e);const n=performance.now(),i=r();s(t,e);const S=r(),u=performance.now()-n,d="function"==typeof t?"(updater fn)":t;_zustandStateStore.zustandStateStore.addStateChange({storeName:a,partial:d,replace:e??!1,prevState:i,nextState:S,duration:u,isPersisted:!1})},r,n);return setTimeout(()=>{if(n[WATCHED_SYMBOL])return;n[WATCHED_SYMBOL]=!0;const{isPersisted:t,persistName:e}=detectPersist(n);_zustandStateStore.zustandStateStore.registerStore(a,{getState:r,getInitialState:n.getInitialState,setState:s,subscribe:n.subscribe},{isPersisted:t,persistName:e})},0),i}}function isStoreInstrumented(t){return!0===t[WATCHED_SYMBOL]}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"buoyDevTools",{enumerable:!0,get:function(){return _buoyZustandMiddleware.buoyDevTools}}),Object.defineProperty(exports,"isStoreInstrumented",{enumerable:!0,get:function(){return _buoyZustandMiddleware.isStoreInstrumented}}),Object.defineProperty(exports,"watchStores",{enumerable:!0,get:function(){return _buoyZustandMiddleware.watchStores}}),Object.defineProperty(exports,"zustandStateStore",{enumerable:!0,get:function(){return _zustandStateStore.zustandStateStore}});var _zustandStateStore=require("./zustandStateStore"),_buoyZustandMiddleware=require("./buoyZustandMiddleware");
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.zustandStateStore=void 0;const STORE_COLORS={counter:"#10B981",auth:"#8B5CF6",user:"#3B82F6",cart:"#EC4899",app:"#6366F1",ui:"#F59E0B",settings:"#14B8A6",theme:"#06B6D4",navigation:"#F97316",form:"#EF4444"};function getStoreColor(e){const t=e.toLowerCase();if(STORE_COLORS[t])return STORE_COLORS[t];for(const[e,s]of Object.entries(STORE_COLORS))if(t.includes(e))return s;const s=137*e.split("").reduce((e,t)=>e+t.charCodeAt(0),0)%360,r=.7*(1-Math.abs(1.2-1)),n=r*(1-Math.abs(s/60%2-1)),a=.6-r/2;let i=0,o=0,h=0;s<60?(i=r,o=n):s<120?(i=n,o=r):s<180?(o=r,h=n):s<240?(o=n,h=r):s<300?(i=n,h=r):(i=r,h=n);const g=e=>Math.round(255*(e+a)).toString(16).padStart(2,"0");return`#${g(i)}${g(o)}${g(h)}`}function formatPartialPreview(e,t=40){if(void 0===e)return"";if(null===e)return"null";try{if("function"==typeof e)return"(updater fn)";if("string"==typeof e)return e.length>t?`"${e.slice(0,t-3)}..."`:`"${e}"`;if("number"==typeof e||"boolean"==typeof e)return String(e);if(Array.isArray(e)){if(0===e.length)return"[]";const s=JSON.stringify(e);return s.length>t?`[${e.length} items]`:s}if("object"==typeof e){const s=Object.keys(e);if(0===s.length)return"{}";const r=JSON.stringify(e);return r.length<=t?r:`{ ${s.length} keys }`}return String(e).slice(0,t)}catch{return"[complex]"}}function getStateDiffSummary(e,t){if(e===t)return{summary:"no change",changedKeys:[],changedCount:0};if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return{summary:"changed",changedKeys:[],changedCount:1};const s=Object.keys(e),r=Object.keys(t),n=r.filter(e=>!s.includes(e)),a=s.filter(e=>!r.includes(e)),i=[];for(const n of s)r.includes(n)&&e[n]!==t[n]&&i.push(n);const o=[...n,...a,...i],h=[];n.length>0&&h.push(`+${n.length}`),a.length>0&&h.push(`-${a.length}`),i.length>0&&h.push(`~${i.length}`);const g=o.length;return 0===h.length?{summary:"nested change",changedKeys:[],changedCount:1}:{summary:`${h.join(" ")} ${1===g?"key":"keys"}`,changedKeys:o,changedCount:g}}class ZustandStateStore{stateChanges=[];stores=new Map;listeners=new Set;storeListeners=new Set;maxChanges=200;idCounter=0;isEnabled=!0;addStateChange(e){if(!this.isEnabled)return;const{storeName:t,partial:s,replace:r,prevState:n,nextState:a,duration:i,category:o,isPersisted:h=!1}=e,g=n!==a,{summary:u,changedKeys:l,changedCount:c}=getStateDiffSummary(n,a),d=formatPartialPreview(s),f=(i??0)>16,S=o??(r?"replace":"setState"),C={id:`${Date.now()}-${++this.idCounter}`,storeName:t,timestamp:Date.now(),prevState:n,nextState:a,partial:s,duration:i,hasStateChange:g,replace:r,category:S,changedKeys:l,changedKeysCount:c,diffSummary:u,partialPreview:d,isSlowUpdate:f,isPersisted:h};this.stateChanges=[C,...this.stateChanges].slice(0,this.maxChanges);const y=this.stores.get(t);y&&y.stateChangeCount++,this.notifyListeners()}getStateChanges(){return[...this.stateChanges]}getStateChangeById(e){return this.stateChanges.find(t=>t.id===e)}clearStateChanges(){this.stateChanges=[];for(const e of this.stores.values())e.stateChangeCount=0;this.notifyListeners()}registerStore(e,t,s){if(this.stores.has(e))return;const r={name:e,api:t,stateChangeCount:0,isPersisted:s?.isPersisted??!1,persistName:s?.persistName,color:getStoreColor(e)};this.stores.set(e,r),this.notifyStoreListeners()}unregisterStore(e){this.stores.delete(e),this.notifyStoreListeners()}getStores(){return Array.from(this.stores.values())}getStore(e){return this.stores.get(e)}getStoreColor(e){return this.stores.get(e)?.color??getStoreColor(e)}filterStateChanges(e){let t=[...this.stateChanges];if(e.searchText){const s=e.searchText.toLowerCase();t=t.filter(e=>e.storeName.toLowerCase().includes(s)||e.partialPreview.toLowerCase().includes(s)||e.changedKeys.some(e=>e.toLowerCase().includes(s)))}return e.storeNames&&e.storeNames.length>0&&(t=t.filter(t=>e.storeNames.includes(t.storeName))),e.onlyWithChanges&&(t=t.filter(e=>e.hasStateChange)),t}getStats(){const e=this.stateChanges.length,t=this.stateChanges.filter(e=>e.hasStateChange).length,s=this.stores.size,r=this.stateChanges.filter(e=>void 0!==e.duration).map(e=>e.duration),n=r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0;return{totalChanges:e,changesWithStateChange:t,changesWithoutStateChange:e-t,storeCount:s,averageDuration:Math.round(100*n)/100}}getUniqueStoreNames(){return Array.from(this.stores.keys()).sort()}setEnabled(e){this.isEnabled=e}getEnabled(){return this.isEnabled}setMaxChanges(e){this.maxChanges=e,this.stateChanges.length>e&&(this.stateChanges=this.stateChanges.slice(0,e),this.notifyListeners())}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}subscribeToStores(e){return this.storeListeners.add(e),()=>{this.storeListeners.delete(e)}}notifyListeners(){const e=this.getStateChanges();this.listeners.forEach(t=>t(e))}notifyStoreListeners(){const e=this.getStores();this.storeListeners.forEach(t=>t(e))}}const zustandStateStore=exports.zustandStateStore=new ZustandStateStore;
@@ -0,0 +1 @@
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";
@@ -0,0 +1 @@
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}}}
@@ -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={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}});
@@ -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:"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}});
@@ -0,0 +1 @@
1
+ "use strict";import{useState}from"react";import{View,Text,StyleSheet,TouchableOpacity,ScrollView}from"react-native";import{Filter,X,SectionHeader,AddFilterButton,AddFilterInput,macOSColors,buoyColors}from"@buoy-gg/shared-ui";import{zustandStateStore}from"../utils/zustandStateStore";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";function getStoreColorForPattern(e,o){const t=o.find(o=>o.name.toLowerCase()===e.toLowerCase());return t?zustandStateStore.getStoreColor(t.name):null}function isStoreFiltered(e,o){return Array.from(o).some(o=>e.name.toLowerCase().includes(o.toLowerCase()))}export function ZustandEventFilterView({ignoredPatterns:e,onTogglePattern:o,onAddPattern:t,stores:r}){const[s,n]=useState(!1),[l,i]=useState("");return _jsxs(ScrollView,{style:styles.container,contentContainerStyle:styles.scrollContent,showsVerticalScrollIndicator:!1,children:[r.length>0&&_jsxs(View,{style:styles.section,children:[_jsxs(SectionHeader,{children:[_jsx(SectionHeader.Title,{children:"REGISTERED STORES"}),_jsx(SectionHeader.Badge,{count:r.length,color:buoyColors.primary})]}),_jsx(ScrollView,{style:styles.storeList,contentContainerStyle:styles.storeListContent,showsVerticalScrollIndicator:!0,nestedScrollEnabled:!0,children:r.map(o=>{const r=zustandStateStore.getStoreColor(o.name),s=isStoreFiltered(o,e);return _jsxs(TouchableOpacity,{style:[styles.storeRow,s&&styles.storeRowFiltered],onPress:()=>t(o.name),disabled:s,children:[_jsx(View,{style:[styles.storeDot,{backgroundColor:s?macOSColors.text.disabled:r}]}),_jsx(Text,{style:[styles.storeRowText,s&&styles.storeRowTextFiltered,!s&&{color:r}],numberOfLines:1,children:o.name}),_jsx(Text,s?{style:styles.filteredLabel,children:"hidden"}:{style:[styles.addLabel,{color:r+"99"}],children:"+ hide"})]},o.name)})})]}),_jsxs(View,{style:styles.section,children:[_jsxs(SectionHeader,{children:[_jsx(SectionHeader.Icon,{icon:Filter,color:buoyColors.primary,size:12}),_jsx(SectionHeader.Title,{children:"STORE NAME FILTERS"}),e.size>0&&_jsx(SectionHeader.Badge,{count:e.size,color:buoyColors.primary})]}),_jsx(View,{style:styles.addInputWrapper,children:s?_jsx(AddFilterInput,{value:l,onChange:i,onSubmit:()=>{const e=l.trim();e&&(t(e),i(""),n(!1))},onCancel:()=>{n(!1),i("")},placeholder:"Enter store name pattern to hide...",color:buoyColors.primary}):_jsx(AddFilterButton,{onPress:()=>n(!0),color:buoyColors.primary,label:"Add store name pattern"})}),e.size>0&&_jsx(View,{style:styles.patternList,children:Array.from(e).map(e=>{const t=getStoreColorForPattern(e,r);return _jsxs(TouchableOpacity,{style:styles.patternRow,onPress:()=>o(e),activeOpacity:.8,children:[t?_jsx(View,{style:[styles.storeDot,{backgroundColor:t}]}):null,_jsx(Text,{style:[styles.patternText,t?{color:t}:null],numberOfLines:1,children:e}),_jsx(X,{size:12,color:buoyColors.primary+"80"})]},e)})})]}),_jsxs(View,{style:styles.section,children:[_jsxs(SectionHeader,{children:[_jsx(SectionHeader.Icon,{icon:Filter,color:buoyColors.textSecondary,size:12}),_jsx(SectionHeader.Title,{children:"HOW EVENT FILTERS WORK"})]}),_jsx(Text,{style:styles.howItWorksText,children:"Patterns hide matching stores from both the Stores tab and the Events tab. Tap a store above to quickly add it as a filter."}),_jsxs(View,{style:styles.examplesContainer,children:[_jsx(Text,{style:styles.examplesTitle,children:"EXAMPLES:"}),["• auth → hides authStore from stores & events","• temp → hides tempStore, tempUserStore","• cart → hides cartStore from both tabs"].map(e=>_jsx(Text,{style:styles.exampleItem,children:e},e))]})]})]})}const styles=StyleSheet.create({container:{flex:1,backgroundColor:buoyColors.base},scrollContent:{paddingTop:16,paddingHorizontal:16,paddingBottom:24,gap:16},section:{backgroundColor:buoyColors.card,borderRadius:16,borderWidth:1,borderColor:buoyColors.border,overflow:"hidden"},storeList:{maxHeight:180},storeListContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:16,gap:10},storeRow:{flexDirection:"row",alignItems:"center",gap:10,paddingVertical:10,paddingHorizontal:12,backgroundColor:buoyColors.hover,borderRadius:8,borderWidth:1,borderColor:buoyColors.border},storeRowFiltered:{opacity:.45},storeDot:{width:7,height:7,borderRadius:3.5},storeRowText:{flex:1,fontSize:12,fontWeight:"600",fontFamily:"monospace"},storeRowTextFiltered:{color:macOSColors.text.muted,textDecorationLine:"line-through"},filteredLabel:{fontSize:10,fontWeight:"500",color:macOSColors.text.disabled,fontFamily:"monospace"},addLabel:{fontSize:10,fontWeight:"600",fontFamily:"monospace"},addInputWrapper:{paddingHorizontal:16,paddingTop:8,paddingBottom:8},patternList:{paddingHorizontal:16,paddingBottom:16,gap:8},patternRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,paddingHorizontal:12,backgroundColor:buoyColors.hover,borderRadius:8,borderWidth:1,borderColor:buoyColors.border,gap:8},patternText:{flex:1,fontSize:12,fontFamily:"monospace",color:buoyColors.text},howItWorksText:{fontSize:11,color:buoyColors.textSecondary,lineHeight:16,marginTop:8,paddingHorizontal:16,fontFamily:"monospace"},examplesContainer:{paddingTop:8,paddingHorizontal:16,paddingBottom:16,borderTopWidth:1,borderTopColor:buoyColors.border,marginTop:12},examplesTitle:{fontSize:10,fontWeight:"600",color:buoyColors.textMuted,fontFamily:"monospace",letterSpacing:.5,marginBottom:6},exampleItem:{fontSize:10,color:buoyColors.textMuted,fontFamily:"monospace",lineHeight:16}});
@@ -0,0 +1 @@
1
+ "use strict";import{View}from"react-native";import{Text}from"react-native";import{jsx as _jsx}from"react/jsx-runtime";const ZUSTAND_ICON_COLOR="#463B3F";export function ZustandIcon({size:t,color:e}){return _jsx(View,{style:{width:t,height:t,justifyContent:"center",alignItems:"center"},children:_jsx(Text,{style:{fontSize:.75*t,color:e||"#463B3F",fontWeight:"700"},children:"Z"})})}export{ZUSTAND_ICON_COLOR};
@@ -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,TabSelector,macOSColors,buoyColors,Search,Filter,Power,X,Lock,Box,devToolsStorageKeys,ProUpgradeModal,PowerToggleButton,ToolbarCopyButton,ToolbarClearButton,truncatePayload}from"@buoy-gg/shared-ui";import{useIsPro}from"@buoy-gg/license";import{useZustandStateChanges}from"../hooks/useZustandStateChanges";import{ZustandStateChangeItem}from"./ZustandStateChangeItem";import{ZustandStateDetailContent,ZustandStateDetailFooter}from"./ZustandStateDetailContent";import{ZustandStoreBrowser}from"./ZustandStoreBrowser";import{ZustandEventFilterView}from"./ZustandEventFilterView";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const FREE_TIER_CHANGE_LIMIT=25;function EventsEmptyState({isEnabled:e}){return _jsxs(View,{style:styles.emptyState,children:[_jsx(Box,{size:32,color:macOSColors.text.muted}),_jsx(Text,{style:styles.emptyTitle,children:"No state changes"}),_jsx(Text,{style:styles.emptyText,children:e?"State changes will appear here as stores update.":"Enable capture to start recording state changes"})]})}export function ZustandModal({visible:e,onClose:t,onBack:a,onMinimize:o,enableSharedModalDimensions:s=!1}){const r=useIsPro(),[n,l]=useState(!1),[i,d]=useState("stores"),[c,u]=useState(null),[h,m]=useState(!1),[g,y]=useState(new Set),{filteredChanges:x,filter:S,setFilter:C,stats:b,stores:p,clearChanges:_,isEnabled:f,toggleCapture:j}=useZustandStateChanges(),T=useMemo(()=>0===g.size?x:x.filter(e=>!Array.from(g).some(t=>e.storeName.toLowerCase().includes(t.toLowerCase()))),[x,g]),k=useMemo(()=>0===g.size?p:p.filter(e=>!Array.from(g).some(t=>e.name.toLowerCase().includes(t.toLowerCase()))),[p,g]),B=useMemo(()=>r?T:T.slice(0,25),[T,r]),w=useMemo(()=>r?0:Math.max(0,T.length-25),[T.length,r]),v=w>0,M=useMemo(()=>c?B.filter(e=>e.storeName===c):B,[B,c]),[O,P]=useState(null),z=useMemo(()=>{if(null===O)return null;const e=M.findIndex(e=>e.id===O);return e>=0?e:null},[O,M]),I=null!==z?M[z]:null,[E,H]=useState(""),[A,F]=useState(!1),Z=useRef(null),N=useRef(null),V=useCallback(e=>{},[]),R=e=>{H(e),"events"===i&&C(t=>({...t,searchText:e}))},L=useCallback(e=>{P(e.id)},[]),D=useCallback(()=>{l(!0)},[]),K=useCallback(()=>{P(null)},[]),W=useCallback(e=>{const t=M[e];t&&P(t.id)},[M]),$=useCallback(e=>{u(e),P(null)},[]),G=useCallback(()=>{u(null),P(null)},[]),U=useCallback(()=>k.reduce((e,t)=>{try{const a=t.api.getState();if(a&&"object"==typeof a){const o={};for(const[e,t]of Object.entries(a))"function"!=typeof t&&(o[e]=truncatePayload(t));e[t.name]=o}else e[t.name]=truncatePayload(a)}catch{e[t.name]=null}return e},{}),[k]),J=useCallback(()=>T.map(e=>({id:e.id,storeName:e.storeName,timestamp:e.timestamp,prevState:truncatePayload(e.prevState),nextState:truncatePayload(e.nextState),hasStateChange:e.hasStateChange,changedKeys:e.changedKeys})),[T]),Q=useCallback(()=>M.map(e=>({id:e.id,storeName:e.storeName,timestamp:e.timestamp,prevState:truncatePayload(e.prevState),nextState:truncatePayload(e.nextState),hasStateChange:e.hasStateChange,changedKeys:e.changedKeys})),[M]),q=useCallback(e=>{y(t=>{const a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),Y=useCallback(e=>{y(t=>new Set([...t,e]))},[]),ee=useCallback(e=>{d(e),u(null),P(null),m(!1),E&&(H(""),C(e=>({...e,searchText:""}))),F(!1)},[E,C]),te=useCallback(e=>e.id,[]),ae=useCallback(({item:e})=>_jsx(ZustandStateChangeItem,{change:e,onPress:L}),[L]),oe=g.size>0,se=s?devToolsStorageKeys.modal.root():"buoy-zustand-modal";if(!e)return null;const re=I&&null!==z?_jsx(ZustandStateDetailFooter,{change:I,changes:M,selectedIndex:z,onIndexChange:W}):null,ne=I&&M.length>1?68:0;return _jsxs(_Fragment,{children:[_jsx(JsModal,{visible:e,onClose:t,onMinimize:o,persistenceKey:se,header:{showToggleButton:!0,customContent:_jsxs(ModalHeader,h?{children:[_jsx(ModalHeader.Navigation,{onBack:()=>m(!1)}),_jsx(ModalHeader.Content,{title:"Filters",centered:!0})]}:I?{children:[_jsx(ModalHeader.Navigation,{onBack:K}),_jsx(ModalHeader.Content,{title:`${I.storeName}/setState`,centered:!0})]}:c?{children:[_jsx(ModalHeader.Navigation,{onBack:G}),_jsx(ModalHeader.Content,{title:`${c} History`,centered:!0}),_jsx(ModalHeader.Actions,{children:_jsx(ToolbarCopyButton,{value:Q,disabled:0===M.length,buttonStyle:styles.headerActionButton})})]}:{children:[a&&_jsx(ModalHeader.Navigation,{onBack:a}),_jsx(ModalHeader.Content,{title:"",children:A?_jsxs(View,{style:styles.headerSearchContainer,children:[_jsx(Search,{size:14,color:macOSColors.text.secondary}),_jsx(TextInput,{ref:Z,style:styles.headerSearchInput,placeholder:"stores"===i?"Search stores...":"Search events...",placeholderTextColor:macOSColors.text.muted,value:E,onChangeText:R,onSubmitEditing:()=>F(!1),onBlur:()=>F(!1),autoCapitalize:"none",autoCorrect:!1,returnKeyType:"search"}),E.length>0&&_jsx(TouchableOpacity,{onPress:()=>{R(""),F(!1)},style:styles.headerSearchClear,children:_jsx(X,{size:14,color:macOSColors.text.secondary})})]}):_jsx(TabSelector,{tabs:[{key:"stores",label:"Stores"+(k.length>0?` (${k.length})`:"")},{key:"events",label:"Events"+(T.length>0?` (${T.length})`:"")}],activeTab:i,onTabChange:ee})}),_jsxs(ModalHeader.Actions,{children:[_jsx(TouchableOpacity,{onPress:()=>F(!0),style:styles.headerActionButton,children:_jsx(Search,{size:14,color:macOSColors.text.secondary})}),_jsx(TouchableOpacity,{onPress:()=>m(!0),style:[styles.headerActionButton,oe&&styles.headerActionButtonActive],children:_jsx(Filter,{size:14,color:oe?macOSColors.semantic.debug:macOSColors.text.secondary})}),"stores"===i&&_jsx(ToolbarCopyButton,{value:U,disabled:0===k.length,buttonStyle:styles.headerActionButton}),"events"===i&&_jsxs(_Fragment,{children:[_jsx(ToolbarCopyButton,{value:J,disabled:0===T.length,buttonStyle:styles.headerActionButton}),_jsx(PowerToggleButton,{isEnabled:f,onToggle:j,accessibilityLabel:"Toggle Zustand state capture"}),_jsx(ToolbarClearButton,{onPress:_,disabled:0===T.length,buttonStyle:styles.headerActionButton})]})]})]})},onModeChange:V,enablePersistence:!0,initialMode:"bottomSheet",enableGlitchEffects:!0,styles:{},footer:re,footerHeight:ne,children:_jsx(View,{style:styles.container,children:h?_jsx(ZustandEventFilterView,{ignoredPatterns:g,onTogglePattern:q,onAddPattern:Y,stores:p}):I&&null!==z?_jsx(ZustandStateDetailContent,{change:I,changes:M,selectedIndex:z,onIndexChange:W,disableInternalFooter:!0}):c?M.length>0?_jsx(FlatList,{data:M,renderItem:ae,keyExtractor:te,contentContainerStyle:styles.listContent,showsVerticalScrollIndicator:!0,removeClippedSubviews:!0,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:!1}):_jsxs(View,{style:styles.emptyState,children:[_jsx(Box,{size:32,color:macOSColors.text.muted}),_jsx(Text,{style:styles.emptyTitle,children:"No history yet"}),_jsxs(Text,{style:styles.emptyText,children:["State changes for ",c," will appear here."]})]}):"stores"===i?_jsx(ZustandStoreBrowser,{stores:k,searchQuery:E,onViewHistory:$}):_jsxs(_Fragment,{children:[!f&&_jsxs(View,{style:styles.disabledBanner,children:[_jsx(Power,{size:14,color:macOSColors.semantic.warning}),_jsx(Text,{style:styles.disabledText,children:"State capture is disabled"})]}),v&&_jsxs(TouchableOpacity,{style:styles.lockedBanner,onPress:D,activeOpacity:.8,children:[_jsx(Lock,{size:14,color:buoyColors.primary}),_jsxs(Text,{style:styles.lockedText,children:[w," older"," ",1===w?"change":"changes"," locked"]}),_jsx(View,{style:styles.upgradeBadge,children:_jsx(Text,{style:styles.upgradeBadgeText,children:"UPGRADE"})})]}),B.length>0?_jsx(FlatList,{ref:N,data:B,renderItem:ae,keyExtractor:te,contentContainerStyle:styles.listContent,showsVerticalScrollIndicator:!0,removeClippedSubviews:!0,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:!1}):_jsx(EventsEmptyState,{isEnabled:f})]})})}),_jsx(ProUpgradeModal,{visible:n,onClose:()=>l(!1),featureName:"Full State 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},headerActionButton:{width:32,height:32,borderRadius:8,backgroundColor:macOSColors.background.hover,borderWidth:1,borderColor:macOSColors.border.default,alignItems:"center",justifyContent:"center"},headerActionButtonDisabled:{opacity:.55},headerActionButtonActive:{backgroundColor:macOSColors.semantic.infoBackground},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",lineHeight:18},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";import{View,Text,StyleSheet}from"react-native";import{CompactRow,buoyColors,Zap,Clock}from"@buoy-gg/shared-ui";import{zustandStateStore}from"../utils/zustandStateStore";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";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,t){switch(e){case"replace":return"Replace";case"persist":return"Hydrate";case"initial":return"Initial";default:return t.charAt(0).toUpperCase()+t.slice(1)}}function getCategoryColor(e,t){switch(e){case"replace":return buoyColors.warning;case"persist":return buoyColors.info;case"initial":return buoyColors.textMuted;default:return zustandStateStore.getStoreColor(t)}}function getSublabel(e){const t=[];return void 0!==e.duration&&e.duration>=.1&&t.push(`${e.duration.toFixed(1)}ms`),e.hasStateChange?e.changedKeysCount>0?t.push(`${e.changedKeysCount} key${e.changedKeysCount>1?"s":""} changed`):t.push(e.diffSummary||"state changed"):t.push("no state change"),t.join(" · ")}function getBadgeText(e){return"replace"===e.category?"REPLACE":"persist"===e.category?"HYDRATE":"initial"===e.category?"INIT":"SET"}function getPrimaryText(e){return e.changedKeys.length>0&&e.changedKeys.length<=3?e.changedKeys.join(", "):e.changedKeys.length>3?`${e.changedKeys.slice(0,2).join(", ")} +${e.changedKeys.length-2}`:e.partialPreview||"setState()"}export function ZustandStateChangeItem({change:e,onPress:t}){const a=getCategoryColor(e.category,e.storeName),o=getStatusLabel(e.category,e.storeName),s=getSublabel(e),r=getPrimaryText(e),n=getBadgeText(e);let i;return e.isSlowUpdate?i=_jsxs(View,{style:styles.badgeContainer,children:[_jsx(Text,{style:[styles.badgeText,{color:a}],children:n}),_jsx(View,{style:styles.slowBadge,children:_jsx(Clock,{size:12,color:buoyColors.error})})]}):e.hasStateChange&&(i=_jsxs(View,{style:styles.badgeContainer,children:[_jsx(Text,{style:[styles.badgeText,{color:a}],children:n}),_jsx(View,{style:styles.changeBadge,children:_jsx(Zap,{size:12,color:buoyColors.warning})})]})),_jsx(CompactRow,{statusDotColor:a,statusLabel:o,statusSublabel:s,primaryText:r,bottomRightText:formatRelativeTime(e.timestamp),customBadge:i,badgeText:i?void 0:n,badgeColor:a,showChevron:!0,onPress:()=>t(e)})}const styles=StyleSheet.create({badgeContainer:{flexDirection:"row",alignItems:"center",gap:4},badgeText:{fontSize:11,fontWeight:"600",fontFamily:"monospace"},changeBadge:{paddingHorizontal:4},slowBadge:{paddingHorizontal:4}});
@@ -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{ZustandDetailViewToggle}from"./ZustandDetailViewToggle";import{ZustandStateInfoView}from"./ZustandStateInfoView";import{DiffModeTabs,CompareBar}from"@buoy-gg/shared-ui";import{zustandStateStore}from"../utils/zustandStateStore";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";function getChangeColor(e){return zustandStateStore.getStoreColor(e.storeName)}function getChangeLabel(e){switch(e.category){case"replace":return"REPLACE";case"persist":return"HYDRATE";case"initial":return"INIT";default:return"SET"}}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 ZustandStateDetailContent({change:e,changes:t,selectedIndex:a,onIndexChange:o,disableInternalFooter:n=!1}){const[r,l]=useState("change"),[i,s]=useState("tree"),d=t.length,c=getChangeColor(e),m=getChangeLabel(e),u=getValueType(e.nextState),g=d-a,f=g-1,x=a<d-1?a+1:null,h=null!==x?t[x]:null,p=useMemo(()=>({index:x??0,label:f>0?`#${f}`:"Initial",timestamp:h?formatTimestamp(h.timestamp):"",relativeTime:h?formatRelativeTime(new Date(h.timestamp)):"state",badge:h?_jsx(View,{style:[styles.changeBadgeSmall,{backgroundColor:`${getChangeColor(h)}20`}],children:_jsx(Text,{style:[styles.changeTextSmall,{color:getChangeColor(h)}],children:getChangeLabel(h)})}):void 0}),[x,h,f]),y=useMemo(()=>({index:a,label:`#${g}`,timestamp:formatTimestamp(e.timestamp),relativeTime:formatRelativeTime(new Date(e.timestamp)),badge:_jsx(View,{style:[styles.changeBadgeSmall,{backgroundColor:`${c}20`}],children:_jsx(Text,{style:[styles.changeTextSmall,{color:c}],children:m})})}),[a,e.timestamp,c,m,g]),S=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 CHANGE"}),_jsxs(View,{style:styles.valueHeaderBadges,children:[_jsx(View,{style:[styles.changeBadge,{backgroundColor:`${c}20`}],children:_jsx(Text,{style:[styles.changeText,{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]),b=useCallback(()=>{const t=parseValue(e.prevState),a=parseValue(e.nextState);return"split"===i?_jsx(ScrollView,{style:{flex:1},showsVerticalScrollIndicator:!0,children:_jsx(SplitDiffViewer,{oldValue:t,newValue:a,theme:diffThemes.devToolsDefault,options:{hideLineNumbers:!1,disableWordDiff:!1,showDiffOnly:!1,compareMethod:"words",contextLines:3},showThemeName:!1})}):_jsx(TreeDiffViewer,{oldValue:t,newValue:a})},[e.prevState,e.nextState,i]),C=useCallback(()=>{o(Math.min(d-1,a+1))},[a,d,o]),T=useCallback(()=>{o(Math.max(0,a-1))},[a,o]),w=d<=1;return _jsxs(View,{style:styles.container,children:[_jsx(ZustandDetailViewToggle,{activeView:r,onViewChange:l,diffDisabled:w}),_jsxs(View,{style:styles.contentArea,children:["change"===r&&_jsx(ZustandStateInfoView,{change:e}),"state"===r&&_jsx(View,{style:styles.stateContainer,children:S()}),"diff"===r&&_jsxs(View,{style:styles.diffContainer,children:[_jsx(DiffModeTabs,{tabs:DIFF_MODE_TABS,activeTab:i,onTabChange:s}),_jsx(CompareBar,{leftEvent:p,rightEvent:y}),_jsx(View,{style:styles.diffContent,children:b()})]})]}),!n&&d>1&&_jsx(EventStepperFooter,{currentIndex:g-1,totalItems:d,onPrevious:C,onNext:T,itemLabel:"Change",subtitle:formatRelativeTime(new Date(e.timestamp)),absolute:!0})]})}export function ZustandStateDetailFooter({change:e,changes:t,selectedIndex:a,onIndexChange:o}){const n=t.length;return n<=1?null:_jsx(EventStepperFooter,{currentIndex:n-a-1,totalItems:n,onPrevious:()=>o(Math.min(n-1,a+1)),onNext:()=>o(Math.max(0,a-1)),itemLabel:"Change",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},changeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4},changeText:{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},changeBadgeSmall:{paddingHorizontal:6,paddingVertical:1,borderRadius:3},changeTextSmall:{fontSize:8,fontWeight:"700",fontFamily:"monospace"}});
@@ -0,0 +1 @@
1
+ "use strict";import React,{memo,useCallback,useState,useEffect}from"react";import{View,Text,StyleSheet,ScrollView}from"react-native";import{buoyColors,Clock,AlertTriangle,Zap,Info,Box,Database,parseValue,ProUpgradeModal,copyToClipboard}from"@buoy-gg/shared-ui";import{useIsPro}from"@buoy-gg/license";import{DataViewer}from"@buoy-gg/shared-ui/dataViewer";import{ZustandActionButton}from"./ZustandActionButton";import{zustandStateStore}from"../utils/zustandStateStore";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";function getCategoryInfo(e){switch(e){case"replace":return{label:"REPLACE",color:buoyColors.warning,bgColor:buoyColors.warning+"26"};case"persist":return{label:"PERSIST",color:buoyColors.info,bgColor:buoyColors.info+"26"};case"initial":return{label:"INITIAL",color:buoyColors.textMuted,bgColor:buoyColors.textMuted+"26"};default:return{label:"SET STATE",color:buoyColors.success,bgColor:buoyColors.success+"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 _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:t})]}),o]})}function InfoRow({label:e,value:t,valueColor:o,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,o?{color:o}:void 0],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")}`}export const ZustandStateInfoView=memo(function({change:e}){const t=useIsPro(),[o,r]=useState(!1);useEffect(()=>{o&&t&&r(!1)},[o,t]);const s=getCategoryInfo(e.category),a=void 0!==e.partial&&"(updater fn)"!==e.partial,i=e.changedKeys.length>0,n=zustandStateStore.getStoreColor(e.storeName),l=useCallback(async()=>{t?await copyToClipboard(e.nextState):r(!0)},[e.nextState,t]),d=useCallback(()=>{const t=zustandStateStore.getStore(e.storeName);if(t?.api.getInitialState){const e=t.api.getInitialState();t.api.setState(e,!0)}},[e.storeName]),c=useCallback(()=>{const t=zustandStateStore.getStore(e.storeName);t&&t.api.setState(e.nextState,!0)},[e.storeName,e.nextState]);return _jsxs(ScrollView,{style:styles.container,contentContainerStyle:styles.contentContainer,showsVerticalScrollIndicator:!1,children:[_jsxs(View,{style:styles.card,children:[_jsx(SectionHeader,{icon:Info,title:"CHANGE INFO"}),_jsxs(View,{style:styles.cardContent,children:[_jsx(InfoRow,{label:"Store",value:e.storeName,mono:!0,valueColor:n}),_jsx(InfoRow,{label:"Time",value:formatTime(e.timestamp),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.isSlowUpdate&&styles.durationBadgeSlow],children:[_jsx(Clock,{size:10,color:e.isSlowUpdate?buoyColors.error:buoyColors.textSecondary}),_jsx(Text,{style:[styles.durationText,e.isSlowUpdate&&styles.durationTextSlow],children:formatDuration(e.duration)}),e.isSlowUpdate&&_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"})}),e.isPersisted&&_jsxs(View,{style:styles.persistBadge,children:[_jsx(Database,{size:10,color:buoyColors.info}),_jsx(Text,{style:styles.persistText,children:"PERSISTED"})]})]})]})]}),i&&_jsxs(View,{style:styles.card,children:[_jsx(SectionHeader,{icon:Zap,title:"CHANGED KEYS",badge:_jsx(View,{style:styles.countBadge,children:_jsx(Text,{style:styles.countText,children:e.changedKeys.length})})}),_jsx(View,{style:styles.cardContent,children:_jsx(View,{style:styles.keysContainer,children:e.changedKeys.map(e=>_jsx(View,{style:styles.keyBadge,children:_jsx(Text,{style:styles.keyText,children:e})},e))})})]}),a&&_jsxs(View,{style:styles.card,children:[_jsx(SectionHeader,{icon:Box,title:"PARTIAL (setState argument)",badge:_jsx(View,{style:styles.typeBadge,children:_jsx(Text,{style:styles.typeText,children:Array.isArray(e.partial)?"ARRAY":"object"==typeof e.partial?"OBJECT":String(typeof e.partial).toUpperCase()})})}),_jsx(View,{style:styles.dataViewerContainer,children:_jsx(DataViewer,{title:"",data:parseValue(e.partial),showTypeFilter:!1})})]}),"(updater fn)"===e.partial&&_jsxs(View,{style:styles.card,children:[_jsx(SectionHeader,{icon:Box,title:"SET STATE CALL"}),_jsxs(View,{style:styles.cardContent,children:[_jsx(Text,{style:styles.updaterText,children:"Called with an updater function: set((state) => ...)"}),_jsx(Text,{style:styles.updaterSubtext,children:"The partial value is computed at runtime from the previous state. See the DIFF tab to view the resulting changes."})]})]}),_jsxs(View,{style:styles.actionsGrid,children:[_jsx(ZustandActionButton,{type:"jump",text:"JUMP",onPress:c}),_jsx(ZustandActionButton,{type:"reset",text:"RESET STORE",onPress:d}),_jsx(ZustandActionButton,{type:"copy",text:"COPY STATE",onPress:l})]}),_jsx(ProUpgradeModal,{visible:o,onClose:()=>r(!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},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},persistBadge:{flexDirection:"row",alignItems:"center",gap:4,paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:buoyColors.info+"26"},persistText:{fontSize:9,fontWeight:"700",color:buoyColors.info,letterSpacing:.3},keysContainer:{flexDirection:"row",flexWrap:"wrap",gap:6},keyBadge:{paddingHorizontal:8,paddingVertical:4,borderRadius:4,backgroundColor:buoyColors.primary+"20",borderWidth:1,borderColor:buoyColors.primary+"40"},keyText:{fontSize:11,fontWeight:"600",color:buoyColors.primary,fontFamily:"monospace"},countBadge:{paddingHorizontal:8,paddingVertical:3,borderRadius:4,backgroundColor:buoyColors.primary+"26"},countText:{fontSize:9,fontWeight:"700",color:buoyColors.primary,fontFamily:"monospace"},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},updaterText:{fontSize:12,color:buoyColors.text,fontFamily:"monospace"},updaterSubtext:{fontSize:11,color:buoyColors.textMuted,lineHeight:16,marginTop:4},actionsGrid:{flexDirection:"row",flexWrap:"wrap",gap:12,justifyContent:"flex-start"}});
@@ -0,0 +1 @@
1
+ "use strict";import{useState,useMemo,useCallback}from"react";import{View,Text,StyleSheet,ScrollView,TouchableOpacity}from"react-native";import{CompactRow,macOSColors,buoyColors,Database,parseValue,Box,ExpandedInfoRow,PillBadge}from"@buoy-gg/shared-ui";import{DataViewer}from"@buoy-gg/shared-ui/dataViewer";import{zustandStateStore}from"../utils/zustandStateStore";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";function getKeysPreview(e){try{const t=e.api.getState();if(t&&"object"==typeof t){const e=Object.keys(t).filter(e=>"function"!=typeof t[e]);return 0===e.length?"no data keys":e.length<=3?e.join(", "):`${e.slice(0,2).join(", ")} +${e.length-2}`}return""}catch{return""}}function StoreExpandedContent({store:e,onViewHistory:t}){const o=e.api.getState(),s=useMemo(()=>{if(o&&"object"==typeof o){const e={};for(const[t,s]of Object.entries(o))"function"!=typeof s&&(e[t]=s);return parseValue(e)}return parseValue(o)},[o]);return _jsxs(View,{style:expandedStyles.container,children:[_jsx(ExpandedInfoRow,{label:"Type",children:_jsx(PillBadge,{color:e.color,children:"ZUSTAND"})}),e.stateChangeCount>0&&_jsxs(ExpandedInfoRow,{label:"Changes",children:[_jsx(PillBadge,{color:buoyColors.warning,children:String(e.stateChangeCount)}),_jsx(TouchableOpacity,{onPress:()=>t(e.name),style:expandedStyles.viewHistoryButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:_jsx(Text,{style:[expandedStyles.viewHistoryText,{color:e.color}],children:"view history →"})})]}),e.isPersisted&&_jsx(ExpandedInfoRow,{label:"Persist",children:_jsx(PillBadge,{color:buoyColors.info,icon:_jsx(Database,{size:9,color:buoyColors.info}),children:e.persistName||"persisted"})}),_jsx(View,{style:expandedStyles.dataContainer,children:s&&"object"==typeof s?_jsx(DataViewer,{title:"",data:s,showTypeFilter:!0}):_jsx(Text,{style:expandedStyles.emptyText,children:"Empty state"})})]})}function EmptyBrowserState(){return _jsxs(View,{style:styles.emptyState,children:[_jsx(Box,{size:32,color:macOSColors.text.muted}),_jsx(Text,{style:styles.emptyTitle,children:"No stores registered"}),_jsx(Text,{style:styles.emptyText,children:"Use watchStores() to register your Zustand stores.\nThey will appear here with their current state."})]})}export function ZustandStoreBrowser({stores:e,searchQuery:t,onViewHistory:o}){const[s,r]=useState(null),n=useMemo(()=>{if(!t)return e;const o=t.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(o)||e.persistName&&e.persistName.toLowerCase().includes(o))},[e,t]),i=useCallback(e=>{r(t=>t===e.name?null:e.name)},[]);return 0!==n.length||t?0===n.length&&t?_jsxs(View,{style:styles.emptyState,children:[_jsx(Text,{style:styles.emptyTitle,children:"No matching stores"}),_jsxs(Text,{style:styles.emptyText,children:['No stores match "',t,'"']})]}):_jsxs(ScrollView,{style:styles.container,contentContainerStyle:styles.scrollContent,showsVerticalScrollIndicator:!0,children:[_jsxs(View,{style:styles.sectionHeader,children:[_jsx(Text,{style:styles.sectionTitle,children:"STORES"}),_jsx(View,{style:styles.sectionCountBadge,children:_jsx(Text,{style:styles.sectionCountText,children:n.length})})]}),n.map(e=>{const t=s===e.name,r=getKeysPreview(e),n=zustandStateStore.getStoreColor(e.name);return _jsxs(View,{style:styles.storeRowWrapper,children:[_jsx(CompactRow,{statusDotColor:n,statusLabel:e.name,statusSublabel:e.isPersisted?"persisted":"in-memory",primaryText:r,showChevron:!0,isExpanded:t,onPress:()=>i(e),expandedContent:t?_jsx(StoreExpandedContent,{store:e,onViewHistory:o}):void 0}),e.stateChangeCount>0&&_jsx(View,{style:[styles.absCountBadge,{backgroundColor:n+"22",borderColor:n+"55"}],pointerEvents:"none",children:_jsx(Text,{style:[styles.absCountText,{color:n}],children:String(e.stateChangeCount)})})]},e.name)})]}):_jsx(EmptyBrowserState,{})}const styles=StyleSheet.create({container:{flex:1},storeRowWrapper:{position:"relative"},absCountBadge:{position:"absolute",top:4,right:10,paddingHorizontal:5,paddingVertical:1,borderRadius:4,borderWidth:1,zIndex:1},absCountText:{fontSize:9,fontWeight:"700",fontFamily:"monospace"},scrollContent:{paddingTop:8,paddingBottom:20},sectionHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:8,gap:8},sectionTitle:{fontSize:11,fontWeight:"700",letterSpacing:.5,color:macOSColors.text.muted},sectionCountBadge:{backgroundColor:buoyColors.primary+"26",paddingHorizontal:8,paddingVertical:2,borderRadius:4},sectionCountText:{fontSize:10,fontWeight:"700",color:buoyColors.primary,fontFamily:"monospace"},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",lineHeight:18}}),expandedStyles=StyleSheet.create({container:{gap:10},viewHistoryButton:{marginLeft:4},viewHistoryText:{fontSize:10,fontWeight:"600",fontFamily:"monospace"},dataContainer:{backgroundColor:buoyColors.base,borderRadius:6,borderWidth:1,borderColor:buoyColors.border,overflow:"hidden",minHeight:60},emptyText:{color:buoyColors.textMuted,fontSize:12,padding:14,fontStyle:"italic"}});
@@ -0,0 +1 @@
1
+ "use strict";export{ZustandModal}from"./ZustandModal";export{ZustandIcon,ZUSTAND_ICON_COLOR}from"./ZustandIcon";export{ZustandStateChangeItem}from"./ZustandStateChangeItem";export{ZustandStateDetailContent,ZustandStateDetailFooter}from"./ZustandStateDetailContent";export{ZustandStateInfoView}from"./ZustandStateInfoView";export{ZustandDetailViewToggle}from"./ZustandDetailViewToggle";export{ZustandActionButton}from"./ZustandActionButton";export{ZustandStoreBrowser}from"./ZustandStoreBrowser";
@@ -0,0 +1 @@
1
+ "use strict";export{useZustandStateChanges}from"./useZustandStateChanges";
@@ -0,0 +1 @@
1
+ "use strict";import{useState,useEffect,useMemo,useCallback}from"react";import{zustandStateStore}from"../utils/zustandStateStore";export function useZustandStateChanges(){const[e,t]=useState(()=>zustandStateStore.getStateChanges()),[a,s]=useState(()=>zustandStateStore.getStores()),[r,n]=useState({}),[o,u]=useState(()=>zustandStateStore.getEnabled());useEffect(()=>{const e=zustandStateStore.subscribe(e=>{t(e)}),a=zustandStateStore.subscribeToStores(e=>{s(e)});return()=>{e(),a()}},[]);const S=useMemo(()=>{let t=e;if(r.searchText){const e=r.searchText.toLowerCase();t=t.filter(t=>t.storeName.toLowerCase().includes(e)||t.partialPreview.toLowerCase().includes(e)||t.changedKeys.some(t=>t.toLowerCase().includes(e)))}return r.storeNames&&r.storeNames.length>0&&(t=t.filter(e=>r.storeNames.includes(e.storeName))),r.onlyWithChanges&&(t=t.filter(e=>e.hasStateChange)),t},[e,r]),l=useMemo(()=>{const t=e.length,s=e.filter(e=>e.hasStateChange).length;return{totalChanges:t,changesWithStateChange:s,changesWithoutStateChange:t-s,storeCount:a.length,averageDuration:0}},[e,a]),g=useMemo(()=>zustandStateStore.getUniqueStoreNames(),[a]),c=useCallback(()=>{zustandStateStore.clearStateChanges()},[]),h=useCallback(()=>{const e=!o;zustandStateStore.setEnabled(e),u(e)},[o]),i=useCallback(e=>zustandStateStore.getStateChangeById(e),[]);return{stateChanges:e,filteredChanges:S,filter:r,setFilter:n,stats:l,stores:a,clearChanges:c,isEnabled:o,toggleCapture:h,storeNames:g,getChangeById:i}}
@@ -0,0 +1 @@
1
+ "use strict";export{ZustandModal}from"./components/ZustandModal";export{ZustandIcon,ZUSTAND_ICON_COLOR}from"./components/ZustandIcon";export{ZustandStateChangeItem}from"./components/ZustandStateChangeItem";export{ZustandStateDetailContent,ZustandStateDetailFooter}from"./components/ZustandStateDetailContent";export{ZustandStateInfoView}from"./components/ZustandStateInfoView";export{ZustandDetailViewToggle}from"./components/ZustandDetailViewToggle";export{ZustandActionButton}from"./components/ZustandActionButton";export{zustandStateStore}from"./utils/zustandStateStore";export{watchStores,buoyDevTools,isStoreInstrumented}from"./utils/buoyZustandMiddleware";export{useZustandStateChanges}from"./hooks/useZustandStateChanges";
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";import{zustandStateStore}from"./zustandStateStore";const WATCHED_SYMBOL=Symbol.for("@@buoy-zustand/watched");function detectPersist(t){const e=t.persist;if(e&&"function"==typeof e.getOptions){const t=e.getOptions();return{isPersisted:!0,persistName:t?.name}}return{isPersisted:!1}}export function watchStores(t){const e=[];for(const[s,r]of Object.entries(t)){const t=r;if(t[WATCHED_SYMBOL])continue;t[WATCHED_SYMBOL]=!0;const{isPersisted:n,persistName:a}=detectPersist(r);zustandStateStore.registerStore(s,{getState:r.getState,getInitialState:r.getInitialState,setState:r.setState,subscribe:r.subscribe},{isPersisted:n,persistName:a});const i=r.subscribe((t,e)=>{try{zustandStateStore.addStateChange({storeName:s,partial:void 0,replace:!1,prevState:e,nextState:t,duration:void 0,isPersisted:n})}catch{}});e.push(()=>{i(),delete r[WATCHED_SYMBOL],zustandStateStore.unregisterStore(s)})}return()=>{e.forEach(t=>t())}}let unnamedCounter=0;export function buoyDevTools(t,e){return(s,r,n)=>{const a=e?.name??"store-"+ ++unnamedCounter,i=!1!==e?.enabled,o=t((t,e)=>{if(!i)return s(t,e);const n=performance.now(),o=r();s(t,e);const S=r(),u=performance.now()-n,c="function"==typeof t?"(updater fn)":t;zustandStateStore.addStateChange({storeName:a,partial:c,replace:e??!1,prevState:o,nextState:S,duration:u,isPersisted:!1})},r,n);return setTimeout(()=>{if(n[WATCHED_SYMBOL])return;n[WATCHED_SYMBOL]=!0;const{isPersisted:t,persistName:e}=detectPersist(n);zustandStateStore.registerStore(a,{getState:r,getInitialState:n.getInitialState,setState:s,subscribe:n.subscribe},{isPersisted:t,persistName:e})},0),o}}export function isStoreInstrumented(t){return!0===t[WATCHED_SYMBOL]}
@@ -0,0 +1 @@
1
+ "use strict";export{zustandStateStore}from"./zustandStateStore";export{watchStores,buoyDevTools,isStoreInstrumented}from"./buoyZustandMiddleware";