@buoy-gg/storage 7.0.68 → 7.0.69

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StorageEventFilterView=StorageEventFilterView;var _storageLabels=require("../utils/storageLabels");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");function StorageEventFilterView({ignoredPatterns:s,onTogglePattern:o,onAddPattern:r,availableKeys:a=[],enabledStorageTypes:e,onToggleStorageType:t}){const i={addFilterSection:{enabled:true,placeholder:"Enter key pattern to hide...",title:"KEY FILTERS",icon:_sharedUi.Filter},availableItemsSection:{enabled:true,title:"AVAILABLE EVENT KEYS",emptyMessage:"No storage event keys available. Events will appear here once captured.",items:a},howItWorksSection:{enabled:true,title:"HOW EVENT FILTERS WORK",description:"Patterns hide matching storage keys from the event list. Storage type toggles control which storage backends are monitored.",examples:["\u2022 react_buoy \u2192 hides keys containing react_buoy","\u2022 @temp \u2192 hides @temp_user, @temp_data","\u2022 redux \u2192 hides redux-persist:root",`\u2022 ${_storageLabels.storageLabels.asyncFull}: show or hide captured events`,`\u2022 ${_storageLabels.storageLabels.mmkv}: show or hide captured events`],icon:_sharedUi.Filter},onPatternToggle:o,onPatternAdd:r,activePatterns:s};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.storageTypeSection,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"STORAGE TYPES"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.storageTypeButtons,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.storageTypeButton,e.has("async")&&styles.storageTypeButtonActive,{borderColor:_sharedUi.macOSColors.semantic.warning+"40"}],onPress:()=>t("async"),testID:"buoy-storage-backend-async",accessibilityRole:"button",accessibilityLabel:`Toggle ${_storageLabels.storageLabels.asyncFull} capture`,accessibilityState:{selected:e.has("async")},children:[(0,_jsxRuntime.jsx)(_sharedUi.Database,{size:16,color:e.has("async")?_sharedUi.macOSColors.semantic.warning:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.storageTypeButtonText,e.has("async")&&{color:_sharedUi.macOSColors.semantic.warning}],children:_storageLabels.storageLabels.asyncFull})]}),(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.storageTypeButton,e.has("mmkv")&&styles.storageTypeButtonActive,{borderColor:_sharedUi.macOSColors.semantic.info+"40"}],onPress:()=>t("mmkv"),testID:"buoy-storage-backend-mmkv",accessibilityRole:"button",accessibilityLabel:`Toggle ${_storageLabels.storageLabels.mmkv} capture`,accessibilityState:{selected:e.has("mmkv")},children:[(0,_jsxRuntime.jsx)(_sharedUi.HardDrive,{size:16,color:e.has("mmkv")?_sharedUi.macOSColors.semantic.info:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.storageTypeButtonText,e.has("mmkv")&&{color:_sharedUi.macOSColors.semantic.info}],children:_storageLabels.storageLabels.mmkv})]}),_storageLabels.storageLabels.hasSecure&&(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.storageTypeButton,e.has("secure")&&styles.storageTypeButtonActive,{borderColor:_sharedUi.macOSColors.semantic.success+"40"}],onPress:()=>t("secure"),testID:"buoy-storage-backend-secure",accessibilityRole:"button",accessibilityLabel:"Toggle Secure Storage capture",accessibilityState:{selected:e.has("secure")},children:[(0,_jsxRuntime.jsx)(_sharedUi.Shield,{size:16,color:e.has("secure")?_sharedUi.macOSColors.semantic.success:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.storageTypeButtonText,e.has("secure")&&{color:_sharedUi.macOSColors.semantic.success}],children:"Secure Storage"})]})]})]}),(0,_jsxRuntime.jsx)(_sharedUi.DynamicFilterView,{...i})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1},storageTypeSection:{padding:16,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border},sectionTitle:{fontSize:11,fontWeight:"700",color:_sharedUi.night.color.textSecondary,letterSpacing:.8,marginBottom:12},storageTypeButtons:{flexDirection:"row",gap:8},storageTypeButton:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,paddingHorizontal:12,backgroundColor:_sharedUi.night.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.border},storageTypeButtonActive:{backgroundColor:_sharedUi.night.color.surface},storageTypeButtonText:{fontSize:11,fontWeight:"600",color:_sharedUi.night.color.textTertiary}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StorageEventFilterView=StorageEventFilterView;var _storageLabels=require("../utils/storageLabels");var _showsSecureStorage=require("../utils/showsSecureStorage");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");function StorageEventFilterView({ignoredPatterns:r,onTogglePattern:s,onAddPattern:o,availableKeys:a=[],enabledStorageTypes:e,onToggleStorageType:t}){const i={addFilterSection:{enabled:true,placeholder:"Enter key pattern to hide...",title:"KEY FILTERS",icon:_sharedUi.Filter},availableItemsSection:{enabled:true,title:"AVAILABLE EVENT KEYS",emptyMessage:"No storage event keys available. Events will appear here once captured.",items:a},howItWorksSection:{enabled:true,title:"HOW EVENT FILTERS WORK",description:"Patterns hide matching storage keys from the event list. Storage type toggles control which storage backends are monitored.",examples:["\u2022 react_buoy \u2192 hides keys containing react_buoy","\u2022 @temp \u2192 hides @temp_user, @temp_data","\u2022 redux \u2192 hides redux-persist:root",`\u2022 ${_storageLabels.storageLabels.asyncFull}: show or hide captured events`,`\u2022 ${_storageLabels.storageLabels.mmkv}: show or hide captured events`],icon:_sharedUi.Filter},onPatternToggle:s,onPatternAdd:o,activePatterns:r};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.storageTypeSection,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"STORAGE TYPES"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.storageTypeButtons,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.storageTypeButton,e.has("async")&&styles.storageTypeButtonActive,{borderColor:_sharedUi.macOSColors.semantic.warning+"40"}],onPress:()=>t("async"),testID:"buoy-storage-backend-async",accessibilityRole:"button",accessibilityLabel:`Toggle ${_storageLabels.storageLabels.asyncFull} capture`,accessibilityState:{selected:e.has("async")},children:[(0,_jsxRuntime.jsx)(_sharedUi.Database,{size:16,color:e.has("async")?_sharedUi.macOSColors.semantic.warning:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.storageTypeButtonText,e.has("async")&&{color:_sharedUi.macOSColors.semantic.warning}],children:_storageLabels.storageLabels.asyncFull})]}),(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.storageTypeButton,e.has("mmkv")&&styles.storageTypeButtonActive,{borderColor:_sharedUi.macOSColors.semantic.info+"40"}],onPress:()=>t("mmkv"),testID:"buoy-storage-backend-mmkv",accessibilityRole:"button",accessibilityLabel:`Toggle ${_storageLabels.storageLabels.mmkv} capture`,accessibilityState:{selected:e.has("mmkv")},children:[(0,_jsxRuntime.jsx)(_sharedUi.HardDrive,{size:16,color:e.has("mmkv")?_sharedUi.macOSColors.semantic.info:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.storageTypeButtonText,e.has("mmkv")&&{color:_sharedUi.macOSColors.semantic.info}],children:_storageLabels.storageLabels.mmkv})]}),(0,_showsSecureStorage.showsSecureStorage)()&&(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.storageTypeButton,e.has("secure")&&styles.storageTypeButtonActive,{borderColor:_sharedUi.macOSColors.semantic.success+"40"}],onPress:()=>t("secure"),testID:"buoy-storage-backend-secure",accessibilityRole:"button",accessibilityLabel:"Toggle Secure Storage capture",accessibilityState:{selected:e.has("secure")},children:[(0,_jsxRuntime.jsx)(_sharedUi.Shield,{size:16,color:e.has("secure")?_sharedUi.macOSColors.semantic.success:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.storageTypeButtonText,e.has("secure")&&{color:_sharedUi.macOSColors.semantic.success}],children:"Secure Storage"})]})]})]}),(0,_jsxRuntime.jsx)(_sharedUi.DynamicFilterView,{...i})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1},storageTypeSection:{padding:16,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border},sectionTitle:{fontSize:11,fontWeight:"700",color:_sharedUi.night.color.textSecondary,letterSpacing:.8,marginBottom:12},storageTypeButtons:{flexDirection:"row",gap:8},storageTypeButton:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,paddingHorizontal:12,backgroundColor:_sharedUi.night.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.border},storageTypeButtonActive:{backgroundColor:_sharedUi.night.color.surface},storageTypeButtonText:{fontSize:11,fontWeight:"600",color:_sharedUi.night.color.textTertiary}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StorageKeyCard=StorageKeyCard;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _storageQueryUtils=require("../utils/storageQueryUtils");var _valueType=require("../utils/valueType");var _dataViewer=require("@buoy-gg/shared-ui/dataViewer");var _jsxRuntime=require("react/jsx-runtime");const HIT_SLOP={top:6,bottom:6,left:6,right:6};const INSTANCE_COLORS=[_sharedUi.macOSColors.semantic.info,_sharedUi.macOSColors.semantic.success,_sharedUi.macOSColors.semantic.warning,_sharedUi.macOSColors.semantic.debug,"#FF6B9D","#00D9FF"];function getInstanceColor(e){const o=e.split("").reduce((l,r)=>l+r.charCodeAt(0),0);return INSTANCE_COLORS[o%INSTANCE_COLORS.length]}const getStatusConfig=e=>{switch(e){case"required_present":return{icon:_sharedUi.CheckCircle2,color:_sharedUi.macOSColors.semantic.success,bgColor:_sharedUi.macOSColors.semantic.successBackground,borderColor:_sharedUi.macOSColors.semantic.success+"40",label:"REQUIRED",labelColor:_sharedUi.macOSColors.semantic.success};case"required_missing":return{icon:_sharedUi.AlertCircle,color:_sharedUi.macOSColors.semantic.error,bgColor:_sharedUi.macOSColors.semantic.errorBackground,borderColor:_sharedUi.macOSColors.semantic.error+"50",label:"MISSING",labelColor:_sharedUi.macOSColors.semantic.error};case"required_wrong_value":return{icon:_sharedUi.XCircle,color:_sharedUi.macOSColors.semantic.warning,bgColor:_sharedUi.macOSColors.semantic.warningBackground,borderColor:_sharedUi.macOSColors.semantic.warning+"50",label:"WRONG S",labelColor:_sharedUi.macOSColors.semantic.warning};case"required_wrong_type":return{icon:_sharedUi.XCircle,color:_sharedUi.macOSColors.semantic.info,bgColor:_sharedUi.macOSColors.semantic.infoBackground,borderColor:_sharedUi.macOSColors.semantic.info+"50",label:"WRONG TYPE",labelColor:_sharedUi.macOSColors.semantic.info};case"optional_present":return{icon:_sharedUi.Eye,color:_sharedUi.macOSColors.semantic.debug,bgColor:_sharedUi.macOSColors.semantic.infoBackground,borderColor:_sharedUi.macOSColors.semantic.debug+"40",label:"OPTIONAL",labelColor:_sharedUi.macOSColors.semantic.debug}}};const getStorageIcon=e=>{switch(e){case"mmkv":return _sharedUi.HardDrive;case"async":return _sharedUi.Database;case"secure":return _sharedUi.Shield;default:return _sharedUi.Database}};function StorageKeyCard({storageKey:e,isExpanded:o,onToggle:l}){const r=getStatusConfig(e.status);const c=r.icon;const s=getStorageIcon(e.storageType);const a=e.value!==void 0&&e.value!==null;const i=e.expectedValue!==void 0;const d=e.expectedType!==void 0;const n=(0,_storageQueryUtils.getStorageTypeHexColor)(e.storageType);const u=(0,_storageQueryUtils.getStorageTypeLabel)(e.storageType);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.storageKeyCard,{borderColor:r.borderColor}],children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{accessibilityLabel:"Storage key card",accessibilityHint:"View storage key card","sentry-label":`ignore storage key card ${e.key}`,accessibilityRole:"button",style:styles.cardHeader,onPress:l,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardHeaderLeft,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.iconContainer,{backgroundColor:r.bgColor}],children:(0,_jsxRuntime.jsx)(c,{size:14,color:r.color})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardHeaderInfo,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.storageKeyText,children:e.key}),e.description?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.descriptionText,children:e.description}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardHeaderMeta,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.statusBadge,{backgroundColor:r.bgColor}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.statusText,{color:r.labelColor}],children:r.label})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.storageBadge,{backgroundColor:`${n}15`}],children:[(0,_jsxRuntime.jsx)(s,{size:10,color:n}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.storageText,{color:n}],children:u})]}),e.storageType==="mmkv"&&e.instanceId&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.instanceBadge,{backgroundColor:getInstanceColor(e.instanceId)+"20",borderColor:getInstanceColor(e.instanceId)+"40"}],children:[(0,_jsxRuntime.jsx)(_sharedUi.HardDrive,{size:9,color:getInstanceColor(e.instanceId)}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.instanceText,{color:getInstanceColor(e.instanceId)}],children:e.instanceId})]}),a&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.valueBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.valueText,children:e.valueType?e.valueType.toUpperCase():(0,_valueType.getValueTypeLabel)(e.value)})})]})]})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.cardHeaderRight,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.actionButton,children:(0,_jsxRuntime.jsx)(_sharedUi.Eye,{size:12,color:_sharedUi.night.color.textSecondary})})})]}),o&&a&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardBody,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dataViewerContainer,children:(()=>{const t=typeof e.value==="string"?(()=>{try{return JSON.parse(e.value)}catch{return e.value}})():e.value;const g=typeof t==="string"||typeof t==="number"||typeof t==="boolean";return g?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.simpleValueContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.simpleValueLabel,children:"Current Value:"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.simpleValueBox,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.simpleValueContent,selectable:true,children:String(t)})}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.valueTypeText,children:["Type: ",(0,_valueType.getValueTypeLabel)(e.value)]})]}):(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"Current Value",data:t,showTypeFilter:false,rawMode:true})})()}),i&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.valueContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.valueLabel,children:"Expected Value:"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expectedValueBox,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expectedValueContent,selectable:true,children:e.expectedValue})})]}),d&&e.expectedType&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.valueContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.valueLabel,children:"Expected Type:"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expectedValueBox,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expectedValueContent,selectable:true,children:e.expectedType.toUpperCase()})}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.typeHelperText,children:["Current type: ",(0,_valueType.getValueTypeLabel)(e.value)]})]}),e.lastUpdated?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.metaInfo,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.metaLabel,children:["Last updated: ",e.lastUpdated.toLocaleString()]})}):null]}),o&&!a&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardBody,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyValueContainer,children:[(0,_jsxRuntime.jsx)(_sharedUi.AlertCircle,{size:16,color:_sharedUi.macOSColors.semantic.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyValueText,children:"Storage key not found or empty"})]}),i&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.valueContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.valueLabel,children:"Expected Value:"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expectedValueBox,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expectedValueContent,selectable:true,children:e.expectedValue})})]})]})]})}const styles=_reactNative.StyleSheet.create({storageKeyCard:{backgroundColor:_sharedUi.night.color.surface,borderRadius:8,borderWidth:1,overflow:"hidden"},cardHeader:{padding:12,flexDirection:"row",alignItems:"center",justifyContent:"space-between"},cardHeaderLeft:{flexDirection:"row",alignItems:"center",flex:1,minWidth:0},iconContainer:{padding:6,borderRadius:6,marginRight:10},cardHeaderInfo:{flex:1,minWidth:0,gap:4},storageKeyText:{color:_sharedUi.night.color.text,fontWeight:"500",fontSize:12,flexWrap:"wrap",flex:1},descriptionText:{color:_sharedUi.night.color.textSecondary,fontSize:10,marginTop:2,flexWrap:"wrap"},cardHeaderMeta:{flexDirection:"row",alignItems:"center",gap:6,flexWrap:"wrap"},statusBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},statusText:{fontSize:9,fontWeight:"600",letterSpacing:.5},storageBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4,flexDirection:"row",alignItems:"center",gap:4},storageText:{fontSize:9,fontWeight:"600"},instanceBadge:{paddingHorizontal:6,paddingVertical:3,borderRadius:4,borderWidth:1,flexDirection:"row",alignItems:"center",gap:4},instanceText:{fontSize:9,fontWeight:"700",fontFamily:_sharedUi.monoFont,letterSpacing:.3},valueBadge:{paddingHorizontal:4,paddingVertical:2,backgroundColor:_sharedUi.night.color.surfaceElevated,borderRadius:3},valueText:{fontSize:8,color:_sharedUi.night.color.textSecondary,fontWeight:"500"},cardHeaderRight:{marginLeft:8},actionButton:{padding:4,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated},cardBody:{borderTopWidth:1,borderTopColor:_sharedUi.night.color.separator,padding:12,gap:12},dataViewerContainer:{marginTop:8},simpleValueContainer:{gap:8},simpleValueLabel:{color:_sharedUi.night.color.textSecondary,fontSize:10,fontWeight:"500",textTransform:"uppercase",letterSpacing:.5},simpleValueBox:{backgroundColor:_sharedUi.night.color.bg,borderRadius:4,padding:10,borderWidth:1,borderColor:_sharedUi.night.color.border},simpleValueContent:{color:_sharedUi.gameUIColors.success,fontSize:12,fontFamily:_sharedUi.monoFont,lineHeight:16},valueTypeText:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontStyle:"italic"},valueContainer:{gap:6},valueLabel:{color:_sharedUi.night.color.textSecondary,fontSize:10,fontWeight:"500",textTransform:"uppercase",letterSpacing:.5},valueBox:{backgroundColor:_sharedUi.night.color.bg,borderRadius:4,padding:8,borderWidth:1,borderColor:_sharedUi.night.color.border},valueContent:{color:_sharedUi.night.color.text,fontSize:10,fontFamily:_sharedUi.monoFont,lineHeight:14},expectedValueBox:{backgroundColor:_sharedUi.night.color.bg,borderRadius:4,padding:8,borderWidth:1,borderColor:_sharedUi.night.color.border},expectedValueContent:{color:_sharedUi.night.color.text,fontSize:10,fontFamily:_sharedUi.monoFont,lineHeight:14},emptyValueContainer:{flexDirection:"row",alignItems:"center",gap:6,padding:8,backgroundColor:_sharedUi.gameUIColors.warning+"0D",borderRadius:4,borderWidth:1,borderColor:_sharedUi.gameUIColors.warning+"1A"},emptyValueText:{color:_sharedUi.gameUIColors.warning,fontSize:10,fontStyle:"italic"},typeHelperText:{color:_sharedUi.night.color.textSecondary,fontSize:9,marginTop:4,textAlign:"center"},metaInfo:{marginTop:8},metaLabel:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontStyle:"italic"}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StorageKeyCard=StorageKeyCard;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _storageQueryUtils=require("../utils/storageQueryUtils");var _valueType=require("../utils/valueType");var _dataViewer=require("@buoy-gg/shared-ui/dataViewer");var _jsxRuntime=require("react/jsx-runtime");const HIT_SLOP={top:6,bottom:6,left:6,right:6};const INSTANCE_COLORS=[_sharedUi.macOSColors.semantic.info,_sharedUi.macOSColors.semantic.success,_sharedUi.macOSColors.semantic.warning,_sharedUi.macOSColors.semantic.debug,"#FF6B9D","#00D9FF"];function getInstanceColor(e){const o=e.split("").reduce((l,r)=>l+r.charCodeAt(0),0);return INSTANCE_COLORS[o%INSTANCE_COLORS.length]}const getStatusConfig=e=>{switch(e){case"required_present":return{icon:_sharedUi.CheckCircle2,color:_sharedUi.macOSColors.semantic.success,bgColor:_sharedUi.macOSColors.semantic.successBackground,borderColor:_sharedUi.macOSColors.semantic.success+"40",label:"REQUIRED",labelColor:_sharedUi.macOSColors.semantic.success};case"required_missing":return{icon:_sharedUi.AlertCircle,color:_sharedUi.macOSColors.semantic.error,bgColor:_sharedUi.macOSColors.semantic.errorBackground,borderColor:_sharedUi.macOSColors.semantic.error+"50",label:"MISSING",labelColor:_sharedUi.macOSColors.semantic.error};case"required_wrong_value":return{icon:_sharedUi.XCircle,color:_sharedUi.macOSColors.semantic.warning,bgColor:_sharedUi.macOSColors.semantic.warningBackground,borderColor:_sharedUi.macOSColors.semantic.warning+"50",label:"WRONG S",labelColor:_sharedUi.macOSColors.semantic.warning};case"required_wrong_type":return{icon:_sharedUi.XCircle,color:_sharedUi.macOSColors.semantic.info,bgColor:_sharedUi.macOSColors.semantic.infoBackground,borderColor:_sharedUi.macOSColors.semantic.info+"50",label:"WRONG TYPE",labelColor:_sharedUi.macOSColors.semantic.info};case"optional_present":return{icon:_sharedUi.Eye,color:_sharedUi.macOSColors.semantic.debug,bgColor:_sharedUi.macOSColors.semantic.infoBackground,borderColor:_sharedUi.macOSColors.semantic.debug+"40",label:"OPTIONAL",labelColor:_sharedUi.macOSColors.semantic.debug}}};const getStorageIcon=e=>{switch(e){case"mmkv":return _sharedUi.HardDrive;case"async":return _sharedUi.Database;case"secure":return _sharedUi.Shield;default:return _sharedUi.Database}};function StorageKeyCard({storageKey:e,isExpanded:o,onToggle:l}){const r=getStatusConfig(e.status);const c=r.icon;const s=getStorageIcon(e.storageType);const a=e.value!==void 0&&e.value!==null;const i=e.expectedValue!==void 0;const d=e.expectedType!==void 0;const n=(0,_storageQueryUtils.getStorageTypeHexColor)(e.storageType);const u=(0,_storageQueryUtils.getStorageTypeLabel)(e.storageType,e.instanceId);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.storageKeyCard,{borderColor:r.borderColor}],children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{accessibilityLabel:"Storage key card",accessibilityHint:"View storage key card","sentry-label":`ignore storage key card ${e.key}`,accessibilityRole:"button",style:styles.cardHeader,onPress:l,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardHeaderLeft,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.iconContainer,{backgroundColor:r.bgColor}],children:(0,_jsxRuntime.jsx)(c,{size:14,color:r.color})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardHeaderInfo,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.storageKeyText,children:e.key}),e.description?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.descriptionText,children:e.description}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardHeaderMeta,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.statusBadge,{backgroundColor:r.bgColor}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.statusText,{color:r.labelColor}],children:r.label})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.storageBadge,{backgroundColor:`${n}15`}],children:[(0,_jsxRuntime.jsx)(s,{size:10,color:n}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.storageText,{color:n}],children:u})]}),e.storageType==="mmkv"&&e.instanceId&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.instanceBadge,{backgroundColor:getInstanceColor(e.instanceId)+"20",borderColor:getInstanceColor(e.instanceId)+"40"}],children:[(0,_jsxRuntime.jsx)(_sharedUi.HardDrive,{size:9,color:getInstanceColor(e.instanceId)}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.instanceText,{color:getInstanceColor(e.instanceId)}],children:e.instanceId})]}),a&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.valueBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.valueText,children:e.valueType?e.valueType.toUpperCase():(0,_valueType.getValueTypeLabel)(e.value)})})]})]})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.cardHeaderRight,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.actionButton,children:(0,_jsxRuntime.jsx)(_sharedUi.Eye,{size:12,color:_sharedUi.night.color.textSecondary})})})]}),o&&a&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardBody,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dataViewerContainer,children:(()=>{const t=typeof e.value==="string"?(()=>{try{return JSON.parse(e.value)}catch{return e.value}})():e.value;const g=typeof t==="string"||typeof t==="number"||typeof t==="boolean";return g?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.simpleValueContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.simpleValueLabel,children:"Current Value:"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.simpleValueBox,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.simpleValueContent,selectable:true,children:String(t)})}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.valueTypeText,children:["Type: ",(0,_valueType.getValueTypeLabel)(e.value)]})]}):(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"Current Value",data:t,showTypeFilter:false,rawMode:true})})()}),i&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.valueContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.valueLabel,children:"Expected Value:"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expectedValueBox,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expectedValueContent,selectable:true,children:e.expectedValue})})]}),d&&e.expectedType&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.valueContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.valueLabel,children:"Expected Type:"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expectedValueBox,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expectedValueContent,selectable:true,children:e.expectedType.toUpperCase()})}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.typeHelperText,children:["Current type: ",(0,_valueType.getValueTypeLabel)(e.value)]})]}),e.lastUpdated?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.metaInfo,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.metaLabel,children:["Last updated: ",e.lastUpdated.toLocaleString()]})}):null]}),o&&!a&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.cardBody,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyValueContainer,children:[(0,_jsxRuntime.jsx)(_sharedUi.AlertCircle,{size:16,color:_sharedUi.macOSColors.semantic.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyValueText,children:"Storage key not found or empty"})]}),i&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.valueContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.valueLabel,children:"Expected Value:"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expectedValueBox,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expectedValueContent,selectable:true,children:e.expectedValue})})]})]})]})}const styles=_reactNative.StyleSheet.create({storageKeyCard:{backgroundColor:_sharedUi.night.color.surface,borderRadius:8,borderWidth:1,overflow:"hidden"},cardHeader:{padding:12,flexDirection:"row",alignItems:"center",justifyContent:"space-between"},cardHeaderLeft:{flexDirection:"row",alignItems:"center",flex:1,minWidth:0},iconContainer:{padding:6,borderRadius:6,marginRight:10},cardHeaderInfo:{flex:1,minWidth:0,gap:4},storageKeyText:{color:_sharedUi.night.color.text,fontWeight:"500",fontSize:12,flexWrap:"wrap",flex:1},descriptionText:{color:_sharedUi.night.color.textSecondary,fontSize:10,marginTop:2,flexWrap:"wrap"},cardHeaderMeta:{flexDirection:"row",alignItems:"center",gap:6,flexWrap:"wrap"},statusBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},statusText:{fontSize:9,fontWeight:"600",letterSpacing:.5},storageBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4,flexDirection:"row",alignItems:"center",gap:4},storageText:{fontSize:9,fontWeight:"600"},instanceBadge:{paddingHorizontal:6,paddingVertical:3,borderRadius:4,borderWidth:1,flexDirection:"row",alignItems:"center",gap:4},instanceText:{fontSize:9,fontWeight:"700",fontFamily:_sharedUi.monoFont,letterSpacing:.3},valueBadge:{paddingHorizontal:4,paddingVertical:2,backgroundColor:_sharedUi.night.color.surfaceElevated,borderRadius:3},valueText:{fontSize:8,color:_sharedUi.night.color.textSecondary,fontWeight:"500"},cardHeaderRight:{marginLeft:8},actionButton:{padding:4,borderRadius:4,backgroundColor:_sharedUi.night.color.surfaceElevated},cardBody:{borderTopWidth:1,borderTopColor:_sharedUi.night.color.separator,padding:12,gap:12},dataViewerContainer:{marginTop:8},simpleValueContainer:{gap:8},simpleValueLabel:{color:_sharedUi.night.color.textSecondary,fontSize:10,fontWeight:"500",textTransform:"uppercase",letterSpacing:.5},simpleValueBox:{backgroundColor:_sharedUi.night.color.bg,borderRadius:4,padding:10,borderWidth:1,borderColor:_sharedUi.night.color.border},simpleValueContent:{color:_sharedUi.gameUIColors.success,fontSize:12,fontFamily:_sharedUi.monoFont,lineHeight:16},valueTypeText:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontStyle:"italic"},valueContainer:{gap:6},valueLabel:{color:_sharedUi.night.color.textSecondary,fontSize:10,fontWeight:"500",textTransform:"uppercase",letterSpacing:.5},valueBox:{backgroundColor:_sharedUi.night.color.bg,borderRadius:4,padding:8,borderWidth:1,borderColor:_sharedUi.night.color.border},valueContent:{color:_sharedUi.night.color.text,fontSize:10,fontFamily:_sharedUi.monoFont,lineHeight:14},expectedValueBox:{backgroundColor:_sharedUi.night.color.bg,borderRadius:4,padding:8,borderWidth:1,borderColor:_sharedUi.night.color.border},expectedValueContent:{color:_sharedUi.night.color.text,fontSize:10,fontFamily:_sharedUi.monoFont,lineHeight:14},emptyValueContainer:{flexDirection:"row",alignItems:"center",gap:6,padding:8,backgroundColor:_sharedUi.gameUIColors.warning+"0D",borderRadius:4,borderWidth:1,borderColor:_sharedUi.gameUIColors.warning+"1A"},emptyValueText:{color:_sharedUi.gameUIColors.warning,fontSize:10,fontStyle:"italic"},typeHelperText:{color:_sharedUi.night.color.textSecondary,fontSize:9,marginTop:4,textAlign:"center"},metaInfo:{marginTop:8},metaLabel:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontStyle:"italic"}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StorageKeyDetailScreen=StorageKeyDetailScreen;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _dataViewer=require("@buoy-gg/shared-ui/dataViewer");var _storageQueryUtils=require("../utils/storageQueryUtils");var _valueType=require("../utils/valueType");var _StorageKeyRow=require("./StorageKeyRow");var _jsxRuntime=require("react/jsx-runtime");const TYPING_COMMIT_MS=300;const DETAIL_ID="buoy-storage-detail";function detailExplorerTestID(e){const s=o=>o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return e.length===0?`${DETAIL_ID}-explorer-root`:`${DETAIL_ID}-explorer-${e.map(s).filter(Boolean).join("-")}`}const INSTANCE_COLORS=[_sharedUi.macOSColors.semantic.info,_sharedUi.macOSColors.semantic.success,_sharedUi.macOSColors.semantic.warning,_sharedUi.macOSColors.semantic.debug,"#FF6B9D","#00D9FF"];function getInstanceColor(e){const s=e.split("").reduce((o,a)=>o+a.charCodeAt(0),0);return INSTANCE_COLORS[s%INSTANCE_COLORS.length]}function StorageKeyDetailScreen({storageKey:e,editBlockedReason:s,eventCount:o,onSave:a,onViewHistory:b,onDeleteKey:u,onHideKey:x,isPinned:d=false,onTogglePin:p,applySafeAreaInset:m}){const j=(0,_sharedUi.useSafeAreaInsets)();const T=m?j.bottom:0;const i=s==null;const f=(0,_StorageKeyRow.getStatusConfig)(e.status);const S=(0,_storageQueryUtils.getStorageTypeLabel)(e.storageType);const[C,g]=(0,_react.useState)(false);const[V,v]=(0,_react.useState)(0);const n=(0,_react.useRef)(null);const D=(0,_react.useMemo)(()=>(0,_valueType.parseStorageValue)(e.value),[e.value]);const w=typeof e.value==="string"?e.value:JSON.stringify(e.value);if(n.current&&n.current.raw===w){n.current=null}const r=n.current?n.current.value:D;const h=(0,_react.useCallback)(t=>{const l=typeof t==="string"?t:JSON.stringify(t);n.current={raw:l,value:t};a(l).catch(c=>{n.current=null;_reactNative.Alert.alert("Couldn't save",c instanceof Error?c.message:String(c))})},[a]);const y=(0,_react.useRef)(r);y.current=r;const k=(0,_react.useMemo)(()=>{if(!i)return void 0;return{update:(t,l)=>{const c=t.length===0?l:(0,_dataViewer.updateNestedDataByPath)(y.current,t,l);h(c)},remove:t=>{if(t.length===0)return;h((0,_dataViewer.deleteNestedDataByPath)(y.current,t))}}},[i,h]);const I=p||x||i&&u;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.screen,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{testID:`${DETAIL_ID}-key`,accessibilityLabel:e.key}),(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{testID:`${DETAIL_ID}-scroll`,style:styles.scroll,contentContainerStyle:[styles.scrollContent,{paddingBottom:24+T}],keyboardShouldPersistTaps:"handled",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.section,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.editorContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sectionHeaderRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{testID:`${DETAIL_ID}-editor-header`,style:styles.sectionHeaderAccentText,children:"Value Editor"}),i?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{onPress:()=>g(true),testID:`${DETAIL_ID}-raw`,accessibilityRole:"button",accessibilityLabel:"Edit raw JSON",style:styles.rawButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.FileJson,{size:13,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rawButtonText,children:"Raw"})]}):null]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sectionBody,children:[(0,_jsxRuntime.jsx)(_dataViewer.LiveExplorer,{editable:i,label:"Value",value:r,defaultExpanded:["Value"],writer:k,dataVersion:V,testIDForPath:detailExplorerTestID,debounceMs:TYPING_COMMIT_MS}),i?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.editorHint,children:"Edits write to the device as you make them \u2014 undo lives in the key's history."}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.blockedText,testID:`${DETAIL_ID}-edit-blocked`,children:s})]})]})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.section,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionHeaderPlain,children:"Key Details"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoBody,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:"Status:"}),(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:f.color,testID:`${DETAIL_ID}-status`,children:f.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoDim,children:f.sublabel})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:"Storage:"}),(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:(0,_StorageKeyRow.getStorageTypeColor)(e.storageType),testID:`${DETAIL_ID}-backend`,children:S}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoDim,children:(0,_valueType.getValueTypeLabel)(e.value)})]}),e.storageType==="mmkv"&&e.instanceId&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:"Instance:"}),(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:getInstanceColor(e.instanceId),icon:(0,_jsxRuntime.jsx)(_sharedUi.HardDrive,{size:9,color:getInstanceColor(e.instanceId)}),children:e.instanceId})]}),o!=null&&o>0&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:"Updates:"}),(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:_sharedUi.macOSColors.semantic.warning,children:String(o)}),o>1&&b&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:b,testID:"buoy-storage-key-history",accessibilityLabel:`View history for ${e.key}`,accessibilityRole:"button",style:styles.inlineLinkButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.inlineLinkText,children:"view history \u2192"})})]}),e.status==="required_wrong_type"&&e.expectedType&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:"Expected:"}),(0,_jsxRuntime.jsx)(_sharedUi.TypeBadge,{type:e.expectedType}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.infoDim,children:["got ",(0,_valueType.getValueTypeLabel)(e.value)]})]}),e.status==="required_wrong_value"&&e.expectedValue&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:"Expected:"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoExpected,children:String(e.expectedValue)})]}),e.description?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:"Info:"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoDescription,children:e.description})]}):null]})]})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.section,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionHeaderPlain,children:"Value Explorer"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.viewerBody,testID:`${DETAIL_ID}-viewer`,children:r!==null&&typeof r==="object"?(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"",data:r,showTypeFilter:true,rawMode:true,initialExpanded:false}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rawValueText,selectable:true,children:w??"undefined"})})]})}),I?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionRow,children:[p?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.actionChip,d&&styles.actionChipActive],testID:"buoy-storage-key-pin",accessibilityLabel:d?`Unpin ${e.key}`:`Pin ${e.key} to top`,accessibilityRole:"button",onPress:()=>p(e.key),hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.Pin,{size:12,active:d,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionChipText,{color:_sharedUi.night.color.accent}],children:d?"Unpin":"Pin to top"})]}):null,x?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.actionChip,testID:"buoy-storage-key-hide",accessibilityLabel:`Hide ${e.key} from list`,accessibilityRole:"button",onPress:()=>x(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.EyeOff,{size:12,color:_sharedUi.night.color.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionChipText,{color:_sharedUi.night.color.warning}],children:"Hide from list"})]}):null,i&&u?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.actionChip,styles.dangerChip],testID:"buoy-storage-key-delete",accessibilityLabel:`Delete key ${e.key}`,accessibilityRole:"button",onPress:()=>u(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:12,color:_sharedUi.night.color.danger}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionChipText,{color:_sharedUi.night.color.danger}],children:"Delete key"})]}):null]}):null]}),C&&i?(0,_jsxRuntime.jsx)(_dataViewer.ValueEditModal,{path:[],value:r,onSave:t=>{h(t);v(l=>l+1);g(false)},onCancel:()=>g(false),saveLabel:"Apply",testIDPrefix:"buoy-storage-value"}):null]})}const styles=_reactNative.StyleSheet.create({screen:{flex:1,minHeight:0},scroll:{flex:1},scrollContent:{paddingHorizontal:8,paddingTop:8},section:{marginBottom:16},editorContainer:{minWidth:200,backgroundColor:_sharedUi.night.color.surface,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.accent+"4D",overflow:"hidden",shadowColor:_sharedUi.night.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},sectionHeaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",backgroundColor:_sharedUi.night.color.accent+"1A",paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.accent+"33"},sectionHeaderAccentText:{fontWeight:"600",fontSize:12,color:_sharedUi.night.color.accent,letterSpacing:.5,textTransform:"uppercase",fontFamily:_sharedUi.monoFont},rawButton:{flexDirection:"row",alignItems:"center",gap:4},rawButtonText:{color:_sharedUi.night.color.accent,fontSize:11,fontWeight:"700"},sectionBody:{padding:8},editorHint:{color:_sharedUi.night.color.textTertiary,fontSize:10,paddingTop:8,paddingHorizontal:4,lineHeight:14},blockedText:{color:_sharedUi.night.color.textSecondary,fontSize:12,padding:12,lineHeight:18},infoContainer:{minWidth:200,backgroundColor:_sharedUi.night.color.surface,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.border,overflow:"hidden"},sectionHeaderPlain:{backgroundColor:_sharedUi.night.color.surfaceElevated,paddingHorizontal:12,paddingVertical:8,fontWeight:"600",fontSize:12,color:_sharedUi.night.color.textSecondary,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border,letterSpacing:.5,textTransform:"uppercase",fontFamily:_sharedUi.monoFont},infoBody:{padding:12,gap:10},infoRow:{flexDirection:"row",alignItems:"center",gap:8},infoLabel:{fontSize:10,color:_sharedUi.night.color.textTertiary,fontWeight:"600",minWidth:64,fontFamily:_sharedUi.monoFont},infoDim:{color:_sharedUi.night.color.textTertiary,fontSize:10,fontFamily:_sharedUi.monoFont},infoExpected:{fontSize:11,color:_sharedUi.macOSColors.semantic.warning,fontFamily:_sharedUi.monoFont,flex:1},infoDescription:{fontSize:11,color:_sharedUi.night.color.textSecondary,flex:1},rawValueText:{color:_sharedUi.night.color.textSecondary,fontSize:11,fontFamily:_sharedUi.monoFont,lineHeight:16,padding:12},viewerBody:{backgroundColor:_sharedUi.night.color.bg,minHeight:48},inlineLinkButton:{marginLeft:4},inlineLinkText:{fontSize:10,fontWeight:"600",fontFamily:_sharedUi.monoFont,color:_sharedUi.night.color.accent},actionRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:8,paddingHorizontal:4},actionChip:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:6,paddingHorizontal:10,borderRadius:6,backgroundColor:_sharedUi.night.color.surface,borderWidth:1,borderColor:_sharedUi.night.color.border},dangerChip:{borderColor:_sharedUi.night.color.danger+"55"},actionChipActive:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorderStrong},actionChipText:{fontSize:11,fontWeight:"600",fontFamily:_sharedUi.monoFont}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StorageKeyDetailScreen=StorageKeyDetailScreen;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _dataViewer=require("@buoy-gg/shared-ui/dataViewer");var _storageQueryUtils=require("../utils/storageQueryUtils");var _valueType=require("../utils/valueType");var _StorageKeyRow=require("./StorageKeyRow");var _jsxRuntime=require("react/jsx-runtime");const TYPING_COMMIT_MS=300;const DETAIL_ID="buoy-storage-detail";function detailExplorerTestID(e){const s=o=>o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return e.length===0?`${DETAIL_ID}-explorer-root`:`${DETAIL_ID}-explorer-${e.map(s).filter(Boolean).join("-")}`}const INSTANCE_COLORS=[_sharedUi.macOSColors.semantic.info,_sharedUi.macOSColors.semantic.success,_sharedUi.macOSColors.semantic.warning,_sharedUi.macOSColors.semantic.debug,"#FF6B9D","#00D9FF"];function getInstanceColor(e){const s=e.split("").reduce((o,a)=>o+a.charCodeAt(0),0);return INSTANCE_COLORS[s%INSTANCE_COLORS.length]}function StorageKeyDetailScreen({storageKey:e,editBlockedReason:s,eventCount:o,onSave:a,onViewHistory:b,onDeleteKey:u,onHideKey:x,isPinned:d=false,onTogglePin:p,applySafeAreaInset:m}){const j=(0,_sharedUi.useSafeAreaInsets)();const T=m?j.bottom:0;const i=s==null;const f=(0,_StorageKeyRow.getStatusConfig)(e.status);const S=(0,_storageQueryUtils.getStorageTypeLabel)(e.storageType,e.instanceId);const[C,g]=(0,_react.useState)(false);const[V,v]=(0,_react.useState)(0);const n=(0,_react.useRef)(null);const D=(0,_react.useMemo)(()=>(0,_valueType.parseStorageValue)(e.value),[e.value]);const w=typeof e.value==="string"?e.value:JSON.stringify(e.value);if(n.current&&n.current.raw===w){n.current=null}const r=n.current?n.current.value:D;const h=(0,_react.useCallback)(t=>{const l=typeof t==="string"?t:JSON.stringify(t);n.current={raw:l,value:t};a(l).catch(c=>{n.current=null;_reactNative.Alert.alert("Couldn't save",c instanceof Error?c.message:String(c))})},[a]);const y=(0,_react.useRef)(r);y.current=r;const I=(0,_react.useMemo)(()=>{if(!i)return void 0;return{update:(t,l)=>{const c=t.length===0?l:(0,_dataViewer.updateNestedDataByPath)(y.current,t,l);h(c)},remove:t=>{if(t.length===0)return;h((0,_dataViewer.deleteNestedDataByPath)(y.current,t))}}},[i,h]);const k=p||x||i&&u;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.screen,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{testID:`${DETAIL_ID}-key`,accessibilityLabel:e.key}),(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{testID:`${DETAIL_ID}-scroll`,style:styles.scroll,contentContainerStyle:[styles.scrollContent,{paddingBottom:24+T}],keyboardShouldPersistTaps:"handled",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.section,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.editorContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sectionHeaderRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{testID:`${DETAIL_ID}-editor-header`,style:styles.sectionHeaderAccentText,children:"Value Editor"}),i?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{onPress:()=>g(true),testID:`${DETAIL_ID}-raw`,accessibilityRole:"button",accessibilityLabel:"Edit raw JSON",style:styles.rawButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.FileJson,{size:13,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rawButtonText,children:"Raw"})]}):null]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sectionBody,children:[(0,_jsxRuntime.jsx)(_dataViewer.LiveExplorer,{editable:i,label:"Value",value:r,defaultExpanded:["Value"],writer:I,dataVersion:V,testIDForPath:detailExplorerTestID,debounceMs:TYPING_COMMIT_MS}),i?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.editorHint,children:"Edits write to the device as you make them \u2014 undo lives in the key's history."}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.blockedText,testID:`${DETAIL_ID}-edit-blocked`,children:s})]})]})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.section,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionHeaderPlain,children:"Key Details"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoBody,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:"Status:"}),(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:f.color,testID:`${DETAIL_ID}-status`,children:f.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoDim,children:f.sublabel})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:"Storage:"}),(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:(0,_StorageKeyRow.getStorageTypeColor)(e.storageType),testID:`${DETAIL_ID}-backend`,children:S}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoDim,children:(0,_valueType.getValueTypeLabel)(e.value)})]}),e.storageType==="mmkv"&&e.instanceId&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:"Instance:"}),(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:getInstanceColor(e.instanceId),icon:(0,_jsxRuntime.jsx)(_sharedUi.HardDrive,{size:9,color:getInstanceColor(e.instanceId)}),children:e.instanceId})]}),o!=null&&o>0&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:"Updates:"}),(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:_sharedUi.macOSColors.semantic.warning,children:String(o)}),o>1&&b&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:b,testID:"buoy-storage-key-history",accessibilityLabel:`View history for ${e.key}`,accessibilityRole:"button",style:styles.inlineLinkButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.inlineLinkText,children:"view history \u2192"})})]}),e.status==="required_wrong_type"&&e.expectedType&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:"Expected:"}),(0,_jsxRuntime.jsx)(_sharedUi.TypeBadge,{type:e.expectedType}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.infoDim,children:["got ",(0,_valueType.getValueTypeLabel)(e.value)]})]}),e.status==="required_wrong_value"&&e.expectedValue&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:"Expected:"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoExpected,children:String(e.expectedValue)})]}),e.description?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:"Info:"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoDescription,children:e.description})]}):null]})]})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.section,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionHeaderPlain,children:"Value Explorer"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.viewerBody,testID:`${DETAIL_ID}-viewer`,children:r!==null&&typeof r==="object"?(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"",data:r,showTypeFilter:true,rawMode:true,initialExpanded:false}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.rawValueText,selectable:true,children:w??"undefined"})})]})}),k?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionRow,children:[p?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.actionChip,d&&styles.actionChipActive],testID:"buoy-storage-key-pin",accessibilityLabel:d?`Unpin ${e.key}`:`Pin ${e.key} to top`,accessibilityRole:"button",onPress:()=>p(e.key),hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.Pin,{size:12,active:d,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionChipText,{color:_sharedUi.night.color.accent}],children:d?"Unpin":"Pin to top"})]}):null,x?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.actionChip,testID:"buoy-storage-key-hide",accessibilityLabel:`Hide ${e.key} from list`,accessibilityRole:"button",onPress:()=>x(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.EyeOff,{size:12,color:_sharedUi.night.color.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionChipText,{color:_sharedUi.night.color.warning}],children:"Hide from list"})]}):null,i&&u?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.actionChip,styles.dangerChip],testID:"buoy-storage-key-delete",accessibilityLabel:`Delete key ${e.key}`,accessibilityRole:"button",onPress:()=>u(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:12,color:_sharedUi.night.color.danger}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionChipText,{color:_sharedUi.night.color.danger}],children:"Delete key"})]}):null]}):null]}),C&&i?(0,_jsxRuntime.jsx)(_dataViewer.ValueEditModal,{path:[],value:r,onSave:t=>{h(t);v(l=>l+1);g(false)},onCancel:()=>g(false),saveLabel:"Apply",testIDPrefix:"buoy-storage-value"}):null]})}const styles=_reactNative.StyleSheet.create({screen:{flex:1,minHeight:0},scroll:{flex:1},scrollContent:{paddingHorizontal:8,paddingTop:8},section:{marginBottom:16},editorContainer:{minWidth:200,backgroundColor:_sharedUi.night.color.surface,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.accent+"4D",overflow:"hidden",shadowColor:_sharedUi.night.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},sectionHeaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",backgroundColor:_sharedUi.night.color.accent+"1A",paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.accent+"33"},sectionHeaderAccentText:{fontWeight:"600",fontSize:12,color:_sharedUi.night.color.accent,letterSpacing:.5,textTransform:"uppercase",fontFamily:_sharedUi.monoFont},rawButton:{flexDirection:"row",alignItems:"center",gap:4},rawButtonText:{color:_sharedUi.night.color.accent,fontSize:11,fontWeight:"700"},sectionBody:{padding:8},editorHint:{color:_sharedUi.night.color.textTertiary,fontSize:10,paddingTop:8,paddingHorizontal:4,lineHeight:14},blockedText:{color:_sharedUi.night.color.textSecondary,fontSize:12,padding:12,lineHeight:18},infoContainer:{minWidth:200,backgroundColor:_sharedUi.night.color.surface,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.border,overflow:"hidden"},sectionHeaderPlain:{backgroundColor:_sharedUi.night.color.surfaceElevated,paddingHorizontal:12,paddingVertical:8,fontWeight:"600",fontSize:12,color:_sharedUi.night.color.textSecondary,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border,letterSpacing:.5,textTransform:"uppercase",fontFamily:_sharedUi.monoFont},infoBody:{padding:12,gap:10},infoRow:{flexDirection:"row",alignItems:"center",gap:8},infoLabel:{fontSize:10,color:_sharedUi.night.color.textTertiary,fontWeight:"600",minWidth:64,fontFamily:_sharedUi.monoFont},infoDim:{color:_sharedUi.night.color.textTertiary,fontSize:10,fontFamily:_sharedUi.monoFont},infoExpected:{fontSize:11,color:_sharedUi.macOSColors.semantic.warning,fontFamily:_sharedUi.monoFont,flex:1},infoDescription:{fontSize:11,color:_sharedUi.night.color.textSecondary,flex:1},rawValueText:{color:_sharedUi.night.color.textSecondary,fontSize:11,fontFamily:_sharedUi.monoFont,lineHeight:16,padding:12},viewerBody:{backgroundColor:_sharedUi.night.color.bg,minHeight:48},inlineLinkButton:{marginLeft:4},inlineLinkText:{fontSize:10,fontWeight:"600",fontFamily:_sharedUi.monoFont,color:_sharedUi.night.color.accent},actionRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:8,paddingHorizontal:4},actionChip:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:6,paddingHorizontal:10,borderRadius:6,backgroundColor:_sharedUi.night.color.surface,borderWidth:1,borderColor:_sharedUi.night.color.border},dangerChip:{borderColor:_sharedUi.night.color.danger+"55"},actionChipActive:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorderStrong},actionChipText:{fontSize:11,fontWeight:"600",fontFamily:_sharedUi.monoFont}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getStorageTypeColor=exports.getStatusConfig=exports.StorageKeyRow=void 0;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _storageQueryUtils=require("../utils/storageQueryUtils");var _valueType=require("../utils/valueType");var _dataViewer=require("@buoy-gg/shared-ui/dataViewer");var _jsxRuntime=require("react/jsx-runtime");const INSTANCE_COLORS=[_sharedUi.macOSColors.semantic.info,_sharedUi.macOSColors.semantic.success,_sharedUi.macOSColors.semantic.warning,_sharedUi.macOSColors.semantic.debug,"#FF6B9D","#00D9FF"];function getInstanceColor(t){const e=t.split("").reduce((r,l)=>r+l.charCodeAt(0),0);return INSTANCE_COLORS[e%INSTANCE_COLORS.length]}const getStatusConfig=t=>{switch(t){case"required_present":return{label:"Valid",color:_sharedUi.macOSColors.semantic.success,sublabel:"Required"};case"required_missing":return{label:"Missing",color:_sharedUi.macOSColors.semantic.error,sublabel:"Required"};case"required_wrong_value":return{label:"Wrong",color:_sharedUi.macOSColors.semantic.warning,sublabel:"Invalid value"};case"required_wrong_type":return{label:"Type Error",color:_sharedUi.macOSColors.semantic.info,sublabel:"Wrong type"};case"optional_present":return{label:"Set",color:_sharedUi.macOSColors.semantic.debug,sublabel:"Optional"};default:return{label:"Set",color:_sharedUi.macOSColors.text.secondary,sublabel:String(t)}}};exports.getStatusConfig=getStatusConfig;const formatValue=t=>{if(t===void 0||t===null){return"undefined"}const e=typeof t==="string"?t:JSON.stringify(t);return e};const StorageKeyRow=exports.StorageKeyRow=(0,_react.memo)(function t({storageKey:e,isExpanded:r,onPress:l,isSelectMode:d=false,isSelected:a=false,onSelectionChange:S,eventCount:o,onViewHistory:g,onHideKey:u,isPinned:i=false,onTogglePin:p,onEditKey:y,onToggleKey:c,onDeleteKey:m,editBlockedReason:x}){const h=y!=null&&x==null;const s=getStatusConfig(e.status);const f=e.value!==void 0&&e.value!==null;const n=f&&typeof e.value==="boolean";const T=e.key;const w=(0,_storageQueryUtils.getStorageTypeLabel)(e.storageType);const b=(0,_valueType.parseStorageValue)(e.value);const j=b!==null&&typeof b==="object";const R=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedContainer,children:[(0,_jsxRuntime.jsx)(_sharedUi.ExpandedInfoRow,{label:"Storage",children:(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:getStorageTypeColor(e.storageType),children:w})}),e.storageType==="mmkv"&&e.instanceId&&(0,_jsxRuntime.jsx)(_sharedUi.ExpandedInfoRow,{label:"Instance",children:(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:getInstanceColor(e.instanceId),icon:(0,_jsxRuntime.jsx)(_sharedUi.HardDrive,{size:9,color:getInstanceColor(e.instanceId)}),children:e.instanceId})}),o!=null&&o>0&&(0,_jsxRuntime.jsxs)(_sharedUi.ExpandedInfoRow,{label:"Updates",children:[(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:_sharedUi.macOSColors.semantic.warning,children:String(o)}),o>1&&g&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:g,testID:"buoy-storage-key-history",accessibilityLabel:`View history for ${e.key}`,accessibilityRole:"button",style:styles.viewHistoryButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.viewHistoryText,children:"view history \u2192"})})]}),j?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dataViewerContainer,children:(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{data:b,title:"",showTypeFilter:true,rawMode:true,initialExpanded:true})}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedLabel,children:"Value:"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedValue,numberOfLines:3,children:formatValue(e.value)||"undefined"})]}),e.status==="required_wrong_type"&&e.expectedType&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedLabel,children:"Type:"}),(0,_jsxRuntime.jsx)(_sharedUi.TypeBadge,{type:(0,_valueType.getValueTypeLabel)(e.value)})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedLabel,children:"Expected:"}),(0,_jsxRuntime.jsx)(_sharedUi.TypeBadge,{type:e.expectedType})]})]}),e.status==="required_wrong_value"&&e.expectedValue&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedLabel,children:"Expected:"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedExpected,children:String(e.expectedValue)})]}),e.description?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedLabel,children:"Info:"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedDescription,children:e.description})]}):null,x?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedLabel,children:"Edit:"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedDescription,children:x})]}):null,p||u||h?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionRow,children:[h?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.editButton,testID:"buoy-storage-key-edit",accessibilityLabel:n&&c?`Toggle ${e.key}`:`Edit ${e.key}`,accessibilityRole:"button",onPress:()=>n&&c?c(e):y?.(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.Edit3,{size:13,color:_sharedUi.night.color.onAccent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.editButtonText,children:n&&c?"Toggle":"Edit"})]}):null,p?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.actionChip,i&&styles.actionChipActive],testID:"buoy-storage-key-pin",accessibilityLabel:i?`Unpin ${e.key}`:`Pin ${e.key} to top`,accessibilityRole:"button",onPress:()=>p(e.key),hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.Pin,{size:12,active:i,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionChipText,{color:_sharedUi.night.color.accent}],children:i?"Unpin":"Pin to top"})]}):null,u?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.actionChip,testID:"buoy-storage-key-hide",accessibilityLabel:`Hide ${e.key} from list`,accessibilityRole:"button",onPress:()=>u(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.EyeOff,{size:12,color:_sharedUi.night.color.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionChipText,{color:_sharedUi.night.color.warning}],children:"Hide from list"})]}):null,h&&m?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.actionChip,styles.dangerChip],testID:"buoy-storage-key-delete",accessibilityLabel:`Delete key ${e.key}`,accessibilityRole:"button",onPress:()=>m(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:12,color:_sharedUi.night.color.danger}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionChipText,{color:_sharedUi.night.color.danger}],children:"Delete key"})]}):null]}):null]});const C=()=>{S?.(e,!a)};const k=d?(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:C,testID:`buoy-storage-checkbox-${e.storageType}-${e.key}`,accessibilityLabel:`Select ${e.key}`,accessibilityRole:"checkbox",accessibilityState:{checked:a},style:styles.checkboxContainer,hitSlop:{top:8,bottom:8,left:8,right:8},children:a?(0,_jsxRuntime.jsx)(_sharedUi.CheckSquare,{size:18,color:_sharedUi.night.color.accent}):(0,_jsxRuntime.jsx)(_sharedUi.Square,{size:18,color:_sharedUi.night.color.textTertiary})}):null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.rowContainer,a&&styles.rowContainerSelected],children:[k,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.compactRowWrapper,children:[(0,_jsxRuntime.jsx)(_sharedUi.CompactRow,{statusDotColor:s.color,statusLabel:s.label,statusSublabel:s.sublabel,primaryText:T,secondaryText:f?n?(0,_valueType.getValueTypeLabel)(e.value):(0,_valueType.getValueTypeWithPreview)(e.value):void 0,secondaryAccessory:n?(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{size:"sm",color:e.value?_sharedUi.macOSColors.semantic.success:_sharedUi.macOSColors.semantic.error,children:e.value?"true":"false"}):void 0,expandedContent:R,isExpanded:r,expandedGlowColor:s.color,customBadge:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.badgeRow,children:[i&&(0,_jsxRuntime.jsx)(_sharedUi.Pin,{size:12,active:true,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:getStorageTypeColor(e.storageType),children:w})]}),showChevron:!d,onPress:d?C:l?()=>l(e):void 0,testID:`buoy-storage-row-${e.storageType}-${e.key}`,accessibilityLabel:`${e.storageType} ${e.key}`}),o!=null&&o>1&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.absCountBadge,r&&styles.absCountBadgeExpanded,{backgroundColor:_sharedUi.macOSColors.semantic.warning+"22",borderColor:_sharedUi.macOSColors.semantic.warning+"55"}],pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.absCountText,{color:_sharedUi.macOSColors.semantic.warning}],children:String(o)})})]})]})});const getStorageTypeColor=t=>{switch(t){case"mmkv":return _sharedUi.macOSColors.semantic.info;case"async":return _sharedUi.macOSColors.semantic.warning;case"secure":return _sharedUi.macOSColors.semantic.success;default:return _sharedUi.macOSColors.text.secondary}};exports.getStorageTypeColor=getStorageTypeColor;const styles=_reactNative.StyleSheet.create({badgeRow:{flexDirection:"row",alignItems:"center",gap:6},expandedContainer:{gap:8},expandedRow:{flexDirection:"row",alignItems:"center",gap:10},expandedLabel:{fontSize:10,color:_sharedUi.night.color.textTertiary,fontWeight:"600",minWidth:70,fontFamily:_sharedUi.monoFont},expandedValue:{fontSize:11,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,flex:1},expandedExpected:{fontSize:11,color:_sharedUi.macOSColors.semantic.warning,fontFamily:_sharedUi.monoFont,flex:1},expandedDescription:{fontSize:11,color:_sharedUi.night.color.textSecondary,flex:1},dataViewerContainer:{marginTop:6,marginBottom:6,backgroundColor:_sharedUi.night.color.bg,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.border,padding:6},rowContainer:{flexDirection:"row",alignItems:"flex-start"},rowContainerSelected:{backgroundColor:_sharedUi.night.color.accentSoft,borderRadius:8},checkboxContainer:{paddingLeft:4,paddingRight:8,paddingTop:10,alignSelf:"flex-start"},compactRowWrapper:{flex:1},absCountBadge:{position:"absolute",top:4,right:10,paddingHorizontal:5,paddingVertical:1,borderRadius:4,borderWidth:1,zIndex:1},absCountBadgeExpanded:{top:13},absCountText:{fontSize:9,fontWeight:"700",fontFamily:_sharedUi.monoFont},actionRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:8,marginTop:4},actionChip:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:6,paddingHorizontal:10,borderRadius:6,backgroundColor:_sharedUi.night.color.surface,borderWidth:1,borderColor:_sharedUi.night.color.border},dangerChip:{borderColor:_sharedUi.night.color.danger+"55"},actionChipActive:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorderStrong},editButton:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:8,paddingHorizontal:14,borderRadius:8,backgroundColor:_sharedUi.night.color.accent},editButtonText:{color:_sharedUi.night.color.onAccent,fontSize:12,fontWeight:"700"},actionChipText:{fontSize:11,fontWeight:"600",fontFamily:_sharedUi.monoFont},viewHistoryButton:{marginLeft:4},viewHistoryText:{fontSize:10,fontWeight:"600",fontFamily:_sharedUi.monoFont,color:_sharedUi.night.color.accent}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getStorageTypeColor=exports.getStatusConfig=exports.StorageKeyRow=void 0;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _storageQueryUtils=require("../utils/storageQueryUtils");var _valueType=require("../utils/valueType");var _dataViewer=require("@buoy-gg/shared-ui/dataViewer");var _jsxRuntime=require("react/jsx-runtime");const INSTANCE_COLORS=[_sharedUi.macOSColors.semantic.info,_sharedUi.macOSColors.semantic.success,_sharedUi.macOSColors.semantic.warning,_sharedUi.macOSColors.semantic.debug,"#FF6B9D","#00D9FF"];function getInstanceColor(t){const e=t.split("").reduce((r,l)=>r+l.charCodeAt(0),0);return INSTANCE_COLORS[e%INSTANCE_COLORS.length]}const getStatusConfig=t=>{switch(t){case"required_present":return{label:"Valid",color:_sharedUi.macOSColors.semantic.success,sublabel:"Required"};case"required_missing":return{label:"Missing",color:_sharedUi.macOSColors.semantic.error,sublabel:"Required"};case"required_wrong_value":return{label:"Wrong",color:_sharedUi.macOSColors.semantic.warning,sublabel:"Invalid value"};case"required_wrong_type":return{label:"Type Error",color:_sharedUi.macOSColors.semantic.info,sublabel:"Wrong type"};case"optional_present":return{label:"Set",color:_sharedUi.macOSColors.semantic.debug,sublabel:"Optional"};default:return{label:"Set",color:_sharedUi.macOSColors.text.secondary,sublabel:String(t)}}};exports.getStatusConfig=getStatusConfig;const formatValue=t=>{if(t===void 0||t===null){return"undefined"}const e=typeof t==="string"?t:JSON.stringify(t);return e};const StorageKeyRow=exports.StorageKeyRow=(0,_react.memo)(function t({storageKey:e,isExpanded:r,onPress:l,isSelectMode:d=false,isSelected:a=false,onSelectionChange:S,eventCount:o,onViewHistory:g,onHideKey:u,isPinned:n=false,onTogglePin:p,onEditKey:y,onToggleKey:c,onDeleteKey:m,editBlockedReason:x}){const h=y!=null&&x==null;const s=getStatusConfig(e.status);const f=e.value!==void 0&&e.value!==null;const i=f&&typeof e.value==="boolean";const T=e.key;const w=(0,_storageQueryUtils.getStorageTypeLabel)(e.storageType,e.instanceId);const b=(0,_valueType.parseStorageValue)(e.value);const j=b!==null&&typeof b==="object";const R=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedContainer,children:[(0,_jsxRuntime.jsx)(_sharedUi.ExpandedInfoRow,{label:"Storage",children:(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:getStorageTypeColor(e.storageType),children:w})}),e.storageType==="mmkv"&&e.instanceId&&(0,_jsxRuntime.jsx)(_sharedUi.ExpandedInfoRow,{label:"Instance",children:(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:getInstanceColor(e.instanceId),icon:(0,_jsxRuntime.jsx)(_sharedUi.HardDrive,{size:9,color:getInstanceColor(e.instanceId)}),children:e.instanceId})}),o!=null&&o>0&&(0,_jsxRuntime.jsxs)(_sharedUi.ExpandedInfoRow,{label:"Updates",children:[(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:_sharedUi.macOSColors.semantic.warning,children:String(o)}),o>1&&g&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:g,testID:"buoy-storage-key-history",accessibilityLabel:`View history for ${e.key}`,accessibilityRole:"button",style:styles.viewHistoryButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.viewHistoryText,children:"view history \u2192"})})]}),j?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dataViewerContainer,children:(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{data:b,title:"",showTypeFilter:true,rawMode:true,initialExpanded:true})}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedLabel,children:"Value:"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedValue,numberOfLines:3,children:formatValue(e.value)||"undefined"})]}),e.status==="required_wrong_type"&&e.expectedType&&(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedLabel,children:"Type:"}),(0,_jsxRuntime.jsx)(_sharedUi.TypeBadge,{type:(0,_valueType.getValueTypeLabel)(e.value)})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedLabel,children:"Expected:"}),(0,_jsxRuntime.jsx)(_sharedUi.TypeBadge,{type:e.expectedType})]})]}),e.status==="required_wrong_value"&&e.expectedValue&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedLabel,children:"Expected:"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedExpected,children:String(e.expectedValue)})]}),e.description?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedLabel,children:"Info:"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedDescription,children:e.description})]}):null,x?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.expandedRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedLabel,children:"Edit:"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.expandedDescription,children:x})]}):null,p||u||h?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.actionRow,children:[h?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.editButton,testID:"buoy-storage-key-edit",accessibilityLabel:i&&c?`Toggle ${e.key}`:`Edit ${e.key}`,accessibilityRole:"button",onPress:()=>i&&c?c(e):y?.(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.Edit3,{size:13,color:_sharedUi.night.color.onAccent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.editButtonText,children:i&&c?"Toggle":"Edit"})]}):null,p?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.actionChip,n&&styles.actionChipActive],testID:"buoy-storage-key-pin",accessibilityLabel:n?`Unpin ${e.key}`:`Pin ${e.key} to top`,accessibilityRole:"button",onPress:()=>p(e.key),hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.Pin,{size:12,active:n,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionChipText,{color:_sharedUi.night.color.accent}],children:n?"Unpin":"Pin to top"})]}):null,u?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.actionChip,testID:"buoy-storage-key-hide",accessibilityLabel:`Hide ${e.key} from list`,accessibilityRole:"button",onPress:()=>u(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.EyeOff,{size:12,color:_sharedUi.night.color.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionChipText,{color:_sharedUi.night.color.warning}],children:"Hide from list"})]}):null,h&&m?(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.actionChip,styles.dangerChip],testID:"buoy-storage-key-delete",accessibilityLabel:`Delete key ${e.key}`,accessibilityRole:"button",onPress:()=>m(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[(0,_jsxRuntime.jsx)(_sharedUi.Trash2,{size:12,color:_sharedUi.night.color.danger}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionChipText,{color:_sharedUi.night.color.danger}],children:"Delete key"})]}):null]}):null]});const C=()=>{S?.(e,!a)};const k=d?(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:C,testID:`buoy-storage-checkbox-${e.storageType}-${e.key}`,accessibilityLabel:`Select ${e.key}`,accessibilityRole:"checkbox",accessibilityState:{checked:a},style:styles.checkboxContainer,hitSlop:{top:8,bottom:8,left:8,right:8},children:a?(0,_jsxRuntime.jsx)(_sharedUi.CheckSquare,{size:18,color:_sharedUi.night.color.accent}):(0,_jsxRuntime.jsx)(_sharedUi.Square,{size:18,color:_sharedUi.night.color.textTertiary})}):null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.rowContainer,a&&styles.rowContainerSelected],children:[k,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.compactRowWrapper,children:[(0,_jsxRuntime.jsx)(_sharedUi.CompactRow,{statusDotColor:s.color,statusLabel:s.label,statusSublabel:s.sublabel,primaryText:T,secondaryText:f?i?(0,_valueType.getValueTypeLabel)(e.value):(0,_valueType.getValueTypeWithPreview)(e.value):void 0,secondaryAccessory:i?(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{size:"sm",color:e.value?_sharedUi.macOSColors.semantic.success:_sharedUi.macOSColors.semantic.error,children:e.value?"true":"false"}):void 0,expandedContent:R,isExpanded:r,expandedGlowColor:s.color,customBadge:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.badgeRow,children:[n&&(0,_jsxRuntime.jsx)(_sharedUi.Pin,{size:12,active:true,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:getStorageTypeColor(e.storageType),children:w})]}),showChevron:!d,onPress:d?C:l?()=>l(e):void 0,testID:`buoy-storage-row-${e.storageType}-${e.key}`,accessibilityLabel:`${e.storageType} ${e.key}`}),o!=null&&o>1&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.absCountBadge,r&&styles.absCountBadgeExpanded,{backgroundColor:_sharedUi.macOSColors.semantic.warning+"22",borderColor:_sharedUi.macOSColors.semantic.warning+"55"}],pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.absCountText,{color:_sharedUi.macOSColors.semantic.warning}],children:String(o)})})]})]})});const getStorageTypeColor=t=>{switch(t){case"mmkv":return _sharedUi.macOSColors.semantic.info;case"async":return _sharedUi.macOSColors.semantic.warning;case"secure":return _sharedUi.macOSColors.semantic.success;default:return _sharedUi.macOSColors.text.secondary}};exports.getStorageTypeColor=getStorageTypeColor;const styles=_reactNative.StyleSheet.create({badgeRow:{flexDirection:"row",alignItems:"center",gap:6},expandedContainer:{gap:8},expandedRow:{flexDirection:"row",alignItems:"center",gap:10},expandedLabel:{fontSize:10,color:_sharedUi.night.color.textTertiary,fontWeight:"600",minWidth:70,fontFamily:_sharedUi.monoFont},expandedValue:{fontSize:11,color:_sharedUi.night.color.textSecondary,fontFamily:_sharedUi.monoFont,flex:1},expandedExpected:{fontSize:11,color:_sharedUi.macOSColors.semantic.warning,fontFamily:_sharedUi.monoFont,flex:1},expandedDescription:{fontSize:11,color:_sharedUi.night.color.textSecondary,flex:1},dataViewerContainer:{marginTop:6,marginBottom:6,backgroundColor:_sharedUi.night.color.bg,borderRadius:6,borderWidth:1,borderColor:_sharedUi.night.color.border,padding:6},rowContainer:{flexDirection:"row",alignItems:"flex-start"},rowContainerSelected:{backgroundColor:_sharedUi.night.color.accentSoft,borderRadius:8},checkboxContainer:{paddingLeft:4,paddingRight:8,paddingTop:10,alignSelf:"flex-start"},compactRowWrapper:{flex:1},absCountBadge:{position:"absolute",top:4,right:10,paddingHorizontal:5,paddingVertical:1,borderRadius:4,borderWidth:1,zIndex:1},absCountBadgeExpanded:{top:13},absCountText:{fontSize:9,fontWeight:"700",fontFamily:_sharedUi.monoFont},actionRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:8,marginTop:4},actionChip:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:6,paddingHorizontal:10,borderRadius:6,backgroundColor:_sharedUi.night.color.surface,borderWidth:1,borderColor:_sharedUi.night.color.border},dangerChip:{borderColor:_sharedUi.night.color.danger+"55"},actionChipActive:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorderStrong},editButton:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:8,paddingHorizontal:14,borderRadius:8,backgroundColor:_sharedUi.night.color.accent},editButtonText:{color:_sharedUi.night.color.onAccent,fontSize:12,fontWeight:"700"},actionChipText:{fontSize:11,fontWeight:"600",fontFamily:_sharedUi.monoFont},viewHistoryButton:{marginLeft:4},viewHistoryText:{fontSize:10,fontWeight:"600",fontFamily:_sharedUi.monoFont,color:_sharedUi.night.color.accent}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StorageTypeFilterBar=StorageTypeFilterBar;exports.countByStorageType=countByStorageType;var _storageLabels=require("../utils/storageLabels");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");const SEGMENTS=[{id:"all",label:"All Types",color:null},{id:"async",label:_storageLabels.storageLabels.async,color:_sharedUi.macOSColors.semantic.warning},{id:"mmkv",label:_storageLabels.storageLabels.mmkv,color:_sharedUi.macOSColors.semantic.info},{id:"secure",label:"Secure",color:_sharedUi.macOSColors.semantic.success}];function StorageTypeFilterBar({active:r,onChange:o,counts:l}){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.row,children:SEGMENTS.filter(e=>_storageLabels.storageLabels.hasSecure||e.id!=="secure").map(e=>{const t=r===e.id;const i=e.color??_sharedUi.night.color.accent;return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{testID:`buoy-storage-type-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Filter by ${e.label}`,accessibilityState:{selected:t},activeOpacity:.8,onPress:()=>o(e.id),style:[styles.pill,{borderColor:_sharedUi.night.color.border},t&&[styles.pillActive,e.color?{backgroundColor:e.color+"15",borderColor:e.color+"40"}:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorderStrong}]],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.label,t&&{color:i,fontWeight:"600"}],children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.value,{color:t?i:_sharedUi.night.color.textTertiary}],children:l[e.id]})]},e.id)})})}function countByStorageType(r){const o={all:r.length,async:0,mmkv:0,secure:0};for(const l of r)o[l.storageType]+=1;return o}const styles=_reactNative.StyleSheet.create({row:{flexDirection:"row",gap:8,marginTop:2},pill:{flex:1,backgroundColor:_sharedUi.night.color.buttonSurface,borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.border,paddingVertical:6,paddingHorizontal:8,alignItems:"center",justifyContent:"center",minHeight:32},pillActive:{borderWidth:1,transform:[{scale:1.005}]},label:{fontSize:9,color:_sharedUi.night.color.textSecondary,textTransform:"uppercase",letterSpacing:.4,fontWeight:"500",marginBottom:1},value:{fontSize:12,fontWeight:"600",fontFamily:_sharedUi.monoFont,lineHeight:14}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StorageTypeFilterBar=StorageTypeFilterBar;exports.countByStorageType=countByStorageType;var _storageLabels=require("../utils/storageLabels");var _showsSecureStorage=require("../utils/showsSecureStorage");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");const SEGMENTS=[{id:"all",label:"All Types",color:null},{id:"async",label:_storageLabels.storageLabels.async,color:_sharedUi.macOSColors.semantic.warning},{id:"mmkv",label:_storageLabels.storageLabels.mmkv,color:_sharedUi.macOSColors.semantic.info},{id:"secure",label:"Secure",color:_sharedUi.macOSColors.semantic.success}];function StorageTypeFilterBar({active:r,onChange:o,counts:l}){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.row,children:SEGMENTS.filter(e=>(0,_showsSecureStorage.showsSecureStorage)()||e.id!=="secure").map(e=>{const t=r===e.id;const i=e.color??_sharedUi.night.color.accent;return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{testID:`buoy-storage-type-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Filter by ${e.label}`,accessibilityState:{selected:t},activeOpacity:.8,onPress:()=>o(e.id),style:[styles.pill,{borderColor:_sharedUi.night.color.border},t&&[styles.pillActive,e.color?{backgroundColor:e.color+"15",borderColor:e.color+"40"}:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorderStrong}]],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.label,t&&{color:i,fontWeight:"600"}],children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.value,{color:t?i:_sharedUi.night.color.textTertiary}],children:l[e.id]})]},e.id)})})}function countByStorageType(r){const o={all:r.length,async:0,mmkv:0,secure:0};for(const l of r)o[l.storageType]+=1;return o}const styles=_reactNative.StyleSheet.create({row:{flexDirection:"row",gap:8,marginTop:2},pill:{flex:1,backgroundColor:_sharedUi.night.color.buttonSurface,borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.border,paddingVertical:6,paddingHorizontal:8,alignItems:"center",justifyContent:"center",minHeight:32},pillActive:{borderWidth:1,transform:[{scale:1.005}]},label:{fontSize:9,color:_sharedUi.night.color.textSecondary,textTransform:"uppercase",letterSpacing:.4,fontWeight:"500",marginBottom:1},value:{fontSize:12,fontWeight:"600",fontFamily:_sharedUi.monoFont,lineHeight:14}});
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.showsSecureStorage=showsSecureStorage;var _storageLabels=require("./storageLabels");var _SecureStoreRegistry=require("./SecureStoreRegistry");function showsSecureStorage(){return _storageLabels.storageLabels.hasSecure||_SecureStoreRegistry.secureStoreRegistry.count()>0}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getStorageTypeHexColor=getStorageTypeHexColor;exports.getStorageTypeLabel=getStorageTypeLabel;var _sharedUi=require("@buoy-gg/shared-ui");var _storageLabels=require("./storageLabels");function getStorageTypeLabel(e){switch(e){case"mmkv":return _storageLabels.storageLabels.mmkv;case"async":return _storageLabels.storageLabels.async;case"secure":return"Secure";default:return e}}function getStorageTypeHexColor(e){switch(e){case"mmkv":return _sharedUi.gameUIColors.info;case"async":return _sharedUi.gameUIColors.warning;case"secure":return _sharedUi.gameUIColors.success;default:return _sharedUi.gameUIColors.muted}}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getStorageTypeHexColor=getStorageTypeHexColor;exports.getStorageTypeLabel=getStorageTypeLabel;var _sharedUi=require("@buoy-gg/shared-ui");var _storageLabels=require("./storageLabels");const BROWSER_AREAS=new Set(["sessionStorage","localStorage"]);function getStorageTypeLabel(e,r){switch(e){case"mmkv":return r&&!BROWSER_AREAS.has(r)?"MMKV":_storageLabels.storageLabels.mmkv;case"async":return _storageLabels.storageLabels.async;case"secure":return"Secure";default:return e}}function getStorageTypeHexColor(e){switch(e){case"mmkv":return _sharedUi.gameUIColors.info;case"async":return _sharedUi.gameUIColors.warning;case"secure":return _sharedUi.gameUIColors.success;default:return _sharedUi.gameUIColors.muted}}
@@ -1 +1 @@
1
- "use strict";import{storageLabels as i}from"../utils/storageLabels";import{View as l,Text as a,StyleSheet as p,TouchableOpacity as u}from"react-native";import{Filter as d,DynamicFilterView as v,Database as T,HardDrive as f,Shield as x,macOSColors as o,night as r}from"@buoy-gg/shared-ui";import{jsx as s,jsxs as c}from"react/jsx-runtime";export function StorageEventFilterView({ignoredPatterns:m,onTogglePattern:y,onAddPattern:h,availableKeys:g=[],enabledStorageTypes:t,onToggleStorageType:n}){const b={addFilterSection:{enabled:true,placeholder:"Enter key pattern to hide...",title:"KEY FILTERS",icon:d},availableItemsSection:{enabled:true,title:"AVAILABLE EVENT KEYS",emptyMessage:"No storage event keys available. Events will appear here once captured.",items:g},howItWorksSection:{enabled:true,title:"HOW EVENT FILTERS WORK",description:"Patterns hide matching storage keys from the event list. Storage type toggles control which storage backends are monitored.",examples:["\u2022 react_buoy \u2192 hides keys containing react_buoy","\u2022 @temp \u2192 hides @temp_user, @temp_data","\u2022 redux \u2192 hides redux-persist:root",`\u2022 ${i.asyncFull}: show or hide captured events`,`\u2022 ${i.mmkv}: show or hide captured events`],icon:d},onPatternToggle:y,onPatternAdd:h,activePatterns:m};return c(l,{style:e.container,children:[c(l,{style:e.storageTypeSection,children:[s(a,{style:e.sectionTitle,children:"STORAGE TYPES"}),c(l,{style:e.storageTypeButtons,children:[c(u,{style:[e.storageTypeButton,t.has("async")&&e.storageTypeButtonActive,{borderColor:o.semantic.warning+"40"}],onPress:()=>n("async"),testID:"buoy-storage-backend-async",accessibilityRole:"button",accessibilityLabel:`Toggle ${i.asyncFull} capture`,accessibilityState:{selected:t.has("async")},children:[s(T,{size:16,color:t.has("async")?o.semantic.warning:r.color.textTertiary}),s(a,{style:[e.storageTypeButtonText,t.has("async")&&{color:o.semantic.warning}],children:i.asyncFull})]}),c(u,{style:[e.storageTypeButton,t.has("mmkv")&&e.storageTypeButtonActive,{borderColor:o.semantic.info+"40"}],onPress:()=>n("mmkv"),testID:"buoy-storage-backend-mmkv",accessibilityRole:"button",accessibilityLabel:`Toggle ${i.mmkv} capture`,accessibilityState:{selected:t.has("mmkv")},children:[s(f,{size:16,color:t.has("mmkv")?o.semantic.info:r.color.textTertiary}),s(a,{style:[e.storageTypeButtonText,t.has("mmkv")&&{color:o.semantic.info}],children:i.mmkv})]}),i.hasSecure&&c(u,{style:[e.storageTypeButton,t.has("secure")&&e.storageTypeButtonActive,{borderColor:o.semantic.success+"40"}],onPress:()=>n("secure"),testID:"buoy-storage-backend-secure",accessibilityRole:"button",accessibilityLabel:"Toggle Secure Storage capture",accessibilityState:{selected:t.has("secure")},children:[s(x,{size:16,color:t.has("secure")?o.semantic.success:r.color.textTertiary}),s(a,{style:[e.storageTypeButtonText,t.has("secure")&&{color:o.semantic.success}],children:"Secure Storage"})]})]})]}),s(v,{...b})]})}const e=p.create({container:{flex:1},storageTypeSection:{padding:16,borderBottomWidth:1,borderBottomColor:r.color.border},sectionTitle:{fontSize:11,fontWeight:"700",color:r.color.textSecondary,letterSpacing:.8,marginBottom:12},storageTypeButtons:{flexDirection:"row",gap:8},storageTypeButton:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,paddingHorizontal:12,backgroundColor:r.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:r.color.border},storageTypeButtonActive:{backgroundColor:r.color.surface},storageTypeButtonText:{fontSize:11,fontWeight:"600",color:r.color.textTertiary}});
1
+ "use strict";import{storageLabels as i}from"../utils/storageLabels";import{showsSecureStorage as b}from"../utils/showsSecureStorage";import{View as l,Text as a,StyleSheet as v,TouchableOpacity as u}from"react-native";import{Filter as d,DynamicFilterView as f,Database as T,HardDrive as x,Shield as k,macOSColors as o,night as r}from"@buoy-gg/shared-ui";import{jsx as s,jsxs as c}from"react/jsx-runtime";export function StorageEventFilterView({ignoredPatterns:m,onTogglePattern:y,onAddPattern:h,availableKeys:g=[],enabledStorageTypes:t,onToggleStorageType:n}){const p={addFilterSection:{enabled:true,placeholder:"Enter key pattern to hide...",title:"KEY FILTERS",icon:d},availableItemsSection:{enabled:true,title:"AVAILABLE EVENT KEYS",emptyMessage:"No storage event keys available. Events will appear here once captured.",items:g},howItWorksSection:{enabled:true,title:"HOW EVENT FILTERS WORK",description:"Patterns hide matching storage keys from the event list. Storage type toggles control which storage backends are monitored.",examples:["\u2022 react_buoy \u2192 hides keys containing react_buoy","\u2022 @temp \u2192 hides @temp_user, @temp_data","\u2022 redux \u2192 hides redux-persist:root",`\u2022 ${i.asyncFull}: show or hide captured events`,`\u2022 ${i.mmkv}: show or hide captured events`],icon:d},onPatternToggle:y,onPatternAdd:h,activePatterns:m};return c(l,{style:e.container,children:[c(l,{style:e.storageTypeSection,children:[s(a,{style:e.sectionTitle,children:"STORAGE TYPES"}),c(l,{style:e.storageTypeButtons,children:[c(u,{style:[e.storageTypeButton,t.has("async")&&e.storageTypeButtonActive,{borderColor:o.semantic.warning+"40"}],onPress:()=>n("async"),testID:"buoy-storage-backend-async",accessibilityRole:"button",accessibilityLabel:`Toggle ${i.asyncFull} capture`,accessibilityState:{selected:t.has("async")},children:[s(T,{size:16,color:t.has("async")?o.semantic.warning:r.color.textTertiary}),s(a,{style:[e.storageTypeButtonText,t.has("async")&&{color:o.semantic.warning}],children:i.asyncFull})]}),c(u,{style:[e.storageTypeButton,t.has("mmkv")&&e.storageTypeButtonActive,{borderColor:o.semantic.info+"40"}],onPress:()=>n("mmkv"),testID:"buoy-storage-backend-mmkv",accessibilityRole:"button",accessibilityLabel:`Toggle ${i.mmkv} capture`,accessibilityState:{selected:t.has("mmkv")},children:[s(x,{size:16,color:t.has("mmkv")?o.semantic.info:r.color.textTertiary}),s(a,{style:[e.storageTypeButtonText,t.has("mmkv")&&{color:o.semantic.info}],children:i.mmkv})]}),b()&&c(u,{style:[e.storageTypeButton,t.has("secure")&&e.storageTypeButtonActive,{borderColor:o.semantic.success+"40"}],onPress:()=>n("secure"),testID:"buoy-storage-backend-secure",accessibilityRole:"button",accessibilityLabel:"Toggle Secure Storage capture",accessibilityState:{selected:t.has("secure")},children:[s(k,{size:16,color:t.has("secure")?o.semantic.success:r.color.textTertiary}),s(a,{style:[e.storageTypeButtonText,t.has("secure")&&{color:o.semantic.success}],children:"Secure Storage"})]})]})]}),s(f,{...p})]})}const e=v.create({container:{flex:1},storageTypeSection:{padding:16,borderBottomWidth:1,borderBottomColor:r.color.border},sectionTitle:{fontSize:11,fontWeight:"700",color:r.color.textSecondary,letterSpacing:.8,marginBottom:12},storageTypeButtons:{flexDirection:"row",gap:8},storageTypeButton:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,paddingHorizontal:12,backgroundColor:r.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:r.color.border},storageTypeButtonActive:{backgroundColor:r.color.surface},storageTypeButtonText:{fontSize:11,fontWeight:"600",color:r.color.textTertiary}});
@@ -1 +1 @@
1
- "use strict";import{View as l,Text as a,StyleSheet as H,TouchableOpacity as W}from"react-native";import{AlertCircle as C,CheckCircle2 as L,Eye as x,XCircle as T,HardDrive as S,Database as V,Shield as R,gameUIColors as u,macOSColors as o,night as n,monoFont as p}from"@buoy-gg/shared-ui";import{getStorageTypeLabel as D,getStorageTypeHexColor as E}from"../utils/storageQueryUtils";import{getValueTypeLabel as y}from"../utils/valueType";import{DataViewer as _}from"@buoy-gg/shared-ui/dataViewer";import{jsx as t,jsxs as i}from"react/jsx-runtime";const P={top:6,bottom:6,left:6,right:6};const v=[o.semantic.info,o.semantic.success,o.semantic.warning,o.semantic.debug,"#FF6B9D","#00D9FF"];function g(r){const s=r.split("").reduce((b,c)=>b+c.charCodeAt(0),0);return v[s%v.length]}const F=r=>{switch(r){case"required_present":return{icon:L,color:o.semantic.success,bgColor:o.semantic.successBackground,borderColor:o.semantic.success+"40",label:"REQUIRED",labelColor:o.semantic.success};case"required_missing":return{icon:C,color:o.semantic.error,bgColor:o.semantic.errorBackground,borderColor:o.semantic.error+"50",label:"MISSING",labelColor:o.semantic.error};case"required_wrong_value":return{icon:T,color:o.semantic.warning,bgColor:o.semantic.warningBackground,borderColor:o.semantic.warning+"50",label:"WRONG S",labelColor:o.semantic.warning};case"required_wrong_type":return{icon:T,color:o.semantic.info,bgColor:o.semantic.infoBackground,borderColor:o.semantic.info+"50",label:"WRONG TYPE",labelColor:o.semantic.info};case"optional_present":return{icon:x,color:o.semantic.debug,bgColor:o.semantic.infoBackground,borderColor:o.semantic.debug+"40",label:"OPTIONAL",labelColor:o.semantic.debug}}};const O=r=>{switch(r){case"mmkv":return S;case"async":return V;case"secure":return R;default:return V}};export function StorageKeyCard({storageKey:r,isExpanded:s,onToggle:b}){const c=F(r.status);const w=c.icon;const I=O(r.storageType);const m=r.value!==void 0&&r.value!==null;const f=r.expectedValue!==void 0;const B=r.expectedType!==void 0;const h=E(r.storageType);const k=D(r.storageType);return i(l,{style:[e.storageKeyCard,{borderColor:c.borderColor}],children:[i(W,{accessibilityLabel:"Storage key card",accessibilityHint:"View storage key card","sentry-label":`ignore storage key card ${r.key}`,accessibilityRole:"button",style:e.cardHeader,onPress:b,children:[i(l,{style:e.cardHeaderLeft,children:[t(l,{style:[e.iconContainer,{backgroundColor:c.bgColor}],children:t(w,{size:14,color:c.color})}),i(l,{style:e.cardHeaderInfo,children:[t(a,{style:e.storageKeyText,children:r.key}),r.description?t(a,{style:e.descriptionText,children:r.description}):null,i(l,{style:e.cardHeaderMeta,children:[t(l,{style:[e.statusBadge,{backgroundColor:c.bgColor}],children:t(a,{style:[e.statusText,{color:c.labelColor}],children:c.label})}),i(l,{style:[e.storageBadge,{backgroundColor:`${h}15`}],children:[t(I,{size:10,color:h}),t(a,{style:[e.storageText,{color:h}],children:k})]}),r.storageType==="mmkv"&&r.instanceId&&i(l,{style:[e.instanceBadge,{backgroundColor:g(r.instanceId)+"20",borderColor:g(r.instanceId)+"40"}],children:[t(S,{size:9,color:g(r.instanceId)}),t(a,{style:[e.instanceText,{color:g(r.instanceId)}],children:r.instanceId})]}),m&&t(l,{style:e.valueBadge,children:t(a,{style:e.valueText,children:r.valueType?r.valueType.toUpperCase():y(r.value)})})]})]})]}),t(l,{style:e.cardHeaderRight,children:t(l,{style:e.actionButton,children:t(x,{size:12,color:n.color.textSecondary})})})]}),s&&m&&i(l,{style:e.cardBody,children:[t(l,{style:e.dataViewerContainer,children:(()=>{const d=typeof r.value==="string"?(()=>{try{return JSON.parse(r.value)}catch{return r.value}})():r.value;const z=typeof d==="string"||typeof d==="number"||typeof d==="boolean";return z?i(l,{style:e.simpleValueContainer,children:[t(a,{style:e.simpleValueLabel,children:"Current Value:"}),t(l,{style:e.simpleValueBox,children:t(a,{style:e.simpleValueContent,selectable:true,children:String(d)})}),i(a,{style:e.valueTypeText,children:["Type: ",y(r.value)]})]}):t(_,{title:"Current Value",data:d,showTypeFilter:false,rawMode:true})})()}),f&&i(l,{style:e.valueContainer,children:[t(a,{style:e.valueLabel,children:"Expected Value:"}),t(l,{style:e.expectedValueBox,children:t(a,{style:e.expectedValueContent,selectable:true,children:r.expectedValue})})]}),B&&r.expectedType&&i(l,{style:e.valueContainer,children:[t(a,{style:e.valueLabel,children:"Expected Type:"}),t(l,{style:e.expectedValueBox,children:t(a,{style:e.expectedValueContent,selectable:true,children:r.expectedType.toUpperCase()})}),i(a,{style:e.typeHelperText,children:["Current type: ",y(r.value)]})]}),r.lastUpdated?t(l,{style:e.metaInfo,children:i(a,{style:e.metaLabel,children:["Last updated: ",r.lastUpdated.toLocaleString()]})}):null]}),s&&!m&&i(l,{style:e.cardBody,children:[i(l,{style:e.emptyValueContainer,children:[t(C,{size:16,color:o.semantic.warning}),t(a,{style:e.emptyValueText,children:"Storage key not found or empty"})]}),f&&i(l,{style:e.valueContainer,children:[t(a,{style:e.valueLabel,children:"Expected Value:"}),t(l,{style:e.expectedValueBox,children:t(a,{style:e.expectedValueContent,selectable:true,children:r.expectedValue})})]})]})]})}const e=H.create({storageKeyCard:{backgroundColor:n.color.surface,borderRadius:8,borderWidth:1,overflow:"hidden"},cardHeader:{padding:12,flexDirection:"row",alignItems:"center",justifyContent:"space-between"},cardHeaderLeft:{flexDirection:"row",alignItems:"center",flex:1,minWidth:0},iconContainer:{padding:6,borderRadius:6,marginRight:10},cardHeaderInfo:{flex:1,minWidth:0,gap:4},storageKeyText:{color:n.color.text,fontWeight:"500",fontSize:12,flexWrap:"wrap",flex:1},descriptionText:{color:n.color.textSecondary,fontSize:10,marginTop:2,flexWrap:"wrap"},cardHeaderMeta:{flexDirection:"row",alignItems:"center",gap:6,flexWrap:"wrap"},statusBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},statusText:{fontSize:9,fontWeight:"600",letterSpacing:.5},storageBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4,flexDirection:"row",alignItems:"center",gap:4},storageText:{fontSize:9,fontWeight:"600"},instanceBadge:{paddingHorizontal:6,paddingVertical:3,borderRadius:4,borderWidth:1,flexDirection:"row",alignItems:"center",gap:4},instanceText:{fontSize:9,fontWeight:"700",fontFamily:p,letterSpacing:.3},valueBadge:{paddingHorizontal:4,paddingVertical:2,backgroundColor:n.color.surfaceElevated,borderRadius:3},valueText:{fontSize:8,color:n.color.textSecondary,fontWeight:"500"},cardHeaderRight:{marginLeft:8},actionButton:{padding:4,borderRadius:4,backgroundColor:n.color.surfaceElevated},cardBody:{borderTopWidth:1,borderTopColor:n.color.separator,padding:12,gap:12},dataViewerContainer:{marginTop:8},simpleValueContainer:{gap:8},simpleValueLabel:{color:n.color.textSecondary,fontSize:10,fontWeight:"500",textTransform:"uppercase",letterSpacing:.5},simpleValueBox:{backgroundColor:n.color.bg,borderRadius:4,padding:10,borderWidth:1,borderColor:n.color.border},simpleValueContent:{color:u.success,fontSize:12,fontFamily:p,lineHeight:16},valueTypeText:{color:n.color.textTertiary,fontSize:9,fontStyle:"italic"},valueContainer:{gap:6},valueLabel:{color:n.color.textSecondary,fontSize:10,fontWeight:"500",textTransform:"uppercase",letterSpacing:.5},valueBox:{backgroundColor:n.color.bg,borderRadius:4,padding:8,borderWidth:1,borderColor:n.color.border},valueContent:{color:n.color.text,fontSize:10,fontFamily:p,lineHeight:14},expectedValueBox:{backgroundColor:n.color.bg,borderRadius:4,padding:8,borderWidth:1,borderColor:n.color.border},expectedValueContent:{color:n.color.text,fontSize:10,fontFamily:p,lineHeight:14},emptyValueContainer:{flexDirection:"row",alignItems:"center",gap:6,padding:8,backgroundColor:u.warning+"0D",borderRadius:4,borderWidth:1,borderColor:u.warning+"1A"},emptyValueText:{color:u.warning,fontSize:10,fontStyle:"italic"},typeHelperText:{color:n.color.textSecondary,fontSize:9,marginTop:4,textAlign:"center"},metaInfo:{marginTop:8},metaLabel:{color:n.color.textTertiary,fontSize:9,fontStyle:"italic"}});
1
+ "use strict";import{View as l,Text as a,StyleSheet as H,TouchableOpacity as W}from"react-native";import{AlertCircle as C,CheckCircle2 as L,Eye as x,XCircle as T,HardDrive as S,Database as V,Shield as R,gameUIColors as u,macOSColors as o,night as n,monoFont as p}from"@buoy-gg/shared-ui";import{getStorageTypeLabel as D,getStorageTypeHexColor as E}from"../utils/storageQueryUtils";import{getValueTypeLabel as f}from"../utils/valueType";import{DataViewer as _}from"@buoy-gg/shared-ui/dataViewer";import{jsx as t,jsxs as i}from"react/jsx-runtime";const P={top:6,bottom:6,left:6,right:6};const v=[o.semantic.info,o.semantic.success,o.semantic.warning,o.semantic.debug,"#FF6B9D","#00D9FF"];function g(r){const s=r.split("").reduce((b,c)=>b+c.charCodeAt(0),0);return v[s%v.length]}const F=r=>{switch(r){case"required_present":return{icon:L,color:o.semantic.success,bgColor:o.semantic.successBackground,borderColor:o.semantic.success+"40",label:"REQUIRED",labelColor:o.semantic.success};case"required_missing":return{icon:C,color:o.semantic.error,bgColor:o.semantic.errorBackground,borderColor:o.semantic.error+"50",label:"MISSING",labelColor:o.semantic.error};case"required_wrong_value":return{icon:T,color:o.semantic.warning,bgColor:o.semantic.warningBackground,borderColor:o.semantic.warning+"50",label:"WRONG S",labelColor:o.semantic.warning};case"required_wrong_type":return{icon:T,color:o.semantic.info,bgColor:o.semantic.infoBackground,borderColor:o.semantic.info+"50",label:"WRONG TYPE",labelColor:o.semantic.info};case"optional_present":return{icon:x,color:o.semantic.debug,bgColor:o.semantic.infoBackground,borderColor:o.semantic.debug+"40",label:"OPTIONAL",labelColor:o.semantic.debug}}};const O=r=>{switch(r){case"mmkv":return S;case"async":return V;case"secure":return R;default:return V}};export function StorageKeyCard({storageKey:r,isExpanded:s,onToggle:b}){const c=F(r.status);const w=c.icon;const I=O(r.storageType);const m=r.value!==void 0&&r.value!==null;const y=r.expectedValue!==void 0;const B=r.expectedType!==void 0;const h=E(r.storageType);const k=D(r.storageType,r.instanceId);return i(l,{style:[e.storageKeyCard,{borderColor:c.borderColor}],children:[i(W,{accessibilityLabel:"Storage key card",accessibilityHint:"View storage key card","sentry-label":`ignore storage key card ${r.key}`,accessibilityRole:"button",style:e.cardHeader,onPress:b,children:[i(l,{style:e.cardHeaderLeft,children:[t(l,{style:[e.iconContainer,{backgroundColor:c.bgColor}],children:t(w,{size:14,color:c.color})}),i(l,{style:e.cardHeaderInfo,children:[t(a,{style:e.storageKeyText,children:r.key}),r.description?t(a,{style:e.descriptionText,children:r.description}):null,i(l,{style:e.cardHeaderMeta,children:[t(l,{style:[e.statusBadge,{backgroundColor:c.bgColor}],children:t(a,{style:[e.statusText,{color:c.labelColor}],children:c.label})}),i(l,{style:[e.storageBadge,{backgroundColor:`${h}15`}],children:[t(I,{size:10,color:h}),t(a,{style:[e.storageText,{color:h}],children:k})]}),r.storageType==="mmkv"&&r.instanceId&&i(l,{style:[e.instanceBadge,{backgroundColor:g(r.instanceId)+"20",borderColor:g(r.instanceId)+"40"}],children:[t(S,{size:9,color:g(r.instanceId)}),t(a,{style:[e.instanceText,{color:g(r.instanceId)}],children:r.instanceId})]}),m&&t(l,{style:e.valueBadge,children:t(a,{style:e.valueText,children:r.valueType?r.valueType.toUpperCase():f(r.value)})})]})]})]}),t(l,{style:e.cardHeaderRight,children:t(l,{style:e.actionButton,children:t(x,{size:12,color:n.color.textSecondary})})})]}),s&&m&&i(l,{style:e.cardBody,children:[t(l,{style:e.dataViewerContainer,children:(()=>{const d=typeof r.value==="string"?(()=>{try{return JSON.parse(r.value)}catch{return r.value}})():r.value;const z=typeof d==="string"||typeof d==="number"||typeof d==="boolean";return z?i(l,{style:e.simpleValueContainer,children:[t(a,{style:e.simpleValueLabel,children:"Current Value:"}),t(l,{style:e.simpleValueBox,children:t(a,{style:e.simpleValueContent,selectable:true,children:String(d)})}),i(a,{style:e.valueTypeText,children:["Type: ",f(r.value)]})]}):t(_,{title:"Current Value",data:d,showTypeFilter:false,rawMode:true})})()}),y&&i(l,{style:e.valueContainer,children:[t(a,{style:e.valueLabel,children:"Expected Value:"}),t(l,{style:e.expectedValueBox,children:t(a,{style:e.expectedValueContent,selectable:true,children:r.expectedValue})})]}),B&&r.expectedType&&i(l,{style:e.valueContainer,children:[t(a,{style:e.valueLabel,children:"Expected Type:"}),t(l,{style:e.expectedValueBox,children:t(a,{style:e.expectedValueContent,selectable:true,children:r.expectedType.toUpperCase()})}),i(a,{style:e.typeHelperText,children:["Current type: ",f(r.value)]})]}),r.lastUpdated?t(l,{style:e.metaInfo,children:i(a,{style:e.metaLabel,children:["Last updated: ",r.lastUpdated.toLocaleString()]})}):null]}),s&&!m&&i(l,{style:e.cardBody,children:[i(l,{style:e.emptyValueContainer,children:[t(C,{size:16,color:o.semantic.warning}),t(a,{style:e.emptyValueText,children:"Storage key not found or empty"})]}),y&&i(l,{style:e.valueContainer,children:[t(a,{style:e.valueLabel,children:"Expected Value:"}),t(l,{style:e.expectedValueBox,children:t(a,{style:e.expectedValueContent,selectable:true,children:r.expectedValue})})]})]})]})}const e=H.create({storageKeyCard:{backgroundColor:n.color.surface,borderRadius:8,borderWidth:1,overflow:"hidden"},cardHeader:{padding:12,flexDirection:"row",alignItems:"center",justifyContent:"space-between"},cardHeaderLeft:{flexDirection:"row",alignItems:"center",flex:1,minWidth:0},iconContainer:{padding:6,borderRadius:6,marginRight:10},cardHeaderInfo:{flex:1,minWidth:0,gap:4},storageKeyText:{color:n.color.text,fontWeight:"500",fontSize:12,flexWrap:"wrap",flex:1},descriptionText:{color:n.color.textSecondary,fontSize:10,marginTop:2,flexWrap:"wrap"},cardHeaderMeta:{flexDirection:"row",alignItems:"center",gap:6,flexWrap:"wrap"},statusBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},statusText:{fontSize:9,fontWeight:"600",letterSpacing:.5},storageBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4,flexDirection:"row",alignItems:"center",gap:4},storageText:{fontSize:9,fontWeight:"600"},instanceBadge:{paddingHorizontal:6,paddingVertical:3,borderRadius:4,borderWidth:1,flexDirection:"row",alignItems:"center",gap:4},instanceText:{fontSize:9,fontWeight:"700",fontFamily:p,letterSpacing:.3},valueBadge:{paddingHorizontal:4,paddingVertical:2,backgroundColor:n.color.surfaceElevated,borderRadius:3},valueText:{fontSize:8,color:n.color.textSecondary,fontWeight:"500"},cardHeaderRight:{marginLeft:8},actionButton:{padding:4,borderRadius:4,backgroundColor:n.color.surfaceElevated},cardBody:{borderTopWidth:1,borderTopColor:n.color.separator,padding:12,gap:12},dataViewerContainer:{marginTop:8},simpleValueContainer:{gap:8},simpleValueLabel:{color:n.color.textSecondary,fontSize:10,fontWeight:"500",textTransform:"uppercase",letterSpacing:.5},simpleValueBox:{backgroundColor:n.color.bg,borderRadius:4,padding:10,borderWidth:1,borderColor:n.color.border},simpleValueContent:{color:u.success,fontSize:12,fontFamily:p,lineHeight:16},valueTypeText:{color:n.color.textTertiary,fontSize:9,fontStyle:"italic"},valueContainer:{gap:6},valueLabel:{color:n.color.textSecondary,fontSize:10,fontWeight:"500",textTransform:"uppercase",letterSpacing:.5},valueBox:{backgroundColor:n.color.bg,borderRadius:4,padding:8,borderWidth:1,borderColor:n.color.border},valueContent:{color:n.color.text,fontSize:10,fontFamily:p,lineHeight:14},expectedValueBox:{backgroundColor:n.color.bg,borderRadius:4,padding:8,borderWidth:1,borderColor:n.color.border},expectedValueContent:{color:n.color.text,fontSize:10,fontFamily:p,lineHeight:14},emptyValueContainer:{flexDirection:"row",alignItems:"center",gap:6,padding:8,backgroundColor:u.warning+"0D",borderRadius:4,borderWidth:1,borderColor:u.warning+"1A"},emptyValueText:{color:u.warning,fontSize:10,fontStyle:"italic"},typeHelperText:{color:n.color.textSecondary,fontSize:9,marginTop:4,textAlign:"center"},metaInfo:{marginTop:8},metaLabel:{color:n.color.textTertiary,fontSize:9,fontStyle:"italic"}});
@@ -1 +1 @@
1
- "use strict";import{useCallback as q,useMemo as B,useRef as H,useState as V}from"react";import{Alert as G,ScrollView as Y,StyleSheet as Q,Text as n,TouchableOpacity as m,View as l}from"react-native";import{EyeOff as X,FileJson as Z,HardDrive as K,night as i,macOSColors as b,Pin as ee,PillBadge as C,Trash2 as te,TypeBadge as oe,useSafeAreaInsets as ie,monoFont as h}from"@buoy-gg/shared-ui";import{DataViewer as ne,LiveExplorer as re,ValueEditModal as le,updateNestedDataByPath as ce,deleteNestedDataByPath as ae}from"@buoy-gg/shared-ui/dataViewer";import{getStorageTypeLabel as se}from"../utils/storageQueryUtils";import{getValueTypeLabel as E,parseStorageValue as de}from"../utils/valueType";import{getStatusConfig as he,getStorageTypeColor as fe}from"./StorageKeyRow";import{jsx as t,jsxs as r}from"react/jsx-runtime";const ue=300;const a="buoy-storage-detail";function pe(o){const y=s=>s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return o.length===0?`${a}-explorer-root`:`${a}-explorer-${o.map(y).filter(Boolean).join("-")}`}const $=[b.semantic.info,b.semantic.success,b.semantic.warning,b.semantic.debug,"#FF6B9D","#00D9FF"];function F(o){const y=o.split("").reduce((s,w)=>s+w.charCodeAt(0),0);return $[y%$.length]}export function StorageKeyDetailScreen({storageKey:o,editBlockedReason:y,eventCount:s,onSave:w,onViewHistory:L,onDeleteKey:T,onHideKey:D,isPinned:x=false,onTogglePin:k,applySafeAreaInset:W}){const O=ie();const P=W?O.bottom:0;const d=y==null;const I=he(o.status);const A=se(o.storageType);const[_,R]=V(false);const[N,j]=V(0);const f=H(null);const M=B(()=>de(o.value),[o.value]);const z=typeof o.value==="string"?o.value:JSON.stringify(o.value);if(f.current&&f.current.raw===z){f.current=null}const u=f.current?f.current.value:M;const S=q(c=>{const p=typeof c==="string"?c:JSON.stringify(c);f.current={raw:p,value:c};w(p).catch(g=>{f.current=null;G.alert("Couldn't save",g instanceof Error?g.message:String(g))})},[w]);const v=H(u);v.current=u;const J=B(()=>{if(!d)return void 0;return{update:(c,p)=>{const g=c.length===0?p:ce(v.current,c,p);S(g)},remove:c=>{if(c.length===0)return;S(ae(v.current,c))}}},[d,S]);const U=k||D||d&&T;return r(l,{style:e.screen,children:[t(l,{testID:`${a}-key`,accessibilityLabel:o.key}),r(Y,{testID:`${a}-scroll`,style:e.scroll,contentContainerStyle:[e.scrollContent,{paddingBottom:24+P}],keyboardShouldPersistTaps:"handled",children:[t(l,{style:e.section,children:r(l,{style:e.editorContainer,children:[r(l,{style:e.sectionHeaderRow,children:[t(n,{testID:`${a}-editor-header`,style:e.sectionHeaderAccentText,children:"Value Editor"}),d?r(m,{onPress:()=>R(true),testID:`${a}-raw`,accessibilityRole:"button",accessibilityLabel:"Edit raw JSON",style:e.rawButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(Z,{size:13,color:i.color.accent}),t(n,{style:e.rawButtonText,children:"Raw"})]}):null]}),r(l,{style:e.sectionBody,children:[t(re,{editable:d,label:"Value",value:u,defaultExpanded:["Value"],writer:J,dataVersion:N,testIDForPath:pe,debounceMs:ue}),d?t(n,{style:e.editorHint,children:"Edits write to the device as you make them \u2014 undo lives in the key's history."}):t(n,{style:e.blockedText,testID:`${a}-edit-blocked`,children:y})]})]})}),t(l,{style:e.section,children:r(l,{style:e.infoContainer,children:[t(n,{style:e.sectionHeaderPlain,children:"Key Details"}),r(l,{style:e.infoBody,children:[r(l,{style:e.infoRow,children:[t(n,{style:e.infoLabel,children:"Status:"}),t(C,{color:I.color,testID:`${a}-status`,children:I.label}),t(n,{style:e.infoDim,children:I.sublabel})]}),r(l,{style:e.infoRow,children:[t(n,{style:e.infoLabel,children:"Storage:"}),t(C,{color:fe(o.storageType),testID:`${a}-backend`,children:A}),t(n,{style:e.infoDim,children:E(o.value)})]}),o.storageType==="mmkv"&&o.instanceId&&r(l,{style:e.infoRow,children:[t(n,{style:e.infoLabel,children:"Instance:"}),t(C,{color:F(o.instanceId),icon:t(K,{size:9,color:F(o.instanceId)}),children:o.instanceId})]}),s!=null&&s>0&&r(l,{style:e.infoRow,children:[t(n,{style:e.infoLabel,children:"Updates:"}),t(C,{color:b.semantic.warning,children:String(s)}),s>1&&L&&t(m,{onPress:L,testID:"buoy-storage-key-history",accessibilityLabel:`View history for ${o.key}`,accessibilityRole:"button",style:e.inlineLinkButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:t(n,{style:e.inlineLinkText,children:"view history \u2192"})})]}),o.status==="required_wrong_type"&&o.expectedType&&r(l,{style:e.infoRow,children:[t(n,{style:e.infoLabel,children:"Expected:"}),t(oe,{type:o.expectedType}),r(n,{style:e.infoDim,children:["got ",E(o.value)]})]}),o.status==="required_wrong_value"&&o.expectedValue&&r(l,{style:e.infoRow,children:[t(n,{style:e.infoLabel,children:"Expected:"}),t(n,{style:e.infoExpected,children:String(o.expectedValue)})]}),o.description?r(l,{style:e.infoRow,children:[t(n,{style:e.infoLabel,children:"Info:"}),t(n,{style:e.infoDescription,children:o.description})]}):null]})]})}),t(l,{style:e.section,children:r(l,{style:e.infoContainer,children:[t(n,{style:e.sectionHeaderPlain,children:"Value Explorer"}),t(l,{style:e.viewerBody,testID:`${a}-viewer`,children:u!==null&&typeof u==="object"?t(ne,{title:"",data:u,showTypeFilter:true,rawMode:true,initialExpanded:false}):t(n,{style:e.rawValueText,selectable:true,children:z??"undefined"})})]})}),U?r(l,{style:e.actionRow,children:[k?r(m,{style:[e.actionChip,x&&e.actionChipActive],testID:"buoy-storage-key-pin",accessibilityLabel:x?`Unpin ${o.key}`:`Pin ${o.key} to top`,accessibilityRole:"button",onPress:()=>k(o.key),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(ee,{size:12,active:x,color:i.color.accent}),t(n,{style:[e.actionChipText,{color:i.color.accent}],children:x?"Unpin":"Pin to top"})]}):null,D?r(m,{style:e.actionChip,testID:"buoy-storage-key-hide",accessibilityLabel:`Hide ${o.key} from list`,accessibilityRole:"button",onPress:()=>D(o),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(X,{size:12,color:i.color.warning}),t(n,{style:[e.actionChipText,{color:i.color.warning}],children:"Hide from list"})]}):null,d&&T?r(m,{style:[e.actionChip,e.dangerChip],testID:"buoy-storage-key-delete",accessibilityLabel:`Delete key ${o.key}`,accessibilityRole:"button",onPress:()=>T(o),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(te,{size:12,color:i.color.danger}),t(n,{style:[e.actionChipText,{color:i.color.danger}],children:"Delete key"})]}):null]}):null]}),_&&d?t(le,{path:[],value:u,onSave:c=>{S(c);j(p=>p+1);R(false)},onCancel:()=>R(false),saveLabel:"Apply",testIDPrefix:"buoy-storage-value"}):null]})}const e=Q.create({screen:{flex:1,minHeight:0},scroll:{flex:1},scrollContent:{paddingHorizontal:8,paddingTop:8},section:{marginBottom:16},editorContainer:{minWidth:200,backgroundColor:i.color.surface,borderRadius:6,borderWidth:1,borderColor:i.color.accent+"4D",overflow:"hidden",shadowColor:i.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},sectionHeaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",backgroundColor:i.color.accent+"1A",paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:i.color.accent+"33"},sectionHeaderAccentText:{fontWeight:"600",fontSize:12,color:i.color.accent,letterSpacing:.5,textTransform:"uppercase",fontFamily:h},rawButton:{flexDirection:"row",alignItems:"center",gap:4},rawButtonText:{color:i.color.accent,fontSize:11,fontWeight:"700"},sectionBody:{padding:8},editorHint:{color:i.color.textTertiary,fontSize:10,paddingTop:8,paddingHorizontal:4,lineHeight:14},blockedText:{color:i.color.textSecondary,fontSize:12,padding:12,lineHeight:18},infoContainer:{minWidth:200,backgroundColor:i.color.surface,borderRadius:6,borderWidth:1,borderColor:i.color.border,overflow:"hidden"},sectionHeaderPlain:{backgroundColor:i.color.surfaceElevated,paddingHorizontal:12,paddingVertical:8,fontWeight:"600",fontSize:12,color:i.color.textSecondary,borderBottomWidth:1,borderBottomColor:i.color.border,letterSpacing:.5,textTransform:"uppercase",fontFamily:h},infoBody:{padding:12,gap:10},infoRow:{flexDirection:"row",alignItems:"center",gap:8},infoLabel:{fontSize:10,color:i.color.textTertiary,fontWeight:"600",minWidth:64,fontFamily:h},infoDim:{color:i.color.textTertiary,fontSize:10,fontFamily:h},infoExpected:{fontSize:11,color:b.semantic.warning,fontFamily:h,flex:1},infoDescription:{fontSize:11,color:i.color.textSecondary,flex:1},rawValueText:{color:i.color.textSecondary,fontSize:11,fontFamily:h,lineHeight:16,padding:12},viewerBody:{backgroundColor:i.color.bg,minHeight:48},inlineLinkButton:{marginLeft:4},inlineLinkText:{fontSize:10,fontWeight:"600",fontFamily:h,color:i.color.accent},actionRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:8,paddingHorizontal:4},actionChip:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:6,paddingHorizontal:10,borderRadius:6,backgroundColor:i.color.surface,borderWidth:1,borderColor:i.color.border},dangerChip:{borderColor:i.color.danger+"55"},actionChipActive:{backgroundColor:i.color.accentSoft,borderColor:i.color.accentBorderStrong},actionChipText:{fontSize:11,fontWeight:"600",fontFamily:h}});
1
+ "use strict";import{useCallback as q,useMemo as B,useRef as H,useState as V}from"react";import{Alert as G,ScrollView as Y,StyleSheet as Q,Text as n,TouchableOpacity as m,View as l}from"react-native";import{EyeOff as X,FileJson as Z,HardDrive as K,night as i,macOSColors as b,Pin as ee,PillBadge as C,Trash2 as te,TypeBadge as oe,useSafeAreaInsets as ie,monoFont as h}from"@buoy-gg/shared-ui";import{DataViewer as ne,LiveExplorer as re,ValueEditModal as le,updateNestedDataByPath as ce,deleteNestedDataByPath as ae}from"@buoy-gg/shared-ui/dataViewer";import{getStorageTypeLabel as se}from"../utils/storageQueryUtils";import{getValueTypeLabel as E,parseStorageValue as de}from"../utils/valueType";import{getStatusConfig as he,getStorageTypeColor as fe}from"./StorageKeyRow";import{jsx as t,jsxs as r}from"react/jsx-runtime";const ue=300;const a="buoy-storage-detail";function pe(o){const y=s=>s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return o.length===0?`${a}-explorer-root`:`${a}-explorer-${o.map(y).filter(Boolean).join("-")}`}const $=[b.semantic.info,b.semantic.success,b.semantic.warning,b.semantic.debug,"#FF6B9D","#00D9FF"];function F(o){const y=o.split("").reduce((s,w)=>s+w.charCodeAt(0),0);return $[y%$.length]}export function StorageKeyDetailScreen({storageKey:o,editBlockedReason:y,eventCount:s,onSave:w,onViewHistory:L,onDeleteKey:T,onHideKey:D,isPinned:x=false,onTogglePin:I,applySafeAreaInset:W}){const O=ie();const P=W?O.bottom:0;const d=y==null;const k=he(o.status);const A=se(o.storageType,o.instanceId);const[_,R]=V(false);const[N,j]=V(0);const f=H(null);const M=B(()=>de(o.value),[o.value]);const z=typeof o.value==="string"?o.value:JSON.stringify(o.value);if(f.current&&f.current.raw===z){f.current=null}const u=f.current?f.current.value:M;const S=q(c=>{const p=typeof c==="string"?c:JSON.stringify(c);f.current={raw:p,value:c};w(p).catch(g=>{f.current=null;G.alert("Couldn't save",g instanceof Error?g.message:String(g))})},[w]);const v=H(u);v.current=u;const J=B(()=>{if(!d)return void 0;return{update:(c,p)=>{const g=c.length===0?p:ce(v.current,c,p);S(g)},remove:c=>{if(c.length===0)return;S(ae(v.current,c))}}},[d,S]);const U=I||D||d&&T;return r(l,{style:e.screen,children:[t(l,{testID:`${a}-key`,accessibilityLabel:o.key}),r(Y,{testID:`${a}-scroll`,style:e.scroll,contentContainerStyle:[e.scrollContent,{paddingBottom:24+P}],keyboardShouldPersistTaps:"handled",children:[t(l,{style:e.section,children:r(l,{style:e.editorContainer,children:[r(l,{style:e.sectionHeaderRow,children:[t(n,{testID:`${a}-editor-header`,style:e.sectionHeaderAccentText,children:"Value Editor"}),d?r(m,{onPress:()=>R(true),testID:`${a}-raw`,accessibilityRole:"button",accessibilityLabel:"Edit raw JSON",style:e.rawButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(Z,{size:13,color:i.color.accent}),t(n,{style:e.rawButtonText,children:"Raw"})]}):null]}),r(l,{style:e.sectionBody,children:[t(re,{editable:d,label:"Value",value:u,defaultExpanded:["Value"],writer:J,dataVersion:N,testIDForPath:pe,debounceMs:ue}),d?t(n,{style:e.editorHint,children:"Edits write to the device as you make them \u2014 undo lives in the key's history."}):t(n,{style:e.blockedText,testID:`${a}-edit-blocked`,children:y})]})]})}),t(l,{style:e.section,children:r(l,{style:e.infoContainer,children:[t(n,{style:e.sectionHeaderPlain,children:"Key Details"}),r(l,{style:e.infoBody,children:[r(l,{style:e.infoRow,children:[t(n,{style:e.infoLabel,children:"Status:"}),t(C,{color:k.color,testID:`${a}-status`,children:k.label}),t(n,{style:e.infoDim,children:k.sublabel})]}),r(l,{style:e.infoRow,children:[t(n,{style:e.infoLabel,children:"Storage:"}),t(C,{color:fe(o.storageType),testID:`${a}-backend`,children:A}),t(n,{style:e.infoDim,children:E(o.value)})]}),o.storageType==="mmkv"&&o.instanceId&&r(l,{style:e.infoRow,children:[t(n,{style:e.infoLabel,children:"Instance:"}),t(C,{color:F(o.instanceId),icon:t(K,{size:9,color:F(o.instanceId)}),children:o.instanceId})]}),s!=null&&s>0&&r(l,{style:e.infoRow,children:[t(n,{style:e.infoLabel,children:"Updates:"}),t(C,{color:b.semantic.warning,children:String(s)}),s>1&&L&&t(m,{onPress:L,testID:"buoy-storage-key-history",accessibilityLabel:`View history for ${o.key}`,accessibilityRole:"button",style:e.inlineLinkButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:t(n,{style:e.inlineLinkText,children:"view history \u2192"})})]}),o.status==="required_wrong_type"&&o.expectedType&&r(l,{style:e.infoRow,children:[t(n,{style:e.infoLabel,children:"Expected:"}),t(oe,{type:o.expectedType}),r(n,{style:e.infoDim,children:["got ",E(o.value)]})]}),o.status==="required_wrong_value"&&o.expectedValue&&r(l,{style:e.infoRow,children:[t(n,{style:e.infoLabel,children:"Expected:"}),t(n,{style:e.infoExpected,children:String(o.expectedValue)})]}),o.description?r(l,{style:e.infoRow,children:[t(n,{style:e.infoLabel,children:"Info:"}),t(n,{style:e.infoDescription,children:o.description})]}):null]})]})}),t(l,{style:e.section,children:r(l,{style:e.infoContainer,children:[t(n,{style:e.sectionHeaderPlain,children:"Value Explorer"}),t(l,{style:e.viewerBody,testID:`${a}-viewer`,children:u!==null&&typeof u==="object"?t(ne,{title:"",data:u,showTypeFilter:true,rawMode:true,initialExpanded:false}):t(n,{style:e.rawValueText,selectable:true,children:z??"undefined"})})]})}),U?r(l,{style:e.actionRow,children:[I?r(m,{style:[e.actionChip,x&&e.actionChipActive],testID:"buoy-storage-key-pin",accessibilityLabel:x?`Unpin ${o.key}`:`Pin ${o.key} to top`,accessibilityRole:"button",onPress:()=>I(o.key),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(ee,{size:12,active:x,color:i.color.accent}),t(n,{style:[e.actionChipText,{color:i.color.accent}],children:x?"Unpin":"Pin to top"})]}):null,D?r(m,{style:e.actionChip,testID:"buoy-storage-key-hide",accessibilityLabel:`Hide ${o.key} from list`,accessibilityRole:"button",onPress:()=>D(o),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(X,{size:12,color:i.color.warning}),t(n,{style:[e.actionChipText,{color:i.color.warning}],children:"Hide from list"})]}):null,d&&T?r(m,{style:[e.actionChip,e.dangerChip],testID:"buoy-storage-key-delete",accessibilityLabel:`Delete key ${o.key}`,accessibilityRole:"button",onPress:()=>T(o),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(te,{size:12,color:i.color.danger}),t(n,{style:[e.actionChipText,{color:i.color.danger}],children:"Delete key"})]}):null]}):null]}),_&&d?t(le,{path:[],value:u,onSave:c=>{S(c);j(p=>p+1);R(false)},onCancel:()=>R(false),saveLabel:"Apply",testIDPrefix:"buoy-storage-value"}):null]})}const e=Q.create({screen:{flex:1,minHeight:0},scroll:{flex:1},scrollContent:{paddingHorizontal:8,paddingTop:8},section:{marginBottom:16},editorContainer:{minWidth:200,backgroundColor:i.color.surface,borderRadius:6,borderWidth:1,borderColor:i.color.accent+"4D",overflow:"hidden",shadowColor:i.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:6},sectionHeaderRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",backgroundColor:i.color.accent+"1A",paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:i.color.accent+"33"},sectionHeaderAccentText:{fontWeight:"600",fontSize:12,color:i.color.accent,letterSpacing:.5,textTransform:"uppercase",fontFamily:h},rawButton:{flexDirection:"row",alignItems:"center",gap:4},rawButtonText:{color:i.color.accent,fontSize:11,fontWeight:"700"},sectionBody:{padding:8},editorHint:{color:i.color.textTertiary,fontSize:10,paddingTop:8,paddingHorizontal:4,lineHeight:14},blockedText:{color:i.color.textSecondary,fontSize:12,padding:12,lineHeight:18},infoContainer:{minWidth:200,backgroundColor:i.color.surface,borderRadius:6,borderWidth:1,borderColor:i.color.border,overflow:"hidden"},sectionHeaderPlain:{backgroundColor:i.color.surfaceElevated,paddingHorizontal:12,paddingVertical:8,fontWeight:"600",fontSize:12,color:i.color.textSecondary,borderBottomWidth:1,borderBottomColor:i.color.border,letterSpacing:.5,textTransform:"uppercase",fontFamily:h},infoBody:{padding:12,gap:10},infoRow:{flexDirection:"row",alignItems:"center",gap:8},infoLabel:{fontSize:10,color:i.color.textTertiary,fontWeight:"600",minWidth:64,fontFamily:h},infoDim:{color:i.color.textTertiary,fontSize:10,fontFamily:h},infoExpected:{fontSize:11,color:b.semantic.warning,fontFamily:h,flex:1},infoDescription:{fontSize:11,color:i.color.textSecondary,flex:1},rawValueText:{color:i.color.textSecondary,fontSize:11,fontFamily:h,lineHeight:16,padding:12},viewerBody:{backgroundColor:i.color.bg,minHeight:48},inlineLinkButton:{marginLeft:4},inlineLinkText:{fontSize:10,fontWeight:"600",fontFamily:h,color:i.color.accent},actionRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:8,paddingHorizontal:4},actionChip:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:6,paddingHorizontal:10,borderRadius:6,backgroundColor:i.color.surface,borderWidth:1,borderColor:i.color.border},dangerChip:{borderColor:i.color.danger+"55"},actionChipActive:{backgroundColor:i.color.accentSoft,borderColor:i.color.accentBorderStrong},actionChipText:{fontSize:11,fontWeight:"600",fontFamily:h}});
@@ -1 +1 @@
1
- "use strict";import{memo as j}from"react";import{View as a,Text as l,StyleSheet as N,TouchableOpacity as s}from"react-native";import{macOSColors as r,night as n,CompactRow as U,TypeBadge as B,HardDrive as G,Square as J,CheckSquare as M,Edit3 as Q,EyeOff as X,Pin as W,Trash2 as Y,ExpandedInfoRow as I,PillBadge as h,monoFont as p}from"@buoy-gg/shared-ui";import{getStorageTypeLabel as Z}from"../utils/storageQueryUtils";import{getValueTypeLabel as _,getValueTypeWithPreview as K,parseStorageValue as ee}from"../utils/valueType";import{DataViewer as te}from"@buoy-gg/shared-ui/dataViewer";import{jsx as t,jsxs as i,Fragment as oe}from"react/jsx-runtime";const F=[r.semantic.info,r.semantic.success,r.semantic.warning,r.semantic.debug,"#FF6B9D","#00D9FF"];function $(c){const e=c.split("").reduce((f,x)=>f+x.charCodeAt(0),0);return F[e%F.length]}export const getStatusConfig=c=>{switch(c){case"required_present":return{label:"Valid",color:r.semantic.success,sublabel:"Required"};case"required_missing":return{label:"Missing",color:r.semantic.error,sublabel:"Required"};case"required_wrong_value":return{label:"Wrong",color:r.semantic.warning,sublabel:"Invalid value"};case"required_wrong_type":return{label:"Type Error",color:r.semantic.info,sublabel:"Wrong type"};case"optional_present":return{label:"Set",color:r.semantic.debug,sublabel:"Optional"};default:return{label:"Set",color:r.text.secondary,sublabel:String(c)}}};const ne=c=>{if(c===void 0||c===null){return"undefined"}const e=typeof c==="string"?c:JSON.stringify(c);return e};export const StorageKeyRow=j(function c({storageKey:e,isExpanded:f,onPress:x,isSelectMode:w=false,isSelected:m=false,onSelectionChange:q,eventCount:d,onViewHistory:D,onHideKey:C,isPinned:u=false,onTogglePin:S,onEditKey:L,onToggleKey:y,onDeleteKey:z,editBlockedReason:T}){const k=L!=null&&T==null;const g=getStatusConfig(e.status);const v=e.value!==void 0&&e.value!==null;const b=v&&typeof e.value==="boolean";const O=e.key;const V=Z(e.storageType);const R=ee(e.value);const A=R!==null&&typeof R==="object";const H=i(a,{style:o.expandedContainer,children:[t(I,{label:"Storage",children:t(h,{color:getStorageTypeColor(e.storageType),children:V})}),e.storageType==="mmkv"&&e.instanceId&&t(I,{label:"Instance",children:t(h,{color:$(e.instanceId),icon:t(G,{size:9,color:$(e.instanceId)}),children:e.instanceId})}),d!=null&&d>0&&i(I,{label:"Updates",children:[t(h,{color:r.semantic.warning,children:String(d)}),d>1&&D&&t(s,{onPress:D,testID:"buoy-storage-key-history",accessibilityLabel:`View history for ${e.key}`,accessibilityRole:"button",style:o.viewHistoryButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:t(l,{style:o.viewHistoryText,children:"view history \u2192"})})]}),A?t(a,{style:o.dataViewerContainer,children:t(te,{data:R,title:"",showTypeFilter:true,rawMode:true,initialExpanded:true})}):i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Value:"}),t(l,{style:o.expandedValue,numberOfLines:3,children:ne(e.value)||"undefined"})]}),e.status==="required_wrong_type"&&e.expectedType&&i(oe,{children:[i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Type:"}),t(B,{type:_(e.value)})]}),i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Expected:"}),t(B,{type:e.expectedType})]})]}),e.status==="required_wrong_value"&&e.expectedValue&&i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Expected:"}),t(l,{style:o.expandedExpected,children:String(e.expectedValue)})]}),e.description?i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Info:"}),t(l,{style:o.expandedDescription,children:e.description})]}):null,T?i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Edit:"}),t(l,{style:o.expandedDescription,children:T})]}):null,S||C||k?i(a,{style:o.actionRow,children:[k?i(s,{style:o.editButton,testID:"buoy-storage-key-edit",accessibilityLabel:b&&y?`Toggle ${e.key}`:`Edit ${e.key}`,accessibilityRole:"button",onPress:()=>b&&y?y(e):L?.(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(Q,{size:13,color:n.color.onAccent}),t(l,{style:o.editButtonText,children:b&&y?"Toggle":"Edit"})]}):null,S?i(s,{style:[o.actionChip,u&&o.actionChipActive],testID:"buoy-storage-key-pin",accessibilityLabel:u?`Unpin ${e.key}`:`Pin ${e.key} to top`,accessibilityRole:"button",onPress:()=>S(e.key),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(W,{size:12,active:u,color:n.color.accent}),t(l,{style:[o.actionChipText,{color:n.color.accent}],children:u?"Unpin":"Pin to top"})]}):null,C?i(s,{style:o.actionChip,testID:"buoy-storage-key-hide",accessibilityLabel:`Hide ${e.key} from list`,accessibilityRole:"button",onPress:()=>C(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(X,{size:12,color:n.color.warning}),t(l,{style:[o.actionChipText,{color:n.color.warning}],children:"Hide from list"})]}):null,k&&z?i(s,{style:[o.actionChip,o.dangerChip],testID:"buoy-storage-key-delete",accessibilityLabel:`Delete key ${e.key}`,accessibilityRole:"button",onPress:()=>z(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(Y,{size:12,color:n.color.danger}),t(l,{style:[o.actionChipText,{color:n.color.danger}],children:"Delete key"})]}):null]}):null]});const E=()=>{q?.(e,!m)};const P=w?t(s,{onPress:E,testID:`buoy-storage-checkbox-${e.storageType}-${e.key}`,accessibilityLabel:`Select ${e.key}`,accessibilityRole:"checkbox",accessibilityState:{checked:m},style:o.checkboxContainer,hitSlop:{top:8,bottom:8,left:8,right:8},children:m?t(M,{size:18,color:n.color.accent}):t(J,{size:18,color:n.color.textTertiary})}):null;return i(a,{style:[o.rowContainer,m&&o.rowContainerSelected],children:[P,i(a,{style:o.compactRowWrapper,children:[t(U,{statusDotColor:g.color,statusLabel:g.label,statusSublabel:g.sublabel,primaryText:O,secondaryText:v?b?_(e.value):K(e.value):void 0,secondaryAccessory:b?t(h,{size:"sm",color:e.value?r.semantic.success:r.semantic.error,children:e.value?"true":"false"}):void 0,expandedContent:H,isExpanded:f,expandedGlowColor:g.color,customBadge:i(a,{style:o.badgeRow,children:[u&&t(W,{size:12,active:true,color:n.color.accent}),t(h,{color:getStorageTypeColor(e.storageType),children:V})]}),showChevron:!w,onPress:w?E:x?()=>x(e):void 0,testID:`buoy-storage-row-${e.storageType}-${e.key}`,accessibilityLabel:`${e.storageType} ${e.key}`}),d!=null&&d>1&&t(a,{style:[o.absCountBadge,f&&o.absCountBadgeExpanded,{backgroundColor:r.semantic.warning+"22",borderColor:r.semantic.warning+"55"}],pointerEvents:"none",children:t(l,{style:[o.absCountText,{color:r.semantic.warning}],children:String(d)})})]})]})});export const getStorageTypeColor=c=>{switch(c){case"mmkv":return r.semantic.info;case"async":return r.semantic.warning;case"secure":return r.semantic.success;default:return r.text.secondary}};const o=N.create({badgeRow:{flexDirection:"row",alignItems:"center",gap:6},expandedContainer:{gap:8},expandedRow:{flexDirection:"row",alignItems:"center",gap:10},expandedLabel:{fontSize:10,color:n.color.textTertiary,fontWeight:"600",minWidth:70,fontFamily:p},expandedValue:{fontSize:11,color:n.color.textSecondary,fontFamily:p,flex:1},expandedExpected:{fontSize:11,color:r.semantic.warning,fontFamily:p,flex:1},expandedDescription:{fontSize:11,color:n.color.textSecondary,flex:1},dataViewerContainer:{marginTop:6,marginBottom:6,backgroundColor:n.color.bg,borderRadius:6,borderWidth:1,borderColor:n.color.border,padding:6},rowContainer:{flexDirection:"row",alignItems:"flex-start"},rowContainerSelected:{backgroundColor:n.color.accentSoft,borderRadius:8},checkboxContainer:{paddingLeft:4,paddingRight:8,paddingTop:10,alignSelf:"flex-start"},compactRowWrapper:{flex:1},absCountBadge:{position:"absolute",top:4,right:10,paddingHorizontal:5,paddingVertical:1,borderRadius:4,borderWidth:1,zIndex:1},absCountBadgeExpanded:{top:13},absCountText:{fontSize:9,fontWeight:"700",fontFamily:p},actionRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:8,marginTop:4},actionChip:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:6,paddingHorizontal:10,borderRadius:6,backgroundColor:n.color.surface,borderWidth:1,borderColor:n.color.border},dangerChip:{borderColor:n.color.danger+"55"},actionChipActive:{backgroundColor:n.color.accentSoft,borderColor:n.color.accentBorderStrong},editButton:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:8,paddingHorizontal:14,borderRadius:8,backgroundColor:n.color.accent},editButtonText:{color:n.color.onAccent,fontSize:12,fontWeight:"700"},actionChipText:{fontSize:11,fontWeight:"600",fontFamily:p},viewHistoryButton:{marginLeft:4},viewHistoryText:{fontSize:10,fontWeight:"600",fontFamily:p,color:n.color.accent}});
1
+ "use strict";import{memo as j}from"react";import{View as a,Text as l,StyleSheet as N,TouchableOpacity as s}from"react-native";import{macOSColors as r,night as n,CompactRow as U,TypeBadge as B,HardDrive as G,Square as J,CheckSquare as M,Edit3 as Q,EyeOff as X,Pin as W,Trash2 as Y,ExpandedInfoRow as I,PillBadge as h,monoFont as p}from"@buoy-gg/shared-ui";import{getStorageTypeLabel as Z}from"../utils/storageQueryUtils";import{getValueTypeLabel as _,getValueTypeWithPreview as K,parseStorageValue as ee}from"../utils/valueType";import{DataViewer as te}from"@buoy-gg/shared-ui/dataViewer";import{jsx as t,jsxs as i,Fragment as oe}from"react/jsx-runtime";const F=[r.semantic.info,r.semantic.success,r.semantic.warning,r.semantic.debug,"#FF6B9D","#00D9FF"];function $(c){const e=c.split("").reduce((f,x)=>f+x.charCodeAt(0),0);return F[e%F.length]}export const getStatusConfig=c=>{switch(c){case"required_present":return{label:"Valid",color:r.semantic.success,sublabel:"Required"};case"required_missing":return{label:"Missing",color:r.semantic.error,sublabel:"Required"};case"required_wrong_value":return{label:"Wrong",color:r.semantic.warning,sublabel:"Invalid value"};case"required_wrong_type":return{label:"Type Error",color:r.semantic.info,sublabel:"Wrong type"};case"optional_present":return{label:"Set",color:r.semantic.debug,sublabel:"Optional"};default:return{label:"Set",color:r.text.secondary,sublabel:String(c)}}};const ne=c=>{if(c===void 0||c===null){return"undefined"}const e=typeof c==="string"?c:JSON.stringify(c);return e};export const StorageKeyRow=j(function c({storageKey:e,isExpanded:f,onPress:x,isSelectMode:w=false,isSelected:m=false,onSelectionChange:q,eventCount:d,onViewHistory:D,onHideKey:C,isPinned:u=false,onTogglePin:S,onEditKey:L,onToggleKey:y,onDeleteKey:z,editBlockedReason:T}){const k=L!=null&&T==null;const g=getStatusConfig(e.status);const v=e.value!==void 0&&e.value!==null;const b=v&&typeof e.value==="boolean";const O=e.key;const V=Z(e.storageType,e.instanceId);const R=ee(e.value);const A=R!==null&&typeof R==="object";const H=i(a,{style:o.expandedContainer,children:[t(I,{label:"Storage",children:t(h,{color:getStorageTypeColor(e.storageType),children:V})}),e.storageType==="mmkv"&&e.instanceId&&t(I,{label:"Instance",children:t(h,{color:$(e.instanceId),icon:t(G,{size:9,color:$(e.instanceId)}),children:e.instanceId})}),d!=null&&d>0&&i(I,{label:"Updates",children:[t(h,{color:r.semantic.warning,children:String(d)}),d>1&&D&&t(s,{onPress:D,testID:"buoy-storage-key-history",accessibilityLabel:`View history for ${e.key}`,accessibilityRole:"button",style:o.viewHistoryButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:t(l,{style:o.viewHistoryText,children:"view history \u2192"})})]}),A?t(a,{style:o.dataViewerContainer,children:t(te,{data:R,title:"",showTypeFilter:true,rawMode:true,initialExpanded:true})}):i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Value:"}),t(l,{style:o.expandedValue,numberOfLines:3,children:ne(e.value)||"undefined"})]}),e.status==="required_wrong_type"&&e.expectedType&&i(oe,{children:[i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Type:"}),t(B,{type:_(e.value)})]}),i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Expected:"}),t(B,{type:e.expectedType})]})]}),e.status==="required_wrong_value"&&e.expectedValue&&i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Expected:"}),t(l,{style:o.expandedExpected,children:String(e.expectedValue)})]}),e.description?i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Info:"}),t(l,{style:o.expandedDescription,children:e.description})]}):null,T?i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Edit:"}),t(l,{style:o.expandedDescription,children:T})]}):null,S||C||k?i(a,{style:o.actionRow,children:[k?i(s,{style:o.editButton,testID:"buoy-storage-key-edit",accessibilityLabel:b&&y?`Toggle ${e.key}`:`Edit ${e.key}`,accessibilityRole:"button",onPress:()=>b&&y?y(e):L?.(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(Q,{size:13,color:n.color.onAccent}),t(l,{style:o.editButtonText,children:b&&y?"Toggle":"Edit"})]}):null,S?i(s,{style:[o.actionChip,u&&o.actionChipActive],testID:"buoy-storage-key-pin",accessibilityLabel:u?`Unpin ${e.key}`:`Pin ${e.key} to top`,accessibilityRole:"button",onPress:()=>S(e.key),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(W,{size:12,active:u,color:n.color.accent}),t(l,{style:[o.actionChipText,{color:n.color.accent}],children:u?"Unpin":"Pin to top"})]}):null,C?i(s,{style:o.actionChip,testID:"buoy-storage-key-hide",accessibilityLabel:`Hide ${e.key} from list`,accessibilityRole:"button",onPress:()=>C(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(X,{size:12,color:n.color.warning}),t(l,{style:[o.actionChipText,{color:n.color.warning}],children:"Hide from list"})]}):null,k&&z?i(s,{style:[o.actionChip,o.dangerChip],testID:"buoy-storage-key-delete",accessibilityLabel:`Delete key ${e.key}`,accessibilityRole:"button",onPress:()=>z(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(Y,{size:12,color:n.color.danger}),t(l,{style:[o.actionChipText,{color:n.color.danger}],children:"Delete key"})]}):null]}):null]});const E=()=>{q?.(e,!m)};const P=w?t(s,{onPress:E,testID:`buoy-storage-checkbox-${e.storageType}-${e.key}`,accessibilityLabel:`Select ${e.key}`,accessibilityRole:"checkbox",accessibilityState:{checked:m},style:o.checkboxContainer,hitSlop:{top:8,bottom:8,left:8,right:8},children:m?t(M,{size:18,color:n.color.accent}):t(J,{size:18,color:n.color.textTertiary})}):null;return i(a,{style:[o.rowContainer,m&&o.rowContainerSelected],children:[P,i(a,{style:o.compactRowWrapper,children:[t(U,{statusDotColor:g.color,statusLabel:g.label,statusSublabel:g.sublabel,primaryText:O,secondaryText:v?b?_(e.value):K(e.value):void 0,secondaryAccessory:b?t(h,{size:"sm",color:e.value?r.semantic.success:r.semantic.error,children:e.value?"true":"false"}):void 0,expandedContent:H,isExpanded:f,expandedGlowColor:g.color,customBadge:i(a,{style:o.badgeRow,children:[u&&t(W,{size:12,active:true,color:n.color.accent}),t(h,{color:getStorageTypeColor(e.storageType),children:V})]}),showChevron:!w,onPress:w?E:x?()=>x(e):void 0,testID:`buoy-storage-row-${e.storageType}-${e.key}`,accessibilityLabel:`${e.storageType} ${e.key}`}),d!=null&&d>1&&t(a,{style:[o.absCountBadge,f&&o.absCountBadgeExpanded,{backgroundColor:r.semantic.warning+"22",borderColor:r.semantic.warning+"55"}],pointerEvents:"none",children:t(l,{style:[o.absCountText,{color:r.semantic.warning}],children:String(d)})})]})]})});export const getStorageTypeColor=c=>{switch(c){case"mmkv":return r.semantic.info;case"async":return r.semantic.warning;case"secure":return r.semantic.success;default:return r.text.secondary}};const o=N.create({badgeRow:{flexDirection:"row",alignItems:"center",gap:6},expandedContainer:{gap:8},expandedRow:{flexDirection:"row",alignItems:"center",gap:10},expandedLabel:{fontSize:10,color:n.color.textTertiary,fontWeight:"600",minWidth:70,fontFamily:p},expandedValue:{fontSize:11,color:n.color.textSecondary,fontFamily:p,flex:1},expandedExpected:{fontSize:11,color:r.semantic.warning,fontFamily:p,flex:1},expandedDescription:{fontSize:11,color:n.color.textSecondary,flex:1},dataViewerContainer:{marginTop:6,marginBottom:6,backgroundColor:n.color.bg,borderRadius:6,borderWidth:1,borderColor:n.color.border,padding:6},rowContainer:{flexDirection:"row",alignItems:"flex-start"},rowContainerSelected:{backgroundColor:n.color.accentSoft,borderRadius:8},checkboxContainer:{paddingLeft:4,paddingRight:8,paddingTop:10,alignSelf:"flex-start"},compactRowWrapper:{flex:1},absCountBadge:{position:"absolute",top:4,right:10,paddingHorizontal:5,paddingVertical:1,borderRadius:4,borderWidth:1,zIndex:1},absCountBadgeExpanded:{top:13},absCountText:{fontSize:9,fontWeight:"700",fontFamily:p},actionRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:8,marginTop:4},actionChip:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:6,paddingHorizontal:10,borderRadius:6,backgroundColor:n.color.surface,borderWidth:1,borderColor:n.color.border},dangerChip:{borderColor:n.color.danger+"55"},actionChipActive:{backgroundColor:n.color.accentSoft,borderColor:n.color.accentBorderStrong},editButton:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:8,paddingHorizontal:14,borderRadius:8,backgroundColor:n.color.accent},editButtonText:{color:n.color.onAccent,fontSize:12,fontWeight:"700"},actionChipText:{fontSize:11,fontWeight:"600",fontFamily:p},viewHistoryButton:{marginLeft:4},viewHistoryText:{fontSize:10,fontWeight:"600",fontFamily:p,color:n.color.accent}});
@@ -1 +1 @@
1
- "use strict";import{storageLabels as a}from"../utils/storageLabels";import{StyleSheet as u,Text as b,TouchableOpacity as y,View as p}from"react-native";import{macOSColors as n,night as r,monoFont as f}from"@buoy-gg/shared-ui";import{jsx as s,jsxs as m}from"react/jsx-runtime";const S=[{id:"all",label:"All Types",color:null},{id:"async",label:a.async,color:n.semantic.warning},{id:"mmkv",label:a.mmkv,color:n.semantic.info},{id:"secure",label:"Secure",color:n.semantic.success}];export function StorageTypeFilterBar({active:t,onChange:l,counts:i}){return s(p,{style:e.row,children:S.filter(o=>a.hasSecure||o.id!=="secure").map(o=>{const c=t===o.id;const d=o.color??r.color.accent;return m(y,{testID:`buoy-storage-type-${o.id}`,accessibilityRole:"button",accessibilityLabel:`Filter by ${o.label}`,accessibilityState:{selected:c},activeOpacity:.8,onPress:()=>l(o.id),style:[e.pill,{borderColor:r.color.border},c&&[e.pillActive,o.color?{backgroundColor:o.color+"15",borderColor:o.color+"40"}:{backgroundColor:r.color.accentSoft,borderColor:r.color.accentBorderStrong}]],children:[s(b,{style:[e.label,c&&{color:d,fontWeight:"600"}],children:o.label}),s(b,{style:[e.value,{color:c?d:r.color.textTertiary}],children:i[o.id]})]},o.id)})})}export function countByStorageType(t){const l={all:t.length,async:0,mmkv:0,secure:0};for(const i of t)l[i.storageType]+=1;return l}const e=u.create({row:{flexDirection:"row",gap:8,marginTop:2},pill:{flex:1,backgroundColor:r.color.buttonSurface,borderRadius:8,borderWidth:1,borderColor:r.color.border,paddingVertical:6,paddingHorizontal:8,alignItems:"center",justifyContent:"center",minHeight:32},pillActive:{borderWidth:1,transform:[{scale:1.005}]},label:{fontSize:9,color:r.color.textSecondary,textTransform:"uppercase",letterSpacing:.4,fontWeight:"500",marginBottom:1},value:{fontSize:12,fontWeight:"600",fontFamily:f,lineHeight:14}});
1
+ "use strict";import{storageLabels as d}from"../utils/storageLabels";import{showsSecureStorage as u}from"../utils/showsSecureStorage";import{StyleSheet as p,Text as b,TouchableOpacity as y,View as f}from"react-native";import{macOSColors as a,night as r,monoFont as m}from"@buoy-gg/shared-ui";import{jsx as n,jsxs as S}from"react/jsx-runtime";const h=[{id:"all",label:"All Types",color:null},{id:"async",label:d.async,color:a.semantic.warning},{id:"mmkv",label:d.mmkv,color:a.semantic.info},{id:"secure",label:"Secure",color:a.semantic.success}];export function StorageTypeFilterBar({active:t,onChange:l,counts:i}){return n(f,{style:e.row,children:h.filter(o=>u()||o.id!=="secure").map(o=>{const c=t===o.id;const s=o.color??r.color.accent;return S(y,{testID:`buoy-storage-type-${o.id}`,accessibilityRole:"button",accessibilityLabel:`Filter by ${o.label}`,accessibilityState:{selected:c},activeOpacity:.8,onPress:()=>l(o.id),style:[e.pill,{borderColor:r.color.border},c&&[e.pillActive,o.color?{backgroundColor:o.color+"15",borderColor:o.color+"40"}:{backgroundColor:r.color.accentSoft,borderColor:r.color.accentBorderStrong}]],children:[n(b,{style:[e.label,c&&{color:s,fontWeight:"600"}],children:o.label}),n(b,{style:[e.value,{color:c?s:r.color.textTertiary}],children:i[o.id]})]},o.id)})})}export function countByStorageType(t){const l={all:t.length,async:0,mmkv:0,secure:0};for(const i of t)l[i.storageType]+=1;return l}const e=p.create({row:{flexDirection:"row",gap:8,marginTop:2},pill:{flex:1,backgroundColor:r.color.buttonSurface,borderRadius:8,borderWidth:1,borderColor:r.color.border,paddingVertical:6,paddingHorizontal:8,alignItems:"center",justifyContent:"center",minHeight:32},pillActive:{borderWidth:1,transform:[{scale:1.005}]},label:{fontSize:9,color:r.color.textSecondary,textTransform:"uppercase",letterSpacing:.4,fontWeight:"500",marginBottom:1},value:{fontSize:12,fontWeight:"600",fontFamily:m,lineHeight:14}});
@@ -0,0 +1 @@
1
+ "use strict";import{storageLabels as r}from"./storageLabels";import{secureStoreRegistry as e}from"./SecureStoreRegistry";export function showsSecureStorage(){return r.hasSecure||e.count()>0}
@@ -1 +1 @@
1
- "use strict";import{gameUIColors as r}from"@buoy-gg/shared-ui";import{storageLabels as t}from"./storageLabels";export function getStorageTypeLabel(e){switch(e){case"mmkv":return t.mmkv;case"async":return t.async;case"secure":return"Secure";default:return e}}export function getStorageTypeHexColor(e){switch(e){case"mmkv":return r.info;case"async":return r.warning;case"secure":return r.success;default:return r.muted}}
1
+ "use strict";import{gameUIColors as r}from"@buoy-gg/shared-ui";import{storageLabels as s}from"./storageLabels";const a=new Set(["sessionStorage","localStorage"]);export function getStorageTypeLabel(e,t){switch(e){case"mmkv":return t&&!a.has(t)?"MMKV":s.mmkv;case"async":return s.async;case"secure":return"Secure";default:return e}}export function getStorageTypeHexColor(e){switch(e){case"mmkv":return r.info;case"async":return r.warning;case"secure":return r.success;default:return r.muted}}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Whether the Secure backend gets its own filter. Apps always show it. The web
3
+ * build shows it once the app has registered SecureStore keys, since those
4
+ * rows are listed then too.
5
+ */
6
+ export declare function showsSecureStorage(): boolean;
7
+ //# sourceMappingURL=showsSecureStorage.d.ts.map
@@ -1,6 +1,5 @@
1
1
  export type StorageType = "mmkv" | "async" | "secure";
2
- /** Human readable label for a storage type id. */
3
- export declare function getStorageTypeLabel(storageType: StorageType): string;
2
+ export declare function getStorageTypeLabel(storageType: StorageType, instanceId?: string): string;
4
3
  /** Preferred color token for rendering a given storage type. */
5
4
  export declare function getStorageTypeHexColor(storageType: StorageType): string;
6
5
  //# sourceMappingURL=storageQueryUtils.d.ts.map