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