@buoy-gg/core 7.0.76 → 7.0.78
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/README.md +1 -1
- package/bin/buoy.js +10 -9
- package/bundlers/vite.d.ts +2 -0
- package/bundlers/vite.mjs +3 -3
- package/lib/commonjs/Buoy.js +1 -1
- package/lib/commonjs/auto.web.js +1 -1
- package/lib/commonjs/floatingMenu/DevToolsSettingsModal.shared.js +1 -1
- package/lib/commonjs/floatingMenu/FloatingDevTools.js +1 -1
- package/lib/commonjs/floatingMenu/FloatingDevTools.web.js +1 -1
- package/lib/commonjs/floatingMenu/autoExternalSync.js +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/Buoy.js +1 -1
- package/lib/module/auto.web.js +1 -1
- package/lib/module/floatingMenu/DevToolsSettingsModal.shared.js +1 -1
- package/lib/module/floatingMenu/FloatingDevTools.js +1 -1
- package/lib/module/floatingMenu/FloatingDevTools.web.js +1 -1
- package/lib/module/floatingMenu/autoExternalSync.js +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/Buoy.d.ts +15 -0
- package/lib/typescript/commonjs/auto.web.d.ts +8 -2
- package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.d.ts +5 -3
- package/lib/typescript/commonjs/version.d.ts +1 -1
- package/lib/typescript/module/Buoy.d.ts +15 -0
- package/lib/typescript/module/auto.web.d.ts +8 -2
- package/lib/typescript/module/floatingMenu/FloatingDevTools.d.ts +5 -3
- package/lib/typescript/module/version.d.ts +1 -1
- package/lib/web/auto.mjs +1 -1
- package/lib/web/chunks/{FloatingDevTools.web-NMBTDON7.mjs → FloatingDevTools.web-FB3F35HU.mjs} +1 -1
- package/lib/web/chunks/FloatingDevTools.web-IIOOVSUC.mjs +1 -0
- package/lib/web/chunks/chunk-A6DQ5EDK.mjs +10 -0
- package/lib/web/chunks/chunk-LAJ3HKAL.mjs +10 -0
- package/lib/web/index.mjs +1 -1
- package/package.json +5 -5
- package/lib/web/chunks/FloatingDevTools.web-FENSHQGD.mjs +0 -1
- package/lib/web/chunks/chunk-2N5IPIMV.mjs +0 -10
- package/lib/web/chunks/chunk-LU4GPZ5L.mjs +0 -10
- package/lib/web/chunks/chunk-RBPDZUHO.mjs +0 -1
- package/lib/web/chunks/chunk-Z6I7ZD34.mjs +0 -1
package/lib/module/auto.web.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{createElement as
|
|
1
|
+
"use strict";import{createElement as n,lazy as c,Suspense as i,useEffect as f,useState as l}from"react";export function shouldShowBuoy(){if(typeof window==="undefined")return false;const e=window.Capacitor;let t=false;try{t=e?.isNativePlatform?.()===true}catch{t=false}if(t)return e?.DEBUG===true;return typeof __DEV__!=="undefined"?Boolean(__DEV__):process.env.NODE_ENV!=="production"}export function bundlerKey(){try{const e=import.meta.env.VITE_BUOY_KEY;if(e)return e}catch{}try{const e=process.env.NEXT_PUBLIC_BUOY_KEY;if(e)return e}catch{}return void 0}let o;function a(){o??=c(()=>import("./floatingMenu/FloatingDevTools.web").then(e=>({default:e.FloatingDevTools})));return o}export function BuoyDevTools({enabled:e,...t}){const[r,u]=l(false);f(()=>{u(e??shouldShowBuoy())},[e]);if(!r)return null;const s=t.licenseKey??bundlerKey();return n(i,{fallback:null},n(a(),{...t,licenseKey:s}))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useState as S,useEffect as C,useCallback as W,useMemo as A}from"react";import{View as l,Text as c,StyleSheet as Xe,ScrollView as be,TouchableOpacity as j,Dimensions as Se,Platform as Ze}from"react-native";import{settingsBus as N}from"./settingsBus.js";import{useDesktopSyncStatus as et}from"./useDesktopSyncStatus";import{SentryIcon as tt,WifiCircuitIcon as ot,ImageOverlayIcon as nt,RenderCountIcon as st,Info as Q,Layers as rt,ChevronRightIcon as we,ChevronDown as Te,getStorageBackendType as it,getUseLicense as at,signOutOfBuoy as lt,persistentStorage as D,Trash2 as ct,CheckCircle2 as ve,BuoyUpgradeSheet as dt,BackgroundSwitcher as gt,night as n,NightCard as R,NightRows as X,NightSectionLabel as ut,NightFootnote as xe,NightSwitch as ze,NightButton as Z,NightSegmented as yt,NightBadge as v,NightSeparator as ht,monoFont as Ie}from"@buoy-gg/shared-ui";import{EnvIcon as Ce,StorageIcon as ft,RoutesIcon as pt,NetworkIcon as mt,QueryIcon as bt,HighlighterIcon as St,ReduxIcon as wt,EventsIcon as Tt}from"@buoy-gg/floating-tools-core";import{useDefaultConfig as Le}from"./DefaultConfigContext.js";import{renderAppIcon as vt}from"./AppIcon";import{JsModal as xt,devToolsStorageKeys as ee,onSettingsApplied as zt,expandableWindowControlsSupported as It}from"@buoy-gg/shared-ui";import{useSafeAreaInsets as Ct}from"@buoy-gg/shared-ui";import{jsx as e,jsxs as i,Fragment as H}from"react/jsx-runtime";const O="@react_buoy_dev_tools_settings";const Lt=6;const V=y=>{let h=Lt;const a={};for(const[f,d]of Object.entries(y)){if(d&&h>0){a[f]=true;h-=1}else{a[f]=false}}return a};const Bt=(y,h)=>{const{userStatus:a,environment:f,...d}=y;const g=h?Object.entries(d).filter(([p])=>h.includes(p)):Object.entries(d);return{...Object.fromEntries(g),environment:f??false}};const Be=(y,h,a)=>{if(!h)return y;const f={...y.dialTools,...h.dialTools??{}};const d=a?.allowedDialKeys?Object.entries(f).filter(([p])=>a.allowedDialKeys?.includes(p)):Object.entries(f);const g=V(Object.fromEntries(d));return{dialTools:g,floatingTools:Bt({...y.floatingTools,...h.floatingTools??{}},a?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...h.globalSettings??{}}}};const Dt=(y=[],h,a)=>{const f={};const d={};const g=new Set(h??[]);const p=new Set(a??[]);const m=!a||a.length===0;for(const x of y){const{id:u,slot:L="both"}=x;if(L==="dial"||L==="both"){f[u]=m?true:p.has(u)}if(L==="row"||L==="both"){d[u]=g.has(u)}}return{dialTools:V(f),floatingTools:{...d,environment:g.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}};export const DevToolsSettingsModal=({visible:y,onClose:h,onSettingsChange:a,initialSettings:f,availableApps:d=[],storage:g=D,zIndex:p})=>{const{defaultFloatingTools:m,defaultDialTools:x}=Le();const u=A(()=>Dt(d,m,x),[d,m,x]);const L=A(()=>Object.keys(u.dialTools),[u]);const oe=A(()=>Object.keys(u.floatingTools).filter(t=>t!=="environment"),[u]);const[z,F]=S(f||M||u);const[E,ne]=S(te??"floating");const[se,Ee]=S(te!==null);const[_,Oe]=S(new Set);const[Fe,re]=S(false);const[ke,Pe]=S(false);C(()=>{const t=requestAnimationFrame(()=>Pe(true));return()=>cancelAnimationFrame(t)},[]);const w=et();C(()=>{const t=async()=>{try{const s=await D.getItem(ee.settings.activeTab());if(s&&["floating","settings","pro"].includes(s)){const r=s;te=r;ne(b=>b===r?b:r)}}catch(s){}finally{Ee(true)}};t()},[]);C(()=>{if(!se)return;D.setItem(ee.settings.activeTab(),E).catch(t=>{console.warn("[Buoy]","Failed to save settings active tab:",t)})},[E,se]);const He=at();const I=He?.();const k=I?.isPro??false;const J=!k&&I?.licenseKey?I.error:null;const Me=I?.errorKind==="transport";const[T,Ke]=S(De);const[U,ie]=S(false);const[G,q]=S(false);const[P,We]=S(false);const[Y,ae]=S([]);const[le,ce]=S(false);const de=Ct();const ge=Se.get("window").height;const ue=Se.get("window").width;const Ae=Math.floor(ge*.33);const je=Math.min(ue-32,400);const ye=W(async()=>{try{const t=await g.getItem(O);if(t){const s=JSON.parse(t);const r=Be(u,s,{allowedDialKeys:L,allowedFloatingKeys:oe});M=r;F(b=>Re(b,r)?b:r);return}M=u;F(s=>Re(s,u)?s:u)}catch(t){console.error("[Buoy]","Failed to load dev tools settings:",t);F(u)}},[u,L,oe,g]);C(()=>{ye()},[ye]);C(()=>{it().then(t=>{De=t;Ke(s=>s===t?s:t)})},[]);C(()=>{if(P){ce(true);D.getAllKeys().then(t=>{ae(t.sort())}).catch(()=>{ae([])}).finally(()=>{ce(false)})}},[P]);const he=async t=>{try{let s=null;try{const b=await g?.getItem(O);s=b?JSON.parse(b):null}catch{}const r={...t,dialTools:{...s?.dialTools,...V(t.dialTools)},floatingTools:{...s?.floatingTools,...t.floatingTools}};await g.setItem(O,JSON.stringify(r));M=r;F(r);a?.(r);N.emit(r)}catch(s){console.error("[Buoy]","Failed to save dev tools settings:",s)}};const Ne=t=>{const s={...z,floatingTools:{...z.floatingTools,[t]:!z.floatingTools[t]}};he(s)};const Ve=t=>{const s={...z,globalSettings:{...z.globalSettings,[t]:!z.globalSettings?.[t]}};he(s)};const _e=async()=>{ie(true);q(false);try{await D.clear();q(true);F(u);if(g!==D)await g.setItem(O,JSON.stringify(u));a?.(u);N.emit(u);setTimeout(()=>q(false),2e3)}catch(t){console.error("[Buoy]","Failed to clear storage:",t)}finally{ie(false)}};const Je=W(t=>{},[]);const Ue=t=>{const s=d.find(r=>r.id===t);if(s?.description){return s.description}if(t==="environment"){return"Environment badge."}return""};const $=t=>{if(t==="environment"){return"Env Badge"}const s=d.find(r=>r.id===t);return s?.name??t.toUpperCase().replace(/_/g," ")};const Ge=t=>{if(!ke)return null;switch(t){case"query":return e(bt,{size:18});case"env":return e(Ce,{size:18});case"sentry":return e(tt,{size:18,color:"#9945FF"});case"storage":return e(ft,{size:18,bgColor:n.color.surface});case"wifi":case"query-wifi-toggle":return e(ot,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return e(pt,{size:18,bgColor:n.color.surface});case"network":return e(mt,{size:18});case"environment":return e(Ce,{size:18});case"debug-borders":return e(rt,{size:18,color:n.color.accent});case"highlight-updates":return e(st,{size:18,color:n.color.accent});case"highlight-updates-modal":return e(St,{size:18});case"redux":return e(wt,{size:18});case"image-overlay":return e(nt,{size:18});case"events":return e(Tt,{size:18});case"zustand":try{const{ZustandIcon:s}=require("@buoy-gg/zustand");return e(s,{size:18})}catch{return e(Q,{size:18,color:n.color.textSecondary})}case"jotai":try{const{JotaiIcon:s}=require("@buoy-gg/jotai");return e(s,{size:18})}catch{return e(Q,{size:18,color:n.color.textSecondary})}default:{const s=d.find(r=>r.id===t);if(s?.icon!=null){return vt(s.icon,{slot:"row",size:18,color:s.color})}return e(Q,{size:18,color:n.color.textSecondary})}}};const qe=(t,s,r,b)=>{const K=Ue(t);return i(j,{activeOpacity:r?1:.7,onPress:()=>!r&&b(),accessibilityLabel:$(t),accessibilityRole:"button",style:[o.toolRow,r&&o.rowDisabled],children:[e(l,{style:o.toolIconSlot,children:Ge(t)}),i(l,{style:o.rowInfo,children:[i(c,{style:o.rowLabel,children:[$(t),r?" \xB7 max 6":""]}),K?e(c,{style:o.rowCaption,numberOfLines:1,children:K}):null]}),e(ze,{value:s,disabled:r,onValueChange:()=>b(),accessibilityLabel:$(t)})]},t)};const fe=t=>{Oe(s=>{const r=new Set(s);if(r.has(t)){r.delete(t)}else{r.add(t)}return r})};const pe=(t,s,r,b,K)=>{const Qe=z.globalSettings?.[t]??false;const me=_.has(t);return i(l,{children:[i(j,{activeOpacity:.7,onPress:()=>fe(t),accessibilityLabel:s,style:o.settingRow,children:[i(l,{style:o.rowInfo,children:[e(c,{style:o.rowLabel,children:s}),e(c,{style:o.rowCaption,numberOfLines:me?0:1,children:r})]}),e(ze,{value:Qe,onValueChange:()=>Ve(t),accessibilityLabel:s})]}),me&&i(l,{style:o.settingRowBody,children:[e(c,{style:o.settingRowBodyText,children:b}),e(c,{style:o.settingRowBodyHint,children:K})]})]},t)};const B=(t,s,r)=>i(l,{children:[e(ut,{children:t}),s,r]});const Ye=T==="filesystem"?e(v,{label:"File System",tone:"accent"}):T==="asyncstorage"?e(v,{label:"Async Storage",tone:"warning"}):T==="localstorage"?e(v,{label:"Local Storage",tone:"accent"}):T==="memory"?e(v,{label:"Memory",tone:"danger"}):e(v,{label:"Loading\u2026",tone:"neutral"});const $e=()=>i(l,{style:o.container,children:[i(be,{style:o.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:o.scrollContainer,children:[E==="floating"&&e(H,{children:B("Floating Tools",e(R,{glass:true,children:e(X,{children:Object.entries(z.floatingTools).map(([t,s])=>qe(t,s,false,()=>Ne(t)))})}),e(xe,{children:"Tools switched on here appear in the floating bubble row."}))}),E==="settings"&&i(H,{children:[B("Background",e(R,{glass:true,padded:true,children:e(gt,{embedded:true})})),B("Storage",i(R,{glass:true,children:[i(j,{activeOpacity:.7,onPress:()=>We(!P),accessibilityLabel:"Storage Type",style:o.settingRow,children:[e(l,{style:o.rowInfo,children:e(c,{style:o.rowLabel,children:"Storage Type"})}),Ye,P?e(Te,{size:16,color:n.color.textTertiary}):e(we,{size:16,color:n.color.textTertiary})]}),P&&i(H,{children:[i(l,{style:o.settingRowBody,children:[e(c,{style:o.settingRowBodyText,children:T==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":T==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":T==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":T==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),T==="asyncstorage"&&e(c,{style:[o.settingRowBodyText,o.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),T==="memory"&&e(c,{style:[o.settingRowBodyText,o.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),e(ht,{}),i(l,{style:o.storageExpanded,children:[i(l,{style:o.storageExpandedHeader,children:[e(c,{style:o.storageExpandedTitle,children:"SAVED SETTINGS"}),e(c,{style:o.storageExpandedCount,children:le?"\u2026":`${Y.length} keys`})]}),le?e(c,{style:o.storageKeyEmpty,children:"Loading\u2026"}):Y.length===0?e(c,{style:o.storageKeyEmpty,children:"No settings saved yet"}):e(be,{style:o.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:Y.map(t=>e(l,{style:o.storageKeyItem,children:e(c,{style:o.storageKeyText,numberOfLines:1,children:t.replace("@react_buoy_","")})},t))})]}),e(l,{style:o.cardButtonWrap,children:e(Z,{label:G?"Cleared":U?"Clearing\u2026":"Clear All Settings",variant:G?"secondary":"destructive",size:"md",disabled:U,onPress:_e,icon:G?e(ve,{size:15,color:n.color.accent}):e(ct,{size:15,color:U?n.color.textTertiary:n.color.danger})})})]})]})),w&&w.state!=="idle"&&B("Desktop Sync",i(R,{glass:true,children:[i(j,{activeOpacity:.7,onPress:()=>fe("desktopSync"),accessibilityLabel:"Buoy Desktop",style:o.settingRow,children:[e(l,{style:o.rowInfo,children:e(c,{style:o.rowLabel,children:"Buoy Desktop"})}),w.state==="connected"?e(v,{label:"Connected",tone:"accent"}):w.state==="connecting"?e(v,{label:"Connecting\u2026",tone:"neutral"}):e(v,{label:"Retrying",tone:"warning"}),_.has("desktopSync")?e(Te,{size:16,color:n.color.textTertiary}):e(we,{size:16,color:n.color.textTertiary})]}),_.has("desktopSync")&&i(l,{style:o.settingRowBody,children:[i(c,{style:o.settingRowBodyText,children:[w.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",e(c,{style:o.footnoteMono,children:w.targetURL??"(unknown URL)"}),w.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),w.state==="retrying"&&w.lastError&&i(c,{style:[o.settingRowBodyText,o.bodyWarning],children:["Last error: ",w.lastError]})]})]})),B("Modal Behavior",e(R,{glass:true,children:i(X,{children:[pe("enableSharedModalDimensions","Shared Modal Size","Sync dimensions across all tools","When enabled, all tool modals will share the same size and position. Resizing one modal will affect all others. When disabled, each tool remembers its own size and position independently.","Keep OFF for the best experience. This allows you to customize each tool's modal size separately."),It(Ze.OS==="web")?pe("expandableWindowControls","Expand Controls","iPad-style expandable window buttons","When enabled, the window control buttons (minimize, toggle mode, close) start as small dots and expand into larger, easy-to-tap buttons when pressed. When disabled, buttons are directly tappable at their small size.","Keep ON for touch devices where the small buttons are hard to press. Turn OFF if you prefer direct single-tap access."):null]})}))]}),E==="pro"&&i(H,{children:[B("License",i(R,{glass:true,children:[i(l,{style:o.settingRow,children:[e(l,{style:o.rowInfo,children:e(c,{style:o.rowLabel,children:"License Status"})}),e(l,{testID:"buoy-settings-license-status",accessibilityLabel:k?"License: Active":"License: Free",children:k?e(v,{label:"Active",tone:"accent"}):e(v,{label:"Free",tone:"neutral"})})]}),I?.tierSource==="session"?i(l,{style:o.settingRow,children:[e(l,{style:o.rowInfo,children:e(c,{style:o.rowLabel,children:"Signed in with Buoy"})}),e(Z,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void lt(),testID:"buoy-settings-signout"})]}):null,I?.teamRole?e(l,{style:o.settingRow,testID:"buoy-settings-team-role",children:i(l,{style:o.rowInfo,children:[i(c,{style:o.rowLabel,children:["Role: ",I.teamRole]}),e(c,{style:o.rowCaption,children:I.allowedTools?"Your team picks the tools you see.":"You see all tools."})]})}):null]}),e(xe,{children:k?"You have full access to all Buoy DevTools features.":J?Me?`Couldn't reach the license server (${J}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${J}.`:"Upgrade to Pro to unlock all features and support development."})),!k&&i(H,{children:[B("Pro Features",e(R,{glass:true,children:e(X,{children:["Advanced Settings","Priority Support"].map(t=>i(l,{style:o.featureRow,children:[e(ve,{size:16,color:n.color.accent}),e(c,{style:o.rowLabel,children:t})]},t))})})),e(Z,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>re(true)})]})]})]}),e(dt,{visible:Fe,onClose:()=>re(false)})]});return e(xt,{visible:y,onClose:h,zIndex:p,variant:"night",header:{showToggleButton:false,customContent:e(l,{style:o.headerRow,children:e(yt,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:E,onChange:t=>ne(t)})})},initialMode:"bottomSheet",onModeChange:Je,persistenceKey:ee.settings.root(),enablePersistence:true,maxHeight:ge-de.top,initialHeight:Ae,initialFloatingPosition:{x:(ue-je)/2,y:de.top+20},enableGlitchEffects:true,children:$e()})};const Rt={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}};const Et=(y,h)=>{const a=new Set(y??[]);const f=new Set(h??[]);const d={};for(const p of f){d[p]=true}const g={environment:a.has("environment")};for(const p of a){if(p!=="environment"){g[p]=true}}return{dialTools:V(d),floatingTools:g,globalSettings:{enableSharedModalDimensions:false}}};let M=null;let te=null;let De=null;const Re=(y,h)=>JSON.stringify(y)===JSON.stringify(h);N.addListener(y=>{if(y)M=y});export const useDevToolsSettings=()=>{const{defaultFloatingTools:y,defaultDialTools:h}=Le();const a=A(()=>{if(!y&&!h){return Rt}return Et(y,h)},[y,h]);const[f,d]=S(a);const g=W(async()=>{try{const m=await D.getItem(O);if(m){const x=JSON.parse(m);const u=Be(a,x);d(u);return}d(a)}catch(m){console.error("[Buoy]","Failed to load dev tools settings:",m);d(a)}},[a]);C(()=>zt(m=>{if(m.includes(O))void g()}),[g]);C(()=>{g();const m=N.addListener(x=>{try{if(x){d(x)}}catch(u){}});return()=>{m()}},[g]);const p=W(()=>{g()},[g]);return{settings:f,refreshSettings:p}};const o=Xe.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:n.gutter,paddingRight:n.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:n.gutter,paddingTop:8,paddingBottom:24,gap:n.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:n.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:n.rowPadH,paddingVertical:n.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:n.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:n.color.text,fontSize:n.font.row,fontWeight:"500"},rowCaption:{color:n.color.textTertiary,fontSize:n.font.label},settingRowBody:{paddingHorizontal:n.rowPadH,paddingBottom:n.rowPadV,gap:6},settingRowBodyText:{color:n.color.textSecondary,fontSize:n.font.caption,lineHeight:n.font.caption*1.45},settingRowBodyHint:{color:n.color.textTertiary,fontSize:n.font.caption,lineHeight:n.font.caption*1.45},bodyWarning:{color:n.color.warning},bodyDanger:{color:n.color.danger},cardButtonWrap:{paddingHorizontal:n.cardPad,paddingTop:10,paddingBottom:n.cardPad},storageExpanded:{paddingHorizontal:n.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:n.color.textSecondary,fontSize:n.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:n.color.textTertiary,fontSize:n.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:n.color.glassElevated,borderRadius:n.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:n.color.textSecondary,fontSize:n.font.micro,fontFamily:Ie},storageKeyEmpty:{color:n.color.textTertiary,fontSize:n.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:Ie,fontSize:n.font.label,color:n.color.textSecondary}});
|
|
1
|
+
"use strict";import{useState as S,useEffect as C,useCallback as W,useMemo as A}from"react";import{View as l,Text as c,StyleSheet as Xe,ScrollView as be,TouchableOpacity as j,Dimensions as Se,Platform as Ze}from"react-native";import{settingsBus as N}from"./settingsBus.js";import{useDesktopSyncStatus as et}from"./useDesktopSyncStatus";import{SentryIcon as tt,WifiCircuitIcon as ot,ImageOverlayIcon as nt,RenderCountIcon as st,Info as Q,Layers as rt,ChevronRightIcon as we,ChevronDown as Te,getStorageBackendType as it,getUseLicense as at,signOutOfBuoy as lt,persistentStorage as D,Trash2 as ct,CheckCircle2 as ve,BuoyUpgradeSheet as dt,BackgroundSwitcher as gt,night as n,NightCard as R,NightRows as X,NightSectionLabel as ut,NightFootnote as xe,NightSwitch as ze,NightButton as Z,NightSegmented as yt,NightBadge as v,NightSeparator as ht,monoFont as Ie}from"@buoy-gg/shared-ui";import{EnvIcon as Ce,StorageIcon as ft,RoutesIcon as pt,NetworkIcon as mt,QueryIcon as bt,HighlighterIcon as St,ReduxIcon as wt,EventsIcon as Tt}from"@buoy-gg/floating-tools-core";import{useDefaultConfig as Le}from"./DefaultConfigContext.js";import{renderAppIcon as vt}from"./AppIcon";import{JsModal as xt,devToolsStorageKeys as ee,onSettingsApplied as zt,expandableWindowControlsSupported as It}from"@buoy-gg/shared-ui";import{useSafeAreaInsets as Ct}from"@buoy-gg/shared-ui";import{jsx as e,jsxs as i,Fragment as H}from"react/jsx-runtime";const O="@react_buoy_dev_tools_settings";const Lt=6;const V=y=>{let h=Lt;const a={};for(const[f,d]of Object.entries(y)){if(d&&h>0){a[f]=true;h-=1}else{a[f]=false}}return a};const Bt=(y,h)=>{const{userStatus:a,environment:f,...d}=y;const g=h?Object.entries(d).filter(([p])=>h.includes(p)):Object.entries(d);return{...Object.fromEntries(g),environment:f??false}};const Be=(y,h,a)=>{if(!h)return y;const f={...y.dialTools,...h.dialTools??{}};const d=a?.allowedDialKeys?Object.entries(f).filter(([p])=>a.allowedDialKeys?.includes(p)):Object.entries(f);const g=V(Object.fromEntries(d));return{dialTools:g,floatingTools:Bt({...y.floatingTools,...h.floatingTools??{}},a?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...h.globalSettings??{}}}};const Dt=(y=[],h,a)=>{const f={};const d={};const g=new Set(h??[]);const p=new Set(a??[]);const m=!a||a.length===0;for(const x of y){const{id:u,slot:L="both"}=x;if(L==="dial"||L==="both"){f[u]=m?true:p.has(u)}if(L==="row"||L==="both"){d[u]=g.has(u)}}return{dialTools:V(f),floatingTools:{...d,environment:g.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}};export const DevToolsSettingsModal=({visible:y,onClose:h,onSettingsChange:a,initialSettings:f,availableApps:d=[],storage:g=D,zIndex:p})=>{const{defaultFloatingTools:m,defaultDialTools:x}=Le();const u=A(()=>Dt(d,m,x),[d,m,x]);const L=A(()=>Object.keys(u.dialTools),[u]);const oe=A(()=>Object.keys(u.floatingTools).filter(t=>t!=="environment"),[u]);const[z,F]=S(f||M||u);const[E,ne]=S(te??"floating");const[se,Ee]=S(te!==null);const[_,Oe]=S(new Set);const[Fe,re]=S(false);const[ke,Pe]=S(false);C(()=>{const t=requestAnimationFrame(()=>Pe(true));return()=>cancelAnimationFrame(t)},[]);const w=et();C(()=>{const t=async()=>{try{const s=await D.getItem(ee.settings.activeTab());if(s&&["floating","settings","pro"].includes(s)){const r=s;te=r;ne(b=>b===r?b:r)}}catch(s){}finally{Ee(true)}};t()},[]);C(()=>{if(!se)return;D.setItem(ee.settings.activeTab(),E).catch(t=>{console.warn("[Buoy]","Failed to save settings active tab:",t)})},[E,se]);const He=at();const I=He?.();const k=I?.isPro??false;const J=!k&&I?.licenseKey?I.error:null;const Me=I?.errorKind==="transport";const[T,Ke]=S(De);const[U,ie]=S(false);const[G,q]=S(false);const[P,We]=S(false);const[Y,ae]=S([]);const[le,ce]=S(false);const de=Ct();const ge=Se.get("window").height;const ue=Se.get("window").width;const Ae=Math.floor(ge*.33);const je=Math.min(ue-32,400);const ye=W(async()=>{try{const t=await g.getItem(O);if(t){const s=JSON.parse(t);const r=Be(u,s,{allowedDialKeys:L,allowedFloatingKeys:oe});M=r;F(b=>Re(b,r)?b:r);return}M=u;F(s=>Re(s,u)?s:u)}catch(t){console.error("[Buoy]","Failed to load dev tools settings:",t);F(u)}},[u,L,oe,g]);C(()=>{ye()},[ye]);C(()=>{it().then(t=>{De=t;Ke(s=>s===t?s:t)})},[]);C(()=>{if(P){ce(true);D.getAllKeys().then(t=>{ae(t.sort())}).catch(()=>{ae([])}).finally(()=>{ce(false)})}},[P]);const he=async t=>{try{let s=null;try{const b=await g?.getItem(O);s=b?JSON.parse(b):null}catch{}const r={...t,dialTools:{...s?.dialTools,...V(t.dialTools)},floatingTools:{...s?.floatingTools,...t.floatingTools}};await g.setItem(O,JSON.stringify(r));M=r;F(r);a?.(r);N.emit(r)}catch(s){console.error("[Buoy]","Failed to save dev tools settings:",s)}};const Ne=t=>{const s={...z,floatingTools:{...z.floatingTools,[t]:!z.floatingTools[t]}};he(s)};const Ve=t=>{const s={...z,globalSettings:{...z.globalSettings,[t]:!z.globalSettings?.[t]}};he(s)};const _e=async()=>{ie(true);q(false);try{await D.clear();q(true);F(u);if(g!==D)await g.setItem(O,JSON.stringify(u));a?.(u);N.emit(u);setTimeout(()=>q(false),2e3)}catch(t){console.error("[Buoy]","Failed to clear storage:",t)}finally{ie(false)}};const Je=W(t=>{},[]);const Ue=t=>{const s=d.find(r=>r.id===t);if(s?.description){return s.description}if(t==="environment"){return"Environment badge."}return""};const $=t=>{if(t==="environment"){return"Env Badge"}const s=d.find(r=>r.id===t);return s?.name??t.toUpperCase().replace(/_/g," ")};const Ge=t=>{if(!ke)return null;switch(t){case"query":return e(bt,{size:18});case"env":return e(Ce,{size:18});case"sentry":return e(tt,{size:18,color:"#9945FF"});case"storage":return e(ft,{size:18,bgColor:n.color.surface});case"wifi":case"query-wifi-toggle":return e(ot,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return e(pt,{size:18,bgColor:n.color.surface});case"network":return e(mt,{size:18});case"environment":return e(Ce,{size:18});case"debug-borders":return e(rt,{size:18,color:n.color.accent});case"highlight-updates":return e(st,{size:18,color:n.color.accent});case"highlight-updates-modal":return e(St,{size:18});case"redux":return e(wt,{size:18});case"image-overlay":return e(nt,{size:18});case"events":return e(Tt,{size:18});case"zustand":try{const{ZustandIcon:s}=require("@buoy-gg/zustand");return e(s,{size:18})}catch{return e(Q,{size:18,color:n.color.textSecondary})}case"jotai":try{const{JotaiIcon:s}=require("@buoy-gg/jotai");return e(s,{size:18})}catch{return e(Q,{size:18,color:n.color.textSecondary})}default:{const s=d.find(r=>r.id===t);if(s?.icon!=null){return vt(s.icon,{slot:"row",size:18,color:s.color})}return e(Q,{size:18,color:n.color.textSecondary})}}};const qe=(t,s,r,b)=>{const K=Ue(t);return i(j,{activeOpacity:r?1:.7,onPress:()=>!r&&b(),accessibilityLabel:$(t),accessibilityRole:"button",style:[o.toolRow,r&&o.rowDisabled],children:[e(l,{style:o.toolIconSlot,children:Ge(t)}),i(l,{style:o.rowInfo,children:[i(c,{style:o.rowLabel,children:[$(t),r?" \xB7 max 6":""]}),K?e(c,{style:o.rowCaption,numberOfLines:1,children:K}):null]}),e(ze,{value:s,disabled:r,onValueChange:()=>b(),accessibilityLabel:$(t)})]},t)};const fe=t=>{Oe(s=>{const r=new Set(s);if(r.has(t)){r.delete(t)}else{r.add(t)}return r})};const pe=(t,s,r,b,K)=>{const Qe=z.globalSettings?.[t]??false;const me=_.has(t);return i(l,{children:[i(j,{activeOpacity:.7,onPress:()=>fe(t),accessibilityLabel:s,style:o.settingRow,children:[i(l,{style:o.rowInfo,children:[e(c,{style:o.rowLabel,children:s}),e(c,{style:o.rowCaption,numberOfLines:me?0:1,children:r})]}),e(ze,{value:Qe,onValueChange:()=>Ve(t),accessibilityLabel:s})]}),me&&i(l,{style:o.settingRowBody,children:[e(c,{style:o.settingRowBodyText,children:b}),e(c,{style:o.settingRowBodyHint,children:K})]})]},t)};const B=(t,s,r)=>i(l,{children:[e(ut,{children:t}),s,r]});const Ye=T==="filesystem"?e(v,{label:"File System",tone:"accent"}):T==="asyncstorage"?e(v,{label:"Async Storage",tone:"warning"}):T==="localstorage"?e(v,{label:"Local Storage",tone:"accent"}):T==="memory"?e(v,{label:"Memory",tone:"danger"}):e(v,{label:"Loading\u2026",tone:"neutral"});const $e=()=>i(l,{style:o.container,children:[i(be,{keyboardShouldPersistTaps:"handled",style:o.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:o.scrollContainer,children:[E==="floating"&&e(H,{children:B("Floating Tools",e(R,{glass:true,children:e(X,{children:Object.entries(z.floatingTools).map(([t,s])=>qe(t,s,false,()=>Ne(t)))})}),e(xe,{children:"Tools switched on here appear in the floating bubble row."}))}),E==="settings"&&i(H,{children:[B("Background",e(R,{glass:true,padded:true,children:e(gt,{embedded:true})})),B("Storage",i(R,{glass:true,children:[i(j,{activeOpacity:.7,onPress:()=>We(!P),accessibilityLabel:"Storage Type",style:o.settingRow,children:[e(l,{style:o.rowInfo,children:e(c,{style:o.rowLabel,children:"Storage Type"})}),Ye,P?e(Te,{size:16,color:n.color.textTertiary}):e(we,{size:16,color:n.color.textTertiary})]}),P&&i(H,{children:[i(l,{style:o.settingRowBody,children:[e(c,{style:o.settingRowBodyText,children:T==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":T==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":T==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":T==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),T==="asyncstorage"&&e(c,{style:[o.settingRowBodyText,o.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),T==="memory"&&e(c,{style:[o.settingRowBodyText,o.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),e(ht,{}),i(l,{style:o.storageExpanded,children:[i(l,{style:o.storageExpandedHeader,children:[e(c,{style:o.storageExpandedTitle,children:"SAVED SETTINGS"}),e(c,{style:o.storageExpandedCount,children:le?"\u2026":`${Y.length} keys`})]}),le?e(c,{style:o.storageKeyEmpty,children:"Loading\u2026"}):Y.length===0?e(c,{style:o.storageKeyEmpty,children:"No settings saved yet"}):e(be,{keyboardShouldPersistTaps:"handled",style:o.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:Y.map(t=>e(l,{style:o.storageKeyItem,children:e(c,{style:o.storageKeyText,numberOfLines:1,children:t.replace("@react_buoy_","")})},t))})]}),e(l,{style:o.cardButtonWrap,children:e(Z,{label:G?"Cleared":U?"Clearing\u2026":"Clear All Settings",variant:G?"secondary":"destructive",size:"md",disabled:U,onPress:_e,icon:G?e(ve,{size:15,color:n.color.accent}):e(ct,{size:15,color:U?n.color.textTertiary:n.color.danger})})})]})]})),w&&w.state!=="idle"&&B("Desktop Sync",i(R,{glass:true,children:[i(j,{activeOpacity:.7,onPress:()=>fe("desktopSync"),accessibilityLabel:"Buoy Desktop",style:o.settingRow,children:[e(l,{style:o.rowInfo,children:e(c,{style:o.rowLabel,children:"Buoy Desktop"})}),w.state==="connected"?e(v,{label:"Connected",tone:"accent"}):w.state==="connecting"?e(v,{label:"Connecting\u2026",tone:"neutral"}):e(v,{label:"Retrying",tone:"warning"}),_.has("desktopSync")?e(Te,{size:16,color:n.color.textTertiary}):e(we,{size:16,color:n.color.textTertiary})]}),_.has("desktopSync")&&i(l,{style:o.settingRowBody,children:[i(c,{style:o.settingRowBodyText,children:[w.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",e(c,{style:o.footnoteMono,children:w.targetURL??"(unknown URL)"}),w.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),w.state==="retrying"&&w.lastError&&i(c,{style:[o.settingRowBodyText,o.bodyWarning],children:["Last error: ",w.lastError]})]})]})),B("Modal Behavior",e(R,{glass:true,children:i(X,{children:[pe("enableSharedModalDimensions","Shared Modal Size","Sync dimensions across all tools","When enabled, all tool modals will share the same size and position. Resizing one modal will affect all others. When disabled, each tool remembers its own size and position independently.","Keep OFF for the best experience. This allows you to customize each tool's modal size separately."),It(Ze.OS==="web")?pe("expandableWindowControls","Expand Controls","iPad-style expandable window buttons","When enabled, the window control buttons (minimize, toggle mode, close) start as small dots and expand into larger, easy-to-tap buttons when pressed. When disabled, buttons are directly tappable at their small size.","Keep ON for touch devices where the small buttons are hard to press. Turn OFF if you prefer direct single-tap access."):null]})}))]}),E==="pro"&&i(H,{children:[B("License",i(R,{glass:true,children:[i(l,{style:o.settingRow,children:[e(l,{style:o.rowInfo,children:e(c,{style:o.rowLabel,children:"License Status"})}),e(l,{testID:"buoy-settings-license-status",accessibilityLabel:k?"License: Active":"License: Free",children:k?e(v,{label:"Active",tone:"accent"}):e(v,{label:"Free",tone:"neutral"})})]}),I?.tierSource==="session"?i(l,{style:o.settingRow,children:[e(l,{style:o.rowInfo,children:e(c,{style:o.rowLabel,children:"Signed in with Buoy"})}),e(Z,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void lt(),testID:"buoy-settings-signout"})]}):null,I?.teamRole?e(l,{style:o.settingRow,testID:"buoy-settings-team-role",children:i(l,{style:o.rowInfo,children:[i(c,{style:o.rowLabel,children:["Role: ",I.teamRole]}),e(c,{style:o.rowCaption,children:I.allowedTools?"Your team picks the tools you see.":"You see all tools."})]})}):null]}),e(xe,{children:k?"You have full access to all Buoy DevTools features.":J?Me?`Couldn't reach the license server (${J}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${J}.`:"Upgrade to Pro to unlock all features and support development."})),!k&&i(H,{children:[B("Pro Features",e(R,{glass:true,children:e(X,{children:["Advanced Settings","Priority Support"].map(t=>i(l,{style:o.featureRow,children:[e(ve,{size:16,color:n.color.accent}),e(c,{style:o.rowLabel,children:t})]},t))})})),e(Z,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>re(true)})]})]})]}),e(dt,{visible:Fe,onClose:()=>re(false)})]});return e(xt,{visible:y,onClose:h,zIndex:p,variant:"night",header:{showToggleButton:false,customContent:e(l,{style:o.headerRow,children:e(yt,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:E,onChange:t=>ne(t)})})},initialMode:"bottomSheet",onModeChange:Je,persistenceKey:ee.settings.root(),enablePersistence:true,maxHeight:ge-de.top,initialHeight:Ae,initialFloatingPosition:{x:(ue-je)/2,y:de.top+20},enableGlitchEffects:true,children:$e()})};const Rt={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}};const Et=(y,h)=>{const a=new Set(y??[]);const f=new Set(h??[]);const d={};for(const p of f){d[p]=true}const g={environment:a.has("environment")};for(const p of a){if(p!=="environment"){g[p]=true}}return{dialTools:V(d),floatingTools:g,globalSettings:{enableSharedModalDimensions:false}}};let M=null;let te=null;let De=null;const Re=(y,h)=>JSON.stringify(y)===JSON.stringify(h);N.addListener(y=>{if(y)M=y});export const useDevToolsSettings=()=>{const{defaultFloatingTools:y,defaultDialTools:h}=Le();const a=A(()=>{if(!y&&!h){return Rt}return Et(y,h)},[y,h]);const[f,d]=S(a);const g=W(async()=>{try{const m=await D.getItem(O);if(m){const x=JSON.parse(m);const u=Be(a,x);d(u);return}d(a)}catch(m){console.error("[Buoy]","Failed to load dev tools settings:",m);d(a)}},[a]);C(()=>zt(m=>{if(m.includes(O))void g()}),[g]);C(()=>{g();const m=N.addListener(x=>{try{if(x){d(x)}}catch(u){}});return()=>{m()}},[g]);const p=W(()=>{g()},[g]);return{settings:f,refreshSettings:p}};const o=Xe.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:n.gutter,paddingRight:n.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:n.gutter,paddingTop:8,paddingBottom:24,gap:n.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:n.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:n.rowPadH,paddingVertical:n.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:n.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:n.color.text,fontSize:n.font.row,fontWeight:"500"},rowCaption:{color:n.color.textTertiary,fontSize:n.font.label},settingRowBody:{paddingHorizontal:n.rowPadH,paddingBottom:n.rowPadV,gap:6},settingRowBodyText:{color:n.color.textSecondary,fontSize:n.font.caption,lineHeight:n.font.caption*1.45},settingRowBodyHint:{color:n.color.textTertiary,fontSize:n.font.caption,lineHeight:n.font.caption*1.45},bodyWarning:{color:n.color.warning},bodyDanger:{color:n.color.danger},cardButtonWrap:{paddingHorizontal:n.cardPad,paddingTop:10,paddingBottom:n.cardPad},storageExpanded:{paddingHorizontal:n.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:n.color.textSecondary,fontSize:n.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:n.color.textTertiary,fontSize:n.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:n.color.glassElevated,borderRadius:n.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:n.color.textSecondary,fontSize:n.font.micro,fontFamily:Ie},storageKeyEmpty:{color:n.color.textTertiary,fontSize:n.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:Ie,fontSize:n.font.label,color:n.color.textSecondary}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{FloatingToolHost as
|
|
1
|
+
"use strict";import{FloatingToolHost as le}from"@buoy-gg/shared-ui";import{AccountSetup as ae,setBuoyAppId as ge,startSettingsSync as ye}from"@buoy-gg/shared-ui";import $e,{useMemo as t,useCallback as pe,useEffect as m}from"react";import{View as G,StyleSheet as K}from"react-native";import{AppHostProvider as de}from"./AppHost";import{TeamToolCloser as me}from"./TeamToolCloser.js";import{NO_TEAM_TOOLS_NOTE as fe}from"./teamToolsNote.js";import{FloatingMenu as ve}from"./FloatingMenu.js";import{AppOverlay as be}from"./AppHost";import{ToolOpenerBridge as he}from"./ToolOpenerBridge.js";import{autoDiscoverPresets as Te,autoDiscoverPresetsWithCustom as Oe}from"./autoDiscoverPresets.js";import{sendInstallPing as Ae}from"../telemetry/installPing.js";import{defaultLicenseKey as qe,isTelemetryEnabled as Ie}from"../Buoy.js";import{renderAppIcon as Re}from"./AppIcon";import{DevToolsVisibilityProvider as _e}from"./DevToolsVisibilityContext.js";import{reportOptionalRequireError as n}from"./optionalRequire.js";import{HintsProvider as Ee,normalizeEnvironment as xe}from"@buoy-gg/shared-ui";import{MinimizedToolsProvider as Pe}from"./MinimizedToolsContext.js";import{validateDialConfig as Se}from"./defaultConfig.js";import{DefaultConfigProvider as ke}from"./DefaultConfigContext.js";import{LicenseManager as De,useProAccess as Me,useLicense as Ce,sameLicenseKey as Le}from"@buoy-gg/license";import*as ze from"@buoy-gg/license";import{filterTeamTools as je}from"@buoy-gg/floating-tools-core";import{BuoySignIn as X}from"./BuoySignIn";import{AutoExternalSync as Y,ToolRegistryPublisher as we,isExternalSyncAvailable as Fe}from"./autoExternalSync.js";import{externalSyncOptions as j,releaseTransportProblem as He,shouldMountExternalSync as Be}from"./externalSyncGate.js";import{jsx as r,Fragment as _,jsxs as f}from"react/jsx-runtime";let Z=null;function Ne(i){if(!i||i===Z)return;Z=i;console.warn("[Buoy]",i)}function ee(i){if(i&&typeof i==="object"&&i.appId)return i.appId;try{const{Platform:s}=require("react-native");const u=require("expo-constants");const l=(u?.default??u)?.expoConfig;const v=s.OS==="android"?l?.android?.package:l?.ios?.bundleIdentifier;if(typeof v==="string"&&v)return v}catch{}try{const s=require("expo-application");const u=(s?.default??s)?.applicationId;if(typeof u==="string"&&u)return u}catch{}return null}export const FloatingDevTools=({apps:i,requiredEnvVars:s,requiredStorageKeys:u,askBuoy:l,children:v,disableHints:re=false,defaultFloatingTools:te,defaultDialTools:h,requireLicense:Ue,licenseKey:T,zustandStores:E,environment:oe,externalSync:O=true,headless:x=false,signIn:A,...w})=>{const ne=oe??xe(process.env.NODE_ENV??"dev");const{isLicensed:q}=Me();const{licenseKey:P,isInitialized:F,tier:I,access:c,allowedTools:R}=Ce();const ie=T===void 0||Le(T,P);const S=ie&&c.status==="admitted";m(()=>{if(!F||c.status==="initializing")return;void Ae({tier:c.status==="admitted"?I:"locked",enabled:Ie()})},[F,c.status,I]);const b=A?ee(A):null;m(()=>{if(!b)return;const e=ze.SessionManager;if(!e)return;e.configure({audience:`app:${b}`});void e.load().catch(()=>{})},[b]);m(()=>{ge(b??ee(true))},[b]);m(()=>{void De.configure(T??qe()).catch(()=>{})},[T]);m(()=>{if(S)ye()},[S]);m(()=>{if(!E||c.status==="locked")return;try{const{watchStores:e}=require("@buoy-gg/zustand");return e(E)}catch(e){n("@buoy-gg/zustand",e)}},[E,c.status]);const se=t(()=>{if(h){return Se(h)}return h},[h]);const k=t(()=>{const e=[];if(s&&s.length>0){try{const{createEnvTool:o,createEnvVarConfig:z}=require("@buoy-gg/env");e.push(o({requiredEnvVars:z(s)}))}catch(o){n("@buoy-gg/env",o)}}if(u&&u.length>0){try{const{createStorageTool:o}=require("@buoy-gg/storage");e.push(o({requiredStorageKeys:u}))}catch(o){n("@buoy-gg/storage",o)}}if(l){try{const{createAskBuoyTool:o}=require("@buoy-gg/ask-buoy");e.push(o(l))}catch(o){n("@buoy-gg/ask-buoy",o)}}return e},[s,u,l]);const D=t(()=>{if(!i&&k.length===0)return void 0;return[...i||[],...k]},[i,k]);const a=t(()=>D?Oe(D):Te(),[D]);const M=t(()=>a.filter(e=>e.sync),[a]);const ue=t(()=>je(a,R),[a,R]);const H=t(()=>{try{const{DebugBordersStandaloneOverlay:e}=require("@buoy-gg/debug-borders");return e}catch(e){n("@buoy-gg/debug-borders",e);return null}},[]);const B=t(()=>{try{const{HighlightUpdatesOverlay:e}=require("@buoy-gg/highlight-updates");return e}catch(e){n("@buoy-gg/highlight-updates",e);return null}},[]);const N=t(()=>{try{const{ImageOverlayStandalone:e}=require("@buoy-gg/image-overlay");return e}catch(e){n("@buoy-gg/image-overlay",e);return null}},[]);const V=t(()=>{try{const{PerfMonitorOverlay:e}=require("@buoy-gg/perf-monitor");return e}catch(e){n("@buoy-gg/perf-monitor",e);return null}},[]);const U=t(()=>{try{const{JsTopHudOverlay:e}=require("@buoy-gg/js-top");return e}catch(e){n("@buoy-gg/js-top",e);return null}},[]);const g=t(()=>{try{const{RouteTracker:e}=require("@buoy-gg/route-events");return e}catch(e){n("@buoy-gg/route-events",e);return null}},[]);const y=t(()=>{try{const{ReactQueryTracker:e}=require("@buoy-gg/react-query");return e}catch(e){n("@buoy-gg/react-query",e);return null}},[]);const J=t(()=>{try{const{ImpersonateOverlay:e}=require("@buoy-gg/impersonate");return e}catch(e){n("@buoy-gg/impersonate",e);return null}},[]);const Q=t(()=>{try{const{ScenariosOverlay:e}=require("@buoy-gg/scenarios");return e}catch(e){n("@buoy-gg/scenarios",e);return null}},[]);const p=t(()=>{try{const{ReduxAutoInstrument:e}=require("@buoy-gg/redux");return e??null}catch(e){n("@buoy-gg/redux",e);return null}},[]);const d=t(()=>{try{const{ConsoleRoot:e}=require("@buoy-gg/console");return e??null}catch(e){n("@buoy-gg/console",e);return null}},[]);const ce=pe(e=>{const o=a.find(z=>z.id===e);if(!o)return null;return Re(o.icon,{slot:"dial",size:20,color:o.color})},[a]);const C=typeof __DEV__!=="undefined"&&__DEV__;if(!C&&!q){return A&&!x?r(X,{needsPlan:true}):null}const W=Be({isDevelopment:C,isLicensed:q,externalSync:O,isAvailable:Fe()});const L=j(O);if(!C&&L?.enableInRelease){Ne(He(L.socketURL,L))}const $=r(we,{requiredEnvVars:s,customApps:M});if(!S){return f(_,{children:[c.status==="initializing"&&f(_,{children:[p&&r(p,{}),d&&r(d,{}),g&&r(g,{}),y&&r(y,{})]}),!x&&(A?r(X,{}):r(ae,{}))]})}if(x){return f(_,{children:[p&&r(p,{}),d&&r(d,{}),g&&r(g,{}),y&&r(y,{}),$,W&&r(Y,{options:j(O),requiredEnvVars:s,isPro:q,tier:I,licenseKey:P,customApps:M})]})}return r(ke,{defaultFloatingTools:te,defaultDialTools:se,children:r(Ee,{disableHints:re,children:r(G,{style:Ve.container,pointerEvents:"box-none",__buoyDevToolsRoot:true,children:f(_e,{children:[N&&r(G,{style:K.absoluteFill,pointerEvents:"box-none",collapsable:false,children:r(N,{})}),r(de,{children:f(Pe,{getToolIcon:ce,children:[r(ve,{...w,apps:ue,emptyNote:R?fe:void 0,environment:ne}),w.hidden?null:f(_,{children:[r(be,{}),r(le,{})]}),r(he,{}),r(me,{allowedTools:R??null})]})}),v,H&&r(H,{}),B&&r(B,{}),V&&r(V,{}),U&&r(U,{}),J&&r(J,{}),Q&&r(Q,{}),p&&r(p,{}),d&&r(d,{}),g&&r(g,{}),y&&r(y,{}),$,W&&r(Y,{options:j(O),requiredEnvVars:s,isPro:q,tier:I,licenseKey:P,customApps:M})]})})})})};const Ve=K.create({container:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:9999}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{BuoyPortal as _e,FloatingToolHost as Me}from"@buoy-gg/shared-ui/floating";import*as ke from"@buoy-gg/license";import{LicenseManager as Pe,useLicense as ce,sameLicenseKey as xe,resolveDevBuild as Re,capacitorDebug as Be,isCapacitorNative as Fe,loadCapacitorAppHost as Le}from"@buoy-gg/license";import{AccountSetup as je,HintsProvider as Ne,normalizeEnvironment as Ve,registerToolOpener as de,startSettingsSync as ze}from"@buoy-gg/shared-ui";import{useState as H,useMemo as g,useCallback as I,useEffect as d,useRef as ue}from"react";import{useSettings as We,getToolLabel as R,getToolDescription as Ke,getToolColor as fe}from"@buoy-gg/floating-tools-react";import{persistentStorage as h,devToolsStorageKeys as B,EnvironmentIndicator as He,EnvironmentSelectorInline as Ue}from"@buoy-gg/shared-ui";import{autoDiscoverWithCustom as $e,getToolsBySlot as pe}from"../utils/autoDiscoverPresets.web.js";import{filterTeamTools as Ye,isTeamToolAllowed as Ge}from"@buoy-gg/floating-tools-core";import{NO_TEAM_TOOLS_NOTE as Qe}from"./teamToolsNote.js";import{FloatingTools as Je,UserStatus as Xe}from"./floatingTools.web.js";import{DialMenu as Ze}from"./dial/DialDevTools.web.js";import{getRankedToolIds as qe,recordToolUsage as en}from"./dial/dialUsageStore.js";import{OnboardingTooltip as nn}from"./dial/OnboardingTooltip.web.js";import{SettingsModal as on}from"./DevToolsSettingsModal.web.js";import{AppHostProvider as tn,AppOverlay as sn,useAppHost as me}from"./AppHost.web.js";import{MinimizedToolsStack as rn}from"./MinimizedToolsStack.web.js";import{createWebTools as an}from"../utils/createWebTools.js";import{BrowserToolRuntime as ln}from"./BrowserToolRuntime.js";import{clearReleaseOptIn as cn,markReleaseOptIn as dn}from"../releaseOptIn.js";import{BuoySignIn as un}from"./BuoySignIn.web.js";import{BuoySignIn as ge}from"./BuoyCodeSignIn.js";import{DevToolsVisibilityProvider as fn,useDevToolsVisibility as pn}from"./DevToolsVisibilityContext.js";import{createWebTool as U}from"../utils/createWebTool.js";import{DefaultConfigProvider as mn}from"./DefaultConfigContext.js";import{useDevToolsSettings as gn}from"./DevToolsSettingsModal.shared.js";import{validateDialConfig as Te}from"./defaultConfig.js";import{installedTools as Tn,installedToolsFound as vn}from"../installedTools.js";import{jsx as t,jsxs as _,Fragment as $}from"react/jsx-runtime";const ve={};const ye="@react_buoy_floating_menu_tooltip_shown";const yn=h;function hn({size:n=14,color:s="#20C997"}){const i=Math.max(2,n/4);const l=Math.max(1,n/16);return t("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${i}px)`,gap:l,width:n,height:n,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((a,r)=>t("div",{style:{width:i,height:i,borderRadius:i/2,backgroundColor:s}},r))})}function bn(n){const{defaultFloatingTools:s,defaultDialTools:i,disableHints:l=false,children:a}=n;const r=g(()=>i?Te(i):i,[i]);return t(mn,{defaultFloatingTools:s,defaultDialTools:r,children:t(Ne,{disableHints:l,children:_(fn,{children:[t(tn,{children:t(En,{...n})}),a]})})})}const On=["ReduxAutoInstrument","ConsoleRoot","RouteTracker","ReactQueryTracker"];function Sn({modules:n=ve}){return t($,{children:Object.entries(n).flatMap(([s,i])=>On.map(l=>{const a=i[l];return a?t(a,{},`${s}:${l}`):null}))})}function Cn(){const{openApps:n,restore:s}=me();d(()=>de(i=>{const l=n.find(a=>a.id===i);if(!l)return false;s(l.instanceId);return true}),[n,s]);return null}function Dn(){const n=Be();const s=n===null?process.env.NODE_ENV:n?"development":"production";return Ve(s??"dev")}function In(n,s,i,l){const a=M=>Object.entries(n).find(([v])=>v.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")===M)?.[1];const r=[];const c=a("env");if(s?.length&&c?.createEnvTool&&c.createEnvVarConfig){r.push(U(c.createEnvTool({requiredEnvVars:c.createEnvVarConfig(s)})))}const p=a("storage");if(i?.length&&p?.createStorageTool){r.push(U(p.createStorageTool({requiredStorageKeys:i})))}const E=a("ask-buoy");const b=l==="hosted"?E?.hostedAskBuoy?.():l;if(b&&E?.createAskBuoyTool)r.push(U(E.createAskBuoyTool(b)));return r}function En({environment:n,userRole:s="admin",availableEnvironments:i,onEnvironmentSwitch:l,apps:a,modules:r=ve,externalSync:c,requiredEnvVars:p,sentryGetClient:E,disableHints:b=false,headless:M=false,hidden:v=false,defaultFloatingTools:be,defaultDialTools:F,zustandStores:L,requiredStorageKeys:Y,askBuoy:G}){const j=n??Dn();const Oe=g(()=>F?Te(F):void 0,[F]);const[m,w]=H(false);const[O,k]=H(false);const N=ue(false);const T=me();const Q=g(()=>In(r,p,Y,G),[r,p,Y,G]);const{allowedTools:S}=ce();const f=g(()=>Ye($e([...an(r),...a??[],...Q]),S),[a,r,Q,S]);const{openApps:J,close:X}=T;d(()=>{if(!S)return;for(const e of J){if(!Ge(e.id,S))X(e.instanceId)}},[J,S,X]);const V=g(()=>Object.entries(r).find(([e])=>e.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")==="zustand")?.[1],[r]);d(()=>{if(!L||typeof V?.watchStores!=="function")return;const e=V.watchStores(L);return typeof e==="function"?e:void 0},[L,V]);const P=pn();const Z=T.openApps.some(e=>!e.minimized);d(()=>{P.setDialOpen(m)},[m,P.setDialOpen]);d(()=>{P.setToolOpen(Z||O)},[Z,O,P.setToolOpen]);const{registerApps:q}=T;d(()=>{q(f.map(e=>{const o=e.icon;return{...e,icon:typeof o==="function"?({size:u})=>o(u):o}}))},[q,f]);const Se=g(()=>f.map(e=>({id:e.id,name:e.name,description:e.description,slot:e.slot})),[f]);We({availableTools:Se,storage:yn});d(()=>{let e=false;const o=async()=>{const[u,y]=await Promise.all([h.getItem(B.dial.isOpen()),h.getItem(B.settings.modalOpen())]);if(e)return;if(u==="true")w(true);if(y==="true"){w(true);k(true)}N.current=true};void o();return()=>{e=true}},[]);d(()=>{if(!N.current)return;void h.setItem(B.dial.isOpen(),m?"true":"false")},[m]);d(()=>{if(!N.current)return;void h.setItem(B.settings.modalOpen(),O?"true":"false")},[O]);const A=I(e=>{void en(e.id);if(e.launchMode==="toggle-only"){e.onPress?.();return}if(e.component){const o=typeof e.icon==="function"?e.icon(20):e.icon;T.open({id:e.id,title:e.name||R(e.id),component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:o,color:e.color||fe(e.id)})}else{e.onPress?.()}},[T]);const ee=ue({tools:f,openApps:T.openApps,openTool:A});ee.current={tools:f,openApps:T.openApps,openTool:A};d(()=>de(e=>{const{tools:o,openApps:u,openTool:y}=ee.current;if(u.some(K=>K.id===e))return false;const W=o.find(K=>K.id===e);if(!W||W.launchMode==="toggle-only")return false;y(W);return true}),[]);const x=g(()=>{const e=pe(f,"dial");return e.map(o=>{const u=o.color||fe(o.id);let y;if(typeof o.icon==="string"){y=o.icon}else if(typeof o.icon==="function"){y=o.icon(32)}else{y=null}return{id:o.id,name:o.name||R(o.id),icon:y,unavailable:!o.component&&!o.onPress,color:u,onPress:()=>{A(o);w(false)}}})},[f,A]);const ne=g(()=>{if(!m)return x;const e=new Map(x.map(o=>[o.id,o]));return qe(x.map(o=>o.id)).map(o=>e.get(o)).filter(o=>Boolean(o))},[m,x]);const{settings:z}=gn();const Ce=g(()=>pe(f,"row").filter(e=>(z.floatingTools[e.id]??false)===true&&(e.component||e.onPress)),[f,z.floatingTools]);const De=g(()=>f.map(e=>({id:e.id,name:e.name||R(e.id),description:e.description||Ke(e.id),slot:e.slot,icon:e.icon,color:e.color})),[f]);const[Ie,oe]=H(false);const te=T.openApps.some(e=>!e.minimized);d(()=>{if(b)return;let e=false;const o=setTimeout(async()=>{const u=await h.getItem(ye);if(!e&&!u)oe(true)},1e3);return()=>{e=true;clearTimeout(o)}},[b]);const C=I(()=>{oe(false);void h.setItem(ye,"true")},[]);const ie=I(()=>{C();w(true)},[C]);const Ee=I(()=>{w(false);k(false)},[]);const we=I(()=>{k(e=>!e)},[]);const Ae=I(()=>k(false),[]);const se=Boolean(i?.length&&l);const re=z.floatingTools.environment!==false;const D=Ie&&!m&&!te&&!v;d(()=>{if(!D)return;const e=u=>{if(!(u.target instanceof Element)||!u.target.closest("[data-buoy-root]"))C()};const o=u=>{if(u.key==="Escape")C()};document.addEventListener("pointerdown",e,true);document.addEventListener("keydown",o);return()=>{document.removeEventListener("pointerdown",e,true);document.removeEventListener("keydown",o)}},[D,C]);const ae=T.openApps.some(e=>e.minimized&&e.launchMode!=="toggle-only");const le=t(ln,{modules:r,apps:a,requiredEnvVars:p,externalSync:c,headless:M,sentryGetClient:E});if(M)return le;return _("div",{"data-buoy-root":"",style:{display:"contents"},children:[le,t(Cn,{}),D&&t("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),t("div",{style:v?{visibility:"hidden"}:{display:"contents"},"aria-hidden":v||void 0,children:_(Je,{enablePositionPersistence:!D,pushToSide:m||te,suspendPointerEvents:m,centerOnboarding:D,minimizedStack:ae?t(rn,{}):void 0,hasMinimizedStack:ae,children:[j&&re&&!se&&t(He,{environment:j}),se&&re&&t(Ue,{currentEnvironment:j??"local",availableEnvironments:i,onSelect:l}),s?t(Xe,{userRole:s,onPress:ie}):t("button",{"aria-label":"Open dev tools",onClick:ie,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:t(hn,{})}),Ce.map(e=>t("button",{"aria-label":e.name||R(e.id),title:e.description,onClick:()=>A(e),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof e.icon==="function"?e.icon(16):e.icon},e.id))]})}),D&&t(nn,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:C}),m&&!v&&t(Ze,{icons:ne,onClose:Ee,centerLabel:"BUOY",onCenterPress:we,settingsOpen:O,hintsDisabled:b,emptyNote:S&&ne.length===0?Qe:void 0}),O&&!v&&t(on,{visible:true,onClose:Ae,availableTools:De,defaultFloatingTools:be,defaultDialTools:Oe,onSettingsChange:e=>{}}),!v&&_($,{children:[t(sn,{}),t(Me,{})]})]})}function wn(n){const s=n&&typeof n==="object"?n.appId:void 0;const i=!!n;d(()=>{if(!i)return;let l=false;const a=ke.SessionManager;if(!a)return;const r=c=>{if(l||!c)return;a.configure({audience:`app:${c}`});void a.load().catch(()=>{})};if(s)r(s);else void Le().then(c=>r(c?.bundleId)).catch(()=>{});return()=>{l=true}},[i,s])}let he=false;function An(n){if(n.modules)return n;if(!vn&&!he&&typeof console!=="undefined"){he=true;console.info("[Buoy] No tools loaded. Add buoy() from '@buoy-gg/core/vite' to your Vite plugins, or pass modules to FloatingDevTools.")}return{...n,modules:Tn}}export function FloatingDevTools(n){return t(_e,{children:t(_n,{...An(n)})})}function _n(n){const{access:s,isPro:i,licenseKey:l}=ce();d(()=>{void Pe.configure(n.licenseKey)},[n.licenseKey]);const a=n.licenseKey===void 0||xe(n.licenseKey,l);const r=Re(typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production");const c=a&&s.status==="admitted";d(()=>{if(c)ze()},[c]);d(()=>{if(r||s.status==="initializing")return;if(i&&c)dn();else cn()},[r,i,c,s.status]);const p=Fe();wn(p?n.signIn:void 0);if(!r&&!i){if(!n.signIn||n.headless)return null;return p?t(ge,{needsPlan:true}):t(un,{})}if(!c){return _($,{children:[s.status==="initializing"&&t(Sn,{modules:n.modules}),n.headless?null:n.signIn&&p?t(ge,{}):t(je,{})]})}return t(bn,{...n})}
|
|
1
|
+
"use strict";import{BuoyPortal as ke,FloatingToolHost as xe}from"@buoy-gg/shared-ui/floating";import*as Re from"@buoy-gg/license";import{LicenseManager as Be,useLicense as de,sameLicenseKey as Le,resolveDevBuild as Fe,capacitorDebug as je,isCapacitorNative as ue,loadCapacitorAppHost as fe}from"@buoy-gg/license";import{AccountSetup as Ne,HintsProvider as Ve,normalizeEnvironment as ze,registerToolOpener as pe,setBuoyAppId as H,startSettingsSync as Ke}from"@buoy-gg/shared-ui";import{useState as U,useMemo as g,useCallback as D,useEffect as d,useRef as me}from"react";import{useSettings as We,getToolLabel as R,getToolDescription as He,getToolColor as ge}from"@buoy-gg/floating-tools-react";import{persistentStorage as h,devToolsStorageKeys as B,EnvironmentIndicator as Ue,EnvironmentSelectorInline as $e}from"@buoy-gg/shared-ui";import{autoDiscoverWithCustom as Ye,getToolsBySlot as Te}from"../utils/autoDiscoverPresets.web.js";import{filterTeamTools as Ge,isTeamToolAllowed as Qe}from"@buoy-gg/floating-tools-core";import{NO_TEAM_TOOLS_NOTE as Je}from"./teamToolsNote.js";import{FloatingTools as Xe,UserStatus as Ze}from"./floatingTools.web.js";import{DialMenu as qe}from"./dial/DialDevTools.web.js";import{getRankedToolIds as en,recordToolUsage as nn}from"./dial/dialUsageStore.js";import{OnboardingTooltip as on}from"./dial/OnboardingTooltip.web.js";import{SettingsModal as tn}from"./DevToolsSettingsModal.web.js";import{AppHostProvider as sn,AppOverlay as rn,useAppHost as ve}from"./AppHost.web.js";import{MinimizedToolsStack as ln}from"./MinimizedToolsStack.web.js";import{createWebTools as an}from"../utils/createWebTools.js";import{BrowserToolRuntime as cn}from"./BrowserToolRuntime.js";import{clearReleaseOptIn as dn,markReleaseOptIn as un}from"../releaseOptIn.js";import{BuoySignIn as fn}from"./BuoySignIn.web.js";import{defaultLicenseKey as pn}from"../Buoy.js";import{BuoySignIn as ye}from"./BuoyCodeSignIn.js";import{DevToolsVisibilityProvider as mn,useDevToolsVisibility as gn}from"./DevToolsVisibilityContext.js";import{createWebTool as $}from"../utils/createWebTool.js";import{DefaultConfigProvider as Tn}from"./DefaultConfigContext.js";import{useDevToolsSettings as vn}from"./DevToolsSettingsModal.shared.js";import{validateDialConfig as he}from"./defaultConfig.js";import{installedTools as yn,installedToolsFound as hn}from"../installedTools.js";import{jsx as t,jsxs as _,Fragment as Y}from"react/jsx-runtime";const be={};const Oe="@react_buoy_floating_menu_tooltip_shown";const bn=h;function On({size:n=14,color:i="#20C997"}){const s=Math.max(2,n/4);const l=Math.max(1,n/16);return t("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${s}px)`,gap:l,width:n,height:n,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((a,r)=>t("div",{style:{width:s,height:s,borderRadius:s/2,backgroundColor:i}},r))})}function Sn(n){const{defaultFloatingTools:i,defaultDialTools:s,disableHints:l=false,children:a}=n;const r=g(()=>s?he(s):s,[s]);return t(Tn,{defaultFloatingTools:i,defaultDialTools:r,children:t(Ve,{disableHints:l,children:_(mn,{children:[t(sn,{children:t(wn,{...n})}),a]})})})}const In=["ReduxAutoInstrument","ConsoleRoot","RouteTracker","ReactQueryTracker"];function Cn({modules:n=be}){return t(Y,{children:Object.entries(n).flatMap(([i,s])=>In.map(l=>{const a=s[l];return a?t(a,{},`${i}:${l}`):null}))})}function Dn(){const{openApps:n,restore:i}=ve();d(()=>pe(s=>{const l=n.find(a=>a.id===s);if(!l)return false;i(l.instanceId);return true}),[n,i]);return null}function An(){const n=je();const i=n===null?process.env.NODE_ENV:n?"development":"production";return ze(i??"dev")}function En(n,i,s,l){const a=M=>Object.entries(n).find(([v])=>v.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")===M)?.[1];const r=[];const c=a("env");if(i?.length&&c?.createEnvTool&&c.createEnvVarConfig){r.push($(c.createEnvTool({requiredEnvVars:c.createEnvVarConfig(i)})))}const p=a("storage");if(s?.length&&p?.createStorageTool){r.push($(p.createStorageTool({requiredStorageKeys:s})))}const A=a("ask-buoy");const b=l==="hosted"?A?.hostedAskBuoy?.():l;if(b&&A?.createAskBuoyTool)r.push($(A.createAskBuoyTool(b)));return r}function wn({environment:n,userRole:i="admin",availableEnvironments:s,onEnvironmentSwitch:l,apps:a,modules:r=be,externalSync:c,requiredEnvVars:p,sentryGetClient:A,disableHints:b=false,headless:M=false,hidden:v=false,defaultFloatingTools:Ie,defaultDialTools:L,zustandStores:F,requiredStorageKeys:G,askBuoy:Q}){const j=n??An();const Ce=g(()=>L?he(L):void 0,[L]);const[m,E]=U(false);const[O,P]=U(false);const N=me(false);const T=ve();const J=g(()=>En(r,p,G,Q),[r,p,G,Q]);const{allowedTools:S}=de();const f=g(()=>Ge(Ye([...an(r),...a??[],...J]),S),[a,r,J,S]);const{openApps:X,close:Z}=T;d(()=>{if(!S)return;for(const e of X){if(!Qe(e.id,S))Z(e.instanceId)}},[X,S,Z]);const V=g(()=>Object.entries(r).find(([e])=>e.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")==="zustand")?.[1],[r]);d(()=>{if(!F||typeof V?.watchStores!=="function")return;const e=V.watchStores(F);return typeof e==="function"?e:void 0},[F,V]);const k=gn();const q=T.openApps.some(e=>!e.minimized);d(()=>{k.setDialOpen(m)},[m,k.setDialOpen]);d(()=>{k.setToolOpen(q||O)},[q,O,k.setToolOpen]);const{registerApps:ee}=T;d(()=>{ee(f.map(e=>{const o=e.icon;return{...e,icon:typeof o==="function"?({size:u})=>o(u):o}}))},[ee,f]);const De=g(()=>f.map(e=>({id:e.id,name:e.name,description:e.description,slot:e.slot})),[f]);We({availableTools:De,storage:bn});d(()=>{let e=false;const o=async()=>{const[u,y]=await Promise.all([h.getItem(B.dial.isOpen()),h.getItem(B.settings.modalOpen())]);if(e)return;if(u==="true")E(true);if(y==="true"){E(true);P(true)}N.current=true};void o();return()=>{e=true}},[]);d(()=>{if(!N.current)return;void h.setItem(B.dial.isOpen(),m?"true":"false")},[m]);d(()=>{if(!N.current)return;void h.setItem(B.settings.modalOpen(),O?"true":"false")},[O]);const w=D(e=>{void nn(e.id);if(e.launchMode==="toggle-only"){e.onPress?.();return}if(e.component){const o=typeof e.icon==="function"?e.icon(20):e.icon;T.open({id:e.id,title:e.name||R(e.id),component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:o,color:e.color||ge(e.id)})}else{e.onPress?.()}},[T]);const ne=me({tools:f,openApps:T.openApps,openTool:w});ne.current={tools:f,openApps:T.openApps,openTool:w};d(()=>pe(e=>{const{tools:o,openApps:u,openTool:y}=ne.current;if(u.some(W=>W.id===e))return false;const K=o.find(W=>W.id===e);if(!K||K.launchMode==="toggle-only")return false;y(K);return true}),[]);const x=g(()=>{const e=Te(f,"dial");return e.map(o=>{const u=o.color||ge(o.id);let y;if(typeof o.icon==="string"){y=o.icon}else if(typeof o.icon==="function"){y=o.icon(32)}else{y=null}return{id:o.id,name:o.name||R(o.id),icon:y,unavailable:!o.component&&!o.onPress,color:u,onPress:()=>{w(o);E(false)}}})},[f,w]);const oe=g(()=>{if(!m)return x;const e=new Map(x.map(o=>[o.id,o]));return en(x.map(o=>o.id)).map(o=>e.get(o)).filter(o=>Boolean(o))},[m,x]);const{settings:z}=vn();const Ae=g(()=>Te(f,"row").filter(e=>(z.floatingTools[e.id]??false)===true&&(e.component||e.onPress)),[f,z.floatingTools]);const Ee=g(()=>f.map(e=>({id:e.id,name:e.name||R(e.id),description:e.description||He(e.id),slot:e.slot,icon:e.icon,color:e.color})),[f]);const[we,te]=U(false);const ie=T.openApps.some(e=>!e.minimized);d(()=>{if(b)return;let e=false;const o=setTimeout(async()=>{const u=await h.getItem(Oe);if(!e&&!u)te(true)},1e3);return()=>{e=true;clearTimeout(o)}},[b]);const I=D(()=>{te(false);void h.setItem(Oe,"true")},[]);const se=D(()=>{I();E(true)},[I]);const _e=D(()=>{E(false);P(false)},[]);const Me=D(()=>{P(e=>!e)},[]);const Pe=D(()=>P(false),[]);const re=Boolean(s?.length&&l);const le=z.floatingTools.environment!==false;const C=we&&!m&&!ie&&!v;d(()=>{if(!C)return;const e=u=>{if(!(u.target instanceof Element)||!u.target.closest("[data-buoy-root]"))I()};const o=u=>{if(u.key==="Escape")I()};document.addEventListener("pointerdown",e,true);document.addEventListener("keydown",o);return()=>{document.removeEventListener("pointerdown",e,true);document.removeEventListener("keydown",o)}},[C,I]);const ae=T.openApps.some(e=>e.minimized&&e.launchMode!=="toggle-only");const ce=t(cn,{modules:r,apps:a,requiredEnvVars:p,externalSync:c,headless:M,sentryGetClient:A});if(M)return ce;return _("div",{"data-buoy-root":"",style:{display:"contents"},children:[ce,t(Dn,{}),C&&t("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),t("div",{style:v?{visibility:"hidden"}:{display:"contents"},"aria-hidden":v||void 0,children:_(Xe,{enablePositionPersistence:!C,pushToSide:m||ie,suspendPointerEvents:m,centerOnboarding:C,minimizedStack:ae?t(ln,{}):void 0,hasMinimizedStack:ae,children:[j&&le&&!re&&t(Ue,{environment:j}),re&&le&&t($e,{currentEnvironment:j??"local",availableEnvironments:s,onSelect:l}),i?t(Ze,{userRole:i,onPress:se}):t("button",{"aria-label":"Open dev tools",onClick:se,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:t(On,{})}),Ae.map(e=>t("button",{"aria-label":e.name||R(e.id),title:e.description,onClick:()=>w(e),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof e.icon==="function"?e.icon(16):e.icon},e.id))]})}),C&&t(on,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:I}),m&&!v&&t(qe,{icons:oe,onClose:_e,centerLabel:"BUOY",onCenterPress:Me,settingsOpen:O,hintsDisabled:b,emptyNote:S&&oe.length===0?Je:void 0}),O&&!v&&t(tn,{visible:true,onClose:Pe,availableTools:Ee,defaultFloatingTools:Ie,defaultDialTools:Ce,onSettingsChange:e=>{}}),!v&&_(Y,{children:[t(rn,{}),t(xe,{})]})]})}function _n(n){const i=n&&typeof n==="object"?n.appId:void 0;const s=!!n;d(()=>{if(!s)return;let l=false;const a=Re.SessionManager;if(!a)return;const r=c=>{if(l||!c)return;a.configure({audience:`app:${c}`});void a.load().catch(()=>{})};if(i)r(i);else void fe().then(c=>r(c?.bundleId)).catch(()=>{});return()=>{l=true}},[s,i])}function Mn(n){const i=n&&typeof n==="object"?n.appId:void 0;d(()=>{let s=false;if(i){H(i)}else if(ue()){void fe().then(l=>{if(!s)H(l?.bundleId)}).catch(()=>{})}else if(typeof location!=="undefined"&&location.origin&&location.origin!=="null"){H(location.origin)}return()=>{s=true}},[i])}let Se=false;function Pn(n){if(n.modules)return n;if(!hn&&!Se&&typeof console!=="undefined"){Se=true;console.info("[Buoy] No tools loaded. Add buoy() from '@buoy-gg/core/vite' to your Vite plugins, or pass modules to FloatingDevTools.")}return{...n,modules:yn}}export function FloatingDevTools(n){return t(ke,{children:t(kn,{...Pn(n)})})}function kn(n){const{access:i,isPro:s,licenseKey:l}=de();d(()=>{void Be.configure(n.licenseKey??pn())},[n.licenseKey]);const a=n.licenseKey===void 0||Le(n.licenseKey,l);const r=Fe(typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production");const c=a&&i.status==="admitted";d(()=>{if(c)Ke()},[c]);d(()=>{if(r||i.status==="initializing")return;if(s&&c)un();else dn()},[r,s,c,i.status]);const p=ue();_n(p?n.signIn:void 0);Mn(n.signIn);if(!r&&!s){if(!n.signIn||n.headless)return null;return p?t(ye,{needsPlan:true}):t(fn,{})}if(!c){return _(Y,{children:[i.status==="initializing"&&t(Cn,{modules:n.modules}),n.headless?null:n.signIn&&p?t(ye,{}):t(Ne,{})]})}return t(Sn,{...n})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useEffect as O,useMemo as Q,useRef as V}from"react";import{Platform as H}from"react-native";import{LicenseManager as $}from"@buoy-gg/license";import{reportOptionalRequireError as r}from"./optionalRequire.js";import{appSyncAdapter as
|
|
1
|
+
"use strict";import{useEffect as O,useMemo as Q,useRef as V}from"react";import{Platform as H}from"react-native";import{LicenseManager as $}from"@buoy-gg/license";import{reportOptionalRequireError as r}from"./optionalRequire.js";import{appSyncAdapter as W}from"./sync/appSyncAdapter.js";import{useDeviceIdentity as X}from"./deviceIdentity.js";import{applyReleaseActionPolicy as Y}from"./externalSyncGate.js";import{applyDefaultLicenseKey as Z}from"../Buoy.js";import{registerToolAdapters as ee}from"@buoy-gg/shared-ui";Z();let s=null;let g=null;let d=null;let p=null;let f=null;let b=null;let m=null;let S=null;let A=null;let h=null;let M=null;let v=null;let q=null;let k=null;let x=null;let R=null;try{R=require("@buoy-gg/notifications")}catch(e){r("@buoy-gg/notifications",e)}let j=null;let E=null;let L=null;let I=null;let w=null;let T=null;let _=null;let z=null;let B=null;let D=null;let i=null;try{s=require("@buoy-gg/external-sync")}catch(e){r("@buoy-gg/external-sync",e)}try{g=require("@buoy-gg/storage")}catch(e){r("@buoy-gg/storage",e)}try{d=require("@buoy-gg/network")}catch(e){r("@buoy-gg/network",e)}try{p=require("@buoy-gg/react-query")}catch(e){r("@buoy-gg/react-query",e)}try{f=require("@buoy-gg/route-events")}catch(e){r("@buoy-gg/route-events",e)}try{b=require("@buoy-gg/redux")}catch(e){r("@buoy-gg/redux",e)}try{m=require("@buoy-gg/zustand")}catch(e){r("@buoy-gg/zustand",e)}try{S=require("@buoy-gg/jotai")}catch(e){r("@buoy-gg/jotai",e)}try{A=require("@buoy-gg/events")}catch(e){r("@buoy-gg/events",e)}try{h=require("@buoy-gg/console")}catch(e){r("@buoy-gg/console",e)}try{M=require("@buoy-gg/clock")}catch(e){r("@buoy-gg/clock",e)}try{q=require("@buoy-gg/lifecycle")}catch(e){r("@buoy-gg/lifecycle",e)}try{k=require("@buoy-gg/location")}catch(e){r("@buoy-gg/location",e)}try{v=require("@buoy-gg/permissions")}catch(e){r("@buoy-gg/permissions",e)}try{x=require("@buoy-gg/sentry")}catch(e){r("@buoy-gg/sentry",e)}try{j=require("@buoy-gg/env")}catch(e){r("@buoy-gg/env",e)}try{E=require("@buoy-gg/highlight-updates")}catch(e){r("@buoy-gg/highlight-updates",e)}try{L=require("@buoy-gg/debug-borders")}catch(e){r("@buoy-gg/debug-borders",e)}try{I=require("@buoy-gg/impersonate")}catch(e){r("@buoy-gg/impersonate",e)}try{w=require("@buoy-gg/perf-monitor")}catch(e){r("@buoy-gg/perf-monitor",e)}try{T=require("@buoy-gg/js-top")}catch(e){r("@buoy-gg/js-top",e)}try{_=require("@buoy-gg/images")}catch(e){r("@buoy-gg/images",e)}try{z=require("@buoy-gg/assets")}catch(e){r("@buoy-gg/assets",e)}try{B=require("@buoy-gg/tv-remote")}catch(e){r("@buoy-gg/tv-remote",e)}try{D=require("@buoy-gg/focus-inspector")}catch(e){r("@buoy-gg/focus-inspector",e)}try{i=require("expo-constants")}catch(e){r("expo-constants",e)}export function isExternalSyncAvailable(){return!!s?.useExternalSyncSocket}function te(){const e=i?.default??i;return e?.expoConfig?.name??e?.manifest2?.extra?.expoClient?.name??null}function re(){const e=i?.default??i;const n=e?.deviceName;return typeof n==="string"&&n.length>0?n:null}export function useToolAdapterMap({requiredEnvVars:e,customApps:n}){const c=p?.useReactQuerySyncAdapter?p.useReactQuerySyncAdapter():null;return oe(c,e,n)}export function ToolRegistryPublisher({requiredEnvVars:e,customApps:n}){const c=useToolAdapterMap({requiredEnvVars:e,customApps:n});const t=V(c);t.current=c;O(()=>ee(()=>t.current),[]);return null}export function AutoExternalSync({options:e,requiredEnvVars:n,isPro:c,tier:t,licenseKey:o,customApps:F}){const{useExternalSyncSocket:G,useExternalSync:J}=s;const N=useToolAdapterMap({requiredEnvVars:n,customApps:F});const U=X(e,{appName:te(),hardwareName:re(),platform:H.OS});const P=U?.deviceId??null;const{socket:u}=G({deviceName:U?.deviceName??"Buoy Device",socketURL:e?.socketURL??s.getDefaultSocketURL?.()??"http://localhost:42831",persistentDeviceId:P,platform:H.OS,enableLogs:e?.enableLogs});const a=V({isPro:c,tier:t,licenseKey:o});a.current={isPro:c,tier:t,licenseKey:o};O(()=>{if(!u)return;const y=()=>{if(!$.hasAccountAccess()||!u.connected)return;const C=$.getState();if(!a.current.isPro&&(C.isInitialized===false||C.isValidating===true))return;u.emit("device-license",{isPro:a.current.isPro?"1":"0",tier:a.current.tier??(a.current.isPro?"pro":"free")})};if(u.connected)y();u.on("connect",y);return()=>{u.off("connect",y)}},[u,c,t,o]);const l=e?.releaseActions?.join(",")??"";const K=Q(()=>Y(N,typeof __DEV__!=="undefined"&&__DEV__,l?l.split(","):void 0),[N,l]);J({tools:K,socket:u,deviceId:P,enableLogs:e?.enableLogs});return null}function oe(e,n,c){return Q(()=>{const t={app:W};if(g?.storageSyncAdapter){t.storage=g.storageSyncAdapter}if(d?.networkSyncAdapter){t.network=d.networkSyncAdapter}if(e){t.query=e}if(f?.routeEventsSyncAdapter){t["route-events"]=f.routeEventsSyncAdapter}if(b?.reduxSyncAdapter){t.redux=b.reduxSyncAdapter}if(m?.zustandSyncAdapter){t.zustand=m.zustandSyncAdapter}if(S?.jotaiSyncAdapter){t.jotai=S.jotaiSyncAdapter}if(A?.eventsSyncAdapter){t.events=A.eventsSyncAdapter}if(h?.consoleSyncAdapter){t.console=h.consoleSyncAdapter}if(M?.clockSyncAdapter){t.clock=M.clockSyncAdapter}if(v?.permissionsSyncAdapter){t.permissions=v.permissionsSyncAdapter}if(q?.lifecycleSyncAdapter){t.lifecycle=q.lifecycleSyncAdapter}if(k?.locationSyncAdapter){t.location=k.locationSyncAdapter}if(R?.notificationSyncAdapter){t["push-notifications"]=R.notificationSyncAdapter}if(x?.sentrySyncAdapter){t.sentry=x.sentrySyncAdapter}try{const o=require("@buoy-gg/time-machine");if(o?.timeMachineSyncAdapter){t["time-machine"]=o.timeMachineSyncAdapter}}catch(o){r("@buoy-gg/time-machine",o)}try{const o=require("@buoy-gg/scenarios");if(o?.scenariosSyncAdapter){t.scenarios=o.scenariosSyncAdapter}}catch(o){r("@buoy-gg/scenarios",o)}try{const o=require("@buoy-gg/ask-buoy");if(o?.askBuoySyncAdapter){t["ask-buoy"]=o.askBuoySyncAdapter}}catch(o){r("@buoy-gg/ask-buoy",o)}if(j?.createEnvSyncAdapter){t.env=j.createEnvSyncAdapter(n??[])}if(E?.highlightUpdatesSyncAdapter){t["highlight-updates"]=E.highlightUpdatesSyncAdapter}if(L?.debugBordersSyncAdapter){t["debug-borders"]=L.debugBordersSyncAdapter}if(I?.impersonateSyncAdapter){t.impersonate=I.impersonateSyncAdapter}if(w?.perfMonitorSyncAdapter){t["perf-monitor"]=w.perfMonitorSyncAdapter}if(T?.jsTopSyncAdapter){t["js-top"]=T.jsTopSyncAdapter}if(_?.imagesSyncAdapter){t.images=_.imagesSyncAdapter}if(z?.assetsSyncAdapter){t.assets=z.assetsSyncAdapter}if(B?.tvRemoteSyncAdapter){t["tv-remote"]=B.tvRemoteSyncAdapter}if(D?.focusInspectorSyncAdapter){t["focus-inspector"]=D.focusInspectorSyncAdapter}for(const o of c??[]){if(o?.sync){t[`custom:${o.id}`]=o.sync}}return t},[e,n,c])}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export const SDK_VERSION="7.0.
|
|
1
|
+
"use strict";export const SDK_VERSION="7.0.78";
|
|
@@ -34,6 +34,21 @@ export interface BuoyConfig {
|
|
|
34
34
|
}
|
|
35
35
|
/** Whether the anonymous install ping is allowed to fire. */
|
|
36
36
|
export declare function isTelemetryEnabled(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The key `buoy login` wrote, used when the app passes none. Expo puts
|
|
39
|
+
* `EXPO_PUBLIC_*` values on `process.env` in development, including for code
|
|
40
|
+
* in node_modules. Next.js swaps in `NEXT_PUBLIC_*` values when it bundles.
|
|
41
|
+
* Each name is written out in full so the bundler can find it.
|
|
42
|
+
*/
|
|
43
|
+
export declare function defaultLicenseKey(): string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Start the account check with the env key while Buoy loads, the way a
|
|
46
|
+
* top-level `Buoy.init()` would. The Network tool decides whether to keep
|
|
47
|
+
* start-up calls as it loads, and only does while a check is running; a key
|
|
48
|
+
* applied later, from a React effect, lost the app's first calls.
|
|
49
|
+
* `Buoy.init()` and the `licenseKey` prop run later, so they still win.
|
|
50
|
+
*/
|
|
51
|
+
export declare function applyDefaultLicenseKey(): void;
|
|
37
52
|
/**
|
|
38
53
|
* Buoy SDK namespace
|
|
39
54
|
*
|
|
@@ -12,10 +12,16 @@ export interface BuoyDevToolsProps extends FloatingDevToolsProps {
|
|
|
12
12
|
* browser it's a development build.
|
|
13
13
|
*/
|
|
14
14
|
export declare function shouldShowBuoy(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The key `buoy login` writes: `VITE_BUOY_KEY` in a Vite app, `NEXT_PUBLIC_BUOY_KEY`
|
|
17
|
+
* in Next.js. Each bundler fills in its own expression; the other stays empty.
|
|
18
|
+
*/
|
|
19
|
+
export declare function bundlerKey(): string | undefined;
|
|
15
20
|
/**
|
|
16
21
|
* Buoy with no setup: shows in debug and development builds, loads every
|
|
17
|
-
* installed tool (with the `buoy()` plugin from `@buoy-gg/core/vite`),
|
|
18
|
-
* stays out of other builds. Takes every
|
|
22
|
+
* installed tool (with the `buoy()` plugin from `@buoy-gg/core/vite`), reads
|
|
23
|
+
* the key `buoy login` wrote, and stays out of other builds. Takes every
|
|
24
|
+
* `FloatingDevTools` prop.
|
|
19
25
|
*/
|
|
20
26
|
export declare function BuoyDevTools({ enabled, ...props }: BuoyDevToolsProps): import("react").FunctionComponentElement<import("react").SuspenseProps> | null;
|
|
21
27
|
//# sourceMappingURL=auto.web.d.ts.map
|
|
@@ -236,12 +236,14 @@ export interface FloatingDevToolsProps extends Omit<FloatingMenuProps, "apps"> {
|
|
|
236
236
|
/** @deprecated Account access is always required for Free and Pro users. */
|
|
237
237
|
requireLicense?: boolean;
|
|
238
238
|
/**
|
|
239
|
-
*
|
|
240
|
-
*
|
|
239
|
+
* The dev token `npx --package=@buoy-gg/core buoy login` writes to your env
|
|
240
|
+
* file, or a Buoy key. Buoy reads `EXPO_PUBLIC_BUOY_KEY` and
|
|
241
|
+
* `NEXT_PUBLIC_BUOY_KEY` for you; pass this for other setups, like Vite.
|
|
242
|
+
* Test and store builds sign in with `signIn` instead.
|
|
241
243
|
*
|
|
242
244
|
* @example
|
|
243
245
|
* ```tsx
|
|
244
|
-
* <FloatingDevTools licenseKey=
|
|
246
|
+
* <FloatingDevTools licenseKey={import.meta.env.VITE_BUOY_KEY} />
|
|
245
247
|
* ```
|
|
246
248
|
*/
|
|
247
249
|
licenseKey?: string;
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
* Drift is prevented by a test that fails when this disagrees with
|
|
10
10
|
* package.json, so a version bump that forgets this file cannot ship.
|
|
11
11
|
*/
|
|
12
|
-
export declare const SDK_VERSION = "7.0.
|
|
12
|
+
export declare const SDK_VERSION = "7.0.78";
|
|
13
13
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -34,6 +34,21 @@ export interface BuoyConfig {
|
|
|
34
34
|
}
|
|
35
35
|
/** Whether the anonymous install ping is allowed to fire. */
|
|
36
36
|
export declare function isTelemetryEnabled(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The key `buoy login` wrote, used when the app passes none. Expo puts
|
|
39
|
+
* `EXPO_PUBLIC_*` values on `process.env` in development, including for code
|
|
40
|
+
* in node_modules. Next.js swaps in `NEXT_PUBLIC_*` values when it bundles.
|
|
41
|
+
* Each name is written out in full so the bundler can find it.
|
|
42
|
+
*/
|
|
43
|
+
export declare function defaultLicenseKey(): string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Start the account check with the env key while Buoy loads, the way a
|
|
46
|
+
* top-level `Buoy.init()` would. The Network tool decides whether to keep
|
|
47
|
+
* start-up calls as it loads, and only does while a check is running; a key
|
|
48
|
+
* applied later, from a React effect, lost the app's first calls.
|
|
49
|
+
* `Buoy.init()` and the `licenseKey` prop run later, so they still win.
|
|
50
|
+
*/
|
|
51
|
+
export declare function applyDefaultLicenseKey(): void;
|
|
37
52
|
/**
|
|
38
53
|
* Buoy SDK namespace
|
|
39
54
|
*
|
|
@@ -12,10 +12,16 @@ export interface BuoyDevToolsProps extends FloatingDevToolsProps {
|
|
|
12
12
|
* browser it's a development build.
|
|
13
13
|
*/
|
|
14
14
|
export declare function shouldShowBuoy(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The key `buoy login` writes: `VITE_BUOY_KEY` in a Vite app, `NEXT_PUBLIC_BUOY_KEY`
|
|
17
|
+
* in Next.js. Each bundler fills in its own expression; the other stays empty.
|
|
18
|
+
*/
|
|
19
|
+
export declare function bundlerKey(): string | undefined;
|
|
15
20
|
/**
|
|
16
21
|
* Buoy with no setup: shows in debug and development builds, loads every
|
|
17
|
-
* installed tool (with the `buoy()` plugin from `@buoy-gg/core/vite`),
|
|
18
|
-
* stays out of other builds. Takes every
|
|
22
|
+
* installed tool (with the `buoy()` plugin from `@buoy-gg/core/vite`), reads
|
|
23
|
+
* the key `buoy login` wrote, and stays out of other builds. Takes every
|
|
24
|
+
* `FloatingDevTools` prop.
|
|
19
25
|
*/
|
|
20
26
|
export declare function BuoyDevTools({ enabled, ...props }: BuoyDevToolsProps): import("react").FunctionComponentElement<import("react").SuspenseProps> | null;
|
|
21
27
|
//# sourceMappingURL=auto.web.d.ts.map
|
|
@@ -236,12 +236,14 @@ export interface FloatingDevToolsProps extends Omit<FloatingMenuProps, "apps"> {
|
|
|
236
236
|
/** @deprecated Account access is always required for Free and Pro users. */
|
|
237
237
|
requireLicense?: boolean;
|
|
238
238
|
/**
|
|
239
|
-
*
|
|
240
|
-
*
|
|
239
|
+
* The dev token `npx --package=@buoy-gg/core buoy login` writes to your env
|
|
240
|
+
* file, or a Buoy key. Buoy reads `EXPO_PUBLIC_BUOY_KEY` and
|
|
241
|
+
* `NEXT_PUBLIC_BUOY_KEY` for you; pass this for other setups, like Vite.
|
|
242
|
+
* Test and store builds sign in with `signIn` instead.
|
|
241
243
|
*
|
|
242
244
|
* @example
|
|
243
245
|
* ```tsx
|
|
244
|
-
* <FloatingDevTools licenseKey=
|
|
246
|
+
* <FloatingDevTools licenseKey={import.meta.env.VITE_BUOY_KEY} />
|
|
245
247
|
* ```
|
|
246
248
|
*/
|
|
247
249
|
licenseKey?: string;
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
* Drift is prevented by a test that fails when this disagrees with
|
|
10
10
|
* package.json, so a version bump that forgets this file cannot ship.
|
|
11
11
|
*/
|
|
12
|
-
export declare const SDK_VERSION = "7.0.
|
|
12
|
+
export declare const SDK_VERSION = "7.0.78";
|
|
13
13
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/web/auto.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as
|
|
1
|
+
"use client";import{a as o,e as u}from"./chunks/chunk-LOPXJLVB.mjs";import{createElement as l,lazy as p,Suspense as d,useEffect as m,useState as v}from"react";function n(){if(typeof window>"u")return false;let e=window.Capacitor,t=false;try{t=e?.isNativePlatform?.()===true}catch{t=false}return t?e?.DEBUG===true:typeof u<"u"?!!u:process.env.NODE_ENV!=="production"}o(n,"shouldShowBuoy");function r(){try{let e=import.meta.env.VITE_BUOY_KEY;if(e)return e}catch{}try{let e=process.env.NEXT_PUBLIC_BUOY_KEY;if(e)return e}catch{}}o(r,"bundlerKey");var a;function s(){return a??(a=p(()=>import("./chunks/FloatingDevTools.web-FB3F35HU.mjs").then(e=>({default:e.FloatingDevTools})))),a}o(s,"loadHost");function i({enabled:e,...t}){let[c,f]=v(false);if(m(()=>{f(e??n())},[e]),!c)return null;let y=t.licenseKey??r();return l(d,{fallback:null},l(s(),{...t,licenseKey:y}))}o(i,"BuoyDevTools");export{i as BuoyDevTools,r as bundlerKey,n as shouldShowBuoy};
|
package/lib/web/chunks/{FloatingDevTools.web-NMBTDON7.mjs → FloatingDevTools.web-FB3F35HU.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{v as o}from"./chunk-
|
|
1
|
+
"use client";import{v as o}from"./chunk-A6DQ5EDK.mjs";import"./chunk-C6HZO5XT.mjs";import"./chunk-D2FYORGY.mjs";import"./chunk-LOPXJLVB.mjs";export{o as FloatingDevTools};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{v as o}from"./chunk-LAJ3HKAL.mjs";import"./chunk-C6HZO5XT.mjs";import"./chunk-D2FYORGY.mjs";import"./chunk-LOPXJLVB.mjs";export{o as FloatingDevTools};
|