@buoy-gg/env 7.0.63 → 7.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/web/index.mjs +1 -1
- package/package.json +3 -3
package/lib/web/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";var ie=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var ke=Object.prototype.hasOwnProperty;var Ee=(e,n)=>{for(var r in n)ie(e,r,{get:n[r],enumerable:true})},se=(e,n,r,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of Ve(n))!ke.call(e,t)&&t!==r&&ie(e,t,{get:()=>n[t],enumerable:!(a=Te(n,t))||a.enumerable});return e},Ie=(e,n,r)=>(se(e,n,"default"),r&&se(r,n,"default"));var dr=(()=>{try{let e=globalThis.Capacitor;if(e&&typeof e.isNativePlatform=="function"&&e.isNativePlatform())return e.DEBUG===true}catch{}return process.env.NODE_ENV!=="production"})();typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{EnvIcon as Le}from"@buoy-gg/floating-tools-core/web";import{JsModal as De,devToolsStorageKeys as le,ModalHeader as N,HeaderSearchButton as qe,displayValue as Ae,buoyColors as M,night as G,windowDragProps as _e,ToolEmptyState as Re,resolveListEmptyState as Be,monoFont as ce}from"@buoy-gg/shared-ui/web";import{useCallback as Ne,useState as Y,useRef as Me,useEffect as de,useMemo as P}from"react";var ue={};Ee(ue,{AccessibilityInfo:()=>Fe,ActivityIndicator:()=>Nt,Alert:()=>jt,Animated:()=>Oe,AppRegistry:()=>He,AppState:()=>$e,Appearance:()=>ze,BackHandler:()=>Ge,Button:()=>Mt,CheckBox:()=>lt,Clipboard:()=>Ke,DeviceEventEmitter:()=>Tt,Dimensions:()=>Ue,Easing:()=>Je,FlatList:()=>ct,I18nManager:()=>Ye,Image:()=>dt,ImageBackground:()=>ut,InteractionManager:()=>Qe,Keyboard:()=>Xe,KeyboardAvoidingView:()=>pt,LayoutAnimation:()=>Ze,Linking:()=>et,LogBox:()=>wt,Modal:()=>Rt,NativeEventEmitter:()=>tt,NativeModules:()=>We,PanResponder:()=>rt,Picker:()=>yt,PixelRatio:()=>at,Platform:()=>nt,Pressable:()=>_t,ProgressBar:()=>ht,RefreshControl:()=>bt,SafeAreaView:()=>gt,ScrollView:()=>pe,SectionList:()=>ft,Share:()=>ot,StatusBar:()=>mt,StyleSheet:()=>j,Switch:()=>Bt,Text:()=>y,TextInput:()=>Dt,Touchable:()=>vt,TouchableHighlight:()=>qt,TouchableNativeFeedback:()=>xt,TouchableOpacity:()=>K,TouchableWithoutFeedback:()=>At,UIManager:()=>it,Vibration:()=>st,View:()=>p,VirtualizedList:()=>Ct,YellowBox:()=>St,findNodeHandle:()=>Pt,unstable_createElement:()=>je,useColorScheme:()=>Vt,useLocaleContext:()=>kt,useWindowDimensions:()=>Et});Ie(ue,Pe);import*as Pe from"react-native-web";import{unstable_createElement as je,NativeModules as We,AccessibilityInfo as Fe,Animated as Oe,Appearance as ze,AppRegistry as He,AppState as $e,BackHandler as Ge,Clipboard as Ke,Dimensions as Ue,Easing as Je,I18nManager as Ye,Keyboard as Xe,InteractionManager as Qe,LayoutAnimation as Ze,Linking as et,NativeEventEmitter as tt,PanResponder as rt,PixelRatio as at,Platform as nt,Share as ot,StyleSheet as j,UIManager as it,Vibration as st,CheckBox as lt,FlatList as ct,Image as dt,ImageBackground as ut,KeyboardAvoidingView as pt,Picker as yt,ProgressBar as ht,RefreshControl as bt,SafeAreaView as gt,SectionList as ft,StatusBar as mt,Touchable as vt,TouchableNativeFeedback as xt,VirtualizedList as Ct,YellowBox as St,LogBox as wt,DeviceEventEmitter as Tt,useColorScheme as Vt,useLocaleContext as kt,useWindowDimensions as Et}from"react-native-web";import*as g from"react-native-web";import{createElement as It,forwardRef as Lt}from"react";function x(e){let n=Lt((a,t)=>{let{accessibilityState:o,accessibilityValue:s,...i}=a;for(let d of["busy","checked","disabled","expanded","selected"])o?.[d]!==void 0&&i[`aria-${d}`]===void 0&&(i[`aria-${d}`]=o[d]);for(let[d,c]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))s?.[d]!==void 0&&i[`aria-${c}`]===void 0&&(i[`aria-${c}`]=s[d]);return It(e,{...i,ref:t})}),r=e.State;return r&&Object.assign(n,{State:r}),n.displayName=e.displayName??e.name??"NativeWebView",n}var p=x(g.View),y=x(g.Text),Dt=x(g.TextInput),K=x(g.TouchableOpacity),qt=x(g.TouchableHighlight),At=x(g.TouchableWithoutFeedback),_t=x(g.Pressable),pe=x(g.ScrollView),Rt=x(g.Modal),Bt=x(g.Switch),Nt=x(g.ActivityIndicator),Mt=x(g.Button),Pt=g.findNodeHandle,jt={alert(e,n,r,a){if(typeof document>"u")return;let t=document.createElement("dialog");t.dataset.buoyRoot="",t.setAttribute("aria-label",e),t.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let o=document.createElement("h2");if(o.textContent=e,o.style.cssText="font-size:18px;margin:0 0 12px",t.appendChild(o),n){let c=document.createElement("p");c.textContent=n,c.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",t.appendChild(c)}let s=document.createElement("div");s.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let i=r?.length?r:[{text:"OK"}],d=()=>{t.close?.(),t.remove()};for(let c of i){let l=document.createElement("button");l.type="button",l.textContent=c.text??"OK",l.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${c.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,l.onclick=()=>{d(),c.onPress?.()},s.appendChild(l)}t.addEventListener("cancel",c=>{c.preventDefault(),a?.cancelable!==false&&(d(),a?.onDismiss?.())}),t.appendChild(s),document.body.appendChild(t),t.showModal?t.showModal():t.setAttribute("open","")}};import{CompactRow as Wt,night as T,monoFont as ye}from"@buoy-gg/shared-ui/web";import{jsx as V,jsxs as q}from"react/jsx-runtime";function Ft({stats:e,healthPercentage:n,healthStatus:r,healthColor:a,activeFilter:t="all",onFilterChange:o}){let s=e.wrongValueCount+e.wrongTypeCount;return q(p,{style:u.container,children:[V(Wt,{statusDotColor:a,statusLabel:"System",statusSublabel:r.toLowerCase(),primaryText:"Environment Configuration",secondaryText:`${n}% healthy`,testID:"buoy-env-health",statusSublabelTestID:"buoy-env-health-status",accessibilityLabel:`Environment configuration ${r.toLowerCase()}, ${n}% healthy`,customBadge:V(p,{style:[u.percentBadge,{borderColor:a+"40",backgroundColor:a+"10"}],children:q(y,{style:[u.percentText,{color:a}],testID:"buoy-env-health-percent",children:[n,"%"]})})}),q(p,{style:u.statsGrid,children:[q(K,{style:[u.statCard,t==="all"&&u.statCardActive],onPress:()=>o?.("all"),activeOpacity:.8,testID:"buoy-env-filter-all",accessibilityRole:"button",accessibilityLabel:"Show all variables",accessibilityState:{selected:t==="all"},children:[V(y,{style:[u.statValue,t==="all"&&u.statValueActive],testID:"buoy-env-filter-all-count",children:e.requiredCount+e.optionalCount}),V(y,{style:[u.statLabel,t==="all"&&u.statLabelActive],children:"ALL"})]}),q(K,{style:[u.statCard,t==="missing"&&u.statCardActive],onPress:()=>o?.("missing"),activeOpacity:.8,testID:"buoy-env-filter-missing",accessibilityRole:"button",accessibilityLabel:"Show missing variables",accessibilityState:{selected:t==="missing"},children:[V(y,{style:[u.statValue,t==="missing"&&u.statValueActive],testID:"buoy-env-filter-missing-count",children:e.missingCount}),V(y,{style:[u.statLabel,t==="missing"&&u.statLabelActive],children:"MISSING"})]}),q(K,{style:[u.statCard,t==="issues"&&u.statCardActive],onPress:()=>o?.("issues"),activeOpacity:.8,testID:"buoy-env-filter-issues",accessibilityRole:"button",accessibilityLabel:"Show variables with issues",accessibilityState:{selected:t==="issues"},children:[V(y,{style:[u.statValue,t==="issues"&&u.statValueActive],testID:"buoy-env-filter-issues-count",children:s}),V(y,{style:[u.statLabel,t==="issues"&&u.statLabelActive],children:"ISSUES"})]})]})]})}var u=j.create({container:{gap:8},statsGrid:{flexDirection:"row",gap:8,paddingHorizontal:4},statCard:{flex:1,backgroundColor:T.color.surface,borderRadius:10,borderWidth:1,borderColor:T.color.border,padding:12,alignItems:"center",justifyContent:"center",minHeight:64},statCardActive:{borderColor:T.color.accentBorderStrong,backgroundColor:T.color.accentSoft},statValue:{fontSize:22,fontWeight:"700",fontFamily:ye,lineHeight:26,color:T.color.text},statValueActive:{color:T.color.accent},statLabel:{fontSize:9,color:T.color.textTertiary,marginTop:4,textTransform:"uppercase",letterSpacing:.5,fontWeight:"600"},statLabelActive:{color:T.color.accent},percentBadge:{paddingHorizontal:8,paddingVertical:4,borderRadius:6,borderWidth:1},percentText:{fontSize:14,fontWeight:"700",fontFamily:ye}});import{useMemo as he}from"react";var be=null;function Ot(e){be=e}function ge(){return be}function zt({envFilter:e=()=>true}={}){let n=ge()??(typeof process>"u"?{}:process.env),r=he(()=>a=>{let t=n[a];if(t===void 0)return null;try{if(t.startsWith("{")||t.startsWith("["))return JSON.parse(t);if(t.toLowerCase()==="true")return true;if(t.toLowerCase()==="false")return false;if(/^\d+$/.test(t)){let o=parseInt(t,10);return isNaN(o)?t:o}if(/^\d*\.\d+$/.test(t)){let o=parseFloat(t);return isNaN(o)?t:o}return t}catch{return t}},[n]);return he(()=>Object.keys(n).filter(a=>{let t=n[a];return e(a,t)}).map(a=>({key:a,data:r(a)})),[e,r,n])}function X(e){let n=typeof e;if(n==="boolean")return"boolean";if(n==="number")return"number";if(Array.isArray(e))return"array";if(n==="object"&&e!==null)return"object";if(n==="string"){let r=e;if(r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]"))try{let t=JSON.parse(r);return Array.isArray(t)?"array":"object"}catch{return"string"}let a=r.toLowerCase();return a==="true"||a==="false"||a==="enabled"||a==="disabled"||a==="yes"||a==="no"||a==="on"||a==="off"?"boolean":!isNaN(Number(r))&&r.trim()!==""?"number":r.startsWith("http://")||r.startsWith("https://")?"url":r.includes(",")?"array":"string"}return"unknown"}var Ht=class{constructor(e){this.key=e}exists(){return this.key}withValue(e){return this.expectedValue=e,delete this.expectedType,this}withType(e){return this.expectedType=e,delete this.expectedValue,this}withDescription(e){return this.description=e,this}build(){return this.expectedValue!==void 0?this.description?{key:this.key,expectedValue:this.expectedValue,description:this.description}:{key:this.key,expectedValue:this.expectedValue}:this.expectedType!==void 0?this.description?{key:this.key,expectedType:this.expectedType,description:this.description}:{key:this.key,expectedType:this.expectedType}:this.key}};function $t(e){return new Ht(e)}function Gt(e){return e}var Q=(e,n)=>{let r=[],a=[],t=new Set;return n?.forEach(o=>{let s=typeof o=="string"?o:o.key,i=typeof o=="object"&&"expectedValue"in o?o.expectedValue:void 0,d=typeof o=="object"&&"expectedType"in o?o.expectedType:void 0,c=typeof o=="object"&&"description"in o?o.description:void 0;t.add(s);let l=e[s],E=l!==void 0,S;if(!E)S="required_missing";else if(i){let I=false;i==="sk_*"?I=l.startsWith("sk_"):i==="production or development"?I=l==="production"||l==="development":I=l===i,S=I?"required_present":"required_wrong_value"}else d&&X(l).toLowerCase()!==d.toLowerCase()?S="required_wrong_type":S="required_present";r.push({key:s,value:l,expectedValue:i,expectedType:d,description:c,status:S,category:"required"})}),Object.entries(e).forEach(([o,s])=>{t.has(o)||a.push({key:o,value:s,status:"optional_present",category:"optional"})}),r.sort((o,s)=>{let i={required_missing:0,required_wrong_value:1,required_wrong_type:2,required_present:3,optional_present:4};return i[o.status]!==i[s.status]?i[o.status]-i[s.status]:o.key.localeCompare(s.key)}),a.sort((o,s)=>o.key.localeCompare(s.key)),{requiredVars:r,optionalVars:a}},fe=(e,n,r)=>{let a=Object.keys(r).length,t=e.length,o=e.filter(l=>l.status==="required_missing").length,s=e.filter(l=>l.status==="required_wrong_value").length,i=e.filter(l=>l.status==="required_wrong_type").length,d=e.filter(l=>l.status==="required_present").length,c=n.length;return{totalCount:a,requiredCount:t,missingCount:o,wrongValueCount:s,wrongTypeCount:i,presentRequiredCount:d,optionalCount:c}};import{useCallback as Kt,useState as Ut}from"react";import{CompactRow as Jt,TypeBadge as Z,buoyColors as A,night as ee,monoFont as te}from"@buoy-gg/shared-ui/web";import{Fragment as Yt,jsx as C,jsxs as D}from"react/jsx-runtime";var Xt=(e,n)=>{switch(e){case"required_present":return{label:"Valid",color:A.success,sublabel:"Required"};case"required_missing":return{label:"Missing",color:A.error,sublabel:"Required"};case"required_wrong_value":return{label:"Wrong",color:A.warning,sublabel:"Invalid value"};case"required_wrong_type":return{label:"Type Error",color:A.info,sublabel:"Wrong type"};case"optional_present":return{label:"Set",color:A.textSecondary,sublabel:"Optional"}}};var Qt=e=>e==null?"undefined":typeof e=="string"?e:String(e);function Zt({envVar:e,isExpanded:n,onPress:r}){let a=Xt(e.status,e.expectedType),t=e.value!==void 0&&e.value!==null,o=e.key.split("_").map(d=>d.toLowerCase()).join(" \u203A "),s=`buoy-env-row-${e.key}`,i=D(p,{style:h.expandedContainer,children:[D(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Value:"}),C(y,{style:h.expandedValue,numberOfLines:3,testID:`${s}-value`,children:Qt(e.value)||"undefined"})]}),e.status==="required_wrong_type"&&e.expectedType&&D(Yt,{children:[D(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Type:"}),C(Z,{type:X(e.value),testID:`${s}-actual-type`})]}),D(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Expected:"}),C(Z,{type:e.expectedType,testID:`${s}-expected-type`})]})]}),e.status==="required_wrong_value"&&e.expectedValue&&D(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Expected:"}),C(y,{style:h.expandedExpected,testID:`${s}-expected-value`,children:String(e.expectedValue)})]}),e.description&&D(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Info:"}),C(y,{style:h.expandedDescription,testID:`${s}-description`,children:e.description})]})]});return C(Jt,{statusDotColor:a.color,statusLabel:a.label,statusSublabel:a.sublabel,primaryText:o,secondaryText:void 0,expandedContent:i,isExpanded:n,expandedGlowColor:a.color,customBadge:e.expectedType?C(Z,{type:e.expectedType,testID:`${s}-type-badge`}):void 0,showChevron:true,onPress:r?()=>r(e):void 0,testID:s,statusTestID:`${s}-status`,statusSublabelTestID:`${s}-category`,accessibilityLabel:`${e.key}, ${a.label}, ${a.sublabel}`})}var h=j.create({expandedContainer:{gap:6},expandedRow:{flexDirection:"row",alignItems:"center",gap:8},expandedLabel:{fontSize:10,color:ee.color.textTertiary,fontWeight:"600",minWidth:60,fontFamily:te},expandedValue:{fontSize:11,color:ee.color.textSecondary,fontFamily:te,flex:1},expandedExpected:{fontSize:11,color:A.warning,fontFamily:te,flex:1},expandedDescription:{fontSize:11,color:ee.color.textSecondary,flex:1}});import{SectionHeader as _,night as W,monoFont as er}from"@buoy-gg/shared-ui/web";import{jsx as k,jsxs as U}from"react/jsx-runtime";function tr({title:e,count:n,vars:r,emptyMessage:a}){let[t,o]=Ut(null),s=Kt(i=>{o(d=>d===i.key?null:i.key)},[]);return r.length===0&&e==="Required Variables"?U(p,{style:F.sectionContainer,children:[U(_,{children:[k(_.Title,{children:e}),k(_.Badge,{count:0,color:W.color.accent})]}),k(p,{style:F.emptySection,children:k(y,{style:F.emptySectionText,children:a})})]}):r.length===0?null:U(p,{style:F.sectionContainer,children:[e!==""&&U(_,{children:[k(_.Title,{children:e}),k(_.Badge,{count:n,color:W.color.accent})]}),k(p,{style:F.sectionContent,children:r.map(i=>k(Zt,{envVar:i,isExpanded:t===i.key,onPress:s},i.key))})]})}var F=j.create({sectionContainer:{gap:8},sectionContent:{},emptySection:{padding:20,backgroundColor:W.color.accent+"08",borderRadius:8,borderWidth:1,borderColor:W.color.accent+"20",alignItems:"center"},emptySectionText:{color:W.color.accent,fontSize:11,textAlign:"center",fontFamily:er,opacity:.8,letterSpacing:.5}});import{jsx as b,jsxs as O}from"react/jsx-runtime";function re({visible:e,onClose:n,requiredEnvVars:r,onBack:a,onMinimize:t,enableSharedModalDimensions:o=false,inline:s=false}){let[i,d]=Y("all"),[c,l]=Y(false),[E,S]=Y(""),I=Me(null),xe=Ne(f=>{},[]);de(()=>{c&&I.current&&I.current.focus()},[c]),de(()=>{S(""),l(false)},[i]);let ae=zt(),z=P(()=>{let f={};return ae.forEach(({key:m,data:v})=>{v!=null&&(f[m]=typeof v=="string"?v:Ae(v))}),f},[ae]),{requiredVars:H,optionalVars:R}=P(()=>Q(z,r),[z,r]),$=P(()=>r===void 0?{totalCount:0,requiredCount:0,optionalCount:0,presentRequiredCount:0,missingCount:0,wrongValueCount:0,wrongTypeCount:0}:fe(H,R,z),[r,H,R,z]),B=P(()=>[...H,...R].sort((f,m)=>{let v={required_missing:1,required_wrong_type:2,required_wrong_value:3,required_present:4,optional_present:5};return(v[f.status]||999)-(v[m.status]||999)}),[H,R]),J=P(()=>{let f=[];switch(i){case"all":f=B;break;case"missing":f=B.filter(m=>m.status==="required_missing");break;case"issues":f=B.filter(m=>m.status==="required_wrong_type"||m.status==="required_wrong_value");break}if(E){let m=E.toLowerCase();f=f.filter(v=>v.key.toLowerCase().includes(m)||v.description?.toLowerCase().includes(m)||typeof v.value=="string"&&v.value.toLowerCase().includes(m))}return f},[B,R,i,E]),L=$.requiredCount>0?Math.round($.presentRequiredCount/$.requiredCount*100):100,Ce=L===100?"HEALTHY":L>=75?"WARNING":L>=50?"ERROR":"CRITICAL",Se=L===100?M.success:L>=75?M.warning:L>=50?M.error:M.error;if(!e)return null;let we=o?le.modal.root():le.env.modal(),ne=O(N,{children:[a&&b(N.Navigation,{onBack:a}),b(N.Content,{title:c?"":"Environment Variables",noMargin:c,children:c&&b(N.Search,{value:E,onChangeText:S,onCancel:()=>{l(false),S("")},placeholder:"Search env keys...",accessibilityLabel:"Search env keys",testID:"buoy-env-search",containerTestID:"buoy-env-search-field",clearTestID:"buoy-env-search-clear"})}),b(N.Actions,{children:!c&&b(qe,{onPress:()=>l(true),testID:"buoy-env-search-open",accessibilityLabel:"Search env keys"})})]}),oe=O(pe,{style:w.scrollContainer,contentContainerStyle:w.contentContainer,showsVerticalScrollIndicator:false,testID:"buoy-env-scroll",children:[b(Ft,{stats:$,healthPercentage:L,healthStatus:Ce,healthColor:Se,activeFilter:i,onFilterChange:d}),J.length>0?O(p,{style:w.varsSection,children:[O(p,{style:w.sectionHeader,children:[b(y,{style:w.sectionTitle,testID:"buoy-env-section-title",children:i==="all"?"ALL VARIABLES":i==="missing"?"MISSING VARIABLES":"ISSUES TO FIX"}),b(p,{style:w.countBadge,children:b(y,{style:w.countText,testID:"buoy-env-section-count",children:J.length})})]}),b(tr,{title:"",count:0,vars:J,emptyMessage:""})]}):b(Re,{testID:"buoy-env-empty",...Be({subject:"variables",verb:"declared",search:E,total:B.length,waiting:{otto:"keys",title:"No variables",message:`No ${i==="all"?"":i} variables found`}})})]});return s?O(p,{style:w.inlineRoot,children:[b(p,{style:w.inlineHeader,..._e,children:ne}),oe]}):b(De,{visible:e,onClose:n,onMinimize:t,persistenceKey:we,header:{customContent:ne,showToggleButton:true},onModeChange:xe,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,styles:{},children:oe})}function rr({requiredEnvVars:e}){return b(re,{inline:true,visible:true,requiredEnvVars:e,onClose:()=>{}})}var w=j.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:M.border,backgroundColor:"transparent"},scrollContainer:{flex:1,backgroundColor:"transparent"},contentContainer:{padding:8,paddingBottom:24},varsSection:{marginTop:16},sectionHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8,paddingHorizontal:8},sectionTitle:{fontSize:10,fontWeight:"700",color:G.color.textTertiary,letterSpacing:1.2,fontFamily:ce},countBadge:{backgroundColor:G.color.accent+"15",paddingHorizontal:8,paddingVertical:2,borderRadius:9999,borderWidth:1,borderColor:G.color.accent+"40"},countText:{fontSize:10,fontWeight:"500",color:G.color.accent,fontFamily:ce}});function ar(){let e={};for(let[n,r]of Object.entries(ge()??(typeof process>"u"?{}:process.env)))typeof r=="string"&&(e[n]=r);return e}var me=[];function nr(e){me=e}function or(e=[]){return{version:1,getSnapshot:()=>{let n=ar(),r=e.length>0?e:me,a=[];try{a=Q(n,r).requiredVars.map(t=>({key:t.key,status:t.status}))}catch{a=[]}return{env:n,requiredEnvVars:r,checks:a}},subscribe:()=>()=>{}}}import{createToolFactory as ir,defineToolPreset as sr}from"@buoy-gg/shared-ui/web";import{jsx as lr}from"react/jsx-runtime";var ve=sr({id:"env",name:"ENV",description:"Environment variables debugger",slot:"both",icon:({size:e})=>lr(Le,{size:e}),component:re,props:{requiredEnvVars:[],enableSharedModalDimensions:true}}),cr=ir(ve,e=>(nr(e.requiredEnvVars||[]),{requiredEnvVars:e.requiredEnvVars||[],enableSharedModalDimensions:e.enableSharedModalDimensions??true}));export{rr as EnvToolView,re as EnvVarsModal,fe as calculateStats,or as createEnvSyncAdapter,cr as createEnvTool,Gt as createEnvVarConfig,ve as envToolPreset,$t as envVar,X as getEnvVarType,Q as processEnvVars,Ot as setRemoteEnv};
|
|
1
|
+
"use client";var le=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var _e=Object.prototype.hasOwnProperty;var qe=(e,r)=>{for(var n in r)le(e,n,{get:r[n],enumerable:true})},ce=(e,r,n,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of De(r))!_e.call(e,t)&&t!==n&&le(e,t,{get:()=>r[t],enumerable:!(a=Ae(r,t))||a.enumerable});return e},Re=(e,r,n)=>(ce(e,r,"default"),n&&ce(n,r,"default"));var wr=(()=>{try{let e=globalThis.Capacitor;if(e&&typeof e.isNativePlatform=="function"&&e.isNativePlatform())return e.DEBUG===true}catch{}return process.env.NODE_ENV!=="production"})();typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{EnvIcon as Be}from"@buoy-gg/floating-tools-core/web";import{JsModal as Ne,devToolsStorageKeys as de,ModalHeader as N,HeaderSearchButton as Me,displayValue as Pe,buoyColors as M,night as G,windowDragProps as je,ToolEmptyState as Fe,resolveListEmptyState as Oe,monoFont as ue}from"@buoy-gg/shared-ui/web";import{useCallback as We,useState as X,useRef as ze,useEffect as pe,useMemo as P}from"react";var ye={};qe(ye,{AccessibilityInfo:()=>Ge,ActivityIndicator:()=>Ut,Alert:()=>Xt,Animated:()=>Ue,AppRegistry:()=>Ye,AppState:()=>Xe,Appearance:()=>Je,BackHandler:()=>Qe,Button:()=>Jt,CheckBox:()=>ht,Clipboard:()=>Ze,DeviceEventEmitter:()=>At,Dimensions:()=>et,Easing:()=>tt,FlatList:()=>bt,I18nManager:()=>rt,Image:()=>mt,ImageBackground:()=>gt,InteractionManager:()=>at,Keyboard:()=>nt,KeyboardAvoidingView:()=>ft,LayoutAnimation:()=>ot,Linking:()=>st,LogBox:()=>It,Modal:()=>Kt,NativeEventEmitter:()=>it,NativeModules:()=>Ke,PanResponder:()=>lt,Picker:()=>vt,PixelRatio:()=>ct,Platform:()=>dt,Pressable:()=>$t,ProgressBar:()=>xt,RefreshControl:()=>Ct,SafeAreaView:()=>wt,ScrollView:()=>ge,SectionList:()=>St,Share:()=>ut,StatusBar:()=>Et,StyleSheet:()=>j,Switch:()=>Gt,Text:()=>y,TextInput:()=>Wt,Touchable:()=>kt,TouchableHighlight:()=>zt,TouchableNativeFeedback:()=>Tt,TouchableOpacity:()=>U,TouchableWithoutFeedback:()=>Ht,UIManager:()=>pt,Vibration:()=>yt,View:()=>p,VirtualizedList:()=>Vt,YellowBox:()=>Lt,findNodeHandle:()=>Yt,unstable_createElement:()=>$e,useColorScheme:()=>Dt,useLocaleContext:()=>_t,useWindowDimensions:()=>qt});Re(ye,He);import*as He from"react-native-web";import{unstable_createElement as $e,NativeModules as Ke,AccessibilityInfo as Ge,Animated as Ue,Appearance as Je,AppRegistry as Ye,AppState as Xe,BackHandler as Qe,Clipboard as Ze,Dimensions as et,Easing as tt,I18nManager as rt,Keyboard as nt,InteractionManager as at,LayoutAnimation as ot,Linking as st,NativeEventEmitter as it,PanResponder as lt,PixelRatio as ct,Platform as dt,Share as ut,StyleSheet as j,UIManager as pt,Vibration as yt,CheckBox as ht,FlatList as bt,Image as mt,ImageBackground as gt,KeyboardAvoidingView as ft,Picker as vt,ProgressBar as xt,RefreshControl as Ct,SafeAreaView as wt,SectionList as St,StatusBar as Et,Touchable as kt,TouchableNativeFeedback as Tt,VirtualizedList as Vt,YellowBox as Lt,LogBox as It,DeviceEventEmitter as At,useColorScheme as Dt,useLocaleContext as _t,useWindowDimensions as qt}from"react-native-web";import*as m from"react-native-web";import{createElement as Q,forwardRef as he,useCallback as Rt,useRef as Bt}from"react";import{useEffect as Nt,useState as Mt}from"react";import{createPortal as Pt}from"react-dom";var jt='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';import{jsx as Ft}from"react/jsx-runtime";var F=Symbol.for("@buoy-gg/portal-host"),be=e=>{if(!(e instanceof Element))return false;if(e.closest("input, textarea, select"))return true;let r=e.closest("[contenteditable]")?.getAttribute("contenteditable")?.toLowerCase();return r===""||r==="true"||r==="plaintext-only"};function me(){let e=document;if(e[F])return e[F].host;let r=document.createElement("div");r.dataset.buoyPortalHost="",Object.assign(r.style,{position:"fixed",inset:"0",zIndex:"2147483647",pointerEvents:"none",fontFamily:jt});let n=()=>{let s=document.fullscreenElement,g=s&&s.tagName!=="CANVAS"?s:document.body;r.parentElement!==g&&g.appendChild(r)},a=new Map,t=s=>{(!r.contains(s.target)||!be(s.target))&&a.set(s.code||s.key,{key:s.key,code:s.code,location:s.location,keyCode:s.keyCode,which:s.which,altKey:s.altKey,ctrlKey:s.ctrlKey,metaKey:s.metaKey,shiftKey:s.shiftKey})},o=s=>{a.delete(s.code||s.key)},l=()=>a.clear(),i=()=>{let s=[...a.values()];a.clear();for(let g of s)document.dispatchEvent(new KeyboardEvent("keyup",{...g,bubbles:true}))},c=s=>{be(s.target)&&s.stopPropagation()},d=s=>s.stopPropagation();return n(),document.addEventListener("fullscreenchange",n),document.addEventListener("keydown",t,true),document.addEventListener("keyup",o,true),window.addEventListener("blur",l),r.addEventListener("focusin",i),r.addEventListener("keydown",c),r.addEventListener("keyup",c),r.addEventListener("keypress",c),r.addEventListener("wheel",d,{passive:true}),e[F]={host:r,users:0,dispose:()=>{document.removeEventListener("fullscreenchange",n),document.removeEventListener("keydown",t,true),document.removeEventListener("keyup",o,true),window.removeEventListener("blur",l),r.remove(),delete e[F]}},r}function Ot({children:e}){let[r,n]=Mt(null);return Nt(()=>{let a=me(),t=document[F];return t.users++,n(a),()=>{--t.users===0&&t.dispose()}},[]),r?Pt(Ft("div",{"data-buoy-root":"",style:{display:"contents",pointerEvents:"auto"},children:e}),r):null}function C(e){let r=he((a,t)=>{let{accessibilityState:o,accessibilityValue:l,...i}=a;for(let c of["busy","checked","disabled","expanded","selected"])o?.[c]!==void 0&&i[`aria-${c}`]===void 0&&(i[`aria-${c}`]=o[c]);for(let[c,d]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))l?.[c]!==void 0&&i[`aria-${d}`]===void 0&&(i[`aria-${d}`]=l[c]);return Q(e,{...i,ref:t})}),n=e.State;return n&&Object.assign(r,{State:n}),r.displayName=e.displayName??e.name??"NativeWebView",r}var p=C(m.View),y=C(m.Text),Wt=C(m.TextInput),U=C(m.TouchableOpacity),zt=C(m.TouchableHighlight),Ht=C(m.TouchableWithoutFeedback),$t=C(m.Pressable),ge=C(m.ScrollView),fe=he((e,r)=>{let n=Bt(null),a=Rt(t=>{if(t){let o=t;for(;o.parentElement&&o.parentElement!==document.body;)o=o.parentElement;o.parentElement===document.body&&(n.current=o,Object.assign(o.style,{position:"relative",zIndex:"2147483647",pointerEvents:"auto"}),me().appendChild(o))}else n.current&&(document.body.appendChild(n.current),n.current=null);typeof r=="function"?r(t):r&&(r.current=t)},[r]);return Q(Ot,null,Q(m.Modal,{...e,ref:a}))});fe.displayName="Modal";var Kt=C(fe),Gt=C(m.Switch),Ut=C(m.ActivityIndicator),Jt=C(m.Button),Yt=m.findNodeHandle,Xt={alert(e,r,n,a){if(typeof document>"u")return;let t=document.createElement("dialog");t.dataset.buoyRoot="",t.setAttribute("aria-label",e),t.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let o=document.createElement("h2");if(o.textContent=e,o.style.cssText="font-size:18px;margin:0 0 12px",t.appendChild(o),r){let d=document.createElement("p");d.textContent=r,d.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",t.appendChild(d)}let l=document.createElement("div");l.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let i=n?.length?n:[{text:"OK"}],c=()=>{t.close?.(),t.remove()};for(let d of i){let s=document.createElement("button");s.type="button",s.textContent=d.text??"OK",s.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${d.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,s.onclick=()=>{c(),d.onPress?.()},l.appendChild(s)}t.addEventListener("cancel",d=>{d.preventDefault(),a?.cancelable!==false&&(c(),a?.onDismiss?.())}),t.appendChild(l),document.body.appendChild(t),t.showModal?t.showModal():t.setAttribute("open","")}};import{CompactRow as Qt,night as k,monoFont as ve}from"@buoy-gg/shared-ui/web";import{jsx as T,jsxs as D}from"react/jsx-runtime";function Zt({stats:e,healthPercentage:r,healthStatus:n,healthColor:a,activeFilter:t="all",onFilterChange:o}){let l=e.wrongValueCount+e.wrongTypeCount;return D(p,{style:u.container,children:[T(Qt,{statusDotColor:a,statusLabel:"System",statusSublabel:n.toLowerCase(),primaryText:"Environment Configuration",secondaryText:`${r}% healthy`,testID:"buoy-env-health",statusSublabelTestID:"buoy-env-health-status",accessibilityLabel:`Environment configuration ${n.toLowerCase()}, ${r}% healthy`,customBadge:T(p,{style:[u.percentBadge,{borderColor:a+"40",backgroundColor:a+"10"}],children:D(y,{style:[u.percentText,{color:a}],testID:"buoy-env-health-percent",children:[r,"%"]})})}),D(p,{style:u.statsGrid,children:[D(U,{style:[u.statCard,t==="all"&&u.statCardActive],onPress:()=>o?.("all"),activeOpacity:.8,testID:"buoy-env-filter-all",accessibilityRole:"button",accessibilityLabel:"Show all variables",accessibilityState:{selected:t==="all"},children:[T(y,{style:[u.statValue,t==="all"&&u.statValueActive],testID:"buoy-env-filter-all-count",children:e.requiredCount+e.optionalCount}),T(y,{style:[u.statLabel,t==="all"&&u.statLabelActive],children:"ALL"})]}),D(U,{style:[u.statCard,t==="missing"&&u.statCardActive],onPress:()=>o?.("missing"),activeOpacity:.8,testID:"buoy-env-filter-missing",accessibilityRole:"button",accessibilityLabel:"Show missing variables",accessibilityState:{selected:t==="missing"},children:[T(y,{style:[u.statValue,t==="missing"&&u.statValueActive],testID:"buoy-env-filter-missing-count",children:e.missingCount}),T(y,{style:[u.statLabel,t==="missing"&&u.statLabelActive],children:"MISSING"})]}),D(U,{style:[u.statCard,t==="issues"&&u.statCardActive],onPress:()=>o?.("issues"),activeOpacity:.8,testID:"buoy-env-filter-issues",accessibilityRole:"button",accessibilityLabel:"Show variables with issues",accessibilityState:{selected:t==="issues"},children:[T(y,{style:[u.statValue,t==="issues"&&u.statValueActive],testID:"buoy-env-filter-issues-count",children:l}),T(y,{style:[u.statLabel,t==="issues"&&u.statLabelActive],children:"ISSUES"})]})]})]})}var u=j.create({container:{gap:8},statsGrid:{flexDirection:"row",gap:8,paddingHorizontal:4},statCard:{flex:1,backgroundColor:k.color.surface,borderRadius:10,borderWidth:1,borderColor:k.color.border,padding:12,alignItems:"center",justifyContent:"center",minHeight:64},statCardActive:{borderColor:k.color.accentBorderStrong,backgroundColor:k.color.accentSoft},statValue:{fontSize:22,fontWeight:"700",fontFamily:ve,lineHeight:26,color:k.color.text},statValueActive:{color:k.color.accent},statLabel:{fontSize:9,color:k.color.textTertiary,marginTop:4,textTransform:"uppercase",letterSpacing:.5,fontWeight:"600"},statLabelActive:{color:k.color.accent},percentBadge:{paddingHorizontal:8,paddingVertical:4,borderRadius:6,borderWidth:1},percentText:{fontSize:14,fontWeight:"700",fontFamily:ve}});import{useMemo as xe}from"react";var Ce=null;function er(e){Ce=e}function we(){return Ce}function tr({envFilter:e=()=>true}={}){let r=we()??(typeof process>"u"?{}:process.env),n=xe(()=>a=>{let t=r[a];if(t===void 0)return null;try{if(t.startsWith("{")||t.startsWith("["))return JSON.parse(t);if(t.toLowerCase()==="true")return true;if(t.toLowerCase()==="false")return false;if(/^\d+$/.test(t)){let o=parseInt(t,10);return isNaN(o)?t:o}if(/^\d*\.\d+$/.test(t)){let o=parseFloat(t);return isNaN(o)?t:o}return t}catch{return t}},[r]);return xe(()=>Object.keys(r).filter(a=>{let t=r[a];return e(a,t)}).map(a=>({key:a,data:n(a)})),[e,n,r])}function Z(e){let r=typeof e;if(r==="boolean")return"boolean";if(r==="number")return"number";if(Array.isArray(e))return"array";if(r==="object"&&e!==null)return"object";if(r==="string"){let n=e;if(n.startsWith("{")&&n.endsWith("}")||n.startsWith("[")&&n.endsWith("]"))try{let t=JSON.parse(n);return Array.isArray(t)?"array":"object"}catch{return"string"}let a=n.toLowerCase();return a==="true"||a==="false"||a==="enabled"||a==="disabled"||a==="yes"||a==="no"||a==="on"||a==="off"?"boolean":!isNaN(Number(n))&&n.trim()!==""?"number":n.startsWith("http://")||n.startsWith("https://")?"url":n.includes(",")?"array":"string"}return"unknown"}var rr=class{constructor(e){this.key=e}exists(){return this.key}withValue(e){return this.expectedValue=e,delete this.expectedType,this}withType(e){return this.expectedType=e,delete this.expectedValue,this}withDescription(e){return this.description=e,this}build(){return this.expectedValue!==void 0?this.description?{key:this.key,expectedValue:this.expectedValue,description:this.description}:{key:this.key,expectedValue:this.expectedValue}:this.expectedType!==void 0?this.description?{key:this.key,expectedType:this.expectedType,description:this.description}:{key:this.key,expectedType:this.expectedType}:this.key}};function nr(e){return new rr(e)}function ar(e){return e}var ee=(e,r)=>{let n=[],a=[],t=new Set;return r?.forEach(o=>{let l=typeof o=="string"?o:o.key,i=typeof o=="object"&&"expectedValue"in o?o.expectedValue:void 0,c=typeof o=="object"&&"expectedType"in o?o.expectedType:void 0,d=typeof o=="object"&&"description"in o?o.description:void 0;t.add(l);let s=e[l],g=s!==void 0,S;if(!g)S="required_missing";else if(i){let L=false;i==="sk_*"?L=s.startsWith("sk_"):i==="production or development"?L=s==="production"||s==="development":L=s===i,S=L?"required_present":"required_wrong_value"}else c&&Z(s).toLowerCase()!==c.toLowerCase()?S="required_wrong_type":S="required_present";n.push({key:l,value:s,expectedValue:i,expectedType:c,description:d,status:S,category:"required"})}),Object.entries(e).forEach(([o,l])=>{t.has(o)||a.push({key:o,value:l,status:"optional_present",category:"optional"})}),n.sort((o,l)=>{let i={required_missing:0,required_wrong_value:1,required_wrong_type:2,required_present:3,optional_present:4};return i[o.status]!==i[l.status]?i[o.status]-i[l.status]:o.key.localeCompare(l.key)}),a.sort((o,l)=>o.key.localeCompare(l.key)),{requiredVars:n,optionalVars:a}},Se=(e,r,n)=>{let a=Object.keys(n).length,t=e.length,o=e.filter(s=>s.status==="required_missing").length,l=e.filter(s=>s.status==="required_wrong_value").length,i=e.filter(s=>s.status==="required_wrong_type").length,c=e.filter(s=>s.status==="required_present").length,d=r.length;return{totalCount:a,requiredCount:t,missingCount:o,wrongValueCount:l,wrongTypeCount:i,presentRequiredCount:c,optionalCount:d}};import{useCallback as or,useState as sr}from"react";import{CompactRow as ir,TypeBadge as te,buoyColors as _,night as re,monoFont as ne}from"@buoy-gg/shared-ui/web";import{Fragment as lr,jsx as w,jsxs as A}from"react/jsx-runtime";var cr=(e,r)=>{switch(e){case"required_present":return{label:"Valid",color:_.success,sublabel:"Required"};case"required_missing":return{label:"Missing",color:_.error,sublabel:"Required"};case"required_wrong_value":return{label:"Wrong",color:_.warning,sublabel:"Invalid value"};case"required_wrong_type":return{label:"Type Error",color:_.info,sublabel:"Wrong type"};case"optional_present":return{label:"Set",color:_.textSecondary,sublabel:"Optional"}}};var dr=e=>e==null?"undefined":typeof e=="string"?e:String(e);function ur({envVar:e,isExpanded:r,onPress:n}){let a=cr(e.status,e.expectedType),t=e.value!==void 0&&e.value!==null,o=e.key.split("_").map(c=>c.toLowerCase()).join(" \u203A "),l=`buoy-env-row-${e.key}`,i=A(p,{style:h.expandedContainer,children:[A(p,{style:h.expandedRow,children:[w(y,{style:h.expandedLabel,children:"Value:"}),w(y,{style:h.expandedValue,numberOfLines:3,testID:`${l}-value`,children:dr(e.value)||"undefined"})]}),e.status==="required_wrong_type"&&e.expectedType&&A(lr,{children:[A(p,{style:h.expandedRow,children:[w(y,{style:h.expandedLabel,children:"Type:"}),w(te,{type:Z(e.value),testID:`${l}-actual-type`})]}),A(p,{style:h.expandedRow,children:[w(y,{style:h.expandedLabel,children:"Expected:"}),w(te,{type:e.expectedType,testID:`${l}-expected-type`})]})]}),e.status==="required_wrong_value"&&e.expectedValue&&A(p,{style:h.expandedRow,children:[w(y,{style:h.expandedLabel,children:"Expected:"}),w(y,{style:h.expandedExpected,testID:`${l}-expected-value`,children:String(e.expectedValue)})]}),e.description&&A(p,{style:h.expandedRow,children:[w(y,{style:h.expandedLabel,children:"Info:"}),w(y,{style:h.expandedDescription,testID:`${l}-description`,children:e.description})]})]});return w(ir,{statusDotColor:a.color,statusLabel:a.label,statusSublabel:a.sublabel,primaryText:o,secondaryText:void 0,expandedContent:i,isExpanded:r,expandedGlowColor:a.color,customBadge:e.expectedType?w(te,{type:e.expectedType,testID:`${l}-type-badge`}):void 0,showChevron:true,onPress:n?()=>n(e):void 0,testID:l,statusTestID:`${l}-status`,statusSublabelTestID:`${l}-category`,accessibilityLabel:`${e.key}, ${a.label}, ${a.sublabel}`})}var h=j.create({expandedContainer:{gap:6},expandedRow:{flexDirection:"row",alignItems:"center",gap:8},expandedLabel:{fontSize:10,color:re.color.textTertiary,fontWeight:"600",minWidth:60,fontFamily:ne},expandedValue:{fontSize:11,color:re.color.textSecondary,fontFamily:ne,flex:1},expandedExpected:{fontSize:11,color:_.warning,fontFamily:ne,flex:1},expandedDescription:{fontSize:11,color:re.color.textSecondary,flex:1}});import{SectionHeader as q,night as O,monoFont as pr}from"@buoy-gg/shared-ui/web";import{jsx as V,jsxs as J}from"react/jsx-runtime";function yr({title:e,count:r,vars:n,emptyMessage:a}){let[t,o]=sr(null),l=or(i=>{o(c=>c===i.key?null:i.key)},[]);return n.length===0&&e==="Required Variables"?J(p,{style:W.sectionContainer,children:[J(q,{children:[V(q.Title,{children:e}),V(q.Badge,{count:0,color:O.color.accent})]}),V(p,{style:W.emptySection,children:V(y,{style:W.emptySectionText,children:a})})]}):n.length===0?null:J(p,{style:W.sectionContainer,children:[e!==""&&J(q,{children:[V(q.Title,{children:e}),V(q.Badge,{count:r,color:O.color.accent})]}),V(p,{style:W.sectionContent,children:n.map(i=>V(ur,{envVar:i,isExpanded:t===i.key,onPress:l},i.key))})]})}var W=j.create({sectionContainer:{gap:8},sectionContent:{},emptySection:{padding:20,backgroundColor:O.color.accent+"08",borderRadius:8,borderWidth:1,borderColor:O.color.accent+"20",alignItems:"center"},emptySectionText:{color:O.color.accent,fontSize:11,textAlign:"center",fontFamily:pr,opacity:.8,letterSpacing:.5}});import{jsx as b,jsxs as z}from"react/jsx-runtime";function ae({visible:e,onClose:r,requiredEnvVars:n,onBack:a,onMinimize:t,enableSharedModalDimensions:o=false,inline:l=false}){let[i,c]=X("all"),[d,s]=X(false),[g,S]=X(""),L=ze(null),Te=We(f=>{},[]);pe(()=>{d&&L.current&&L.current.focus()},[d]),pe(()=>{S(""),s(false)},[i]);let oe=tr(),H=P(()=>{let f={};return oe.forEach(({key:v,data:x})=>{x!=null&&(f[v]=typeof x=="string"?x:Pe(x))}),f},[oe]),{requiredVars:$,optionalVars:R}=P(()=>ee(H,n),[H,n]),K=P(()=>n===void 0?{totalCount:0,requiredCount:0,optionalCount:0,presentRequiredCount:0,missingCount:0,wrongValueCount:0,wrongTypeCount:0}:Se($,R,H),[n,$,R,H]),B=P(()=>[...$,...R].sort((f,v)=>{let x={required_missing:1,required_wrong_type:2,required_wrong_value:3,required_present:4,optional_present:5};return(x[f.status]||999)-(x[v.status]||999)}),[$,R]),Y=P(()=>{let f=[];switch(i){case"all":f=B;break;case"missing":f=B.filter(v=>v.status==="required_missing");break;case"issues":f=B.filter(v=>v.status==="required_wrong_type"||v.status==="required_wrong_value");break}if(g){let v=g.toLowerCase();f=f.filter(x=>x.key.toLowerCase().includes(v)||x.description?.toLowerCase().includes(v)||typeof x.value=="string"&&x.value.toLowerCase().includes(v))}return f},[B,R,i,g]),I=K.requiredCount>0?Math.round(K.presentRequiredCount/K.requiredCount*100):100,Ve=I===100?"HEALTHY":I>=75?"WARNING":I>=50?"ERROR":"CRITICAL",Le=I===100?M.success:I>=75?M.warning:I>=50?M.error:M.error;if(!e)return null;let Ie=o?de.modal.root():de.env.modal(),se=z(N,{children:[a&&b(N.Navigation,{onBack:a}),b(N.Content,{title:d?"":"Environment Variables",noMargin:d,children:d&&b(N.Search,{value:g,onChangeText:S,onCancel:()=>{s(false),S("")},placeholder:"Search env keys...",accessibilityLabel:"Search env keys",testID:"buoy-env-search",containerTestID:"buoy-env-search-field",clearTestID:"buoy-env-search-clear"})}),b(N.Actions,{children:!d&&b(Me,{onPress:()=>s(true),testID:"buoy-env-search-open",accessibilityLabel:"Search env keys"})})]}),ie=z(ge,{style:E.scrollContainer,contentContainerStyle:E.contentContainer,showsVerticalScrollIndicator:false,testID:"buoy-env-scroll",children:[b(Zt,{stats:K,healthPercentage:I,healthStatus:Ve,healthColor:Le,activeFilter:i,onFilterChange:c}),Y.length>0?z(p,{style:E.varsSection,children:[z(p,{style:E.sectionHeader,children:[b(y,{style:E.sectionTitle,testID:"buoy-env-section-title",children:i==="all"?"ALL VARIABLES":i==="missing"?"MISSING VARIABLES":"ISSUES TO FIX"}),b(p,{style:E.countBadge,children:b(y,{style:E.countText,testID:"buoy-env-section-count",children:Y.length})})]}),b(yr,{title:"",count:0,vars:Y,emptyMessage:""})]}):b(Fe,{testID:"buoy-env-empty",...Oe({subject:"variables",verb:"declared",search:g,total:B.length,waiting:{otto:"keys",title:"No variables",message:`No ${i==="all"?"":i} variables found`}})})]});return l?z(p,{style:E.inlineRoot,children:[b(p,{style:E.inlineHeader,...je,children:se}),ie]}):b(Ne,{visible:e,onClose:r,onMinimize:t,persistenceKey:Ie,header:{customContent:se,showToggleButton:true},onModeChange:Te,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,styles:{},children:ie})}function hr({requiredEnvVars:e}){return b(ae,{inline:true,visible:true,requiredEnvVars:e,onClose:()=>{}})}var E=j.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:M.border,backgroundColor:"transparent"},scrollContainer:{flex:1,backgroundColor:"transparent"},contentContainer:{padding:8,paddingBottom:24},varsSection:{marginTop:16},sectionHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8,paddingHorizontal:8},sectionTitle:{fontSize:10,fontWeight:"700",color:G.color.textTertiary,letterSpacing:1.2,fontFamily:ue},countBadge:{backgroundColor:G.color.accent+"15",paddingHorizontal:8,paddingVertical:2,borderRadius:9999,borderWidth:1,borderColor:G.color.accent+"40"},countText:{fontSize:10,fontWeight:"500",color:G.color.accent,fontFamily:ue}});function br(){let e={};for(let[r,n]of Object.entries(we()??(typeof process>"u"?{}:process.env)))typeof n=="string"&&(e[r]=n);return e}var Ee=[];function mr(e){Ee=e}function gr(e=[]){return{version:1,getSnapshot:()=>{let r=br(),n=e.length>0?e:Ee,a=[];try{a=ee(r,n).requiredVars.map(t=>({key:t.key,status:t.status}))}catch{a=[]}return{env:r,requiredEnvVars:n,checks:a}},subscribe:()=>()=>{}}}import{createToolFactory as fr,defineToolPreset as vr}from"@buoy-gg/shared-ui/web";import{jsx as xr}from"react/jsx-runtime";var ke=vr({id:"env",name:"ENV",description:"Environment variables debugger",slot:"both",icon:({size:e})=>xr(Be,{size:e}),component:ae,props:{requiredEnvVars:[],enableSharedModalDimensions:true}}),Cr=fr(ke,e=>(mr(e.requiredEnvVars||[]),{requiredEnvVars:e.requiredEnvVars||[],enableSharedModalDimensions:e.enableSharedModalDimensions??true}));export{hr as EnvToolView,ae as EnvVarsModal,Se as calculateStats,gr as createEnvSyncAdapter,Cr as createEnvTool,ar as createEnvVarConfig,ke as envToolPreset,nr as envVar,Z as getEnvVarType,ee as processEnvVars,er as setRemoteEnv};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/env",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.64",
|
|
4
4
|
"description": "Environment variable inspector for React Native with runtime-visible values, required-variable checks, and type validation.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
],
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@buoy-gg/
|
|
38
|
-
"@buoy-gg/
|
|
37
|
+
"@buoy-gg/floating-tools-core": "^7.0.64",
|
|
38
|
+
"@buoy-gg/shared-ui": "^7.0.64"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": "*"
|