@buoy-gg/core 7.0.43 → 7.0.45
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/bin/buoy.js +11 -8
- package/lib/commonjs/floatingMenu/BrowserToolRuntime.js +1 -1
- package/lib/commonjs/floatingMenu/BuoySignIn.web.js +1 -0
- 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/FloatingMenu.js +1 -1
- package/lib/commonjs/floatingMenu/ToolHost.js +1 -1
- package/lib/commonjs/floatingMenu/autoDiscoverPresets.js +1 -1
- package/lib/commonjs/floatingMenu/autoExternalSync.js +1 -1
- package/lib/commonjs/floatingMenu/dial/DialIcon.js +1 -1
- package/lib/commonjs/floatingMenu/externalSyncGate.js +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/floatingMenu/BrowserToolRuntime.js +1 -1
- package/lib/module/floatingMenu/BuoySignIn.web.js +1 -0
- 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/FloatingMenu.js +1 -1
- package/lib/module/floatingMenu/ToolHost.js +1 -1
- package/lib/module/floatingMenu/autoDiscoverPresets.js +1 -1
- package/lib/module/floatingMenu/autoExternalSync.js +1 -1
- package/lib/module/floatingMenu/dial/DialIcon.js +1 -1
- package/lib/module/floatingMenu/externalSyncGate.js +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/Buoy.d.ts +1 -1
- package/lib/typescript/commonjs/floatingMenu/BuoySignIn.web.d.ts +12 -0
- package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.web.d.ts +7 -0
- package/lib/typescript/commonjs/floatingMenu/ToolOpenerBridge.d.ts +2 -1
- package/lib/typescript/commonjs/floatingMenu/autoExternalSync.d.ts +16 -0
- package/lib/typescript/commonjs/floatingMenu/defaultConfig.d.ts +1 -1
- package/lib/typescript/commonjs/floatingMenu/externalSyncGate.d.ts +27 -0
- package/lib/typescript/commonjs/version.d.ts +1 -1
- package/lib/typescript/module/Buoy.d.ts +1 -1
- package/lib/typescript/module/floatingMenu/BuoySignIn.web.d.ts +12 -0
- package/lib/typescript/module/floatingMenu/FloatingDevTools.web.d.ts +7 -0
- package/lib/typescript/module/floatingMenu/ToolOpenerBridge.d.ts +2 -1
- package/lib/typescript/module/floatingMenu/autoExternalSync.d.ts +16 -0
- package/lib/typescript/module/floatingMenu/defaultConfig.d.ts +1 -1
- package/lib/typescript/module/floatingMenu/externalSyncGate.d.ts +27 -0
- package/lib/typescript/module/version.d.ts +1 -1
- package/lib/web/chunks/chunk-5NZOQR6Q.mjs +1 -0
- package/lib/web/chunks/chunk-CGDSLLZF.mjs +1 -0
- package/lib/web/chunks/chunk-DCJDUSNR.mjs +1 -0
- package/lib/web/chunks/chunk-IDSHFS6G.mjs +1 -0
- package/lib/web/chunks/chunk-JOAMJGCS.mjs +1 -0
- package/lib/web/chunks/chunk-KYKZ2N52.mjs +1 -0
- package/lib/web/chunks/chunk-NGM7JGGS.mjs +1 -0
- package/lib/web/chunks/chunk-Z3XWDDIO.mjs +1 -0
- package/lib/web/chunks/chunk-ZTGQ6TTY.mjs +1 -0
- package/lib/web/index.mjs +2 -2
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useEffect as
|
|
1
|
+
"use strict";import{useEffect as R,useMemo as g,useRef as L}from"react";import{LicenseManager as I,useLicense as j}from"@buoy-gg/license";import{registerToolAdapters as x}from"@buoy-gg/shared-ui";import{RELEASE_DEFAULT_SOCKET_URL as k,applyReleaseActionPolicy as T,externalSyncOptions as h,releaseTransportProblem as B,shouldMountExternalSync as D}from"./externalSyncGate.js";import{useDeviceIdentity as M}from"./deviceIdentity.js";import{appSyncAdapter as N}from"./sync/appSyncAdapter.js";import{jsx as l,Fragment as U,jsxs as C}from"react/jsx-runtime";const P=["ConsoleRoot","RouteTracker","ReactQueryTracker","ReduxAutoInstrument","PerfMonitorRoot","AutomationResumer","ImagesRoot"];const $=["DebugBordersStandaloneOverlay","HighlightUpdatesOverlay","ImageOverlayStandalone","PerfMonitorOverlay","JsTopHudOverlay","ImpersonateOverlay","ScenariosOverlay"];export function BrowserToolRuntime(e){const o=g(()=>Object.fromEntries(Object.entries(e.modules).map(([i,f])=>[i.replace(/^@buoy-gg\//,"").replace(/\/web$/,""),f])),[e.modules]);const s=o["react-query"];return s?.useReactQuerySyncAdapter?l(Q,{...e,modules:o,query:s}):l(E,{...e,modules:o})}function Q(e){const o=e.query.useReactQuerySyncAdapter();return l(E,{...e,queryAdapter:o})}function E({modules:e,apps:o,requiredEnvVars:s,externalSync:i,headless:f,sentryGetClient:p,queryAdapter:u}){const{isPro:c,tier:d}=j();const m=g(()=>{const r={app:N};for(const[t,n]of Object.entries(e)){for(const[a,b]of Object.entries(n)){if(a.endsWith("SyncAdapter")&&b&&typeof b==="object")r[t]=b}}if(u)r.query=u;if(e.env?.createEnvSyncAdapter)r.env=e.env.createEnvSyncAdapter(s??[]);for(const t of o??[])if(t.sync)r[`custom:${t.id}`]=t.sync;return r},[e,o,s,u]);const y=L(m);y.current=m;R(()=>x(()=>y.current),[]);R(()=>{const r=[];const t=n=>{const a=n?.();if(typeof a==="function")r.push(a)};t(e.network?.startNetworkCapture);t(e.storage?.startBrowserStorageCapture);t(e.assets?.startBrowserAssetCapture);if(e.storage?.storageSyncAdapter?.subscribe)t(()=>e.storage.storageSyncAdapter.subscribe(()=>{}));if(e["focus-inspector"]?.focusInspectorSyncAdapter?.subscribe)t(()=>e["focus-inspector"].focusInspectorSyncAdapter.subscribe(()=>{}));return()=>{for(const n of r.reverse())n()}},[e]);const A=e["external-sync"];const S=typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production";const _=D({isDevelopment:S,isLicensed:c,externalSync:i,isAvailable:Boolean(A)});const v=h(i);if(!S&&v?.enableInRelease)q(B(v.socketURL,v));const O=e.sentry?.SentryRoot;return C(U,{children:[Object.entries(e).flatMap(([r,t])=>P.map(n=>{const a=t[n];return a?l(a,{},`${r}:${n}`):null})),O&&l(O,{getClient:p}),Object.entries(e).flatMap(([r,t])=>$.map(n=>{const a=t[n];return a&&(!f||n==="ScenariosOverlay"||n==="ImpersonateOverlay")?l(a,{},`${r}:${n}`):null})),_&&l(F,{module:A,tools:m,options:v,isPro:c,tier:d,dev:S})]})}let w=null;function q(e){if(!e||e===w)return;w=e;console.warn(e)}function F({module:e,tools:o,options:s,isPro:i,tier:f,dev:p}){const u=M(s,{appName:typeof document==="undefined"?null:document.title||location.hostname,hardwareName:"Browser",platform:"web"});const{socket:c}=e.useExternalSyncSocket({deviceName:u?.deviceName??"Buoy Browser",socketURL:s?.socketURL??(p?e.getDefaultSocketURL():k),persistentDeviceId:u?.deviceId??null,platform:"web",enableLogs:s?.enableLogs});R(()=>{if(!c)return;const y=()=>{if(c.connected&&I.hasAccountAccess())c.emit("device-license",{isPro:i?"1":"0",tier:f})};y();c.on("connect",y);return()=>{c.off("connect",y)}},[c,i,f]);const d=s?.releaseActions?.join(",")??"";const m=g(()=>T(o,p,d?d.split(","):void 0),[o,p,d]);e.useExternalSync({tools:m,socket:c,deviceId:u?.deviceId??null,enableLogs:s?.enableLogs});return null}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{useState as a}from"react";import{createPortal as y}from"react-dom";import{useBuoySession as x}from"@buoy-gg/license";import{jsx as t,Fragment as d,jsxs as l}from"react/jsx-runtime";const u="#20C997";export function BuoySignIn(){const{status:c,signIn:g,signOut:p}=x();const[o,i]=a(false);const[n,r]=a(null);if(typeof document==="undefined")return null;const m=()=>{r(null);i(true);g().catch(s=>r(s instanceof Error?s.message:"Sign-in did not work. Try again.")).finally(()=>i(false))};const e=c.state==="active";return y(t("div",{"data-buoy-signin":"",style:{position:"fixed",right:"max(16px, env(safe-area-inset-right))",bottom:"max(20px, env(safe-area-inset-bottom))",zIndex:99999,maxWidth:"min(320px, calc(100vw - 32px))",padding:e||n?"12px 14px":0,borderRadius:16,background:e||n?"#0f1419":"transparent",color:"#e6edf3",boxShadow:e||n?"0 10px 30px rgba(0,0,0,.35)":"none",fontFamily:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",fontSize:14,lineHeight:1.45},children:e?l(d,{children:[t("div",{"data-testid":"buoy-signin-needs-plan",children:"Buoy on a live site needs a Pro or Business plan."}),t("button",{type:"button",onClick:()=>void p(),style:b,"data-testid":"buoy-signout",children:"Sign out"})]}):l(d,{children:[n?t("div",{role:"alert",style:{marginBottom:10},"data-testid":"buoy-signin-error",children:n}):null,t("button",{type:"button",onClick:m,disabled:o,"data-testid":"buoy-signin",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",border:"none",borderRadius:999,background:u,color:"#04130d",fontWeight:600,fontSize:14,cursor:o?"wait":"pointer",boxShadow:"0 8px 24px rgba(0,0,0,.3)"},children:o?"Signing in\u2026":"Sign in to Buoy"})]})}),document.body)}const b={marginTop:8,padding:0,border:"none",background:"none",color:u,fontSize:14,cursor:"pointer",textDecoration:"underline"};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useState as m,useEffect as L,useCallback as K,useMemo as W}from"react";import{View as y,Text as u,StyleSheet as Xe,ScrollView as me,TouchableOpacity as j,Dimensions as Se,Platform as Ze}from"react-native";import{settingsBus as A}from"./settingsBus.js";import{useDesktopSyncStatus as et}from"./useDesktopSyncStatus";import{SentryIcon as tt,WifiCircuitIcon as ot,ImageOverlayIcon as nt,RenderCountIcon as rt,Info as Q,Layers as st,ChevronRightIcon as be,ChevronDown as we,getStorageBackendType as at,getUseLicense as it,persistentStorage as D,Trash2 as lt,CheckCircle2 as Te,LicenseEntryModal as ct,BackgroundSwitcher as dt,night as o,NightCard as R,NightRows as X,NightSectionLabel as gt,NightFootnote as ve,NightSwitch as xe,NightButton as ze,NightSegmented as ut,NightBadge as v,NightSeparator as ht,monoFont as Ie}from"@buoy-gg/shared-ui";import{EnvIcon as Ce,StorageIcon as yt,RoutesIcon as ft,NetworkIcon as pt,QueryIcon as mt,HighlighterIcon as St,ReduxIcon as bt,EventsIcon as wt}from"@buoy-gg/floating-tools-core";import{useDefaultConfig as Le}from"./DefaultConfigContext.js";import{renderAppIcon as Tt}from"./AppIcon";import{JsModal as vt,devToolsStorageKeys as Z}from"@buoy-gg/shared-ui";import{useSafeAreaInsets as xt}from"@buoy-gg/shared-ui";import{jsx as e,jsxs as a,Fragment as k}from"react/jsx-runtime";const N="@react_buoy_dev_tools_settings";const zt=6;const V=d=>{let g=zt;const i={};for(const[f,l]of Object.entries(d)){if(l&&g>0){i[f]=true;g-=1}else{i[f]=false}}return i};const It=(d,g)=>{const{userStatus:i,environment:f,...l}=d;const h=g?Object.entries(l).filter(([p])=>g.includes(p)):Object.entries(l);return{...Object.fromEntries(h),environment:f??false}};const De=(d,g,i)=>{if(!g)return d;const f={...d.dialTools,...g.dialTools??{}};const l=i?.allowedDialKeys?Object.entries(f).filter(([p])=>i.allowedDialKeys?.includes(p)):Object.entries(f);const h=V(Object.fromEntries(l));return{dialTools:h,floatingTools:It({...d.floatingTools,...g.floatingTools??{}},i?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...g.globalSettings??{}}}};const Ct=(d=[],g,i)=>{const f={};const l={};const h=new Set(g??[]);const p=new Set(i??[]);const S=!i||i.length===0;for(const x of d){const{id:c,slot:I="both"}=x;if(I==="dial"||I==="both"){f[c]=S?true:p.has(c)}if(I==="row"||I==="both"){l[c]=h.has(c)}}return{dialTools:V(f),floatingTools:{...l,environment:h.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}};export const DevToolsSettingsModal=({visible:d,onClose:g,onSettingsChange:i,initialSettings:f,availableApps:l=[],storage:h=D,zIndex:p})=>{const{defaultFloatingTools:S,defaultDialTools:x}=Le();const c=W(()=>Ct(l,S,x),[l,S,x]);const I=W(()=>Object.keys(c.dialTools),[c]);const te=W(()=>Object.keys(c.floatingTools).filter(t=>t!=="environment"),[c]);const[z,E]=m(f||P||c);const[B,oe]=m(ee??"floating");const[ne,Ee]=m(ee!==null);const[_,Fe]=m(new Set);const[Oe,J]=m(false);const[ke,Pe]=m(false);L(()=>{const t=requestAnimationFrame(()=>Pe(true));return()=>cancelAnimationFrame(t)},[]);const b=et();L(()=>{const t=async()=>{try{const r=await D.getItem(Z.settings.activeTab());if(r&&["floating","settings","pro"].includes(r)){const s=r;ee=s;oe(T=>T===s?T:s)}}catch(r){}finally{Ee(true)}};t()},[]);L(()=>{if(!ne)return;D.setItem(Z.settings.activeTab(),B).catch(t=>{console.warn("Failed to save settings active tab:",t)})},[B,ne]);const He=it();const H=He?.();const F=H?.isPro??false;const U=!F&&H?.licenseKey?H.error:null;const Me=H?.errorKind==="transport";const[w,Ke]=m(Re);const[G,re]=m(false);const[q,Y]=m(false);const[O,We]=m(false);const[$,se]=m([]);const[ae,ie]=m(false);const le=xt();const ce=Se.get("window").height;const de=Se.get("window").width;const je=Math.floor(ce*.33);const Ae=Math.min(de-32,400);const ge=K(async()=>{try{const t=await h.getItem(N);if(t){const r=JSON.parse(t);const s=De(c,r,{allowedDialKeys:I,allowedFloatingKeys:te});P=s;E(T=>Be(T,s)?T:s);return}P=c;E(r=>Be(r,c)?r:c)}catch(t){console.error("Failed to load dev tools settings:",t);E(c)}},[c,I,te,h]);L(()=>{ge()},[ge]);L(()=>{at().then(t=>{Re=t;Ke(r=>r===t?r:t)})},[]);L(()=>{if(O){ie(true);D.getAllKeys().then(t=>{se(t.sort())}).catch(()=>{se([])}).finally(()=>{ie(false)})}},[O]);const ue=async t=>{try{const r={...t,dialTools:V(t.dialTools)};await h.setItem(N,JSON.stringify(r));P=r;E(r);i?.(r);A.emit(r)}catch(r){console.error("Failed to save dev tools settings:",r)}};const Ne=t=>{const r={...z,floatingTools:{...z.floatingTools,[t]:!z.floatingTools[t]}};ue(r)};const Ve=t=>{const r={...z,globalSettings:{...z.globalSettings,[t]:!z.globalSettings?.[t]}};ue(r)};const _e=async()=>{re(true);Y(false);try{await D.clear();Y(true);E(c);if(h!==D)await h.setItem(N,JSON.stringify(c));i?.(c);A.emit(c);setTimeout(()=>Y(false),2e3)}catch(t){console.error("Failed to clear storage:",t)}finally{re(false)}};const Je=K(t=>{},[]);const Ue=t=>{const r=l.find(s=>s.id===t);if(r?.description){return r.description}if(t==="environment"){return"Environment badge."}return""};const he=t=>{if(t==="environment"){return"Env Badge"}const r=l.find(s=>s.id===t);return r?.name??t.toUpperCase().replace(/_/g," ")};const Ge=t=>{if(!ke)return null;switch(t){case"query":return e(mt,{size:18});case"env":return e(Ce,{size:18});case"sentry":return e(tt,{size:18,color:"#9945FF"});case"storage":return e(yt,{size:18,bgColor:o.color.surface});case"wifi":case"query-wifi-toggle":return e(ot,{size:18,colorPreset:"green",strength:4,noBackground:true});case"route-events":return e(ft,{size:18,bgColor:o.color.surface});case"network":return e(pt,{size:18});case"environment":return e(Ce,{size:18});case"debug-borders":return e(st,{size:18,color:o.color.accent});case"highlight-updates":return e(rt,{size:18,color:o.color.accent});case"highlight-updates-modal":return e(St,{size:18});case"redux":return e(bt,{size:18});case"image-overlay":return e(nt,{size:18});case"events":return e(wt,{size:18});case"zustand":try{const{ZustandIcon:r}=require("@buoy-gg/zustand");return e(r,{size:18})}catch{return e(Q,{size:18,color:o.color.textSecondary})}case"jotai":try{const{JotaiIcon:r}=require("@buoy-gg/jotai");return e(r,{size:18})}catch{return e(Q,{size:18,color:o.color.textSecondary})}default:{const r=l.find(s=>s.id===t);if(r?.icon!=null){return Tt(r.icon,{slot:"row",size:18,color:r.color})}return e(Q,{size:18,color:o.color.textSecondary})}}};const qe=(t,r,s,T)=>{const M=Ue(t);return a(j,{activeOpacity:s?1:.7,onPress:()=>!s&&T(),accessibilityLabel:he(t),accessibilityRole:"button",style:[n.toolRow,s&&n.rowDisabled],children:[e(y,{style:n.toolIconSlot,children:Ge(t)}),a(y,{style:n.rowInfo,children:[a(u,{style:n.rowLabel,children:[he(t),s?" \xB7 max 6":""]}),M?e(u,{style:n.rowCaption,numberOfLines:1,children:M}):null]}),e(xe,{value:r,disabled:s,onValueChange:()=>T()})]},t)};const ye=t=>{Fe(r=>{const s=new Set(r);if(s.has(t)){s.delete(t)}else{s.add(t)}return s})};const fe=(t,r,s,T,M)=>{const Qe=z.globalSettings?.[t]??false;const pe=_.has(t);return a(y,{children:[a(j,{activeOpacity:.7,onPress:()=>ye(t),accessibilityLabel:r,style:n.settingRow,children:[a(y,{style:n.rowInfo,children:[e(u,{style:n.rowLabel,children:r}),e(u,{style:n.rowCaption,numberOfLines:pe?0:1,children:s})]}),e(xe,{value:Qe,onValueChange:()=>Ve(t)})]}),pe&&a(y,{style:n.settingRowBody,children:[e(u,{style:n.settingRowBodyText,children:T}),e(u,{style:n.settingRowBodyHint,children:M})]})]},t)};const C=(t,r,s)=>a(y,{children:[e(gt,{children:t}),r,s]});const Ye=w==="filesystem"?e(v,{label:"File System",tone:"accent"}):w==="asyncstorage"?e(v,{label:"Async Storage",tone:"warning"}):w==="localstorage"?e(v,{label:"Local Storage",tone:"accent"}):w==="memory"?e(v,{label:"Memory",tone:"danger"}):e(v,{label:"Loading\u2026",tone:"neutral"});const $e=()=>a(y,{style:n.container,children:[a(me,{style:n.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:n.scrollContainer,children:[B==="floating"&&e(k,{children:C("Floating Tools",e(R,{glass:true,children:e(X,{children:Object.entries(z.floatingTools).map(([t,r])=>qe(t,r,false,()=>Ne(t)))})}),e(ve,{children:"Tools switched on here appear in the floating bubble row."}))}),B==="settings"&&a(k,{children:[C("Background",e(R,{glass:true,padded:true,children:e(dt,{embedded:true})})),C("Storage",a(R,{glass:true,children:[a(j,{activeOpacity:.7,onPress:()=>We(!O),accessibilityLabel:"Storage Type",style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(u,{style:n.rowLabel,children:"Storage Type"})}),Ye,O?e(we,{size:16,color:o.color.textTertiary}):e(be,{size:16,color:o.color.textTertiary})]}),O&&a(k,{children:[a(y,{style:n.settingRowBody,children:[e(u,{style:n.settingRowBodyText,children:w==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":w==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":w==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":w==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),w==="asyncstorage"&&e(u,{style:[n.settingRowBodyText,n.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),w==="memory"&&e(u,{style:[n.settingRowBodyText,n.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),e(ht,{}),a(y,{style:n.storageExpanded,children:[a(y,{style:n.storageExpandedHeader,children:[e(u,{style:n.storageExpandedTitle,children:"SAVED SETTINGS"}),e(u,{style:n.storageExpandedCount,children:ae?"\u2026":`${$.length} keys`})]}),ae?e(u,{style:n.storageKeyEmpty,children:"Loading\u2026"}):$.length===0?e(u,{style:n.storageKeyEmpty,children:"No settings saved yet"}):e(me,{style:n.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:$.map(t=>e(y,{style:n.storageKeyItem,children:e(u,{style:n.storageKeyText,numberOfLines:1,children:t.replace("@react_buoy_","")})},t))})]}),e(y,{style:n.cardButtonWrap,children:e(ze,{label:q?"Cleared":G?"Clearing\u2026":"Clear All Settings",variant:q?"secondary":"destructive",size:"md",disabled:G,onPress:_e,icon:q?e(Te,{size:15,color:o.color.accent}):e(lt,{size:15,color:G?o.color.textTertiary:o.color.danger})})})]})]})),b&&b.state!=="idle"&&C("Desktop Sync",a(R,{glass:true,children:[a(j,{activeOpacity:.7,onPress:()=>ye("desktopSync"),accessibilityLabel:"Buoy Desktop",style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(u,{style:n.rowLabel,children:"Buoy Desktop"})}),b.state==="connected"?e(v,{label:"Connected",tone:"accent"}):b.state==="connecting"?e(v,{label:"Connecting\u2026",tone:"neutral"}):e(v,{label:"Retrying",tone:"warning"}),_.has("desktopSync")?e(we,{size:16,color:o.color.textTertiary}):e(be,{size:16,color:o.color.textTertiary})]}),_.has("desktopSync")&&a(y,{style:n.settingRowBody,children:[a(u,{style:n.settingRowBodyText,children:[b.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",e(u,{style:n.footnoteMono,children:b.targetURL??"(unknown URL)"}),b.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),b.state==="retrying"&&b.lastError&&a(u,{style:[n.settingRowBodyText,n.bodyWarning],children:["Last error: ",b.lastError]})]})]})),C("Modal Behavior",e(R,{glass:true,children:a(X,{children:[fe("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."),Ze.OS!=="web"?fe("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]})}))]}),B==="pro"&&a(k,{children:[C("License",e(R,{glass:true,children:a(y,{style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(u,{style:n.rowLabel,children:"License Status"})}),e(y,{testID:"buoy-settings-license-status",accessibilityLabel:F?"License: Active":"License: Free",children:F?e(v,{label:"Active",tone:"accent"}):e(v,{label:"Free",tone:"neutral"})})]})}),e(ve,{children:F?"You have full access to all Buoy DevTools features.":U?Me?`Couldn't reach the license server (${U}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${U}.`:"Upgrade to Pro to unlock all features and support development."})),!F&&a(k,{children:[C("Pro Features",e(R,{glass:true,children:e(X,{children:["Advanced Settings","Priority Support"].map(t=>a(y,{style:n.featureRow,children:[e(Te,{size:16,color:o.color.accent}),e(u,{style:n.rowLabel,children:t})]},t))})})),e(ze,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>J(true)})]})]})]}),e(ct,{visible:Oe,onClose:()=>J(false),onSuccess:()=>J(false)})]});return e(vt,{visible:d,onClose:g,zIndex:p,variant:"night",header:{showToggleButton:false,customContent:e(y,{style:n.headerRow,children:e(ut,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:B,onChange:t=>oe(t)})})},initialMode:"bottomSheet",onModeChange:Je,persistenceKey:Z.settings.root(),enablePersistence:true,maxHeight:ce-le.top,initialHeight:je,initialFloatingPosition:{x:(de-Ae)/2,y:le.top+20},enableGlitchEffects:true,children:$e()})};const Lt={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}};const Dt=(d,g)=>{const i=new Set(d??[]);const f=new Set(g??[]);const l={};for(const p of f){l[p]=true}const h={environment:i.has("environment")};for(const p of i){if(p!=="environment"){h[p]=true}}return{dialTools:V(l),floatingTools:h,globalSettings:{enableSharedModalDimensions:false}}};let P=null;let ee=null;let Re=null;const Be=(d,g)=>JSON.stringify(d)===JSON.stringify(g);A.addListener(d=>{if(d)P=d});export const useDevToolsSettings=()=>{const{defaultFloatingTools:d,defaultDialTools:g}=Le();const i=W(()=>{if(!d&&!g){return Lt}return Dt(d,g)},[d,g]);const[f,l]=m(i);const h=K(async()=>{try{const S=await D.getItem(N);if(S){const x=JSON.parse(S);const c=De(i,x);l(c);return}l(i)}catch(S){console.error("Failed to load dev tools settings:",S);l(i)}},[i]);L(()=>{h();const S=A.addListener(x=>{try{if(x){l(x)}}catch(c){}});return()=>{S()}},[h]);const p=K(()=>{h()},[h]);return{settings:f,refreshSettings:p}};const n=Xe.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:o.gutter,paddingRight:o.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:o.gutter,paddingTop:8,paddingBottom:24,gap:o.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:o.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:o.rowPadH,paddingVertical:o.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:o.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:o.color.text,fontSize:o.font.row,fontWeight:"500"},rowCaption:{color:o.color.textTertiary,fontSize:o.font.label},settingRowBody:{paddingHorizontal:o.rowPadH,paddingBottom:o.rowPadV,gap:6},settingRowBodyText:{color:o.color.textSecondary,fontSize:o.font.caption,lineHeight:o.font.caption*1.45},settingRowBodyHint:{color:o.color.textTertiary,fontSize:o.font.caption,lineHeight:o.font.caption*1.45},bodyWarning:{color:o.color.warning},bodyDanger:{color:o.color.danger},cardButtonWrap:{paddingHorizontal:o.cardPad,paddingTop:10,paddingBottom:o.cardPad},storageExpanded:{paddingHorizontal:o.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:o.color.textSecondary,fontSize:o.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:o.color.textTertiary,fontSize:o.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:o.color.glassElevated,borderRadius:o.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:o.color.textSecondary,fontSize:o.font.micro,fontFamily:Ie},storageKeyEmpty:{color:o.color.textTertiary,fontSize:o.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:Ie,fontSize:o.font.label,color:o.color.textSecondary}});
|
|
1
|
+
"use strict";import{useState as m,useEffect as L,useCallback as K,useMemo as W}from"react";import{View as u,Text as y,StyleSheet as Xe,ScrollView as Se,TouchableOpacity as j,Dimensions as be,Platform as Ze}from"react-native";import{settingsBus as A}from"./settingsBus.js";import{useDesktopSyncStatus as et}from"./useDesktopSyncStatus";import{SentryIcon as tt,WifiCircuitIcon as ot,ImageOverlayIcon as nt,RenderCountIcon as rt,Info as Q,Layers as st,ChevronRightIcon as we,ChevronDown as Te,getStorageBackendType as it,getUseLicense as at,signOutOfBuoy as lt,persistentStorage as D,Trash2 as ct,CheckCircle2 as ve,LicenseEntryModal as dt,BackgroundSwitcher as gt,night as o,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 St,HighlighterIcon as bt,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}from"@buoy-gg/shared-ui";import{useSafeAreaInsets as zt}from"@buoy-gg/shared-ui";import{jsx as e,jsxs as s,Fragment as P}from"react/jsx-runtime";const N="@react_buoy_dev_tools_settings";const It=6;const V=d=>{let g=It;const a={};for(const[f,l]of Object.entries(d)){if(l&&g>0){a[f]=true;g-=1}else{a[f]=false}}return a};const Ct=(d,g)=>{const{userStatus:a,environment:f,...l}=d;const h=g?Object.entries(l).filter(([p])=>g.includes(p)):Object.entries(l);return{...Object.fromEntries(h),environment:f??false}};const De=(d,g,a)=>{if(!g)return d;const f={...d.dialTools,...g.dialTools??{}};const l=a?.allowedDialKeys?Object.entries(f).filter(([p])=>a.allowedDialKeys?.includes(p)):Object.entries(f);const h=V(Object.fromEntries(l));return{dialTools:h,floatingTools:Ct({...d.floatingTools,...g.floatingTools??{}},a?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...g.globalSettings??{}}}};const Lt=(d=[],g,a)=>{const f={};const l={};const h=new Set(g??[]);const p=new Set(a??[]);const S=!a||a.length===0;for(const x of d){const{id:c,slot:I="both"}=x;if(I==="dial"||I==="both"){f[c]=S?true:p.has(c)}if(I==="row"||I==="both"){l[c]=h.has(c)}}return{dialTools:V(f),floatingTools:{...l,environment:h.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}};export const DevToolsSettingsModal=({visible:d,onClose:g,onSettingsChange:a,initialSettings:f,availableApps:l=[],storage:h=D,zIndex:p})=>{const{defaultFloatingTools:S,defaultDialTools:x}=Le();const c=W(()=>Lt(l,S,x),[l,S,x]);const I=W(()=>Object.keys(c.dialTools),[c]);const oe=W(()=>Object.keys(c.floatingTools).filter(t=>t!=="environment"),[c]);const[z,E]=m(f||H||c);const[B,ne]=m(te??"floating");const[re,Ee]=m(te!==null);const[_,Fe]=m(new Set);const[Oe,J]=m(false);const[ke,Pe]=m(false);L(()=>{const t=requestAnimationFrame(()=>Pe(true));return()=>cancelAnimationFrame(t)},[]);const b=et();L(()=>{const t=async()=>{try{const r=await D.getItem(ee.settings.activeTab());if(r&&["floating","settings","pro"].includes(r)){const i=r;te=i;ne(T=>T===i?T:i)}}catch(r){}finally{Ee(true)}};t()},[]);L(()=>{if(!re)return;D.setItem(ee.settings.activeTab(),B).catch(t=>{console.warn("Failed to save settings active tab:",t)})},[B,re]);const He=at();const F=He?.();const O=F?.isPro??false;const U=!O&&F?.licenseKey?F.error:null;const Me=F?.errorKind==="transport";const[w,Ke]=m(Re);const[G,se]=m(false);const[q,Y]=m(false);const[k,We]=m(false);const[$,ie]=m([]);const[ae,le]=m(false);const ce=zt();const de=be.get("window").height;const ge=be.get("window").width;const je=Math.floor(de*.33);const Ae=Math.min(ge-32,400);const ue=K(async()=>{try{const t=await h.getItem(N);if(t){const r=JSON.parse(t);const i=De(c,r,{allowedDialKeys:I,allowedFloatingKeys:oe});H=i;E(T=>Be(T,i)?T:i);return}H=c;E(r=>Be(r,c)?r:c)}catch(t){console.error("Failed to load dev tools settings:",t);E(c)}},[c,I,oe,h]);L(()=>{ue()},[ue]);L(()=>{it().then(t=>{Re=t;Ke(r=>r===t?r:t)})},[]);L(()=>{if(k){le(true);D.getAllKeys().then(t=>{ie(t.sort())}).catch(()=>{ie([])}).finally(()=>{le(false)})}},[k]);const ye=async t=>{try{const r={...t,dialTools:V(t.dialTools)};await h.setItem(N,JSON.stringify(r));H=r;E(r);a?.(r);A.emit(r)}catch(r){console.error("Failed to save dev tools settings:",r)}};const Ne=t=>{const r={...z,floatingTools:{...z.floatingTools,[t]:!z.floatingTools[t]}};ye(r)};const Ve=t=>{const r={...z,globalSettings:{...z.globalSettings,[t]:!z.globalSettings?.[t]}};ye(r)};const _e=async()=>{se(true);Y(false);try{await D.clear();Y(true);E(c);if(h!==D)await h.setItem(N,JSON.stringify(c));a?.(c);A.emit(c);setTimeout(()=>Y(false),2e3)}catch(t){console.error("Failed to clear storage:",t)}finally{se(false)}};const Je=K(t=>{},[]);const Ue=t=>{const r=l.find(i=>i.id===t);if(r?.description){return r.description}if(t==="environment"){return"Environment badge."}return""};const he=t=>{if(t==="environment"){return"Env Badge"}const r=l.find(i=>i.id===t);return r?.name??t.toUpperCase().replace(/_/g," ")};const Ge=t=>{if(!ke)return null;switch(t){case"query":return e(St,{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:o.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:o.color.surface});case"network":return e(mt,{size:18});case"environment":return e(Ce,{size:18});case"debug-borders":return e(st,{size:18,color:o.color.accent});case"highlight-updates":return e(rt,{size:18,color:o.color.accent});case"highlight-updates-modal":return e(bt,{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:r}=require("@buoy-gg/zustand");return e(r,{size:18})}catch{return e(Q,{size:18,color:o.color.textSecondary})}case"jotai":try{const{JotaiIcon:r}=require("@buoy-gg/jotai");return e(r,{size:18})}catch{return e(Q,{size:18,color:o.color.textSecondary})}default:{const r=l.find(i=>i.id===t);if(r?.icon!=null){return vt(r.icon,{slot:"row",size:18,color:r.color})}return e(Q,{size:18,color:o.color.textSecondary})}}};const qe=(t,r,i,T)=>{const M=Ue(t);return s(j,{activeOpacity:i?1:.7,onPress:()=>!i&&T(),accessibilityLabel:he(t),accessibilityRole:"button",style:[n.toolRow,i&&n.rowDisabled],children:[e(u,{style:n.toolIconSlot,children:Ge(t)}),s(u,{style:n.rowInfo,children:[s(y,{style:n.rowLabel,children:[he(t),i?" \xB7 max 6":""]}),M?e(y,{style:n.rowCaption,numberOfLines:1,children:M}):null]}),e(ze,{value:r,disabled:i,onValueChange:()=>T()})]},t)};const fe=t=>{Fe(r=>{const i=new Set(r);if(i.has(t)){i.delete(t)}else{i.add(t)}return i})};const pe=(t,r,i,T,M)=>{const Qe=z.globalSettings?.[t]??false;const me=_.has(t);return s(u,{children:[s(j,{activeOpacity:.7,onPress:()=>fe(t),accessibilityLabel:r,style:n.settingRow,children:[s(u,{style:n.rowInfo,children:[e(y,{style:n.rowLabel,children:r}),e(y,{style:n.rowCaption,numberOfLines:me?0:1,children:i})]}),e(ze,{value:Qe,onValueChange:()=>Ve(t)})]}),me&&s(u,{style:n.settingRowBody,children:[e(y,{style:n.settingRowBodyText,children:T}),e(y,{style:n.settingRowBodyHint,children:M})]})]},t)};const C=(t,r,i)=>s(u,{children:[e(ut,{children:t}),r,i]});const Ye=w==="filesystem"?e(v,{label:"File System",tone:"accent"}):w==="asyncstorage"?e(v,{label:"Async Storage",tone:"warning"}):w==="localstorage"?e(v,{label:"Local Storage",tone:"accent"}):w==="memory"?e(v,{label:"Memory",tone:"danger"}):e(v,{label:"Loading\u2026",tone:"neutral"});const $e=()=>s(u,{style:n.container,children:[s(Se,{style:n.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:n.scrollContainer,children:[B==="floating"&&e(P,{children:C("Floating Tools",e(R,{glass:true,children:e(X,{children:Object.entries(z.floatingTools).map(([t,r])=>qe(t,r,false,()=>Ne(t)))})}),e(xe,{children:"Tools switched on here appear in the floating bubble row."}))}),B==="settings"&&s(P,{children:[C("Background",e(R,{glass:true,padded:true,children:e(gt,{embedded:true})})),C("Storage",s(R,{glass:true,children:[s(j,{activeOpacity:.7,onPress:()=>We(!k),accessibilityLabel:"Storage Type",style:n.settingRow,children:[e(u,{style:n.rowInfo,children:e(y,{style:n.rowLabel,children:"Storage Type"})}),Ye,k?e(Te,{size:16,color:o.color.textTertiary}):e(we,{size:16,color:o.color.textTertiary})]}),k&&s(P,{children:[s(u,{style:n.settingRowBody,children:[e(y,{style:n.settingRowBodyText,children:w==="filesystem"?"Settings persist independently and survive AsyncStorage.clear() calls during logout.":w==="asyncstorage"?"Settings may be lost if AsyncStorage is cleared during logout.":w==="localstorage"?"Settings are saved in this browser. Clearing site data removes them.":w==="memory"?"Settings are stored in memory only and will be lost on app restart.":"Checking storage backend\u2026"}),w==="asyncstorage"&&e(y,{style:[n.settingRowBodyText,n.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),w==="memory"&&e(y,{style:[n.settingRowBodyText,n.bodyDanger],children:"No persistent storage available \u2014 install expo-file-system (best) or @react-native-async-storage/async-storage."})]}),e(ht,{}),s(u,{style:n.storageExpanded,children:[s(u,{style:n.storageExpandedHeader,children:[e(y,{style:n.storageExpandedTitle,children:"SAVED SETTINGS"}),e(y,{style:n.storageExpandedCount,children:ae?"\u2026":`${$.length} keys`})]}),ae?e(y,{style:n.storageKeyEmpty,children:"Loading\u2026"}):$.length===0?e(y,{style:n.storageKeyEmpty,children:"No settings saved yet"}):e(Se,{style:n.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:$.map(t=>e(u,{style:n.storageKeyItem,children:e(y,{style:n.storageKeyText,numberOfLines:1,children:t.replace("@react_buoy_","")})},t))})]}),e(u,{style:n.cardButtonWrap,children:e(Z,{label:q?"Cleared":G?"Clearing\u2026":"Clear All Settings",variant:q?"secondary":"destructive",size:"md",disabled:G,onPress:_e,icon:q?e(ve,{size:15,color:o.color.accent}):e(ct,{size:15,color:G?o.color.textTertiary:o.color.danger})})})]})]})),b&&b.state!=="idle"&&C("Desktop Sync",s(R,{glass:true,children:[s(j,{activeOpacity:.7,onPress:()=>fe("desktopSync"),accessibilityLabel:"Buoy Desktop",style:n.settingRow,children:[e(u,{style:n.rowInfo,children:e(y,{style:n.rowLabel,children:"Buoy Desktop"})}),b.state==="connected"?e(v,{label:"Connected",tone:"accent"}):b.state==="connecting"?e(v,{label:"Connecting\u2026",tone:"neutral"}):e(v,{label:"Retrying",tone:"warning"}),_.has("desktopSync")?e(Te,{size:16,color:o.color.textTertiary}):e(we,{size:16,color:o.color.textTertiary})]}),_.has("desktopSync")&&s(u,{style:n.settingRowBody,children:[s(y,{style:n.settingRowBodyText,children:[b.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",e(y,{style:n.footnoteMono,children:b.targetURL??"(unknown URL)"}),b.state!=="connected"&&" \u2014 is the desktop app running? Override with the externalSync socketURL option if it runs elsewhere."]}),b.state==="retrying"&&b.lastError&&s(y,{style:[n.settingRowBodyText,n.bodyWarning],children:["Last error: ",b.lastError]})]})]})),C("Modal Behavior",e(R,{glass:true,children:s(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."),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]})}))]}),B==="pro"&&s(P,{children:[C("License",s(R,{glass:true,children:[s(u,{style:n.settingRow,children:[e(u,{style:n.rowInfo,children:e(y,{style:n.rowLabel,children:"License Status"})}),e(u,{testID:"buoy-settings-license-status",accessibilityLabel:O?"License: Active":"License: Free",children:O?e(v,{label:"Active",tone:"accent"}):e(v,{label:"Free",tone:"neutral"})})]}),F?.tierSource==="session"?s(u,{style:n.settingRow,children:[e(u,{style:n.rowInfo,children:e(y,{style:n.rowLabel,children:"Signed in with Buoy"})}),e(Z,{label:"Sign out",variant:"secondary",size:"md",onPress:()=>void lt(),testID:"buoy-settings-signout"})]}):null]}),e(xe,{children:O?"You have full access to all Buoy DevTools features.":U?Me?`Couldn't reach the license server (${U}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${U}.`:"Upgrade to Pro to unlock all features and support development."})),!O&&s(P,{children:[C("Pro Features",e(R,{glass:true,children:e(X,{children:["Advanced Settings","Priority Support"].map(t=>s(u,{style:n.featureRow,children:[e(ve,{size:16,color:o.color.accent}),e(y,{style:n.rowLabel,children:t})]},t))})})),e(Z,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>J(true)})]})]})]}),e(dt,{visible:Oe,onClose:()=>J(false),onSuccess:()=>J(false)})]});return e(xt,{visible:d,onClose:g,zIndex:p,variant:"night",header:{showToggleButton:false,customContent:e(u,{style:n.headerRow,children:e(yt,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:B,onChange:t=>ne(t)})})},initialMode:"bottomSheet",onModeChange:Je,persistenceKey:ee.settings.root(),enablePersistence:true,maxHeight:de-ce.top,initialHeight:je,initialFloatingPosition:{x:(ge-Ae)/2,y:ce.top+20},enableGlitchEffects:true,children:$e()})};const Dt={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}};const Rt=(d,g)=>{const a=new Set(d??[]);const f=new Set(g??[]);const l={};for(const p of f){l[p]=true}const h={environment:a.has("environment")};for(const p of a){if(p!=="environment"){h[p]=true}}return{dialTools:V(l),floatingTools:h,globalSettings:{enableSharedModalDimensions:false}}};let H=null;let te=null;let Re=null;const Be=(d,g)=>JSON.stringify(d)===JSON.stringify(g);A.addListener(d=>{if(d)H=d});export const useDevToolsSettings=()=>{const{defaultFloatingTools:d,defaultDialTools:g}=Le();const a=W(()=>{if(!d&&!g){return Dt}return Rt(d,g)},[d,g]);const[f,l]=m(a);const h=K(async()=>{try{const S=await D.getItem(N);if(S){const x=JSON.parse(S);const c=De(a,x);l(c);return}l(a)}catch(S){console.error("Failed to load dev tools settings:",S);l(a)}},[a]);L(()=>{h();const S=A.addListener(x=>{try{if(x){l(x)}}catch(c){}});return()=>{S()}},[h]);const p=K(()=>{h()},[h]);return{settings:f,refreshSettings:p}};const n=Xe.create({container:{flex:1,backgroundColor:"transparent"},headerRow:{flexDirection:"row",alignItems:"center",paddingLeft:o.gutter,paddingRight:o.gutter,paddingBottom:8},scrollContent:{flex:1},scrollContainer:{paddingHorizontal:o.gutter,paddingTop:8,paddingBottom:24,gap:o.groupGap},toolRow:{flexDirection:"row",alignItems:"center",gap:12,paddingHorizontal:o.rowPadH,paddingVertical:12},settingRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:o.rowPadH,paddingVertical:o.rowPadV,minHeight:52},featureRow:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:o.rowPadH,paddingVertical:12},rowDisabled:{opacity:.4},toolIconSlot:{width:24,alignItems:"center"},rowInfo:{flex:1,gap:2},rowLabel:{color:o.color.text,fontSize:o.font.row,fontWeight:"500"},rowCaption:{color:o.color.textTertiary,fontSize:o.font.label},settingRowBody:{paddingHorizontal:o.rowPadH,paddingBottom:o.rowPadV,gap:6},settingRowBodyText:{color:o.color.textSecondary,fontSize:o.font.caption,lineHeight:o.font.caption*1.45},settingRowBodyHint:{color:o.color.textTertiary,fontSize:o.font.caption,lineHeight:o.font.caption*1.45},bodyWarning:{color:o.color.warning},bodyDanger:{color:o.color.danger},cardButtonWrap:{paddingHorizontal:o.cardPad,paddingTop:10,paddingBottom:o.cardPad},storageExpanded:{paddingHorizontal:o.rowPadH,paddingVertical:12,gap:8},storageExpandedHeader:{flexDirection:"row",alignItems:"center"},storageExpandedTitle:{flex:1,color:o.color.textSecondary,fontSize:o.font.micro,fontWeight:"600",letterSpacing:.5},storageExpandedCount:{color:o.color.textTertiary,fontSize:o.font.micro},storageKeysList:{maxHeight:150},storageKeyItem:{backgroundColor:o.color.glassElevated,borderRadius:o.radius.segment,paddingHorizontal:10,paddingVertical:7,marginBottom:4},storageKeyText:{color:o.color.textSecondary,fontSize:o.font.micro,fontFamily:Ie},storageKeyEmpty:{color:o.color.textTertiary,fontSize:o.font.caption,fontStyle:"italic"},footnoteMono:{fontFamily:Ie,fontSize:o.font.label,color:o.color.textSecondary}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{FloatingToolHost as
|
|
1
|
+
"use strict";import{FloatingToolHost as oe}from"@buoy-gg/shared-ui";import{AccountSetup as ne}from"@buoy-gg/shared-ui";import Me,{useMemo as t,useCallback as se,useEffect as P}from"react";import{View as J,StyleSheet as N}from"react-native";import{AppHostProvider as ie}from"./AppHost";import{FloatingMenu as ue}from"./FloatingMenu.js";import{AppOverlay as ce}from"./AppHost";import{ToolOpenerBridge as le}from"./ToolOpenerBridge.js";import{autoDiscoverPresets as ae,autoDiscoverPresetsWithCustom as ge}from"./autoDiscoverPresets.js";import{sendInstallPing as ye}from"../telemetry/installPing.js";import{isTelemetryEnabled as me}from"../Buoy.js";import{renderAppIcon as pe}from"./AppIcon";import{DevToolsVisibilityProvider as de}from"./DevToolsVisibilityContext.js";import{reportOptionalRequireError as n}from"./optionalRequire.js";import{HintsProvider as fe,normalizeEnvironment as be}from"@buoy-gg/shared-ui";import{MinimizedToolsProvider as ve}from"./MinimizedToolsContext.js";import{validateDialConfig as he}from"./defaultConfig.js";import{DefaultConfigProvider as Oe}from"./DefaultConfigContext.js";import{LicenseManager as Te,useProAccess as Ae,useLicense as Re}from"@buoy-gg/license";import{AutoExternalSync as Q,ToolRegistryPublisher as qe,isExternalSyncAvailable as Ee}from"./autoExternalSync.js";import{externalSyncOptions as k,releaseTransportProblem as _e,shouldMountExternalSync as Ie}from"./externalSyncGate.js";import{jsx as r,Fragment as O,jsxs as y}from"react/jsx-runtime";let W=null;function xe(s){if(!s||s===W)return;W=s;console.warn(s)}export const FloatingDevTools=({apps:s,requiredEnvVars:i,requiredStorageKeys:p,askBuoy:T,children:G,disableHints:X=false,defaultFloatingTools:Y,defaultDialTools:d,requireLicense:Pe,licenseKey:f,zustandStores:A,environment:Z,externalSync:b=true,headless:z=false,...C})=>{const $=Z??be(process.env.NODE_ENV??"dev");const{isLicensed:v}=Ae();const{licenseKey:R,isInitialized:M,tier:h,access:u}=Re();const K=f===void 0||f.trim().toUpperCase()===(R??"");const ee=K&&u.status==="admitted";P(()=>{if(!M||u.status==="initializing")return;void ye({tier:u.status==="admitted"?h:"locked",enabled:me()})},[M,u.status,h]);P(()=>{void Te.configure(f).catch(()=>{})},[f]);P(()=>{if(!A||u.status==="locked")return;try{const{watchStores:e}=require("@buoy-gg/zustand");return e(A)}catch(e){n("@buoy-gg/zustand",e)}},[A,u.status]);const re=t(()=>{if(d){return he(d)}return d},[d]);const q=t(()=>{const e=[];if(i&&i.length>0){try{const{createEnvTool:o,createEnvVarConfig:D}=require("@buoy-gg/env");e.push(o({requiredEnvVars:D(i)}))}catch(o){n("@buoy-gg/env",o)}}if(p&&p.length>0){try{const{createStorageTool:o}=require("@buoy-gg/storage");e.push(o({requiredStorageKeys:p}))}catch(o){n("@buoy-gg/storage",o)}}if(T){try{const{createAskBuoyTool:o}=require("@buoy-gg/ask-buoy");e.push(o(T))}catch(o){n("@buoy-gg/ask-buoy",o)}}return e},[i,p,T]);const E=t(()=>{if(!s&&q.length===0)return void 0;return[...s||[],...q]},[s,q]);const m=t(()=>E?ge(E):ae(),[E]);const _=t(()=>m.filter(e=>e.sync),[m]);const F=t(()=>{try{const{DebugBordersStandaloneOverlay:e}=require("@buoy-gg/debug-borders");return e}catch(e){n("@buoy-gg/debug-borders",e);return null}},[]);const H=t(()=>{try{const{HighlightUpdatesOverlay:e}=require("@buoy-gg/highlight-updates");return e}catch(e){n("@buoy-gg/highlight-updates",e);return null}},[]);const j=t(()=>{try{const{ImageOverlayStandalone:e}=require("@buoy-gg/image-overlay");return e}catch(e){n("@buoy-gg/image-overlay",e);return null}},[]);const L=t(()=>{try{const{PerfMonitorOverlay:e}=require("@buoy-gg/perf-monitor");return e}catch(e){n("@buoy-gg/perf-monitor",e);return null}},[]);const S=t(()=>{try{const{JsTopHudOverlay:e}=require("@buoy-gg/js-top");return e}catch(e){n("@buoy-gg/js-top",e);return null}},[]);const c=t(()=>{try{const{RouteTracker:e}=require("@buoy-gg/route-events");return e}catch(e){n("@buoy-gg/route-events",e);return null}},[]);const l=t(()=>{try{const{ReactQueryTracker:e}=require("@buoy-gg/react-query");return e}catch(e){n("@buoy-gg/react-query",e);return null}},[]);const w=t(()=>{try{const{ImpersonateOverlay:e}=require("@buoy-gg/impersonate");return e}catch(e){n("@buoy-gg/impersonate",e);return null}},[]);const U=t(()=>{try{const{ScenariosOverlay:e}=require("@buoy-gg/scenarios");return e}catch(e){n("@buoy-gg/scenarios",e);return null}},[]);const a=t(()=>{try{const{ReduxAutoInstrument:e}=require("@buoy-gg/redux");return e??null}catch(e){n("@buoy-gg/redux",e);return null}},[]);const g=t(()=>{try{const{ConsoleRoot:e}=require("@buoy-gg/console");return e??null}catch(e){n("@buoy-gg/console",e);return null}},[]);const te=se(e=>{const o=m.find(D=>D.id===e);if(!o)return null;return pe(o.icon,{slot:"dial",size:20,color:o.color})},[m]);const I=typeof __DEV__!=="undefined"&&__DEV__;if(!I&&!v){return null}const V=Ie({isDevelopment:I,isLicensed:v,externalSync:b,isAvailable:Ee()});const x=k(b);if(!I&&x?.enableInRelease){xe(_e(x.socketURL,x))}const B=r(qe,{requiredEnvVars:i,customApps:_});if(!ee){return y(O,{children:[u.status==="initializing"&&y(O,{children:[a&&r(a,{}),g&&r(g,{}),c&&r(c,{}),l&&r(l,{})]}),!z&&r(ne,{})]})}if(z){return y(O,{children:[a&&r(a,{}),g&&r(g,{}),c&&r(c,{}),l&&r(l,{}),B,V&&r(Q,{options:k(b),requiredEnvVars:i,isPro:v,tier:h,licenseKey:R,customApps:_})]})}return r(Oe,{defaultFloatingTools:Y,defaultDialTools:re,children:r(fe,{disableHints:X,children:r(J,{style:De.container,pointerEvents:"box-none",__buoyDevToolsRoot:true,children:y(de,{children:[j&&r(J,{style:N.absoluteFill,pointerEvents:"box-none",collapsable:false,children:r(j,{})}),r(ie,{children:y(ve,{getToolIcon:te,children:[r(ue,{...C,apps:m,environment:$}),C.hidden?null:y(O,{children:[r(ce,{}),r(oe,{})]}),r(le,{})]})}),G,F&&r(F,{}),H&&r(H,{}),L&&r(L,{}),S&&r(S,{}),w&&r(w,{}),U&&r(U,{}),a&&r(a,{}),g&&r(g,{}),c&&r(c,{}),l&&r(l,{}),B,V&&r(Q,{options:k(b),requiredEnvVars:i,isPro:v,tier:h,licenseKey:R,customApps:_})]})})})})};const De=N.create({container:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:9999}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{FloatingToolHost as oe}from"@buoy-gg/shared-ui/floating";import{LicenseManager as ie,useLicense as se}from"@buoy-gg/license";import{AccountSetup as re}from"@buoy-gg/shared-ui";import{useState as x,useMemo as
|
|
1
|
+
"use strict";import{FloatingToolHost as oe}from"@buoy-gg/shared-ui/floating";import{LicenseManager as ie,useLicense as se}from"@buoy-gg/license";import{AccountSetup as re}from"@buoy-gg/shared-ui";import{useState as x,useMemo as T,useCallback as b,useEffect as c,useRef as ae}from"react";import{useSettings as ce,getToolLabel as w,getToolDescription as le,getToolColor as F}from"@buoy-gg/floating-tools-react";import{persistentStorage as m,devToolsStorageKeys as E,EnvironmentIndicator as de,EnvironmentSelectorInline as me}from"@buoy-gg/shared-ui";import{autoDiscoverWithCustom as ue,getToolsBySlot as N}from"../utils/autoDiscoverPresets.web.js";import{FloatingTools as pe,UserStatus as fe}from"./floatingTools.web.js";import{DialMenu as ge}from"./dial/DialDevTools.web.js";import{getRankedToolIds as ye,recordToolUsage as ve}from"./dial/dialUsageStore.js";import{OnboardingTooltip as he}from"./dial/OnboardingTooltip.web.js";import{SettingsModal as Te}from"./DevToolsSettingsModal.web.js";import{AppHostProvider as be,AppOverlay as Oe,useAppHost as Ie}from"./AppHost.web.js";import{MinimizedToolsStack as Se}from"./MinimizedToolsStack.web.js";import{createWebTools as Ce}from"../utils/createWebTools.js";import{BrowserToolRuntime as De}from"./BrowserToolRuntime.js";import{clearReleaseOptIn as we,markReleaseOptIn as Ee}from"../releaseOptIn.js";import{BuoySignIn as _e}from"./BuoySignIn.web.js";import{DevToolsVisibilityProvider as Me,useDevToolsVisibility as Pe}from"./DevToolsVisibilityContext.js";import{jsx as t,jsxs as Y}from"react/jsx-runtime";const ke={};const G="@react_buoy_floating_menu_tooltip_shown";const xe=m;function Ae({size:o=14,color:d="#20C997"}){const s=Math.max(2,o/4);const u=Math.max(1,o/16);return t("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${s}px)`,gap:u,width:o,height:o,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((p,l)=>t("div",{style:{width:s,height:s,borderRadius:s/2,backgroundColor:d}},l))})}function Le(o){return t(Me,{children:t(be,{children:t(Re,{...o})})})}function Re({environment:o,userRole:d,availableEnvironments:s,onEnvironmentSwitch:u,apps:p,modules:l=ke,externalSync:O,requiredEnvVars:H,sentryGetClient:q,disableHints:_=false,headless:A=false}){const[r,I]=x(false);const[f,S]=x(false);const M=ae(false);const g=Ie();const a=T(()=>ue([...Ce(l),...p??[]]),[p,l]);const C=Pe();const L=g.openApps.some(e=>!e.minimized);c(()=>{C.setDialOpen(r)},[r,C.setDialOpen]);c(()=>{C.setToolOpen(L||f)},[L,f,C.setToolOpen]);const{registerApps:R}=g;c(()=>{R(a.map(e=>{const n=e.icon;return{...e,icon:typeof n==="function"?({size:i})=>n(i):n}}))},[R,a]);const $=T(()=>a.map(e=>({id:e.id,name:e.name,description:e.description,slot:e.slot})),[a]);const{settings:P}=ce({availableTools:$,storage:xe});c(()=>{let e=false;const n=async()=>{const[i,h]=await Promise.all([m.getItem(E.dial.isOpen()),m.getItem(E.settings.modalOpen())]);if(e)return;if(i==="true")I(true);if(h==="true"){I(true);S(true)}M.current=true};void n();return()=>{e=true}},[]);c(()=>{if(!M.current)return;void m.setItem(E.dial.isOpen(),r?"true":"false")},[r]);c(()=>{if(!M.current)return;void m.setItem(E.settings.modalOpen(),f?"true":"false")},[f]);const k=b(e=>{void ve(e.id);if(e.launchMode==="toggle-only"){e.onPress?.();return}if(e.component){const n=typeof e.icon==="function"?e.icon(20):e.icon;g.open({id:e.id,title:e.name||w(e.id),component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:n,color:e.color||F(e.id)})}else{e.onPress?.()}},[g]);const D=T(()=>{const e=N(a,"dial");return e.map(n=>{const i=n.color||F(n.id);let h;if(typeof n.icon==="string"){h=n.icon}else if(typeof n.icon==="function"){h=n.icon(32)}else{h=null}return{id:n.id,name:n.name||w(n.id),icon:h,unavailable:!n.component&&!n.onPress,color:i,onPress:()=>{k(n);I(false)}}})},[a,k]);const J=T(()=>{if(!r)return D;const e=new Map(D.map(n=>[n.id,n]));return ye(D.map(n=>n.id)).map(n=>e.get(n)).filter(n=>Boolean(n))},[r,D]);const Q=T(()=>N(a,"row").filter(e=>P.floatingTools[e.id]===true&&(e.component||e.onPress)),[a,P.floatingTools]);const X=T(()=>a.map(e=>({id:e.id,name:e.name||w(e.id),description:e.description||le(e.id),slot:e.slot,icon:e.icon,color:e.color})),[a]);const[Z,K]=x(false);const j=g.openApps.some(e=>!e.minimized);c(()=>{if(_)return;let e=false;const n=setTimeout(async()=>{const i=await m.getItem(G);if(!e&&!i)K(true)},1e3);return()=>{e=true;clearTimeout(n)}},[_]);const y=b(()=>{K(false);void m.setItem(G,"true")},[]);const B=b(()=>{y();I(true)},[y]);const ee=b(()=>{I(false);S(false)},[]);const ne=b(()=>{S(e=>!e)},[]);const te=b(()=>S(false),[]);const V=Boolean(s?.length&&u);const z=P.floatingTools.environment!==false;const v=Z&&!r&&!j;c(()=>{if(!v)return;const e=i=>{if(!(i.target instanceof Element)||!i.target.closest("[data-buoy-root]"))y()};const n=i=>{if(i.key==="Escape")y()};document.addEventListener("pointerdown",e,true);document.addEventListener("keydown",n);return()=>{document.removeEventListener("pointerdown",e,true);document.removeEventListener("keydown",n)}},[v,y]);const U=g.openApps.some(e=>e.minimized&&e.launchMode!=="toggle-only");const W=t(De,{modules:l,apps:p,requiredEnvVars:H,externalSync:O,headless:A,sentryGetClient:q});if(A)return W;return Y("div",{"data-buoy-root":"",style:{display:"contents"},children:[W,v&&t("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),Y(pe,{enablePositionPersistence:!v,pushToSide:r||j,suspendPointerEvents:r,centerOnboarding:v,minimizedStack:U?t(Se,{}):void 0,hasMinimizedStack:U,children:[o&&z&&!V&&t(de,{environment:o}),V&&z&&t(me,{currentEnvironment:o??"local",availableEnvironments:s,onSelect:u}),d?t(fe,{userRole:d,onPress:B}):t("button",{"aria-label":"Open dev tools",onClick:B,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:t(Ae,{})}),Q.map(e=>t("button",{"aria-label":e.name||w(e.id),title:e.description,onClick:()=>k(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))]}),v&&t(he,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:y}),r&&t(ge,{icons:J,onClose:ee,centerLabel:"BUOY",onCenterPress:ne,settingsOpen:f,hintsDisabled:_}),t(Te,{visible:f,onClose:te,availableTools:X,onSettingsChange:e=>{}}),t(Oe,{}),t(oe,{})]})}export function FloatingDevTools(o){const{access:d,isPro:s,licenseKey:u}=se();c(()=>{void ie.configure(o.licenseKey)},[o.licenseKey]);const p=o.licenseKey===void 0||o.licenseKey.trim().toUpperCase()===(u??"");const l=typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production";const O=p&&d.status==="admitted";c(()=>{if(l||d.status==="initializing")return;if(s&&O)Ee();else we()},[l,s,O,d.status]);if(!l&&!s)return o.signIn&&!o.headless?t(_e,{}):null;if(!O)return o.headless?null:t(re,{});return t(Le,{...o})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import Oe,{useEffect as r,useMemo as M,useRef as A,useState as m}from"react";import{TouchableOpacity as K,StyleSheet as se,View as l}from"react-native";import{absoluteFill as U,registerToolOpener as ie}from"@buoy-gg/shared-ui";import{FloatingTools as re,UserStatus as le}from"./floatingTools";import{renderAppIcon as Y}from"./AppIcon";import{DialDevTools as ae}from"./dial/DialDevTools";import{EnvironmentIndicator as ce,persistentStorage as y,useHintsDisabled as de,devToolsStorageKeys as $,buoyColors as ue}from"@buoy-gg/shared-ui";import{useDevToolsSettings as me}from"./DevToolsSettingsModal";import{useAppHost as ge}from"./AppHost";import{useDevToolsVisibility as fe}from"./DevToolsVisibilityContext.js";import{toggleStateManager as he}from"./ToggleStateManager.js";import{OnboardingTooltip as be}from"./dial/OnboardingTooltip";import{jsx as n,jsxs as x,Fragment as pe}from"react/jsx-runtime";const q="@react_buoy_floating_menu_tooltip_shown";const Ee="@react_buoy_onboarding_step";export const FloatingMenu=({apps:t,state:f,actions:a,hidden:h,environment:c,userRole:w="admin",availableEnvironments:b,onEnvironmentSwitch:P})=>{const[R,O]=m(false);const[s,d]=m(false);const[E,J]=m(false);const[Q,F]=m(null);const[,B]=m(0);const H=A(false);const S=de();r(()=>{const e=async()=>{try{const o=await y.getItem($.dial.isOpen());if(o==="true"){d(true)}}catch(o){}finally{J(true)}};e()},[]);r(()=>{if(!E)return;y.setItem($.dial.isOpen(),s?"true":"false").catch(e=>{console.warn("Failed to save dial state:",e)})},[s,E]);const j=Boolean(b?.length&&P);const{isAnyOpen:i,open:X,registerApps:D,openApps:z}=ge();const k=A(i);const{setDialOpen:L,setToolOpen:N}=fe();r(()=>{if(S){return}const e=async()=>{try{const o=await y.getItem(q);if(!o){setTimeout(()=>{F("positioning")},1e3)}}catch(o){}};e()},[S]);r(()=>{const e=he.subscribe(()=>{B(o=>o+1)});return e},[]);r(()=>{L(s)},[s,L]);r(()=>{N(i)},[i,N]);const Z=M(()=>Boolean(s||i),[s,i]);const v=M(()=>Boolean(h??R),[h,R]);const{settings:p}=me();r(()=>{if(D){D(t)}},[t,D]);const T=M(()=>{return{...a??{},closeMenu:()=>d(false),hideFloatingRow:()=>O(true),showFloatingRow:()=>O(false),notifyToggleChange:()=>B(e=>e+1)}},[a]);r(()=>{if(k.current&&!i){O(false);d(false)}k.current=i},[i]);const ee=e=>{if(!p)return false;return p.floatingTools[e]??false};const I=e=>{e?.onPress?.(T);if(e.launchMode!=="toggle-only"){const o=Y(e.icon,{slot:"dial",size:20,color:e.color});X({id:e.id,title:e.name,component:e.component,props:e.props,launchMode:e.launchMode??"self-modal",singleton:e.singleton??true,icon:o,color:e.color,modal:e.modal})}};const W=A({apps:t,openApps:z,handlePress:I});W.current={apps:t,openApps:z,handlePress:I};r(()=>ie(e=>{const{apps:o,openApps:ne,handlePress:te}=W.current;if(ne.some(C=>C.id===e))return false;const _=o.find(C=>C.id===e);if(!_||_.launchMode==="toggle-only")return false;te(_);return true}),[]);const G=()=>{H.current=true;F(null);y.setItem(q,"true").catch(e=>{console.warn("Failed to save onboarding state:",e)})};const V=()=>{if(u){G()}d(true)};const u=Q==="positioning"&&!H.current&&!S;const oe=!u;return x(pe,{children:[u&&!s&&!i&&x(l,{style:g.onboardingContainer,children:[n(l,{style:g.onboardingBackdrop}),n(be,{visible:true,onDismiss:G,title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools."})]}),n(l,{nativeID:"floating-devtools-root",pointerEvents:v||s?"none":"box-none",style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:u?10001:9999,opacity:v?0:1},children:x(re,{enablePositionPersistence:oe,pushToSide:Z,centerOnboarding:u,environment:c,availableEnvironments:b,onEnvironmentSwitch:P,showEnvironmentSelector:j&&p?.floatingTools?.environment,children:[c&&p?.floatingTools?.environment!==false&&!j?n(ce,{environment:c}):null,w?n(le,{userRole:w,onPress:V}):n(K,{accessibilityLabel:"Open Dev Tools Menu",onPress:V,style:g.fab,children:n(l,{style:g.menuButton,children:n(ye,{size:14})})}),t.filter(e=>(e.slot??"both")!=="dial"&&ee(e.id)).map(e=>n(K,{accessibilityLabel:e.name,onPress:()=>I(e),style:g.fab,children:(()=>{if(typeof e.icon==="function"){const o=e.icon;return n(o,{slot:"row",size:16,state:f,actions:T})}return Y(e.icon,{slot:"row",size:16,color:e.color})})()},`row-${e.id}`))]})}),s&&!v&&n(ae,{apps:t,state:f,actions:T,onClose:()=>{d(false)}})]})};const g=se.create({fab:{paddingHorizontal:6,paddingVertical:4,borderRadius:6,marginRight:4,alignItems:"center",justifyContent:"center",minWidth:0,minHeight:0,backgroundColor:"transparent"},menuButton:{paddingHorizontal:4,paddingVertical:2,minWidth:16,alignItems:"center",justifyContent:"center"},menuDots:{color:"#8CA2C8",fontSize:14,fontWeight:"900"},onboardingContainer:{...U,zIndex:1e4},onboardingBackdrop:{...U,backgroundColor:"rgba(0, 0, 0, 0.85)"}});const ye=({size:t=14,color:f=ue.primary})=>{const a=Math.max(2,Math.floor(t/4));const h=Math.max(1,Math.floor(t/16));const c=Array.from({length:9});return n(l,{style:{width:t,height:t,flexDirection:"row",flexWrap:"wrap",alignContent:"center",justifyContent:"center"},children:c.map((w,b)=>n(l,{style:{width:a,height:a,margin:h,borderRadius:2,backgroundColor:f}},b))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import ie,{createContext as J,useCallback as I,useContext as X,useEffect as T,useMemo as G,useRef as R,useState as b}from"react";import{Animated as i,StyleSheet as Q,Text as Y,View as k}from"react-native";import{JsModal as Z,ModalHeader as u,HeaderSearchButton as ee,TickProvider as te,ToolScreenHeaderContext as oe,devToolsStorageKeys as V,buoyColors as B,gameUIColors as g}from"@buoy-gg/shared-ui";import{jsx as t,jsxs as f}from"react/jsx-runtime";const h=()=>{};const re={search:"",isSearchActive:false,clearSearch:h,close:h,minimize:h,showToast:h,setHeaderOverride:h};const D=J(null);export function useToolHost(){return X(D)??re}export function useToolHeader(e,o){const{setHeaderOverride:n}=useToolHost();T(()=>{n(e);return()=>n(null)},o)}const M=2200;const se={success:g.success,error:g.error,info:g.info};function ne({message:e,type:o,nonce:n}){const s=R(new i.Value(0)).current;T(()=>{s.setValue(0);i.sequence([i.timing(s,{toValue:1,duration:150,useNativeDriver:true}),i.delay(M-450),i.timing(s,{toValue:0,duration:300,useNativeDriver:true})]).start()},[n,s]);const a=se[o];return f(i.View,{pointerEvents:"none",style:[v.toast,{opacity:s,borderColor:a+"60"}],children:[t(k,{style:[v.toastDot,{backgroundColor:a}]}),t(Y,{style:v.toastText,numberOfLines:2,children:e})]})}export function ToolModalShell({app:e,config:o,visible:n,zIndex:s,onClose:a,onMinimize:S,initialModalState:P,enableSharedModalDimensions:_,bodyProps:N}){const j=e.component;const[r,w]=b(false);const[x,O]=b("");const[c,p]=b(null);const[m,A]=b(null);const l=R(null);const d=I(()=>{w(false);O("")},[]);const H=I(($,q="info")=>{if(l.current)clearTimeout(l.current);A(F=>({message:$,type:q,nonce:(F?.nonce??0)+1}));l.current=setTimeout(()=>A(null),M)},[]);T(()=>{return()=>{if(l.current)clearTimeout(l.current)}},[]);const z=G(()=>({search:r?x:"",isSearchActive:r,clearSearch:d,close:a,minimize:()=>S(),showToast:H,setHeaderOverride:p,instanceId:e.instanceId}),[x,r,d,a,S,H,e.instanceId]);const K=c?.title??o.title??e.title??e.id;const L=c?.subtitle??o.subtitle;const y=c?.onBack;const E=c?.actions??o.headerActions;const C=c?.searchable??o.searchable;T(()=>{if(!C&&r)d()},[C,r,d]);const W=_?V.modal.root():V.custom(e.id).modal();const U=f(u,{children:[y&&!r&&t(u.Navigation,{onBack:y}),r?t(u.Search,{value:x,onChangeText:O,onCancel:d,placeholder:o.searchPlaceholder,testID:`tool-search-field-${e.id}`}):t(u.Content,{title:K,subtitle:L}),f(u.Actions,{children:[!r&&E,C&&!r&&t(ee,{variant:"chip",testID:`tool-search-${e.id}`,onPress:()=>w(true)})]})]});return t(D.Provider,{value:z,children:t(Z,{visible:n,onClose:a,onBack:y,onMinimize:S,initialModalState:P,zIndex:s,persistenceKey:W,enablePersistence:true,initialMode:o.initialMode??"bottomSheet",header:{customContent:U,showToggleButton:true},disableScrollWrapper:true,styles:{},children:f(k,{style:v.bodyRoot,children:[t(te,{children:t(oe.Provider,{value:p,children:t(j,{...N})})}),m&&t(ne,{message:m.message,type:m.type,nonce:m.nonce})]})})})}const v=Q.create({bodyRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},toast:{position:"absolute",bottom:16,alignSelf:"center",flexDirection:"row",alignItems:"center",gap:8,maxWidth:"86%",backgroundColor:B.card,borderWidth:1,borderRadius:8,paddingHorizontal:12,paddingVertical:8,shadowColor:"#000",shadowOpacity:.4,shadowRadius:8,shadowOffset:{width:0,height:2},elevation:6},toastDot:{width:6,height:6,borderRadius:3},toastText:{flex:1,fontSize:12,color:B.text}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{reportOptionalRequireError as r}from"./optionalRequire.js";export function autoDiscoverPresets(){const u=[];const n=[{name:"@buoy-gg/env",loader:()=>{try{const{envToolPreset:e}=require("@buoy-gg/env");return e}catch(e){r("@buoy-gg/env",e);return null}}},{name:"@buoy-gg/network",loader:()=>{try{const{networkToolPreset:e}=require("@buoy-gg/network");return e}catch(e){r("@buoy-gg/network",e);return null}}},{name:"@buoy-gg/storage",loader:()=>{try{const{storageToolPreset:e}=require("@buoy-gg/storage");return e}catch(e){r("@buoy-gg/storage",e);return null}}},{name:"@buoy-gg/react-query",loader:()=>{try{const{reactQueryToolPreset:e,wifiTogglePreset:o}=require("@buoy-gg/react-query");return[e,o]}catch(e){r("@buoy-gg/react-query",e);return null}}},{name:"@buoy-gg/route-events",loader:()=>{try{const{routeEventsToolPreset:e}=require("@buoy-gg/route-events");return e}catch(e){r("@buoy-gg/route-events",e);return null}}},{name:"@buoy-gg/debug-borders",loader:()=>{try{const{debugBordersToolPreset:e}=require("@buoy-gg/debug-borders");return e}catch(e){r("@buoy-gg/debug-borders",e);return null}}},{name:"@buoy-gg/highlight-updates",loader:()=>{try{const{highlightUpdatesPreset:e,highlightUpdatesModalPreset:o}=require("@buoy-gg/highlight-updates");return[o,e]}catch(e){r("@buoy-gg/highlight-updates",e);return null}}},{name:"@buoy-gg/console",loader:()=>{try{const{consoleToolPreset:e}=require("@buoy-gg/console");return e}catch(e){r("@buoy-gg/console",e);return null}}},{name:"@buoy-gg/notifications",loader:()=>{try{return require("@buoy-gg/notifications").notificationToolPreset}catch(e){r("@buoy-gg/notifications",e);return null}}},{name:"@buoy-gg/sentry",loader:()=>{try{const{sentryToolPreset:e}=require("@buoy-gg/sentry");return e}catch(e){r("@buoy-gg/sentry",e);return null}}},{name:"@buoy-gg/time-machine",loader:()=>{try{const{timeMachineToolPreset:e}=require("@buoy-gg/time-machine");return e}catch(e){r("@buoy-gg/time-machine",e);return null}}},{name:"@buoy-gg/clock",loader:()=>{try{const{clockToolPreset:e}=require("@buoy-gg/clock");return e}catch(e){r("@buoy-gg/clock",e);return null}}},{name:"@buoy-gg/scenarios",loader:()=>{try{const{scenariosToolPreset:e}=require("@buoy-gg/scenarios");return e}catch(e){r("@buoy-gg/scenarios",e);return null}}},{name:"@buoy-gg/ask-buoy",loader:()=>{try{const{askBuoyToolPreset:e}=require("@buoy-gg/ask-buoy");return e}catch(e){r("@buoy-gg/ask-buoy",e);return null}}},{name:"@buoy-gg/redux",loader:()=>{try{const{reduxToolPreset:e}=require("@buoy-gg/redux");return e}catch(e){r("@buoy-gg/redux",e);return null}}},{name:"@buoy-gg/zustand",loader:()=>{try{const{zustandToolPreset:e}=require("@buoy-gg/zustand");return e}catch(e){r("@buoy-gg/zustand",e);return null}}},{name:"@buoy-gg/events",loader:()=>{try{const{eventsToolPreset:e}=require("@buoy-gg/events");return e}catch(e){r("@buoy-gg/events",e);return null}}},{name:"@buoy-gg/jotai",loader:()=>{try{const{jotaiToolPreset:e}=require("@buoy-gg/jotai");return e}catch(e){r("@buoy-gg/jotai",e);return null}}},{name:"@buoy-gg/image-overlay",loader:()=>{try{const{imageOverlayToolPreset:e}=require("@buoy-gg/image-overlay");return e}catch(e){r("@buoy-gg/image-overlay",e);return null}}},{name:"@buoy-gg/perf-monitor",loader:()=>{try{const{perfMonitorPreset:e,perfMonitorModalPreset:o}=require("@buoy-gg/perf-monitor");return[e,o]}catch(e){r("@buoy-gg/perf-monitor",e);return null}}},{name:"@buoy-gg/js-top",loader:()=>{try{const{jsTopPreset:e,jsTopModalPreset:o}=require("@buoy-gg/js-top");return[o,e]}catch(e){r("@buoy-gg/js-top",e);return null}}},{name:"@buoy-gg/images",loader:()=>{try{const{imagesToolPreset:e}=require("@buoy-gg/images");return e}catch(e){r("@buoy-gg/images",e);return null}}},{name:"@buoy-gg/assets",loader:()=>{try{const{assetsToolPreset:e}=require("@buoy-gg/assets");return e}catch(e){r("@buoy-gg/assets",e);return null}}}];for(const{name:e,loader:o}of n){try{const t=o();if(t){if(Array.isArray(t)){u.push(...t)}else{u.push(t)}}}catch(t){r(e,t)}}return u}export function autoDiscoverPresetsWithCustom(u){const n=autoDiscoverPresets();const e=new Set(u.map(t=>t.id));const o=n.filter(t=>!e.has(t.id));return[...u,...o]}
|
|
1
|
+
"use strict";import{reportOptionalRequireError as r}from"./optionalRequire.js";export function autoDiscoverPresets(){const u=[];const n=[{name:"@buoy-gg/env",loader:()=>{try{const{envToolPreset:e}=require("@buoy-gg/env");return e}catch(e){r("@buoy-gg/env",e);return null}}},{name:"@buoy-gg/network",loader:()=>{try{const{networkToolPreset:e}=require("@buoy-gg/network");return e}catch(e){r("@buoy-gg/network",e);return null}}},{name:"@buoy-gg/storage",loader:()=>{try{const{storageToolPreset:e}=require("@buoy-gg/storage");return e}catch(e){r("@buoy-gg/storage",e);return null}}},{name:"@buoy-gg/react-query",loader:()=>{try{const{reactQueryToolPreset:e,wifiTogglePreset:o}=require("@buoy-gg/react-query");return[e,o]}catch(e){r("@buoy-gg/react-query",e);return null}}},{name:"@buoy-gg/route-events",loader:()=>{try{const{routeEventsToolPreset:e}=require("@buoy-gg/route-events");return e}catch(e){r("@buoy-gg/route-events",e);return null}}},{name:"@buoy-gg/debug-borders",loader:()=>{try{const{debugBordersToolPreset:e}=require("@buoy-gg/debug-borders");return e}catch(e){r("@buoy-gg/debug-borders",e);return null}}},{name:"@buoy-gg/highlight-updates",loader:()=>{try{const{highlightUpdatesPreset:e,highlightUpdatesModalPreset:o}=require("@buoy-gg/highlight-updates");return[o,e]}catch(e){r("@buoy-gg/highlight-updates",e);return null}}},{name:"@buoy-gg/console",loader:()=>{try{const{consoleToolPreset:e}=require("@buoy-gg/console");return e}catch(e){r("@buoy-gg/console",e);return null}}},{name:"@buoy-gg/notifications",loader:()=>{try{return require("@buoy-gg/notifications").notificationToolPreset}catch(e){r("@buoy-gg/notifications",e);return null}}},{name:"@buoy-gg/sentry",loader:()=>{try{const{sentryToolPreset:e}=require("@buoy-gg/sentry");return e}catch(e){r("@buoy-gg/sentry",e);return null}}},{name:"@buoy-gg/time-machine",loader:()=>{try{const{timeMachineToolPreset:e}=require("@buoy-gg/time-machine");return e}catch(e){r("@buoy-gg/time-machine",e);return null}}},{name:"@buoy-gg/clock",loader:()=>{try{const{clockToolPreset:e}=require("@buoy-gg/clock");return e}catch(e){r("@buoy-gg/clock",e);return null}}},{name:"@buoy-gg/lifecycle",loader:()=>{try{const{lifecycleToolPreset:e}=require("@buoy-gg/lifecycle");return e}catch(e){r("@buoy-gg/lifecycle",e);return null}}},{name:"@buoy-gg/location",loader:()=>{try{const{locationToolPreset:e}=require("@buoy-gg/location");return e}catch(e){r("@buoy-gg/location",e);return null}}},{name:"@buoy-gg/permissions",loader:()=>{try{const{permissionsToolPreset:e}=require("@buoy-gg/permissions");return e}catch(e){r("@buoy-gg/permissions",e);return null}}},{name:"@buoy-gg/scenarios",loader:()=>{try{const{scenariosToolPreset:e}=require("@buoy-gg/scenarios");return e}catch(e){r("@buoy-gg/scenarios",e);return null}}},{name:"@buoy-gg/ask-buoy",loader:()=>{try{const{askBuoyToolPreset:e}=require("@buoy-gg/ask-buoy");return e}catch(e){r("@buoy-gg/ask-buoy",e);return null}}},{name:"@buoy-gg/redux",loader:()=>{try{const{reduxToolPreset:e}=require("@buoy-gg/redux");return e}catch(e){r("@buoy-gg/redux",e);return null}}},{name:"@buoy-gg/zustand",loader:()=>{try{const{zustandToolPreset:e}=require("@buoy-gg/zustand");return e}catch(e){r("@buoy-gg/zustand",e);return null}}},{name:"@buoy-gg/events",loader:()=>{try{const{eventsToolPreset:e}=require("@buoy-gg/events");return e}catch(e){r("@buoy-gg/events",e);return null}}},{name:"@buoy-gg/jotai",loader:()=>{try{const{jotaiToolPreset:e}=require("@buoy-gg/jotai");return e}catch(e){r("@buoy-gg/jotai",e);return null}}},{name:"@buoy-gg/image-overlay",loader:()=>{try{const{imageOverlayToolPreset:e}=require("@buoy-gg/image-overlay");return e}catch(e){r("@buoy-gg/image-overlay",e);return null}}},{name:"@buoy-gg/perf-monitor",loader:()=>{try{const{perfMonitorPreset:e,perfMonitorModalPreset:o}=require("@buoy-gg/perf-monitor");return[e,o]}catch(e){r("@buoy-gg/perf-monitor",e);return null}}},{name:"@buoy-gg/js-top",loader:()=>{try{const{jsTopPreset:e,jsTopModalPreset:o}=require("@buoy-gg/js-top");return[o,e]}catch(e){r("@buoy-gg/js-top",e);return null}}},{name:"@buoy-gg/images",loader:()=>{try{const{imagesToolPreset:e}=require("@buoy-gg/images");return e}catch(e){r("@buoy-gg/images",e);return null}}},{name:"@buoy-gg/assets",loader:()=>{try{const{assetsToolPreset:e}=require("@buoy-gg/assets");return e}catch(e){r("@buoy-gg/assets",e);return null}}}];for(const{name:e,loader:o}of n){try{const t=o();if(t){if(Array.isArray(t)){u.push(...t)}else{u.push(t)}}}catch(t){r(e,t)}}return u}export function autoDiscoverPresetsWithCustom(u){const n=autoDiscoverPresets();const e=new Set(u.map(t=>t.id));const o=n.filter(t=>!e.has(t.id));return[...u,...o]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useEffect as
|
|
1
|
+
"use strict";import{useEffect as C,useMemo as O,useRef as Q}from"react";import{Platform as H}from"react-native";import{LicenseManager as J}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{registerToolAdapters as Z}from"@buoy-gg/shared-ui";let i=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 w=null;let I=null;let T=null;let _=null;let B=null;let N=null;let z=null;let a=null;try{i=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{w=require("@buoy-gg/impersonate")}catch(e){r("@buoy-gg/impersonate",e)}try{I=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{B=require("@buoy-gg/assets")}catch(e){r("@buoy-gg/assets",e)}try{N=require("@buoy-gg/tv-remote")}catch(e){r("@buoy-gg/tv-remote",e)}try{z=require("@buoy-gg/focus-inspector")}catch(e){r("@buoy-gg/focus-inspector",e)}try{a=require("expo-constants")}catch(e){r("expo-constants",e)}export function isExternalSyncAvailable(){return!!i?.useExternalSyncSocket}function K(){const e=a?.default??a;return e?.expoConfig?.name??e?.manifest2?.extra?.expoClient?.name??null}function ee(){const e=a?.default??a;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 te(c,e,n)}export function ToolRegistryPublisher({requiredEnvVars:e,customApps:n}){const c=useToolAdapterMap({requiredEnvVars:e,customApps:n});const t=Q(c);t.current=c;C(()=>Z(()=>t.current),[]);return null}export function AutoExternalSync({options:e,requiredEnvVars:n,isPro:c,tier:t,licenseKey:o,customApps:V}){const{useExternalSyncSocket:$,useExternalSync:F}=i;const D=useToolAdapterMap({requiredEnvVars:n,customApps:V});const U=X(e,{appName:K(),hardwareName:ee(),platform:H.OS});const P=U?.deviceId??null;const{socket:u}=$({deviceName:U?.deviceName??"Buoy Device",socketURL:e?.socketURL??i.getDefaultSocketURL?.()??"http://localhost:42831",persistentDeviceId:P,platform:H.OS,enableLogs:e?.enableLogs});const s=Q({isPro:c,tier:t,licenseKey:o});s.current={isPro:c,tier:t,licenseKey:o};C(()=>{if(!u)return;const y=()=>{if(!J.hasAccountAccess()||!u.connected)return;u.emit("device-license",{isPro:s.current.isPro?"1":"0",tier:s.current.tier??(s.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 G=O(()=>Y(D,typeof __DEV__!=="undefined"&&__DEV__,l?l.split(","):void 0),[D,l]);F({tools:G,socket:u,deviceId:P,enableLogs:e?.enableLogs});return null}function te(e,n,c){return O(()=>{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(w?.impersonateSyncAdapter){t.impersonate=w.impersonateSyncAdapter}if(I?.perfMonitorSyncAdapter){t["perf-monitor"]=I.perfMonitorSyncAdapter}if(T?.jsTopSyncAdapter){t["js-top"]=T.jsTopSyncAdapter}if(_?.imagesSyncAdapter){t.images=_.imagesSyncAdapter}if(B?.assetsSyncAdapter){t.assets=B.assetsSyncAdapter}if(N?.tvRemoteSyncAdapter){t["tv-remote"]=N.tvRemoteSyncAdapter}if(z?.focusInspectorSyncAdapter){t["focus-inspector"]=z.focusInspectorSyncAdapter}for(const o of c??[]){if(o?.sync){t[`custom:${o.id}`]=o.sync}}return t},[e,n,c])}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useMemo as
|
|
1
|
+
"use strict";import{useMemo as P,useRef as E}from"react";import{StyleSheet as G,Pressable as N,View as l,Text as V,useWindowDimensions as Y,Animated as n}from"react-native";import{getDialLayout as F,getIconPosition as X,getIconStaggerInputRange as Z,DIAL_START_ANGLE as H,DIAL_ICON_SIZE as J,DIAL_ICON_GLYPH_SIZE as b,dialColors as I,dialStyles as o,dialAnimationConfig as U}from"@buoy-gg/floating-tools-core";import{jsx as i,jsxs as q}from"react/jsx-runtime";const D={network:"Network",images:"Images","image-overlay":"Image Overlay",assets:"Assets",query:"React Query",storage:"Storage",env:"Env",console:"Console",events:"Events",redux:"Redux",zustand:"Zustand",jotai:"Jotai","route-events":"Routes","time-machine":"Time Machine",clock:"Clock",permissions:"Permissions","highlight-updates":"Highlight Updates","debug-borders":"Debug Borders","perf-monitor":"Bench HUD","js-top":"JS Top","js-top-modal":"JS Top",impersonate:"Impersonate","perf-monitor-modal":"Bench"};function Q(s,t){if(s&&D[s])return D[s];return t}const u=J;export const DialIcon=({index:s,icon:t,iconsProgress:R,onPress:M,totalIcons:d,active:v})=>{const g=E(new n.Value(1)).current;const{width:S}=Y();const c=P(()=>F({screenWidth:S}),[S]);const j=U?.icons??{pressIn:{scale:.95,damping:15,stiffness:400},pressOut:{scale:1,damping:15,stiffness:400}};const{pressIn:m,pressOut:h}=j;const A=()=>{n.spring(g,{toValue:m.scale,damping:m.damping,stiffness:m.stiffness,useNativeDriver:true}).start()};const L=()=>{n.spring(g,{toValue:h.scale,damping:h.damping,stiffness:h.stiffness,useNativeDriver:true}).start()};const p=P(()=>{const y=X(s,d,c.iconRadius,H);const{x:k,y:T,angle:a}=y;const f=c.iconRadius;const W=Z(s,d);const r=R.interpolate({inputRange:W,outputRange:[0,0,1,1],extrapolate:"clamp"});const C=r.interpolate({inputRange:[0,1],outputRange:[Math.PI*2,0]});const w=r.interpolate({inputRange:[0,1],outputRange:[0,f]});const x=n.add(n.multiply(w,C.interpolate({inputRange:[0,Math.PI*2],outputRange:[Math.cos(a),Math.cos(a+Math.PI*2)]})),r.interpolate({inputRange:[0,1],outputRange:[0,k-f*Math.cos(a+Math.PI*2)]}));const z=n.add(n.multiply(w,C.interpolate({inputRange:[0,Math.PI*2],outputRange:[Math.sin(a),Math.sin(a+Math.PI*2)]})),r.interpolate({inputRange:[0,1],outputRange:[0,T-f*Math.sin(a+Math.PI*2)]}));const B=r.interpolate({inputRange:[0,.3,1],outputRange:[0,.3,1]});return{translateX:x,translateY:z,itemOpacity:B,progressScale:r}},[s,d,R,c]);const _={position:"absolute",left:c.circleRadius-u/2,top:c.circleRadius-u/2,opacity:p.itemOpacity,transform:[{translateX:p.translateX},{translateY:p.translateY},{scale:n.multiply(g,p.progressScale)}]};const O=t.icon===null&&!t.iconComponent;return i(n.View,{style:[e.view,_,!v&&e.hidden],children:O?i(l,{style:e.emptySpot,children:i(l,{style:e.emptyDot})}):q(N,{onPress:()=>M(t),onPressIn:A,onPressOut:L,style:e.pressable,testID:t.id?`buoy-dial-${t.id}`:void 0,accessibilityLabel:Q(t.id,t.name),accessibilityRole:"button",children:[i(l,{style:[e.iconGradientBg,{backgroundColor:"rgba(0, 0, 0, 0.2)"}]}),i(l,{style:[e.iconInnerGlow,{backgroundColor:"rgba(255, 255, 255, 0.02)"}]}),i(l,{style:e.iconWrapper,children:t.iconComponent?(()=>{const y=t.iconComponent;return i(y,{slot:"dial",size:b})})():i(l,{style:e.iconClamp,children:t.icon})}),i(V,{style:e.label,numberOfLines:1,adjustsFontSizeToFit:true,minimumFontScale:.7,children:t.name.toUpperCase()})]})})};const e=G.create({view:{width:u,height:u,justifyContent:"center",alignItems:"center"},hidden:{display:"none"},pressable:{width:"100%",height:"100%",justifyContent:"center",alignItems:"center",padding:4,backgroundColor:"transparent"},iconGradientBg:{position:"absolute",width:"85%",height:"85%",borderRadius:12,opacity:.3},iconInnerGlow:{position:"absolute",width:"70%",height:"70%",borderRadius:10,opacity:.5},iconWrapper:{marginBottom:4,alignItems:"center",justifyContent:"center"},iconClamp:{width:b,height:b,alignItems:"center",justifyContent:"center",overflow:"hidden"},label:{fontSize:o.icon.label.fontSize,fontWeight:o.icon.label.fontWeight,letterSpacing:o.icon.label.letterSpacing,fontFamily:o.icon.label.fontFamily,marginTop:o.icon.label.marginTop,color:I.iconLabel},emptySpot:{width:"100%",height:"100%",justifyContent:"center",alignItems:"center"},emptyDot:{width:o.emptySlot.dotSize,height:o.emptySlot.dotSize,borderRadius:o.emptySlot.dotSize/2,backgroundColor:I.emptyDotBackground,borderWidth:o.emptySlot.borderWidth,borderColor:I.emptyDotBorder}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export function externalSyncOptions(e){return typeof e==="object"&&e!==null?e:void 0}export function shouldMountExternalSync({isDevelopment:e,isLicensed:
|
|
1
|
+
"use strict";export function externalSyncOptions(e){return typeof e==="object"&&e!==null?e:void 0}export function shouldMountExternalSync({isDevelopment:e,isLicensed:o,externalSync:r,isAvailable:t}){if(r===false)return false;if(!t)return false;if(e)return true;const n=externalSyncOptions(r);return o&&n?.enableInRelease===true&&releaseTransportProblem(n.socketURL,n)===null}export const RELEASE_DEFAULT_SOCKET_URL="http://localhost:42831";function i(e){return e==="localhost"||e.endsWith(".localhost")||/^127\.\d+\.\d+\.\d+$/.test(e)||e==="[::1]"||e==="::1"||e==="10.0.2.2"}export function releaseTransportProblem(e,o){const r=e??RELEASE_DEFAULT_SOCKET_URL;if(o?.allowInsecureNetwork===true)return null;let t;try{t=new URL(r)}catch{return`[Buoy] externalSync.socketURL "${r}" isn't a valid URL, so this release build won't connect to Buoy Desktop.`}if(t.protocol==="https:"||t.protocol==="wss:")return null;if(i(t.hostname))return null;return`[Buoy] This release build won't connect to ${r}: release sync carries real user data, and plain http to another machine is readable by anyone on the same network. Use a simulator, an emulator or adb reverse (localhost), an https:// broker, or set externalSync.allowInsecureNetwork: true for a network you trust.`}export const RELEASE_GATED_ACTIONS={impersonate:["searchUsers","startImpersonation","resumeImpersonation","updateSettings","removeFromHistory","clearHistory"]};export function applyReleaseActionPolicy(e,o,r){if(o)return e;let t=null;for(const[n,u]of Object.entries(RELEASE_GATED_ACTIONS)){if(r?.includes(n))continue;const s=e[n];if(!s?.actions)continue;const a={...s.actions};for(const l of u){if(!(l in a))continue;a[l]=()=>{throw new Error(`${n}.${l} is off in release builds. To allow it from Buoy Desktop and the MCP, pass externalSync={{ enableInRelease: true, releaseActions: ["${n}"] }}.`)}}t??={...e};t[n]={...s,actions:a}}return t??e}
|
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.45";
|
|
@@ -85,11 +85,11 @@ export declare const Buoy: {
|
|
|
85
85
|
*/
|
|
86
86
|
getState(): {
|
|
87
87
|
tier: import("@buoy-gg/license").BuoyTier;
|
|
88
|
+
tierSource: import("@buoy-gg/license").TierSource;
|
|
88
89
|
isPro: boolean;
|
|
89
90
|
access: import("@buoy-gg/license").AccountAccess;
|
|
90
91
|
isInitialized: boolean;
|
|
91
92
|
isValidating: boolean;
|
|
92
|
-
tierSource: import("@buoy-gg/license").TierSource;
|
|
93
93
|
licenseKey: string | null;
|
|
94
94
|
error: string | null;
|
|
95
95
|
errorKind: "transport" | "verdict" | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Sign in to Buoy" for a live site (BUOY_SIGN_IN_PLAN.md, step 1.5).
|
|
3
|
+
*
|
|
4
|
+
* Shown by FloatingDevTools in a production build when the site passes
|
|
5
|
+
* `signIn` and nobody with a paid plan is signed in. The site decides who sees
|
|
6
|
+
* it (its own admins), the same way it decides who sees Buoy at all.
|
|
7
|
+
*
|
|
8
|
+
* The click handler calls signIn() directly: the popup has to open before
|
|
9
|
+
* anything awaits, or the browser blocks it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function BuoySignIn(): import("react").ReactPortal | null;
|
|
12
|
+
//# sourceMappingURL=BuoySignIn.web.d.ts.map
|
|
@@ -24,6 +24,13 @@ export interface FloatingDevToolsProps {
|
|
|
24
24
|
/** Keep capture and desktop sync running without the floating menu. */
|
|
25
25
|
headless?: boolean;
|
|
26
26
|
licenseKey?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Live sites: show a "Sign in to Buoy" button when nobody with a paid plan
|
|
29
|
+
* is signed in. Buoy then opens for that person, with no key in the build.
|
|
30
|
+
* Only render FloatingDevTools with this for your own admins and testers.
|
|
31
|
+
* The site must be on your list at buoy.gg/dashboard/sites.
|
|
32
|
+
*/
|
|
33
|
+
signIn?: boolean;
|
|
27
34
|
/** @deprecated Accounts are required for all dev tools. */
|
|
28
35
|
requireLicense?: boolean;
|
|
29
36
|
}
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* Scenarios so the tester can drive the app, then needs it back). It
|
|
13
13
|
* deliberately does not construct and open a tool from scratch: an opener that
|
|
14
14
|
* guesses at an instance is a worse failure than reporting that it couldn't,
|
|
15
|
-
* and every caller already has to handle `false`.
|
|
15
|
+
* and every caller already has to handle `false`. Opening a tool that isn't
|
|
16
|
+
* open yet is FloatingMenu's opener, which launches it the way a dial tap does.
|
|
16
17
|
*/
|
|
17
18
|
export declare function ToolOpenerBridge(): null;
|
|
18
19
|
//# sourceMappingURL=ToolOpenerBridge.d.ts.map
|
|
@@ -45,6 +45,22 @@ export interface ExternalSyncOptions {
|
|
|
45
45
|
* @default false
|
|
46
46
|
*/
|
|
47
47
|
enableInRelease?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Let a release build connect over plain `http://` to another machine.
|
|
50
|
+
* Off by default: release sync carries real user data, and anyone on the
|
|
51
|
+
* same network can read unencrypted traffic. Release builds otherwise only
|
|
52
|
+
* connect to localhost (simulator, emulator, `adb reverse`) or over
|
|
53
|
+
* `https://`.
|
|
54
|
+
*
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
allowInsecureNetwork?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Tools whose sensitive remote actions stay available in a release build.
|
|
60
|
+
* Today that's `"impersonate"`: its user search and start-impersonation
|
|
61
|
+
* actions are refused in release builds unless it's listed here.
|
|
62
|
+
*/
|
|
63
|
+
releaseActions?: string[];
|
|
48
64
|
/** @default false */
|
|
49
65
|
enableLogs?: boolean;
|
|
50
66
|
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* All known tool IDs that can appear in the floating menu or dial menu.
|
|
20
20
|
* This is a union type of all auto-discovered tool IDs.
|
|
21
21
|
*/
|
|
22
|
-
export type BuiltInToolId = 'env' | 'network' | 'push-notifications' | 'storage' | 'query' | 'query-wifi-toggle' | 'route-events' | 'debug-borders' | 'highlight-updates' | 'highlight-updates-modal' | 'redux' | 'zustand' | 'jotai' | 'events' | 'time-machine' | 'clock' | 'scenarios' | 'ask-buoy' | 'image-overlay' | 'perf-monitor' | 'perf-monitor-modal';
|
|
22
|
+
export type BuiltInToolId = 'env' | 'network' | 'push-notifications' | 'storage' | 'query' | 'query-wifi-toggle' | 'route-events' | 'debug-borders' | 'highlight-updates' | 'highlight-updates-modal' | 'redux' | 'zustand' | 'jotai' | 'events' | 'time-machine' | 'clock' | 'permissions' | 'lifecycle' | 'location' | 'scenarios' | 'ask-buoy' | 'image-overlay' | 'perf-monitor' | 'perf-monitor-modal';
|
|
23
23
|
/**
|
|
24
24
|
* Special floating-only tool IDs that only appear in the floating bubble row.
|
|
25
25
|
*/
|
|
@@ -27,4 +27,31 @@ export interface ExternalSyncGateInput {
|
|
|
27
27
|
/** The options object from the prop, or undefined when it's a boolean. */
|
|
28
28
|
export declare function externalSyncOptions(externalSync: boolean | ExternalSyncOptions | undefined): ExternalSyncOptions | undefined;
|
|
29
29
|
export declare function shouldMountExternalSync({ isDevelopment, isLicensed, externalSync, isAvailable, }: ExternalSyncGateInput): boolean;
|
|
30
|
+
/** Where a release build connects when the app doesn't pass `socketURL`. */
|
|
31
|
+
export declare const RELEASE_DEFAULT_SOCKET_URL = "http://localhost:42831";
|
|
32
|
+
/**
|
|
33
|
+
* Why a release build must not use this broker URL, or null if it may.
|
|
34
|
+
*
|
|
35
|
+
* Release sync carries real user data (session tokens in network captures,
|
|
36
|
+
* real accounts in storage). Over plain `http://` to another machine, anyone
|
|
37
|
+
* on the same Wi-Fi can read it, so a release build only connects to this
|
|
38
|
+
* machine (simulator, emulator, `adb reverse`) or over `https://`/`wss://`,
|
|
39
|
+
* unless the app sets `allowInsecureNetwork`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function releaseTransportProblem(socketURL: string | undefined, options: ExternalSyncOptions | undefined): string | null;
|
|
42
|
+
/**
|
|
43
|
+
* Remote actions a release build refuses unless the app lists the tool in
|
|
44
|
+
* `externalSync.releaseActions`. Impersonate's search runs the app's own user
|
|
45
|
+
* lookup with the signed-in admin's credentials, and starting impersonation
|
|
46
|
+
* switches who the admin's session acts as, so neither should be reachable
|
|
47
|
+
* from a dashboard in production by default. Stopping and pausing stay open:
|
|
48
|
+
* they only ever end an impersonation.
|
|
49
|
+
*/
|
|
50
|
+
export declare const RELEASE_GATED_ACTIONS: Readonly<Record<string, readonly string[]>>;
|
|
51
|
+
/**
|
|
52
|
+
* The tool map a release build exposes over the broker: gated actions are
|
|
53
|
+
* replaced with ones that fail and say how to allow them. Dev builds, and
|
|
54
|
+
* tools the app lists in `releaseActions`, are returned unchanged.
|
|
55
|
+
*/
|
|
56
|
+
export declare function applyReleaseActionPolicy<T extends Record<string, unknown>>(tools: T, isDevelopment: boolean, releaseActions: readonly string[] | undefined): T;
|
|
30
57
|
//# sourceMappingURL=externalSyncGate.d.ts.map
|
|
@@ -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.45";
|
|
13
13
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -85,11 +85,11 @@ export declare const Buoy: {
|
|
|
85
85
|
*/
|
|
86
86
|
getState(): {
|
|
87
87
|
tier: import("@buoy-gg/license").BuoyTier;
|
|
88
|
+
tierSource: import("@buoy-gg/license").TierSource;
|
|
88
89
|
isPro: boolean;
|
|
89
90
|
access: import("@buoy-gg/license").AccountAccess;
|
|
90
91
|
isInitialized: boolean;
|
|
91
92
|
isValidating: boolean;
|
|
92
|
-
tierSource: import("@buoy-gg/license").TierSource;
|
|
93
93
|
licenseKey: string | null;
|
|
94
94
|
error: string | null;
|
|
95
95
|
errorKind: "transport" | "verdict" | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Sign in to Buoy" for a live site (BUOY_SIGN_IN_PLAN.md, step 1.5).
|
|
3
|
+
*
|
|
4
|
+
* Shown by FloatingDevTools in a production build when the site passes
|
|
5
|
+
* `signIn` and nobody with a paid plan is signed in. The site decides who sees
|
|
6
|
+
* it (its own admins), the same way it decides who sees Buoy at all.
|
|
7
|
+
*
|
|
8
|
+
* The click handler calls signIn() directly: the popup has to open before
|
|
9
|
+
* anything awaits, or the browser blocks it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function BuoySignIn(): import("react").ReactPortal | null;
|
|
12
|
+
//# sourceMappingURL=BuoySignIn.web.d.ts.map
|
|
@@ -24,6 +24,13 @@ export interface FloatingDevToolsProps {
|
|
|
24
24
|
/** Keep capture and desktop sync running without the floating menu. */
|
|
25
25
|
headless?: boolean;
|
|
26
26
|
licenseKey?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Live sites: show a "Sign in to Buoy" button when nobody with a paid plan
|
|
29
|
+
* is signed in. Buoy then opens for that person, with no key in the build.
|
|
30
|
+
* Only render FloatingDevTools with this for your own admins and testers.
|
|
31
|
+
* The site must be on your list at buoy.gg/dashboard/sites.
|
|
32
|
+
*/
|
|
33
|
+
signIn?: boolean;
|
|
27
34
|
/** @deprecated Accounts are required for all dev tools. */
|
|
28
35
|
requireLicense?: boolean;
|
|
29
36
|
}
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* Scenarios so the tester can drive the app, then needs it back). It
|
|
13
13
|
* deliberately does not construct and open a tool from scratch: an opener that
|
|
14
14
|
* guesses at an instance is a worse failure than reporting that it couldn't,
|
|
15
|
-
* and every caller already has to handle `false`.
|
|
15
|
+
* and every caller already has to handle `false`. Opening a tool that isn't
|
|
16
|
+
* open yet is FloatingMenu's opener, which launches it the way a dial tap does.
|
|
16
17
|
*/
|
|
17
18
|
export declare function ToolOpenerBridge(): null;
|
|
18
19
|
//# sourceMappingURL=ToolOpenerBridge.d.ts.map
|