@buoy-gg/core 7.0.77 → 7.0.79

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.
Files changed (60) hide show
  1. package/bundlers/vite.d.ts +1 -1
  2. package/bundlers/vite.mjs +3 -3
  3. package/lib/commonjs/earlyNetwork.js +1 -1
  4. package/lib/commonjs/floatingMenu/AppHost.js +1 -1
  5. package/lib/commonjs/floatingMenu/AppHost.web.js +1 -1
  6. package/lib/commonjs/floatingMenu/AppHostLogic.js +1 -1
  7. package/lib/commonjs/floatingMenu/DevToolsSettingsModal.shared.js +1 -1
  8. package/lib/commonjs/floatingMenu/FloatingDevTools.js +1 -1
  9. package/lib/commonjs/floatingMenu/FloatingDevTools.web.js +1 -1
  10. package/lib/commonjs/floatingMenu/autoDiscoverPresets.js +1 -1
  11. package/lib/commonjs/floatingMenu/autoExternalSync.js +1 -1
  12. package/lib/commonjs/floatingMenu/backTarget.js +1 -0
  13. package/lib/commonjs/floatingMenu/capacitorBackButton.js +1 -1
  14. package/lib/commonjs/floatingMenu/dial/DialDevTools.js +1 -1
  15. package/lib/commonjs/floatingMenu/dial/DialDevTools.web.js +1 -1
  16. package/lib/commonjs/floatingMenu/externalSyncGate.js +1 -1
  17. package/lib/commonjs/floatingMenu/hardwareBack.js +1 -0
  18. package/lib/commonjs/version.js +1 -1
  19. package/lib/module/earlyNetwork.js +1 -1
  20. package/lib/module/floatingMenu/AppHost.js +1 -1
  21. package/lib/module/floatingMenu/AppHost.web.js +1 -1
  22. package/lib/module/floatingMenu/AppHostLogic.js +1 -1
  23. package/lib/module/floatingMenu/DevToolsSettingsModal.shared.js +1 -1
  24. package/lib/module/floatingMenu/FloatingDevTools.js +1 -1
  25. package/lib/module/floatingMenu/FloatingDevTools.web.js +1 -1
  26. package/lib/module/floatingMenu/autoDiscoverPresets.js +1 -1
  27. package/lib/module/floatingMenu/autoExternalSync.js +1 -1
  28. package/lib/module/floatingMenu/backTarget.js +1 -0
  29. package/lib/module/floatingMenu/capacitorBackButton.js +1 -1
  30. package/lib/module/floatingMenu/dial/DialDevTools.js +1 -1
  31. package/lib/module/floatingMenu/dial/DialDevTools.web.js +1 -1
  32. package/lib/module/floatingMenu/externalSyncGate.js +1 -1
  33. package/lib/module/floatingMenu/hardwareBack.js +1 -0
  34. package/lib/module/version.js +1 -1
  35. package/lib/typescript/commonjs/earlyNetwork.d.ts +19 -4
  36. package/lib/typescript/commonjs/floatingMenu/AppHostLogic.d.ts +6 -0
  37. package/lib/typescript/commonjs/floatingMenu/backTarget.d.ts +17 -0
  38. package/lib/typescript/commonjs/floatingMenu/capacitorBackButton.d.ts +5 -3
  39. package/lib/typescript/commonjs/floatingMenu/defaultConfig.d.ts +1 -1
  40. package/lib/typescript/commonjs/floatingMenu/hardwareBack.d.ts +8 -0
  41. package/lib/typescript/commonjs/version.d.ts +1 -1
  42. package/lib/typescript/module/earlyNetwork.d.ts +19 -4
  43. package/lib/typescript/module/floatingMenu/AppHostLogic.d.ts +6 -0
  44. package/lib/typescript/module/floatingMenu/backTarget.d.ts +17 -0
  45. package/lib/typescript/module/floatingMenu/capacitorBackButton.d.ts +5 -3
  46. package/lib/typescript/module/floatingMenu/defaultConfig.d.ts +1 -1
  47. package/lib/typescript/module/floatingMenu/hardwareBack.d.ts +8 -0
  48. package/lib/typescript/module/version.d.ts +1 -1
  49. package/lib/web/auto.mjs +1 -1
  50. package/lib/web/chunks/{FloatingDevTools.web-IIOOVSUC.mjs → FloatingDevTools.web-5EMC7ZIE.mjs} +1 -1
  51. package/lib/web/chunks/FloatingDevTools.web-QLTO5FXP.mjs +1 -0
  52. package/lib/web/chunks/chunk-EFTCKGMC.mjs +10 -0
  53. package/lib/web/chunks/chunk-JXTHZBMM.mjs +10 -0
  54. package/lib/web/chunks/chunk-OXRZOHYP.mjs +1 -0
  55. package/lib/web/index.mjs +1 -1
  56. package/lib/web/register-network.mjs +1 -1
  57. package/lib/web/register.mjs +1 -1
  58. package/package.json +5 -5
  59. package/lib/web/chunks/chunk-5EUMNDI5.mjs +0 -1
  60. package/lib/web/chunks/chunk-LAJ3HKAL.mjs +0 -10
@@ -1 +1 @@
1
- "use strict";import{useEffect as O,useMemo as Q,useRef as V}from"react";import{Platform as H}from"react-native";import{LicenseManager as $}from"@buoy-gg/license";import{reportOptionalRequireError as r}from"./optionalRequire.js";import{appSyncAdapter as W}from"./sync/appSyncAdapter.js";import{useDeviceIdentity as X}from"./deviceIdentity.js";import{applyReleaseActionPolicy as Y}from"./externalSyncGate.js";import{applyDefaultLicenseKey as Z}from"../Buoy.js";import{registerToolAdapters as ee}from"@buoy-gg/shared-ui";Z();let s=null;let g=null;let d=null;let p=null;let f=null;let b=null;let m=null;let S=null;let A=null;let h=null;let M=null;let v=null;let q=null;let k=null;let x=null;let R=null;try{R=require("@buoy-gg/notifications")}catch(e){r("@buoy-gg/notifications",e)}let j=null;let E=null;let L=null;let I=null;let w=null;let T=null;let _=null;let z=null;let B=null;let D=null;let i=null;try{s=require("@buoy-gg/external-sync")}catch(e){r("@buoy-gg/external-sync",e)}try{g=require("@buoy-gg/storage")}catch(e){r("@buoy-gg/storage",e)}try{d=require("@buoy-gg/network")}catch(e){r("@buoy-gg/network",e)}try{p=require("@buoy-gg/react-query")}catch(e){r("@buoy-gg/react-query",e)}try{f=require("@buoy-gg/route-events")}catch(e){r("@buoy-gg/route-events",e)}try{b=require("@buoy-gg/redux")}catch(e){r("@buoy-gg/redux",e)}try{m=require("@buoy-gg/zustand")}catch(e){r("@buoy-gg/zustand",e)}try{S=require("@buoy-gg/jotai")}catch(e){r("@buoy-gg/jotai",e)}try{A=require("@buoy-gg/events")}catch(e){r("@buoy-gg/events",e)}try{h=require("@buoy-gg/console")}catch(e){r("@buoy-gg/console",e)}try{M=require("@buoy-gg/clock")}catch(e){r("@buoy-gg/clock",e)}try{q=require("@buoy-gg/lifecycle")}catch(e){r("@buoy-gg/lifecycle",e)}try{k=require("@buoy-gg/location")}catch(e){r("@buoy-gg/location",e)}try{v=require("@buoy-gg/permissions")}catch(e){r("@buoy-gg/permissions",e)}try{x=require("@buoy-gg/sentry")}catch(e){r("@buoy-gg/sentry",e)}try{j=require("@buoy-gg/env")}catch(e){r("@buoy-gg/env",e)}try{E=require("@buoy-gg/highlight-updates")}catch(e){r("@buoy-gg/highlight-updates",e)}try{L=require("@buoy-gg/debug-borders")}catch(e){r("@buoy-gg/debug-borders",e)}try{I=require("@buoy-gg/impersonate")}catch(e){r("@buoy-gg/impersonate",e)}try{w=require("@buoy-gg/perf-monitor")}catch(e){r("@buoy-gg/perf-monitor",e)}try{T=require("@buoy-gg/js-top")}catch(e){r("@buoy-gg/js-top",e)}try{_=require("@buoy-gg/images")}catch(e){r("@buoy-gg/images",e)}try{z=require("@buoy-gg/assets")}catch(e){r("@buoy-gg/assets",e)}try{B=require("@buoy-gg/tv-remote")}catch(e){r("@buoy-gg/tv-remote",e)}try{D=require("@buoy-gg/focus-inspector")}catch(e){r("@buoy-gg/focus-inspector",e)}try{i=require("expo-constants")}catch(e){r("expo-constants",e)}export function isExternalSyncAvailable(){return!!s?.useExternalSyncSocket}function te(){const e=i?.default??i;return e?.expoConfig?.name??e?.manifest2?.extra?.expoClient?.name??null}function re(){const e=i?.default??i;const n=e?.deviceName;return typeof n==="string"&&n.length>0?n:null}export function useToolAdapterMap({requiredEnvVars:e,customApps:n}){const c=p?.useReactQuerySyncAdapter?p.useReactQuerySyncAdapter():null;return oe(c,e,n)}export function ToolRegistryPublisher({requiredEnvVars:e,customApps:n}){const c=useToolAdapterMap({requiredEnvVars:e,customApps:n});const t=V(c);t.current=c;O(()=>ee(()=>t.current),[]);return null}export function AutoExternalSync({options:e,requiredEnvVars:n,isPro:c,tier:t,licenseKey:o,customApps:F}){const{useExternalSyncSocket:G,useExternalSync:J}=s;const N=useToolAdapterMap({requiredEnvVars:n,customApps:F});const U=X(e,{appName:te(),hardwareName:re(),platform:H.OS});const P=U?.deviceId??null;const{socket:u}=G({deviceName:U?.deviceName??"Buoy Device",socketURL:e?.socketURL??s.getDefaultSocketURL?.()??"http://localhost:42831",persistentDeviceId:P,platform:H.OS,enableLogs:e?.enableLogs});const a=V({isPro:c,tier:t,licenseKey:o});a.current={isPro:c,tier:t,licenseKey:o};O(()=>{if(!u)return;const y=()=>{if(!$.hasAccountAccess()||!u.connected)return;const C=$.getState();if(!a.current.isPro&&(C.isInitialized===false||C.isValidating===true))return;u.emit("device-license",{isPro:a.current.isPro?"1":"0",tier:a.current.tier??(a.current.isPro?"pro":"free")})};if(u.connected)y();u.on("connect",y);return()=>{u.off("connect",y)}},[u,c,t,o]);const l=e?.releaseActions?.join(",")??"";const K=Q(()=>Y(N,typeof __DEV__!=="undefined"&&__DEV__,l?l.split(","):void 0),[N,l]);J({tools:K,socket:u,deviceId:P,enableLogs:e?.enableLogs});return null}function oe(e,n,c){return Q(()=>{const t={app:W};if(g?.storageSyncAdapter){t.storage=g.storageSyncAdapter}if(d?.networkSyncAdapter){t.network=d.networkSyncAdapter}if(e){t.query=e}if(f?.routeEventsSyncAdapter){t["route-events"]=f.routeEventsSyncAdapter}if(b?.reduxSyncAdapter){t.redux=b.reduxSyncAdapter}if(m?.zustandSyncAdapter){t.zustand=m.zustandSyncAdapter}if(S?.jotaiSyncAdapter){t.jotai=S.jotaiSyncAdapter}if(A?.eventsSyncAdapter){t.events=A.eventsSyncAdapter}if(h?.consoleSyncAdapter){t.console=h.consoleSyncAdapter}if(M?.clockSyncAdapter){t.clock=M.clockSyncAdapter}if(v?.permissionsSyncAdapter){t.permissions=v.permissionsSyncAdapter}if(q?.lifecycleSyncAdapter){t.lifecycle=q.lifecycleSyncAdapter}if(k?.locationSyncAdapter){t.location=k.locationSyncAdapter}if(R?.notificationSyncAdapter){t["push-notifications"]=R.notificationSyncAdapter}if(x?.sentrySyncAdapter){t.sentry=x.sentrySyncAdapter}try{const o=require("@buoy-gg/time-machine");if(o?.timeMachineSyncAdapter){t["time-machine"]=o.timeMachineSyncAdapter}}catch(o){r("@buoy-gg/time-machine",o)}try{const o=require("@buoy-gg/scenarios");if(o?.scenariosSyncAdapter){t.scenarios=o.scenariosSyncAdapter}}catch(o){r("@buoy-gg/scenarios",o)}try{const o=require("@buoy-gg/ask-buoy");if(o?.askBuoySyncAdapter){t["ask-buoy"]=o.askBuoySyncAdapter}}catch(o){r("@buoy-gg/ask-buoy",o)}if(j?.createEnvSyncAdapter){t.env=j.createEnvSyncAdapter(n??[])}if(E?.highlightUpdatesSyncAdapter){t["highlight-updates"]=E.highlightUpdatesSyncAdapter}if(L?.debugBordersSyncAdapter){t["debug-borders"]=L.debugBordersSyncAdapter}if(I?.impersonateSyncAdapter){t.impersonate=I.impersonateSyncAdapter}if(w?.perfMonitorSyncAdapter){t["perf-monitor"]=w.perfMonitorSyncAdapter}if(T?.jsTopSyncAdapter){t["js-top"]=T.jsTopSyncAdapter}if(_?.imagesSyncAdapter){t.images=_.imagesSyncAdapter}if(z?.assetsSyncAdapter){t.assets=z.assetsSyncAdapter}if(B?.tvRemoteSyncAdapter){t["tv-remote"]=B.tvRemoteSyncAdapter}if(D?.focusInspectorSyncAdapter){t["focus-inspector"]=D.focusInspectorSyncAdapter}for(const o of c??[]){if(o?.sync){t[`custom:${o.id}`]=o.sync}}return t},[e,n,c])}
1
+ "use strict";import{useEffect as H,useMemo as $,useRef as F}from"react";import{Platform as G}from"react-native";import{LicenseManager as J}from"@buoy-gg/license";import{reportOptionalRequireError as r}from"./optionalRequire.js";import{appSyncAdapter as Z}from"./sync/appSyncAdapter.js";import{useDeviceIdentity as ee}from"./deviceIdentity.js";import{applyReleaseActionPolicy as te}from"./externalSyncGate.js";import{applyDefaultLicenseKey as re}from"../Buoy.js";import{registerToolAdapters as oe}from"@buoy-gg/shared-ui";re();let i=null;let g=null;let d=null;let p=null;let f=null;let b=null;let m=null;let S=null;let A=null;let h=null;let M=null;let k=null;let q=null;try{q=require("@buoy-gg/memory-leaks")}catch(e){r("@buoy-gg/memory-leaks",e)}let v=null;let x=null;let L=null;let R=null;let j=null;let E=null;try{E=require("@buoy-gg/notifications")}catch(e){r("@buoy-gg/notifications",e)}let I=null;let w=null;let T=null;let _=null;let z=null;let B=null;let D=null;let N=null;let U=null;let P=null;let s=null;try{i=require("@buoy-gg/external-sync")}catch(e){r("@buoy-gg/external-sync",e)}try{g=require("@buoy-gg/storage")}catch(e){r("@buoy-gg/storage",e)}try{d=require("@buoy-gg/network")}catch(e){r("@buoy-gg/network",e)}try{p=require("@buoy-gg/react-query")}catch(e){r("@buoy-gg/react-query",e)}try{f=require("@buoy-gg/route-events")}catch(e){r("@buoy-gg/route-events",e)}try{b=require("@buoy-gg/redux")}catch(e){r("@buoy-gg/redux",e)}try{m=require("@buoy-gg/zustand")}catch(e){r("@buoy-gg/zustand",e)}try{S=require("@buoy-gg/jotai")}catch(e){r("@buoy-gg/jotai",e)}try{A=require("@buoy-gg/events")}catch(e){r("@buoy-gg/events",e)}try{h=require("@buoy-gg/console")}catch(e){r("@buoy-gg/console",e)}try{M=require("@buoy-gg/clock")}catch(e){r("@buoy-gg/clock",e)}try{k=require("@buoy-gg/bug-links")}catch(e){r("@buoy-gg/bug-links",e)}try{x=require("@buoy-gg/lifecycle")}catch(e){r("@buoy-gg/lifecycle",e)}try{L=require("@buoy-gg/ota-inspector")}catch(e){r("@buoy-gg/ota-inspector",e)}try{R=require("@buoy-gg/location")}catch(e){r("@buoy-gg/location",e)}try{v=require("@buoy-gg/permissions")}catch(e){r("@buoy-gg/permissions",e)}try{j=require("@buoy-gg/sentry")}catch(e){r("@buoy-gg/sentry",e)}try{I=require("@buoy-gg/env")}catch(e){r("@buoy-gg/env",e)}try{w=require("@buoy-gg/highlight-updates")}catch(e){r("@buoy-gg/highlight-updates",e)}try{T=require("@buoy-gg/debug-borders")}catch(e){r("@buoy-gg/debug-borders",e)}try{_=require("@buoy-gg/impersonate")}catch(e){r("@buoy-gg/impersonate",e)}try{z=require("@buoy-gg/perf-monitor")}catch(e){r("@buoy-gg/perf-monitor",e)}try{B=require("@buoy-gg/js-top")}catch(e){r("@buoy-gg/js-top",e)}try{D=require("@buoy-gg/images")}catch(e){r("@buoy-gg/images",e)}try{N=require("@buoy-gg/assets")}catch(e){r("@buoy-gg/assets",e)}try{U=require("@buoy-gg/tv-remote")}catch(e){r("@buoy-gg/tv-remote",e)}try{P=require("@buoy-gg/focus-inspector")}catch(e){r("@buoy-gg/focus-inspector",e)}try{s=require("expo-constants")}catch(e){r("expo-constants",e)}export function isExternalSyncAvailable(){return!!i?.useExternalSyncSocket}function ne(){const e=s?.default??s;return e?.expoConfig?.name??e?.manifest2?.extra?.expoClient?.name??null}function ce(){const e=s?.default??s;const n=e?.deviceName;return typeof n==="string"&&n.length>0?n:null}export function useToolAdapterMap({requiredEnvVars:e,customApps:n}){const c=p?.useReactQuerySyncAdapter?p.useReactQuerySyncAdapter():null;return ue(c,e,n)}export function ToolRegistryPublisher({requiredEnvVars:e,customApps:n}){const c=useToolAdapterMap({requiredEnvVars:e,customApps:n});const t=F(c);t.current=c;H(()=>oe(()=>t.current),[]);return null}export function AutoExternalSync({options:e,requiredEnvVars:n,isPro:c,tier:t,licenseKey:o,customApps:K}){const{useExternalSyncSocket:W,useExternalSync:X}=i;const C=useToolAdapterMap({requiredEnvVars:n,customApps:K});const O=ee(e,{appName:ne(),hardwareName:ce(),platform:G.OS});const Q=O?.deviceId??null;const{socket:u}=W({deviceName:O?.deviceName??"Buoy Device",socketURL:e?.socketURL??i.getDefaultSocketURL?.()??"http://localhost:42831",persistentDeviceId:Q,platform:G.OS,enableLogs:e?.enableLogs});const a=F({isPro:c,tier:t,licenseKey:o});a.current={isPro:c,tier:t,licenseKey:o};H(()=>{if(!u)return;const y=()=>{if(!J.hasAccountAccess()||!u.connected)return;const V=J.getState();if(!a.current.isPro&&(V.isInitialized===false||V.isValidating===true))return;u.emit("device-license",{isPro:a.current.isPro?"1":"0",tier:a.current.tier??(a.current.isPro?"pro":"free")})};if(u.connected)y();u.on("connect",y);return()=>{u.off("connect",y)}},[u,c,t,o]);const l=e?.releaseActions?.join(",")??"";const Y=$(()=>te(C,typeof __DEV__!=="undefined"&&__DEV__,l?l.split(","):void 0),[C,l]);X({tools:Y,socket:u,deviceId:Q,enableLogs:e?.enableLogs});return null}function ue(e,n,c){return $(()=>{const t={app:Z};if(g?.storageSyncAdapter){t.storage=g.storageSyncAdapter}if(d?.networkSyncAdapter){t.network=d.networkSyncAdapter}if(e){t.query=e}if(f?.routeEventsSyncAdapter){t["route-events"]=f.routeEventsSyncAdapter}if(b?.reduxSyncAdapter){t.redux=b.reduxSyncAdapter}if(m?.zustandSyncAdapter){t.zustand=m.zustandSyncAdapter}if(S?.jotaiSyncAdapter){t.jotai=S.jotaiSyncAdapter}if(A?.eventsSyncAdapter){t.events=A.eventsSyncAdapter}if(h?.consoleSyncAdapter){t.console=h.consoleSyncAdapter}if(q?.memoryLeaksSyncAdapter)t["memory-leaks"]=q.memoryLeaksSyncAdapter;if(M?.clockSyncAdapter){t.clock=M.clockSyncAdapter}if(v?.permissionsSyncAdapter){t.permissions=v.permissionsSyncAdapter}if(k?.bugLinksSyncAdapter){t["bug-links"]=k.bugLinksSyncAdapter}if(L?.otaInspectorSyncAdapter)t["ota-update-inspector"]=L.otaInspectorSyncAdapter;if(x?.lifecycleSyncAdapter){t.lifecycle=x.lifecycleSyncAdapter}if(R?.locationSyncAdapter){t.location=R.locationSyncAdapter}if(E?.notificationSyncAdapter){t["push-notifications"]=E.notificationSyncAdapter}if(j?.sentrySyncAdapter){t.sentry=j.sentrySyncAdapter}try{const o=require("@buoy-gg/time-machine");if(o?.timeMachineSyncAdapter){t["time-machine"]=o.timeMachineSyncAdapter}}catch(o){r("@buoy-gg/time-machine",o)}try{const o=require("@buoy-gg/scenarios");if(o?.scenariosSyncAdapter){t.scenarios=o.scenariosSyncAdapter}}catch(o){r("@buoy-gg/scenarios",o)}try{const o=require("@buoy-gg/ask-buoy");if(o?.askBuoySyncAdapter){t["ask-buoy"]=o.askBuoySyncAdapter}}catch(o){r("@buoy-gg/ask-buoy",o)}if(I?.createEnvSyncAdapter){t.env=I.createEnvSyncAdapter(n??[])}if(w?.highlightUpdatesSyncAdapter){t["highlight-updates"]=w.highlightUpdatesSyncAdapter}if(T?.debugBordersSyncAdapter){t["debug-borders"]=T.debugBordersSyncAdapter}if(_?.impersonateSyncAdapter){t.impersonate=_.impersonateSyncAdapter}if(z?.perfMonitorSyncAdapter){t["perf-monitor"]=z.perfMonitorSyncAdapter}if(B?.jsTopSyncAdapter){t["js-top"]=B.jsTopSyncAdapter}if(D?.imagesSyncAdapter){t.images=D.imagesSyncAdapter}if(N?.assetsSyncAdapter){t.assets=N.assetsSyncAdapter}if(U?.tvRemoteSyncAdapter){t["tv-remote"]=U.tvRemoteSyncAdapter}if(P?.focusInspectorSyncAdapter){t["focus-inspector"]=P.focusInspectorSyncAdapter}for(const o of c??[]){if(o?.sync){t[`custom:${o.id}`]=o.sync}}return t},[e,n,c])}
@@ -0,0 +1 @@
1
+ "use strict";export function resolveBackTarget(n,l){if(l)return{kind:"dial"};for(let t=n.length-1;t>=0;t--){const i=n[t];if(i.launchMode!=="toggle-only"&&!i.minimized){return{kind:"tool",instanceId:i.instanceId}}}const e=n[n.length-1];return e?{kind:"tool",instanceId:e.instanceId}:null}
@@ -1 +1 @@
1
- "use strict";import{useEffect as s,useRef as l}from"react";import{capacitorPlatform as f,capacitorPlugin as _}from"@buoy-gg/license";export function isBuoyHoldingBackButton(){return globalThis.__BUOY_HOLDS_BACK__===true}export const BUOY_BACK_PRIORITY=99.5;export function ionicHandlesBack(){if(typeof document==="undefined")return false;const e=globalThis.Ionic;if(!e&&!document.querySelector("ion-app"))return false;try{return e?.config?.get?.("hardwareBackButton",true)!==false}catch{return true}}export function useCapacitorBackButton(e,u){const n=l(u);n.current=u;s(()=>{if(!e||f()!=="android")return;const o=globalThis;o.__BUOY_HOLDS_BACK__=true;let i;if(ionicHandlesBack()){const t=r=>{r.detail?.register?.(BUOY_BACK_PRIORITY,()=>{n.current()})};document.addEventListener("ionBackButton",t);i=()=>document.removeEventListener("ionBackButton",t)}else{const t=_("App");if(!t?.addListener){o.__BUOY_HOLDS_BACK__=false;return}let r=false;let c=null;void Promise.resolve(t.addListener("backButton",()=>n.current())).then(a=>{if(r)void a.remove();else c=a}).catch(()=>{});i=()=>{r=true;if(c)void c.remove()}}return()=>{i();o.__BUOY_HOLDS_BACK__=false}},[e])}
1
+ "use strict";import{useEffect as f,useRef as B}from"react";import{capacitorPlatform as _,capacitorPlugin as p}from"@buoy-gg/license";export function isBuoyHoldingBackButton(){return globalThis.__BUOY_HOLDS_BACK__===true}export const BUOY_BACK_PRIORITY=99.5;export const BUOY_DIAL_BACK_PRIORITY=99.6;let n=0;export function ionicHandlesBack(){if(typeof document==="undefined")return false;const e=globalThis.Ionic;if(!e&&!document.querySelector("ion-app"))return false;try{return e?.config?.get?.("hardwareBackButton",true)!==false}catch{return true}}export function useCapacitorBackButton(e,u,a=BUOY_BACK_PRIORITY){const o=B(u);o.current=u;f(()=>{if(!e||_()!=="android")return;const s=globalThis;n+=1;s.__BUOY_HOLDS_BACK__=true;const l=()=>{n=Math.max(0,n-1);s.__BUOY_HOLDS_BACK__=n>0};let c;if(ionicHandlesBack()){const t=r=>{r.detail?.register?.(a,()=>{o.current()})};document.addEventListener("ionBackButton",t);c=()=>document.removeEventListener("ionBackButton",t)}else{const t=p("App");if(!t?.addListener){l();return}let r=false;let i=null;void Promise.resolve(t.addListener("backButton",()=>o.current())).then(d=>{if(r)void d.remove();else i=d}).catch(()=>{});c=()=>{r=true;if(i)void i.remove()}}return()=>{c();l()}},[e,a])}
@@ -1 +1 @@
1
- "use strict";import{useEffect as S,useMemo as v,useRef as f,useState as w}from"react";import{Pressable as Le,StyleSheet as Be,TouchableOpacity as Oe,View as l,useWindowDimensions as Re,Text as L,Animated as o,Easing as c}from"react-native";import{absoluteFill as u,monoFont as F}from"@buoy-gg/shared-ui";import{DialIcon as ie}from"./DialIcon.js";import{DialHyperspace as Pe}from"./DialHyperspace.js";import{DialPagination as Ae}from"./DialPagination.js";import{getRankedToolIds as j,isDialUsageLoaded as Ve,loadDialUsage as Ne,recordToolUsage as Ge}from"./dialUsageStore.js";import{persistentStorage as P,useHintsDisabled as Me,devToolsStorageKeys as re,buoyColors as ae,ToolBackground as _e,useToolBackground as Ee}from"@buoy-gg/shared-ui";import{DevToolsSettingsModal as Fe,useDevToolsSettings as je}from"../DevToolsSettingsModal";import{useProAccess as ze}from"@buoy-gg/license";import{renderAppIcon as se}from"../AppIcon";import{useAppHost as Ue}from"../AppHost";import{OnboardingTooltip as We}from"./OnboardingTooltip";import{getDialLayout as $e,MAX_DIAL_SLOTS as T,DIAL_BUTTON_SIZE as qe,dialAnimationConfig as z,dialColors as a}from"@buoy-gg/floating-tools-core";import{jsx as i,jsxs as h,Fragment as le}from"react/jsx-runtime";const d=qe;const He={x:.5,y:.5};const Ke=d*.75+6;const Ye=false;const ce="@react_buoy_settings_tooltip_shown";const Ze=y=>({id:`empty-${y}`,name:`empty-${y}`,icon:null,color:"transparent",onPress:()=>{}});export const DialDevTools=({onClose:y,onSettingsPress:de,autoOpenSettings:U=false,apps:B,emptyNote:W,state:Xe,actions:$})=>{const[ue,ge]=w(-1);const[g,k]=w(false);const[q,pe]=w(false);const[H,K]=w(false);const A=f(false);const Y=Me();const{refreshSettings:me}=je();const{open:Z}=Ue();const{isPro:fe,isWeekendFree:X}=ze();const{width:V,height:he}=Re();const s=$e({screenWidth:V}).circleSize;const{id:ye}=Ee();const p=v(()=>({parent:{width:s,height:s},circle:{width:s,height:s,borderRadius:s/2},rounded:{borderRadius:s/2},gridLine:{width:s},spoke:{width:s/2-Ke}}),[s]);S(()=>{const t=async()=>{try{const e=await P.getItem(re.settings.modalOpen());if(e==="true"){k(true)}}catch(e){}finally{pe(true)}};t()},[]);S(()=>{if(!q)return;P.setItem(re.settings.modalOpen(),g?"true":"false").catch(t=>{console.warn("[Buoy]","Failed to save settings modal state:",t)})},[g,q]);S(()=>{if(U&&!g){k(true)}},[U,g]);S(()=>{if(Y){return}const t=async()=>{try{const e=await P.getItem(ce);if(!e){setTimeout(()=>{K(true)},1200)}}catch(e){}};t()},[Y]);const N=f(new o.Value(0)).current;const D=f(new o.Value(0)).current;const G=f(new o.Value(0)).current;const x=f(new o.Value(0)).current;const O=f(new o.Value(0)).current;const M=f(new o.Value(1)).current;const be=v(()=>B.map(({id:t,name:e,slot:r,description:I,icon:Ce,color:Ie})=>({id:t,name:e,slot:r,description:I,icon:Ce,color:Ie})),[B]);const C=f(null);const Se=()=>{if(g){k(false);return}k(true);if(H&&!A.current){te()}de?.()};const b=v(()=>B.filter(t=>(t.slot??"both")!=="row"),[B]);const J=v(()=>{const t=new Map;for(const e of b){t.set(e.id,{id:e.id,name:e.name,icon:typeof e.icon==="function"?null:se(e.icon,{slot:"dial",size:20,color:e.color}),iconComponent:typeof e.icon==="function"?e.icon:void 0,color:e.color??ae.primary,onPress:()=>{void Ge(e.id);e?.onPress?.($);if(e.launchMode!=="toggle-only"){const r=se(e.icon,{slot:"dial",size:20,color:e.color});Z({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},[b,$,Z,y]);const[_,Q]=w(()=>j(b.map(t=>t.id)));S(()=>{const t=b.map(r=>r.id);if(Ve()){Q(j(t));return}let e=false;Ne().then(()=>{if(!e)Q(j(t))});return()=>{e=true}},[b]);const R=Math.max(1,Math.ceil(_.length/T));const[ve,we]=w(0);const m=Math.min(ve,R-1);const E=v(()=>{return _.map(t=>J.get(t)).filter(t=>Boolean(t)).map((t,e)=>({icon:t,page:Math.floor(e/T),slot:e%T}))},[_,J]);const Te=v(()=>{const t=E.filter(r=>r.page===m).length;const e=[];for(let r=t;r<T;r+=1)e.push(r);return e},[E,m]);const ee=t=>{const e=Math.max(0,Math.min(t,R-1));if(e!==m)we(e)};S(()=>{const t=z??{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(D,{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:c.out(c.cubic),useNativeDriver:true}),o.timing(G,{toValue:0,duration:0,useNativeDriver:true})]).start();o.sequence([o.delay(e.centerButton.delay),o.spring(x,{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:c.out(c.cubic),useNativeDriver:true})]).start();if(!Ye)return;C.current=o.loop(o.sequence([o.timing(M,{toValue:r.pulse.maxScale,duration:r.pulse.duration,easing:c.inOut(c.ease),useNativeDriver:true}),o.timing(M,{toValue:r.pulse.minScale,duration:r.pulse.duration,easing:c.inOut(c.ease),useNativeDriver:true})]));C.current.start();return()=>{C.current?.stop()}},[]);const te=()=>{A.current=true;K(false);P.setItem(ce,"true").catch(t=>{console.warn("[Buoy]","Failed to save dial onboarding state:",t)})};const oe=()=>{if(C.current){C.current.stop()}const t=z?.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:c.in(c.cubic),useNativeDriver:true}),o.parallel([o.timing(x,{toValue:0,duration:t.centerButton.duration,easing:c.in(c.cubic),useNativeDriver:true}),o.timing(D,{toValue:0,duration:t.dialScale.duration,easing:c.in(c.cubic),useNativeDriver:true})]),o.timing(N,{toValue:0,duration:t.backdrop.duration,useNativeDriver:true})]).start(()=>{if(y){setTimeout(()=>{y()},0)}})};const ne=t=>{ge(1);const e=z?.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(x,{toValue:r.scale,damping:r.damping,stiffness:r.stiffness,useNativeDriver:true}),o.spring(x,{toValue:I.scale,damping:I.damping,stiffness:I.stiffness,useNativeDriver:true})]).start();setTimeout(()=>{t.onPress();if(t.id!=="wifi"){oe()}},e.iconSelect.actionDelay)};const ke={opacity:N};const De={transform:[{scale:x}]};const xe={transform:[{scale:ue>=0?1:M}]};return h(l,{style:n.container,nativeID:"dial-devtools-root",children:[i(o.View,{style:[n.backdrop,ke],children:i(Le,{style:u,onPress:oe})}),b.length===0&&W?i(L,{style:[n.emptyNote,{bottom:80+s+16}],accessibilityLiveRegion:"polite",testID:"buoy-dial-empty-note",children:W}):null,h(o.View,{style:[n.parent,p.parent,{position:"absolute",left:(V-s)/2,bottom:80,transform:[{scale:D},{rotate:G.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]}],children:[h(o.View,{style:[n.circle,p.circle],children:[h(l,{style:[n.gradientBackground,p.rounded],children:[i(l,{style:[n.gradientLayer1,p.rounded]}),i(l,{style:[n.gradientLayer2,p.rounded]}),i(l,{style:[n.gradientLayer3,p.rounded]}),i(l,{style:n.gridPattern,children:Array.from({length:6}).map((t,e)=>h(l,{style:[n.gridLine,p.gridLine,{transform:[{rotate:`${e*60}deg`}]}],children:[i(l,{style:[n.spoke,p.spoke,n.spokeLeft]}),i(l,{style:[n.spoke,p.spoke,n.spokeRight]})]},e))}),ye==="hyperspace"?i(Pe,{size:s}):i(_e,{focus:He})]}),E.filter(({page:t})=>t===m).map(({icon:t,slot:e})=>i(ie,{onPress:ne,iconsProgress:O,icon:t,index:e,totalIcons:T,active:true},`${t.id??"icon"}:${m}:${e}`)),Te.map(t=>i(ie,{onPress:ne,iconsProgress:O,icon:Ze(t),index:t,totalIcons:T,active:true},`empty-${t}`))]}),i(o.View,{style:[n.buttonContainer,De],children:h(l,{style:n.buttonGradient,children:[i(l,{style:n.buttonGradientLayer1}),i(l,{style:n.buttonGradientLayer2}),i(l,{style:n.buttonGradientLayer3}),i(l,{style:n.buttonBorder,children:i(o.View,{style:[n.button,xe],children:i(Oe,{accessibilityRole:"button",accessibilityLabel:g?"Close Settings":"Open Dev Tools Settings",onPress:Se,activeOpacity:.5,style:n.buttonPressable,children:g?h(le,{children:[i(L,{style:[n.centerText,n.closeTextTop],children:"CLOSE"}),i(L,{style:[n.centerText,n.closeTextBottom],children:"SETTINGS"})]}):h(le,{children:[i(L,{style:n.centerText,children:"BUOY"}),fe&&i(L,{style:[n.proText,X&&n.weekendText],children:X?"WEEKEND":"PRO"})]})})})})]})})]}),R>1&&i(Ae,{page:m,pageCount:R,onPrev:()=>ee(m-1),onNext:()=>ee(m+1),animatedStyle:{position:"absolute",left:(V-s)/2,top:he-80+16,width:s,opacity:D,transform:[{scale:D}]}}),g&&i(Fe,{visible:true,onClose:()=>{k(false);me()},availableApps:be}),H&&!g&&!A.current&&i(We,{visible:true,onDismiss:te})]})};const n=Be.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:d*1.5,height:d*1.5,borderRadius:d},buttonGradient:{width:"100%",height:"100%",borderRadius:d,alignItems:"center",justifyContent:"center",padding:4,backgroundColor:a.hubHalo,position:"relative",overflow:"hidden"},buttonGradientLayer1:{...u,backgroundColor:a.dialGradient1,opacity:.5,borderRadius:d},buttonGradientLayer2:{...u,backgroundColor:a.dialGradient2,opacity:.3,top:"20%",left:"20%",borderRadius:d},buttonGradientLayer3:{...u,backgroundColor:a.dialGradient3,opacity:.2,top:"40%",left:"40%",borderRadius:d},buttonBorder:{backgroundColor:a.hubFill,alignItems:"center",justifyContent:"center",width:d*1.2,height:d*1.2,borderRadius:d*.6},button:{width:d,height:d,borderRadius:d/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:F,letterSpacing:1,textAlign:"center",textTransform:"uppercase",textShadowColor:a.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},closeTextTop:{marginBottom:-2},emptyNote:{position:"absolute",left:16,right:16,color:a.iconLabel,fontSize:12,fontFamily:F,textAlign:"center"},closeTextBottom:{marginTop:-2},proText:{color:ae.warning,fontSize:8,fontWeight:"900",fontFamily:F,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 w,useMemo as v,useRef as m,useState as T}from"react";import{Pressable as Be,StyleSheet as Oe,TouchableOpacity as Re,View as l,useWindowDimensions as Pe,Text as L,Animated as o,Easing as c}from"react-native";import{absoluteFill as g,monoFont as j}from"@buoy-gg/shared-ui";import{DialIcon as ae}from"./DialIcon.js";import{DialHyperspace as Ae}from"./DialHyperspace.js";import{DialPagination as Ve}from"./DialPagination.js";import{getRankedToolIds as z,isDialUsageLoaded as Ne,loadDialUsage as Ge,recordToolUsage as Me}from"./dialUsageStore.js";import{persistentStorage as P,useHintsDisabled as _e,devToolsStorageKeys as se,buoyColors as le,ToolBackground as Ee,useToolBackground as Fe}from"@buoy-gg/shared-ui";import{DevToolsSettingsModal as je,useDevToolsSettings as ze}from"../DevToolsSettingsModal";import{useProAccess as Ue}from"@buoy-gg/license";import{renderAppIcon as ce}from"../AppIcon";import{useAppHost as He}from"../AppHost";import{useHardwareBack as We}from"../hardwareBack.js";import{OnboardingTooltip as $e}from"./OnboardingTooltip";import{getDialLayout as qe,MAX_DIAL_SLOTS as k,DIAL_BUTTON_SIZE as Ke,dialAnimationConfig as U,dialColors as a}from"@buoy-gg/floating-tools-core";import{jsx as i,jsxs as h,Fragment as de}from"react/jsx-runtime";const d=Ke;const Ye={x:.5,y:.5};const Ze=d*.75+6;const Xe=false;const ue="@react_buoy_settings_tooltip_shown";const Je=y=>({id:`empty-${y}`,name:`empty-${y}`,icon:null,color:"transparent",onPress:()=>{}});export const DialDevTools=({onClose:y,onSettingsPress:ge,autoOpenSettings:H=false,apps:B,emptyNote:W,state:Qe,actions:$})=>{const[pe,me]=T(-1);const[u,b]=T(false);const[q,fe]=T(false);const[K,Y]=T(false);const A=m(false);const Z=_e();const{refreshSettings:X}=ze();const{open:J}=He();const{isPro:he,isWeekendFree:Q}=Ue();const{width:V,height:ye}=Pe();const s=qe({screenWidth:V}).circleSize;const{id:be}=Fe();const p=v(()=>({parent:{width:s,height:s},circle:{width:s,height:s,borderRadius:s/2},rounded:{borderRadius:s/2},gridLine:{width:s},spoke:{width:s/2-Ze}}),[s]);w(()=>{const t=async()=>{try{const e=await P.getItem(se.settings.modalOpen());if(e==="true"){b(true)}}catch(e){}finally{fe(true)}};t()},[]);w(()=>{if(!q)return;P.setItem(se.settings.modalOpen(),u?"true":"false").catch(t=>{console.warn("[Buoy]","Failed to save settings modal state:",t)})},[u,q]);w(()=>{if(H&&!u){b(true)}},[H,u]);w(()=>{if(Z){return}const t=async()=>{try{const e=await P.getItem(ue);if(!e){setTimeout(()=>{Y(true)},1200)}}catch(e){}};t()},[Z]);const N=m(new o.Value(0)).current;const D=m(new o.Value(0)).current;const G=m(new o.Value(0)).current;const x=m(new o.Value(0)).current;const O=m(new o.Value(0)).current;const M=m(new o.Value(1)).current;const Se=v(()=>B.map(({id:t,name:e,slot:r,description:I,icon:Ie,color:Le})=>({id:t,name:e,slot:r,description:I,icon:Ie,color:Le})),[B]);const ee=m(false);const C=m(null);const we=()=>{if(u){b(false);return}b(true);if(K&&!A.current){ie()}ge?.()};const S=v(()=>B.filter(t=>(t.slot??"both")!=="row"),[B]);const te=v(()=>{const t=new Map;for(const e of S){t.set(e.id,{id:e.id,name:e.name,icon:typeof e.icon==="function"?null:ce(e.icon,{slot:"dial",size:20,color:e.color}),iconComponent:typeof e.icon==="function"?e.icon:void 0,color:e.color??le.primary,onPress:()=>{void Me(e.id);e?.onPress?.($);if(e.launchMode!=="toggle-only"){const r=ce(e.icon,{slot:"dial",size:20,color:e.color});J({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},[S,$,J,y]);const[_,oe]=T(()=>z(S.map(t=>t.id)));w(()=>{const t=S.map(r=>r.id);if(Ne()){oe(z(t));return}let e=false;Ge().then(()=>{if(!e)oe(z(t))});return()=>{e=true}},[S]);const R=Math.max(1,Math.ceil(_.length/k));const[ve,Te]=T(0);const f=Math.min(ve,R-1);const E=v(()=>{return _.map(t=>te.get(t)).filter(t=>Boolean(t)).map((t,e)=>({icon:t,page:Math.floor(e/k),slot:e%k}))},[_,te]);const ke=v(()=>{const t=E.filter(r=>r.page===f).length;const e=[];for(let r=t;r<k;r+=1)e.push(r);return e},[E,f]);const ne=t=>{const e=Math.max(0,Math.min(t,R-1));if(e!==f)Te(e)};w(()=>{const t=U??{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(D,{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:c.out(c.cubic),useNativeDriver:true}),o.timing(G,{toValue:0,duration:0,useNativeDriver:true})]).start();o.sequence([o.delay(e.centerButton.delay),o.spring(x,{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:c.out(c.cubic),useNativeDriver:true})]).start();if(!Xe)return;C.current=o.loop(o.sequence([o.timing(M,{toValue:r.pulse.maxScale,duration:r.pulse.duration,easing:c.inOut(c.ease),useNativeDriver:true}),o.timing(M,{toValue:r.pulse.minScale,duration:r.pulse.duration,easing:c.inOut(c.ease),useNativeDriver:true})]));C.current.start();return()=>{C.current?.stop()}},[]);const ie=()=>{A.current=true;Y(false);P.setItem(ue,"true").catch(t=>{console.warn("[Buoy]","Failed to save dial onboarding state:",t)})};const F=()=>{ee.current=true;if(C.current){C.current.stop()}const t=U?.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:c.in(c.cubic),useNativeDriver:true}),o.parallel([o.timing(x,{toValue:0,duration:t.centerButton.duration,easing:c.in(c.cubic),useNativeDriver:true}),o.timing(D,{toValue:0,duration:t.dialScale.duration,easing:c.in(c.cubic),useNativeDriver:true})]),o.timing(N,{toValue:0,duration:t.backdrop.duration,useNativeDriver:true})]).start(()=>{if(y){setTimeout(()=>{y()},0)}})};We(true,()=>{if(ee.current)return true;if(u){b(false);X();return true}F();return true});const re=t=>{me(1);const e=U?.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(x,{toValue:r.scale,damping:r.damping,stiffness:r.stiffness,useNativeDriver:true}),o.spring(x,{toValue:I.scale,damping:I.damping,stiffness:I.stiffness,useNativeDriver:true})]).start();setTimeout(()=>{t.onPress();if(t.id!=="wifi"){F()}},e.iconSelect.actionDelay)};const De={opacity:N};const xe={transform:[{scale:x}]};const Ce={transform:[{scale:pe>=0?1:M}]};return h(l,{style:n.container,nativeID:"dial-devtools-root",children:[i(o.View,{style:[n.backdrop,De],children:i(Be,{style:g,onPress:F})}),S.length===0&&W?i(L,{style:[n.emptyNote,{bottom:80+s+16}],accessibilityLiveRegion:"polite",testID:"buoy-dial-empty-note",children:W}):null,h(o.View,{style:[n.parent,p.parent,{position:"absolute",left:(V-s)/2,bottom:80,transform:[{scale:D},{rotate:G.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]}],children:[h(o.View,{style:[n.circle,p.circle],children:[h(l,{style:[n.gradientBackground,p.rounded],children:[i(l,{style:[n.gradientLayer1,p.rounded]}),i(l,{style:[n.gradientLayer2,p.rounded]}),i(l,{style:[n.gradientLayer3,p.rounded]}),i(l,{style:n.gridPattern,children:Array.from({length:6}).map((t,e)=>h(l,{style:[n.gridLine,p.gridLine,{transform:[{rotate:`${e*60}deg`}]}],children:[i(l,{style:[n.spoke,p.spoke,n.spokeLeft]}),i(l,{style:[n.spoke,p.spoke,n.spokeRight]})]},e))}),be==="hyperspace"?i(Ae,{size:s}):i(Ee,{focus:Ye})]}),E.filter(({page:t})=>t===f).map(({icon:t,slot:e})=>i(ae,{onPress:re,iconsProgress:O,icon:t,index:e,totalIcons:k,active:true},`${t.id??"icon"}:${f}:${e}`)),ke.map(t=>i(ae,{onPress:re,iconsProgress:O,icon:Je(t),index:t,totalIcons:k,active:true},`empty-${t}`))]}),i(o.View,{style:[n.buttonContainer,xe],children:h(l,{style:n.buttonGradient,children:[i(l,{style:n.buttonGradientLayer1}),i(l,{style:n.buttonGradientLayer2}),i(l,{style:n.buttonGradientLayer3}),i(l,{style:n.buttonBorder,children:i(o.View,{style:[n.button,Ce],children:i(Re,{accessibilityRole:"button",accessibilityLabel:u?"Close Settings":"Open Dev Tools Settings",onPress:we,activeOpacity:.5,style:n.buttonPressable,children:u?h(de,{children:[i(L,{style:[n.centerText,n.closeTextTop],children:"CLOSE"}),i(L,{style:[n.centerText,n.closeTextBottom],children:"SETTINGS"})]}):h(de,{children:[i(L,{style:n.centerText,children:"BUOY"}),he&&i(L,{style:[n.proText,Q&&n.weekendText],children:Q?"WEEKEND":"PRO"})]})})})})]})})]}),R>1&&i(Ve,{page:f,pageCount:R,onPrev:()=>ne(f-1),onNext:()=>ne(f+1),animatedStyle:{position:"absolute",left:(V-s)/2,top:ye-80+16,width:s,opacity:D,transform:[{scale:D}]}}),u&&i(je,{visible:true,onClose:()=>{b(false);X()},availableApps:Se}),K&&!u&&!A.current&&i($e,{visible:true,onDismiss:ie})]})};const n=Oe.create({container:{...g,zIndex:9999},backdrop:{...g,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:{...g,backgroundColor:a.dialGradient1,opacity:.6},gradientLayer2:{...g,backgroundColor:a.dialGradient2,opacity:.4,top:"30%",left:"30%"},gradientLayer3:{...g,backgroundColor:a.dialGradient3,opacity:.3,top:"50%",left:"50%"},gridPattern:{...g,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:d*1.5,height:d*1.5,borderRadius:d},buttonGradient:{width:"100%",height:"100%",borderRadius:d,alignItems:"center",justifyContent:"center",padding:4,backgroundColor:a.hubHalo,position:"relative",overflow:"hidden"},buttonGradientLayer1:{...g,backgroundColor:a.dialGradient1,opacity:.5,borderRadius:d},buttonGradientLayer2:{...g,backgroundColor:a.dialGradient2,opacity:.3,top:"20%",left:"20%",borderRadius:d},buttonGradientLayer3:{...g,backgroundColor:a.dialGradient3,opacity:.2,top:"40%",left:"40%",borderRadius:d},buttonBorder:{backgroundColor:a.hubFill,alignItems:"center",justifyContent:"center",width:d*1.2,height:d*1.2,borderRadius:d*.6},button:{width:d,height:d,borderRadius:d/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:j,letterSpacing:1,textAlign:"center",textTransform:"uppercase",textShadowColor:a.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},closeTextTop:{marginBottom:-2},emptyNote:{position:"absolute",left:16,right:16,color:a.iconLabel,fontSize:12,fontFamily:j,textAlign:"center"},closeTextBottom:{marginTop:-2},proText:{color:le.warning,fontSize:8,fontWeight:"900",fontFamily:j,letterSpacing:2,textAlign:"center",textShadowColor:a.centerTextGlow,textShadowOffset:{width:0,height:0},textShadowRadius:4},weekendText:{color:"#BF5AF2",letterSpacing:1}});
@@ -1 +1 @@
1
- "use strict";import{useState as p,useEffect as E,useMemo as J,useRef as Q,useCallback as ee}from"react";import{dialAccessibilityLabel as $e}from"./dialA11y.js";import{getDialLayout as Le,getAllIconPositions as Fe,getGridLineRotations as We,getIconStaggerInputRange as Ge,MAX_DIAL_SLOTS as K,DIAL_ICON_SIZE as He,dialAnimationConfig as ye,getDialCSSKeyframesString as _e,getDialCSSAnimationStyles as je,dialColors as r,dialStyles as e,withAlpha as be,floatingToolsColors as Oe}from"@buoy-gg/floating-tools-react";import{persistentStorage as Se,monoFont as de,ToolBackground as qe,useToolBackground as Ue}from"@buoy-gg/shared-ui";import{DialHyperspace as Ke}from"./DialHyperspace.js";import{OnboardingTooltip as Ne}from"./OnboardingTooltip.web.js";import{jsx as n,Fragment as Ve,jsxs as k}from"react/jsx-runtime";const Xe={x:.5,y:.5};const xe="@react_buoy_settings_tooltip_shown";let we=false;function Ye(){if(we||typeof document==="undefined")return;const o=document.createElement("style");o.textContent=_e();document.head.appendChild(o);we=true}const H=o=>1-Math.pow(1-o,3);const ue=o=>o*o*o;function Ze({icon:o,index:m,totalIcons:I,position:h,progress:c,onPress:x}){const[z,D]=p(false);const[N,w]=p(false);const b=!o.icon&&o.id.startsWith("empty-");const R=!b&&o.unavailable===true;const T=!b&&!R;const{icons:V}=ye;const P=Ge(m,I);let d=0;if(c<=P[1]){d=0}else if(c<=P[2]){d=(c-P[1])/(P[2]-P[1])}else{d=1}d=Math.max(0,Math.min(1,d));const $=He;const L=V.pressIn.scale;const te=1.1;const _=d*(N?L:z?te:1);let A=0;if(d<=0){A=0}else if(d<=.3){A=d}else{A=.3+(d-.3)*(.7/.7)}const X=h.x*(d-1);const ne=h.y*(d-1);return n("button",{role:"menuitem","aria-label":b?"Empty slot":$e(o.id,o.name),"data-testid":o.id?`buoy-dial-${o.id}`:void 0,"aria-disabled":!T,tabIndex:T?0:-1,onClick:T?x:void 0,onPointerEnter:oe=>T&&oe.pointerType==="mouse"&&D(true),onPointerLeave:()=>{D(false);w(false)},onPointerDown:()=>T&&w(true),onPointerUp:()=>w(false),onPointerCancel:()=>w(false),style:{position:"absolute",left:`calc(50% + ${h.x}px)`,top:`calc(50% + ${h.y}px)`,width:$,height:$,marginLeft:-$/2,marginTop:-$/2,cursor:T?"pointer":"default",background:"none",border:"none",padding:0},children:n("span",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",transform:`translate(${X}px, ${ne}px) scale(${_})`,opacity:A,transition:z||N?"transform 100ms ease":"none"},children:b?n("div",{style:{width:e.emptySlot.dotSize,height:e.emptySlot.dotSize,borderRadius:e.emptySlot.dotSize/2,backgroundColor:r.emptyDotBackground,border:`${e.emptySlot.borderWidth}px solid ${r.emptyDotBorder}`}}):k(Ve,{children:[n("div",{style:{position:"absolute",width:`${e.icon.gradientBgSizePercent}%`,height:`${e.icon.gradientBgSizePercent}%`,borderRadius:e.icon.gradientBgBorderRadius,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:e.icon.gradientBgOpacity}}),n("div",{style:{position:"absolute",width:`${e.icon.innerGlowSizePercent}%`,height:`${e.icon.innerGlowSizePercent}%`,borderRadius:e.icon.innerGlowBorderRadius,backgroundColor:"rgba(255, 255, 255, 0.02)",opacity:e.icon.innerGlowOpacity}}),n("div",{style:{marginBottom:e.icon.wrapperMarginBottom,display:"flex",alignItems:"center",justifyContent:"center",fontSize:32,filter:z?"brightness(1.2)":"none"},children:o.icon}),n("span",{style:{fontSize:o.name.length>8?Math.max(e.icon.label.fontSize*.7,e.icon.label.fontSize*8/o.name.length):e.icon.label.fontSize,fontWeight:e.icon.label.fontWeight,fontFamily:e.icon.label.fontFamily,color:r.iconLabel,letterSpacing:e.icon.label.letterSpacing,marginTop:e.icon.label.marginTop,textTransform:"uppercase",whiteSpace:"nowrap"},children:o.name}),R&&n("span",{style:{fontSize:e.icon.label.fontSize-1,fontWeight:e.icon.label.fontWeight,fontFamily:e.icon.label.fontFamily,letterSpacing:e.icon.label.letterSpacing,color:Oe.muted,textTransform:"uppercase",whiteSpace:"nowrap"},children:"Unavailable"})]})})})}function Ce({side:o,color:m}){const I=o==="prev"?[[15,18,9,12],[9,12,15,6]]:[[9,18,15,12],[15,12,9,6]];return n("svg",{width:18,height:18,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:I.map(([h,c,x,z],D)=>n("line",{x1:h,y1:c,x2:x,y2:z,stroke:m,strokeWidth:2},D))})}function ve({side:o,disabled:m,onClick:I}){const[h,c]=p(false);const x=m?r.emptyDotBorder:r.accent;return k("button",{type:"button","aria-label":`${o==="prev"?"Previous":"Next"} dial page`,"data-testid":`buoy-dial-${o}`,disabled:m,onClick:I,onPointerDown:()=>!m&&c(true),onPointerUp:()=>c(false),onPointerLeave:()=>c(false),onPointerCancel:()=>c(false),style:{display:"flex",alignItems:"center",gap:4,padding:"10px 16px",borderRadius:10,border:`1px solid ${r.dialBorder}`,backgroundColor:r.dialBackground,color:m?r.iconLabelMuted:r.centerText,fontSize:12,fontWeight:900,fontFamily:de,letterSpacing:1.5,textTransform:"uppercase",cursor:m?"default":"pointer",opacity:m?.4:1,boxShadow:m?"none":`0 0 8px ${be(r.dialShadow,.4)}`,transform:h?"scale(0.92)":"scale(1)",transition:"transform 100ms ease"},children:[o==="prev"&&n(Ce,{side:"prev",color:x}),o==="prev"?"PREV":"NEXT",o==="next"&&n(Ce,{side:"next",color:x})]})}export function DialMenu({icons:o,onClose:m,centerLabel:I="MENU",onCenterPress:h,settingsOpen:c=false,hintsDisabled:x=false,emptyNote:z}){const{id:D}=Ue();const[N,w]=p(0);const[b,R]=p(0);const[T,V]=p(0);const[P,d]=p(0);const[$,L]=p(0);const[te,_]=p(1);const[A,X]=p(false);const[ne,oe]=p(false);const[ke,ze]=p(false);const ie=Q(null);const pe=Q(null);const S=Q(null);const Y=Q(false);const{entrance:j,exit:O,interaction:q}=ye;const Te=je();const[re,Pe]=p(()=>({width:window.innerWidth,height:window.innerHeight}));E(()=>{const i=()=>Pe({width:window.innerWidth,height:window.innerHeight});window.addEventListener("resize",i);return()=>window.removeEventListener("resize",i)},[]);const a=J(()=>Le({screenWidth:re.width,maxCircleSize:Math.max(120,Math.min(320,re.height-96))}),[re]);const Be=J(()=>We(),[]);const Ie=J(()=>Fe(K,a.iconRadius),[a.iconRadius]);const[De,Re]=p(0);const F=Math.max(1,Math.ceil(o.length/K));const C=Math.min(De,F-1);const me=J(()=>{const i=C*K;const t=[...o.slice(i,i+K)];while(t.length<K){t.push({id:`empty-${t.length}`,name:"",icon:null,onPress:()=>{}})}return t},[o,C]);E(()=>{Ye()},[]);E(()=>{const i=j.backdrop.duration;const t=j.dial.rotation.duration;const f=j.centerButton.delay;const l=j.icons.delay;const u=j.icons.duration;const g=performance.now();const y=B=>{const s=B-g;w(Math.min(1,s/i));const v=Math.min(1,s/400);let W=H(v)*1.1;if(v>.7){W-=(v-.7)*.33}if(v>=1)W=1;R(Math.max(0,Math.min(1.05,W)));const M=Math.min(1,s/t);V(H(M)*360);if(s>=f){const G=Math.min(1,(s-f)/300);let ce=H(G)*1.15;if(G>.6){ce-=(G-.6)*.375}if(G>=1)ce=1;d(Math.max(0,Math.min(1.05,ce)))}if(s>=l){const G=Math.min(1,(s-l)/u);L(H(G))}const le=l+u;if(s<le){S.current=requestAnimationFrame(y)}else{w(1);R(1);V(360);d(1);L(1);ze(true)}};S.current=requestAnimationFrame(y);return()=>{if(S.current)cancelAnimationFrame(S.current)}},[]);const U=ee(()=>{if(Y.current)return;Y.current=true;oe(true);if(S.current){cancelAnimationFrame(S.current)}const i=performance.now();const t=O.icons.duration;const f=O.centerButton.duration;const l=O.dialScale.duration;const u=Math.max(f,l);const g=O.backdrop.duration;const y=B=>{const s=B-i;if(s<t){const M=ue(s/t);L(1-M);S.current=requestAnimationFrame(y);return}const v=t;if(s<v+u){L(0);const M=Math.min(1,(s-v)/f);const le=Math.min(1,(s-v)/l);d(1-ue(M));R(1-ue(le));S.current=requestAnimationFrame(y);return}const W=v+u;if(s<W+g){R(0);d(0);const M=(s-W)/g;w(1-M);S.current=requestAnimationFrame(y);return}w(0);m()};S.current=requestAnimationFrame(y)},[O,m]);E(()=>{const i=document.activeElement;const t=ie.current;return()=>{if(i?.isConnected&&(document.activeElement===document.body||t?.contains(document.activeElement))){i.focus()}}},[]);E(()=>{if(c)return;pe.current?.focus();const i=t=>{const f=ie.current;if(!f)return;if(t.key==="Escape"){t.preventDefault();U()}else if(t.key==="Tab"){const l=Array.from(f.querySelectorAll('button:not(:disabled):not([aria-disabled="true"]), [tabindex="0"]')).filter(y=>y.getClientRects().length>0);const u=l[0];const g=l[l.length-1];if(!f.contains(document.activeElement)||(t.shiftKey?document.activeElement===u:document.activeElement===g)){t.preventDefault();(t.shiftKey?g:u)?.focus()}}else if(["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"].includes(t.key)){const l=Array.from(f.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])'));const u=l.indexOf(document.activeElement);if(u<0||!l.length)return;t.preventDefault();const g=t.key==="Home"?0:t.key==="End"?l.length-1:(u+(t.key==="ArrowRight"||t.key==="ArrowDown"?1:-1)+l.length)%l.length;l[g].focus()}};document.addEventListener("keydown",i);return()=>document.removeEventListener("keydown",i)},[U,c]);const[ae,fe]=p(false);E(()=>{if(x)return;let i=false;const t=setTimeout(async()=>{const f=await Se.getItem(xe);if(!i&&!f)fe(true)},1200);return()=>{i=true;clearTimeout(t)}},[x]);const se=ee(()=>{fe(false);void Se.setItem(xe,"true")},[]);E(()=>{if(c&&ae){se()}},[c,ae,se]);const Ae=ee(i=>{if(i.id.startsWith("empty-")||Y.current)return;const[t,f]=q.iconSelect.pulse;const l=performance.now();const u=150;const g=y=>{const B=y-l;if(B<u){const s=H(B/u);_(1-(1-t.scale)*s);requestAnimationFrame(g)}else if(B<u*2){const s=H((B-u)/u);_(t.scale+(f.scale-t.scale)*s);requestAnimationFrame(g)}else{_(1)}};requestAnimationFrame(g);setTimeout(()=>{i.onPress();U()},q.iconSelect.actionDelay)},[q.iconSelect,U]);const ge=ee(i=>{if(Y.current)return;const t=Math.max(0,Math.min(i,F-1));if(t!==C)Re(t)},[F,C]);const Z=a.buttonSize*e.centerButton.containerRatio;const he=a.buttonSize*e.centerButton.borderRatio;const Me=a.buttonSize*e.centerButton.containerRatio/2+6;const Ee=ke&&!ne;return k("div",{ref:ie,role:"dialog","aria-label":"Dial Menu","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:1e4},children:[n("button",{type:"button","aria-label":"Close dial menu",tabIndex:0,onClick:U,style:{position:"absolute",inset:0,border:0,padding:0,backgroundColor:r.dialBackdrop,opacity:N}}),z?n("div",{role:"status","data-testid":"buoy-dial-empty-note",style:{position:"absolute",left:16,right:16,bottom:80+a.circleSize+16,color:r.iconLabel,fontSize:12,fontFamily:de,textAlign:"center",opacity:b>.01?1:0},children:z}):null,k("div",{style:{position:"absolute",left:"50%",marginLeft:-a.circleSize/2,bottom:80,width:a.circleSize,height:a.circleSize,borderRadius:"50%",backgroundColor:r.dialBackground,border:`${e.circle.borderWidth}px solid ${r.dialBorder}`,boxShadow:`0 0 ${e.circle.shadowRadius}px ${be(r.dialShadow,e.circle.shadowOpacity)}`,transform:`scale(${b}) rotate(${T}deg)`,opacity:b>.01?1:0,overflow:"hidden"},children:[n("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:r.dialGradient1,opacity:e.gradientLayers[0].opacity}}),n("div",{style:{position:"absolute",inset:0,top:"30%",left:"30%",borderRadius:"50%",backgroundColor:r.dialGradient2,opacity:e.gradientLayers[1].opacity}}),n("div",{style:{position:"absolute",inset:0,top:"50%",left:"50%",borderRadius:"50%",backgroundColor:r.dialGradient3,opacity:e.gradientLayers[2].opacity}}),Be.map(i=>n("div",{style:{position:"absolute",top:"50%",left:0,right:0,height:e.grid.lineHeight,transform:`rotate(${i}deg)`,transformOrigin:"center"},children:["left","right"].map(t=>n("div",{style:{position:"absolute",top:0,[t]:0,width:`calc(50% - ${Me}px)`,height:e.grid.lineHeight,backgroundColor:r.dialGridLine}},t))},i)),n("div",{"data-testid":"dial-background","data-background":D,style:{position:"absolute",inset:0,pointerEvents:"none"},children:D==="hyperspace"?n(Ke,{size:a.circleSize}):n(qe,{focus:Xe})}),me.map((i,t)=>n(Ze,{icon:i,index:t,totalIcons:me.length,position:Ie[t],progress:$,onPress:()=>Ae(i)},t)),k("div",{style:{position:"absolute",left:"50%",top:"50%",width:Z,height:Z,marginLeft:-Z/2,marginTop:-Z/2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:r.hubHalo,borderRadius:a.buttonSize,overflow:"hidden",transform:`scale(${P*te})`,opacity:P>.01?1:0},children:[n("div",{style:{position:"absolute",inset:0,backgroundColor:r.dialGradient1,opacity:.5,borderRadius:a.buttonSize}}),n("div",{style:{position:"absolute",inset:0,top:"20%",left:"20%",backgroundColor:r.dialGradient2,opacity:.3,borderRadius:a.buttonSize}}),n("div",{style:{position:"absolute",inset:0,top:"40%",left:"40%",backgroundColor:r.dialGradient3,opacity:.2,borderRadius:a.buttonSize}}),n("div",{style:{width:he,height:he,borderRadius:a.buttonSize*e.centerButton.borderRadiusRatio,backgroundColor:r.hubFill,display:"flex",alignItems:"center",justifyContent:"center"},children:n("button",{ref:pe,type:"button","aria-label":c?"Close Settings":"Open Dev Tools Settings",disabled:!h,onClick:h,onPointerEnter:i=>i.pointerType==="mouse"&&X(true),onPointerLeave:()=>X(false),style:{border:0,padding:0,background:"transparent",width:a.buttonSize,height:a.buttonSize,borderRadius:a.buttonSize/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:h?"pointer":"default",transform:A?`scale(${q.centerHover.scale})`:"scale(1)",transition:`transform ${q.centerHover.duration}ms ease`,animation:Ee&&!A?Te.pulse:"none"},children:c?k("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",fontSize:e.centerButton.text.fontSize-2,fontWeight:e.centerButton.text.fontWeight,fontFamily:e.centerButton.text.fontFamily,color:r.centerText,letterSpacing:e.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${r.centerTextGlow}`,textTransform:"uppercase",lineHeight:1.2},children:[n("span",{style:{marginBottom:-2},children:"CLOSE"}),n("span",{style:{marginTop:-2},children:"SETTINGS"})]}):n("span",{style:{fontSize:e.centerButton.text.fontSize,fontWeight:e.centerButton.text.fontWeight,fontFamily:e.centerButton.text.fontFamily,color:r.centerText,letterSpacing:e.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${r.centerTextGlow}`,textTransform:"uppercase"},children:I})})})]})]}),F>1&&k("div",{style:{position:"absolute",left:"50%",marginLeft:-a.circleSize/2,top:"calc(100% - 64px)",width:a.circleSize,display:"flex",alignItems:"center",justifyContent:"space-between",opacity:Math.min(1,b),transform:`scale(${Math.min(1,b)})`},children:[n(ve,{side:"prev",disabled:C<=0,onClick:()=>ge(C-1)}),k("span",{"data-testid":"buoy-dial-page",style:{padding:"6px 12px",fontSize:13,fontWeight:900,fontFamily:de,letterSpacing:2,color:r.centerText,textShadow:`0 0 6px ${r.centerTextGlow}`},children:[String(C+1).padStart(2,"0"),k("span",{style:{color:r.iconLabelMuted,textShadow:"none"},children:[" / ",String(F).padStart(2,"0")]})]}),n(ve,{side:"next",disabled:C>=F-1,onClick:()=>ge(C+1)})]}),ae&&!c&&n(Ne,{title:"Welcome to Buoy!",message:"Tap the center button to configure and add tools to your dial menu.",onDismiss:se,showArrow:false})]})}
1
+ "use strict";import{useState as p,useEffect as E,useMemo as J,useRef as Q,useCallback as ee}from"react";import{dialAccessibilityLabel as $e}from"./dialA11y.js";import{getDialLayout as Le,getAllIconPositions as Fe,getGridLineRotations as We,getIconStaggerInputRange as Ge,MAX_DIAL_SLOTS as N,DIAL_ICON_SIZE as _e,dialAnimationConfig as ye,getDialCSSKeyframesString as He,getDialCSSAnimationStyles as Oe,dialColors as r,dialStyles as e,withAlpha as be,floatingToolsColors as je}from"@buoy-gg/floating-tools-react";import{persistentStorage as Se,monoFont as de,ToolBackground as qe,useToolBackground as Ue}from"@buoy-gg/shared-ui";import{DialHyperspace as Ke}from"./DialHyperspace.js";import{OnboardingTooltip as Ne}from"./OnboardingTooltip.web.js";import{BUOY_DIAL_BACK_PRIORITY as Ye,useCapacitorBackButton as Ve}from"../capacitorBackButton.js";import{jsx as n,Fragment as Xe,jsxs as k}from"react/jsx-runtime";const Ze={x:.5,y:.5};const xe="@react_buoy_settings_tooltip_shown";let we=false;function Je(){if(we||typeof document==="undefined")return;const o=document.createElement("style");o.textContent=He();document.head.appendChild(o);we=true}const H=o=>1-Math.pow(1-o,3);const ue=o=>o*o*o;function Qe({icon:o,index:m,totalIcons:P,position:g,progress:l,onPress:x}){const[z,R]=p(false);const[Y,w]=p(false);const b=!o.icon&&o.id.startsWith("empty-");const D=!b&&o.unavailable===true;const B=!b&&!D;const{icons:V}=ye;const T=Ge(m,P);let d=0;if(l<=T[1]){d=0}else if(l<=T[2]){d=(l-T[1])/(T[2]-T[1])}else{d=1}d=Math.max(0,Math.min(1,d));const $=_e;const L=V.pressIn.scale;const te=1.1;const O=d*(Y?L:z?te:1);let A=0;if(d<=0){A=0}else if(d<=.3){A=d}else{A=.3+(d-.3)*(.7/.7)}const X=g.x*(d-1);const ne=g.y*(d-1);return n("button",{role:"menuitem","aria-label":b?"Empty slot":$e(o.id,o.name),"data-testid":o.id?`buoy-dial-${o.id}`:void 0,"aria-disabled":!B,tabIndex:B?0:-1,onClick:B?x:void 0,onPointerEnter:oe=>B&&oe.pointerType==="mouse"&&R(true),onPointerLeave:()=>{R(false);w(false)},onPointerDown:()=>B&&w(true),onPointerUp:()=>w(false),onPointerCancel:()=>w(false),style:{position:"absolute",left:`calc(50% + ${g.x}px)`,top:`calc(50% + ${g.y}px)`,width:$,height:$,marginLeft:-$/2,marginTop:-$/2,cursor:B?"pointer":"default",background:"none",border:"none",padding:0},children:n("span",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",transform:`translate(${X}px, ${ne}px) scale(${O})`,opacity:A,transition:z||Y?"transform 100ms ease":"none"},children:b?n("div",{style:{width:e.emptySlot.dotSize,height:e.emptySlot.dotSize,borderRadius:e.emptySlot.dotSize/2,backgroundColor:r.emptyDotBackground,border:`${e.emptySlot.borderWidth}px solid ${r.emptyDotBorder}`}}):k(Xe,{children:[n("div",{style:{position:"absolute",width:`${e.icon.gradientBgSizePercent}%`,height:`${e.icon.gradientBgSizePercent}%`,borderRadius:e.icon.gradientBgBorderRadius,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:e.icon.gradientBgOpacity}}),n("div",{style:{position:"absolute",width:`${e.icon.innerGlowSizePercent}%`,height:`${e.icon.innerGlowSizePercent}%`,borderRadius:e.icon.innerGlowBorderRadius,backgroundColor:"rgba(255, 255, 255, 0.02)",opacity:e.icon.innerGlowOpacity}}),n("div",{style:{marginBottom:e.icon.wrapperMarginBottom,display:"flex",alignItems:"center",justifyContent:"center",fontSize:32,filter:z?"brightness(1.2)":"none"},children:o.icon}),n("span",{style:{fontSize:o.name.length>8?Math.max(e.icon.label.fontSize*.7,e.icon.label.fontSize*8/o.name.length):e.icon.label.fontSize,fontWeight:e.icon.label.fontWeight,fontFamily:e.icon.label.fontFamily,color:r.iconLabel,letterSpacing:e.icon.label.letterSpacing,marginTop:e.icon.label.marginTop,textTransform:"uppercase",whiteSpace:"nowrap"},children:o.name}),D&&n("span",{style:{fontSize:e.icon.label.fontSize-1,fontWeight:e.icon.label.fontWeight,fontFamily:e.icon.label.fontFamily,letterSpacing:e.icon.label.letterSpacing,color:je.muted,textTransform:"uppercase",whiteSpace:"nowrap"},children:"Unavailable"})]})})})}function Ce({side:o,color:m}){const P=o==="prev"?[[15,18,9,12],[9,12,15,6]]:[[9,18,15,12],[15,12,9,6]];return n("svg",{width:18,height:18,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:P.map(([g,l,x,z],R)=>n("line",{x1:g,y1:l,x2:x,y2:z,stroke:m,strokeWidth:2},R))})}function ve({side:o,disabled:m,onClick:P}){const[g,l]=p(false);const x=m?r.emptyDotBorder:r.accent;return k("button",{type:"button","aria-label":`${o==="prev"?"Previous":"Next"} dial page`,"data-testid":`buoy-dial-${o}`,disabled:m,onClick:P,onPointerDown:()=>!m&&l(true),onPointerUp:()=>l(false),onPointerLeave:()=>l(false),onPointerCancel:()=>l(false),style:{display:"flex",alignItems:"center",gap:4,padding:"10px 16px",borderRadius:10,border:`1px solid ${r.dialBorder}`,backgroundColor:r.dialBackground,color:m?r.iconLabelMuted:r.centerText,fontSize:12,fontWeight:900,fontFamily:de,letterSpacing:1.5,textTransform:"uppercase",cursor:m?"default":"pointer",opacity:m?.4:1,boxShadow:m?"none":`0 0 8px ${be(r.dialShadow,.4)}`,transform:g?"scale(0.92)":"scale(1)",transition:"transform 100ms ease"},children:[o==="prev"&&n(Ce,{side:"prev",color:x}),o==="prev"?"PREV":"NEXT",o==="next"&&n(Ce,{side:"next",color:x})]})}export function DialMenu({icons:o,onClose:m,centerLabel:P="MENU",onCenterPress:g,settingsOpen:l=false,hintsDisabled:x=false,emptyNote:z}){const{id:R}=Ue();const[Y,w]=p(0);const[b,D]=p(0);const[B,V]=p(0);const[T,d]=p(0);const[$,L]=p(0);const[te,O]=p(1);const[A,X]=p(false);const[ne,oe]=p(false);const[ke,ze]=p(false);const ie=Q(null);const pe=Q(null);const S=Q(null);const j=Q(false);const{entrance:q,exit:U,interaction:K}=ye;const Be=Oe();const[re,Te]=p(()=>({width:window.innerWidth,height:window.innerHeight}));E(()=>{const i=()=>Te({width:window.innerWidth,height:window.innerHeight});window.addEventListener("resize",i);return()=>window.removeEventListener("resize",i)},[]);const a=J(()=>Le({screenWidth:re.width,maxCircleSize:Math.max(120,Math.min(320,re.height-96))}),[re]);const Ie=J(()=>We(),[]);const Pe=J(()=>Fe(N,a.iconRadius),[a.iconRadius]);const[Re,De]=p(0);const F=Math.max(1,Math.ceil(o.length/N));const C=Math.min(Re,F-1);const me=J(()=>{const i=C*N;const t=[...o.slice(i,i+N)];while(t.length<N){t.push({id:`empty-${t.length}`,name:"",icon:null,onPress:()=>{}})}return t},[o,C]);E(()=>{Je()},[]);E(()=>{const i=q.backdrop.duration;const t=q.dial.rotation.duration;const f=q.centerButton.delay;const c=q.icons.delay;const u=q.icons.duration;const h=performance.now();const y=I=>{const s=I-h;w(Math.min(1,s/i));const v=Math.min(1,s/400);let G=H(v)*1.1;if(v>.7){G-=(v-.7)*.33}if(v>=1)G=1;D(Math.max(0,Math.min(1.05,G)));const M=Math.min(1,s/t);V(H(M)*360);if(s>=f){const _=Math.min(1,(s-f)/300);let ce=H(_)*1.15;if(_>.6){ce-=(_-.6)*.375}if(_>=1)ce=1;d(Math.max(0,Math.min(1.05,ce)))}if(s>=c){const _=Math.min(1,(s-c)/u);L(H(_))}const le=c+u;if(s<le){S.current=requestAnimationFrame(y)}else{w(1);D(1);V(360);d(1);L(1);ze(true)}};S.current=requestAnimationFrame(y);return()=>{if(S.current)cancelAnimationFrame(S.current)}},[]);const W=ee(()=>{if(j.current)return;j.current=true;oe(true);if(S.current){cancelAnimationFrame(S.current)}const i=performance.now();const t=U.icons.duration;const f=U.centerButton.duration;const c=U.dialScale.duration;const u=Math.max(f,c);const h=U.backdrop.duration;const y=I=>{const s=I-i;if(s<t){const M=ue(s/t);L(1-M);S.current=requestAnimationFrame(y);return}const v=t;if(s<v+u){L(0);const M=Math.min(1,(s-v)/f);const le=Math.min(1,(s-v)/c);d(1-ue(M));D(1-ue(le));S.current=requestAnimationFrame(y);return}const G=v+u;if(s<G+h){D(0);d(0);const M=(s-G)/h;w(1-M);S.current=requestAnimationFrame(y);return}w(0);m()};S.current=requestAnimationFrame(y)},[U,m]);Ve(true,()=>{if(j.current)return;if(l)g?.();else W()},Ye);E(()=>{const i=document.activeElement;const t=ie.current;return()=>{if(i?.isConnected&&(document.activeElement===document.body||t?.contains(document.activeElement))){i.focus()}}},[]);E(()=>{if(l)return;pe.current?.focus();const i=t=>{const f=ie.current;if(!f)return;if(t.key==="Escape"){t.preventDefault();W()}else if(t.key==="Tab"){const c=Array.from(f.querySelectorAll('button:not(:disabled):not([aria-disabled="true"]), [tabindex="0"]')).filter(y=>y.getClientRects().length>0);const u=c[0];const h=c[c.length-1];if(!f.contains(document.activeElement)||(t.shiftKey?document.activeElement===u:document.activeElement===h)){t.preventDefault();(t.shiftKey?h:u)?.focus()}}else if(["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End"].includes(t.key)){const c=Array.from(f.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])'));const u=c.indexOf(document.activeElement);if(u<0||!c.length)return;t.preventDefault();const h=t.key==="Home"?0:t.key==="End"?c.length-1:(u+(t.key==="ArrowRight"||t.key==="ArrowDown"?1:-1)+c.length)%c.length;c[h].focus()}};document.addEventListener("keydown",i);return()=>document.removeEventListener("keydown",i)},[W,l]);const[ae,fe]=p(false);E(()=>{if(x)return;let i=false;const t=setTimeout(async()=>{const f=await Se.getItem(xe);if(!i&&!f)fe(true)},1200);return()=>{i=true;clearTimeout(t)}},[x]);const se=ee(()=>{fe(false);void Se.setItem(xe,"true")},[]);E(()=>{if(l&&ae){se()}},[l,ae,se]);const Ae=ee(i=>{if(i.id.startsWith("empty-")||j.current)return;const[t,f]=K.iconSelect.pulse;const c=performance.now();const u=150;const h=y=>{const I=y-c;if(I<u){const s=H(I/u);O(1-(1-t.scale)*s);requestAnimationFrame(h)}else if(I<u*2){const s=H((I-u)/u);O(t.scale+(f.scale-t.scale)*s);requestAnimationFrame(h)}else{O(1)}};requestAnimationFrame(h);setTimeout(()=>{i.onPress();W()},K.iconSelect.actionDelay)},[K.iconSelect,W]);const ge=ee(i=>{if(j.current)return;const t=Math.max(0,Math.min(i,F-1));if(t!==C)De(t)},[F,C]);const Z=a.buttonSize*e.centerButton.containerRatio;const he=a.buttonSize*e.centerButton.borderRatio;const Me=a.buttonSize*e.centerButton.containerRatio/2+6;const Ee=ke&&!ne;return k("div",{ref:ie,role:"dialog","aria-label":"Dial Menu","aria-modal":"true",style:{position:"fixed",inset:0,zIndex:1e4},children:[n("button",{type:"button","aria-label":"Close dial menu",tabIndex:0,onClick:W,style:{position:"absolute",inset:0,border:0,padding:0,backgroundColor:r.dialBackdrop,opacity:Y}}),z?n("div",{role:"status","data-testid":"buoy-dial-empty-note",style:{position:"absolute",left:16,right:16,bottom:80+a.circleSize+16,color:r.iconLabel,fontSize:12,fontFamily:de,textAlign:"center",opacity:b>.01?1:0},children:z}):null,k("div",{style:{position:"absolute",left:"50%",marginLeft:-a.circleSize/2,bottom:80,width:a.circleSize,height:a.circleSize,borderRadius:"50%",backgroundColor:r.dialBackground,border:`${e.circle.borderWidth}px solid ${r.dialBorder}`,boxShadow:`0 0 ${e.circle.shadowRadius}px ${be(r.dialShadow,e.circle.shadowOpacity)}`,transform:`scale(${b}) rotate(${B}deg)`,opacity:b>.01?1:0,overflow:"hidden"},children:[n("div",{style:{position:"absolute",inset:0,borderRadius:"50%",backgroundColor:r.dialGradient1,opacity:e.gradientLayers[0].opacity}}),n("div",{style:{position:"absolute",inset:0,top:"30%",left:"30%",borderRadius:"50%",backgroundColor:r.dialGradient2,opacity:e.gradientLayers[1].opacity}}),n("div",{style:{position:"absolute",inset:0,top:"50%",left:"50%",borderRadius:"50%",backgroundColor:r.dialGradient3,opacity:e.gradientLayers[2].opacity}}),Ie.map(i=>n("div",{style:{position:"absolute",top:"50%",left:0,right:0,height:e.grid.lineHeight,transform:`rotate(${i}deg)`,transformOrigin:"center"},children:["left","right"].map(t=>n("div",{style:{position:"absolute",top:0,[t]:0,width:`calc(50% - ${Me}px)`,height:e.grid.lineHeight,backgroundColor:r.dialGridLine}},t))},i)),n("div",{"data-testid":"dial-background","data-background":R,style:{position:"absolute",inset:0,pointerEvents:"none"},children:R==="hyperspace"?n(Ke,{size:a.circleSize}):n(qe,{focus:Ze})}),me.map((i,t)=>n(Qe,{icon:i,index:t,totalIcons:me.length,position:Pe[t],progress:$,onPress:()=>Ae(i)},t)),k("div",{style:{position:"absolute",left:"50%",top:"50%",width:Z,height:Z,marginLeft:-Z/2,marginTop:-Z/2,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:r.hubHalo,borderRadius:a.buttonSize,overflow:"hidden",transform:`scale(${T*te})`,opacity:T>.01?1:0},children:[n("div",{style:{position:"absolute",inset:0,backgroundColor:r.dialGradient1,opacity:.5,borderRadius:a.buttonSize}}),n("div",{style:{position:"absolute",inset:0,top:"20%",left:"20%",backgroundColor:r.dialGradient2,opacity:.3,borderRadius:a.buttonSize}}),n("div",{style:{position:"absolute",inset:0,top:"40%",left:"40%",backgroundColor:r.dialGradient3,opacity:.2,borderRadius:a.buttonSize}}),n("div",{style:{width:he,height:he,borderRadius:a.buttonSize*e.centerButton.borderRadiusRatio,backgroundColor:r.hubFill,display:"flex",alignItems:"center",justifyContent:"center"},children:n("button",{ref:pe,type:"button","aria-label":l?"Close Settings":"Open Dev Tools Settings",disabled:!g,onClick:g,onPointerEnter:i=>i.pointerType==="mouse"&&X(true),onPointerLeave:()=>X(false),style:{border:0,padding:0,background:"transparent",width:a.buttonSize,height:a.buttonSize,borderRadius:a.buttonSize/2,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:g?"pointer":"default",transform:A?`scale(${K.centerHover.scale})`:"scale(1)",transition:`transform ${K.centerHover.duration}ms ease`,animation:Ee&&!A?Be.pulse:"none"},children:l?k("span",{style:{display:"flex",flexDirection:"column",alignItems:"center",fontSize:e.centerButton.text.fontSize-2,fontWeight:e.centerButton.text.fontWeight,fontFamily:e.centerButton.text.fontFamily,color:r.centerText,letterSpacing:e.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${r.centerTextGlow}`,textTransform:"uppercase",lineHeight:1.2},children:[n("span",{style:{marginBottom:-2},children:"CLOSE"}),n("span",{style:{marginTop:-2},children:"SETTINGS"})]}):n("span",{style:{fontSize:e.centerButton.text.fontSize,fontWeight:e.centerButton.text.fontWeight,fontFamily:e.centerButton.text.fontFamily,color:r.centerText,letterSpacing:e.centerButton.text.letterSpacing,textAlign:"center",textShadow:`0 0 4px ${r.centerTextGlow}`,textTransform:"uppercase"},children:P})})})]})]}),F>1&&k("div",{style:{position:"absolute",left:"50%",marginLeft:-a.circleSize/2,top:"calc(100% - 64px)",width:a.circleSize,display:"flex",alignItems:"center",justifyContent:"space-between",opacity:Math.min(1,b),transform:`scale(${Math.min(1,b)})`},children:[n(ve,{side:"prev",disabled:C<=0,onClick:()=>ge(C-1)}),k("span",{"data-testid":"buoy-dial-page",style:{padding:"6px 12px",fontSize:13,fontWeight:900,fontFamily:de,letterSpacing:2,color:r.centerText,textShadow:`0 0 6px ${r.centerTextGlow}`},children:[String(C+1).padStart(2,"0"),k("span",{style:{color:r.iconLabelMuted,textShadow:"none"},children:[" / ",String(F).padStart(2,"0")]})]}),n(ve,{side:"next",disabled:C>=F-1,onClick:()=>ge(C+1)})]}),ae&&!l&&n(Ne,{title:"Welcome to Buoy!",message:"Tap the center button to configure and add tools to your dial menu.",onDismiss:se,showArrow:false})]})}
@@ -1 +1 @@
1
- "use strict";export function externalSyncOptions(e){return typeof e==="object"&&e!==null?e:void 0}export function shouldMountExternalSync({isDevelopment:e,isLicensed:o,externalSync:r,isAvailable:t}){if(r===false)return false;if(!t)return false;if(e)return true;const n=externalSyncOptions(r);return o&&n?.enableInRelease===true&&releaseTransportProblem(n.socketURL,n)===null}export const RELEASE_DEFAULT_SOCKET_URL="http://localhost:42831";function i(e){return e==="localhost"||e.endsWith(".localhost")||/^127\.\d+\.\d+\.\d+$/.test(e)||e==="[::1]"||e==="::1"||e==="10.0.2.2"}export function releaseTransportProblem(e,o){const r=e??RELEASE_DEFAULT_SOCKET_URL;if(o?.allowInsecureNetwork===true)return null;let t;try{t=new URL(r)}catch{return`[Buoy] externalSync.socketURL "${r}" isn't a valid URL, so this release build won't connect to Buoy Desktop.`}if(t.protocol==="https:"||t.protocol==="wss:")return null;if(i(t.hostname))return null;return`[Buoy] This release build won't connect to ${r}: release sync carries real user data, and plain http to another machine is readable by anyone on the same network. Use a simulator, an emulator or adb reverse (localhost), an https:// broker, or set externalSync.allowInsecureNetwork: true for a network you trust.`}export const RELEASE_GATED_ACTIONS={impersonate:["searchUsers","startImpersonation","resumeImpersonation","updateSettings","removeFromHistory","clearHistory"]};export function applyReleaseActionPolicy(e,o,r){if(o)return e;let t=null;for(const[n,u]of Object.entries(RELEASE_GATED_ACTIONS)){if(r?.includes(n))continue;const s=e[n];if(!s?.actions)continue;const a={...s.actions};for(const l of u){if(!(l in a))continue;a[l]=()=>{throw new Error(`${n}.${l} is off in release builds. To allow it from Buoy Desktop and the MCP, pass externalSync={{ enableInRelease: true, releaseActions: ["${n}"] }}.`)}}t??={...e};t[n]={...s,actions:a}}return t??e}
1
+ "use strict";export function externalSyncOptions(e){return typeof e==="object"&&e!==null?e:void 0}export function shouldMountExternalSync({isDevelopment:e,isLicensed:o,externalSync:n,isAvailable:t}){if(n===false)return false;if(!t)return false;if(e)return true;const r=externalSyncOptions(n);return o&&r?.enableInRelease===true&&releaseTransportProblem(r.socketURL,r)===null}export const RELEASE_DEFAULT_SOCKET_URL="http://localhost:42831";function i(e){return e==="localhost"||e.endsWith(".localhost")||/^127\.\d+\.\d+\.\d+$/.test(e)||e==="[::1]"||e==="::1"||e==="10.0.2.2"}export function releaseTransportProblem(e,o){const n=e??RELEASE_DEFAULT_SOCKET_URL;if(o?.allowInsecureNetwork===true)return null;let t;try{t=new URL(n)}catch{return`[Buoy] externalSync.socketURL "${n}" isn't a valid URL, so this release build won't connect to Buoy Desktop.`}if(t.protocol==="https:"||t.protocol==="wss:")return null;if(i(t.hostname))return null;return`[Buoy] This release build won't connect to ${n}: release sync carries real user data, and plain http to another machine is readable by anyone on the same network. Use a simulator, an emulator or adb reverse (localhost), an https:// broker, or set externalSync.allowInsecureNetwork: true for a network you trust.`}export const RELEASE_GATED_ACTIONS={"ota-update-inspector":["check","fetch","reload","setHeaders","setURL"],impersonate:["searchUsers","startImpersonation","resumeImpersonation","updateSettings","removeFromHistory","clearHistory"]};export function applyReleaseActionPolicy(e,o,n){if(o)return e;let t=null;for(const[r,u]of Object.entries(RELEASE_GATED_ACTIONS)){if(n?.includes(r))continue;const s=e[r];if(!s?.actions)continue;const a={...s.actions};for(const l of u){if(!(l in a))continue;a[l]=()=>{throw new Error(`${r}.${l} is off in release builds. To allow it from Buoy Desktop and the MCP, pass externalSync={{ enableInRelease: true, releaseActions: ["${r}"] }}.`)}}t??={...e};t[r]={...s,actions:a}}return t??e}
@@ -0,0 +1 @@
1
+ "use strict";import{useEffect as a,useRef as n}from"react";import{BackHandler as s,Platform as c}from"react-native";export{resolveBackTarget}from"./backTarget.js";export function useHardwareBack(r,e){const t=n(e);t.current=e;a(()=>{if(!r||c.OS!=="android")return;const o=s.addEventListener("hardwareBackPress",()=>t.current());return()=>o.remove()},[r])}
@@ -1 +1 @@
1
- "use strict";export const SDK_VERSION="7.0.77";
1
+ "use strict";export const SDK_VERSION="7.0.79";
@@ -9,9 +9,19 @@
9
9
  * `adopt` and turns each record into a normal request row, including requests
10
10
  * that are still in flight. After that the recorder only passes calls through.
11
11
  *
12
- * It has no dependencies because it loads before everything else. The shape
13
- * of `window.__BUOY_EARLY_NETWORK__` is shared with @buoy-gg/network
14
- * (network/utils/adoptEarlyNetwork.ts); change both together.
12
+ * It has no dependencies because it loads before everything else. The handle
13
+ * lives on `window[Symbol.for('buoy.earlyNetwork')]` (EARLY_NETWORK_KEY), a
14
+ * non-enumerable, read-only property. Its shape is shared with
15
+ * @buoy-gg/network (network/utils/networkListener.ts, adoptEarlyRequests);
16
+ * change both together. The records array itself is never exposed: page
17
+ * scripts can't read or rewrite it in place, and `adopt` hands each record
18
+ * out once.
19
+ *
20
+ * Legacy: `window.__BUOY_EARLY_NETWORK__` stays for one more version, so an
21
+ * older @buoy-gg/network (which reads only that name) still adopts. It is
22
+ * also non-enumerable and read-only, shares the same `adopt`, and has no
23
+ * `records` field. Remove it in the release after the one that added the
24
+ * symbol.
15
25
  */
16
26
  export interface EarlyFetchRecord {
17
27
  kind: 'fetch';
@@ -44,9 +54,14 @@ export interface EarlyXhrRecord {
44
54
  export type EarlyNetworkRecord = EarlyFetchRecord | EarlyXhrRecord;
45
55
  export interface EarlyNetworkRecorder {
46
56
  version: 1;
47
- records: EarlyNetworkRecord[];
57
+ /** How many records are waiting to be adopted. */
58
+ readonly pending: number;
48
59
  /** Hand every record to the Network tool and stop recording. Returns them once. */
49
60
  adopt(): EarlyNetworkRecord[];
50
61
  }
62
+ /** The window key @buoy-gg/network reads. A registry symbol, so separate bundles agree on it. */
63
+ export declare const EARLY_NETWORK_KEY: unique symbol;
64
+ /** The old window key. Read-only fallback for older @buoy-gg/network; remove next version. */
65
+ export declare const LEGACY_EARLY_NETWORK_KEY = "__BUOY_EARLY_NETWORK__";
51
66
  export declare function installEarlyNetworkRecorder(): void;
52
67
  //# sourceMappingURL=earlyNetwork.d.ts.map
@@ -57,4 +57,10 @@ export declare const resolveOpenAppsState: (current: AppInstance[], def: OpenDef
57
57
  instanceId: string;
58
58
  wasMinimized: boolean;
59
59
  };
60
+ /**
61
+ * Un-minimizes a tool and moves it to the end of the stack. Tools are drawn in
62
+ * this order (z-index = base + index), so it comes back on top of tools opened
63
+ * after it, the same as re-opening it from the dial.
64
+ */
65
+ export declare const restoreOpenApp: (current: AppInstance[], instanceId: string, restoreState?: ModalRestoreState) => AppInstance[];
60
66
  //# sourceMappingURL=AppHostLogic.d.ts.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The Buoy layer Android back closes, top first. Shared by the native
3
+ * BackHandler (hardwareBack.ts) and the Capacitor back button
4
+ * (capacitorBackButton.ts). No platform imports, so the web build can use it.
5
+ */
6
+ import type { AppInstance } from "./AppHostLogic";
7
+ export type BackTarget = {
8
+ kind: "tool";
9
+ instanceId: string;
10
+ } | {
11
+ kind: "dial";
12
+ } | null;
13
+ type BackApp = Pick<AppInstance, "instanceId" | "launchMode" | "minimized">;
14
+ /** Which Buoy layer Android back should close, or null to let the app have it. */
15
+ export declare function resolveBackTarget(openApps: readonly BackApp[], dialOpen: boolean): BackTarget;
16
+ export {};
17
+ //# sourceMappingURL=backTarget.d.ts.map
@@ -7,11 +7,13 @@
7
7
  export declare function isBuoyHoldingBackButton(): boolean;
8
8
  /** Between Ionic's menu (99) and overlays (100). Ionic compares with >=, so fractions work. */
9
9
  export declare const BUOY_BACK_PRIORITY = 99.5;
10
+ /** The dial draws over every tool, so it wins over them, still under Ionic's overlays. */
11
+ export declare const BUOY_DIAL_BACK_PRIORITY = 99.6;
10
12
  /** Ionic is mounted and handling hardware back (its config can turn that off). */
11
13
  export declare function ionicHandlesBack(): boolean;
12
14
  /**
13
- * Close the last open tool on Android back while `active`.
14
- * `onBack` is read through a ref, so a new callback never re-registers.
15
+ * Run `onBack` on Android back while `active`. `onBack` is read through a
16
+ * ref, so a new callback never re-registers. `priority` is the Ionic one.
15
17
  */
16
- export declare function useCapacitorBackButton(active: boolean, onBack: () => void): void;
18
+ export declare function useCapacitorBackButton(active: boolean, onBack: () => void, priority?: number): void;
17
19
  //# sourceMappingURL=capacitorBackButton.d.ts.map
@@ -19,7 +19,7 @@
19
19
  * All known tool IDs that can appear in the floating menu or dial menu.
20
20
  * This is a union type of all auto-discovered tool IDs.
21
21
  */
22
- export type BuiltInToolId = 'env' | 'network' | 'push-notifications' | 'storage' | 'query' | 'query-wifi-toggle' | 'route-events' | 'debug-borders' | 'highlight-updates' | 'highlight-updates-modal' | 'redux' | 'zustand' | 'jotai' | 'events' | 'time-machine' | 'clock' | 'permissions' | 'lifecycle' | 'location' | 'scenarios' | 'ask-buoy' | 'image-overlay' | 'perf-monitor' | 'perf-monitor-modal';
22
+ export type BuiltInToolId = 'env' | 'network' | 'push-notifications' | 'storage' | 'query' | 'query-wifi-toggle' | 'route-events' | 'debug-borders' | 'highlight-updates' | 'highlight-updates-modal' | 'redux' | 'zustand' | 'jotai' | 'events' | 'time-machine' | 'clock' | 'report-bug' | 'bug-links' | 'permissions' | 'lifecycle' | 'location' | 'scenarios' | 'ask-buoy' | 'image-overlay' | 'perf-monitor' | 'perf-monitor-modal';
23
23
  /**
24
24
  * Special floating-only tool IDs that only appear in the floating bubble row.
25
25
  */
@@ -0,0 +1,8 @@
1
+ export { resolveBackTarget, type BackTarget } from "./backTarget";
2
+ /**
3
+ * Listen for Android hardware back while `active`. `onBack` returns true when
4
+ * it handled the press. It is read through a ref, so a new callback never
5
+ * re-registers. No-op on other platforms.
6
+ */
7
+ export declare function useHardwareBack(active: boolean, onBack: () => boolean): void;
8
+ //# sourceMappingURL=hardwareBack.d.ts.map
@@ -9,5 +9,5 @@
9
9
  * Drift is prevented by a test that fails when this disagrees with
10
10
  * package.json, so a version bump that forgets this file cannot ship.
11
11
  */
12
- export declare const SDK_VERSION = "7.0.77";
12
+ export declare const SDK_VERSION = "7.0.79";
13
13
  //# sourceMappingURL=version.d.ts.map
@@ -9,9 +9,19 @@
9
9
  * `adopt` and turns each record into a normal request row, including requests
10
10
  * that are still in flight. After that the recorder only passes calls through.
11
11
  *
12
- * It has no dependencies because it loads before everything else. The shape
13
- * of `window.__BUOY_EARLY_NETWORK__` is shared with @buoy-gg/network
14
- * (network/utils/adoptEarlyNetwork.ts); change both together.
12
+ * It has no dependencies because it loads before everything else. The handle
13
+ * lives on `window[Symbol.for('buoy.earlyNetwork')]` (EARLY_NETWORK_KEY), a
14
+ * non-enumerable, read-only property. Its shape is shared with
15
+ * @buoy-gg/network (network/utils/networkListener.ts, adoptEarlyRequests);
16
+ * change both together. The records array itself is never exposed: page
17
+ * scripts can't read or rewrite it in place, and `adopt` hands each record
18
+ * out once.
19
+ *
20
+ * Legacy: `window.__BUOY_EARLY_NETWORK__` stays for one more version, so an
21
+ * older @buoy-gg/network (which reads only that name) still adopts. It is
22
+ * also non-enumerable and read-only, shares the same `adopt`, and has no
23
+ * `records` field. Remove it in the release after the one that added the
24
+ * symbol.
15
25
  */
16
26
  export interface EarlyFetchRecord {
17
27
  kind: 'fetch';
@@ -44,9 +54,14 @@ export interface EarlyXhrRecord {
44
54
  export type EarlyNetworkRecord = EarlyFetchRecord | EarlyXhrRecord;
45
55
  export interface EarlyNetworkRecorder {
46
56
  version: 1;
47
- records: EarlyNetworkRecord[];
57
+ /** How many records are waiting to be adopted. */
58
+ readonly pending: number;
48
59
  /** Hand every record to the Network tool and stop recording. Returns them once. */
49
60
  adopt(): EarlyNetworkRecord[];
50
61
  }
62
+ /** The window key @buoy-gg/network reads. A registry symbol, so separate bundles agree on it. */
63
+ export declare const EARLY_NETWORK_KEY: unique symbol;
64
+ /** The old window key. Read-only fallback for older @buoy-gg/network; remove next version. */
65
+ export declare const LEGACY_EARLY_NETWORK_KEY = "__BUOY_EARLY_NETWORK__";
51
66
  export declare function installEarlyNetworkRecorder(): void;
52
67
  //# sourceMappingURL=earlyNetwork.d.ts.map
@@ -57,4 +57,10 @@ export declare const resolveOpenAppsState: (current: AppInstance[], def: OpenDef
57
57
  instanceId: string;
58
58
  wasMinimized: boolean;
59
59
  };
60
+ /**
61
+ * Un-minimizes a tool and moves it to the end of the stack. Tools are drawn in
62
+ * this order (z-index = base + index), so it comes back on top of tools opened
63
+ * after it, the same as re-opening it from the dial.
64
+ */
65
+ export declare const restoreOpenApp: (current: AppInstance[], instanceId: string, restoreState?: ModalRestoreState) => AppInstance[];
60
66
  //# sourceMappingURL=AppHostLogic.d.ts.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The Buoy layer Android back closes, top first. Shared by the native
3
+ * BackHandler (hardwareBack.ts) and the Capacitor back button
4
+ * (capacitorBackButton.ts). No platform imports, so the web build can use it.
5
+ */
6
+ import type { AppInstance } from "./AppHostLogic";
7
+ export type BackTarget = {
8
+ kind: "tool";
9
+ instanceId: string;
10
+ } | {
11
+ kind: "dial";
12
+ } | null;
13
+ type BackApp = Pick<AppInstance, "instanceId" | "launchMode" | "minimized">;
14
+ /** Which Buoy layer Android back should close, or null to let the app have it. */
15
+ export declare function resolveBackTarget(openApps: readonly BackApp[], dialOpen: boolean): BackTarget;
16
+ export {};
17
+ //# sourceMappingURL=backTarget.d.ts.map
@@ -7,11 +7,13 @@
7
7
  export declare function isBuoyHoldingBackButton(): boolean;
8
8
  /** Between Ionic's menu (99) and overlays (100). Ionic compares with >=, so fractions work. */
9
9
  export declare const BUOY_BACK_PRIORITY = 99.5;
10
+ /** The dial draws over every tool, so it wins over them, still under Ionic's overlays. */
11
+ export declare const BUOY_DIAL_BACK_PRIORITY = 99.6;
10
12
  /** Ionic is mounted and handling hardware back (its config can turn that off). */
11
13
  export declare function ionicHandlesBack(): boolean;
12
14
  /**
13
- * Close the last open tool on Android back while `active`.
14
- * `onBack` is read through a ref, so a new callback never re-registers.
15
+ * Run `onBack` on Android back while `active`. `onBack` is read through a
16
+ * ref, so a new callback never re-registers. `priority` is the Ionic one.
15
17
  */
16
- export declare function useCapacitorBackButton(active: boolean, onBack: () => void): void;
18
+ export declare function useCapacitorBackButton(active: boolean, onBack: () => void, priority?: number): void;
17
19
  //# sourceMappingURL=capacitorBackButton.d.ts.map
@@ -19,7 +19,7 @@
19
19
  * All known tool IDs that can appear in the floating menu or dial menu.
20
20
  * This is a union type of all auto-discovered tool IDs.
21
21
  */
22
- export type BuiltInToolId = 'env' | 'network' | 'push-notifications' | 'storage' | 'query' | 'query-wifi-toggle' | 'route-events' | 'debug-borders' | 'highlight-updates' | 'highlight-updates-modal' | 'redux' | 'zustand' | 'jotai' | 'events' | 'time-machine' | 'clock' | 'permissions' | 'lifecycle' | 'location' | 'scenarios' | 'ask-buoy' | 'image-overlay' | 'perf-monitor' | 'perf-monitor-modal';
22
+ export type BuiltInToolId = 'env' | 'network' | 'push-notifications' | 'storage' | 'query' | 'query-wifi-toggle' | 'route-events' | 'debug-borders' | 'highlight-updates' | 'highlight-updates-modal' | 'redux' | 'zustand' | 'jotai' | 'events' | 'time-machine' | 'clock' | 'report-bug' | 'bug-links' | 'permissions' | 'lifecycle' | 'location' | 'scenarios' | 'ask-buoy' | 'image-overlay' | 'perf-monitor' | 'perf-monitor-modal';
23
23
  /**
24
24
  * Special floating-only tool IDs that only appear in the floating bubble row.
25
25
  */
@@ -0,0 +1,8 @@
1
+ export { resolveBackTarget, type BackTarget } from "./backTarget";
2
+ /**
3
+ * Listen for Android hardware back while `active`. `onBack` returns true when
4
+ * it handled the press. It is read through a ref, so a new callback never
5
+ * re-registers. No-op on other platforms.
6
+ */
7
+ export declare function useHardwareBack(active: boolean, onBack: () => boolean): void;
8
+ //# sourceMappingURL=hardwareBack.d.ts.map
@@ -9,5 +9,5 @@
9
9
  * Drift is prevented by a test that fails when this disagrees with
10
10
  * package.json, so a version bump that forgets this file cannot ship.
11
11
  */
12
- export declare const SDK_VERSION = "7.0.77";
12
+ export declare const SDK_VERSION = "7.0.79";
13
13
  //# sourceMappingURL=version.d.ts.map
package/lib/web/auto.mjs CHANGED
@@ -1 +1 @@
1
- "use client";import{a as o,e as u}from"./chunks/chunk-LOPXJLVB.mjs";import{createElement as l,lazy as p,Suspense as d,useEffect as m,useState as v}from"react";function n(){if(typeof window>"u")return false;let e=window.Capacitor,t=false;try{t=e?.isNativePlatform?.()===true}catch{t=false}return t?e?.DEBUG===true:typeof u<"u"?!!u:process.env.NODE_ENV!=="production"}o(n,"shouldShowBuoy");function r(){try{let e=import.meta.env.VITE_BUOY_KEY;if(e)return e}catch{}try{let e=process.env.NEXT_PUBLIC_BUOY_KEY;if(e)return e}catch{}}o(r,"bundlerKey");var a;function s(){return a??(a=p(()=>import("./chunks/FloatingDevTools.web-IIOOVSUC.mjs").then(e=>({default:e.FloatingDevTools})))),a}o(s,"loadHost");function i({enabled:e,...t}){let[c,f]=v(false);if(m(()=>{f(e??n())},[e]),!c)return null;let y=t.licenseKey??r();return l(d,{fallback:null},l(s(),{...t,licenseKey:y}))}o(i,"BuoyDevTools");export{i as BuoyDevTools,r as bundlerKey,n as shouldShowBuoy};
1
+ "use client";import{a as o,e as u}from"./chunks/chunk-LOPXJLVB.mjs";import{createElement as l,lazy as p,Suspense as d,useEffect as m,useState as v}from"react";function n(){if(typeof window>"u")return false;let e=window.Capacitor,t=false;try{t=e?.isNativePlatform?.()===true}catch{t=false}return t?e?.DEBUG===true:typeof u<"u"?!!u:process.env.NODE_ENV!=="production"}o(n,"shouldShowBuoy");function r(){try{let e=import.meta.env.VITE_BUOY_KEY;if(e)return e}catch{}try{let e=process.env.NEXT_PUBLIC_BUOY_KEY;if(e)return e}catch{}}o(r,"bundlerKey");var a;function s(){return a??(a=p(()=>import("./chunks/FloatingDevTools.web-QLTO5FXP.mjs").then(e=>({default:e.FloatingDevTools})))),a}o(s,"loadHost");function i({enabled:e,...t}){let[c,f]=v(false);if(m(()=>{f(e??n())},[e]),!c)return null;let y=t.licenseKey??r();return l(d,{fallback:null},l(s(),{...t,licenseKey:y}))}o(i,"BuoyDevTools");export{i as BuoyDevTools,r as bundlerKey,n as shouldShowBuoy};
@@ -1 +1 @@
1
- "use client";import{v as o}from"./chunk-LAJ3HKAL.mjs";import"./chunk-C6HZO5XT.mjs";import"./chunk-D2FYORGY.mjs";import"./chunk-LOPXJLVB.mjs";export{o as FloatingDevTools};
1
+ "use client";import{v as o}from"./chunk-EFTCKGMC.mjs";import"./chunk-C6HZO5XT.mjs";import"./chunk-D2FYORGY.mjs";import"./chunk-LOPXJLVB.mjs";export{o as FloatingDevTools};
@@ -0,0 +1 @@
1
+ "use client";import{v as o}from"./chunk-JXTHZBMM.mjs";import"./chunk-C6HZO5XT.mjs";import"./chunk-D2FYORGY.mjs";import"./chunk-LOPXJLVB.mjs";export{o as FloatingDevTools};