@buoy-gg/core 7.0.63 → 7.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/bin/buoy.js +11 -8
- package/lib/commonjs/browserRegister.js +1 -1
- package/lib/commonjs/browserRegister.server.js +1 -1
- package/lib/commonjs/browserRegisterNetwork.js +1 -0
- package/lib/commonjs/browserRegisterNetwork.server.js +1 -0
- package/lib/commonjs/browserRegisterNetwork.test.js +1 -0
- package/lib/commonjs/earlyNetwork.js +1 -1
- package/lib/commonjs/floatingMenu/AppHost.web.js +1 -1
- package/lib/commonjs/floatingMenu/BrowserToolRuntime.js +1 -1
- package/lib/commonjs/floatingMenu/BuoySignIn.web.js +1 -1
- package/lib/commonjs/floatingMenu/DevToolsSettingsModal.shared.js +1 -1
- package/lib/commonjs/floatingMenu/FloatingDevTools.js +1 -1
- package/lib/commonjs/floatingMenu/FloatingDevTools.web.js +1 -1
- package/lib/commonjs/floatingMenu/FloatingMenu.js +1 -1
- package/lib/commonjs/floatingMenu/dial/DialDevTools.js +1 -1
- package/lib/commonjs/index.web.js +1 -1
- package/lib/commonjs/mountBuoy.js +1 -0
- package/lib/commonjs/mountBuoy.test.js +1 -0
- package/lib/commonjs/threeBootHook.js +1 -0
- package/lib/commonjs/threeBootHook.test.js +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/module/browserRegister.js +1 -1
- package/lib/module/browserRegister.server.js +1 -1
- package/lib/module/browserRegisterNetwork.js +1 -0
- package/lib/module/browserRegisterNetwork.server.js +1 -0
- package/lib/module/browserRegisterNetwork.test.js +1 -0
- package/lib/module/earlyNetwork.js +1 -1
- package/lib/module/floatingMenu/AppHost.web.js +1 -1
- package/lib/module/floatingMenu/BrowserToolRuntime.js +1 -1
- package/lib/module/floatingMenu/BuoySignIn.web.js +1 -1
- package/lib/module/floatingMenu/DevToolsSettingsModal.shared.js +1 -1
- package/lib/module/floatingMenu/FloatingDevTools.js +1 -1
- package/lib/module/floatingMenu/FloatingDevTools.web.js +1 -1
- package/lib/module/floatingMenu/FloatingMenu.js +1 -1
- package/lib/module/floatingMenu/dial/DialDevTools.js +1 -1
- package/lib/module/index.web.js +1 -1
- package/lib/module/mountBuoy.js +1 -0
- package/lib/module/mountBuoy.test.js +1 -0
- package/lib/module/threeBootHook.js +1 -0
- package/lib/module/threeBootHook.test.js +1 -0
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/browserRegister.d.ts +1 -0
- package/lib/typescript/commonjs/browserRegister.server.d.ts +2 -0
- package/lib/typescript/commonjs/browserRegisterNetwork.d.ts +5 -0
- package/lib/typescript/commonjs/browserRegisterNetwork.server.d.ts +5 -0
- package/lib/typescript/commonjs/floatingMenu/BuoySignIn.web.d.ts +1 -1
- package/lib/typescript/commonjs/floatingMenu/FloatingDevTools.web.d.ts +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +1 -0
- package/lib/typescript/commonjs/mountBuoy.d.ts +16 -0
- package/lib/typescript/commonjs/threeBootHook.d.ts +9 -0
- package/lib/typescript/commonjs/version.d.ts +1 -1
- package/lib/typescript/module/browserRegister.d.ts +1 -0
- package/lib/typescript/module/browserRegister.server.d.ts +2 -0
- package/lib/typescript/module/browserRegisterNetwork.d.ts +5 -0
- package/lib/typescript/module/browserRegisterNetwork.server.d.ts +5 -0
- package/lib/typescript/module/floatingMenu/BuoySignIn.web.d.ts +1 -1
- package/lib/typescript/module/floatingMenu/FloatingDevTools.web.d.ts +1 -1
- package/lib/typescript/module/index.web.d.ts +1 -0
- package/lib/typescript/module/mountBuoy.d.ts +16 -0
- package/lib/typescript/module/threeBootHook.d.ts +9 -0
- package/lib/typescript/module/version.d.ts +1 -1
- package/lib/web/auto.mjs +1 -1
- package/lib/web/chunks/FloatingDevTools.web-P3PAM3FD.mjs +1 -0
- package/lib/web/chunks/chunk-5EUMNDI5.mjs +1 -0
- package/lib/web/chunks/chunk-D2FYORGY.mjs +1 -0
- package/lib/web/chunks/chunk-LOPXJLVB.mjs +1 -0
- package/lib/web/chunks/chunk-NEDMFPZ4.mjs +1 -0
- package/lib/web/chunks/chunk-NKUQECQ2.mjs +10 -0
- package/lib/web/chunks/chunk-RBPDZUHO.mjs +1 -0
- package/lib/web/chunks/chunk-Z6I7ZD34.mjs +1 -0
- package/lib/web/index.mjs +1 -1
- package/lib/web/installed-tools.mjs +1 -1
- package/lib/web/register-network-server.mjs +1 -0
- package/lib/web/register-network.mjs +1 -0
- package/lib/web/register-server.mjs +1 -1
- package/lib/web/register.mjs +1 -1
- package/lib/web/three.mjs +1 -0
- package/lib/web/toolkit.mjs +1 -1
- package/package.json +21 -6
- package/lib/web/chunks/FloatingDevTools.web-M3ASH5EV.mjs +0 -1
- package/lib/web/chunks/chunk-3YORPV22.mjs +0 -10
- package/lib/web/chunks/chunk-5SGL6QL4.mjs +0 -1
- package/lib/web/chunks/chunk-7G3P7Z7K.mjs +0 -1
- package/lib/web/chunks/chunk-CLXYMJTS.mjs +0 -1
- package/lib/web/chunks/chunk-ZD6O2YPD.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DialDevTools=void 0;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _DialIcon=require("./DialIcon.js");var _DialHyperspace=require("./DialHyperspace.js");var _DialPagination=require("./DialPagination.js");var _dialUsageStore=require("./dialUsageStore.js");var _DevToolsSettingsModal=require("../DevToolsSettingsModal");var _license=require("@buoy-gg/license");var _AppIcon=require("../AppIcon");var _AppHost=require("../AppHost");var _OnboardingTooltip=require("./OnboardingTooltip");var _floatingToolsCore=require("@buoy-gg/floating-tools-core");var _jsxRuntime=require("react/jsx-runtime");const BUTTON_SIZE=_floatingToolsCore.DIAL_BUTTON_SIZE;const DIAL_BACKGROUND_FOCUS={x:.5,y:.5};const HUB_CLEARANCE=BUTTON_SIZE*.75+6;const DIAL_IDLE_PULSE=false;const ONBOARDING_STORAGE_KEY="@react_buoy_settings_tooltip_shown";const createEmptySlot=r=>({id:`empty-${r}`,name:`empty-${r}`,icon:null,color:"transparent",onPress:()=>{}});const DialDevTools=({onClose:r,onSettingsPress:B,autoOpenSettings:T=false,apps:m,state:ie,actions:D})=>{const[N,F]=(0,_react.useState)(-1);const[n,l]=(0,_react.useState)(false);const[C,G]=(0,_react.useState)(false);const[I,j]=(0,_react.useState)(false);const y=(0,_react.useRef)(false);const k=(0,_sharedUi.useHintsDisabled)();const{refreshSettings:q}=(0,_DevToolsSettingsModal.useDevToolsSettings)();const{open:L}=(0,_AppHost.useAppHost)();const{isPro:U,isWeekendFree:_}=(0,_license.useProAccess)();const{width:b,height:z}=(0,_reactNative.useWindowDimensions)();const o=(0,_floatingToolsCore.getDialLayout)({screenWidth:b}).circleSize;const{id:H}=(0,_sharedUi.useToolBackground)();const a=(0,_react.useMemo)(()=>({parent:{width:o,height:o},circle:{width:o,height:o,borderRadius:o/2},rounded:{borderRadius:o/2},gridLine:{width:o},spoke:{width:o/2-HUB_CLEARANCE}}),[o]);(0,_react.useEffect)(()=>{const t=async()=>{try{const e=await _sharedUi.persistentStorage.getItem(_sharedUi.devToolsStorageKeys.settings.modalOpen());if(e==="true"){l(true)}}catch(e){}finally{G(true)}};t()},[]);(0,_react.useEffect)(()=>{if(!C)return;_sharedUi.persistentStorage.setItem(_sharedUi.devToolsStorageKeys.settings.modalOpen(),n?"true":"false").catch(t=>{console.warn("Failed to save settings modal state:",t)})},[n,C]);(0,_react.useEffect)(()=>{if(T&&!n){l(true)}},[T,n]);(0,_react.useEffect)(()=>{if(k){return}const t=async()=>{try{const e=await _sharedUi.persistentStorage.getItem(ONBOARDING_STORAGE_KEY);if(!e){setTimeout(()=>{j(true)},1200)}}catch(e){}};t()},[k]);const S=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const d=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const x=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const c=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const f=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const v=(0,_react.useRef)(new _reactNative.Animated.Value(1)).current;const W=(0,_react.useMemo)(()=>m.map(({id:t,name:e,slot:i,description:p,icon:ee,color:te})=>({id:t,name:e,slot:i,description:p,icon:ee,color:te})),[m]);const u=(0,_react.useRef)(null);const X=()=>{if(n){l(false);return}l(true);if(I&&!y.current){E()}B?.()};const g=(0,_react.useMemo)(()=>m.filter(t=>(t.slot??"both")!=="row"),[m]);const O=(0,_react.useMemo)(()=>{const t=new Map;for(const e of g){t.set(e.id,{id:e.id,name:e.name,icon:typeof e.icon==="function"?null:(0,_AppIcon.renderAppIcon)(e.icon,{slot:"dial",size:20,color:e.color}),iconComponent:typeof e.icon==="function"?e.icon:void 0,color:e.color??_sharedUi.buoyColors.primary,onPress:()=>{void(0,_dialUsageStore.recordToolUsage)(e.id);e?.onPress?.(D);if(e.launchMode!=="toggle-only"){const i=(0,_AppIcon.renderAppIcon)(e.icon,{slot:"dial",size:20,color:e.color});L({id:e.id,title:e.name,component:e.component,props:e.props,launchMode:e.launchMode??"self-modal",singleton:e.singleton??true,icon:i,color:e.color,modal:e.modal})}r?.()}})}return t},[g,D,L,r]);const[A,V]=(0,_react.useState)(()=>(0,_dialUsageStore.getRankedToolIds)(g.map(t=>t.id)));(0,_react.useEffect)(()=>{const t=g.map(i=>i.id);if((0,_dialUsageStore.isDialUsageLoaded)()){V((0,_dialUsageStore.getRankedToolIds)(t));return}let e=false;(0,_dialUsageStore.loadDialUsage)().then(()=>{if(!e)V((0,_dialUsageStore.getRankedToolIds)(t))});return()=>{e=true}},[g]);const h=Math.max(1,Math.ceil(A.length/_floatingToolsCore.MAX_DIAL_SLOTS));const[$,K]=(0,_react.useState)(0);const s=Math.min($,h-1);const w=(0,_react.useMemo)(()=>{return A.map(t=>O.get(t)).filter(t=>Boolean(t)).map((t,e)=>({icon:t,page:Math.floor(e/_floatingToolsCore.MAX_DIAL_SLOTS),slot:e%_floatingToolsCore.MAX_DIAL_SLOTS}))},[A,O]);const Y=(0,_react.useMemo)(()=>{const t=w.filter(i=>i.page===s).length;const e=[];for(let i=t;i<_floatingToolsCore.MAX_DIAL_SLOTS;i+=1)e.push(i);return e},[w,s]);const R=t=>{const e=Math.max(0,Math.min(t,h-1));if(e!==s)K(e)};(0,_react.useEffect)(()=>{const t=_floatingToolsCore.dialAnimationConfig??{entrance:{backdrop:{duration:400},dial:{scale:{damping:15,stiffness:150,mass:1},rotation:{duration:800}},centerButton:{delay:150,damping:10,stiffness:200},icons:{delay:200,duration:400},circuitTraces:{delay:600,duration:1e3}},continuous:{glitch:{interval:3e3,offset:2,stepDuration:50},pulse:{maxScale:1.02,minScale:.98,duration:1e3},floating:{maxY:-8,minY:0,duration:3e3},breathing:{maxScale:1.05,minScale:.98,duration:2500}}};const{entrance:e,continuous:i}=t;_reactNative.Animated.timing(S,{toValue:1,duration:e.backdrop.duration,useNativeDriver:true}).start();_reactNative.Animated.spring(d,{toValue:1,damping:e.dial.scale.damping,stiffness:e.dial.scale.stiffness,mass:e.dial.scale.mass,useNativeDriver:true}).start();_reactNative.Animated.sequence([_reactNative.Animated.timing(x,{toValue:1,duration:e.dial.rotation.duration,easing:_reactNative.Easing.out(_reactNative.Easing.cubic),useNativeDriver:true}),_reactNative.Animated.timing(x,{toValue:0,duration:0,useNativeDriver:true})]).start();_reactNative.Animated.sequence([_reactNative.Animated.delay(e.centerButton.delay),_reactNative.Animated.spring(c,{toValue:1,damping:e.centerButton.damping,stiffness:e.centerButton.stiffness,useNativeDriver:true})]).start();_reactNative.Animated.sequence([_reactNative.Animated.delay(e.icons.delay),_reactNative.Animated.timing(f,{toValue:1,duration:e.icons.duration,easing:_reactNative.Easing.out(_reactNative.Easing.cubic),useNativeDriver:true})]).start();if(!DIAL_IDLE_PULSE)return;u.current=_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(v,{toValue:i.pulse.maxScale,duration:i.pulse.duration,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:true}),_reactNative.Animated.timing(v,{toValue:i.pulse.minScale,duration:i.pulse.duration,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:true})]));u.current.start();return()=>{u.current?.stop()}},[]);const E=()=>{y.current=true;j(false);_sharedUi.persistentStorage.setItem(ONBOARDING_STORAGE_KEY,"true").catch(t=>{console.warn("Failed to save dial onboarding state:",t)})};const M=()=>{if(u.current){u.current.stop()}const t=_floatingToolsCore.dialAnimationConfig?.exit??{icons:{duration:300},centerButton:{duration:200},dialScale:{duration:250},backdrop:{duration:200}};_reactNative.Animated.sequence([_reactNative.Animated.timing(f,{toValue:0,duration:t.icons.duration,easing:_reactNative.Easing.in(_reactNative.Easing.cubic),useNativeDriver:true}),_reactNative.Animated.parallel([_reactNative.Animated.timing(c,{toValue:0,duration:t.centerButton.duration,easing:_reactNative.Easing.in(_reactNative.Easing.cubic),useNativeDriver:true}),_reactNative.Animated.timing(d,{toValue:0,duration:t.dialScale.duration,easing:_reactNative.Easing.in(_reactNative.Easing.cubic),useNativeDriver:true})]),_reactNative.Animated.timing(S,{toValue:0,duration:t.backdrop.duration,useNativeDriver:true})]).start(()=>{if(r){setTimeout(()=>{r()},0)}})};const P=t=>{F(1);const e=_floatingToolsCore.dialAnimationConfig?.interaction??{iconSelect:{pulse:[{scale:.9,damping:15,stiffness:500},{scale:1,damping:10,stiffness:200}],actionDelay:50}};const[i,p]=e.iconSelect.pulse;_reactNative.Animated.sequence([_reactNative.Animated.spring(c,{toValue:i.scale,damping:i.damping,stiffness:i.stiffness,useNativeDriver:true}),_reactNative.Animated.spring(c,{toValue:p.scale,damping:p.damping,stiffness:p.stiffness,useNativeDriver:true})]).start();setTimeout(()=>{t.onPress();if(t.id!=="wifi"){M()}},e.iconSelect.actionDelay)};const Z={opacity:S};const J={transform:[{scale:c}]};const Q={transform:[{scale:N>=0?1:v}]};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,nativeID:"dial-devtools-root",children:[(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.backdrop,Z],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{style:_sharedUi.absoluteFill,onPress:M})}),(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[styles.parent,a.parent,{position:"absolute",left:(b-o)/2,bottom:80,transform:[{scale:d},{rotate:x.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]}],children:[(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[styles.circle,a.circle],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.gradientBackground,a.rounded],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.gradientLayer1,a.rounded]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.gradientLayer2,a.rounded]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.gradientLayer3,a.rounded]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.gridPattern,children:Array.from({length:6}).map((t,e)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.gridLine,a.gridLine,{transform:[{rotate:`${e*60}deg`}]}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.spoke,a.spoke,styles.spokeLeft]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.spoke,a.spoke,styles.spokeRight]})]},e))}),H==="hyperspace"?(0,_jsxRuntime.jsx)(_DialHyperspace.DialHyperspace,{size:o}):(0,_jsxRuntime.jsx)(_sharedUi.ToolBackground,{focus:DIAL_BACKGROUND_FOCUS})]}),w.filter(({page:t})=>t===s).map(({icon:t,slot:e})=>(0,_jsxRuntime.jsx)(_DialIcon.DialIcon,{onPress:P,iconsProgress:f,icon:t,index:e,totalIcons:_floatingToolsCore.MAX_DIAL_SLOTS,active:true},t.id??`page${s}-${e}`)),Y.map(t=>(0,_jsxRuntime.jsx)(_DialIcon.DialIcon,{onPress:P,iconsProgress:f,icon:createEmptySlot(t),index:t,totalIcons:_floatingToolsCore.MAX_DIAL_SLOTS,active:true},`empty-${t}`))]}),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.buttonContainer,J],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.buttonGradient,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonGradientLayer1}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonGradientLayer2}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonGradientLayer3}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonBorder,children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.button,Q],children:(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{accessibilityRole:"button",accessibilityLabel:n?"Close Settings":"Open Dev Tools Settings",onPress:X,activeOpacity:.5,style:styles.buttonPressable,children:n?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.centerText,styles.closeTextTop],children:"CLOSE"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.centerText,styles.closeTextBottom],children:"SETTINGS"})]}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.centerText,children:"BUOY"}),U&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.proText,_&&styles.weekendText],children:_?"WEEKEND":"PRO"})]})})})})]})})]}),h>1&&(0,_jsxRuntime.jsx)(_DialPagination.DialPagination,{page:s,pageCount:h,onPrev:()=>R(s-1),onNext:()=>R(s+1),animatedStyle:{position:"absolute",left:(b-o)/2,top:z-80+16,width:o,opacity:d,transform:[{scale:d}]}}),n&&(0,_jsxRuntime.jsx)(_DevToolsSettingsModal.DevToolsSettingsModal,{visible:true,onClose:()=>{l(false);q()},availableApps:W}),I&&!n&&!y.current&&(0,_jsxRuntime.jsx)(_OnboardingTooltip.OnboardingTooltip,{visible:true,onDismiss:E})]})};exports.DialDevTools=DialDevTools;const styles=_reactNative.StyleSheet.create({container:{..._sharedUi.absoluteFill,zIndex:9999},backdrop:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialBackdrop},parent:{alignItems:"center",justifyContent:"center"},circle:{position:"absolute",backgroundColor:"transparent",borderWidth:1,borderColor:_floatingToolsCore.dialColors.dialBorder,shadowColor:_floatingToolsCore.dialColors.dialShadow,shadowOffset:{width:0,height:0},shadowOpacity:.5,shadowRadius:20,elevation:10},gradientBackground:{width:"100%",height:"100%",position:"relative",backgroundColor:_floatingToolsCore.dialColors.dialBackground,overflow:"hidden"},gradientLayer1:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient1,opacity:.6},gradientLayer2:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient2,opacity:.4,top:"30%",left:"30%"},gradientLayer3:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient3,opacity:.3,top:"50%",left:"50%"},gridPattern:{..._sharedUi.absoluteFill,alignItems:"center",justifyContent:"center"},gridLine:{position:"absolute",height:1},spoke:{position:"absolute",top:0,height:1,backgroundColor:_floatingToolsCore.dialColors.dialGridLine},spokeLeft:{left:0},spokeRight:{right:0},buttonContainer:{zIndex:1,backgroundColor:"transparent",alignItems:"center",justifyContent:"center",position:"absolute",width:BUTTON_SIZE*1.5,height:BUTTON_SIZE*1.5,borderRadius:BUTTON_SIZE},buttonGradient:{width:"100%",height:"100%",borderRadius:BUTTON_SIZE,alignItems:"center",justifyContent:"center",padding:4,backgroundColor:_floatingToolsCore.dialColors.hubHalo,position:"relative",overflow:"hidden"},buttonGradientLayer1:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient1,opacity:.5,borderRadius:BUTTON_SIZE},buttonGradientLayer2:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient2,opacity:.3,top:"20%",left:"20%",borderRadius:BUTTON_SIZE},buttonGradientLayer3:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient3,opacity:.2,top:"40%",left:"40%",borderRadius:BUTTON_SIZE},buttonBorder:{backgroundColor:_floatingToolsCore.dialColors.hubFill,alignItems:"center",justifyContent:"center",width:BUTTON_SIZE*1.2,height:BUTTON_SIZE*1.2,borderRadius:BUTTON_SIZE*.6},button:{width:BUTTON_SIZE,height:BUTTON_SIZE,borderRadius:BUTTON_SIZE/2,justifyContent:"center",alignItems:"center",position:"relative",overflow:"hidden"},buttonPressable:{width:"100%",height:"100%",justifyContent:"center",alignItems:"center"},centerText:{color:_floatingToolsCore.dialColors.centerText,fontSize:10,fontWeight:"900",fontFamily:_sharedUi.monoFont,letterSpacing:1,textAlign:"center",textTransform:"uppercase",textShadowColor:_floatingToolsCore.dialColors.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},closeTextTop:{marginBottom:-2},closeTextBottom:{marginTop:-2},proText:{color:_sharedUi.buoyColors.warning,fontSize:8,fontWeight:"900",fontFamily:_sharedUi.monoFont,letterSpacing:2,textAlign:"center",textShadowColor:_floatingToolsCore.dialColors.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},weekendText:{color:"#BF5AF2",letterSpacing:1}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DialDevTools=void 0;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _DialIcon=require("./DialIcon.js");var _DialHyperspace=require("./DialHyperspace.js");var _DialPagination=require("./DialPagination.js");var _dialUsageStore=require("./dialUsageStore.js");var _DevToolsSettingsModal=require("../DevToolsSettingsModal");var _license=require("@buoy-gg/license");var _AppIcon=require("../AppIcon");var _AppHost=require("../AppHost");var _OnboardingTooltip=require("./OnboardingTooltip");var _floatingToolsCore=require("@buoy-gg/floating-tools-core");var _jsxRuntime=require("react/jsx-runtime");const BUTTON_SIZE=_floatingToolsCore.DIAL_BUTTON_SIZE;const DIAL_BACKGROUND_FOCUS={x:.5,y:.5};const HUB_CLEARANCE=BUTTON_SIZE*.75+6;const DIAL_IDLE_PULSE=false;const ONBOARDING_STORAGE_KEY="@react_buoy_settings_tooltip_shown";const createEmptySlot=r=>({id:`empty-${r}`,name:`empty-${r}`,icon:null,color:"transparent",onPress:()=>{}});const DialDevTools=({onClose:r,onSettingsPress:P,autoOpenSettings:T=false,apps:m,state:oe,actions:D})=>{const[N,F]=(0,_react.useState)(-1);const[n,l]=(0,_react.useState)(false);const[C,G]=(0,_react.useState)(false);const[I,j]=(0,_react.useState)(false);const y=(0,_react.useRef)(false);const k=(0,_sharedUi.useHintsDisabled)();const{refreshSettings:q}=(0,_DevToolsSettingsModal.useDevToolsSettings)();const{open:L}=(0,_AppHost.useAppHost)();const{isPro:U,isWeekendFree:_}=(0,_license.useProAccess)();const{width:b,height:z}=(0,_reactNative.useWindowDimensions)();const i=(0,_floatingToolsCore.getDialLayout)({screenWidth:b}).circleSize;const{id:H}=(0,_sharedUi.useToolBackground)();const a=(0,_react.useMemo)(()=>({parent:{width:i,height:i},circle:{width:i,height:i,borderRadius:i/2},rounded:{borderRadius:i/2},gridLine:{width:i},spoke:{width:i/2-HUB_CLEARANCE}}),[i]);(0,_react.useEffect)(()=>{const t=async()=>{try{const e=await _sharedUi.persistentStorage.getItem(_sharedUi.devToolsStorageKeys.settings.modalOpen());if(e==="true"){l(true)}}catch(e){}finally{G(true)}};t()},[]);(0,_react.useEffect)(()=>{if(!C)return;_sharedUi.persistentStorage.setItem(_sharedUi.devToolsStorageKeys.settings.modalOpen(),n?"true":"false").catch(t=>{console.warn("[Buoy]","Failed to save settings modal state:",t)})},[n,C]);(0,_react.useEffect)(()=>{if(T&&!n){l(true)}},[T,n]);(0,_react.useEffect)(()=>{if(k){return}const t=async()=>{try{const e=await _sharedUi.persistentStorage.getItem(ONBOARDING_STORAGE_KEY);if(!e){setTimeout(()=>{j(true)},1200)}}catch(e){}};t()},[k]);const S=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const d=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const x=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const c=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const f=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const v=(0,_react.useRef)(new _reactNative.Animated.Value(1)).current;const W=(0,_react.useMemo)(()=>m.map(({id:t,name:e,slot:o,description:p,icon:ee,color:te})=>({id:t,name:e,slot:o,description:p,icon:ee,color:te})),[m]);const u=(0,_react.useRef)(null);const X=()=>{if(n){l(false);return}l(true);if(I&&!y.current){E()}P?.()};const g=(0,_react.useMemo)(()=>m.filter(t=>(t.slot??"both")!=="row"),[m]);const O=(0,_react.useMemo)(()=>{const t=new Map;for(const e of g){t.set(e.id,{id:e.id,name:e.name,icon:typeof e.icon==="function"?null:(0,_AppIcon.renderAppIcon)(e.icon,{slot:"dial",size:20,color:e.color}),iconComponent:typeof e.icon==="function"?e.icon:void 0,color:e.color??_sharedUi.buoyColors.primary,onPress:()=>{void(0,_dialUsageStore.recordToolUsage)(e.id);e?.onPress?.(D);if(e.launchMode!=="toggle-only"){const o=(0,_AppIcon.renderAppIcon)(e.icon,{slot:"dial",size:20,color:e.color});L({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})}r?.()}})}return t},[g,D,L,r]);const[A,V]=(0,_react.useState)(()=>(0,_dialUsageStore.getRankedToolIds)(g.map(t=>t.id)));(0,_react.useEffect)(()=>{const t=g.map(o=>o.id);if((0,_dialUsageStore.isDialUsageLoaded)()){V((0,_dialUsageStore.getRankedToolIds)(t));return}let e=false;(0,_dialUsageStore.loadDialUsage)().then(()=>{if(!e)V((0,_dialUsageStore.getRankedToolIds)(t))});return()=>{e=true}},[g]);const h=Math.max(1,Math.ceil(A.length/_floatingToolsCore.MAX_DIAL_SLOTS));const[$,K]=(0,_react.useState)(0);const s=Math.min($,h-1);const w=(0,_react.useMemo)(()=>{return A.map(t=>O.get(t)).filter(t=>Boolean(t)).map((t,e)=>({icon:t,page:Math.floor(e/_floatingToolsCore.MAX_DIAL_SLOTS),slot:e%_floatingToolsCore.MAX_DIAL_SLOTS}))},[A,O]);const Y=(0,_react.useMemo)(()=>{const t=w.filter(o=>o.page===s).length;const e=[];for(let o=t;o<_floatingToolsCore.MAX_DIAL_SLOTS;o+=1)e.push(o);return e},[w,s]);const R=t=>{const e=Math.max(0,Math.min(t,h-1));if(e!==s)K(e)};(0,_react.useEffect)(()=>{const t=_floatingToolsCore.dialAnimationConfig??{entrance:{backdrop:{duration:400},dial:{scale:{damping:15,stiffness:150,mass:1},rotation:{duration:800}},centerButton:{delay:150,damping:10,stiffness:200},icons:{delay:200,duration:400},circuitTraces:{delay:600,duration:1e3}},continuous:{glitch:{interval:3e3,offset:2,stepDuration:50},pulse:{maxScale:1.02,minScale:.98,duration:1e3},floating:{maxY:-8,minY:0,duration:3e3},breathing:{maxScale:1.05,minScale:.98,duration:2500}}};const{entrance:e,continuous:o}=t;_reactNative.Animated.timing(S,{toValue:1,duration:e.backdrop.duration,useNativeDriver:true}).start();_reactNative.Animated.spring(d,{toValue:1,damping:e.dial.scale.damping,stiffness:e.dial.scale.stiffness,mass:e.dial.scale.mass,useNativeDriver:true}).start();_reactNative.Animated.sequence([_reactNative.Animated.timing(x,{toValue:1,duration:e.dial.rotation.duration,easing:_reactNative.Easing.out(_reactNative.Easing.cubic),useNativeDriver:true}),_reactNative.Animated.timing(x,{toValue:0,duration:0,useNativeDriver:true})]).start();_reactNative.Animated.sequence([_reactNative.Animated.delay(e.centerButton.delay),_reactNative.Animated.spring(c,{toValue:1,damping:e.centerButton.damping,stiffness:e.centerButton.stiffness,useNativeDriver:true})]).start();_reactNative.Animated.sequence([_reactNative.Animated.delay(e.icons.delay),_reactNative.Animated.timing(f,{toValue:1,duration:e.icons.duration,easing:_reactNative.Easing.out(_reactNative.Easing.cubic),useNativeDriver:true})]).start();if(!DIAL_IDLE_PULSE)return;u.current=_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(v,{toValue:o.pulse.maxScale,duration:o.pulse.duration,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:true}),_reactNative.Animated.timing(v,{toValue:o.pulse.minScale,duration:o.pulse.duration,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:true})]));u.current.start();return()=>{u.current?.stop()}},[]);const E=()=>{y.current=true;j(false);_sharedUi.persistentStorage.setItem(ONBOARDING_STORAGE_KEY,"true").catch(t=>{console.warn("[Buoy]","Failed to save dial onboarding state:",t)})};const M=()=>{if(u.current){u.current.stop()}const t=_floatingToolsCore.dialAnimationConfig?.exit??{icons:{duration:300},centerButton:{duration:200},dialScale:{duration:250},backdrop:{duration:200}};_reactNative.Animated.sequence([_reactNative.Animated.timing(f,{toValue:0,duration:t.icons.duration,easing:_reactNative.Easing.in(_reactNative.Easing.cubic),useNativeDriver:true}),_reactNative.Animated.parallel([_reactNative.Animated.timing(c,{toValue:0,duration:t.centerButton.duration,easing:_reactNative.Easing.in(_reactNative.Easing.cubic),useNativeDriver:true}),_reactNative.Animated.timing(d,{toValue:0,duration:t.dialScale.duration,easing:_reactNative.Easing.in(_reactNative.Easing.cubic),useNativeDriver:true})]),_reactNative.Animated.timing(S,{toValue:0,duration:t.backdrop.duration,useNativeDriver:true})]).start(()=>{if(r){setTimeout(()=>{r()},0)}})};const B=t=>{F(1);const e=_floatingToolsCore.dialAnimationConfig?.interaction??{iconSelect:{pulse:[{scale:.9,damping:15,stiffness:500},{scale:1,damping:10,stiffness:200}],actionDelay:50}};const[o,p]=e.iconSelect.pulse;_reactNative.Animated.sequence([_reactNative.Animated.spring(c,{toValue:o.scale,damping:o.damping,stiffness:o.stiffness,useNativeDriver:true}),_reactNative.Animated.spring(c,{toValue:p.scale,damping:p.damping,stiffness:p.stiffness,useNativeDriver:true})]).start();setTimeout(()=>{t.onPress();if(t.id!=="wifi"){M()}},e.iconSelect.actionDelay)};const Z={opacity:S};const J={transform:[{scale:c}]};const Q={transform:[{scale:N>=0?1:v}]};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,nativeID:"dial-devtools-root",children:[(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.backdrop,Z],children:(0,_jsxRuntime.jsx)(_reactNative.Pressable,{style:_sharedUi.absoluteFill,onPress:M})}),(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[styles.parent,a.parent,{position:"absolute",left:(b-i)/2,bottom:80,transform:[{scale:d},{rotate:x.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]}],children:[(0,_jsxRuntime.jsxs)(_reactNative.Animated.View,{style:[styles.circle,a.circle],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.gradientBackground,a.rounded],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.gradientLayer1,a.rounded]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.gradientLayer2,a.rounded]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.gradientLayer3,a.rounded]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.gridPattern,children:Array.from({length:6}).map((t,e)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.gridLine,a.gridLine,{transform:[{rotate:`${e*60}deg`}]}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.spoke,a.spoke,styles.spokeLeft]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.spoke,a.spoke,styles.spokeRight]})]},e))}),H==="hyperspace"?(0,_jsxRuntime.jsx)(_DialHyperspace.DialHyperspace,{size:i}):(0,_jsxRuntime.jsx)(_sharedUi.ToolBackground,{focus:DIAL_BACKGROUND_FOCUS})]}),w.filter(({page:t})=>t===s).map(({icon:t,slot:e})=>(0,_jsxRuntime.jsx)(_DialIcon.DialIcon,{onPress:B,iconsProgress:f,icon:t,index:e,totalIcons:_floatingToolsCore.MAX_DIAL_SLOTS,active:true},t.id??`page${s}-${e}`)),Y.map(t=>(0,_jsxRuntime.jsx)(_DialIcon.DialIcon,{onPress:B,iconsProgress:f,icon:createEmptySlot(t),index:t,totalIcons:_floatingToolsCore.MAX_DIAL_SLOTS,active:true},`empty-${t}`))]}),(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.buttonContainer,J],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.buttonGradient,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonGradientLayer1}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonGradientLayer2}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonGradientLayer3}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.buttonBorder,children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.button,Q],children:(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{accessibilityRole:"button",accessibilityLabel:n?"Close Settings":"Open Dev Tools Settings",onPress:X,activeOpacity:.5,style:styles.buttonPressable,children:n?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.centerText,styles.closeTextTop],children:"CLOSE"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.centerText,styles.closeTextBottom],children:"SETTINGS"})]}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.centerText,children:"BUOY"}),U&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.proText,_&&styles.weekendText],children:_?"WEEKEND":"PRO"})]})})})})]})})]}),h>1&&(0,_jsxRuntime.jsx)(_DialPagination.DialPagination,{page:s,pageCount:h,onPrev:()=>R(s-1),onNext:()=>R(s+1),animatedStyle:{position:"absolute",left:(b-i)/2,top:z-80+16,width:i,opacity:d,transform:[{scale:d}]}}),n&&(0,_jsxRuntime.jsx)(_DevToolsSettingsModal.DevToolsSettingsModal,{visible:true,onClose:()=>{l(false);q()},availableApps:W}),I&&!n&&!y.current&&(0,_jsxRuntime.jsx)(_OnboardingTooltip.OnboardingTooltip,{visible:true,onDismiss:E})]})};exports.DialDevTools=DialDevTools;const styles=_reactNative.StyleSheet.create({container:{..._sharedUi.absoluteFill,zIndex:9999},backdrop:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialBackdrop},parent:{alignItems:"center",justifyContent:"center"},circle:{position:"absolute",backgroundColor:"transparent",borderWidth:1,borderColor:_floatingToolsCore.dialColors.dialBorder,shadowColor:_floatingToolsCore.dialColors.dialShadow,shadowOffset:{width:0,height:0},shadowOpacity:.5,shadowRadius:20,elevation:10},gradientBackground:{width:"100%",height:"100%",position:"relative",backgroundColor:_floatingToolsCore.dialColors.dialBackground,overflow:"hidden"},gradientLayer1:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient1,opacity:.6},gradientLayer2:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient2,opacity:.4,top:"30%",left:"30%"},gradientLayer3:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient3,opacity:.3,top:"50%",left:"50%"},gridPattern:{..._sharedUi.absoluteFill,alignItems:"center",justifyContent:"center"},gridLine:{position:"absolute",height:1},spoke:{position:"absolute",top:0,height:1,backgroundColor:_floatingToolsCore.dialColors.dialGridLine},spokeLeft:{left:0},spokeRight:{right:0},buttonContainer:{zIndex:1,backgroundColor:"transparent",alignItems:"center",justifyContent:"center",position:"absolute",width:BUTTON_SIZE*1.5,height:BUTTON_SIZE*1.5,borderRadius:BUTTON_SIZE},buttonGradient:{width:"100%",height:"100%",borderRadius:BUTTON_SIZE,alignItems:"center",justifyContent:"center",padding:4,backgroundColor:_floatingToolsCore.dialColors.hubHalo,position:"relative",overflow:"hidden"},buttonGradientLayer1:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient1,opacity:.5,borderRadius:BUTTON_SIZE},buttonGradientLayer2:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient2,opacity:.3,top:"20%",left:"20%",borderRadius:BUTTON_SIZE},buttonGradientLayer3:{..._sharedUi.absoluteFill,backgroundColor:_floatingToolsCore.dialColors.dialGradient3,opacity:.2,top:"40%",left:"40%",borderRadius:BUTTON_SIZE},buttonBorder:{backgroundColor:_floatingToolsCore.dialColors.hubFill,alignItems:"center",justifyContent:"center",width:BUTTON_SIZE*1.2,height:BUTTON_SIZE*1.2,borderRadius:BUTTON_SIZE*.6},button:{width:BUTTON_SIZE,height:BUTTON_SIZE,borderRadius:BUTTON_SIZE/2,justifyContent:"center",alignItems:"center",position:"relative",overflow:"hidden"},buttonPressable:{width:"100%",height:"100%",justifyContent:"center",alignItems:"center"},centerText:{color:_floatingToolsCore.dialColors.centerText,fontSize:10,fontWeight:"900",fontFamily:_sharedUi.monoFont,letterSpacing:1,textAlign:"center",textTransform:"uppercase",textShadowColor:_floatingToolsCore.dialColors.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},closeTextTop:{marginBottom:-2},closeTextBottom:{marginTop:-2},proText:{color:_sharedUi.buoyColors.warning,fontSize:8,fontWeight:"900",fontFamily:_sharedUi.monoFont,letterSpacing:2,textAlign:"center",textShadowColor:_floatingToolsCore.dialColors.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},weekendText:{color:"#BF5AF2",letterSpacing:1}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={FloatingDevTools:true,createWebTool:true,clearReleaseOptIn:true,isBuoyHoldingBackButton:true,FloatingTools:true,UserStatus:true,Divider:true,DialMenu:true,SettingsModal:true,AppHostProvider:true,AppOverlay:true,useAppHost:true,autoDiscoverWebPresets:true,autoDiscoverWithCustom:true,getToolsBySlot:true,getEnabledTools:true,defaultToolPresets:true,useSettings:true,useFloatingTools:true,getToolLabel:true,getToolDescription:true,getToolColor:true,settingsColors:true,settingsStyles:true,dialColors:true,dialStyles:true,createWebTools:true,useToolHost:true,useToolHeader:true,DevToolsVisibilityProvider:true,useDevToolsVisibility:true,appSyncAdapter:true,LicenseManager:true};Object.defineProperty(exports,"AppHostProvider",{enumerable:true,get:function(){return _AppHostWeb.AppHostProvider}});Object.defineProperty(exports,"AppOverlay",{enumerable:true,get:function(){return _AppHostWeb.AppOverlay}});Object.defineProperty(exports,"DevToolsVisibilityProvider",{enumerable:true,get:function(){return _DevToolsVisibilityContext.DevToolsVisibilityProvider}});Object.defineProperty(exports,"DialMenu",{enumerable:true,get:function(){return _DialDevToolsWeb.DialMenu}});Object.defineProperty(exports,"Divider",{enumerable:true,get:function(){return _floatingToolsWeb.Divider}});Object.defineProperty(exports,"FloatingDevTools",{enumerable:true,get:function(){return _FloatingDevToolsWeb.FloatingDevTools}});Object.defineProperty(exports,"FloatingTools",{enumerable:true,get:function(){return _floatingToolsWeb.FloatingTools}});Object.defineProperty(exports,"LicenseManager",{enumerable:true,get:function(){return _license.LicenseManager}});Object.defineProperty(exports,"SettingsModal",{enumerable:true,get:function(){return _DevToolsSettingsModalWeb.SettingsModal}});Object.defineProperty(exports,"UserStatus",{enumerable:true,get:function(){return _floatingToolsWeb.UserStatus}});Object.defineProperty(exports,"appSyncAdapter",{enumerable:true,get:function(){return _appSyncAdapter.appSyncAdapter}});Object.defineProperty(exports,"autoDiscoverWebPresets",{enumerable:true,get:function(){return _autoDiscoverPresetsWeb.autoDiscoverWebPresets}});Object.defineProperty(exports,"autoDiscoverWithCustom",{enumerable:true,get:function(){return _autoDiscoverPresetsWeb.autoDiscoverWithCustom}});Object.defineProperty(exports,"clearReleaseOptIn",{enumerable:true,get:function(){return _releaseOptIn.clearReleaseOptIn}});Object.defineProperty(exports,"createWebTool",{enumerable:true,get:function(){return _createWebTool.createWebTool}});Object.defineProperty(exports,"createWebTools",{enumerable:true,get:function(){return _createWebTools.createWebTools}});Object.defineProperty(exports,"defaultToolPresets",{enumerable:true,get:function(){return _autoDiscoverPresetsWeb.defaultToolPresets}});Object.defineProperty(exports,"dialColors",{enumerable:true,get:function(){return _floatingToolsReact.dialColors}});Object.defineProperty(exports,"dialStyles",{enumerable:true,get:function(){return _floatingToolsReact.dialStyles}});Object.defineProperty(exports,"getEnabledTools",{enumerable:true,get:function(){return _autoDiscoverPresetsWeb.getEnabledTools}});Object.defineProperty(exports,"getToolColor",{enumerable:true,get:function(){return _floatingToolsReact.getToolColor}});Object.defineProperty(exports,"getToolDescription",{enumerable:true,get:function(){return _floatingToolsReact.getToolDescription}});Object.defineProperty(exports,"getToolLabel",{enumerable:true,get:function(){return _floatingToolsReact.getToolLabel}});Object.defineProperty(exports,"getToolsBySlot",{enumerable:true,get:function(){return _autoDiscoverPresetsWeb.getToolsBySlot}});Object.defineProperty(exports,"isBuoyHoldingBackButton",{enumerable:true,get:function(){return _capacitorBackButton.isBuoyHoldingBackButton}});Object.defineProperty(exports,"settingsColors",{enumerable:true,get:function(){return _floatingToolsReact.settingsColors}});Object.defineProperty(exports,"settingsStyles",{enumerable:true,get:function(){return _floatingToolsReact.settingsStyles}});Object.defineProperty(exports,"useAppHost",{enumerable:true,get:function(){return _AppHostWeb.useAppHost}});Object.defineProperty(exports,"useDevToolsVisibility",{enumerable:true,get:function(){return _DevToolsVisibilityContext.useDevToolsVisibility}});Object.defineProperty(exports,"useFloatingTools",{enumerable:true,get:function(){return _floatingToolsReact.useFloatingTools}});Object.defineProperty(exports,"useSettings",{enumerable:true,get:function(){return _floatingToolsReact.useSettings}});Object.defineProperty(exports,"useToolHeader",{enumerable:true,get:function(){return _ToolHost.useToolHeader}});Object.defineProperty(exports,"useToolHost",{enumerable:true,get:function(){return _ToolHost.useToolHost}});var _FloatingDevToolsWeb=require("./floatingMenu/FloatingDevTools.web.js");var _createWebTool=require("./utils/createWebTool.js");var _releaseOptIn=require("./releaseOptIn.js");var _capacitorBackButton=require("./floatingMenu/capacitorBackButton.js");var _floatingToolsWeb=require("./floatingMenu/floatingTools.web.js");var _DialDevToolsWeb=require("./floatingMenu/dial/DialDevTools.web.js");var _DevToolsSettingsModalWeb=require("./floatingMenu/DevToolsSettingsModal.web.js");var _AppHostWeb=require("./floatingMenu/AppHost.web.js");var _autoDiscoverPresetsWeb=require("./utils/autoDiscoverPresets.web.js");var _floatingToolsReact=require("@buoy-gg/floating-tools-react");var _createWebTools=require("./utils/createWebTools.js");var _toolkit=require("./toolkit.js");Object.keys(_toolkit).forEach(function(e){if(e==="default"||e==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,e))return;if(e in exports&&exports[e]===_toolkit[e])return;Object.defineProperty(exports,e,{enumerable:true,get:function(){return _toolkit[e]}})});var _ToolHost=require("./floatingMenu/ToolHost.js");var _DevToolsVisibilityContext=require("./floatingMenu/DevToolsVisibilityContext.js");var _appSyncAdapter=require("./floatingMenu/sync/appSyncAdapter.js");var _license=require("@buoy-gg/license");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={FloatingDevTools:true,createWebTool:true,clearReleaseOptIn:true,isBuoyHoldingBackButton:true,FloatingTools:true,UserStatus:true,Divider:true,DialMenu:true,SettingsModal:true,AppHostProvider:true,AppOverlay:true,useAppHost:true,autoDiscoverWebPresets:true,autoDiscoverWithCustom:true,getToolsBySlot:true,getEnabledTools:true,defaultToolPresets:true,useSettings:true,useFloatingTools:true,getToolLabel:true,getToolDescription:true,getToolColor:true,settingsColors:true,settingsStyles:true,dialColors:true,dialStyles:true,createWebTools:true,useToolHost:true,useToolHeader:true,DevToolsVisibilityProvider:true,useDevToolsVisibility:true,appSyncAdapter:true,LicenseManager:true,mountBuoy:true};Object.defineProperty(exports,"AppHostProvider",{enumerable:true,get:function(){return _AppHostWeb.AppHostProvider}});Object.defineProperty(exports,"AppOverlay",{enumerable:true,get:function(){return _AppHostWeb.AppOverlay}});Object.defineProperty(exports,"DevToolsVisibilityProvider",{enumerable:true,get:function(){return _DevToolsVisibilityContext.DevToolsVisibilityProvider}});Object.defineProperty(exports,"DialMenu",{enumerable:true,get:function(){return _DialDevToolsWeb.DialMenu}});Object.defineProperty(exports,"Divider",{enumerable:true,get:function(){return _floatingToolsWeb.Divider}});Object.defineProperty(exports,"FloatingDevTools",{enumerable:true,get:function(){return _FloatingDevToolsWeb.FloatingDevTools}});Object.defineProperty(exports,"FloatingTools",{enumerable:true,get:function(){return _floatingToolsWeb.FloatingTools}});Object.defineProperty(exports,"LicenseManager",{enumerable:true,get:function(){return _license.LicenseManager}});Object.defineProperty(exports,"SettingsModal",{enumerable:true,get:function(){return _DevToolsSettingsModalWeb.SettingsModal}});Object.defineProperty(exports,"UserStatus",{enumerable:true,get:function(){return _floatingToolsWeb.UserStatus}});Object.defineProperty(exports,"appSyncAdapter",{enumerable:true,get:function(){return _appSyncAdapter.appSyncAdapter}});Object.defineProperty(exports,"autoDiscoverWebPresets",{enumerable:true,get:function(){return _autoDiscoverPresetsWeb.autoDiscoverWebPresets}});Object.defineProperty(exports,"autoDiscoverWithCustom",{enumerable:true,get:function(){return _autoDiscoverPresetsWeb.autoDiscoverWithCustom}});Object.defineProperty(exports,"clearReleaseOptIn",{enumerable:true,get:function(){return _releaseOptIn.clearReleaseOptIn}});Object.defineProperty(exports,"createWebTool",{enumerable:true,get:function(){return _createWebTool.createWebTool}});Object.defineProperty(exports,"createWebTools",{enumerable:true,get:function(){return _createWebTools.createWebTools}});Object.defineProperty(exports,"defaultToolPresets",{enumerable:true,get:function(){return _autoDiscoverPresetsWeb.defaultToolPresets}});Object.defineProperty(exports,"dialColors",{enumerable:true,get:function(){return _floatingToolsReact.dialColors}});Object.defineProperty(exports,"dialStyles",{enumerable:true,get:function(){return _floatingToolsReact.dialStyles}});Object.defineProperty(exports,"getEnabledTools",{enumerable:true,get:function(){return _autoDiscoverPresetsWeb.getEnabledTools}});Object.defineProperty(exports,"getToolColor",{enumerable:true,get:function(){return _floatingToolsReact.getToolColor}});Object.defineProperty(exports,"getToolDescription",{enumerable:true,get:function(){return _floatingToolsReact.getToolDescription}});Object.defineProperty(exports,"getToolLabel",{enumerable:true,get:function(){return _floatingToolsReact.getToolLabel}});Object.defineProperty(exports,"getToolsBySlot",{enumerable:true,get:function(){return _autoDiscoverPresetsWeb.getToolsBySlot}});Object.defineProperty(exports,"isBuoyHoldingBackButton",{enumerable:true,get:function(){return _capacitorBackButton.isBuoyHoldingBackButton}});Object.defineProperty(exports,"mountBuoy",{enumerable:true,get:function(){return _mountBuoy.mountBuoy}});Object.defineProperty(exports,"settingsColors",{enumerable:true,get:function(){return _floatingToolsReact.settingsColors}});Object.defineProperty(exports,"settingsStyles",{enumerable:true,get:function(){return _floatingToolsReact.settingsStyles}});Object.defineProperty(exports,"useAppHost",{enumerable:true,get:function(){return _AppHostWeb.useAppHost}});Object.defineProperty(exports,"useDevToolsVisibility",{enumerable:true,get:function(){return _DevToolsVisibilityContext.useDevToolsVisibility}});Object.defineProperty(exports,"useFloatingTools",{enumerable:true,get:function(){return _floatingToolsReact.useFloatingTools}});Object.defineProperty(exports,"useSettings",{enumerable:true,get:function(){return _floatingToolsReact.useSettings}});Object.defineProperty(exports,"useToolHeader",{enumerable:true,get:function(){return _ToolHost.useToolHeader}});Object.defineProperty(exports,"useToolHost",{enumerable:true,get:function(){return _ToolHost.useToolHost}});var _FloatingDevToolsWeb=require("./floatingMenu/FloatingDevTools.web.js");var _createWebTool=require("./utils/createWebTool.js");var _releaseOptIn=require("./releaseOptIn.js");var _capacitorBackButton=require("./floatingMenu/capacitorBackButton.js");var _floatingToolsWeb=require("./floatingMenu/floatingTools.web.js");var _DialDevToolsWeb=require("./floatingMenu/dial/DialDevTools.web.js");var _DevToolsSettingsModalWeb=require("./floatingMenu/DevToolsSettingsModal.web.js");var _AppHostWeb=require("./floatingMenu/AppHost.web.js");var _autoDiscoverPresetsWeb=require("./utils/autoDiscoverPresets.web.js");var _floatingToolsReact=require("@buoy-gg/floating-tools-react");var _createWebTools=require("./utils/createWebTools.js");var _toolkit=require("./toolkit.js");Object.keys(_toolkit).forEach(function(e){if(e==="default"||e==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,e))return;if(e in exports&&exports[e]===_toolkit[e])return;Object.defineProperty(exports,e,{enumerable:true,get:function(){return _toolkit[e]}})});var _ToolHost=require("./floatingMenu/ToolHost.js");var _DevToolsVisibilityContext=require("./floatingMenu/DevToolsVisibilityContext.js");var _appSyncAdapter=require("./floatingMenu/sync/appSyncAdapter.js");var _license=require("@buoy-gg/license");var _mountBuoy=require("./mountBuoy.js");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.mountBuoy=mountBuoy;var _client=require("react-dom/client");var _react=require("react");var _FloatingDevToolsWeb=require("./floatingMenu/FloatingDevTools.web.js");var _jsxRuntime=require("react/jsx-runtime");function mountBuoy({queryClient:t,...r}={}){const o=Object.values(r.modules??{}).find(a=>a.QueryClientProvider)?.QueryClientProvider;if(t&&!o)throw new Error("Add the react-query tool to modules to use queryClient.");const e=document.createElement("div");e.dataset.buoyMount="";document.body.appendChild(e);const n=(0,_client.createRoot)(e);const u=(0,_jsxRuntime.jsx)(_FloatingDevToolsWeb.FloatingDevTools,{...r});n.render(t?(0,_react.createElement)(o,{client:t},u):u);let i=true;return()=>{if(!i)return;i=false;n.unmount();e.remove()}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var _react=require("react");var _vitest=require("vitest");var _mountBuoy=require("./mountBuoy.js");var _reactQuery=require("@tanstack/react-query");var _jsxRuntime=require("react/jsx-runtime");_vitest.vi.mock("./floatingMenu/FloatingDevTools.web",()=>({FloatingDevTools:e=>(0,_jsxRuntime.jsxs)("span",{children:[e.environment,e.children]})}));_vitest.vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT",true);(0,_vitest.afterEach)(()=>{document.body.innerHTML=""});(0,_vitest.it)("mounts with the given props and removes its root on unmount",async()=>{let e;await(0,_react.act)(async()=>{e=(0,_mountBuoy.mountBuoy)({environment:"qa"})});(0,_vitest.expect)(document.querySelector("[data-buoy-mount]")?.textContent).toBe("qa");await(0,_react.act)(async()=>e());(0,_vitest.expect)(document.querySelector("[data-buoy-mount]")).toBeNull();(0,_vitest.expect)(()=>e()).not.toThrow()});(0,_vitest.it)("keeps other roots and app DOM when one mount is removed",async()=>{const e=document.createElement("main");document.body.append(e);let n;let t;await(0,_react.act)(async()=>{n=(0,_mountBuoy.mountBuoy)({environment:"qa"});t=(0,_mountBuoy.mountBuoy)({environment:"dev"})});await(0,_react.act)(async()=>n());(0,_vitest.expect)(e.isConnected).toBe(true);(0,_vitest.expect)(document.querySelectorAll("[data-buoy-mount]")).toHaveLength(1);(0,_vitest.expect)(document.querySelector("[data-buoy-mount]")?.textContent).toBe("dev");await(0,_react.act)(async()=>t())});(0,_vitest.it)("shares the app QueryClient with tool panels",async()=>{const e=new _reactQuery.QueryClient;e.setQueryData(["host"],"from Angular");function n(){return(0,_jsxRuntime.jsx)("b",{children:(0,_reactQuery.useQueryClient)().getQueryData(["host"])})}let t;await(0,_react.act)(async()=>{t=(0,_mountBuoy.mountBuoy)({queryClient:e,modules:{query:{QueryClientProvider:_reactQuery.QueryClientProvider}},children:(0,_jsxRuntime.jsx)(n,{})})});(0,_vitest.expect)(document.querySelector("[data-buoy-mount]")?.textContent).toBe("from Angular");await(0,_react.act)(async()=>t())});(0,_vitest.it)("fails before adding a root when the Query provider is absent",()=>{(0,_vitest.expect)(()=>(0,_mountBuoy.mountBuoy)({queryClient:new _reactQuery.QueryClient})).toThrow("Add the react-query tool");(0,_vitest.expect)(document.querySelector("[data-buoy-mount]")).toBeNull()});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.installThreeBootHook=installThreeBootHook;exports.subscribeThreeBootEvents=subscribeThreeBootEvents;const buffers=new WeakMap;const LIMIT=128;function installThreeBootHook(){const o=window;const e=o.__THREE_DEVTOOLS__??(o.__THREE_DEVTOOLS__=new EventTarget);if(!buffers.has(e)){const n=[];buffers.set(e,n);const t=r=>{const s=r.detail;const i={type:r.type};if(typeof s==="object"&&s!==null||typeof s==="function"){if(typeof WeakRef==="undefined")return;i.ref=new WeakRef(s)}else i.value=s;n.push(i);if(n.length>LIMIT)n.shift()};e.addEventListener("register",t);e.addEventListener("observe",t)}return e}function subscribeThreeBootEvents(o){const e=installThreeBootHook();const n=t=>o({type:t.type,detail:t.detail});e.addEventListener("register",n);e.addEventListener("observe",n);for(const t of[...buffers.get(e)]){const r=t.ref?t.ref.deref():t.value;if(t.ref&&r===void 0)continue;o({type:t.type,detail:r})}return()=>{e.removeEventListener("register",n);e.removeEventListener("observe",n)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var _vitest=require("vitest");var _threeBootHook=require("./threeBootHook.js");function _interopRequireWildcard(t,o){if("function"==typeof WeakMap)var n=new WeakMap,s=new WeakMap;return(_interopRequireWildcard=function(e,c){if(!c&&e&&e.__esModule)return e;var r,l,a={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return a;if(r=c?s:n){if(r.has(e))return r.get(e);r.set(e,a)}for(const i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&((l=(r=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,i))&&(l.get||l.set)?r(a,i,l):a[i]=e[i]);return a})(t,o)}(0,_vitest.afterEach)(()=>_vitest.vi.unstubAllGlobals());(0,_vitest.it)("keeps an existing hook and its listeners",()=>{const t=new EventTarget;const o=_vitest.vi.fn();t.addEventListener("observe",o);_vitest.vi.stubGlobal("window",{__THREE_DEVTOOLS__:t});(0,_vitest.expect)((0,_threeBootHook.installThreeBootHook)()).toBe(t);t.dispatchEvent(new CustomEvent("observe",{detail:{}}));(0,_vitest.expect)(o).toHaveBeenCalledOnce()});(0,_vitest.it)("replays buffered events once and unsubscribes from live events",()=>{_vitest.vi.stubGlobal("window",{});const t=(0,_threeBootHook.installThreeBootHook)();const o={};t.dispatchEvent(new CustomEvent("register",{detail:{revision:"186"}}));t.dispatchEvent(new CustomEvent("observe",{detail:o}));(0,_threeBootHook.installThreeBootHook)();const n=_vitest.vi.fn();const s=(0,_threeBootHook.subscribeThreeBootEvents)(n);(0,_vitest.expect)(n).toHaveBeenCalledTimes(2);(0,_vitest.expect)(n).toHaveBeenLastCalledWith({type:"observe",detail:o});t.dispatchEvent(new CustomEvent("observe",{detail:{}}));(0,_vitest.expect)(n).toHaveBeenCalledTimes(3);s();t.dispatchEvent(new CustomEvent("observe",{detail:{}}));(0,_vitest.expect)(n).toHaveBeenCalledTimes(3)});(0,_vitest.it)("bounds the buffer and uses weak references for objects",()=>{_vitest.vi.stubGlobal("window",{});const t=[];_vitest.vi.stubGlobal("WeakRef",class{constructor(e){t.push(e)}deref(){return void 0}});const o=(0,_threeBootHook.installThreeBootHook)();const n={};o.dispatchEvent(new CustomEvent("observe",{detail:n}));(0,_vitest.expect)(t).toEqual([n]);const s=_vitest.vi.fn();(0,_threeBootHook.subscribeThreeBootEvents)(s)();(0,_vitest.expect)(s).not.toHaveBeenCalled();for(let e=0;e<150;e++)o.dispatchEvent(new CustomEvent("register",{detail:e}));(0,_threeBootHook.subscribeThreeBootEvents)(s)();(0,_vitest.expect)(s).toHaveBeenCalledTimes(128);(0,_vitest.expect)(s).toHaveBeenNthCalledWith(1,{type:"register",detail:22})});(0,_vitest.it)("offers a safe subscription from the server entry",async()=>{const t=await Promise.resolve().then(()=>_interopRequireWildcard(require("./browserRegister.server")));(0,_vitest.expect)(t).toHaveProperty("subscribeThreeBootEvents");const o=_vitest.vi.fn();const n=t.subscribeThreeBootEvents(o);(0,_vitest.expect)(n).toBeTypeOf("function");n();(0,_vitest.expect)(o).not.toHaveBeenCalled()});
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SDK_VERSION=void 0;const SDK_VERSION=exports.SDK_VERSION="7.0.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.SDK_VERSION=void 0;const SDK_VERSION=exports.SDK_VERSION="7.0.64";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import*as d from"react-devtools-core";import{installEarlyNetworkRecorder as
|
|
1
|
+
"use strict";import{installThreeBootHook as A}from"./threeBootHook.js";export{subscribeThreeBootEvents}from"./threeBootHook.js";import*as d from"react-devtools-core";import{installEarlyNetworkRecorder as T}from"./earlyNetwork.js";import{hasReleaseOptIn as R}from"./releaseOptIn.js";import{installCapacitorBridge as b}from"@buoy-gg/license/capacitor";export{earlyHookScript}from"./earlyHookScript.js";const m=["onScheduleFiberRoot","onCommitFiberRoot","onPostCommitFiberRoot","onCommitFiberUnmount","setStrictMode"];export function registerBrowserDevTools(E={}){if(typeof window==="undefined"||typeof document==="undefined")return false;const a=window.Capacitor;const f=(()=>{try{return a?.isNativePlatform?.()===true}catch{return false}})();const l=f?a?.DEBUG===true:typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production";if(!l&&!E.enableInRelease&&!R())return false;A();T();if(f)b({release:!l});const n=window;const o=n.__REACT_DEVTOOLS_GLOBAL_HOOK__;const O=o&&o.supportsFiber&&!o.getFiberRoots&&!o.sub&&Object.getOwnPropertyDescriptor(n,"__REACT_DEVTOOLS_GLOBAL_HOOK__")?.configurable;if(O)delete n.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!n.__REACT_DEVTOOLS_GLOBAL_HOOK__){const L=d.initialize??d.default?.initialize;L({appendComponentStack:false,breakOnConsoleErrors:false,showInlineWarningsAndErrors:false,hideConsoleLogsInStrictMode:false});if(O){const i=n.__REACT_DEVTOOLS_GLOBAL_HOOK__;const p=i.inject;const c=new Map;i.inject=e=>{const t=p(e);c.set(t,o.inject(e));return t};for(const e of m){const t=i[e];if(typeof t!=="function")continue;i[e]=(r,...s)=>{if(c.has(r))o[e]?.(c.get(r),...s);return t(r,...s)}}const _=new Map;o.renderers?.forEach?.((e,t)=>_.set(t,p(e)));if(_.size){for(const e of m){const t=o[e];o[e]=function(r,...s){const C=t?.call(this,r,...s);const u=_.get(r);if(u!==void 0)i[e]?.(u,...s);return C}}}}}return Boolean(n.__REACT_DEVTOOLS_GLOBAL_HOOK__)}registerBrowserDevTools();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{earlyHookScript}from"./earlyHookScript.js";export function registerBrowserDevTools(
|
|
1
|
+
"use strict";export{earlyHookScript}from"./earlyHookScript.js";export function registerBrowserDevTools(e={}){return false}export function subscribeThreeBootEvents(e){return()=>{}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{installEarlyNetworkRecorder as n}from"./earlyNetwork.js";import{hasReleaseOptIn as i}from"./releaseOptIn.js";import{installCapacitorBridge as a}from"@buoy-gg/license/capacitor";export function registerBrowserNetwork(o={}){if(typeof window==="undefined"||typeof document==="undefined")return false;const e=window.Capacitor;const r=(()=>{try{return e?.isNativePlatform?.()===true}catch{return false}})();const t=r?e?.DEBUG===true:typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production";if(!t&&!o.enableInRelease&&!i())return false;n();if(r)a({release:!t});return true}registerBrowserNetwork();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export function registerBrowserNetwork(r={}){return false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{afterEach as s,beforeEach as l,expect as a,it as r,vi as e}from"vitest";const t=e.hoisted(()=>({network:e.fn(),capacitor:e.fn(),optedIn:false}));e.mock("./earlyNetwork",()=>({installEarlyNetworkRecorder:t.network}));e.mock("./releaseOptIn",()=>({hasReleaseOptIn:()=>t.optedIn}));e.mock("@buoy-gg/license/capacitor",()=>({installCapacitorBridge:t.capacitor}));l(()=>{e.stubGlobal("window",{});e.stubGlobal("document",{});e.stubGlobal("__DEV__",true);t.network.mockClear();t.capacitor.mockClear();t.optedIn=false});s(()=>{e.unstubAllGlobals();e.resetModules()});r("starts early recording without a React hook",async()=>{await import("./browserRegisterNetwork");a(t.network).toHaveBeenCalledTimes(1);a(t.capacitor).not.toHaveBeenCalled();a(window.__REACT_DEVTOOLS_GLOBAL_HOOK__).toBeUndefined()});r("does not start on the server",async()=>{e.stubGlobal("window",void 0);const{registerBrowserNetwork:o}=await import("./browserRegisterNetwork");a(o()).toBe(false);a(t.network).not.toHaveBeenCalled()});r("keeps release capture off unless opted in",async()=>{e.stubGlobal("__DEV__",false);const{registerBrowserNetwork:o}=await import("./browserRegisterNetwork");a(t.network).not.toHaveBeenCalled();a(o({enableInRelease:true})).toBe(true);t.optedIn=true;a(o()).toBe(true)});r("uses the native debug flag and starts the Capacitor bridge",async()=>{e.stubGlobal("__DEV__",false);e.stubGlobal("window",{Capacitor:{isNativePlatform:()=>true,DEBUG:true}});await import("./browserRegisterNetwork");a(t.capacitor).toHaveBeenCalledWith({release:false})});r("requires opt-in for a native release even when the web flag is dev",async()=>{e.stubGlobal("window",{Capacitor:{isNativePlatform:()=>true,DEBUG:false}});const{registerBrowserNetwork:o}=await import("./browserRegisterNetwork");a(t.network).not.toHaveBeenCalled();o({enableInRelease:true});a(t.capacitor).toHaveBeenCalledWith({release:true})});r("has a safe server export",async()=>{const{registerBrowserNetwork:o}=await import("./browserRegisterNetwork.server");a(o({enableInRelease:true})).toBe(false);a(t.network).not.toHaveBeenCalled()});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const p=100;export function installEarlyNetworkRecorder(){if(typeof window==="undefined")return;const u=window;if(u.__BUOY_EARLY_NETWORK__)return;const d=Date.now;let f=true;const
|
|
1
|
+
"use strict";const p=100;export function installEarlyNetworkRecorder(){if(typeof window==="undefined")return;const u=window;if(u.__BUOY_EARLY_NETWORK__)return;const d=Date.now;let f=true;const i=[];const y=c=>{i.push(c);if(i.length>p){const e=i.shift();if(e?.kind==="fetch")void e.settled.then(r=>r.clone?.body?.cancel()).catch(()=>{})}};const h=typeof window.fetch==="function"?window.fetch:void 0;if(h){window.fetch=function c(e,r){if(r?.__buoyInternal)return h.call(window,e,r);if(!f)return h.call(window,e,r);let l;try{if(e instanceof Request&&e.body&&!e.bodyUsed&&r?.body===void 0)l=e.clone()}catch{}const a=d();const o=h.call(window,e,r);const n=o.then(t=>{const s=d();const _=/event-stream|ndjson/.test(t.headers.get("content-type")??"");let w;try{if(!_)w=t.clone()}catch{}return{response:t,clone:w,headersAt:s}},t=>({error:t,headersAt:d()}));y({kind:"fetch",input:e,init:r,requestCopy:l,start:a,settled:n});return o}}if(typeof XMLHttpRequest!=="undefined"){const c=XMLHttpRequest.prototype;const{open:e,send:r,setRequestHeader:l}=c;const a=new WeakMap;c.open=function(o,n,...t){if(f)a.set(this,{method:o,url:String(n),headers:{}});return e.call(this,o,n,...t)};c.setRequestHeader=function(o,n){const t=a.get(this);if(t)t.headers[o]=n;return l.call(this,o,n)};c.send=function(o){const n=a.get(this);if(f&&n){a.delete(this);const t=d();const s=this;s.addEventListener("readystatechange",()=>{if(s.readyState===2&&s._buoyTtfb===void 0)s._buoyTtfb=d()-t;if(s.readyState===4)s._buoyEarlyEnd=d()});y({kind:"xhr",xhr:s,method:n.method,url:n.url,headers:n.headers,body:o,start:t})}return r.call(this,o)}}u.__BUOY_EARLY_NETWORK__={version:1,records:i,adopt(){f=false;return i.splice(0)}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{persistentStorage as
|
|
1
|
+
"use strict";import{listenBuoyKeydown as D}from"@buoy-gg/shared-ui/floating";import{persistentStorage as P,setExpandableWindowControls as $}from"@buoy-gg/shared-ui";import{createContext as B,useCallback as p,useContext as F,useEffect as M,useMemo as H,useRef as S,useState as w}from"react";import{resolveOpenAppsState as N}from"./AppHostLogic.js";import{renderAppIcon as j}from"./AppIcon";import{ToolModalShell as W}from"./ToolHost.js";import{useDevToolsSettings as G}from"./DevToolsSettingsModal.shared.js";import{getBubbleAnchorPosition as J}from"./floatingTools.web.js";import{useCapacitorBackButton as K}from"./capacitorBackButton.js";import{jsx as d,Fragment as V}from"react/jsx-runtime";const _=B(null);const T="@react_buoy_open_apps";const z=44;const Z=12;const q=100;const X=16;const Y=t=>({x:window.innerWidth-z-X,y:window.innerHeight-q-z-t*(z+Z)});export const AppHostProvider=({children:t})=>{const[i,l]=w([]);const[c,a]=w(false);const g=S([]);const m=S(null);const r=S(false);const f=S(false);const b=S(false);const A=p(n=>{let o="";l(s=>{const{apps:e,instanceId:u}=N(s,n,()=>`${n.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`);o=u;return e});return o},[]);const v=p(()=>{if(r.current||!f.current||!b.current)return;r.current=true;const n=m.current;if(!n||n.length===0){a(true);return}m.current=null;n.forEach(({id:o,minimized:s})=>{const e=g.current.find(u=>u.id===o);if(e&&e.component){const u=j(e.icon,{slot:"dial",size:20,color:e.color});A({id:e.id,title:e.name,component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:u,color:e.color,minimized:s})}});a(true)},[A]);M(()=>{let n=false;const o=async()=>{try{const s=await P.getItem(T);if(n)return;if(s){const e=JSON.parse(s);let u;if(Array.isArray(e)&&e.length>0){if(typeof e[0]==="string"){u=e.map(y=>({id:y,minimized:false}))}else{u=e.filter(y=>typeof y==="object"&&y!==null&&typeof y.id==="string")}if(u.length){m.current=u}}}}catch{}if(n)return;f.current=true;v()};void o();return()=>{n=true}},[v]);M(()=>{if(!c)return;const n=i.map(o=>({id:o.id,minimized:o.minimized??false}));void P.setItem(T,JSON.stringify(n))},[i,c]);const x=p(n=>{g.current=n;b.current=true;v()},[v]);const h=p(n=>{l(o=>{if(!o.length)return o;if(!n)return o.slice(0,-1);return o.filter(s=>s.instanceId!==n)})},[]);const C=p(()=>l([]),[]);const O=p((n,o)=>{l(s=>s.map(e=>e.instanceId===n?{...e,minimized:true,restoreState:o}:e))},[]);const R=p((n,o)=>{l(s=>s.map(e=>e.instanceId===n?{...e,minimized:false,restoreState:o??e.restoreState}:e))},[]);const E=p(n=>{const o=i.find(s=>s.instanceId===n);return o?.minimized??false},[i]);const I=i.some(n=>n.launchMode!=="toggle-only"&&!n.minimized);M(()=>{if(!I)return;const n=o=>{if(o.key!=="Escape")return;if(o.defaultPrevented)return;const s=[...i].reverse().find(e=>e.launchMode!=="toggle-only"&&!e.minimized);if(s)h(s.instanceId)};return D(n)},[I,h,i]);K(i.length>0,()=>h());const k=H(()=>({openApps:i,isAnyOpen:I,open:A,close:h,closeAll:C,registerApps:x,minimize:O,restore:R,isMinimized:E}),[i,I,A,h,C,x,O,R,E]);return d(_.Provider,{value:k,children:t})};export const useAppHost=()=>{const t=F(_);if(!t){return{openApps:[],isAnyOpen:false,open:()=>"",close:()=>{},closeAll:()=>{},registerApps:()=>{},minimize:()=>{},restore:()=>{},isMinimized:()=>false}}return t};const L=9e3;const Q={position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.28)",display:"flex",alignItems:"center",justifyContent:"center"};const U={maxHeight:"90%",width:"94%",borderRadius:12,backgroundColor:"white",overflow:"hidden"};const ee=({app:t,zIndex:i,onClose:l,onMinimize:c,minimizeTargetPosition:a,enableSharedModalDimensions:g})=>{const m=t.component;const r=!t.minimized;const f={...t.props??{},...g?{enableSharedModalDimensions:true}:{}};if(t.modal&&(!t.launchMode||t.launchMode==="self-modal")){return d("div",{"data-testid":`buoy-tool-instance-${t.id}`,style:{position:"fixed",inset:0,zIndex:i,pointerEvents:"none"},children:d(W,{app:t,config:t.modal,visible:r,zIndex:i,onClose:l,onMinimize:c,initialModalState:t.restoreState,enableSharedModalDimensions:g,bodyProps:f})})}if(t.launchMode==="self-modal"){return d("div",{"data-testid":`buoy-tool-instance-${t.id}`,style:{position:"fixed",inset:0,zIndex:i,pointerEvents:"none"},children:d(m,{...f,visible:r,onClose:l,onRequestClose:l,onMinimize:c,minimizeTargetPosition:a,instanceId:t.instanceId,zIndex:i,initialModalState:t.restoreState})})}if(t.launchMode==="inline"){if(!r)return null;return d("div",{"data-testid":`buoy-tool-instance-${t.id}`,style:{position:"fixed",inset:0,zIndex:i,pointerEvents:"none"},children:d(m,{...f,onClose:l,onMinimize:c,minimizeTargetPosition:a,initialModalState:t.restoreState,instanceId:t.instanceId})})}return d("div",{"data-testid":`buoy-tool-instance-${t.id}`,style:{...Q,zIndex:i,display:r?"flex":"none"},children:d("div",{style:U,children:d(m,{...f,onClose:l,onMinimize:c,minimizeTargetPosition:a,initialModalState:t.restoreState,instanceId:t.instanceId})})})};export const AppOverlay=()=>{const{openApps:t,close:i,minimize:l}=useAppHost();const{settings:c}=G();M(()=>{$(c.globalSettings?.expandableWindowControls!==false)},[c.globalSettings?.expandableWindowControls]);const a=t.filter(r=>r.launchMode!=="toggle-only");if(a.length===0)return null;const g=a.filter(r=>r.minimized).length;const m=J()??Y(g);return d(V,{children:a.map((r,f)=>d(ee,{app:r,zIndex:L+f,onClose:()=>i(r.instanceId),onMinimize:b=>l(r.instanceId,b),enableSharedModalDimensions:c.globalSettings?.enableSharedModalDimensions===true,minimizeTargetPosition:m},r.instanceId))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useEffect as g,useMemo as S,useRef as
|
|
1
|
+
"use strict";import{useEffect as g,useMemo as S,useRef as h}from"react";import{LicenseManager as B,installCapacitorBridge as T,resolveDevBuild as O,useLicense as k}from"@buoy-gg/license";import{registerToolAdapters as w}from"@buoy-gg/shared-ui";import{RELEASE_DEFAULT_SOCKET_URL as x,applyReleaseActionPolicy as j,externalSyncOptions as N,releaseTransportProblem as U,shouldMountExternalSync as C}from"./externalSyncGate.js";import{useDeviceIdentity as M}from"./deviceIdentity.js";import{capacitorBrokerURL as P,capacitorTransportProblem as $,useHostInfo as V}from"./capacitorHostInfo.js";import{appSyncAdapter as F}from"./sync/appSyncAdapter.js";import{jsx as f,Fragment as Q,jsxs as q}from"react/jsx-runtime";const H=["ConsoleRoot","RouteTracker","ReactQueryTracker","ReduxAutoInstrument","PerfMonitorRoot","AutomationResumer","ImagesRoot"];const K=["DebugBordersStandaloneOverlay","HighlightUpdatesOverlay","ImageOverlayStandalone","PerfMonitorOverlay","JsTopHudOverlay","ImpersonateOverlay","ScenariosOverlay"];export function BrowserToolRuntime(e){const a=S(()=>Object.fromEntries(Object.entries(e.modules).map(([u,p])=>[u.replace(/^@buoy-gg\//,"").replace(/\/web$/,""),p])),[e.modules]);const o=a["react-query"];return o?.useReactQuerySyncAdapter?f(J,{...e,modules:a,query:o}):f(I,{...e,modules:a})}function J(e){const a=e.query.useReactQuerySyncAdapter();return f(I,{...e,queryAdapter:a})}function I({modules:e,apps:a,requiredEnvVars:o,externalSync:u,headless:p,sentryGetClient:y,queryAdapter:r}){const{isPro:d,tier:v}=k();const n=S(()=>{const c={app:F};for(const[t,s]of Object.entries(e)){for(const[l,A]of Object.entries(s)){if(l.endsWith("SyncAdapter")&&A&&typeof A==="object")c[t]=A}}if(r)c.query=r;if(e.env?.createEnvSyncAdapter)c.env=e.env.createEnvSyncAdapter(o??[]);for(const t of a??[])if(t.sync)c[`custom:${t.id}`]=t.sync;return c},[e,a,o,r]);const m=h(n);m.current=n;g(()=>w(()=>m.current),[]);g(()=>{const c=[];const t=s=>{const l=s?.();if(typeof l==="function")c.push(l)};t(e.network?.startNetworkCapture);t(e.storage?.startBrowserStorageCapture);t(e.assets?.startBrowserAssetCapture);t(e.three?.startThreeCapture);if(O(typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production")){t(e["time-machine"]?.startTimeMachineFloatingToolPersistence)}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 s of c.reverse())s()}},[e]);const _=e["external-sync"];const i=O(typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production");const b=C({isDevelopment:i,isLicensed:d,externalSync:u,isAvailable:Boolean(_)});const R=N(u);T({release:!i&&Boolean(R?.enableInRelease)});if(!i&&R?.enableInRelease)D(U(R.socketURL,R));const E=e.sentry?.SentryRoot;return q(Q,{children:[Object.entries(e).flatMap(([c,t])=>H.map(s=>{const l=t[s];return l?f(l,{},`${c}:${s}`):null})),E&&f(E,{getClient:y}),Object.entries(e).flatMap(([c,t])=>K.map(s=>{const l=t[s];return l&&(!p||s==="ScenariosOverlay"||s==="ImpersonateOverlay")?f(l,{},`${c}:${s}`):null})),b&&f(W,{module:_,tools:n,options:R,isPro:d,tier:v,dev:i})]})}let L=null;function D(e){if(!e||e===L)return;L=e;console.warn("[Buoy]",e)}function W({module:e,tools:a,options:o,isPro:u,tier:p,dev:y}){const r=V();const d=M(o,{appName:r.appName,hardwareName:r.hardwareName,platform:r.platform});const v=S(()=>P(o?.socketURL??(y?e.getDefaultSocketURL():x),Boolean(o?.socketURL),r.platform),[o?.socketURL,y,e,r.platform]);const{socket:n}=e.useExternalSyncSocket({deviceName:d?.deviceName??"Buoy Browser",socketURL:v,persistentDeviceId:r.ready?d?.deviceId??null:null,platform:r.platform,extraDeviceInfo:r.extraDeviceInfo,enableLogs:o?.enableLogs});g(()=>{const i=$(v,r.platform);if(!n||!i)return;const b=()=>D(i);n.on("connect_error",b);return()=>{n.off("connect_error",b)}},[n,v,r.platform]);g(()=>{if(!n)return;const i=()=>{if(n.connected&&B.hasAccountAccess())n.emit("device-license",{isPro:u?"1":"0",tier:p})};i();n.on("connect",i);return()=>{n.off("connect",i)}},[n,u,p]);const m=o?.releaseActions?.join(",")??"";const _=S(()=>j(a,y,m?m.split(","):void 0),[a,y,m]);e.useExternalSync({tools:_,socket:n,deviceId:r.ready?d?.deviceId??null:null,enableLogs:o?.enableLogs});return null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{useState as a}from"react";import{
|
|
1
|
+
"use strict";import{useState as a}from"react";import{BuoyPortal as m}from"@buoy-gg/shared-ui/floating";import{useBuoySession as x}from"@buoy-gg/license";import{jsx as n,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[t,r]=a(null);if(typeof document==="undefined")return null;const y=()=>{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 n(m,{children:n("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||t?"12px 14px":0,borderRadius:16,background:e||t?"#0f1419":"transparent",color:"#e6edf3",boxShadow:e||t?"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:[n("div",{"data-testid":"buoy-signin-needs-plan",children:"Buoy on a live site needs a Pro or Business plan."}),n("button",{type:"button",onClick:()=>void p(),style:b,"data-testid":"buoy-signout",children:"Sign out"})]}):l(d,{children:[t?n("div",{role:"alert",style:{marginBottom:10},"data-testid":"buoy-signin-error",children:t}):null,n("button",{type:"button",onClick:y,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"})]})})})}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 S,useEffect as I,useCallback as W,useMemo as A}from"react";import{View as y,Text as h,StyleSheet as Xe,ScrollView as Se,TouchableOpacity as j,Dimensions as be,Platform as Ze}from"react-native";import{settingsBus as N}from"./settingsBus.js";import{useDesktopSyncStatus as et}from"./useDesktopSyncStatus";import{SentryIcon as tt,WifiCircuitIcon as ot,ImageOverlayIcon as nt,RenderCountIcon as rt,Info as $,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,BuoyUpgradeSheet as dt,BackgroundSwitcher as gt,night as o,NightCard as R,NightRows as Q,NightSectionLabel as ut,NightFootnote as xe,NightSwitch as ze,NightButton as X,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 Z,onSettingsApplied as zt,expandableWindowControlsSupported as It}from"@buoy-gg/shared-ui";import{useSafeAreaInsets as Ct}from"@buoy-gg/shared-ui";import{jsx as e,jsxs as s,Fragment as P}from"react/jsx-runtime";const H="@react_buoy_dev_tools_settings";const Lt=6;const V=d=>{let g=Lt;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 Dt=(d,g)=>{const{userStatus:a,environment:f,...l}=d;const u=g?Object.entries(l).filter(([p])=>g.includes(p)):Object.entries(l);return{...Object.fromEntries(u),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 u=V(Object.fromEntries(l));return{dialTools:u,floatingTools:Dt({...d.floatingTools,...g.floatingTools??{}},a?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...g.globalSettings??{}}}};const Rt=(d=[],g,a)=>{const f={};const l={};const u=new Set(g??[]);const p=new Set(a??[]);const m=!a||a.length===0;for(const x of d){const{id:c,slot:C="both"}=x;if(C==="dial"||C==="both"){f[c]=m?true:p.has(c)}if(C==="row"||C==="both"){l[c]=u.has(c)}}return{dialTools:V(f),floatingTools:{...l,environment:u.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}};export const DevToolsSettingsModal=({visible:d,onClose:g,onSettingsChange:a,initialSettings:f,availableApps:l=[],storage:u=D,zIndex:p})=>{const{defaultFloatingTools:m,defaultDialTools:x}=Le();const c=A(()=>Rt(l,m,x),[l,m,x]);const C=A(()=>Object.keys(c.dialTools),[c]);const te=A(()=>Object.keys(c.floatingTools).filter(t=>t!=="environment"),[c]);const[z,E]=S(f||M||c);const[B,oe]=S(ee??"floating");const[ne,Ee]=S(ee!==null);const[_,Fe]=S(new Set);const[Oe,re]=S(false);const[ke,Pe]=S(false);I(()=>{const t=requestAnimationFrame(()=>Pe(true));return()=>cancelAnimationFrame(t)},[]);const b=et();I(()=>{const t=async()=>{try{const r=await D.getItem(Z.settings.activeTab());if(r&&["floating","settings","pro"].includes(r)){const i=r;ee=i;oe(T=>T===i?T:i)}}catch(r){}finally{Ee(true)}};t()},[]);I(()=>{if(!ne)return;D.setItem(Z.settings.activeTab(),B).catch(t=>{console.warn("Failed to save settings active tab:",t)})},[B,ne]);const He=at();const F=He?.();const O=F?.isPro??false;const J=!O&&F?.licenseKey?F.error:null;const Me=F?.errorKind==="transport";const[w,Ke]=S(Re);const[U,se]=S(false);const[G,q]=S(false);const[k,We]=S(false);const[Y,ie]=S([]);const[ae,le]=S(false);const ce=Ct();const de=be.get("window").height;const ge=be.get("window").width;const Ae=Math.floor(de*.33);const je=Math.min(ge-32,400);const ue=W(async()=>{try{const t=await u.getItem(H);if(t){const r=JSON.parse(t);const i=De(c,r,{allowedDialKeys:C,allowedFloatingKeys:te});M=i;E(T=>Be(T,i)?T:i);return}M=c;E(r=>Be(r,c)?r:c)}catch(t){console.error("Failed to load dev tools settings:",t);E(c)}},[c,C,te,u]);I(()=>{ue()},[ue]);I(()=>{it().then(t=>{Re=t;Ke(r=>r===t?r:t)})},[]);I(()=>{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 u.setItem(H,JSON.stringify(r));M=r;E(r);a?.(r);N.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);q(false);try{await D.clear();q(true);E(c);if(u!==D)await u.setItem(H,JSON.stringify(c));a?.(c);N.emit(c);setTimeout(()=>q(false),2e3)}catch(t){console.error("Failed to clear storage:",t)}finally{se(false)}};const Je=W(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($,{size:18,color:o.color.textSecondary})}case"jotai":try{const{JotaiIcon:r}=require("@buoy-gg/jotai");return e(r,{size:18})}catch{return e($,{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($,{size:18,color:o.color.textSecondary})}}};const qe=(t,r,i,T)=>{const K=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(y,{style:n.toolIconSlot,children:Ge(t)}),s(y,{style:n.rowInfo,children:[s(h,{style:n.rowLabel,children:[he(t),i?" \xB7 max 6":""]}),K?e(h,{style:n.rowCaption,numberOfLines:1,children:K}):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,K)=>{const Qe=z.globalSettings?.[t]??false;const me=_.has(t);return s(y,{children:[s(j,{activeOpacity:.7,onPress:()=>fe(t),accessibilityLabel:r,style:n.settingRow,children:[s(y,{style:n.rowInfo,children:[e(h,{style:n.rowLabel,children:r}),e(h,{style:n.rowCaption,numberOfLines:me?0:1,children:i})]}),e(ze,{value:Qe,onValueChange:()=>Ve(t)})]}),me&&s(y,{style:n.settingRowBody,children:[e(h,{style:n.settingRowBodyText,children:T}),e(h,{style:n.settingRowBodyHint,children:K})]})]},t)};const L=(t,r,i)=>s(y,{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(y,{style:n.container,children:[s(Se,{style:n.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:n.scrollContainer,children:[B==="floating"&&e(P,{children:L("Floating Tools",e(R,{glass:true,children:e(Q,{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:[L("Background",e(R,{glass:true,padded:true,children:e(gt,{embedded:true})})),L("Storage",s(R,{glass:true,children:[s(j,{activeOpacity:.7,onPress:()=>We(!k),accessibilityLabel:"Storage Type",style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(h,{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(y,{style:n.settingRowBody,children:[e(h,{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(h,{style:[n.settingRowBodyText,n.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),w==="memory"&&e(h,{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(y,{style:n.storageExpanded,children:[s(y,{style:n.storageExpandedHeader,children:[e(h,{style:n.storageExpandedTitle,children:"SAVED SETTINGS"}),e(h,{style:n.storageExpandedCount,children:ae?"\u2026":`${Y.length} keys`})]}),ae?e(h,{style:n.storageKeyEmpty,children:"Loading\u2026"}):Y.length===0?e(h,{style:n.storageKeyEmpty,children:"No settings saved yet"}):e(Se,{style:n.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:Y.map(t=>e(y,{style:n.storageKeyItem,children:e(h,{style:n.storageKeyText,numberOfLines:1,children:t.replace("@react_buoy_","")})},t))})]}),e(y,{style:n.cardButtonWrap,children:e(X,{label:G?"Cleared":U?"Clearing\u2026":"Clear All Settings",variant:G?"secondary":"destructive",size:"md",disabled:U,onPress:_e,icon:G?e(ve,{size:15,color:o.color.accent}):e(ct,{size:15,color:U?o.color.textTertiary:o.color.danger})})})]})]})),b&&b.state!=="idle"&&L("Desktop Sync",s(R,{glass:true,children:[s(j,{activeOpacity:.7,onPress:()=>fe("desktopSync"),accessibilityLabel:"Buoy Desktop",style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(h,{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(y,{style:n.settingRowBody,children:[s(h,{style:n.settingRowBodyText,children:[b.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",e(h,{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(h,{style:[n.settingRowBodyText,n.bodyWarning],children:["Last error: ",b.lastError]})]})]})),L("Modal Behavior",e(R,{glass:true,children:s(Q,{children:[pe("enableSharedModalDimensions","Shared Modal Size","Sync dimensions across all tools","When enabled, all tool modals will share the same size and position. Resizing one modal will affect all others. When disabled, each tool remembers its own size and position independently.","Keep OFF for the best experience. This allows you to customize each tool's modal size separately."),It(Ze.OS==="web")?pe("expandableWindowControls","Expand Controls","iPad-style expandable window buttons","When enabled, the window control buttons (minimize, toggle mode, close) start as small dots and expand into larger, easy-to-tap buttons when pressed. When disabled, buttons are directly tappable at their small size.","Keep ON for touch devices where the small buttons are hard to press. Turn OFF if you prefer direct single-tap access."):null]})}))]}),B==="pro"&&s(P,{children:[L("License",s(R,{glass:true,children:[s(y,{style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(h,{style:n.rowLabel,children:"License Status"})}),e(y,{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(y,{style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(h,{style:n.rowLabel,children:"Signed in with Buoy"})}),e(X,{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.":J?Me?`Couldn't reach the license server (${J}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${J}.`:"Upgrade to Pro to unlock all features and support development."})),!O&&s(P,{children:[L("Pro Features",e(R,{glass:true,children:e(Q,{children:["Advanced Settings","Priority Support"].map(t=>s(y,{style:n.featureRow,children:[e(ve,{size:16,color:o.color.accent}),e(h,{style:n.rowLabel,children:t})]},t))})})),e(X,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>re(true)})]})]})]}),e(dt,{visible:Oe,onClose:()=>re(false)})]});return e(xt,{visible:d,onClose:g,zIndex:p,variant:"night",header:{showToggleButton:false,customContent:e(y,{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=>oe(t)})})},initialMode:"bottomSheet",onModeChange:Je,persistenceKey:Z.settings.root(),enablePersistence:true,maxHeight:de-ce.top,initialHeight:Ae,initialFloatingPosition:{x:(ge-je)/2,y:ce.top+20},enableGlitchEffects:true,children:$e()})};const Bt={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}};const Et=(d,g)=>{const a=new Set(d??[]);const f=new Set(g??[]);const l={};for(const p of f){l[p]=true}const u={environment:a.has("environment")};for(const p of a){if(p!=="environment"){u[p]=true}}return{dialTools:V(l),floatingTools:u,globalSettings:{enableSharedModalDimensions:false}}};let M=null;let ee=null;let Re=null;const Be=(d,g)=>JSON.stringify(d)===JSON.stringify(g);N.addListener(d=>{if(d)M=d});export const useDevToolsSettings=()=>{const{defaultFloatingTools:d,defaultDialTools:g}=Le();const a=A(()=>{if(!d&&!g){return Bt}return Et(d,g)},[d,g]);const[f,l]=S(a);const u=W(async()=>{try{const m=await D.getItem(H);if(m){const x=JSON.parse(m);const c=De(a,x);l(c);return}l(a)}catch(m){console.error("Failed to load dev tools settings:",m);l(a)}},[a]);I(()=>zt(m=>{if(m.includes(H))void u()}),[u]);I(()=>{u();const m=N.addListener(x=>{try{if(x){l(x)}}catch(c){}});return()=>{m()}},[u]);const p=W(()=>{u()},[u]);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 S,useEffect as I,useCallback as W,useMemo as A}from"react";import{View as y,Text as h,StyleSheet as Xe,ScrollView as Se,TouchableOpacity as j,Dimensions as be,Platform as Ze}from"react-native";import{settingsBus as N}from"./settingsBus.js";import{useDesktopSyncStatus as et}from"./useDesktopSyncStatus";import{SentryIcon as tt,WifiCircuitIcon as ot,ImageOverlayIcon as nt,RenderCountIcon as rt,Info as $,Layers as st,ChevronRightIcon as we,ChevronDown as Te,getStorageBackendType as it,getUseLicense as at,signOutOfBuoy as lt,persistentStorage as L,Trash2 as ct,CheckCircle2 as ve,BuoyUpgradeSheet as dt,BackgroundSwitcher as gt,night as o,NightCard as D,NightRows as Q,NightSectionLabel as ut,NightFootnote as xe,NightSwitch as ze,NightButton as X,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 Be}from"./DefaultConfigContext.js";import{renderAppIcon as vt}from"./AppIcon";import{JsModal as xt,devToolsStorageKeys as Z,onSettingsApplied as zt,expandableWindowControlsSupported as It}from"@buoy-gg/shared-ui";import{useSafeAreaInsets as Ct}from"@buoy-gg/shared-ui";import{jsx as e,jsxs as s,Fragment as P}from"react/jsx-runtime";const H="@react_buoy_dev_tools_settings";const Bt=6;const V=d=>{let g=Bt;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 Lt=(d,g)=>{const{userStatus:a,environment:f,...l}=d;const u=g?Object.entries(l).filter(([p])=>g.includes(p)):Object.entries(l);return{...Object.fromEntries(u),environment:f??false}};const Le=(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 u=V(Object.fromEntries(l));return{dialTools:u,floatingTools:Lt({...d.floatingTools,...g.floatingTools??{}},a?.allowedFloatingKeys),globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true,...g.globalSettings??{}}}};const Dt=(d=[],g,a)=>{const f={};const l={};const u=new Set(g??[]);const p=new Set(a??[]);const m=!a||a.length===0;for(const x of d){const{id:c,slot:C="both"}=x;if(C==="dial"||C==="both"){f[c]=m?true:p.has(c)}if(C==="row"||C==="both"){l[c]=u.has(c)}}return{dialTools:V(f),floatingTools:{...l,environment:u.has("environment")},globalSettings:{enableSharedModalDimensions:false,expandableWindowControls:true}}};export const DevToolsSettingsModal=({visible:d,onClose:g,onSettingsChange:a,initialSettings:f,availableApps:l=[],storage:u=L,zIndex:p})=>{const{defaultFloatingTools:m,defaultDialTools:x}=Be();const c=A(()=>Dt(l,m,x),[l,m,x]);const C=A(()=>Object.keys(c.dialTools),[c]);const te=A(()=>Object.keys(c.floatingTools).filter(t=>t!=="environment"),[c]);const[z,E]=S(f||M||c);const[R,oe]=S(ee??"floating");const[ne,Ee]=S(ee!==null);const[_,Fe]=S(new Set);const[Oe,re]=S(false);const[ke,Pe]=S(false);I(()=>{const t=requestAnimationFrame(()=>Pe(true));return()=>cancelAnimationFrame(t)},[]);const b=et();I(()=>{const t=async()=>{try{const r=await L.getItem(Z.settings.activeTab());if(r&&["floating","settings","pro"].includes(r)){const i=r;ee=i;oe(T=>T===i?T:i)}}catch(r){}finally{Ee(true)}};t()},[]);I(()=>{if(!ne)return;L.setItem(Z.settings.activeTab(),R).catch(t=>{console.warn("[Buoy]","Failed to save settings active tab:",t)})},[R,ne]);const He=at();const F=He?.();const O=F?.isPro??false;const J=!O&&F?.licenseKey?F.error:null;const Me=F?.errorKind==="transport";const[w,Ke]=S(De);const[U,se]=S(false);const[G,q]=S(false);const[k,We]=S(false);const[Y,ie]=S([]);const[ae,le]=S(false);const ce=Ct();const de=be.get("window").height;const ge=be.get("window").width;const Ae=Math.floor(de*.33);const je=Math.min(ge-32,400);const ue=W(async()=>{try{const t=await u.getItem(H);if(t){const r=JSON.parse(t);const i=Le(c,r,{allowedDialKeys:C,allowedFloatingKeys:te});M=i;E(T=>Re(T,i)?T:i);return}M=c;E(r=>Re(r,c)?r:c)}catch(t){console.error("[Buoy]","Failed to load dev tools settings:",t);E(c)}},[c,C,te,u]);I(()=>{ue()},[ue]);I(()=>{it().then(t=>{De=t;Ke(r=>r===t?r:t)})},[]);I(()=>{if(k){le(true);L.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 u.setItem(H,JSON.stringify(r));M=r;E(r);a?.(r);N.emit(r)}catch(r){console.error("[Buoy]","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);q(false);try{await L.clear();q(true);E(c);if(u!==L)await u.setItem(H,JSON.stringify(c));a?.(c);N.emit(c);setTimeout(()=>q(false),2e3)}catch(t){console.error("[Buoy]","Failed to clear storage:",t)}finally{se(false)}};const Je=W(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($,{size:18,color:o.color.textSecondary})}case"jotai":try{const{JotaiIcon:r}=require("@buoy-gg/jotai");return e(r,{size:18})}catch{return e($,{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($,{size:18,color:o.color.textSecondary})}}};const qe=(t,r,i,T)=>{const K=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(y,{style:n.toolIconSlot,children:Ge(t)}),s(y,{style:n.rowInfo,children:[s(h,{style:n.rowLabel,children:[he(t),i?" \xB7 max 6":""]}),K?e(h,{style:n.rowCaption,numberOfLines:1,children:K}):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,K)=>{const Qe=z.globalSettings?.[t]??false;const me=_.has(t);return s(y,{children:[s(j,{activeOpacity:.7,onPress:()=>fe(t),accessibilityLabel:r,style:n.settingRow,children:[s(y,{style:n.rowInfo,children:[e(h,{style:n.rowLabel,children:r}),e(h,{style:n.rowCaption,numberOfLines:me?0:1,children:i})]}),e(ze,{value:Qe,onValueChange:()=>Ve(t)})]}),me&&s(y,{style:n.settingRowBody,children:[e(h,{style:n.settingRowBodyText,children:T}),e(h,{style:n.settingRowBodyHint,children:K})]})]},t)};const B=(t,r,i)=>s(y,{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(y,{style:n.container,children:[s(Se,{style:n.scrollContent,showsVerticalScrollIndicator:false,contentContainerStyle:n.scrollContainer,children:[R==="floating"&&e(P,{children:B("Floating Tools",e(D,{glass:true,children:e(Q,{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."}))}),R==="settings"&&s(P,{children:[B("Background",e(D,{glass:true,padded:true,children:e(gt,{embedded:true})})),B("Storage",s(D,{glass:true,children:[s(j,{activeOpacity:.7,onPress:()=>We(!k),accessibilityLabel:"Storage Type",style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(h,{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(y,{style:n.settingRowBody,children:[e(h,{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(h,{style:[n.settingRowBodyText,n.bodyWarning],children:"Install expo-file-system to persist settings through logout flows."}),w==="memory"&&e(h,{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(y,{style:n.storageExpanded,children:[s(y,{style:n.storageExpandedHeader,children:[e(h,{style:n.storageExpandedTitle,children:"SAVED SETTINGS"}),e(h,{style:n.storageExpandedCount,children:ae?"\u2026":`${Y.length} keys`})]}),ae?e(h,{style:n.storageKeyEmpty,children:"Loading\u2026"}):Y.length===0?e(h,{style:n.storageKeyEmpty,children:"No settings saved yet"}):e(Se,{style:n.storageKeysList,nestedScrollEnabled:true,showsVerticalScrollIndicator:true,children:Y.map(t=>e(y,{style:n.storageKeyItem,children:e(h,{style:n.storageKeyText,numberOfLines:1,children:t.replace("@react_buoy_","")})},t))})]}),e(y,{style:n.cardButtonWrap,children:e(X,{label:G?"Cleared":U?"Clearing\u2026":"Clear All Settings",variant:G?"secondary":"destructive",size:"md",disabled:U,onPress:_e,icon:G?e(ve,{size:15,color:o.color.accent}):e(ct,{size:15,color:U?o.color.textTertiary:o.color.danger})})})]})]})),b&&b.state!=="idle"&&B("Desktop Sync",s(D,{glass:true,children:[s(j,{activeOpacity:.7,onPress:()=>fe("desktopSync"),accessibilityLabel:"Buoy Desktop",style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(h,{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(y,{style:n.settingRowBody,children:[s(h,{style:n.settingRowBodyText,children:[b.state==="connected"?"Streaming tool data to Buoy Desktop at ":"Trying to reach Buoy Desktop at ",e(h,{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(h,{style:[n.settingRowBodyText,n.bodyWarning],children:["Last error: ",b.lastError]})]})]})),B("Modal Behavior",e(D,{glass:true,children:s(Q,{children:[pe("enableSharedModalDimensions","Shared Modal Size","Sync dimensions across all tools","When enabled, all tool modals will share the same size and position. Resizing one modal will affect all others. When disabled, each tool remembers its own size and position independently.","Keep OFF for the best experience. This allows you to customize each tool's modal size separately."),It(Ze.OS==="web")?pe("expandableWindowControls","Expand Controls","iPad-style expandable window buttons","When enabled, the window control buttons (minimize, toggle mode, close) start as small dots and expand into larger, easy-to-tap buttons when pressed. When disabled, buttons are directly tappable at their small size.","Keep ON for touch devices where the small buttons are hard to press. Turn OFF if you prefer direct single-tap access."):null]})}))]}),R==="pro"&&s(P,{children:[B("License",s(D,{glass:true,children:[s(y,{style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(h,{style:n.rowLabel,children:"License Status"})}),e(y,{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(y,{style:n.settingRow,children:[e(y,{style:n.rowInfo,children:e(h,{style:n.rowLabel,children:"Signed in with Buoy"})}),e(X,{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.":J?Me?`Couldn't reach the license server (${J}). A VPN or corporate proxy can block buoy.gg \u2014 turn it off and reload. Your key hasn't been rejected.`:`License check failed: ${J}.`:"Upgrade to Pro to unlock all features and support development."})),!O&&s(P,{children:[B("Pro Features",e(D,{glass:true,children:e(Q,{children:["Advanced Settings","Priority Support"].map(t=>s(y,{style:n.featureRow,children:[e(ve,{size:16,color:o.color.accent}),e(h,{style:n.rowLabel,children:t})]},t))})})),e(X,{label:"Upgrade to Pro",variant:"primary",size:"lg",onPress:()=>re(true)})]})]})]}),e(dt,{visible:Oe,onClose:()=>re(false)})]});return e(xt,{visible:d,onClose:g,zIndex:p,variant:"night",header:{showToggleButton:false,customContent:e(y,{style:n.headerRow,children:e(yt,{glass:true,tabs:[{key:"floating",label:"Floating"},{key:"settings",label:"Settings"},{key:"pro",label:"Pro"}],activeKey:R,onChange:t=>oe(t)})})},initialMode:"bottomSheet",onModeChange:Je,persistenceKey:Z.settings.root(),enablePersistence:true,maxHeight:de-ce.top,initialHeight:Ae,initialFloatingPosition:{x:(ge-je)/2,y:ce.top+20},enableGlitchEffects:true,children:$e()})};const Rt={dialTools:{},floatingTools:{environment:false},globalSettings:{enableSharedModalDimensions:false}};const Et=(d,g)=>{const a=new Set(d??[]);const f=new Set(g??[]);const l={};for(const p of f){l[p]=true}const u={environment:a.has("environment")};for(const p of a){if(p!=="environment"){u[p]=true}}return{dialTools:V(l),floatingTools:u,globalSettings:{enableSharedModalDimensions:false}}};let M=null;let ee=null;let De=null;const Re=(d,g)=>JSON.stringify(d)===JSON.stringify(g);N.addListener(d=>{if(d)M=d});export const useDevToolsSettings=()=>{const{defaultFloatingTools:d,defaultDialTools:g}=Be();const a=A(()=>{if(!d&&!g){return Rt}return Et(d,g)},[d,g]);const[f,l]=S(a);const u=W(async()=>{try{const m=await L.getItem(H);if(m){const x=JSON.parse(m);const c=Le(a,x);l(c);return}l(a)}catch(m){console.error("[Buoy]","Failed to load dev tools settings:",m);l(a)}},[a]);I(()=>zt(m=>{if(m.includes(H))void u()}),[u]);I(()=>{u();const m=N.addListener(x=>{try{if(x){l(x)}}catch(c){}});return()=>{m()}},[u]);const p=W(()=>{u()},[u]);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 se}from"@buoy-gg/shared-ui";import{AccountSetup as ce,startSettingsSync as ue}from"@buoy-gg/shared-ui";import
|
|
1
|
+
"use strict";import{FloatingToolHost as se}from"@buoy-gg/shared-ui";import{AccountSetup as ce,startSettingsSync as ue}from"@buoy-gg/shared-ui";import Be,{useMemo as t,useCallback as ae,useEffect as v}from"react";import{View as $,StyleSheet as G}from"react-native";import{AppHostProvider as le}from"./AppHost";import{FloatingMenu as ge}from"./FloatingMenu.js";import{AppOverlay as ye}from"./AppHost";import{ToolOpenerBridge as pe}from"./ToolOpenerBridge.js";import{autoDiscoverPresets as de,autoDiscoverPresetsWithCustom as me}from"./autoDiscoverPresets.js";import{sendInstallPing as fe}from"../telemetry/installPing.js";import{isTelemetryEnabled as ve}from"../Buoy.js";import{renderAppIcon as be}from"./AppIcon";import{DevToolsVisibilityProvider as he}from"./DevToolsVisibilityContext.js";import{reportOptionalRequireError as n}from"./optionalRequire.js";import{HintsProvider as Oe,normalizeEnvironment as Te}from"@buoy-gg/shared-ui";import{MinimizedToolsProvider as Ae}from"./MinimizedToolsContext.js";import{validateDialConfig as qe}from"./defaultConfig.js";import{DefaultConfigProvider as Re}from"./DefaultConfigContext.js";import{LicenseManager as Ie,useProAccess as xe,useLicense as Ee,sameLicenseKey as _e}from"@buoy-gg/license";import*as Pe from"@buoy-gg/license";import{BuoySignIn as X}from"./BuoySignIn";import{AutoExternalSync as Y,ToolRegistryPublisher as ke,isExternalSyncAvailable as De}from"./autoExternalSync.js";import{externalSyncOptions as j,releaseTransportProblem as Se,shouldMountExternalSync as Me}from"./externalSyncGate.js";import{jsx as r,Fragment as R,jsxs as d}from"react/jsx-runtime";let Z=null;function ze(i){if(!i||i===Z)return;Z=i;console.warn("[Buoy]",i)}function Ce(i){if(i&&typeof i==="object"&&i.appId)return i.appId;try{const{Platform:s}=require("react-native");const c=require("expo-constants");const a=(c?.default??c)?.expoConfig;const m=s.OS==="android"?a?.android?.package:a?.ios?.bundleIdentifier;if(typeof m==="string"&&m)return m}catch{}try{const s=require("expo-application");const c=(s?.default??s)?.applicationId;if(typeof c==="string"&&c)return c}catch{}return null}export const FloatingDevTools=({apps:i,requiredEnvVars:s,requiredStorageKeys:c,askBuoy:a,children:m,disableHints:K=false,defaultFloatingTools:ee,defaultDialTools:b,requireLicense:Fe,licenseKey:h,zustandStores:I,environment:re,externalSync:O=true,headless:x=false,signIn:T,...F})=>{const te=re??Te(process.env.NODE_ENV??"dev");const{isLicensed:A}=xe();const{licenseKey:E,isInitialized:H,tier:q,access:u}=Ee();const oe=h===void 0||_e(h,E);const _=oe&&u.status==="admitted";v(()=>{if(!H||u.status==="initializing")return;void fe({tier:u.status==="admitted"?q:"locked",enabled:ve()})},[H,u.status,q]);const P=T?Ce(T):null;v(()=>{if(!P)return;const e=Pe.SessionManager;if(!e)return;e.configure({audience:`app:${P}`});void e.load().catch(()=>{})},[P]);v(()=>{void Ie.configure(h).catch(()=>{})},[h]);v(()=>{if(_)ue()},[_]);v(()=>{if(!I||u.status==="locked")return;try{const{watchStores:e}=require("@buoy-gg/zustand");return e(I)}catch(e){n("@buoy-gg/zustand",e)}},[I,u.status]);const ne=t(()=>{if(b){return qe(b)}return b},[b]);const k=t(()=>{const e=[];if(s&&s.length>0){try{const{createEnvTool:o,createEnvVarConfig:C}=require("@buoy-gg/env");e.push(o({requiredEnvVars:C(s)}))}catch(o){n("@buoy-gg/env",o)}}if(c&&c.length>0){try{const{createStorageTool:o}=require("@buoy-gg/storage");e.push(o({requiredStorageKeys:c}))}catch(o){n("@buoy-gg/storage",o)}}if(a){try{const{createAskBuoyTool:o}=require("@buoy-gg/ask-buoy");e.push(o(a))}catch(o){n("@buoy-gg/ask-buoy",o)}}return e},[s,c,a]);const D=t(()=>{if(!i&&k.length===0)return void 0;return[...i||[],...k]},[i,k]);const f=t(()=>D?me(D):de(),[D]);const S=t(()=>f.filter(e=>e.sync),[f]);const L=t(()=>{try{const{DebugBordersStandaloneOverlay:e}=require("@buoy-gg/debug-borders");return e}catch(e){n("@buoy-gg/debug-borders",e);return null}},[]);const w=t(()=>{try{const{HighlightUpdatesOverlay:e}=require("@buoy-gg/highlight-updates");return e}catch(e){n("@buoy-gg/highlight-updates",e);return null}},[]);const B=t(()=>{try{const{ImageOverlayStandalone:e}=require("@buoy-gg/image-overlay");return e}catch(e){n("@buoy-gg/image-overlay",e);return null}},[]);const V=t(()=>{try{const{PerfMonitorOverlay:e}=require("@buoy-gg/perf-monitor");return e}catch(e){n("@buoy-gg/perf-monitor",e);return null}},[]);const U=t(()=>{try{const{JsTopHudOverlay:e}=require("@buoy-gg/js-top");return e}catch(e){n("@buoy-gg/js-top",e);return null}},[]);const l=t(()=>{try{const{RouteTracker:e}=require("@buoy-gg/route-events");return e}catch(e){n("@buoy-gg/route-events",e);return null}},[]);const g=t(()=>{try{const{ReactQueryTracker:e}=require("@buoy-gg/react-query");return e}catch(e){n("@buoy-gg/react-query",e);return null}},[]);const J=t(()=>{try{const{ImpersonateOverlay:e}=require("@buoy-gg/impersonate");return e}catch(e){n("@buoy-gg/impersonate",e);return null}},[]);const N=t(()=>{try{const{ScenariosOverlay:e}=require("@buoy-gg/scenarios");return e}catch(e){n("@buoy-gg/scenarios",e);return null}},[]);const y=t(()=>{try{const{ReduxAutoInstrument:e}=require("@buoy-gg/redux");return e??null}catch(e){n("@buoy-gg/redux",e);return null}},[]);const p=t(()=>{try{const{ConsoleRoot:e}=require("@buoy-gg/console");return e??null}catch(e){n("@buoy-gg/console",e);return null}},[]);const ie=ae(e=>{const o=f.find(C=>C.id===e);if(!o)return null;return be(o.icon,{slot:"dial",size:20,color:o.color})},[f]);const M=typeof __DEV__!=="undefined"&&__DEV__;if(!M&&!A){return T&&!x?r(X,{needsPlan:true}):null}const Q=Me({isDevelopment:M,isLicensed:A,externalSync:O,isAvailable:De()});const z=j(O);if(!M&&z?.enableInRelease){ze(Se(z.socketURL,z))}const W=r(ke,{requiredEnvVars:s,customApps:S});if(!_){return d(R,{children:[u.status==="initializing"&&d(R,{children:[y&&r(y,{}),p&&r(p,{}),l&&r(l,{}),g&&r(g,{})]}),!x&&(T?r(X,{}):r(ce,{}))]})}if(x){return d(R,{children:[y&&r(y,{}),p&&r(p,{}),l&&r(l,{}),g&&r(g,{}),W,Q&&r(Y,{options:j(O),requiredEnvVars:s,isPro:A,tier:q,licenseKey:E,customApps:S})]})}return r(Re,{defaultFloatingTools:ee,defaultDialTools:ne,children:r(Oe,{disableHints:K,children:r($,{style:je.container,pointerEvents:"box-none",__buoyDevToolsRoot:true,children:d(he,{children:[B&&r($,{style:G.absoluteFill,pointerEvents:"box-none",collapsable:false,children:r(B,{})}),r(le,{children:d(Ae,{getToolIcon:ie,children:[r(ge,{...F,apps:f,environment:te}),F.hidden?null:d(R,{children:[r(ye,{}),r(se,{})]}),r(pe,{})]})}),m,L&&r(L,{}),w&&r(w,{}),V&&r(V,{}),U&&r(U,{}),J&&r(J,{}),N&&r(N,{}),y&&r(y,{}),p&&r(p,{}),l&&r(l,{}),g&&r(g,{}),W,Q&&r(Y,{options:j(O),requiredEnvVars:s,isPro:A,tier:q,licenseKey:E,customApps:S})]})})})})};const je=G.create({container:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:9999}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{FloatingToolHost as be}from"@buoy-gg/shared-ui/floating";import*as Oe from"@buoy-gg/license";import{LicenseManager as Se,useLicense as Ce,sameLicenseKey as De,resolveDevBuild as Ie,capacitorDebug as Ee,isCapacitorNative as we,loadCapacitorAppHost as _e}from"@buoy-gg/license";import{AccountSetup as ke,HintsProvider as Me,normalizeEnvironment as Pe,registerToolOpener as Ae,startSettingsSync as xe}from"@buoy-gg/shared-ui";import{useState as N,useMemo as g,useCallback as I,useEffect as d,useRef as Re}from"react";import{useSettings as Be,getToolLabel as A,getToolDescription as Fe,getToolColor as te}from"@buoy-gg/floating-tools-react";import{persistentStorage as T,devToolsStorageKeys as x,EnvironmentIndicator as Le,EnvironmentSelectorInline as je}from"@buoy-gg/shared-ui";import{autoDiscoverWithCustom as Ve,getToolsBySlot as oe}from"../utils/autoDiscoverPresets.web.js";import{FloatingTools as ze,UserStatus as Ne}from"./floatingTools.web.js";import{DialMenu as We}from"./dial/DialDevTools.web.js";import{getRankedToolIds as Ke,recordToolUsage as He}from"./dial/dialUsageStore.js";import{OnboardingTooltip as Ue}from"./dial/OnboardingTooltip.web.js";import{SettingsModal as $e}from"./DevToolsSettingsModal.web.js";import{AppHostProvider as Ye,AppOverlay as Ge,useAppHost as ie}from"./AppHost.web.js";import{MinimizedToolsStack as Qe}from"./MinimizedToolsStack.web.js";import{createWebTools as Je}from"../utils/createWebTools.js";import{BrowserToolRuntime as Xe}from"./BrowserToolRuntime.js";import{clearReleaseOptIn as Ze,markReleaseOptIn as qe}from"../releaseOptIn.js";import{BuoySignIn as en}from"./BuoySignIn.web.js";import{BuoySignIn as se}from"./BuoyCodeSignIn.js";import{DevToolsVisibilityProvider as nn,useDevToolsVisibility as tn}from"./DevToolsVisibilityContext.js";import{createWebTool as W}from"../utils/createWebTool.js";import{DefaultConfigProvider as on}from"./DefaultConfigContext.js";import{useDevToolsSettings as sn}from"./DevToolsSettingsModal.shared.js";import{validateDialConfig as re}from"./defaultConfig.js";import{installedTools as rn,installedToolsFound as an}from"../installedTools.js";import{jsx as i,jsxs as w,Fragment as K}from"react/jsx-runtime";const ae={};const le="@react_buoy_floating_menu_tooltip_shown";const ln=T;function cn({size:o=14,color:t="#20C997"}){const s=Math.max(2,o/4);const r=Math.max(1,o/16);return i("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${s}px)`,gap:r,width:o,height:o,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((a,l)=>i("div",{style:{width:s,height:s,borderRadius:s/2,backgroundColor:t}},l))})}function dn(o){const{defaultFloatingTools:t,defaultDialTools:s,disableHints:r=false,children:a}=o;const l=g(()=>s?re(s):s,[s]);return i(on,{defaultFloatingTools:t,defaultDialTools:l,children:i(Me,{disableHints:r,children:w(nn,{children:[i(Ye,{children:i(vn,{...o})}),a]})})})}const un=["ReduxAutoInstrument","ConsoleRoot","RouteTracker","ReactQueryTracker"];function pn({modules:o=ae}){return i(K,{children:Object.entries(o).flatMap(([t,s])=>un.map(r=>{const a=s[r];return a?i(a,{},`${t}:${r}`):null}))})}function fn(){const{openApps:o,restore:t}=ie();d(()=>Ae(s=>{const r=o.find(a=>a.id===s);if(!r)return false;t(r.instanceId);return true}),[o,t]);return null}function mn(){const o=Ee();const t=o===null?process.env.NODE_ENV:o?"development":"production";return Pe(t??"dev")}function gn(o,t,s,r){const a=_=>Object.entries(o).find(([y])=>y.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")===_)?.[1];const l=[];const c=a("env");if(t?.length&&c?.createEnvTool&&c.createEnvVarConfig){l.push(W(c.createEnvTool({requiredEnvVars:c.createEnvVarConfig(t)})))}const u=a("storage");if(s?.length&&u?.createStorageTool){l.push(W(u.createStorageTool({requiredStorageKeys:s})))}const v=a("ask-buoy");const h=r==="hosted"?v?.hostedAskBuoy?.():r;if(h&&v?.createAskBuoyTool)l.push(W(v.createAskBuoyTool(h)));return l}function vn({environment:o,userRole:t="admin",availableEnvironments:s,onEnvironmentSwitch:r,apps:a,modules:l=ae,externalSync:c,requiredEnvVars:u,sentryGetClient:v,disableHints:h=false,headless:_=false,hidden:y=false,defaultFloatingTools:de,defaultDialTools:R,zustandStores:B,requiredStorageKeys:H,askBuoy:U}){const F=o??mn();const ue=g(()=>R?re(R):void 0,[R]);const[f,E]=N(false);const[b,k]=N(false);const L=Re(false);const O=ie();const $=g(()=>gn(l,u,H,U),[l,u,H,U]);const m=g(()=>Ve([...Je(l),...a??[],...$]),[a,l,$]);const j=g(()=>Object.entries(l).find(([e])=>e.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")==="zustand")?.[1],[l]);d(()=>{if(!B||typeof j?.watchStores!=="function")return;const e=j.watchStores(B);return typeof e==="function"?e:void 0},[B,j]);const M=tn();const Y=O.openApps.some(e=>!e.minimized);d(()=>{M.setDialOpen(f)},[f,M.setDialOpen]);d(()=>{M.setToolOpen(Y||b)},[Y,b,M.setToolOpen]);const{registerApps:G}=O;d(()=>{G(m.map(e=>{const n=e.icon;return{...e,icon:typeof n==="function"?({size:p})=>n(p):n}}))},[G,m]);const pe=g(()=>m.map(e=>({id:e.id,name:e.name,description:e.description,slot:e.slot})),[m]);Be({availableTools:pe,storage:ln});d(()=>{let e=false;const n=async()=>{const[p,D]=await Promise.all([T.getItem(x.dial.isOpen()),T.getItem(x.settings.modalOpen())]);if(e)return;if(p==="true")E(true);if(D==="true"){E(true);k(true)}L.current=true};void n();return()=>{e=true}},[]);d(()=>{if(!L.current)return;void T.setItem(x.dial.isOpen(),f?"true":"false")},[f]);d(()=>{if(!L.current)return;void T.setItem(x.settings.modalOpen(),b?"true":"false")},[b]);const V=I(e=>{void He(e.id);if(e.launchMode==="toggle-only"){e.onPress?.();return}if(e.component){const n=typeof e.icon==="function"?e.icon(20):e.icon;O.open({id:e.id,title:e.name||A(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||te(e.id)})}else{e.onPress?.()}},[O]);const P=g(()=>{const e=oe(m,"dial");return e.map(n=>{const p=n.color||te(n.id);let D;if(typeof n.icon==="string"){D=n.icon}else if(typeof n.icon==="function"){D=n.icon(32)}else{D=null}return{id:n.id,name:n.name||A(n.id),icon:D,unavailable:!n.component&&!n.onPress,color:p,onPress:()=>{V(n);E(false)}}})},[m,V]);const fe=g(()=>{if(!f)return P;const e=new Map(P.map(n=>[n.id,n]));return Ke(P.map(n=>n.id)).map(n=>e.get(n)).filter(n=>Boolean(n))},[f,P]);const{settings:z}=sn();const me=g(()=>oe(m,"row").filter(e=>(z.floatingTools[e.id]??false)===true&&(e.component||e.onPress)),[m,z.floatingTools]);const ge=g(()=>m.map(e=>({id:e.id,name:e.name||A(e.id),description:e.description||Fe(e.id),slot:e.slot,icon:e.icon,color:e.color})),[m]);const[ve,Q]=N(false);const J=O.openApps.some(e=>!e.minimized);d(()=>{if(h)return;let e=false;const n=setTimeout(async()=>{const p=await T.getItem(le);if(!e&&!p)Q(true)},1e3);return()=>{e=true;clearTimeout(n)}},[h]);const S=I(()=>{Q(false);void T.setItem(le,"true")},[]);const X=I(()=>{S();E(true)},[S]);const ye=I(()=>{E(false);k(false)},[]);const Te=I(()=>{k(e=>!e)},[]);const he=I(()=>k(false),[]);const Z=Boolean(s?.length&&r);const q=z.floatingTools.environment!==false;const C=ve&&!f&&!J&&!y;d(()=>{if(!C)return;const e=p=>{if(!(p.target instanceof Element)||!p.target.closest("[data-buoy-root]"))S()};const n=p=>{if(p.key==="Escape")S()};document.addEventListener("pointerdown",e,true);document.addEventListener("keydown",n);return()=>{document.removeEventListener("pointerdown",e,true);document.removeEventListener("keydown",n)}},[C,S]);const ee=O.openApps.some(e=>e.minimized&&e.launchMode!=="toggle-only");const ne=i(Xe,{modules:l,apps:a,requiredEnvVars:u,externalSync:c,headless:_,sentryGetClient:v});if(_)return ne;return w("div",{"data-buoy-root":"",style:{display:"contents"},children:[ne,i(fn,{}),C&&i("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),i("div",{style:y?{visibility:"hidden"}:{display:"contents"},"aria-hidden":y||void 0,children:w(ze,{enablePositionPersistence:!C,pushToSide:f||J,suspendPointerEvents:f,centerOnboarding:C,minimizedStack:ee?i(Qe,{}):void 0,hasMinimizedStack:ee,children:[F&&q&&!Z&&i(Le,{environment:F}),Z&&q&&i(je,{currentEnvironment:F??"local",availableEnvironments:s,onSelect:r}),t?i(Ne,{userRole:t,onPress:X}):i("button",{"aria-label":"Open dev tools",onClick:X,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:i(cn,{})}),me.map(e=>i("button",{"aria-label":e.name||A(e.id),title:e.description,onClick:()=>V(e),style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 6px",borderRadius:6,background:"none",border:"none",cursor:"pointer"},children:typeof e.icon==="function"?e.icon(16):e.icon},e.id))]})}),C&&i(Ue,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:S}),f&&!y&&i(We,{icons:fe,onClose:ye,centerLabel:"BUOY",onCenterPress:Te,settingsOpen:b,hintsDisabled:h}),b&&!y&&i($e,{visible:true,onClose:he,availableTools:ge,defaultFloatingTools:de,defaultDialTools:ue,onSettingsChange:e=>{}}),!y&&w(K,{children:[i(Ge,{}),i(be,{})]})]})}function yn(o){const t=o&&typeof o==="object"?o.appId:void 0;const s=!!o;d(()=>{if(!s)return;let r=false;const a=Oe.SessionManager;if(!a)return;const l=c=>{if(r||!c)return;a.configure({audience:`app:${c}`});void a.load().catch(()=>{})};if(t)l(t);else void _e().then(c=>l(c?.bundleId)).catch(()=>{});return()=>{r=true}},[s,t])}let ce=false;function Tn(o){if(o.modules)return o;if(!an&&!ce&&typeof console!=="undefined"){ce=true;console.info("[Buoy] No tools loaded. Add buoy() from '@buoy-gg/core/vite' to your Vite plugins, or pass modules to FloatingDevTools.")}return{...o,modules:rn}}export function FloatingDevTools(o){const t=Tn(o);const{access:s,isPro:r,licenseKey:a}=Ce();d(()=>{void Se.configure(t.licenseKey)},[t.licenseKey]);const l=t.licenseKey===void 0||De(t.licenseKey,a);const c=Ie(typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production");const u=l&&s.status==="admitted";d(()=>{if(u)xe()},[u]);d(()=>{if(c||s.status==="initializing")return;if(r&&u)qe();else Ze()},[c,r,u,s.status]);const v=we();yn(v?t.signIn:void 0);if(!c&&!r){if(!t.signIn||t.headless)return null;return v?i(se,{needsPlan:true}):i(en,{})}if(!u){return w(K,{children:[s.status==="initializing"&&i(pn,{modules:t.modules}),t.headless?null:t.signIn&&v?i(se,{}):i(ke,{})]})}return i(dn,{...t})}
|
|
1
|
+
"use strict";import{BuoyPortal as be,FloatingToolHost as Oe}from"@buoy-gg/shared-ui/floating";import*as Se from"@buoy-gg/license";import{LicenseManager as Ce,useLicense as De,sameLicenseKey as Ie,resolveDevBuild as Ee,capacitorDebug as we,isCapacitorNative as _e,loadCapacitorAppHost as ke}from"@buoy-gg/license";import{AccountSetup as Pe,HintsProvider as Me,normalizeEnvironment as Ae,registerToolOpener as xe,startSettingsSync as Re}from"@buoy-gg/shared-ui";import{useState as N,useMemo as g,useCallback as D,useEffect as d,useRef as Be}from"react";import{useSettings as Fe,getToolLabel as A,getToolDescription as Le,getToolColor as te}from"@buoy-gg/floating-tools-react";import{persistentStorage as y,devToolsStorageKeys as x,EnvironmentIndicator as je,EnvironmentSelectorInline as Ve}from"@buoy-gg/shared-ui";import{autoDiscoverWithCustom as ze,getToolsBySlot as oe}from"../utils/autoDiscoverPresets.web.js";import{FloatingTools as Ne,UserStatus as We}from"./floatingTools.web.js";import{DialMenu as Ke}from"./dial/DialDevTools.web.js";import{getRankedToolIds as He,recordToolUsage as Ue}from"./dial/dialUsageStore.js";import{OnboardingTooltip as $e}from"./dial/OnboardingTooltip.web.js";import{SettingsModal as Ye}from"./DevToolsSettingsModal.web.js";import{AppHostProvider as Ge,AppOverlay as Qe,useAppHost as ie}from"./AppHost.web.js";import{MinimizedToolsStack as Je}from"./MinimizedToolsStack.web.js";import{createWebTools as Xe}from"../utils/createWebTools.js";import{BrowserToolRuntime as Ze}from"./BrowserToolRuntime.js";import{clearReleaseOptIn as qe,markReleaseOptIn as en}from"../releaseOptIn.js";import{BuoySignIn as nn}from"./BuoySignIn.web.js";import{BuoySignIn as se}from"./BuoyCodeSignIn.js";import{DevToolsVisibilityProvider as tn,useDevToolsVisibility as on}from"./DevToolsVisibilityContext.js";import{createWebTool as W}from"../utils/createWebTool.js";import{DefaultConfigProvider as sn}from"./DefaultConfigContext.js";import{useDevToolsSettings as rn}from"./DevToolsSettingsModal.shared.js";import{validateDialConfig as re}from"./defaultConfig.js";import{installedTools as an,installedToolsFound as ln}from"../installedTools.js";import{jsx as o,jsxs as w,Fragment as K}from"react/jsx-runtime";const ae={};const le="@react_buoy_floating_menu_tooltip_shown";const cn=y;function dn({size:n=14,color:s="#20C997"}){const i=Math.max(2,n/4);const l=Math.max(1,n/16);return o("div",{style:{display:"grid",gridTemplateColumns:`repeat(3, ${i}px)`,gap:l,width:n,height:n,alignContent:"center",justifyContent:"center"},children:Array.from({length:9}).map((a,r)=>o("div",{style:{width:i,height:i,borderRadius:i/2,backgroundColor:s}},r))})}function un(n){const{defaultFloatingTools:s,defaultDialTools:i,disableHints:l=false,children:a}=n;const r=g(()=>i?re(i):i,[i]);return o(sn,{defaultFloatingTools:s,defaultDialTools:r,children:o(Me,{disableHints:l,children:w(tn,{children:[o(Ge,{children:o(yn,{...n})}),a]})})})}const fn=["ReduxAutoInstrument","ConsoleRoot","RouteTracker","ReactQueryTracker"];function mn({modules:n=ae}){return o(K,{children:Object.entries(n).flatMap(([s,i])=>fn.map(l=>{const a=i[l];return a?o(a,{},`${s}:${l}`):null}))})}function pn(){const{openApps:n,restore:s}=ie();d(()=>xe(i=>{const l=n.find(a=>a.id===i);if(!l)return false;s(l.instanceId);return true}),[n,s]);return null}function gn(){const n=we();const s=n===null?process.env.NODE_ENV:n?"development":"production";return Ae(s??"dev")}function vn(n,s,i,l){const a=_=>Object.entries(n).find(([v])=>v.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")===_)?.[1];const r=[];const c=a("env");if(s?.length&&c?.createEnvTool&&c.createEnvVarConfig){r.push(W(c.createEnvTool({requiredEnvVars:c.createEnvVarConfig(s)})))}const f=a("storage");if(i?.length&&f?.createStorageTool){r.push(W(f.createStorageTool({requiredStorageKeys:i})))}const I=a("ask-buoy");const T=l==="hosted"?I?.hostedAskBuoy?.():l;if(T&&I?.createAskBuoyTool)r.push(W(I.createAskBuoyTool(T)));return r}function yn({environment:n,userRole:s="admin",availableEnvironments:i,onEnvironmentSwitch:l,apps:a,modules:r=ae,externalSync:c,requiredEnvVars:f,sentryGetClient:I,disableHints:T=false,headless:_=false,hidden:v=false,defaultFloatingTools:de,defaultDialTools:R,zustandStores:B,requiredStorageKeys:H,askBuoy:U}){const F=n??gn();const ue=g(()=>R?re(R):void 0,[R]);const[m,E]=N(false);const[h,k]=N(false);const L=Be(false);const b=ie();const $=g(()=>vn(r,f,H,U),[r,f,H,U]);const p=g(()=>ze([...Xe(r),...a??[],...$]),[a,r,$]);const j=g(()=>Object.entries(r).find(([e])=>e.replace(/^@buoy-gg\//,"").replace(/\/web$/,"")==="zustand")?.[1],[r]);d(()=>{if(!B||typeof j?.watchStores!=="function")return;const e=j.watchStores(B);return typeof e==="function"?e:void 0},[B,j]);const P=on();const Y=b.openApps.some(e=>!e.minimized);d(()=>{P.setDialOpen(m)},[m,P.setDialOpen]);d(()=>{P.setToolOpen(Y||h)},[Y,h,P.setToolOpen]);const{registerApps:G}=b;d(()=>{G(p.map(e=>{const t=e.icon;return{...e,icon:typeof t==="function"?({size:u})=>t(u):t}}))},[G,p]);const fe=g(()=>p.map(e=>({id:e.id,name:e.name,description:e.description,slot:e.slot})),[p]);Fe({availableTools:fe,storage:cn});d(()=>{let e=false;const t=async()=>{const[u,C]=await Promise.all([y.getItem(x.dial.isOpen()),y.getItem(x.settings.modalOpen())]);if(e)return;if(u==="true")E(true);if(C==="true"){E(true);k(true)}L.current=true};void t();return()=>{e=true}},[]);d(()=>{if(!L.current)return;void y.setItem(x.dial.isOpen(),m?"true":"false")},[m]);d(()=>{if(!L.current)return;void y.setItem(x.settings.modalOpen(),h?"true":"false")},[h]);const V=D(e=>{void Ue(e.id);if(e.launchMode==="toggle-only"){e.onPress?.();return}if(e.component){const t=typeof e.icon==="function"?e.icon(20):e.icon;b.open({id:e.id,title:e.name||A(e.id),component:e.component,props:e.props,modal:e.modal,launchMode:e.launchMode||"self-modal",singleton:e.singleton??true,icon:t,color:e.color||te(e.id)})}else{e.onPress?.()}},[b]);const M=g(()=>{const e=oe(p,"dial");return e.map(t=>{const u=t.color||te(t.id);let C;if(typeof t.icon==="string"){C=t.icon}else if(typeof t.icon==="function"){C=t.icon(32)}else{C=null}return{id:t.id,name:t.name||A(t.id),icon:C,unavailable:!t.component&&!t.onPress,color:u,onPress:()=>{V(t);E(false)}}})},[p,V]);const me=g(()=>{if(!m)return M;const e=new Map(M.map(t=>[t.id,t]));return He(M.map(t=>t.id)).map(t=>e.get(t)).filter(t=>Boolean(t))},[m,M]);const{settings:z}=rn();const pe=g(()=>oe(p,"row").filter(e=>(z.floatingTools[e.id]??false)===true&&(e.component||e.onPress)),[p,z.floatingTools]);const ge=g(()=>p.map(e=>({id:e.id,name:e.name||A(e.id),description:e.description||Le(e.id),slot:e.slot,icon:e.icon,color:e.color})),[p]);const[ve,Q]=N(false);const J=b.openApps.some(e=>!e.minimized);d(()=>{if(T)return;let e=false;const t=setTimeout(async()=>{const u=await y.getItem(le);if(!e&&!u)Q(true)},1e3);return()=>{e=true;clearTimeout(t)}},[T]);const O=D(()=>{Q(false);void y.setItem(le,"true")},[]);const X=D(()=>{O();E(true)},[O]);const ye=D(()=>{E(false);k(false)},[]);const Te=D(()=>{k(e=>!e)},[]);const he=D(()=>k(false),[]);const Z=Boolean(i?.length&&l);const q=z.floatingTools.environment!==false;const S=ve&&!m&&!J&&!v;d(()=>{if(!S)return;const e=u=>{if(!(u.target instanceof Element)||!u.target.closest("[data-buoy-root]"))O()};const t=u=>{if(u.key==="Escape")O()};document.addEventListener("pointerdown",e,true);document.addEventListener("keydown",t);return()=>{document.removeEventListener("pointerdown",e,true);document.removeEventListener("keydown",t)}},[S,O]);const ee=b.openApps.some(e=>e.minimized&&e.launchMode!=="toggle-only");const ne=o(Ze,{modules:r,apps:a,requiredEnvVars:f,externalSync:c,headless:_,sentryGetClient:I});if(_)return ne;return w("div",{"data-buoy-root":"",style:{display:"contents"},children:[ne,o(pn,{}),S&&o("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.85)",zIndex:1e4,pointerEvents:"none"}}),o("div",{style:v?{visibility:"hidden"}:{display:"contents"},"aria-hidden":v||void 0,children:w(Ne,{enablePositionPersistence:!S,pushToSide:m||J,suspendPointerEvents:m,centerOnboarding:S,minimizedStack:ee?o(Je,{}):void 0,hasMinimizedStack:ee,children:[F&&q&&!Z&&o(je,{environment:F}),Z&&q&&o(Ve,{currentEnvironment:F??"local",availableEnvironments:i,onSelect:l}),s?o(We,{userRole:s,onPress:X}):o("button",{"aria-label":"Open dev tools",onClick:X,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 8px",background:"none",border:"none",cursor:"pointer"},children:o(dn,{})}),pe.map(e=>o("button",{"aria-label":e.name||A(e.id),title:e.description,onClick:()=>V(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))]})}),S&&o($e,{title:"Welcome to Buoy!",message:"Grab and position this menu wherever you want, then tap the icon to open your tools.",onDismiss:O}),m&&!v&&o(Ke,{icons:me,onClose:ye,centerLabel:"BUOY",onCenterPress:Te,settingsOpen:h,hintsDisabled:T}),h&&!v&&o(Ye,{visible:true,onClose:he,availableTools:ge,defaultFloatingTools:de,defaultDialTools:ue,onSettingsChange:e=>{}}),!v&&w(K,{children:[o(Qe,{}),o(Oe,{})]})]})}function Tn(n){const s=n&&typeof n==="object"?n.appId:void 0;const i=!!n;d(()=>{if(!i)return;let l=false;const a=Se.SessionManager;if(!a)return;const r=c=>{if(l||!c)return;a.configure({audience:`app:${c}`});void a.load().catch(()=>{})};if(s)r(s);else void ke().then(c=>r(c?.bundleId)).catch(()=>{});return()=>{l=true}},[i,s])}let ce=false;function hn(n){if(n.modules)return n;if(!ln&&!ce&&typeof console!=="undefined"){ce=true;console.info("[Buoy] No tools loaded. Add buoy() from '@buoy-gg/core/vite' to your Vite plugins, or pass modules to FloatingDevTools.")}return{...n,modules:an}}export function FloatingDevTools(n){return o(be,{children:o(bn,{...hn(n)})})}function bn(n){const{access:s,isPro:i,licenseKey:l}=De();d(()=>{void Ce.configure(n.licenseKey)},[n.licenseKey]);const a=n.licenseKey===void 0||Ie(n.licenseKey,l);const r=Ee(typeof __DEV__!=="undefined"?__DEV__:process.env.NODE_ENV!=="production");const c=a&&s.status==="admitted";d(()=>{if(c)Re()},[c]);d(()=>{if(r||s.status==="initializing")return;if(i&&c)en();else qe()},[r,i,c,s.status]);const f=_e();Tn(f?n.signIn:void 0);if(!r&&!i){if(!n.signIn||n.headless)return null;return f?o(se,{needsPlan:true}):o(nn,{})}if(!c){return w(K,{children:[s.status==="initializing"&&o(mn,{modules:n.modules}),n.headless?null:n.signIn&&f?o(se,{}):o(Pe,{})]})}return o(un,{...n})}
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 Re="@react_buoy_onboarding_step";export const FloatingMenu=({apps:t,state:f,actions:a,hidden:h,environment:c,userRole:w="admin",availableEnvironments:b,onEnvironmentSwitch:B})=>{const[P,O]=m(false);const[s,d]=m(false);const[R,J]=m(false);const[Q,E]=m(null);const[,F]=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(!R)return;y.setItem($.dial.isOpen(),s?"true":"false").catch(e=>{console.warn("[Buoy]","Failed to save dial state:",e)})},[s,R]);const j=Boolean(b?.length&&B);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(()=>{E("positioning")},1e3)}}catch(o){}};e()},[S]);r(()=>{const e=he.subscribe(()=>{F(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??P),[h,P]);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:()=>F(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;E(null);y.setItem(q,"true").catch(e=>{console.warn("[Buoy]","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:B,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{useEffect as b,useMemo as S,useRef as f,useState as w}from"react";import{Pressable as Ie,StyleSheet as Le,TouchableOpacity as Oe,View as s,useWindowDimensions as Be,Text as P,Animated as o,Easing as l}from"react-native";import{absoluteFill as u,monoFont as oe}from"@buoy-gg/shared-ui";import{DialIcon as ne}from"./DialIcon.js";import{DialHyperspace as Pe}from"./DialHyperspace.js";import{DialPagination as Re}from"./DialPagination.js";import{getRankedToolIds as F,isDialUsageLoaded as Ae,loadDialUsage as Ve,recordToolUsage as Ne}from"./dialUsageStore.js";import{persistentStorage as R,useHintsDisabled as Ge,devToolsStorageKeys as ie,buoyColors as re,ToolBackground as Me,useToolBackground as _e}from"@buoy-gg/shared-ui";import{DevToolsSettingsModal as Ee,useDevToolsSettings as Fe}from"../DevToolsSettingsModal";import{useProAccess as je}from"@buoy-gg/license";import{renderAppIcon as ae}from"../AppIcon";import{useAppHost as ze}from"../AppHost";import{OnboardingTooltip as Ue}from"./OnboardingTooltip";import{getDialLayout as We,MAX_DIAL_SLOTS as v,DIAL_BUTTON_SIZE as qe,dialAnimationConfig as j,dialColors as a}from"@buoy-gg/floating-tools-core";import{jsx as i,jsxs as h,Fragment as se}from"react/jsx-runtime";const c=qe;const He={x:.5,y:.5};const $e=c*.75+6;const Ke=false;const le="@react_buoy_settings_tooltip_shown";const Ye=y=>({id:`empty-${y}`,name:`empty-${y}`,icon:null,color:"transparent",onPress:()=>{}});export const DialDevTools=({onClose:y,onSettingsPress:ce,autoOpenSettings:z=false,apps:L,state:Ze,actions:U})=>{const[de,ue]=w(-1);const[g,T]=w(false);const[W,ge]=w(false);const[q,H]=w(false);const A=f(false);const $=Ge();const{refreshSettings:pe}=Fe();const{open:K}=ze();const{isPro:me,isWeekendFree:Y}=je();const{width:V,height:fe}=Be();const d=We({screenWidth:V}).circleSize;const{id:he}=_e();const p=S(()=>({parent:{width:d,height:d},circle:{width:d,height:d,borderRadius:d/2},rounded:{borderRadius:d/2},gridLine:{width:d},spoke:{width:d/2-$e}}),[d]);b(()=>{const t=async()=>{try{const e=await R.getItem(ie.settings.modalOpen());if(e==="true"){T(true)}}catch(e){}finally{ge(true)}};t()},[]);b(()=>{if(!W)return;R.setItem(ie.settings.modalOpen(),g?"true":"false").catch(t=>{console.warn("Failed to save settings modal state:",t)})},[g,W]);b(()=>{if(z&&!g){T(true)}},[z,g]);b(()=>{if($){return}const t=async()=>{try{const e=await R.getItem(le);if(!e){setTimeout(()=>{H(true)},1200)}}catch(e){}};t()},[$]);const N=f(new o.Value(0)).current;const k=f(new o.Value(0)).current;const G=f(new o.Value(0)).current;const D=f(new o.Value(0)).current;const O=f(new o.Value(0)).current;const M=f(new o.Value(1)).current;const ye=S(()=>L.map(({id:t,name:e,slot:r,description:I,icon:xe,color:Ce})=>({id:t,name:e,slot:r,description:I,icon:xe,color:Ce})),[L]);const x=f(null);const be=()=>{if(g){T(false);return}T(true);if(q&&!A.current){Q()}ce?.()};const C=S(()=>L.filter(t=>(t.slot??"both")!=="row"),[L]);const Z=S(()=>{const t=new Map;for(const e of C){t.set(e.id,{id:e.id,name:e.name,icon:typeof e.icon==="function"?null:ae(e.icon,{slot:"dial",size:20,color:e.color}),iconComponent:typeof e.icon==="function"?e.icon:void 0,color:e.color??re.primary,onPress:()=>{void Ne(e.id);e?.onPress?.(U);if(e.launchMode!=="toggle-only"){const r=ae(e.icon,{slot:"dial",size:20,color:e.color});K({id:e.id,title:e.name,component:e.component,props:e.props,launchMode:e.launchMode??"self-modal",singleton:e.singleton??true,icon:r,color:e.color,modal:e.modal})}y?.()}})}return t},[C,U,K,y]);const[_,X]=w(()=>F(C.map(t=>t.id)));b(()=>{const t=C.map(r=>r.id);if(Ae()){X(F(t));return}let e=false;Ve().then(()=>{if(!e)X(F(t))});return()=>{e=true}},[C]);const B=Math.max(1,Math.ceil(_.length/v));const[Se,we]=w(0);const m=Math.min(Se,B-1);const E=S(()=>{return _.map(t=>Z.get(t)).filter(t=>Boolean(t)).map((t,e)=>({icon:t,page:Math.floor(e/v),slot:e%v}))},[_,Z]);const ve=S(()=>{const t=E.filter(r=>r.page===m).length;const e=[];for(let r=t;r<v;r+=1)e.push(r);return e},[E,m]);const J=t=>{const e=Math.max(0,Math.min(t,B-1));if(e!==m)we(e)};b(()=>{const t=j??{entrance:{backdrop:{duration:400},dial:{scale:{damping:15,stiffness:150,mass:1},rotation:{duration:800}},centerButton:{delay:150,damping:10,stiffness:200},icons:{delay:200,duration:400},circuitTraces:{delay:600,duration:1e3}},continuous:{glitch:{interval:3e3,offset:2,stepDuration:50},pulse:{maxScale:1.02,minScale:.98,duration:1e3},floating:{maxY:-8,minY:0,duration:3e3},breathing:{maxScale:1.05,minScale:.98,duration:2500}}};const{entrance:e,continuous:r}=t;o.timing(N,{toValue:1,duration:e.backdrop.duration,useNativeDriver:true}).start();o.spring(k,{toValue:1,damping:e.dial.scale.damping,stiffness:e.dial.scale.stiffness,mass:e.dial.scale.mass,useNativeDriver:true}).start();o.sequence([o.timing(G,{toValue:1,duration:e.dial.rotation.duration,easing:l.out(l.cubic),useNativeDriver:true}),o.timing(G,{toValue:0,duration:0,useNativeDriver:true})]).start();o.sequence([o.delay(e.centerButton.delay),o.spring(D,{toValue:1,damping:e.centerButton.damping,stiffness:e.centerButton.stiffness,useNativeDriver:true})]).start();o.sequence([o.delay(e.icons.delay),o.timing(O,{toValue:1,duration:e.icons.duration,easing:l.out(l.cubic),useNativeDriver:true})]).start();if(!Ke)return;x.current=o.loop(o.sequence([o.timing(M,{toValue:r.pulse.maxScale,duration:r.pulse.duration,easing:l.inOut(l.ease),useNativeDriver:true}),o.timing(M,{toValue:r.pulse.minScale,duration:r.pulse.duration,easing:l.inOut(l.ease),useNativeDriver:true})]));x.current.start();return()=>{x.current?.stop()}},[]);const Q=()=>{A.current=true;H(false);R.setItem(le,"true").catch(t=>{console.warn("Failed to save dial onboarding state:",t)})};const ee=()=>{if(x.current){x.current.stop()}const t=j?.exit??{icons:{duration:300},centerButton:{duration:200},dialScale:{duration:250},backdrop:{duration:200}};o.sequence([o.timing(O,{toValue:0,duration:t.icons.duration,easing:l.in(l.cubic),useNativeDriver:true}),o.parallel([o.timing(D,{toValue:0,duration:t.centerButton.duration,easing:l.in(l.cubic),useNativeDriver:true}),o.timing(k,{toValue:0,duration:t.dialScale.duration,easing:l.in(l.cubic),useNativeDriver:true})]),o.timing(N,{toValue:0,duration:t.backdrop.duration,useNativeDriver:true})]).start(()=>{if(y){setTimeout(()=>{y()},0)}})};const te=t=>{ue(1);const e=j?.interaction??{iconSelect:{pulse:[{scale:.9,damping:15,stiffness:500},{scale:1,damping:10,stiffness:200}],actionDelay:50}};const[r,I]=e.iconSelect.pulse;o.sequence([o.spring(D,{toValue:r.scale,damping:r.damping,stiffness:r.stiffness,useNativeDriver:true}),o.spring(D,{toValue:I.scale,damping:I.damping,stiffness:I.stiffness,useNativeDriver:true})]).start();setTimeout(()=>{t.onPress();if(t.id!=="wifi"){ee()}},e.iconSelect.actionDelay)};const Te={opacity:N};const ke={transform:[{scale:D}]};const De={transform:[{scale:de>=0?1:M}]};return h(s,{style:n.container,nativeID:"dial-devtools-root",children:[i(o.View,{style:[n.backdrop,Te],children:i(Ie,{style:u,onPress:ee})}),h(o.View,{style:[n.parent,p.parent,{position:"absolute",left:(V-d)/2,bottom:80,transform:[{scale:k},{rotate:G.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]}],children:[h(o.View,{style:[n.circle,p.circle],children:[h(s,{style:[n.gradientBackground,p.rounded],children:[i(s,{style:[n.gradientLayer1,p.rounded]}),i(s,{style:[n.gradientLayer2,p.rounded]}),i(s,{style:[n.gradientLayer3,p.rounded]}),i(s,{style:n.gridPattern,children:Array.from({length:6}).map((t,e)=>h(s,{style:[n.gridLine,p.gridLine,{transform:[{rotate:`${e*60}deg`}]}],children:[i(s,{style:[n.spoke,p.spoke,n.spokeLeft]}),i(s,{style:[n.spoke,p.spoke,n.spokeRight]})]},e))}),he==="hyperspace"?i(Pe,{size:d}):i(Me,{focus:He})]}),E.filter(({page:t})=>t===m).map(({icon:t,slot:e})=>i(ne,{onPress:te,iconsProgress:O,icon:t,index:e,totalIcons:v,active:true},t.id??`page${m}-${e}`)),ve.map(t=>i(ne,{onPress:te,iconsProgress:O,icon:Ye(t),index:t,totalIcons:v,active:true},`empty-${t}`))]}),i(o.View,{style:[n.buttonContainer,ke],children:h(s,{style:n.buttonGradient,children:[i(s,{style:n.buttonGradientLayer1}),i(s,{style:n.buttonGradientLayer2}),i(s,{style:n.buttonGradientLayer3}),i(s,{style:n.buttonBorder,children:i(o.View,{style:[n.button,De],children:i(Oe,{accessibilityRole:"button",accessibilityLabel:g?"Close Settings":"Open Dev Tools Settings",onPress:be,activeOpacity:.5,style:n.buttonPressable,children:g?h(se,{children:[i(P,{style:[n.centerText,n.closeTextTop],children:"CLOSE"}),i(P,{style:[n.centerText,n.closeTextBottom],children:"SETTINGS"})]}):h(se,{children:[i(P,{style:n.centerText,children:"BUOY"}),me&&i(P,{style:[n.proText,Y&&n.weekendText],children:Y?"WEEKEND":"PRO"})]})})})})]})})]}),B>1&&i(Re,{page:m,pageCount:B,onPrev:()=>J(m-1),onNext:()=>J(m+1),animatedStyle:{position:"absolute",left:(V-d)/2,top:fe-80+16,width:d,opacity:k,transform:[{scale:k}]}}),g&&i(Ee,{visible:true,onClose:()=>{T(false);pe()},availableApps:ye}),q&&!g&&!A.current&&i(Ue,{visible:true,onDismiss:Q})]})};const n=Le.create({container:{...u,zIndex:9999},backdrop:{...u,backgroundColor:a.dialBackdrop},parent:{alignItems:"center",justifyContent:"center"},circle:{position:"absolute",backgroundColor:"transparent",borderWidth:1,borderColor:a.dialBorder,shadowColor:a.dialShadow,shadowOffset:{width:0,height:0},shadowOpacity:.5,shadowRadius:20,elevation:10},gradientBackground:{width:"100%",height:"100%",position:"relative",backgroundColor:a.dialBackground,overflow:"hidden"},gradientLayer1:{...u,backgroundColor:a.dialGradient1,opacity:.6},gradientLayer2:{...u,backgroundColor:a.dialGradient2,opacity:.4,top:"30%",left:"30%"},gradientLayer3:{...u,backgroundColor:a.dialGradient3,opacity:.3,top:"50%",left:"50%"},gridPattern:{...u,alignItems:"center",justifyContent:"center"},gridLine:{position:"absolute",height:1},spoke:{position:"absolute",top:0,height:1,backgroundColor:a.dialGridLine},spokeLeft:{left:0},spokeRight:{right:0},buttonContainer:{zIndex:1,backgroundColor:"transparent",alignItems:"center",justifyContent:"center",position:"absolute",width:c*1.5,height:c*1.5,borderRadius:c},buttonGradient:{width:"100%",height:"100%",borderRadius:c,alignItems:"center",justifyContent:"center",padding:4,backgroundColor:a.hubHalo,position:"relative",overflow:"hidden"},buttonGradientLayer1:{...u,backgroundColor:a.dialGradient1,opacity:.5,borderRadius:c},buttonGradientLayer2:{...u,backgroundColor:a.dialGradient2,opacity:.3,top:"20%",left:"20%",borderRadius:c},buttonGradientLayer3:{...u,backgroundColor:a.dialGradient3,opacity:.2,top:"40%",left:"40%",borderRadius:c},buttonBorder:{backgroundColor:a.hubFill,alignItems:"center",justifyContent:"center",width:c*1.2,height:c*1.2,borderRadius:c*.6},button:{width:c,height:c,borderRadius:c/2,justifyContent:"center",alignItems:"center",position:"relative",overflow:"hidden"},buttonPressable:{width:"100%",height:"100%",justifyContent:"center",alignItems:"center"},centerText:{color:a.centerText,fontSize:10,fontWeight:"900",fontFamily:oe,letterSpacing:1,textAlign:"center",textTransform:"uppercase",textShadowColor:a.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},closeTextTop:{marginBottom:-2},closeTextBottom:{marginTop:-2},proText:{color:re.warning,fontSize:8,fontWeight:"900",fontFamily:oe,letterSpacing:2,textAlign:"center",textShadowColor:a.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},weekendText:{color:"#BF5AF2",letterSpacing:1}});
|
|
1
|
+
"use strict";import{useEffect as b,useMemo as S,useRef as f,useState as w}from"react";import{Pressable as Ie,StyleSheet as Le,TouchableOpacity as Be,View as s,useWindowDimensions as Oe,Text as P,Animated as o,Easing as l}from"react-native";import{absoluteFill as u,monoFont as oe}from"@buoy-gg/shared-ui";import{DialIcon as ne}from"./DialIcon.js";import{DialHyperspace as Pe}from"./DialHyperspace.js";import{DialPagination as Re}from"./DialPagination.js";import{getRankedToolIds as F,isDialUsageLoaded as Ae,loadDialUsage as Ve,recordToolUsage as Ne}from"./dialUsageStore.js";import{persistentStorage as R,useHintsDisabled as Ge,devToolsStorageKeys as ie,buoyColors as re,ToolBackground as Me,useToolBackground as _e}from"@buoy-gg/shared-ui";import{DevToolsSettingsModal as Ee,useDevToolsSettings as Fe}from"../DevToolsSettingsModal";import{useProAccess as je}from"@buoy-gg/license";import{renderAppIcon as ae}from"../AppIcon";import{useAppHost as ze}from"../AppHost";import{OnboardingTooltip as Ue}from"./OnboardingTooltip";import{getDialLayout as We,MAX_DIAL_SLOTS as v,DIAL_BUTTON_SIZE as qe,dialAnimationConfig as j,dialColors as a}from"@buoy-gg/floating-tools-core";import{jsx as i,jsxs as h,Fragment as se}from"react/jsx-runtime";const c=qe;const He={x:.5,y:.5};const $e=c*.75+6;const Ke=false;const le="@react_buoy_settings_tooltip_shown";const Ye=y=>({id:`empty-${y}`,name:`empty-${y}`,icon:null,color:"transparent",onPress:()=>{}});export const DialDevTools=({onClose:y,onSettingsPress:ce,autoOpenSettings:z=false,apps:L,state:Ze,actions:U})=>{const[de,ue]=w(-1);const[g,T]=w(false);const[W,ge]=w(false);const[q,H]=w(false);const A=f(false);const $=Ge();const{refreshSettings:pe}=Fe();const{open:K}=ze();const{isPro:me,isWeekendFree:Y}=je();const{width:V,height:fe}=Oe();const d=We({screenWidth:V}).circleSize;const{id:he}=_e();const p=S(()=>({parent:{width:d,height:d},circle:{width:d,height:d,borderRadius:d/2},rounded:{borderRadius:d/2},gridLine:{width:d},spoke:{width:d/2-$e}}),[d]);b(()=>{const t=async()=>{try{const e=await R.getItem(ie.settings.modalOpen());if(e==="true"){T(true)}}catch(e){}finally{ge(true)}};t()},[]);b(()=>{if(!W)return;R.setItem(ie.settings.modalOpen(),g?"true":"false").catch(t=>{console.warn("[Buoy]","Failed to save settings modal state:",t)})},[g,W]);b(()=>{if(z&&!g){T(true)}},[z,g]);b(()=>{if($){return}const t=async()=>{try{const e=await R.getItem(le);if(!e){setTimeout(()=>{H(true)},1200)}}catch(e){}};t()},[$]);const N=f(new o.Value(0)).current;const k=f(new o.Value(0)).current;const G=f(new o.Value(0)).current;const D=f(new o.Value(0)).current;const B=f(new o.Value(0)).current;const M=f(new o.Value(1)).current;const ye=S(()=>L.map(({id:t,name:e,slot:r,description:I,icon:xe,color:Ce})=>({id:t,name:e,slot:r,description:I,icon:xe,color:Ce})),[L]);const x=f(null);const be=()=>{if(g){T(false);return}T(true);if(q&&!A.current){Q()}ce?.()};const C=S(()=>L.filter(t=>(t.slot??"both")!=="row"),[L]);const Z=S(()=>{const t=new Map;for(const e of C){t.set(e.id,{id:e.id,name:e.name,icon:typeof e.icon==="function"?null:ae(e.icon,{slot:"dial",size:20,color:e.color}),iconComponent:typeof e.icon==="function"?e.icon:void 0,color:e.color??re.primary,onPress:()=>{void Ne(e.id);e?.onPress?.(U);if(e.launchMode!=="toggle-only"){const r=ae(e.icon,{slot:"dial",size:20,color:e.color});K({id:e.id,title:e.name,component:e.component,props:e.props,launchMode:e.launchMode??"self-modal",singleton:e.singleton??true,icon:r,color:e.color,modal:e.modal})}y?.()}})}return t},[C,U,K,y]);const[_,X]=w(()=>F(C.map(t=>t.id)));b(()=>{const t=C.map(r=>r.id);if(Ae()){X(F(t));return}let e=false;Ve().then(()=>{if(!e)X(F(t))});return()=>{e=true}},[C]);const O=Math.max(1,Math.ceil(_.length/v));const[Se,we]=w(0);const m=Math.min(Se,O-1);const E=S(()=>{return _.map(t=>Z.get(t)).filter(t=>Boolean(t)).map((t,e)=>({icon:t,page:Math.floor(e/v),slot:e%v}))},[_,Z]);const ve=S(()=>{const t=E.filter(r=>r.page===m).length;const e=[];for(let r=t;r<v;r+=1)e.push(r);return e},[E,m]);const J=t=>{const e=Math.max(0,Math.min(t,O-1));if(e!==m)we(e)};b(()=>{const t=j??{entrance:{backdrop:{duration:400},dial:{scale:{damping:15,stiffness:150,mass:1},rotation:{duration:800}},centerButton:{delay:150,damping:10,stiffness:200},icons:{delay:200,duration:400},circuitTraces:{delay:600,duration:1e3}},continuous:{glitch:{interval:3e3,offset:2,stepDuration:50},pulse:{maxScale:1.02,minScale:.98,duration:1e3},floating:{maxY:-8,minY:0,duration:3e3},breathing:{maxScale:1.05,minScale:.98,duration:2500}}};const{entrance:e,continuous:r}=t;o.timing(N,{toValue:1,duration:e.backdrop.duration,useNativeDriver:true}).start();o.spring(k,{toValue:1,damping:e.dial.scale.damping,stiffness:e.dial.scale.stiffness,mass:e.dial.scale.mass,useNativeDriver:true}).start();o.sequence([o.timing(G,{toValue:1,duration:e.dial.rotation.duration,easing:l.out(l.cubic),useNativeDriver:true}),o.timing(G,{toValue:0,duration:0,useNativeDriver:true})]).start();o.sequence([o.delay(e.centerButton.delay),o.spring(D,{toValue:1,damping:e.centerButton.damping,stiffness:e.centerButton.stiffness,useNativeDriver:true})]).start();o.sequence([o.delay(e.icons.delay),o.timing(B,{toValue:1,duration:e.icons.duration,easing:l.out(l.cubic),useNativeDriver:true})]).start();if(!Ke)return;x.current=o.loop(o.sequence([o.timing(M,{toValue:r.pulse.maxScale,duration:r.pulse.duration,easing:l.inOut(l.ease),useNativeDriver:true}),o.timing(M,{toValue:r.pulse.minScale,duration:r.pulse.duration,easing:l.inOut(l.ease),useNativeDriver:true})]));x.current.start();return()=>{x.current?.stop()}},[]);const Q=()=>{A.current=true;H(false);R.setItem(le,"true").catch(t=>{console.warn("[Buoy]","Failed to save dial onboarding state:",t)})};const ee=()=>{if(x.current){x.current.stop()}const t=j?.exit??{icons:{duration:300},centerButton:{duration:200},dialScale:{duration:250},backdrop:{duration:200}};o.sequence([o.timing(B,{toValue:0,duration:t.icons.duration,easing:l.in(l.cubic),useNativeDriver:true}),o.parallel([o.timing(D,{toValue:0,duration:t.centerButton.duration,easing:l.in(l.cubic),useNativeDriver:true}),o.timing(k,{toValue:0,duration:t.dialScale.duration,easing:l.in(l.cubic),useNativeDriver:true})]),o.timing(N,{toValue:0,duration:t.backdrop.duration,useNativeDriver:true})]).start(()=>{if(y){setTimeout(()=>{y()},0)}})};const te=t=>{ue(1);const e=j?.interaction??{iconSelect:{pulse:[{scale:.9,damping:15,stiffness:500},{scale:1,damping:10,stiffness:200}],actionDelay:50}};const[r,I]=e.iconSelect.pulse;o.sequence([o.spring(D,{toValue:r.scale,damping:r.damping,stiffness:r.stiffness,useNativeDriver:true}),o.spring(D,{toValue:I.scale,damping:I.damping,stiffness:I.stiffness,useNativeDriver:true})]).start();setTimeout(()=>{t.onPress();if(t.id!=="wifi"){ee()}},e.iconSelect.actionDelay)};const Te={opacity:N};const ke={transform:[{scale:D}]};const De={transform:[{scale:de>=0?1:M}]};return h(s,{style:n.container,nativeID:"dial-devtools-root",children:[i(o.View,{style:[n.backdrop,Te],children:i(Ie,{style:u,onPress:ee})}),h(o.View,{style:[n.parent,p.parent,{position:"absolute",left:(V-d)/2,bottom:80,transform:[{scale:k},{rotate:G.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]}],children:[h(o.View,{style:[n.circle,p.circle],children:[h(s,{style:[n.gradientBackground,p.rounded],children:[i(s,{style:[n.gradientLayer1,p.rounded]}),i(s,{style:[n.gradientLayer2,p.rounded]}),i(s,{style:[n.gradientLayer3,p.rounded]}),i(s,{style:n.gridPattern,children:Array.from({length:6}).map((t,e)=>h(s,{style:[n.gridLine,p.gridLine,{transform:[{rotate:`${e*60}deg`}]}],children:[i(s,{style:[n.spoke,p.spoke,n.spokeLeft]}),i(s,{style:[n.spoke,p.spoke,n.spokeRight]})]},e))}),he==="hyperspace"?i(Pe,{size:d}):i(Me,{focus:He})]}),E.filter(({page:t})=>t===m).map(({icon:t,slot:e})=>i(ne,{onPress:te,iconsProgress:B,icon:t,index:e,totalIcons:v,active:true},t.id??`page${m}-${e}`)),ve.map(t=>i(ne,{onPress:te,iconsProgress:B,icon:Ye(t),index:t,totalIcons:v,active:true},`empty-${t}`))]}),i(o.View,{style:[n.buttonContainer,ke],children:h(s,{style:n.buttonGradient,children:[i(s,{style:n.buttonGradientLayer1}),i(s,{style:n.buttonGradientLayer2}),i(s,{style:n.buttonGradientLayer3}),i(s,{style:n.buttonBorder,children:i(o.View,{style:[n.button,De],children:i(Be,{accessibilityRole:"button",accessibilityLabel:g?"Close Settings":"Open Dev Tools Settings",onPress:be,activeOpacity:.5,style:n.buttonPressable,children:g?h(se,{children:[i(P,{style:[n.centerText,n.closeTextTop],children:"CLOSE"}),i(P,{style:[n.centerText,n.closeTextBottom],children:"SETTINGS"})]}):h(se,{children:[i(P,{style:n.centerText,children:"BUOY"}),me&&i(P,{style:[n.proText,Y&&n.weekendText],children:Y?"WEEKEND":"PRO"})]})})})})]})})]}),O>1&&i(Re,{page:m,pageCount:O,onPrev:()=>J(m-1),onNext:()=>J(m+1),animatedStyle:{position:"absolute",left:(V-d)/2,top:fe-80+16,width:d,opacity:k,transform:[{scale:k}]}}),g&&i(Ee,{visible:true,onClose:()=>{T(false);pe()},availableApps:ye}),q&&!g&&!A.current&&i(Ue,{visible:true,onDismiss:Q})]})};const n=Le.create({container:{...u,zIndex:9999},backdrop:{...u,backgroundColor:a.dialBackdrop},parent:{alignItems:"center",justifyContent:"center"},circle:{position:"absolute",backgroundColor:"transparent",borderWidth:1,borderColor:a.dialBorder,shadowColor:a.dialShadow,shadowOffset:{width:0,height:0},shadowOpacity:.5,shadowRadius:20,elevation:10},gradientBackground:{width:"100%",height:"100%",position:"relative",backgroundColor:a.dialBackground,overflow:"hidden"},gradientLayer1:{...u,backgroundColor:a.dialGradient1,opacity:.6},gradientLayer2:{...u,backgroundColor:a.dialGradient2,opacity:.4,top:"30%",left:"30%"},gradientLayer3:{...u,backgroundColor:a.dialGradient3,opacity:.3,top:"50%",left:"50%"},gridPattern:{...u,alignItems:"center",justifyContent:"center"},gridLine:{position:"absolute",height:1},spoke:{position:"absolute",top:0,height:1,backgroundColor:a.dialGridLine},spokeLeft:{left:0},spokeRight:{right:0},buttonContainer:{zIndex:1,backgroundColor:"transparent",alignItems:"center",justifyContent:"center",position:"absolute",width:c*1.5,height:c*1.5,borderRadius:c},buttonGradient:{width:"100%",height:"100%",borderRadius:c,alignItems:"center",justifyContent:"center",padding:4,backgroundColor:a.hubHalo,position:"relative",overflow:"hidden"},buttonGradientLayer1:{...u,backgroundColor:a.dialGradient1,opacity:.5,borderRadius:c},buttonGradientLayer2:{...u,backgroundColor:a.dialGradient2,opacity:.3,top:"20%",left:"20%",borderRadius:c},buttonGradientLayer3:{...u,backgroundColor:a.dialGradient3,opacity:.2,top:"40%",left:"40%",borderRadius:c},buttonBorder:{backgroundColor:a.hubFill,alignItems:"center",justifyContent:"center",width:c*1.2,height:c*1.2,borderRadius:c*.6},button:{width:c,height:c,borderRadius:c/2,justifyContent:"center",alignItems:"center",position:"relative",overflow:"hidden"},buttonPressable:{width:"100%",height:"100%",justifyContent:"center",alignItems:"center"},centerText:{color:a.centerText,fontSize:10,fontWeight:"900",fontFamily:oe,letterSpacing:1,textAlign:"center",textTransform:"uppercase",textShadowColor:a.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},closeTextTop:{marginBottom:-2},closeTextBottom:{marginTop:-2},proText:{color:re.warning,fontSize:8,fontWeight:"900",fontFamily:oe,letterSpacing:2,textAlign:"center",textShadowColor:a.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},weekendText:{color:"#BF5AF2",letterSpacing:1}});
|
package/lib/module/index.web.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{FloatingDevTools}from"./floatingMenu/FloatingDevTools.web.js";export{createWebTool}from"./utils/createWebTool.js";export{clearReleaseOptIn}from"./releaseOptIn.js";export{isBuoyHoldingBackButton}from"./floatingMenu/capacitorBackButton.js";export{FloatingTools,UserStatus,Divider}from"./floatingMenu/floatingTools.web.js";export{DialMenu}from"./floatingMenu/dial/DialDevTools.web.js";export{SettingsModal}from"./floatingMenu/DevToolsSettingsModal.web.js";export{AppHostProvider,AppOverlay,useAppHost}from"./floatingMenu/AppHost.web.js";export{autoDiscoverWebPresets,autoDiscoverWithCustom,getToolsBySlot,getEnabledTools,defaultToolPresets}from"./utils/autoDiscoverPresets.web.js";export{useSettings,useFloatingTools,getToolLabel,getToolDescription,getToolColor,settingsColors,settingsStyles,dialColors,dialStyles}from"@buoy-gg/floating-tools-react";export{createWebTools}from"./utils/createWebTools.js";export*from"./toolkit.js";export{useToolHost,useToolHeader}from"./floatingMenu/ToolHost.js";export{DevToolsVisibilityProvider,useDevToolsVisibility}from"./floatingMenu/DevToolsVisibilityContext.js";export{appSyncAdapter}from"./floatingMenu/sync/appSyncAdapter.js";export{LicenseManager}from"@buoy-gg/license";
|
|
1
|
+
"use strict";export{FloatingDevTools}from"./floatingMenu/FloatingDevTools.web.js";export{createWebTool}from"./utils/createWebTool.js";export{clearReleaseOptIn}from"./releaseOptIn.js";export{isBuoyHoldingBackButton}from"./floatingMenu/capacitorBackButton.js";export{FloatingTools,UserStatus,Divider}from"./floatingMenu/floatingTools.web.js";export{DialMenu}from"./floatingMenu/dial/DialDevTools.web.js";export{SettingsModal}from"./floatingMenu/DevToolsSettingsModal.web.js";export{AppHostProvider,AppOverlay,useAppHost}from"./floatingMenu/AppHost.web.js";export{autoDiscoverWebPresets,autoDiscoverWithCustom,getToolsBySlot,getEnabledTools,defaultToolPresets}from"./utils/autoDiscoverPresets.web.js";export{useSettings,useFloatingTools,getToolLabel,getToolDescription,getToolColor,settingsColors,settingsStyles,dialColors,dialStyles}from"@buoy-gg/floating-tools-react";export{createWebTools}from"./utils/createWebTools.js";export*from"./toolkit.js";export{useToolHost,useToolHeader}from"./floatingMenu/ToolHost.js";export{DevToolsVisibilityProvider,useDevToolsVisibility}from"./floatingMenu/DevToolsVisibilityContext.js";export{appSyncAdapter}from"./floatingMenu/sync/appSyncAdapter.js";export{LicenseManager}from"@buoy-gg/license";export{mountBuoy}from"./mountBuoy.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{createRoot as i}from"react-dom/client";import{createElement as s}from"react";import{FloatingDevTools as c}from"./floatingMenu/FloatingDevTools.web.js";import{jsx as l}from"react/jsx-runtime";export function mountBuoy({queryClient:t,...o}={}){const r=Object.values(o.modules??{}).find(d=>d.QueryClientProvider)?.QueryClientProvider;if(t&&!r)throw new Error("Add the react-query tool to modules to use queryClient.");const e=document.createElement("div");e.dataset.buoyMount="";document.body.appendChild(e);const n=i(e);const u=l(c,{...o});n.render(t?s(r,{client:t},u):u);let m=true;return()=>{if(!m)return;m=false;n.unmount();e.remove()}}
|