@buoy-gg/shared-ui 7.0.62 → 7.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/lib/commonjs/JsModal.web.js +1 -1
- package/lib/commonjs/clipboard/copyToClipboard.js +1 -1
- package/lib/commonjs/dataViewer/VirtualizedDataExplorer.js +1 -1
- package/lib/commonjs/hooks/useDeviceInfo.js +1 -1
- package/lib/commonjs/license/AccountSetup.web.js +2 -2
- package/lib/commonjs/settings/components/BubbleSettingsSection.js +1 -1
- package/lib/commonjs/storage/buoyOwnership.js +1 -0
- package/lib/commonjs/storage/buoyOwnership.test.js +1 -0
- package/lib/commonjs/storage/devToolsStorageKeys.js +1 -1
- package/lib/commonjs/storage/index.js +1 -1
- package/lib/commonjs/ui/components/ChangeRow.js +1 -1
- package/lib/commonjs/ui/components/CompactRow.js +1 -1
- package/lib/commonjs/ui/components/DataInspector.js +1 -1
- package/lib/commonjs/ui/components/DraggableHeader.js +1 -1
- package/lib/commonjs/ui/floating/FloatingTool.web.js +1 -1
- package/lib/commonjs/ui/floating/index.web.js +1 -1
- package/lib/commonjs/ui/floating/portalHost.test.js +1 -0
- package/lib/commonjs/ui/floating/portalHost.web.js +1 -0
- package/lib/commonjs/ui/fonts.js +1 -1
- package/lib/commonjs/ui/index.js +1 -1
- package/lib/commonjs/ui/systemFont.js +1 -0
- package/lib/commonjs/utils/loadOptionalModule.js +1 -1
- package/lib/commonjs/utils/minimalSuperJSON.js +1 -1
- package/lib/commonjs/utils/nativeWeb.js +1 -1
- package/lib/commonjs/utils/persistentStorage.js +1 -1
- package/lib/module/JsModal.web.js +1 -1
- package/lib/module/clipboard/copyToClipboard.js +1 -1
- package/lib/module/dataViewer/VirtualizedDataExplorer.js +1 -1
- package/lib/module/hooks/useDeviceInfo.js +1 -1
- package/lib/module/license/AccountSetup.web.js +2 -2
- package/lib/module/settings/components/BubbleSettingsSection.js +1 -1
- package/lib/module/storage/buoyOwnership.js +1 -0
- package/lib/module/storage/buoyOwnership.test.js +1 -0
- package/lib/module/storage/devToolsStorageKeys.js +1 -1
- package/lib/module/storage/index.js +1 -1
- package/lib/module/ui/components/ChangeRow.js +1 -1
- package/lib/module/ui/components/CompactRow.js +1 -1
- package/lib/module/ui/components/DataInspector.js +1 -1
- package/lib/module/ui/components/DraggableHeader.js +1 -1
- package/lib/module/ui/floating/FloatingTool.web.js +1 -1
- package/lib/module/ui/floating/index.web.js +1 -1
- package/lib/module/ui/floating/portalHost.test.js +1 -0
- package/lib/module/ui/floating/portalHost.web.js +1 -0
- package/lib/module/ui/fonts.js +1 -1
- package/lib/module/ui/index.js +1 -1
- package/lib/module/ui/systemFont.js +1 -0
- package/lib/module/utils/loadOptionalModule.js +1 -1
- package/lib/module/utils/minimalSuperJSON.js +1 -1
- package/lib/module/utils/nativeWeb.js +1 -1
- package/lib/module/utils/persistentStorage.js +1 -1
- package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/commonjs/license/AccountSetup.web.d.ts +1 -1
- package/lib/typescript/commonjs/storage/buoyOwnership.d.ts +15 -0
- package/lib/typescript/commonjs/storage/buoyOwnership.test.d.ts +2 -0
- package/lib/typescript/commonjs/storage/index.d.ts +1 -0
- package/lib/typescript/commonjs/ui/floating/FloatingTool.web.d.ts +2 -2
- package/lib/typescript/commonjs/ui/floating/index.web.d.ts +1 -0
- package/lib/typescript/commonjs/ui/floating/portalHost.test.d.ts +2 -0
- package/lib/typescript/commonjs/ui/floating/portalHost.web.d.ts +8 -0
- package/lib/typescript/commonjs/ui/fonts.d.ts +1 -0
- package/lib/typescript/commonjs/ui/index.d.ts +1 -1
- package/lib/typescript/commonjs/ui/systemFont.d.ts +2 -0
- package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/module/license/AccountSetup.web.d.ts +1 -1
- package/lib/typescript/module/storage/buoyOwnership.d.ts +15 -0
- package/lib/typescript/module/storage/buoyOwnership.test.d.ts +2 -0
- package/lib/typescript/module/storage/index.d.ts +1 -0
- package/lib/typescript/module/ui/floating/FloatingTool.web.d.ts +2 -2
- package/lib/typescript/module/ui/floating/index.web.d.ts +1 -0
- package/lib/typescript/module/ui/floating/portalHost.test.d.ts +2 -0
- package/lib/typescript/module/ui/floating/portalHost.web.d.ts +8 -0
- package/lib/typescript/module/ui/fonts.d.ts +1 -0
- package/lib/typescript/module/ui/index.d.ts +1 -1
- package/lib/typescript/module/ui/systemFont.d.ts +2 -0
- package/lib/web/asyncStorage.mjs +1 -1
- package/lib/web/chunks/chunk-3HELV44Y.mjs +1 -0
- package/lib/web/chunks/chunk-4HIK66DZ.mjs +1 -0
- package/lib/web/chunks/chunk-4YLP5MMN.mjs +1 -0
- package/lib/web/chunks/chunk-5G6RSRP4.mjs +1 -0
- package/lib/web/chunks/chunk-7JJHWSTD.mjs +1 -0
- package/lib/web/chunks/chunk-AHVO74UQ.mjs +1 -0
- package/lib/web/chunks/chunk-CJTGUGMQ.mjs +1 -0
- package/lib/web/chunks/chunk-FA6WAQUA.mjs +6 -0
- package/lib/web/chunks/chunk-GMM6TGFO.mjs +1 -0
- package/lib/web/chunks/chunk-HIAN3HBD.mjs +1 -0
- package/lib/web/chunks/chunk-HPZXETRA.mjs +1 -0
- package/lib/web/chunks/chunk-NOSWH3E2.mjs +1 -0
- package/lib/web/chunks/chunk-OGAHL36T.mjs +15 -0
- package/lib/web/chunks/chunk-P32XO2YS.mjs +1 -0
- package/lib/web/chunks/chunk-SBYYOE2T.mjs +1 -0
- package/lib/web/chunks/chunk-T6T3FEMU.mjs +1 -0
- package/lib/web/chunks/chunk-VAR5UK6J.mjs +1 -0
- package/lib/web/chunks/persistentStorage.web-NOUYFUMM.mjs +1 -0
- package/lib/web/colors.mjs +1 -1
- package/lib/web/dataViewer.mjs +2 -2
- package/lib/web/floating.mjs +1 -1
- package/lib/web/history.mjs +1 -1
- package/lib/web/hooks.mjs +1 -1
- package/lib/web/index.mjs +3 -3
- package/lib/web/native.mjs +1 -1
- package/lib/web/ui.mjs +1 -1
- package/lib/web/utils.mjs +1 -1
- package/package.json +5 -5
- package/lib/web/chunks/chunk-3UTMGIUG.mjs +0 -1
- package/lib/web/chunks/chunk-4IM4VIMP.mjs +0 -1
- package/lib/web/chunks/chunk-53J2FMUD.mjs +0 -1
- package/lib/web/chunks/chunk-ASHW3TI7.mjs +0 -1
- package/lib/web/chunks/chunk-BZTGYXMT.mjs +0 -1
- package/lib/web/chunks/chunk-CE5U3CSQ.mjs +0 -1
- package/lib/web/chunks/chunk-E2MI3FII.mjs +0 -15
- package/lib/web/chunks/chunk-FP44YK4E.mjs +0 -1
- package/lib/web/chunks/chunk-GF364FIK.mjs +0 -1
- package/lib/web/chunks/chunk-L63X3LPR.mjs +0 -1
- package/lib/web/chunks/chunk-L7OYS724.mjs +0 -1
- package/lib/web/chunks/chunk-LZ7FZZ7R.mjs +0 -1
- package/lib/web/chunks/chunk-NVD5LLXD.mjs +0 -1
- package/lib/web/chunks/chunk-QNLAFQET.mjs +0 -1
- package/lib/web/chunks/chunk-SYU4BFQR.mjs +0 -6
- package/lib/web/chunks/chunk-UYWHGSA7.mjs +0 -1
- package/lib/web/chunks/persistentStorage.web-3QA77BIL.mjs +0 -1
package/README.md
CHANGED
|
@@ -47,3 +47,6 @@ Follow the [custom-tool guide](https://buoy.gg/buoy/latest/docs/custom-tools) to
|
|
|
47
47
|
See the [custom floating tools guide](https://buoy.gg/buoy/latest/docs/custom-tools/floating-tools) for native and browser integration, lifecycle rules and examples. Browser consumers can import the dedicated `@buoy-gg/shared-ui/floating` entry.
|
|
48
48
|
|
|
49
49
|
In browser panels, header dragging starts on non-interactive space. Buttons, tabs, inputs, and other focusable controls keep their pointer input. Window controls have 24 px hit areas.
|
|
50
|
+
|
|
51
|
+
Web action bars honor a bottom start spot. Saved spots still win.
|
|
52
|
+
Web menus and modals stay above the tool windows.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.JsModal=void 0;var _licenseModule=require("./license/licenseModule.js");var _AccountSetup=require("./license/AccountSetup");var _react=require("react");var _persistentStorage=require("./utils/persistentStorage");var _modalStorage=require("./utils/modalStorage.js");var _devToolsStorageKeys=require("./storage/devToolsStorageKeys.js");var _index=require("./context/index.js");var _ToolBackground=require("./ui/backgrounds/ToolBackground.js");var _nightTheme=require("./ui/night/nightTheme.js");var _windowControlsSetting=require("./ui/components/windowControlsSetting.js");var _jsxRuntime=require("react/jsx-runtime");const buoy={base:"#121212",card:"#1A1A1A",border:"#333333",textMuted:"#888888",primary:"#20C997"};const gameUI={primary:"#F5F5F7",primaryLight:"#F5F5F7",secondary:"#A1A1A6",muted:"#8E8E93",success:"#34C759",info:"#00B8E6"};const MIN_HEIGHT=100;const DEFAULT_HEIGHT=400;const FLOATING_HEIGHT=500;const FLOATING_MIN_HEIGHT=80;const screenW=()=>typeof window!=="undefined"?window.innerWidth:0;const screenH=()=>typeof window!=="undefined"?window.innerHeight:0;const easeOutCubic=n=>1-Math.pow(1-n,3);const easeInOut=n=>n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2;function runAnim(n,o,i,c){let h=0;let a=false;const p=performance.now();const C=B=>{if(a)return;const W=Math.min((B-p)/n,1);i(o(W));if(W<1){h=requestAnimationFrame(C)}else{c?.()}};h=requestAnimationFrame(C);return()=>{a=true;cancelAnimationFrame(h)}}function readSafeAreaInsets(){if(typeof document==="undefined"){return{top:0,left:0,right:0,bottom:0}}const n=document.createElement("div");n.style.cssText="position:fixed;top:env(safe-area-inset-top);left:env(safe-area-inset-left);right:env(safe-area-inset-right);bottom:env(safe-area-inset-bottom);visibility:hidden;pointer-events:none";document.body.appendChild(n);const o=n.getBoundingClientRect();document.body.removeChild(n);return{top:Math.max(0,o.top),left:Math.max(0,o.left),right:Math.max(0,window.innerWidth-o.right),bottom:Math.max(0,window.innerHeight-o.bottom)}}function clampRectToSafeArea(n,o,i=false){const c=Math.max(FLOATING_MIN_HEIGHT,window.innerWidth-o.left-o.right);const h=Math.max(FLOATING_MIN_HEIGHT,window.innerHeight-o.top-o.bottom);const a=Math.min(n.width,c);const p=Math.min(n.height,h);return{width:a,height:p,left:Math.max(o.left,Math.min(n.left,window.innerWidth-o.right-a)),top:Math.max(o.top,Math.min(n.top,window.innerHeight-o.bottom-(i?FLOATING_MIN_HEIGHT:p)))}}const XIcon=({size:n=24,color:o="currentColor",strokeWidth:i=2})=>(0,_jsxRuntime.jsxs)("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",children:[(0,_jsxRuntime.jsx)("line",{x1:18,y1:6,x2:6,y2:18,stroke:o,strokeWidth:i,strokeLinecap:"round"}),(0,_jsxRuntime.jsx)("line",{x1:6,y1:6,x2:18,y2:18,stroke:o,strokeWidth:i,strokeLinecap:"round"})]});const MinusIcon=({size:n=24,color:o="currentColor",strokeWidth:i=2})=>(0,_jsxRuntime.jsx)("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",children:(0,_jsxRuntime.jsx)("line",{x1:5,y1:12,x2:19,y2:12,stroke:o,strokeWidth:i,strokeLinecap:"round"})});const DockBottomIcon=({size:n=24,color:o="currentColor",strokeWidth:i=2})=>(0,_jsxRuntime.jsxs)("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",children:[(0,_jsxRuntime.jsx)("rect",{x:3,y:3,width:18,height:18,rx:2,stroke:o,strokeWidth:i}),(0,_jsxRuntime.jsx)("rect",{x:3,y:14,width:18,height:7,fill:o})]});const FloatWindowIcon=({size:n=24,color:o="currentColor",strokeWidth:i=2})=>(0,_jsxRuntime.jsxs)("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",children:[(0,_jsxRuntime.jsx)("rect",{x:3,y:3,width:14,height:14,rx:2,stroke:o,strokeWidth:i}),(0,_jsxRuntime.jsx)("line",{x1:7,y1:17,x2:7,y2:21,stroke:o,strokeWidth:i}),(0,_jsxRuntime.jsx)("line",{x1:7,y1:21,x2:21,y2:21,stroke:o,strokeWidth:i}),(0,_jsxRuntime.jsx)("line",{x1:21,y1:21,x2:21,y2:7,stroke:o,strokeWidth:i}),(0,_jsxRuntime.jsx)("line",{x1:17,y1:7,x2:21,y2:7,stroke:o,strokeWidth:i})]});const WC_COLORS={close:"#FF5F57",minimize:"#FEBC2E",toggleMode:"#28C840"};const WC_BUTTON_SIZE=24;const WC_BUTTON_SPACING=2;const WC_ICON_SIZE=8;const wcDotStyle=n=>({width:WC_BUTTON_SIZE,height:WC_BUTTON_SIZE,borderRadius:WC_BUTTON_SIZE/2,display:"flex",alignItems:"center",justifyContent:"center",background:`radial-gradient(circle, ${n} 6px, transparent 6px)`,border:"none",padding:0,cursor:"pointer",flexShrink:0});function WindowControls(n){if((0,_windowControlsSetting.isExpandableWindowControlsEnabled)()&&(0,_windowControlsSetting.expandableWindowControlsSupported)(true)){return(0,_jsxRuntime.jsx)(ExpandableWindowControls,{...n})}return(0,_jsxRuntime.jsx)(PlainWindowControls,{...n})}function PlainWindowControls({onClose:n,onMinimize:o,onToggleMode:i,mode:c}){const h=c==="floating"?DockBottomIcon:FloatWindowIcon;const a=c==="floating"?"Dock to bottom sheet":"Make floating window";return(0,_jsxRuntime.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:WC_BUTTON_SPACING},children:[o&&(0,_jsxRuntime.jsx)("button",{type:"button",onClick:o,style:wcDotStyle(WC_COLORS.minimize),"aria-label":"Minimize modal",children:(0,_jsxRuntime.jsx)(MinusIcon,{size:WC_ICON_SIZE,color:"#7A5A00",strokeWidth:1.5})}),i&&(0,_jsxRuntime.jsx)("button",{type:"button",onClick:i,style:wcDotStyle(WC_COLORS.toggleMode),"aria-label":a,children:(0,_jsxRuntime.jsx)(h,{size:WC_ICON_SIZE,color:"#004A1A",strokeWidth:1.5})}),(0,_jsxRuntime.jsx)("button",{type:"button",onClick:n,style:wcDotStyle(WC_COLORS.close),"aria-label":"Close modal",children:(0,_jsxRuntime.jsx)(XIcon,{size:WC_ICON_SIZE,color:"#4A0000",strokeWidth:1.5})})]})}const WC_DOT_SIZE=12;const WC_DOT_SPACING=8;const WC_EXPANDED_BUTTON_SIZE=36;const WC_EXPANDED_BUTTON_SPACING=12;const WC_EXPANDED_ICON_SIZE=16;const WC_EXPANDED_PADDING=8;const WC_AUTO_DISMISS_MS=3e3;const WC_ANIMATION_MS=150;const wcCollapsedDot=n=>({width:WC_DOT_SIZE,height:WC_DOT_SIZE,borderRadius:WC_DOT_SIZE/2,backgroundColor:n,display:"flex",alignItems:"center",justifyContent:"center"});const wcExpandedButton=(n,o,i,c)=>({width:WC_EXPANDED_BUTTON_SIZE,height:WC_EXPANDED_BUTTON_SIZE,borderRadius:WC_EXPANDED_BUTTON_SIZE/2,display:"flex",alignItems:"center",justifyContent:"center",padding:0,cursor:"pointer",flexShrink:0,backgroundColor:n?i:o,border:n?`1px solid ${c}`:"none"});function ExpandableWindowControls({onClose:n,onMinimize:o,onToggleMode:i,mode:c,variant:h="night"}){const a=h==="night";const[p,C]=(0,_react.useState)(false);const[B,W]=(0,_react.useState)(false);const H=(0,_react.useRef)(null);const T=(0,_react.useRef)(null);const y=c==="floating"?DockBottomIcon:FloatWindowIcon;const k=c==="floating"?"Dock to bottom sheet":"Make floating window";const S=(0,_react.useCallback)(()=>{if(H.current)clearTimeout(H.current);if(T.current)clearTimeout(T.current);H.current=null;T.current=null},[]);const P=(0,_react.useCallback)(()=>{S();W(false);T.current=setTimeout(()=>C(false),WC_ANIMATION_MS)},[S]);const U=(0,_react.useCallback)(()=>{S();C(true);requestAnimationFrame(()=>requestAnimationFrame(()=>W(true)));H.current=setTimeout(P,WC_AUTO_DISMISS_MS)},[S,P]);(0,_react.useEffect)(()=>S,[S]);const q=b=>{P();b()};return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)("button",{type:"button",onClick:U,"aria-label":"Open window controls","data-testid":"tool-window-controls",style:{padding:10,margin:-8,border:"none",background:"transparent",cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",gap:WC_DOT_SPACING},children:[o&&(0,_jsxRuntime.jsx)("span",{style:wcCollapsedDot(WC_COLORS.minimize),children:(0,_jsxRuntime.jsx)(MinusIcon,{size:WC_ICON_SIZE,color:"#7A5A00",strokeWidth:1.5})}),i&&(0,_jsxRuntime.jsx)("span",{style:wcCollapsedDot(WC_COLORS.toggleMode),children:(0,_jsxRuntime.jsx)(y,{size:WC_ICON_SIZE,color:"#004A1A",strokeWidth:1.5})}),(0,_jsxRuntime.jsx)("span",{style:wcCollapsedDot(WC_COLORS.close),children:(0,_jsxRuntime.jsx)(XIcon,{size:WC_ICON_SIZE,color:"#4A0000",strokeWidth:1.5})})]}),p&&(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",top:-WC_EXPANDED_PADDING,right:-WC_EXPANDED_PADDING,zIndex:9999,transform:`scale(${B?1:.3})`,opacity:B?1:0,transition:`transform ${WC_ANIMATION_MS}ms ease-out, opacity ${WC_ANIMATION_MS}ms ease-out`},children:(0,_jsxRuntime.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:WC_EXPANDED_BUTTON_SPACING,padding:WC_EXPANDED_PADDING,borderRadius:(WC_EXPANDED_BUTTON_SIZE+WC_EXPANDED_PADDING*2)/2,backgroundColor:a?_nightTheme.night.color.surface:buoy.card,border:`1px solid ${a?_nightTheme.night.color.border:buoy.border}`,boxShadow:"0 4px 12px rgba(0,0,0,0.4)"},children:[o&&(0,_jsxRuntime.jsx)("button",{type:"button",onClick:()=>q(o),"aria-label":"Minimize modal","data-testid":"tool-window-minimize",style:wcExpandedButton(a,WC_COLORS.minimize,_nightTheme.night.color.warningSoft,_nightTheme.night.color.warning+"59"),children:(0,_jsxRuntime.jsx)(MinusIcon,{size:WC_EXPANDED_ICON_SIZE,color:a?_nightTheme.night.color.warning:"#7A5A00",strokeWidth:2})}),i&&(0,_jsxRuntime.jsx)("button",{type:"button",onClick:()=>q(i),"aria-label":k,"data-testid":"tool-window-mode",style:wcExpandedButton(a,WC_COLORS.toggleMode,_nightTheme.night.color.accentSoft,_nightTheme.night.color.accentBorderStrong),children:(0,_jsxRuntime.jsx)(y,{size:WC_EXPANDED_ICON_SIZE,color:a?_nightTheme.night.color.accent:"#004A1A",strokeWidth:2})}),(0,_jsxRuntime.jsx)("button",{type:"button",onClick:()=>q(n),"aria-label":"Close modal","data-testid":"tool-window-close",style:wcExpandedButton(a,WC_COLORS.close,_nightTheme.night.color.dangerSoft,_nightTheme.night.color.danger+"59"),children:(0,_jsxRuntime.jsx)(XIcon,{size:WC_EXPANDED_ICON_SIZE,color:a?_nightTheme.night.color.danger:"#4A0000",strokeWidth:2})})]})})]})}const DragIndicator=(0,_react.memo)(function n({isResizing:o,mode:i,hasCustomContent:c=false,variant:h="default"}){const a=i==="floating";const p=h==="night";return(0,_jsxRuntime.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",position:"relative",justifyContent:c?"center":void 0,minHeight:c?32:void 0,paddingTop:c?0:8,paddingBottom:c?0:8,backgroundColor:"transparent"},children:[(0,_jsxRuntime.jsx)("div",{style:{width:p?36:o?40:a?50:40,height:p?5:a?5:3,backgroundColor:p?_nightTheme.night.color.placeholder:o?buoy.primary:a?buoy.textMuted:buoy.primary,borderRadius:p?2.5:2,boxShadow:p?"none":`0 0 4px ${buoy.primary}99`}}),o&&i==="bottomSheet"&&(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",display:"flex",flexDirection:"row",gap:2,marginTop:12},children:[0,1,2].map(C=>(0,_jsxRuntime.jsx)("div",{style:{width:12,height:1,backgroundColor:gameUI.success,opacity:.6}},C))})]})});const ModalHintBanner=(0,_react.memo)(function n({onAcknowledge:o}){return(0,_jsxRuntime.jsx)("div",{style:{backgroundColor:`${gameUI.info}15`,borderLeft:`3px solid ${gameUI.info}`,borderRadius:8,margin:"8px 12px 4px",overflow:"hidden",boxShadow:`0 0 8px ${gameUI.info}4D`,flexShrink:0},children:(0,_jsxRuntime.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:12,gap:12},children:[(0,_jsxRuntime.jsxs)("div",{style:{width:32,height:32,position:"relative",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:[(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",width:20,height:20,borderRadius:10,border:`2px solid ${gameUI.info}`,opacity:.6,transform:"scale(0.8)",boxSizing:"border-box"}}),(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",width:20,height:20,borderRadius:10,border:`2px solid ${gameUI.info}`,boxSizing:"border-box"}})]}),(0,_jsxRuntime.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:2},children:[(0,_jsxRuntime.jsx)("span",{style:{fontSize:13,fontWeight:600,color:gameUI.info,letterSpacing:.3},children:"\u{1F4A1} Pro Tip"}),(0,_jsxRuntime.jsx)("span",{style:{fontSize:12,color:gameUI.primaryLight,lineHeight:"16px"},children:"Double-tap the header to transform this into a floating modal"})]}),(0,_jsxRuntime.jsx)("button",{type:"button",onClick:o,style:{backgroundColor:`${gameUI.info}30`,padding:"6px 12px",borderRadius:6,border:`1px solid ${gameUI.info}50`,fontSize:12,fontWeight:600,color:gameUI.info,cursor:"pointer",fontFamily:"inherit",flexShrink:0},children:"Got it!"})]})})});function ModalHeaderContent({header:n,isResizing:o,mode:i,onMinimize:c,variant:h="default"}){if(n?.customContent){let a=n.customContent;if((0,_react.isValidElement)(n.customContent)&&c){a=(0,_react.cloneElement)(n.customContent,{onMinimize:c})}return(0,_jsxRuntime.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minWidth:0},children:[(0,_jsxRuntime.jsx)(DragIndicator,{isResizing:o,mode:i,hasCustomContent:true,variant:h}),a]})}return(0,_jsxRuntime.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",position:"relative",minWidth:0},children:[(0,_jsxRuntime.jsx)(DragIndicator,{isResizing:o,mode:i,variant:h}),(0,_jsxRuntime.jsxs)("div",{style:{padding:"0 16px",display:"flex",flexDirection:"column",alignItems:"center"},children:[n?.title&&(0,_jsxRuntime.jsx)("span",{style:{fontSize:16,fontWeight:600,color:gameUI.primary},children:n.title}),n?.subtitle&&(0,_jsxRuntime.jsx)("span",{style:{fontSize:12,color:gameUI.secondary,paddingTop:4},children:n.subtitle})]}),(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:(0,_jsxRuntime.jsx)("span",{style:{fontSize:10,color:gameUI.muted,fontStyle:"italic"},children:"Double tap: Toggle \u2022 Triple tap: Close"})})]})}const JsModalComponent=({visible:n,onClose:o,children:i,header:c,styles:h={},minHeight:a=MIN_HEIGHT,maxHeight:p,initialHeight:C=DEFAULT_HEIGHT,animatedHeight:B,benchMotion:W,initialMode:H="bottomSheet",onModeChange:T,persistenceKey:y,enablePersistence:k=true,initialFloatingPosition:S,footer:P,footerHeight:U=0,onBack:q,onMinimize:b,minimizeRequest:Z=0,minimizeTargetPosition:it,initialModalState:g,zIndex:ht,disableScrollWrapper:At=false,background:gt=true,variant:J="night"})=>{const[w]=(0,_react.useState)(readSafeAreaInsets);const[pt,xt]=(0,_react.useState)(!k);const[f,st]=(0,_react.useState)(H);const V=(0,_react.useRef)(T);V.current=T;const[z,A]=(0,_react.useState)(false);const[at,Y]=(0,_react.useState)(false);const[It,lt]=(0,_react.useState)(C);const[R,L]=(0,_react.useState)(()=>clampRectToSafeArea({width:screenW(),height:FLOATING_HEIGHT,top:S?.y??(screenH()-FLOATING_HEIGHT)/2,left:S?.x??0},w));const[Mt,Q]=(0,_react.useState)(false);const[Et,mt]=(0,_react.useState)(false);const _t=(0,_index.useHintsDisabled)();const I=(0,_react.useRef)(C);const v=(0,_react.useRef)(R);const x=(0,_react.useRef)({x:R.left,y:R.top});const K=(0,_react.useRef)(null);const ct=(0,_react.useRef)(null);const D=(0,_react.useRef)(null);const M=(0,_react.useRef)([]);const j=(0,_react.useCallback)(()=>{M.current.forEach(t=>t());M.current=[]},[]);(0,_react.useEffect)(()=>{v.current=R},[R]);(0,_react.useEffect)(()=>j,[j]);const bt=p||screenH()-w.top;(0,_react.useEffect)(()=>{if(!k||!y){xt(true);return}let t=true;const e=async()=>{const r=await _modalStorage.ModalStorage.load(y);if(t&&r){if(r.mode){st(r.mode);V.current?.(r.mode)}if(r.panelHeight){lt(r.panelHeight);I.current=r.panelHeight}if(r.dimensions){const s=clampRectToSafeArea(r.dimensions,w,true);L(s);x.current={x:s.left,y:s.top}}}if(t)xt(true)};e();return()=>{t=false}},[y,k]);(0,_react.useEffect)(()=>{if(!k||!y||!pt)return;const t=setTimeout(()=>{_modalStorage.ModalStorage.save(y,{mode:f,panelHeight:I.current,dimensions:R,isVisible:n})},500);return()=>clearTimeout(t)},[f,It,R,n,y,k,pt]);(0,_react.useEffect)(()=>{let t=true;const e=async()=>{try{const r=_devToolsStorageKeys.devToolsStorageKeys.modal.hintAcknowledged();const s=await _persistentStorage.persistentStorage.getItem(r);if(t){Q(s!=="true");mt(true)}}catch{if(t){Q(true);mt(true)}}};e();return()=>{t=false}},[]);const $t=(0,_react.useCallback)(async()=>{try{const t=_devToolsStorageKeys.devToolsStorageKeys.modal.hintAcknowledged();await _persistentStorage.persistentStorage.setItem(t,"true");Q(false)}catch{Q(false)}},[]);const dt=(0,_react.useCallback)(()=>{Y(false);A(false);const t=f==="bottomSheet"?"floating":"bottomSheet";st(t);V.current?.(t)},[f]);(0,_react.useEffect)(()=>{Y(false);A(false)},[f]);const E=(0,_react.useCallback)(()=>{if(!b)return;const t={mode:f,panelHeight:I.current,floatingPosition:{x:v.current.left,y:v.current.top},floatingDimensions:{width:v.current.width,height:v.current.height}};if(k&&y)void _modalStorage.ModalStorage.saveMinimized(y,t);const e=it?.x??screenW()-50;const r=it?.y??screenH()-150;j();if(f==="bottomSheet"){const s=K.current;if(!s){b(t);return}const l=screenH();M.current.push(runAnim(300,easeInOut,u=>{s.style.opacity=String(1-u);s.style.transform=`translateY(${u*l}px)`},()=>b(t)))}else{const s=D.current;if(!s){b(t);return}const l={...x.current};M.current.push(runAnim(300,easeInOut,u=>{s.style.opacity=String(1-u);const O=l.x+(e-l.x)*u;const _=l.y+(r-l.y)*u;s.style.transform=`translate(${O}px, ${_}px)`},()=>b(t)))}},[f,b,it,j,k,y]);const yt=(0,_react.useRef)(Z);(0,_react.useEffect)(()=>{if(yt.current===Z)return;yt.current=Z;E()},[Z,E]);(0,_react.useEffect)(()=>{if(!g)return;if(g.mode){st(g.mode);V.current?.(g.mode)}if(g.panelHeight){lt(g.panelHeight);I.current=g.panelHeight}if(g.floatingDimensions&&g.floatingPosition){const t={width:g.floatingDimensions.width,height:g.floatingDimensions.height,top:g.floatingPosition.y,left:g.floatingPosition.x};L(t);x.current={x:g.floatingPosition.x,y:g.floatingPosition.y}}},[g]);(0,_react.useLayoutEffect)(()=>{if(!n)return;j();if(f==="bottomSheet"){const t=K.current;if(!t)return;const e=screenH();t.style.transform=`translateY(${e}px)`;t.style.opacity="0";M.current.push(runAnim(300,easeOutCubic,r=>{t.style.transform=`translateY(${(1-r)*e}px)`}),runAnim(200,easeInOut,r=>{t.style.opacity=String(r)}))}else{const t=D.current;if(!t)return;x.current={x:v.current.left,y:v.current.top};t.style.transform=`translate(${x.current.x}px, ${x.current.y}px)`;t.style.opacity="0";M.current.push(runAnim(200,easeInOut,e=>{t.style.opacity=String(e)}))}},[n,f,j]);const wt=(0,_react.useRef)(0);const F=(0,_react.useRef)(0);const N=(0,_react.useRef)(null);const tt=(0,_react.useCallback)(()=>{const t=Date.now();if(t-wt.current>500){F.current=0}F.current++;wt.current=t;if(N.current)clearTimeout(N.current);N.current=setTimeout(()=>{if(F.current===2){dt()}else if(F.current>=3){if(b)E()}F.current=0},300)},[dt,b,E]);(0,_react.useEffect)(()=>{return()=>{if(N.current)clearTimeout(N.current)}},[]);const et=(0,_react.useRef)({active:false,resizing:false,startY:0,headerOffsetY:0,samples:[]});const Wt=(0,_react.useCallback)(t=>{if(f!=="bottomSheet")return;if(t.button!==0||t.target.closest('button, a, input, textarea, select, [role="button"], [role="tab"], [role="switch"], [contenteditable="true"], [tabindex]'))return;const e=et.current;e.active=true;e.resizing=false;e.startY=t.clientY;const r=t.currentTarget.getBoundingClientRect();e.headerOffsetY=t.clientY-r.top;e.samples=[{t:performance.now(),y:t.clientY}];t.currentTarget.setPointerCapture(t.pointerId)},[f]);const Ht=(0,_react.useCallback)(t=>{const e=et.current;if(!e.active)return;const r=t.clientY-e.startY;if(!e.resizing&&Math.abs(r)>3){e.resizing=true;j();A(true)}if(!e.resizing)return;const s=t.clientY-e.headerOffsetY;let l=screenH()-s;l=Math.max(a,Math.min(l,bt));I.current=l;if(ct.current)ct.current.style.height=`${l}px`;const u=performance.now();e.samples.push({t:u,y:t.clientY});while(e.samples.length>2&&u-e.samples[0].t>100)e.samples.shift()},[a,bt,j]);const Pt=(0,_react.useCallback)(t=>{const e=et.current;if(!e.active)return;e.active=false;if(!e.resizing){tt();return}A(false);const r=I.current;const s=t.clientY-e.startY;const l=e.samples[0];const u=e.samples[e.samples.length-1];const O=u&&l&&u.t>l.t?(u.y-l.y)/(u.t-l.t):0;const _=O>.8&&s>50||s>150&&r<=a;if(_){const m=K.current;j();if(m){const X=screenH();M.current.push(runAnim(200,easeInOut,$=>{m.style.opacity=String(1-$)}),runAnim(300,easeOutCubic,$=>{m.style.transform=`translateY(${$*X}px)`},()=>o()))}else{o()}return}lt(r)},[a,o,tt,j]);const Bt=(0,_react.useCallback)(()=>{const t=et.current;if(!t.active)return;t.active=false;t.resizing=false;A(false)},[]);const nt=(0,_react.useRef)({active:false,dragging:false,startX:0,startY:0,startPos:{x:0,y:0}});const zt=(0,_react.useCallback)(t=>{if(f!=="floating"||z)return;if(t.button!==0||t.target.closest('button, a, input, textarea, select, [role="button"], [role="tab"], [role="switch"], [contenteditable="true"], [tabindex]'))return;const e=nt.current;e.active=true;e.dragging=false;e.startX=t.clientX;e.startY=t.clientY;e.startPos={...x.current};t.currentTarget.setPointerCapture(t.pointerId)},[f,z]);const Yt=(0,_react.useCallback)(t=>{const e=nt.current;if(!e.active)return;const r=t.clientX-e.startX;const s=t.clientY-e.startY;if(!e.dragging&&Math.abs(r)+Math.abs(s)>5){e.dragging=true;Y(true)}if(!e.dragging)return;const l=e.startPos.x+r;const u=e.startPos.y+s;x.current={x:l,y:u};if(D.current){D.current.style.transform=`translate(${l}px, ${u}px)`}},[]);const Lt=(0,_react.useCallback)(()=>{const t=nt.current;if(!t.active)return;t.active=false;if(!t.dragging){tt();return}Y(false);const e=v.current;const r=clampRectToSafeArea({...e,left:x.current.x,top:x.current.y},w);const s=r.left;const l=r.top;x.current={x:s,y:l};if(D.current){D.current.style.transform=`translate(${s}px, ${l}px)`}L(u=>({...u,left:s,top:l}))},[w,tt]);const Ft=(0,_react.useCallback)(()=>{const t=nt.current;if(!t.active)return;t.active=false;t.dragging=false;Y(false)},[]);const ut=(0,_react.useRef)({active:false,corner:"bottomRight",startX:0,startY:0,start:{width:0,height:0,top:0,left:0}});const Nt=(0,_react.useCallback)(t=>e=>{if(f!=="floating")return;e.stopPropagation();const r=ut.current;r.active=true;r.corner=t;r.startX=e.clientX;r.startY=e.clientY;r.start={...v.current};A(true);e.currentTarget.setPointerCapture(e.pointerId)},[f]);const Ot=(0,_react.useCallback)(t=>{const e=ut.current;if(!e.active)return;const r=t.clientX-e.startX;const s=t.clientY-e.startY;if(Math.abs(r)<.5&&Math.abs(s)<.5)return;const l=Math.max(0,w.left);const u=screenH()-Math.max(0,w.bottom);const O=screenW()-Math.max(0,w.right);const _=screenW()*.25;const m=e.start;const X=m.left+m.width;const $=m.top+m.height;let G=m.left;const rt=m.top;let Dt=X;let ft=$;if(e.corner==="bottomLeft"){G=Math.max(l,Math.min(m.left+r,X-_));ft=Math.min(u,Math.max($+s,m.top+FLOATING_MIN_HEIGHT))}else{Dt=Math.min(O,Math.max(X+r,m.left+_));ft=Math.min(u,Math.max($+s,m.top+FLOATING_MIN_HEIGHT))}const Xt=Math.max(_,Dt-G);const Gt=Math.max(FLOATING_MIN_HEIGHT,ft-rt);const Tt={width:Xt,height:Gt,left:G,top:rt};v.current=Tt;x.current={x:G,y:rt};L(Tt);if(D.current){D.current.style.transform=`translate(${G}px, ${rt}px)`}},[w.left,w.right,w.bottom]);const vt=(0,_react.useCallback)(()=>{const t=ut.current;if(!t.active)return;t.active=false;A(false);L(v.current)},[]);const ot=!n;const Ct=ot?{left:-9999,top:-9999,opacity:0,visibility:"hidden",pointerEvents:"none"}:{};const jt=c?.title||"Dev tool panel";const d=J==="night";const kt=gt&&d?(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},"aria-hidden":true,children:(0,_jsxRuntime.jsx)(_ToolBackground.ToolBackground,{})}):null;const St=(0,_jsxRuntime.jsxs)("div",{style:{flex:1,minHeight:0,position:"relative",display:"flex",flexDirection:"column",backgroundColor:d?"transparent":buoy.base,borderBottomLeftRadius:16,borderBottomRightRadius:16,overflow:"hidden",...h.content},children:[gt&&!d?(0,_jsxRuntime.jsx)(_ToolBackground.ToolBackground,{}):null,At?(0,_jsxRuntime.jsx)("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",paddingBottom:U},children:i}):(0,_jsxRuntime.jsx)("div",{style:{flex:1,minHeight:0,overflowY:"auto",paddingBottom:U},children:i}),P?(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",left:0,right:0,bottom:0,backgroundColor:buoy.base,borderBottomLeftRadius:16,borderBottomRightRadius:16},children:P}):null]});const Rt=(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",top:4,right:4,zIndex:10},children:(0,_jsxRuntime.jsx)(WindowControls,{onClose:o,onMinimize:b?E:void 0,onToggleMode:dt,mode:f,variant:J})});if(f==="floating"){const t=at||z;return(0,_jsxRuntime.jsxs)("div",{ref:D,role:"dialog","aria-label":jt,"aria-hidden":ot||void 0,style:{position:"fixed",pointerEvents:"auto",left:0,top:0,width:R.width,height:R.height,transform:`translate(${x.current.x}px, ${x.current.y}px)`,display:"flex",flexDirection:"column",backgroundColor:d?_nightTheme.night.color.bg:buoy.card,borderRadius:d?_nightTheme.night.radius.sheet:6,border:d?`1px solid ${_nightTheme.night.color.accent}55`:t?`2px solid ${buoy.primary}`:`1px solid ${buoy.border}`,boxShadow:d?`0 0 14px ${_nightTheme.night.color.accent}38`:t?`0 0 12px ${buoy.primary}7A`:`0 0 20px ${buoy.primary}4D`,...d?{overflow:"hidden"}:null,boxSizing:"border-box",zIndex:ht??1e3,...h.container,...Ct},children:[kt,(0,_jsxRuntime.jsx)("div",{onPointerDown:zt,onPointerMove:Yt,onPointerUp:Lt,onPointerCancel:Ft,style:{borderTopLeftRadius:d?_nightTheme.night.radius.sheet:6,borderTopRightRadius:d?_nightTheme.night.radius.sheet:6,backgroundColor:d?"transparent":buoy.card,minHeight:56,border:d?"none":`1px solid ${buoy.border}`,boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",flexShrink:0,touchAction:"none",userSelect:"none",cursor:at?"grabbing":"grab",position:"relative"},children:(0,_jsxRuntime.jsx)(ModalHeaderContent,{header:c,isResizing:at||z,mode:f,onMinimize:b?E:void 0,variant:J})}),Rt,St,["bottomLeft","bottomRight"].map(e=>(0,_jsxRuntime.jsx)("div",{onPointerDown:Nt(e),onPointerMove:Ot,onPointerUp:vt,onPointerCancel:vt,style:{position:"absolute",width:30,height:30,bottom:4,...e==="bottomLeft"?{left:4}:{right:4},zIndex:1e3,touchAction:"none",cursor:e==="bottomLeft"?"nesw-resize":"nwse-resize"},children:(0,_jsxRuntime.jsx)("div",{style:{width:20,height:20,borderRadius:10,boxSizing:"border-box",backgroundColor:t?`${gameUI.success}1A`:"transparent",border:t?`2px solid ${gameUI.success}`:"none",boxShadow:t?`0 0 8px ${gameUI.success}99`:"none"}})},e))]},"floating")}return(0,_jsxRuntime.jsx)("div",{"aria-hidden":ot||void 0,style:{position:"fixed",inset:0,zIndex:ht??1e3,pointerEvents:"none",...ot?{...Ct,inset:"auto",width:"100vw",height:"100vh"}:null},children:(0,_jsxRuntime.jsx)("div",{ref:K,style:{position:"absolute",bottom:0,left:0,right:0,pointerEvents:"auto"},children:(0,_jsxRuntime.jsxs)("div",{ref:ct,role:"dialog","aria-label":jt,style:{height:I.current,display:"flex",flexDirection:"column",backgroundColor:d?_nightTheme.night.color.bg:buoy.card,borderTopLeftRadius:d?_nightTheme.night.radius.sheet:6,borderTopRightRadius:d?_nightTheme.night.radius.sheet:6,border:d?`1px solid ${_nightTheme.night.color.accent}55`:`1px solid ${buoy.border}`,boxShadow:d?`0 -4px 10px ${_nightTheme.night.color.accent}38`:`0 -4px 12px ${buoy.primary}33`,...d?{overflow:"hidden"}:null,boxSizing:"border-box",position:"relative",...h.container},children:[kt,(0,_jsxRuntime.jsx)("div",{onPointerDown:Wt,onPointerMove:Ht,onPointerUp:Pt,onPointerCancel:Bt,style:{borderTopLeftRadius:d?_nightTheme.night.radius.sheet:6,borderTopRightRadius:d?_nightTheme.night.radius.sheet:6,backgroundColor:d?"transparent":buoy.card,minHeight:56,border:d?"none":`1px solid ${buoy.border}`,boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",flexShrink:0,touchAction:"none",userSelect:"none",cursor:"ns-resize",position:"relative"},children:(0,_jsxRuntime.jsx)(ModalHeaderContent,{header:c,isResizing:z,mode:f,onMinimize:b?E:void 0,variant:J})}),Rt,Et&&Mt&&!_t&&(0,_jsxRuntime.jsx)(ModalHintBanner,{onAcknowledge:$t}),St]})})},"bottomSheet")};const JsModal=exports.JsModal=(0,_react.memo)(n=>{const o=(0,_licenseModule.getUseAccountAccess)()();if(o.status!=="admitted")return n.visible?(0,_jsxRuntime.jsx)(_AccountSetup.AccountSetup,{}):null;return(0,_jsxRuntime.jsx)(JsModalComponent,{...n})});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.JsModal=void 0;var _fonts=require("./ui/fonts.js");var _licenseModule=require("./license/licenseModule.js");var _AccountSetup=require("./license/AccountSetup");var _react=require("react");var _persistentStorage=require("./utils/persistentStorage");var _modalStorage=require("./utils/modalStorage.js");var _devToolsStorageKeys=require("./storage/devToolsStorageKeys.js");var _index=require("./context/index.js");var _ToolBackground=require("./ui/backgrounds/ToolBackground.js");var _nightTheme=require("./ui/night/nightTheme.js");var _windowControlsSetting=require("./ui/components/windowControlsSetting.js");var _jsxRuntime=require("react/jsx-runtime");const buoy={base:"#121212",card:"#1A1A1A",border:"#333333",textMuted:"#888888",primary:"#20C997"};const gameUI={primary:"#F5F5F7",primaryLight:"#F5F5F7",secondary:"#A1A1A6",muted:"#8E8E93",success:"#34C759",info:"#00B8E6"};const MIN_HEIGHT=100;const DEFAULT_HEIGHT=400;const FLOATING_HEIGHT=500;const FLOATING_MIN_HEIGHT=80;const screenW=()=>typeof window!=="undefined"?window.innerWidth:0;const screenH=()=>typeof window!=="undefined"?window.innerHeight:0;const easeOutCubic=n=>1-Math.pow(1-n,3);const easeInOut=n=>n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2;function runAnim(n,o,i,c){let h=0;let a=false;const p=performance.now();const C=B=>{if(a)return;const W=Math.min((B-p)/n,1);i(o(W));if(W<1){h=requestAnimationFrame(C)}else{c?.()}};h=requestAnimationFrame(C);return()=>{a=true;cancelAnimationFrame(h)}}function readSafeAreaInsets(){if(typeof document==="undefined"){return{top:0,left:0,right:0,bottom:0}}const n=document.createElement("div");n.style.cssText="position:fixed;top:env(safe-area-inset-top);left:env(safe-area-inset-left);right:env(safe-area-inset-right);bottom:env(safe-area-inset-bottom);visibility:hidden;pointer-events:none";document.body.appendChild(n);const o=n.getBoundingClientRect();document.body.removeChild(n);return{top:Math.max(0,o.top),left:Math.max(0,o.left),right:Math.max(0,window.innerWidth-o.right),bottom:Math.max(0,window.innerHeight-o.bottom)}}function clampRectToSafeArea(n,o,i=false){const c=Math.max(FLOATING_MIN_HEIGHT,window.innerWidth-o.left-o.right);const h=Math.max(FLOATING_MIN_HEIGHT,window.innerHeight-o.top-o.bottom);const a=Math.min(n.width,c);const p=Math.min(n.height,h);return{width:a,height:p,left:Math.max(o.left,Math.min(n.left,window.innerWidth-o.right-a)),top:Math.max(o.top,Math.min(n.top,window.innerHeight-o.bottom-(i?FLOATING_MIN_HEIGHT:p)))}}const XIcon=({size:n=24,color:o="currentColor",strokeWidth:i=2})=>(0,_jsxRuntime.jsxs)("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",children:[(0,_jsxRuntime.jsx)("line",{x1:18,y1:6,x2:6,y2:18,stroke:o,strokeWidth:i,strokeLinecap:"round"}),(0,_jsxRuntime.jsx)("line",{x1:6,y1:6,x2:18,y2:18,stroke:o,strokeWidth:i,strokeLinecap:"round"})]});const MinusIcon=({size:n=24,color:o="currentColor",strokeWidth:i=2})=>(0,_jsxRuntime.jsx)("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",children:(0,_jsxRuntime.jsx)("line",{x1:5,y1:12,x2:19,y2:12,stroke:o,strokeWidth:i,strokeLinecap:"round"})});const DockBottomIcon=({size:n=24,color:o="currentColor",strokeWidth:i=2})=>(0,_jsxRuntime.jsxs)("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",children:[(0,_jsxRuntime.jsx)("rect",{x:3,y:3,width:18,height:18,rx:2,stroke:o,strokeWidth:i}),(0,_jsxRuntime.jsx)("rect",{x:3,y:14,width:18,height:7,fill:o})]});const FloatWindowIcon=({size:n=24,color:o="currentColor",strokeWidth:i=2})=>(0,_jsxRuntime.jsxs)("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",children:[(0,_jsxRuntime.jsx)("rect",{x:3,y:3,width:14,height:14,rx:2,stroke:o,strokeWidth:i}),(0,_jsxRuntime.jsx)("line",{x1:7,y1:17,x2:7,y2:21,stroke:o,strokeWidth:i}),(0,_jsxRuntime.jsx)("line",{x1:7,y1:21,x2:21,y2:21,stroke:o,strokeWidth:i}),(0,_jsxRuntime.jsx)("line",{x1:21,y1:21,x2:21,y2:7,stroke:o,strokeWidth:i}),(0,_jsxRuntime.jsx)("line",{x1:17,y1:7,x2:21,y2:7,stroke:o,strokeWidth:i})]});const WC_COLORS={close:"#FF5F57",minimize:"#FEBC2E",toggleMode:"#28C840"};const WC_BUTTON_SIZE=24;const WC_BUTTON_SPACING=2;const WC_ICON_SIZE=8;const wcDotStyle=n=>({width:WC_BUTTON_SIZE,height:WC_BUTTON_SIZE,borderRadius:WC_BUTTON_SIZE/2,display:"flex",alignItems:"center",justifyContent:"center",background:`radial-gradient(circle, ${n} 6px, transparent 6px)`,border:"none",padding:0,cursor:"pointer",flexShrink:0});function WindowControls(n){if((0,_windowControlsSetting.isExpandableWindowControlsEnabled)()&&(0,_windowControlsSetting.expandableWindowControlsSupported)(true)){return(0,_jsxRuntime.jsx)(ExpandableWindowControls,{...n})}return(0,_jsxRuntime.jsx)(PlainWindowControls,{...n})}function PlainWindowControls({onClose:n,onMinimize:o,onToggleMode:i,mode:c}){const h=c==="floating"?DockBottomIcon:FloatWindowIcon;const a=c==="floating"?"Dock to bottom sheet":"Make floating window";return(0,_jsxRuntime.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:WC_BUTTON_SPACING},children:[o&&(0,_jsxRuntime.jsx)("button",{type:"button",onClick:o,style:wcDotStyle(WC_COLORS.minimize),"aria-label":"Minimize modal",children:(0,_jsxRuntime.jsx)(MinusIcon,{size:WC_ICON_SIZE,color:"#7A5A00",strokeWidth:1.5})}),i&&(0,_jsxRuntime.jsx)("button",{type:"button",onClick:i,style:wcDotStyle(WC_COLORS.toggleMode),"aria-label":a,children:(0,_jsxRuntime.jsx)(h,{size:WC_ICON_SIZE,color:"#004A1A",strokeWidth:1.5})}),(0,_jsxRuntime.jsx)("button",{type:"button",onClick:n,style:wcDotStyle(WC_COLORS.close),"aria-label":"Close modal",children:(0,_jsxRuntime.jsx)(XIcon,{size:WC_ICON_SIZE,color:"#4A0000",strokeWidth:1.5})})]})}const WC_DOT_SIZE=12;const WC_DOT_SPACING=8;const WC_EXPANDED_BUTTON_SIZE=36;const WC_EXPANDED_BUTTON_SPACING=12;const WC_EXPANDED_ICON_SIZE=16;const WC_EXPANDED_PADDING=8;const WC_AUTO_DISMISS_MS=3e3;const WC_ANIMATION_MS=150;const wcCollapsedDot=n=>({width:WC_DOT_SIZE,height:WC_DOT_SIZE,borderRadius:WC_DOT_SIZE/2,backgroundColor:n,display:"flex",alignItems:"center",justifyContent:"center"});const wcExpandedButton=(n,o,i,c)=>({width:WC_EXPANDED_BUTTON_SIZE,height:WC_EXPANDED_BUTTON_SIZE,borderRadius:WC_EXPANDED_BUTTON_SIZE/2,display:"flex",alignItems:"center",justifyContent:"center",padding:0,cursor:"pointer",flexShrink:0,backgroundColor:n?i:o,border:n?`1px solid ${c}`:"none"});function ExpandableWindowControls({onClose:n,onMinimize:o,onToggleMode:i,mode:c,variant:h="night"}){const a=h==="night";const[p,C]=(0,_react.useState)(false);const[B,W]=(0,_react.useState)(false);const H=(0,_react.useRef)(null);const T=(0,_react.useRef)(null);const y=c==="floating"?DockBottomIcon:FloatWindowIcon;const k=c==="floating"?"Dock to bottom sheet":"Make floating window";const S=(0,_react.useCallback)(()=>{if(H.current)clearTimeout(H.current);if(T.current)clearTimeout(T.current);H.current=null;T.current=null},[]);const P=(0,_react.useCallback)(()=>{S();W(false);T.current=setTimeout(()=>C(false),WC_ANIMATION_MS)},[S]);const G=(0,_react.useCallback)(()=>{S();C(true);requestAnimationFrame(()=>requestAnimationFrame(()=>W(true)));H.current=setTimeout(P,WC_AUTO_DISMISS_MS)},[S,P]);(0,_react.useEffect)(()=>S,[S]);const U=b=>{P();b()};return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsxs)("button",{type:"button",onClick:G,"aria-label":"Open window controls","data-testid":"tool-window-controls",style:{padding:10,margin:-8,border:"none",background:"transparent",cursor:"pointer",display:"flex",flexDirection:"row",alignItems:"center",gap:WC_DOT_SPACING},children:[o&&(0,_jsxRuntime.jsx)("span",{style:wcCollapsedDot(WC_COLORS.minimize),children:(0,_jsxRuntime.jsx)(MinusIcon,{size:WC_ICON_SIZE,color:"#7A5A00",strokeWidth:1.5})}),i&&(0,_jsxRuntime.jsx)("span",{style:wcCollapsedDot(WC_COLORS.toggleMode),children:(0,_jsxRuntime.jsx)(y,{size:WC_ICON_SIZE,color:"#004A1A",strokeWidth:1.5})}),(0,_jsxRuntime.jsx)("span",{style:wcCollapsedDot(WC_COLORS.close),children:(0,_jsxRuntime.jsx)(XIcon,{size:WC_ICON_SIZE,color:"#4A0000",strokeWidth:1.5})})]}),p&&(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",top:-WC_EXPANDED_PADDING,right:-WC_EXPANDED_PADDING,zIndex:9999,transform:`scale(${B?1:.3})`,opacity:B?1:0,transition:`transform ${WC_ANIMATION_MS}ms ease-out, opacity ${WC_ANIMATION_MS}ms ease-out`},children:(0,_jsxRuntime.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:WC_EXPANDED_BUTTON_SPACING,padding:WC_EXPANDED_PADDING,borderRadius:(WC_EXPANDED_BUTTON_SIZE+WC_EXPANDED_PADDING*2)/2,backgroundColor:a?_nightTheme.night.color.surface:buoy.card,border:`1px solid ${a?_nightTheme.night.color.border:buoy.border}`,boxShadow:"0 4px 12px rgba(0,0,0,0.4)"},children:[o&&(0,_jsxRuntime.jsx)("button",{type:"button",onClick:()=>U(o),"aria-label":"Minimize modal","data-testid":"tool-window-minimize",style:wcExpandedButton(a,WC_COLORS.minimize,_nightTheme.night.color.warningSoft,_nightTheme.night.color.warning+"59"),children:(0,_jsxRuntime.jsx)(MinusIcon,{size:WC_EXPANDED_ICON_SIZE,color:a?_nightTheme.night.color.warning:"#7A5A00",strokeWidth:2})}),i&&(0,_jsxRuntime.jsx)("button",{type:"button",onClick:()=>U(i),"aria-label":k,"data-testid":"tool-window-mode",style:wcExpandedButton(a,WC_COLORS.toggleMode,_nightTheme.night.color.accentSoft,_nightTheme.night.color.accentBorderStrong),children:(0,_jsxRuntime.jsx)(y,{size:WC_EXPANDED_ICON_SIZE,color:a?_nightTheme.night.color.accent:"#004A1A",strokeWidth:2})}),(0,_jsxRuntime.jsx)("button",{type:"button",onClick:()=>U(n),"aria-label":"Close modal","data-testid":"tool-window-close",style:wcExpandedButton(a,WC_COLORS.close,_nightTheme.night.color.dangerSoft,_nightTheme.night.color.danger+"59"),children:(0,_jsxRuntime.jsx)(XIcon,{size:WC_EXPANDED_ICON_SIZE,color:a?_nightTheme.night.color.danger:"#4A0000",strokeWidth:2})})]})})]})}const DragIndicator=(0,_react.memo)(function n({isResizing:o,mode:i,hasCustomContent:c=false,variant:h="default"}){const a=i==="floating";const p=h==="night";return(0,_jsxRuntime.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",position:"relative",justifyContent:c?"center":void 0,minHeight:c?32:void 0,paddingTop:c?0:8,paddingBottom:c?0:8,backgroundColor:"transparent"},children:[(0,_jsxRuntime.jsx)("div",{style:{width:p?36:o?40:a?50:40,height:p?5:a?5:3,backgroundColor:p?_nightTheme.night.color.placeholder:o?buoy.primary:a?buoy.textMuted:buoy.primary,borderRadius:p?2.5:2,boxShadow:p?"none":`0 0 4px ${buoy.primary}99`}}),o&&i==="bottomSheet"&&(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",display:"flex",flexDirection:"row",gap:2,marginTop:12},children:[0,1,2].map(C=>(0,_jsxRuntime.jsx)("div",{style:{width:12,height:1,backgroundColor:gameUI.success,opacity:.6}},C))})]})});const ModalHintBanner=(0,_react.memo)(function n({onAcknowledge:o}){return(0,_jsxRuntime.jsx)("div",{style:{backgroundColor:`${gameUI.info}15`,borderLeft:`3px solid ${gameUI.info}`,borderRadius:8,margin:"8px 12px 4px",overflow:"hidden",boxShadow:`0 0 8px ${gameUI.info}4D`,flexShrink:0},children:(0,_jsxRuntime.jsxs)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",padding:12,gap:12},children:[(0,_jsxRuntime.jsxs)("div",{style:{width:32,height:32,position:"relative",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:[(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",width:20,height:20,borderRadius:10,border:`2px solid ${gameUI.info}`,opacity:.6,transform:"scale(0.8)",boxSizing:"border-box"}}),(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",width:20,height:20,borderRadius:10,border:`2px solid ${gameUI.info}`,boxSizing:"border-box"}})]}),(0,_jsxRuntime.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:2},children:[(0,_jsxRuntime.jsx)("span",{style:{fontSize:13,fontWeight:600,color:gameUI.info,letterSpacing:.3},children:"\u{1F4A1} Pro Tip"}),(0,_jsxRuntime.jsx)("span",{style:{fontSize:12,color:gameUI.primaryLight,lineHeight:"16px"},children:"Double-tap the header to transform this into a floating modal"})]}),(0,_jsxRuntime.jsx)("button",{type:"button",onClick:o,style:{backgroundColor:`${gameUI.info}30`,padding:"6px 12px",borderRadius:6,border:`1px solid ${gameUI.info}50`,fontSize:12,fontWeight:600,color:gameUI.info,cursor:"pointer",fontFamily:"inherit",flexShrink:0},children:"Got it!"})]})})});function ModalHeaderContent({header:n,isResizing:o,mode:i,onMinimize:c,variant:h="default"}){if(n?.customContent){let a=n.customContent;if((0,_react.isValidElement)(n.customContent)&&c){a=(0,_react.cloneElement)(n.customContent,{onMinimize:c})}return(0,_jsxRuntime.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minWidth:0},children:[(0,_jsxRuntime.jsx)(DragIndicator,{isResizing:o,mode:i,hasCustomContent:true,variant:h}),a]})}return(0,_jsxRuntime.jsxs)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",position:"relative",minWidth:0},children:[(0,_jsxRuntime.jsx)(DragIndicator,{isResizing:o,mode:i,variant:h}),(0,_jsxRuntime.jsxs)("div",{style:{padding:"0 16px",display:"flex",flexDirection:"column",alignItems:"center"},children:[n?.title&&(0,_jsxRuntime.jsx)("span",{style:{fontSize:16,fontWeight:600,color:gameUI.primary},children:n.title}),n?.subtitle&&(0,_jsxRuntime.jsx)("span",{style:{fontSize:12,color:gameUI.secondary,paddingTop:4},children:n.subtitle})]}),(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:(0,_jsxRuntime.jsx)("span",{style:{fontSize:10,color:gameUI.muted,fontStyle:"italic"},children:"Double tap: Toggle \u2022 Triple tap: Close"})})]})}const JsModalComponent=({visible:n,onClose:o,children:i,header:c,styles:h={},minHeight:a=MIN_HEIGHT,maxHeight:p,initialHeight:C=DEFAULT_HEIGHT,animatedHeight:B,benchMotion:W,initialMode:H="bottomSheet",onModeChange:T,persistenceKey:y,enablePersistence:k=true,initialFloatingPosition:S,footer:P,footerHeight:G=0,onBack:U,onMinimize:b,minimizeRequest:Z=0,minimizeTargetPosition:it,initialModalState:g,zIndex:ht,disableScrollWrapper:At=false,background:gt=true,variant:J="night"})=>{const[w]=(0,_react.useState)(readSafeAreaInsets);const[pt,xt]=(0,_react.useState)(!k);const[f,st]=(0,_react.useState)(H);const V=(0,_react.useRef)(T);V.current=T;const[z,A]=(0,_react.useState)(false);const[at,Y]=(0,_react.useState)(false);const[It,lt]=(0,_react.useState)(C);const[R,F]=(0,_react.useState)(()=>clampRectToSafeArea({width:screenW(),height:FLOATING_HEIGHT,top:S?.y??(screenH()-FLOATING_HEIGHT)/2,left:S?.x??0},w));const[Mt,Q]=(0,_react.useState)(false);const[Et,mt]=(0,_react.useState)(false);const _t=(0,_index.useHintsDisabled)();const I=(0,_react.useRef)(C);const v=(0,_react.useRef)(R);const x=(0,_react.useRef)({x:R.left,y:R.top});const K=(0,_react.useRef)(null);const ct=(0,_react.useRef)(null);const D=(0,_react.useRef)(null);const M=(0,_react.useRef)([]);const j=(0,_react.useCallback)(()=>{M.current.forEach(t=>t());M.current=[]},[]);(0,_react.useEffect)(()=>{v.current=R},[R]);(0,_react.useEffect)(()=>j,[j]);const bt=p||screenH()-w.top;(0,_react.useEffect)(()=>{if(!k||!y){xt(true);return}let t=true;const e=async()=>{const r=await _modalStorage.ModalStorage.load(y);if(t&&r){if(r.mode){st(r.mode);V.current?.(r.mode)}if(r.panelHeight){lt(r.panelHeight);I.current=r.panelHeight}if(r.dimensions){const s=clampRectToSafeArea(r.dimensions,w,true);F(s);x.current={x:s.left,y:s.top}}}if(t)xt(true)};e();return()=>{t=false}},[y,k]);(0,_react.useEffect)(()=>{if(!k||!y||!pt)return;const t=setTimeout(()=>{_modalStorage.ModalStorage.save(y,{mode:f,panelHeight:I.current,dimensions:R,isVisible:n})},500);return()=>clearTimeout(t)},[f,It,R,n,y,k,pt]);(0,_react.useEffect)(()=>{let t=true;const e=async()=>{try{const r=_devToolsStorageKeys.devToolsStorageKeys.modal.hintAcknowledged();const s=await _persistentStorage.persistentStorage.getItem(r);if(t){Q(s!=="true");mt(true)}}catch{if(t){Q(true);mt(true)}}};e();return()=>{t=false}},[]);const $t=(0,_react.useCallback)(async()=>{try{const t=_devToolsStorageKeys.devToolsStorageKeys.modal.hintAcknowledged();await _persistentStorage.persistentStorage.setItem(t,"true");Q(false)}catch{Q(false)}},[]);const dt=(0,_react.useCallback)(()=>{Y(false);A(false);const t=f==="bottomSheet"?"floating":"bottomSheet";st(t);V.current?.(t)},[f]);(0,_react.useEffect)(()=>{Y(false);A(false)},[f]);const E=(0,_react.useCallback)(()=>{if(!b)return;const t={mode:f,panelHeight:I.current,floatingPosition:{x:v.current.left,y:v.current.top},floatingDimensions:{width:v.current.width,height:v.current.height}};if(k&&y)void _modalStorage.ModalStorage.saveMinimized(y,t);const e=it?.x??screenW()-50;const r=it?.y??screenH()-150;j();if(f==="bottomSheet"){const s=K.current;if(!s){b(t);return}const l=screenH();M.current.push(runAnim(300,easeInOut,u=>{s.style.opacity=String(1-u);s.style.transform=`translateY(${u*l}px)`},()=>b(t)))}else{const s=D.current;if(!s){b(t);return}const l={...x.current};M.current.push(runAnim(300,easeInOut,u=>{s.style.opacity=String(1-u);const O=l.x+(e-l.x)*u;const _=l.y+(r-l.y)*u;s.style.transform=`translate(${O}px, ${_}px)`},()=>b(t)))}},[f,b,it,j,k,y]);const yt=(0,_react.useRef)(Z);(0,_react.useEffect)(()=>{if(yt.current===Z)return;yt.current=Z;E()},[Z,E]);(0,_react.useEffect)(()=>{if(!g)return;if(g.mode){st(g.mode);V.current?.(g.mode)}if(g.panelHeight){lt(g.panelHeight);I.current=g.panelHeight}if(g.floatingDimensions&&g.floatingPosition){const t={width:g.floatingDimensions.width,height:g.floatingDimensions.height,top:g.floatingPosition.y,left:g.floatingPosition.x};F(t);x.current={x:g.floatingPosition.x,y:g.floatingPosition.y}}},[g]);(0,_react.useLayoutEffect)(()=>{if(!n)return;j();if(f==="bottomSheet"){const t=K.current;if(!t)return;const e=screenH();t.style.transform=`translateY(${e}px)`;t.style.opacity="0";M.current.push(runAnim(300,easeOutCubic,r=>{t.style.transform=`translateY(${(1-r)*e}px)`}),runAnim(200,easeInOut,r=>{t.style.opacity=String(r)}))}else{const t=D.current;if(!t)return;x.current={x:v.current.left,y:v.current.top};t.style.transform=`translate(${x.current.x}px, ${x.current.y}px)`;t.style.opacity="0";M.current.push(runAnim(200,easeInOut,e=>{t.style.opacity=String(e)}))}},[n,f,j]);const wt=(0,_react.useRef)(0);const L=(0,_react.useRef)(0);const N=(0,_react.useRef)(null);const tt=(0,_react.useCallback)(()=>{const t=Date.now();if(t-wt.current>500){L.current=0}L.current++;wt.current=t;if(N.current)clearTimeout(N.current);N.current=setTimeout(()=>{if(L.current===2){dt()}else if(L.current>=3){if(b)E()}L.current=0},300)},[dt,b,E]);(0,_react.useEffect)(()=>{return()=>{if(N.current)clearTimeout(N.current)}},[]);const et=(0,_react.useRef)({active:false,resizing:false,startY:0,headerOffsetY:0,samples:[]});const Wt=(0,_react.useCallback)(t=>{if(f!=="bottomSheet")return;if(t.button!==0||t.target.closest('button, a, input, textarea, select, [role="button"], [role="tab"], [role="switch"], [contenteditable="true"], [tabindex]'))return;const e=et.current;e.active=true;e.resizing=false;e.startY=t.clientY;const r=t.currentTarget.getBoundingClientRect();e.headerOffsetY=t.clientY-r.top;e.samples=[{t:performance.now(),y:t.clientY}];t.currentTarget.setPointerCapture(t.pointerId)},[f]);const Ht=(0,_react.useCallback)(t=>{const e=et.current;if(!e.active)return;const r=t.clientY-e.startY;if(!e.resizing&&Math.abs(r)>3){e.resizing=true;j();A(true)}if(!e.resizing)return;const s=t.clientY-e.headerOffsetY;let l=screenH()-s;l=Math.max(a,Math.min(l,bt));I.current=l;if(ct.current)ct.current.style.height=`${l}px`;const u=performance.now();e.samples.push({t:u,y:t.clientY});while(e.samples.length>2&&u-e.samples[0].t>100)e.samples.shift()},[a,bt,j]);const Pt=(0,_react.useCallback)(t=>{const e=et.current;if(!e.active)return;e.active=false;if(!e.resizing){tt();return}A(false);const r=I.current;const s=t.clientY-e.startY;const l=e.samples[0];const u=e.samples[e.samples.length-1];const O=u&&l&&u.t>l.t?(u.y-l.y)/(u.t-l.t):0;const _=O>.8&&s>50||s>150&&r<=a;if(_){const m=K.current;j();if(m){const X=screenH();M.current.push(runAnim(200,easeInOut,$=>{m.style.opacity=String(1-$)}),runAnim(300,easeOutCubic,$=>{m.style.transform=`translateY(${$*X}px)`},()=>o()))}else{o()}return}lt(r)},[a,o,tt,j]);const Bt=(0,_react.useCallback)(()=>{const t=et.current;if(!t.active)return;t.active=false;t.resizing=false;A(false)},[]);const nt=(0,_react.useRef)({active:false,dragging:false,startX:0,startY:0,startPos:{x:0,y:0}});const zt=(0,_react.useCallback)(t=>{if(f!=="floating"||z)return;if(t.button!==0||t.target.closest('button, a, input, textarea, select, [role="button"], [role="tab"], [role="switch"], [contenteditable="true"], [tabindex]'))return;const e=nt.current;e.active=true;e.dragging=false;e.startX=t.clientX;e.startY=t.clientY;e.startPos={...x.current};t.currentTarget.setPointerCapture(t.pointerId)},[f,z]);const Yt=(0,_react.useCallback)(t=>{const e=nt.current;if(!e.active)return;const r=t.clientX-e.startX;const s=t.clientY-e.startY;if(!e.dragging&&Math.abs(r)+Math.abs(s)>5){e.dragging=true;Y(true)}if(!e.dragging)return;const l=e.startPos.x+r;const u=e.startPos.y+s;x.current={x:l,y:u};if(D.current){D.current.style.transform=`translate(${l}px, ${u}px)`}},[]);const Ft=(0,_react.useCallback)(()=>{const t=nt.current;if(!t.active)return;t.active=false;if(!t.dragging){tt();return}Y(false);const e=v.current;const r=clampRectToSafeArea({...e,left:x.current.x,top:x.current.y},w);const s=r.left;const l=r.top;x.current={x:s,y:l};if(D.current){D.current.style.transform=`translate(${s}px, ${l}px)`}F(u=>({...u,left:s,top:l}))},[w,tt]);const Lt=(0,_react.useCallback)(()=>{const t=nt.current;if(!t.active)return;t.active=false;t.dragging=false;Y(false)},[]);const ut=(0,_react.useRef)({active:false,corner:"bottomRight",startX:0,startY:0,start:{width:0,height:0,top:0,left:0}});const Nt=(0,_react.useCallback)(t=>e=>{if(f!=="floating")return;e.stopPropagation();const r=ut.current;r.active=true;r.corner=t;r.startX=e.clientX;r.startY=e.clientY;r.start={...v.current};A(true);e.currentTarget.setPointerCapture(e.pointerId)},[f]);const Ot=(0,_react.useCallback)(t=>{const e=ut.current;if(!e.active)return;const r=t.clientX-e.startX;const s=t.clientY-e.startY;if(Math.abs(r)<.5&&Math.abs(s)<.5)return;const l=Math.max(0,w.left);const u=screenH()-Math.max(0,w.bottom);const O=screenW()-Math.max(0,w.right);const _=screenW()*.25;const m=e.start;const X=m.left+m.width;const $=m.top+m.height;let q=m.left;const rt=m.top;let Dt=X;let ft=$;if(e.corner==="bottomLeft"){q=Math.max(l,Math.min(m.left+r,X-_));ft=Math.min(u,Math.max($+s,m.top+FLOATING_MIN_HEIGHT))}else{Dt=Math.min(O,Math.max(X+r,m.left+_));ft=Math.min(u,Math.max($+s,m.top+FLOATING_MIN_HEIGHT))}const Xt=Math.max(_,Dt-q);const qt=Math.max(FLOATING_MIN_HEIGHT,ft-rt);const Tt={width:Xt,height:qt,left:q,top:rt};v.current=Tt;x.current={x:q,y:rt};F(Tt);if(D.current){D.current.style.transform=`translate(${q}px, ${rt}px)`}},[w.left,w.right,w.bottom]);const vt=(0,_react.useCallback)(()=>{const t=ut.current;if(!t.active)return;t.active=false;A(false);F(v.current)},[]);const ot=!n;const Ct=ot?{left:-9999,top:-9999,opacity:0,visibility:"hidden",pointerEvents:"none"}:{};const jt=c?.title||"Dev tool panel";const d=J==="night";const kt=gt&&d?(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},"aria-hidden":true,children:(0,_jsxRuntime.jsx)(_ToolBackground.ToolBackground,{})}):null;const St=(0,_jsxRuntime.jsxs)("div",{style:{flex:1,minHeight:0,position:"relative",display:"flex",flexDirection:"column",backgroundColor:d?"transparent":buoy.base,borderBottomLeftRadius:16,borderBottomRightRadius:16,overflow:"hidden",...h.content},children:[gt&&!d?(0,_jsxRuntime.jsx)(_ToolBackground.ToolBackground,{}):null,At?(0,_jsxRuntime.jsx)("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",paddingBottom:G},children:i}):(0,_jsxRuntime.jsx)("div",{style:{flex:1,minHeight:0,overflowY:"auto",paddingBottom:G},children:i}),P?(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",left:0,right:0,bottom:0,backgroundColor:buoy.base,borderBottomLeftRadius:16,borderBottomRightRadius:16},children:P}):null]});const Rt=(0,_jsxRuntime.jsx)("div",{style:{position:"absolute",top:4,right:4,zIndex:10},children:(0,_jsxRuntime.jsx)(WindowControls,{onClose:o,onMinimize:b?E:void 0,onToggleMode:dt,mode:f,variant:J})});if(f==="floating"){const t=at||z;return(0,_jsxRuntime.jsxs)("div",{ref:D,role:"dialog","aria-label":jt,"aria-hidden":ot||void 0,style:{fontFamily:_fonts.systemFont,position:"fixed",pointerEvents:"auto",left:0,top:0,width:R.width,height:R.height,transform:`translate(${x.current.x}px, ${x.current.y}px)`,display:"flex",flexDirection:"column",backgroundColor:d?_nightTheme.night.color.bg:buoy.card,borderRadius:d?_nightTheme.night.radius.sheet:6,border:d?`1px solid ${_nightTheme.night.color.accent}55`:t?`2px solid ${buoy.primary}`:`1px solid ${buoy.border}`,boxShadow:d?`0 0 14px ${_nightTheme.night.color.accent}38`:t?`0 0 12px ${buoy.primary}7A`:`0 0 20px ${buoy.primary}4D`,...d?{overflow:"hidden"}:null,boxSizing:"border-box",zIndex:ht??1e3,...h.container,...Ct},children:[kt,(0,_jsxRuntime.jsx)("div",{onPointerDown:zt,onPointerMove:Yt,onPointerUp:Ft,onPointerCancel:Lt,style:{borderTopLeftRadius:d?_nightTheme.night.radius.sheet:6,borderTopRightRadius:d?_nightTheme.night.radius.sheet:6,backgroundColor:d?"transparent":buoy.card,minHeight:56,border:d?"none":`1px solid ${buoy.border}`,boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",flexShrink:0,touchAction:"none",userSelect:"none",cursor:at?"grabbing":"grab",position:"relative"},children:(0,_jsxRuntime.jsx)(ModalHeaderContent,{header:c,isResizing:at||z,mode:f,onMinimize:b?E:void 0,variant:J})}),Rt,St,["bottomLeft","bottomRight"].map(e=>(0,_jsxRuntime.jsx)("div",{onPointerDown:Nt(e),onPointerMove:Ot,onPointerUp:vt,onPointerCancel:vt,style:{position:"absolute",width:30,height:30,bottom:4,...e==="bottomLeft"?{left:4}:{right:4},zIndex:1e3,touchAction:"none",cursor:e==="bottomLeft"?"nesw-resize":"nwse-resize"},children:(0,_jsxRuntime.jsx)("div",{style:{width:20,height:20,borderRadius:10,boxSizing:"border-box",backgroundColor:t?`${gameUI.success}1A`:"transparent",border:t?`2px solid ${gameUI.success}`:"none",boxShadow:t?`0 0 8px ${gameUI.success}99`:"none"}})},e))]},"floating")}return(0,_jsxRuntime.jsx)("div",{"aria-hidden":ot||void 0,style:{fontFamily:_fonts.systemFont,position:"fixed",inset:0,zIndex:ht??1e3,pointerEvents:"none",...ot?{...Ct,inset:"auto",width:"100vw",height:"100vh"}:null},children:(0,_jsxRuntime.jsx)("div",{ref:K,style:{position:"absolute",bottom:0,left:0,right:0,pointerEvents:"auto"},children:(0,_jsxRuntime.jsxs)("div",{ref:ct,role:"dialog","aria-label":jt,style:{height:I.current,display:"flex",flexDirection:"column",backgroundColor:d?_nightTheme.night.color.bg:buoy.card,borderTopLeftRadius:d?_nightTheme.night.radius.sheet:6,borderTopRightRadius:d?_nightTheme.night.radius.sheet:6,border:d?`1px solid ${_nightTheme.night.color.accent}55`:`1px solid ${buoy.border}`,boxShadow:d?`0 -4px 10px ${_nightTheme.night.color.accent}38`:`0 -4px 12px ${buoy.primary}33`,...d?{overflow:"hidden"}:null,boxSizing:"border-box",position:"relative",...h.container},children:[kt,(0,_jsxRuntime.jsx)("div",{onPointerDown:Wt,onPointerMove:Ht,onPointerUp:Pt,onPointerCancel:Bt,style:{borderTopLeftRadius:d?_nightTheme.night.radius.sheet:6,borderTopRightRadius:d?_nightTheme.night.radius.sheet:6,backgroundColor:d?"transparent":buoy.card,minHeight:56,border:d?"none":`1px solid ${buoy.border}`,boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"center",flexShrink:0,touchAction:"none",userSelect:"none",cursor:"ns-resize",position:"relative"},children:(0,_jsxRuntime.jsx)(ModalHeaderContent,{header:c,isResizing:z,mode:f,onMinimize:b?E:void 0,variant:J})}),Rt,Et&&Mt&&!_t&&(0,_jsxRuntime.jsx)(ModalHintBanner,{onAcknowledge:$t}),St]})})},"bottomSheet")};const JsModal=exports.JsModal=(0,_react.memo)(n=>{const o=(0,_licenseModule.getUseAccountAccess)()();if(o.status!=="admitted")return n.visible?(0,_jsxRuntime.jsx)(_AccountSetup.AccountSetup,{}):null;return(0,_jsxRuntime.jsx)(JsModalComponent,{...n})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.copyToClipboard=copyToClipboard;exports.isClipboardAvailable=isClipboardAvailable;var _autoDetectClipboard=require("./autoDetectClipboard.js");var _safeStringify=require("../utils/safeStringify.js");var _displayValue=require("../utils/displayValue.js");const clipboardFunction=(0,_autoDetectClipboard.getAutoDetectedClipboard)();async function copyToClipboard(t){try{const e=typeof t==="string"?t:typeof t==="object"&&t!==null?(()=>{try{if(typeof structuredClone==="function"){const r=structuredClone(t);return(0,_safeStringify.safeStringify)(r,2,{depthLimit:100,edgesLimit:1e3})}}catch{}return(0,_safeStringify.safeStringify)(t,2,{depthLimit:100,edgesLimit:1e3})})():(0,_displayValue.displayValue)(t);return await clipboardFunction(e)}catch(e){console.error("[RnBetterDevTools] Copy failed:",e);console.error("Value type:",typeof t);console.error("Value constructor:",t?.constructor?.name);return false}}function isClipboardAvailable(){return true}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.copyToClipboard=copyToClipboard;exports.isClipboardAvailable=isClipboardAvailable;var _autoDetectClipboard=require("./autoDetectClipboard.js");var _safeStringify=require("../utils/safeStringify.js");var _displayValue=require("../utils/displayValue.js");const clipboardFunction=(0,_autoDetectClipboard.getAutoDetectedClipboard)();async function copyToClipboard(t){try{const e=typeof t==="string"?t:typeof t==="object"&&t!==null?(()=>{try{if(typeof structuredClone==="function"){const r=structuredClone(t);return(0,_safeStringify.safeStringify)(r,2,{depthLimit:100,edgesLimit:1e3})}}catch{}return(0,_safeStringify.safeStringify)(t,2,{depthLimit:100,edgesLimit:1e3})})():(0,_displayValue.displayValue)(t);return await clipboardFunction(e)}catch(e){console.error("[RnBetterDevTools] Copy failed:",e);console.error("[Buoy]","Value type:",typeof t);console.error("[Buoy]","Value constructor:",t?.constructor?.name);return false}}function isClipboardAvailable(){return true}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.VirtualizedDataExplorer=void 0;var _react=require("react");var _reactNative=require("react-native");var _displayValue=require("../utils/displayValue.js");var _index=require("../ui/gameUI/index.js");var _nightTheme=require("../ui/night/nightTheme.js");var _CopyButton=require("../ui/components/CopyButton.js");var _index2=require("../icons/index.js");var _IndentGuidesOverlay=require("./IndentGuidesOverlay.js");var _fonts=require("../ui/fonts.js");var _jsxRuntime=require("react/jsx-runtime");const HIT_SLOP_10={top:10,bottom:10,left:10,right:10};const ITEM_HEIGHT=24;const LONG_ITEM_HEIGHT=24;const CHUNK_SIZE=50;const MAX_DEPTH_LIMIT=15;const MAX_ITEMS_PER_LEVEL=500;const LONG_KEY_THRESHOLD=30;const DOUBLE_TAP_MS=300;const INDENT_WIDTH=16;const INDENT_STYLES=Array.from({length:MAX_DEPTH_LIMIT+1},(e,o)=>_reactNative.StyleSheet.create({container:{marginLeft:o*INDENT_WIDTH}}).container);const TYPE_COLOR_CACHE=new Map([["string",_index.gameUIColors.dataTypes.string],["number",_index.gameUIColors.dataTypes.number],["bigint",_index.gameUIColors.optional],["boolean",_index.gameUIColors.dataTypes.boolean],["null",_index.gameUIColors.dataTypes.null],["undefined",_index.gameUIColors.dataTypes.undefined],["function",_index.gameUIColors.dataTypes.function],["symbol",_index.gameUIColors.critical],["date",_index.gameUIColors.critical],["error",_index.gameUIColors.error],["array",_index.gameUIColors.dataTypes.array],["object",_index.gameUIColors.dataTypes.object],["map",_index.gameUIColors.info],["set",_index.gameUIColors.success],["circular",_index.gameUIColors.warning]]);const STABLE_STYLES=_reactNative.StyleSheet.create({container:{backgroundColor:_nightTheme.night.color.bg,borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border},header:{flexDirection:"column",paddingHorizontal:16,paddingVertical:12},headerRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:6},title:{color:_index.gameUIColors.primary,fontSize:14,fontWeight:"500"},description:{color:_index.gameUIColors.secondary,fontSize:12,marginTop:2},typeLegend:{flexDirection:"row",flexWrap:"wrap",gap:6,marginTop:8,paddingTop:8,borderTopWidth:1,borderTopColor:_index.gameUIColors.primary+"14"},typeBadge:{flexDirection:"row",alignItems:"center",paddingHorizontal:6,paddingVertical:2,borderRadius:4,borderWidth:1},typeColor:{width:8,height:8,borderRadius:4,marginRight:4},typeName:{fontSize:10,fontWeight:"500",color:_index.gameUIColors.secondary},itemContainer:{minHeight:ITEM_HEIGHT,backgroundColor:"transparent",position:"relative",flexDirection:"row",alignItems:"flex-start"},itemTouchable:{flex:1,flexDirection:"row",alignItems:"flex-start",paddingLeft:0,paddingRight:16,paddingVertical:2,minHeight:24},itemTouchablePressed:{backgroundColor:_index.gameUIColors.primary+"0A"},itemSelected:{backgroundColor:_index.gameUIColors.primary+"14"},expanderContainer:{width:16,alignItems:"center",justifyContent:"center",marginTop:4},expanderIcon:{width:12,height:12},labelContainer:{flex:1,flexDirection:"row",alignItems:"flex-start",paddingLeft:2},labelContainerVertical:{flex:1,flexDirection:"column",paddingLeft:2,paddingVertical:2},labelContainerVerticalRow:{flexDirection:"row",alignItems:"center",marginBottom:2},labelText:{color:_index.gameUIColors.primary,fontSize:12,fontWeight:"500",fontFamily:_fonts.monoFont,marginRight:8,flexShrink:1},labelTextTruncated:{color:_index.gameUIColors.primary,fontSize:12,fontWeight:"500",fontFamily:_fonts.monoFont,flexShrink:1},valueText:{fontSize:12,fontFamily:_fonts.monoFont,flex:1,color:_index.gameUIColors.primaryLight},loadingContainer:{padding:16,alignItems:"center"},loadingText:{color:_index.gameUIColors.secondary,fontSize:12},noDataContainer:{padding:16,alignItems:"center"},noDataText:{color:_index.gameUIColors.secondary,fontSize:12},listContent:{paddingBottom:8},headerTouchable:{flex:1,flexDirection:"row",alignItems:"center"},expanderMargin:{marginLeft:8}});function selectionOf(e){return{path:e.path.slice(1),value:e.value,label:e.key}}function countNodesUpTo(e,o,i=0){if(i>=o)return i;let f=i+1;if(Array.isArray(e)){for(const b of e){if(f>=o)return f;f=countNodesUpTo(b,o,f)}}else if(e!==null&&typeof e==="object"){for(const b of Object.values(e)){if(f>=o)return f;f=countNodesUpTo(b,o,f)}}return f}const getValueType=e=>{if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(e instanceof Date)return"date";if(e instanceof Error)return"error";if(e instanceof Map)return"map";if(e instanceof Set)return"set";if(e instanceof RegExp)return"regexp";if(typeof e==="function")return"function";if(typeof e==="symbol")return"symbol";if(typeof e==="bigint")return"bigint";if(typeof e==="object")return"object";return typeof e};const getValueCount=(e,o)=>{if(e===null)return 0;switch(o){case"array":return Array.isArray(e)?e.length:0;case"object":return typeof e==="object"&&!(e instanceof Date)&&!(e instanceof Error)&&!(e instanceof RegExp)&&!(e instanceof Map)&&!(e instanceof Set)?Object.keys(e).length:0;case"map":return e instanceof Map?e.size:0;case"set":return e instanceof Set?e.size:0;default:return 0}};const formatValue=(e,o)=>{if(e===null)return"null";if(e===void 0)return"undefined";switch(o){case"string":return`"${String(e)}"`;case"boolean":return e===true?"true":"false";case"function":return typeof e==="function"?e.toString().slice(0,50)+"...":"undefined";case"symbol":return typeof e==="symbol"?String(e):"undefined";case"date":return e instanceof Date?e.toISOString():"undefined";case"regexp":return e instanceof RegExp?e.toString():"undefined";case"bigint":return typeof e==="bigint"?e.toString()+"n":"undefined";case"error":return e instanceof Error?`${e.name}: ${e.message}`:"undefined";default:return(0,_displayValue.displayValue)(e)}};const getTypeColor=e=>{return TYPE_COLOR_CACHE.get(e)||_index.gameUIColors.dataTypes.array};const ExpanderComponent=({expanded:e,onPress:o})=>{return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{"sentry-label":"ignore devtools data explorer expander",style:STABLE_STYLES.expanderContainer,onPress:o,hitSlop:HIT_SLOP_10,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.expanderIcon,children:(0,_jsxRuntime.jsx)(_index2.ChevronRight,{size:12,color:_index.gameUIColors.secondary,strokeWidth:2,style:{transform:[{rotate:e?"90deg":"0deg"}]}})})})};ExpanderComponent.displayName="Expander";const Expander=(0,_react.memo)(ExpanderComponent);const TypeLegendComponent=({visibleTypes:e})=>{const o=Array.from(new Set(e)).slice(0,8);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.typeLegend,children:o.map(i=>{const f=getTypeColor(i);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[STABLE_STYLES.typeBadge,{backgroundColor:`${f}10`,borderColor:`${f}30`}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[STABLE_STYLES.typeColor,{backgroundColor:f}]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:STABLE_STYLES.typeName,children:i})]},i)})})};TypeLegendComponent.displayName="TypeLegend";const TypeLegend=(0,_react.memo)(TypeLegendComponent);const useDataFlattening=(e,o=10,i=false)=>{const[f,b]=(0,_react.useState)([]);const V=(0,_react.useRef)(new Map);const $=(0,_react.useCallback)(()=>{const t=new Set(["root"]);if(i&&e&&typeof e==="object"){if(Array.isArray(e)){e.forEach((p,s)=>{t.add(`root.${s}`)})}else{Object.keys(e).forEach(p=>{t.add(`root.${p}`)})}}return t},[i,e]);const[E,D]=(0,_react.useState)(()=>$());const[_,R]=(0,_react.useState)(false);const C=(0,_react.useRef)(new WeakSet);const I=(0,_react.useRef)(false);const k=(0,_react.useRef)(0);const P=(0,_react.useRef)(0);const a=(0,_react.useRef)(void 0);const m=(0,_react.useCallback)((t,p,s,u="root",n=0,T,g=[],h=0,S=1,x=[])=>{if(n>Math.min(o,MAX_DEPTH_LIMIT))return[];const c=[...g,u];const l=c.join(".");const y=getValueType(t);const U=["object","array","map","set"].includes(y)&&t!==null;const W=U?getValueCount(t,y):0;const M=Math.min(W,MAX_ITEMS_PER_LEVEL);if(t&&typeof t==="object"){if(s.has(t)){return[{id:l,key:u,value:"[Circular Reference]",valueType:"circular",depth:n,isExpandable:false,isExpanded:false,parentId:T,hasChildren:false,childCount:0,path:c,type:"circular",isLastChild:h===S-1,parentHasMoreSiblings:[...x],siblingIndex:h,totalSiblings:S}]}s.add(t)}const r={id:l,key:u,value:t,valueType:y,depth:n,isExpandable:U,isExpanded:p.has(l),parentId:T,hasChildren:M>0,childCount:M,path:c,type:U?"expandable":y,isLastChild:h===S-1,parentHasMoreSiblings:[...x],siblingIndex:h,totalSiblings:S};const d=[r];if(U&&p.has(l)&&n<Math.min(o,MAX_DEPTH_LIMIT)){try{let j=[];switch(y){case"array":j=Array.isArray(t)?t.map((w,A)=>[A.toString(),w]):[];break;case"object":j=typeof t==="object"&&t!==null&&!(t instanceof Date)&&!(t instanceof Error)&&!(t instanceof RegExp)&&!(t instanceof Map)&&!(t instanceof Set)?Object.entries(t):[];break;case"map":j=t instanceof Map?Array.from(t.entries()).map(([w,A])=>[String(w),A]):[];break;case"set":j=t instanceof Set?Array.from(t.values()).map((w,A)=>[A.toString(),w]):[];break}const B=j.slice(0,M);const v=B.length;const q=[...x];if(n>0){q[n-1]=!r.isLastChild}for(let w=0;w<B.length;w+=CHUNK_SIZE){const A=B.slice(w,w+CHUNK_SIZE);let F=w;for(const[K,G]of A){d.push(...m(G,p,s,K,n+1,l,c,F,v,q));F++}if(w>0&&w%(CHUNK_SIZE*2)===0){break}}}catch(j){console.error(j)}}return d},[o]);(0,_react.useEffect)(()=>{if(a.current&&(a.current.type==="expand"||a.current.type==="collapse")){if(_){R(false);I.current=false}a.current=void 0;return}if(I.current){return}let t;const p=++k.current;const s=()=>k.current===p;I.current=true;R(true);const u=async()=>{t=setTimeout(()=>{if(I.current&&s()){R(false);I.current=false}},5e3);await new Promise(n=>setTimeout(()=>n(),10));if(!s()){return}try{C.current=new WeakSet;P.current=Date.now();const n=m(e,E,C.current,"root",0,void 0,[],0,1,[]);const T=new Map;n.forEach((g,h)=>{T.set(g.id,{item:g,index:h})});V.current=T;if(t)clearTimeout(t);if(s()){b(n);R(false);I.current=false}}catch(n){console.error(n);if(t)clearTimeout(t);if(s()){b([]);V.current=new Map;R(false);I.current=false}}};u();return()=>{I.current=false;if(t)clearTimeout(t)}},[e,E,m,o]);const O=(0,_react.useCallback)((t,p)=>{R(false);I.current=false;b(s=>{const u=V.current.get(t);if(!u){return s}const{item:n,index:T}=u;if(p&&n.isExpandable&&n.hasChildren){const g=[...s];const h=new WeakSet;if(n.value&&typeof n.value==="object"){h.add(n.value)}const S=[];try{let l=[];const y=n.valueType;switch(y){case"array":l=Array.isArray(n.value)?n.value.map((r,d)=>[d.toString(),r]):[];break;case"object":l=typeof n.value==="object"&&n.value!==null&&!(n.value instanceof Date)&&!(n.value instanceof Error)&&!(n.value instanceof RegExp)&&!(n.value instanceof Map)&&!(n.value instanceof Set)?Object.entries(n.value):[];break;case"map":l=n.value instanceof Map?Array.from(n.value.entries()).map(([r,d])=>[String(r),d]):[];break;case"set":l=n.value instanceof Set?Array.from(n.value.values()).map((r,d)=>[d.toString(),r]):[];break}const U=l.length;const W=n.parentHasMoreSiblings||[];const M=[...W];if(n.depth>0){M[n.depth-1]=!n.isLastChild}l.forEach(([r,d],j)=>{const B=m(d,new Set,h,r,n.depth+1,t,n.path,j,U,M);S.push(...B)})}catch(l){console.error(l)}const x=S;if(x.length>0){}g[T]={...n,isExpanded:true};g.splice(T+1,0,...x);const c=new Map;g.forEach((l,y)=>{c.set(l.id,{item:l,index:y})});V.current=c;return g}else if(!p){const g=new Set;const h=(c,l)=>{s.forEach(y=>{if(y.parentId===c||y.id.startsWith(c+".")&&y.depth>l){g.add(y.id);if(y.hasChildren){h(y.id,y.depth)}}})};h(t,n.depth);const S=s.map(c=>{if(c.id===t){return{...c,isExpanded:false}}return c}).filter(c=>!g.has(c.id));const x=new Map;S.forEach((c,l)=>{x.set(c.id,{item:c,index:l})});V.current=x;return S}return s})},[m]);const z=(0,_react.useCallback)(t=>{D(p=>{const s=new Set(p);const u=!s.has(t);if(u){s.add(t)}else{s.delete(t)}a.current={type:u?"expand":"collapse",itemId:t};O(t,u);return s})},[O]);const L=countNodesUpTo(e,CHUNK_SIZE,0)<CHUNK_SIZE;const H=(0,_react.useMemo)(()=>{if(!L)return null;return m(e,E,new WeakSet,"root",0,void 0,[],0,1,[])},[L,e,E,m]);const N=(0,_react.useCallback)(t=>{if(t.length===0)return;D(p=>{if(t.every(u=>p.has(u)))return p;const s=new Set(p);for(const u of t)s.add(u);return s})},[]);return{flatData:H??f,isProcessing:H?false:_,toggleExpanded:z,revealPath:N}};const VirtualizedItemComponent=({item:e,onToggleExpanded:o,index:i,onSelect:f,isSelected:b,selectable:V,onRequestInlineEdit:$,isInlineEditing:E,inlineEditor:D,testIDPrefix:_})=>{const[R,C]=(0,_react.useState)(false);const[I,k]=(0,_react.useState)(false);const P=V===true;const a=(0,_react.useRef)(0);const m=e.path.slice(1);const O=INDENT_STYLES[Math.min(e.depth,MAX_DEPTH_LIMIT)]||INDENT_STYLES[0];const z=getTypeColor(e.valueType);const L=false;const H=()=>{if(P){const s=Date.now();const u=s-a.current<DOUBLE_TAP_MS;a.current=s;if(u&&!e.isExpandable&&$){$(e);return}f(e);return}if(e.isExpandable){o(e.id)}f(e)};const N=()=>{if(e.isExpandable){o(e.id)}f(e)};const t=()=>{};const p=e.key;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[STABLE_STYLES.itemContainer,O],children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{"sentry-label":"ignore devtools data explorer item",testID:`${_}-${e.id}`,accessibilityLabel:`${e.key}: ${e.valueType}`,style:[STABLE_STYLES.itemTouchable,R&&STABLE_STYLES.itemTouchablePressed,P&&b&&STABLE_STYLES.itemSelected,L&&{minHeight:LONG_ITEM_HEIGHT,paddingVertical:2}],onPress:H,onPressIn:()=>C(true),onPressOut:()=>C(false),activeOpacity:e.isExpandable||P?.7:1,disabled:!e.isExpandable&&!P,children:[e.isExpandable?(0,_jsxRuntime.jsx)(Expander,{expanded:e.isExpanded,onPress:N}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.expanderContainer}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:STABLE_STYLES.labelContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:STABLE_STYLES.labelText,numberOfLines:1,children:[e.key,":"]}),E&&D?D:e.isExpandable?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[STABLE_STYLES.valueText,{color:_index.gameUIColors.secondary}],numberOfLines:1,children:[e.valueType," (",e.childCount," ",e.childCount===1?"item":"items",")"]}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[STABLE_STYLES.valueText,{color:z}],numberOfLines:1,children:formatValue(e.value,e.valueType)})]})]}),e.value!==void 0?(0,_jsxRuntime.jsx)(_CopyButton.CopyButton,{value:e.value,size:14,buttonStyle:{marginLeft:8,marginRight:8}}):null]})};VirtualizedItemComponent.displayName="VirtualizedItem";const VirtualizedItem=(0,_react.memo)(VirtualizedItemComponent);const VirtualizedDataExplorer=({title:e,description:o,data:i,maxDepth:f=10,rawMode:b=false,initialExpanded:V=false,disableCopy:$=false,onSelectionChange:E,onRequestInlineEdit:D,inlineEditPath:_,renderInlineEditor:R,selectPath:C,testIDPrefix:I="buoy-tree-row"})=>{const[k,P]=(0,_react.useState)(b);const{flatData:a,isProcessing:m,toggleExpanded:O,revealPath:z}=useDataFlattening(i,f,V);const L=(0,_react.useRef)(null);const[H,N]=(0,_react.useState)({start:0,end:Math.min(a.length-1,Math.max(0,Math.ceil(400/ITEM_HEIGHT)-1))});const t=(0,_react.useRef)({itemVisiblePercentThreshold:1});const p=(0,_react.useRef)(({viewableItems:r})=>{const d=r.map(j=>j.index).filter(j=>typeof j==="number");if(d.length){N({start:Math.min(...d),end:Math.max(...d)})}}).current;(0,_react.useEffect)(()=>{N({start:0,end:Math.min(a.length-1,Math.max(0,Math.ceil(400/ITEM_HEIGHT)-1))})},[a.length]);const s=(0,_react.useMemo)(()=>{const r=new Set;for(const d of a){r.add(d.valueType);if(r.size>=8)break}return Array.from(r)},[a]);const u=()=>{P(!k)};const[n,T]=(0,_react.useState)(null);const g=(0,_react.useMemo)(()=>n==null?void 0:a.find(r=>r.id===n),[a,n]);const h=g?.depth;(0,_react.useEffect)(()=>{if(!E)return;E(g?selectionOf(g):null)},[g,E]);const S=(0,_react.useCallback)(r=>{T(d=>d===r.id?null:r.id)},[]);const x=C===void 0?void 0:C===null?"\0null":C.join(".");const c=(0,_react.useRef)(x);(0,_react.useEffect)(()=>{if(x===c.current)return;c.current=x;if(x===void 0)return;if(C==null){T(null);return}const r=["root"];for(const d of C.slice(0,-1)){r.push(`${r[r.length-1]}.${d}`)}z(r);T(["root",...C].join("."))},[x,C,z]);const l=(0,_react.useCallback)(r=>{T(r.id);D?.(selectionOf(r))},[D]);const y=({item:r,index:d})=>(0,_jsxRuntime.jsx)(VirtualizedItem,{item:r,index:d,onToggleExpanded:O,onSelect:S,isSelected:g?.id===r.id,selectable:E!=null,onRequestInlineEdit:l,isInlineEditing:_!=null&&_.join(".")===r.path.slice(1).join("."),inlineEditor:R?R(selectionOf(r)):null,testIDPrefix:I});const U=ITEM_HEIGHT;const W=r=>r.id;const M=i!==null&&i!==void 0&&(typeof i==="string"?i.length>0:typeof i==="number"||typeof i==="boolean"?true:Array.isArray(i)?i.length>0:typeof i==="object"?Object.keys(i).length>0:false);if(b){if(!M){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flex:1,justifyContent:"center",alignItems:"center",padding:20},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:STABLE_STYLES.noDataText,children:"No data available"})})}return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{minHeight:m?40:a.length*ITEM_HEIGHT},children:m?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:STABLE_STYLES.loadingText,children:["Processing data... (raw mode, isProcessing=",String(m),")"]})}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{position:"relative",height:a.length*ITEM_HEIGHT},children:[(0,_jsxRuntime.jsx)(_IndentGuidesOverlay.IndentGuidesOverlay,{items:a,visibleRange:{start:0,end:Math.max(0,a.length-1)},itemHeight:ITEM_HEIGHT,indentWidth:INDENT_WIDTH,activeDepth:h}),(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:L,"sentry-label":"ignore devtools data explorer list",data:a,renderItem:y,keyExtractor:W,showsVerticalScrollIndicator:true,contentContainerStyle:STABLE_STYLES.listContent,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:false})]})})}if(!M){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:STABLE_STYLES.container,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.header,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.headerRow,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1},children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:STABLE_STYLES.title,children:e}),o&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:STABLE_STYLES.description,children:o})]})})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.noDataContainer,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:STABLE_STYLES.noDataText,children:"No data available"})})]})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:STABLE_STYLES.container,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:STABLE_STYLES.header,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.headerRow,children:(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{"sentry-label":"ignore devtools data explorer header toggle",onPress:u,hitSlop:HIT_SLOP_10,style:STABLE_STYLES.headerTouchable,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1},children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:STABLE_STYLES.title,children:e}),o&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:STABLE_STYLES.description,children:o})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.expanderMargin,children:(0,_jsxRuntime.jsx)(Expander,{expanded:k,onPress:u})})]})}),k&&s.length>0&&!b&&(0,_jsxRuntime.jsx)(TypeLegend,{visibleTypes:s})]}),k&&(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:m?(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.loadingContainer,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:STABLE_STYLES.loadingText,children:["Processing data... (isProcessing=",String(m),")"]})}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{height:a.length*ITEM_HEIGHT,position:"relative"},children:[(0,_jsxRuntime.jsx)(_IndentGuidesOverlay.IndentGuidesOverlay,{items:a,visibleRange:H,itemHeight:ITEM_HEIGHT,indentWidth:INDENT_WIDTH,activeDepth:h}),(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:L,"sentry-label":"ignore devtools data explorer collapsed list",data:a,renderItem:y,keyExtractor:W,showsVerticalScrollIndicator:true,contentContainerStyle:STABLE_STYLES.listContent,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:false,onViewableItemsChanged:p,viewabilityConfig:t.current})]})})]})};exports.VirtualizedDataExplorer=VirtualizedDataExplorer;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.VirtualizedDataExplorer=void 0;var _react=require("react");var _reactNative=require("react-native");var _displayValue=require("../utils/displayValue.js");var _index=require("../ui/gameUI/index.js");var _nightTheme=require("../ui/night/nightTheme.js");var _CopyButton=require("../ui/components/CopyButton.js");var _index2=require("../icons/index.js");var _IndentGuidesOverlay=require("./IndentGuidesOverlay.js");var _fonts=require("../ui/fonts.js");var _jsxRuntime=require("react/jsx-runtime");const HIT_SLOP_10={top:10,bottom:10,left:10,right:10};const ITEM_HEIGHT=24;const LONG_ITEM_HEIGHT=24;const CHUNK_SIZE=50;const MAX_DEPTH_LIMIT=15;const MAX_ITEMS_PER_LEVEL=500;const LONG_KEY_THRESHOLD=30;const DOUBLE_TAP_MS=300;const INDENT_WIDTH=16;const INDENT_STYLES=Array.from({length:MAX_DEPTH_LIMIT+1},(e,o)=>_reactNative.StyleSheet.create({container:{marginLeft:o*INDENT_WIDTH}}).container);const TYPE_COLOR_CACHE=new Map([["string",_index.gameUIColors.dataTypes.string],["number",_index.gameUIColors.dataTypes.number],["bigint",_index.gameUIColors.optional],["boolean",_index.gameUIColors.dataTypes.boolean],["null",_index.gameUIColors.dataTypes.null],["undefined",_index.gameUIColors.dataTypes.undefined],["function",_index.gameUIColors.dataTypes.function],["symbol",_index.gameUIColors.critical],["date",_index.gameUIColors.critical],["error",_index.gameUIColors.error],["array",_index.gameUIColors.dataTypes.array],["object",_index.gameUIColors.dataTypes.object],["map",_index.gameUIColors.info],["set",_index.gameUIColors.success],["circular",_index.gameUIColors.warning]]);const STABLE_STYLES=_reactNative.StyleSheet.create({container:{backgroundColor:_nightTheme.night.color.bg,borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border},header:{flexDirection:"column",paddingHorizontal:16,paddingVertical:12},headerRow:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:6},title:{color:_index.gameUIColors.primary,fontSize:14,fontWeight:"500"},description:{color:_index.gameUIColors.secondary,fontSize:12,marginTop:2},typeLegend:{flexDirection:"row",flexWrap:"wrap",gap:6,marginTop:8,paddingTop:8,borderTopWidth:1,borderTopColor:_index.gameUIColors.primary+"14"},typeBadge:{flexDirection:"row",alignItems:"center",paddingHorizontal:6,paddingVertical:2,borderRadius:4,borderWidth:1},typeColor:{width:8,height:8,borderRadius:4,marginRight:4},typeName:{fontSize:10,fontWeight:"500",color:_index.gameUIColors.secondary},itemContainer:{minHeight:ITEM_HEIGHT,backgroundColor:"transparent",position:"relative",flexDirection:"row",alignItems:"flex-start"},itemTouchable:{flex:1,flexDirection:"row",alignItems:"flex-start",paddingLeft:0,paddingRight:16,paddingVertical:2,minHeight:24},itemTouchablePressed:{backgroundColor:_index.gameUIColors.primary+"0A"},itemSelected:{backgroundColor:_index.gameUIColors.primary+"14"},expanderContainer:{width:16,alignItems:"center",justifyContent:"center",marginTop:4},expanderIcon:{width:12,height:12},labelContainer:{flex:1,flexDirection:"row",alignItems:"flex-start",paddingLeft:2},labelContainerVertical:{flex:1,flexDirection:"column",paddingLeft:2,paddingVertical:2},labelContainerVerticalRow:{flexDirection:"row",alignItems:"center",marginBottom:2},labelText:{color:_index.gameUIColors.primary,fontSize:12,fontWeight:"500",fontFamily:_fonts.monoFont,marginRight:8,flexShrink:1},labelTextTruncated:{color:_index.gameUIColors.primary,fontSize:12,fontWeight:"500",fontFamily:_fonts.monoFont,flexShrink:1},valueText:{fontSize:12,fontFamily:_fonts.monoFont,flex:1,color:_index.gameUIColors.primaryLight},loadingContainer:{padding:16,alignItems:"center"},loadingText:{color:_index.gameUIColors.secondary,fontSize:12},noDataContainer:{padding:16,alignItems:"center"},noDataText:{color:_index.gameUIColors.secondary,fontSize:12},listContent:{paddingBottom:8},headerTouchable:{flex:1,flexDirection:"row",alignItems:"center"},expanderMargin:{marginLeft:8}});function selectionOf(e){return{path:e.path.slice(1),value:e.value,label:e.key}}function countNodesUpTo(e,o,i=0){if(i>=o)return i;let f=i+1;if(Array.isArray(e)){for(const b of e){if(f>=o)return f;f=countNodesUpTo(b,o,f)}}else if(e!==null&&typeof e==="object"){for(const b of Object.values(e)){if(f>=o)return f;f=countNodesUpTo(b,o,f)}}return f}const getValueType=e=>{if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";if(e instanceof Date)return"date";if(e instanceof Error)return"error";if(e instanceof Map)return"map";if(e instanceof Set)return"set";if(e instanceof RegExp)return"regexp";if(typeof e==="function")return"function";if(typeof e==="symbol")return"symbol";if(typeof e==="bigint")return"bigint";if(typeof e==="object")return"object";return typeof e};const getValueCount=(e,o)=>{if(e===null)return 0;switch(o){case"array":return Array.isArray(e)?e.length:0;case"object":return typeof e==="object"&&!(e instanceof Date)&&!(e instanceof Error)&&!(e instanceof RegExp)&&!(e instanceof Map)&&!(e instanceof Set)?Object.keys(e).length:0;case"map":return e instanceof Map?e.size:0;case"set":return e instanceof Set?e.size:0;default:return 0}};const formatValue=(e,o)=>{if(e===null)return"null";if(e===void 0)return"undefined";switch(o){case"string":return`"${String(e)}"`;case"boolean":return e===true?"true":"false";case"function":return typeof e==="function"?e.toString().slice(0,50)+"...":"undefined";case"symbol":return typeof e==="symbol"?String(e):"undefined";case"date":return e instanceof Date?e.toISOString():"undefined";case"regexp":return e instanceof RegExp?e.toString():"undefined";case"bigint":return typeof e==="bigint"?e.toString()+"n":"undefined";case"error":return e instanceof Error?`${e.name}: ${e.message}`:"undefined";default:return(0,_displayValue.displayValue)(e)}};const getTypeColor=e=>{return TYPE_COLOR_CACHE.get(e)||_index.gameUIColors.dataTypes.array};const ExpanderComponent=({expanded:e,onPress:o})=>{return(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{"sentry-label":"ignore devtools data explorer expander",style:STABLE_STYLES.expanderContainer,onPress:o,hitSlop:HIT_SLOP_10,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.expanderIcon,children:(0,_jsxRuntime.jsx)(_index2.ChevronRight,{size:12,color:_index.gameUIColors.secondary,strokeWidth:2,style:{transform:[{rotate:e?"90deg":"0deg"}]}})})})};ExpanderComponent.displayName="Expander";const Expander=(0,_react.memo)(ExpanderComponent);const TypeLegendComponent=({visibleTypes:e})=>{const o=Array.from(new Set(e)).slice(0,8);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.typeLegend,children:o.map(i=>{const f=getTypeColor(i);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[STABLE_STYLES.typeBadge,{backgroundColor:`${f}10`,borderColor:`${f}30`}],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[STABLE_STYLES.typeColor,{backgroundColor:f}]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:STABLE_STYLES.typeName,children:i})]},i)})})};TypeLegendComponent.displayName="TypeLegend";const TypeLegend=(0,_react.memo)(TypeLegendComponent);const useDataFlattening=(e,o=10,i=false)=>{const[f,b]=(0,_react.useState)([]);const V=(0,_react.useRef)(new Map);const B=(0,_react.useCallback)(()=>{const t=new Set(["root"]);if(i&&e&&typeof e==="object"){if(Array.isArray(e)){e.forEach((p,s)=>{t.add(`root.${s}`)})}else{Object.keys(e).forEach(p=>{t.add(`root.${p}`)})}}return t},[i,e]);const[E,D]=(0,_react.useState)(()=>B());const[_,R]=(0,_react.useState)(false);const C=(0,_react.useRef)(new WeakSet);const I=(0,_react.useRef)(false);const k=(0,_react.useRef)(0);const P=(0,_react.useRef)(0);const a=(0,_react.useRef)(void 0);const m=(0,_react.useCallback)((t,p,s,u="root",n=0,T,g=[],h=0,S=1,x=[])=>{if(n>Math.min(o,MAX_DEPTH_LIMIT))return[];const c=[...g,u];const l=c.join(".");const y=getValueType(t);const U=["object","array","map","set"].includes(y)&&t!==null;const W=U?getValueCount(t,y):0;const M=Math.min(W,MAX_ITEMS_PER_LEVEL);if(t&&typeof t==="object"){if(s.has(t)){return[{id:l,key:u,value:"[Circular Reference]",valueType:"circular",depth:n,isExpandable:false,isExpanded:false,parentId:T,hasChildren:false,childCount:0,path:c,type:"circular",isLastChild:h===S-1,parentHasMoreSiblings:[...x],siblingIndex:h,totalSiblings:S}]}s.add(t)}const r={id:l,key:u,value:t,valueType:y,depth:n,isExpandable:U,isExpanded:p.has(l),parentId:T,hasChildren:M>0,childCount:M,path:c,type:U?"expandable":y,isLastChild:h===S-1,parentHasMoreSiblings:[...x],siblingIndex:h,totalSiblings:S};const d=[r];if(U&&p.has(l)&&n<Math.min(o,MAX_DEPTH_LIMIT)){try{let j=[];switch(y){case"array":j=Array.isArray(t)?t.map((w,A)=>[A.toString(),w]):[];break;case"object":j=typeof t==="object"&&t!==null&&!(t instanceof Date)&&!(t instanceof Error)&&!(t instanceof RegExp)&&!(t instanceof Map)&&!(t instanceof Set)?Object.entries(t):[];break;case"map":j=t instanceof Map?Array.from(t.entries()).map(([w,A])=>[String(w),A]):[];break;case"set":j=t instanceof Set?Array.from(t.values()).map((w,A)=>[A.toString(),w]):[];break}const $=j.slice(0,M);const v=$.length;const q=[...x];if(n>0){q[n-1]=!r.isLastChild}for(let w=0;w<$.length;w+=CHUNK_SIZE){const A=$.slice(w,w+CHUNK_SIZE);let F=w;for(const[K,G]of A){d.push(...m(G,p,s,K,n+1,l,c,F,v,q));F++}if(w>0&&w%(CHUNK_SIZE*2)===0){break}}}catch(j){console.error("[Buoy]",j)}}return d},[o]);(0,_react.useEffect)(()=>{if(a.current&&(a.current.type==="expand"||a.current.type==="collapse")){if(_){R(false);I.current=false}a.current=void 0;return}if(I.current){return}let t;const p=++k.current;const s=()=>k.current===p;I.current=true;R(true);const u=async()=>{t=setTimeout(()=>{if(I.current&&s()){R(false);I.current=false}},5e3);await new Promise(n=>setTimeout(()=>n(),10));if(!s()){return}try{C.current=new WeakSet;P.current=Date.now();const n=m(e,E,C.current,"root",0,void 0,[],0,1,[]);const T=new Map;n.forEach((g,h)=>{T.set(g.id,{item:g,index:h})});V.current=T;if(t)clearTimeout(t);if(s()){b(n);R(false);I.current=false}}catch(n){console.error("[Buoy]",n);if(t)clearTimeout(t);if(s()){b([]);V.current=new Map;R(false);I.current=false}}};u();return()=>{I.current=false;if(t)clearTimeout(t)}},[e,E,m,o]);const O=(0,_react.useCallback)((t,p)=>{R(false);I.current=false;b(s=>{const u=V.current.get(t);if(!u){return s}const{item:n,index:T}=u;if(p&&n.isExpandable&&n.hasChildren){const g=[...s];const h=new WeakSet;if(n.value&&typeof n.value==="object"){h.add(n.value)}const S=[];try{let l=[];const y=n.valueType;switch(y){case"array":l=Array.isArray(n.value)?n.value.map((r,d)=>[d.toString(),r]):[];break;case"object":l=typeof n.value==="object"&&n.value!==null&&!(n.value instanceof Date)&&!(n.value instanceof Error)&&!(n.value instanceof RegExp)&&!(n.value instanceof Map)&&!(n.value instanceof Set)?Object.entries(n.value):[];break;case"map":l=n.value instanceof Map?Array.from(n.value.entries()).map(([r,d])=>[String(r),d]):[];break;case"set":l=n.value instanceof Set?Array.from(n.value.values()).map((r,d)=>[d.toString(),r]):[];break}const U=l.length;const W=n.parentHasMoreSiblings||[];const M=[...W];if(n.depth>0){M[n.depth-1]=!n.isLastChild}l.forEach(([r,d],j)=>{const $=m(d,new Set,h,r,n.depth+1,t,n.path,j,U,M);S.push(...$)})}catch(l){console.error("[Buoy]",l)}const x=S;if(x.length>0){}g[T]={...n,isExpanded:true};g.splice(T+1,0,...x);const c=new Map;g.forEach((l,y)=>{c.set(l.id,{item:l,index:y})});V.current=c;return g}else if(!p){const g=new Set;const h=(c,l)=>{s.forEach(y=>{if(y.parentId===c||y.id.startsWith(c+".")&&y.depth>l){g.add(y.id);if(y.hasChildren){h(y.id,y.depth)}}})};h(t,n.depth);const S=s.map(c=>{if(c.id===t){return{...c,isExpanded:false}}return c}).filter(c=>!g.has(c.id));const x=new Map;S.forEach((c,l)=>{x.set(c.id,{item:c,index:l})});V.current=x;return S}return s})},[m]);const z=(0,_react.useCallback)(t=>{D(p=>{const s=new Set(p);const u=!s.has(t);if(u){s.add(t)}else{s.delete(t)}a.current={type:u?"expand":"collapse",itemId:t};O(t,u);return s})},[O]);const L=countNodesUpTo(e,CHUNK_SIZE,0)<CHUNK_SIZE;const H=(0,_react.useMemo)(()=>{if(!L)return null;return m(e,E,new WeakSet,"root",0,void 0,[],0,1,[])},[L,e,E,m]);const N=(0,_react.useCallback)(t=>{if(t.length===0)return;D(p=>{if(t.every(u=>p.has(u)))return p;const s=new Set(p);for(const u of t)s.add(u);return s})},[]);return{flatData:H??f,isProcessing:H?false:_,toggleExpanded:z,revealPath:N}};const VirtualizedItemComponent=({item:e,onToggleExpanded:o,index:i,onSelect:f,isSelected:b,selectable:V,onRequestInlineEdit:B,isInlineEditing:E,inlineEditor:D,testIDPrefix:_})=>{const[R,C]=(0,_react.useState)(false);const[I,k]=(0,_react.useState)(false);const P=V===true;const a=(0,_react.useRef)(0);const m=e.path.slice(1);const O=INDENT_STYLES[Math.min(e.depth,MAX_DEPTH_LIMIT)]||INDENT_STYLES[0];const z=getTypeColor(e.valueType);const L=false;const H=()=>{if(P){const s=Date.now();const u=s-a.current<DOUBLE_TAP_MS;a.current=s;if(u&&!e.isExpandable&&B){B(e);return}f(e);return}if(e.isExpandable){o(e.id)}f(e)};const N=()=>{if(e.isExpandable){o(e.id)}f(e)};const t=()=>{};const p=e.key;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[STABLE_STYLES.itemContainer,O],children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{"sentry-label":"ignore devtools data explorer item",testID:`${_}-${e.id}`,accessibilityLabel:`${e.key}: ${e.valueType}`,style:[STABLE_STYLES.itemTouchable,R&&STABLE_STYLES.itemTouchablePressed,P&&b&&STABLE_STYLES.itemSelected,L&&{minHeight:LONG_ITEM_HEIGHT,paddingVertical:2}],onPress:H,onPressIn:()=>C(true),onPressOut:()=>C(false),activeOpacity:e.isExpandable||P?.7:1,disabled:!e.isExpandable&&!P,children:[e.isExpandable?(0,_jsxRuntime.jsx)(Expander,{expanded:e.isExpanded,onPress:N}):(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.expanderContainer}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:STABLE_STYLES.labelContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:STABLE_STYLES.labelText,numberOfLines:1,children:[e.key,":"]}),E&&D?D:e.isExpandable?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[STABLE_STYLES.valueText,{color:_index.gameUIColors.secondary}],numberOfLines:1,children:[e.valueType," (",e.childCount," ",e.childCount===1?"item":"items",")"]}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[STABLE_STYLES.valueText,{color:z}],numberOfLines:1,children:formatValue(e.value,e.valueType)})]})]}),e.value!==void 0?(0,_jsxRuntime.jsx)(_CopyButton.CopyButton,{value:e.value,size:14,buttonStyle:{marginLeft:8,marginRight:8}}):null]})};VirtualizedItemComponent.displayName="VirtualizedItem";const VirtualizedItem=(0,_react.memo)(VirtualizedItemComponent);const VirtualizedDataExplorer=({title:e,description:o,data:i,maxDepth:f=10,rawMode:b=false,initialExpanded:V=false,disableCopy:B=false,onSelectionChange:E,onRequestInlineEdit:D,inlineEditPath:_,renderInlineEditor:R,selectPath:C,testIDPrefix:I="buoy-tree-row"})=>{const[k,P]=(0,_react.useState)(b);const{flatData:a,isProcessing:m,toggleExpanded:O,revealPath:z}=useDataFlattening(i,f,V);const L=(0,_react.useRef)(null);const[H,N]=(0,_react.useState)({start:0,end:Math.min(a.length-1,Math.max(0,Math.ceil(400/ITEM_HEIGHT)-1))});const t=(0,_react.useRef)({itemVisiblePercentThreshold:1});const p=(0,_react.useRef)(({viewableItems:r})=>{const d=r.map(j=>j.index).filter(j=>typeof j==="number");if(d.length){N({start:Math.min(...d),end:Math.max(...d)})}}).current;(0,_react.useEffect)(()=>{N({start:0,end:Math.min(a.length-1,Math.max(0,Math.ceil(400/ITEM_HEIGHT)-1))})},[a.length]);const s=(0,_react.useMemo)(()=>{const r=new Set;for(const d of a){r.add(d.valueType);if(r.size>=8)break}return Array.from(r)},[a]);const u=()=>{P(!k)};const[n,T]=(0,_react.useState)(null);const g=(0,_react.useMemo)(()=>n==null?void 0:a.find(r=>r.id===n),[a,n]);const h=g?.depth;(0,_react.useEffect)(()=>{if(!E)return;E(g?selectionOf(g):null)},[g,E]);const S=(0,_react.useCallback)(r=>{T(d=>d===r.id?null:r.id)},[]);const x=C===void 0?void 0:C===null?"\0null":C.join(".");const c=(0,_react.useRef)(x);(0,_react.useEffect)(()=>{if(x===c.current)return;c.current=x;if(x===void 0)return;if(C==null){T(null);return}const r=["root"];for(const d of C.slice(0,-1)){r.push(`${r[r.length-1]}.${d}`)}z(r);T(["root",...C].join("."))},[x,C,z]);const l=(0,_react.useCallback)(r=>{T(r.id);D?.(selectionOf(r))},[D]);const y=({item:r,index:d})=>(0,_jsxRuntime.jsx)(VirtualizedItem,{item:r,index:d,onToggleExpanded:O,onSelect:S,isSelected:g?.id===r.id,selectable:E!=null,onRequestInlineEdit:l,isInlineEditing:_!=null&&_.join(".")===r.path.slice(1).join("."),inlineEditor:R?R(selectionOf(r)):null,testIDPrefix:I});const U=ITEM_HEIGHT;const W=r=>r.id;const M=i!==null&&i!==void 0&&(typeof i==="string"?i.length>0:typeof i==="number"||typeof i==="boolean"?true:Array.isArray(i)?i.length>0:typeof i==="object"?Object.keys(i).length>0:false);if(b){if(!M){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flex:1,justifyContent:"center",alignItems:"center",padding:20},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:STABLE_STYLES.noDataText,children:"No data available"})})}return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{minHeight:m?40:a.length*ITEM_HEIGHT},children:m?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flex:1,justifyContent:"center",alignItems:"center"},children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:STABLE_STYLES.loadingText,children:["Processing data... (raw mode, isProcessing=",String(m),")"]})}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{position:"relative",height:a.length*ITEM_HEIGHT},children:[(0,_jsxRuntime.jsx)(_IndentGuidesOverlay.IndentGuidesOverlay,{items:a,visibleRange:{start:0,end:Math.max(0,a.length-1)},itemHeight:ITEM_HEIGHT,indentWidth:INDENT_WIDTH,activeDepth:h}),(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:L,"sentry-label":"ignore devtools data explorer list",data:a,renderItem:y,keyExtractor:W,showsVerticalScrollIndicator:true,contentContainerStyle:STABLE_STYLES.listContent,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:false})]})})}if(!M){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:STABLE_STYLES.container,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.header,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.headerRow,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1},children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:STABLE_STYLES.title,children:e}),o&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:STABLE_STYLES.description,children:o})]})})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.noDataContainer,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:STABLE_STYLES.noDataText,children:"No data available"})})]})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:STABLE_STYLES.container,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:STABLE_STYLES.header,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.headerRow,children:(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{"sentry-label":"ignore devtools data explorer header toggle",onPress:u,hitSlop:HIT_SLOP_10,style:STABLE_STYLES.headerTouchable,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1},children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:STABLE_STYLES.title,children:e}),o&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:STABLE_STYLES.description,children:o})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.expanderMargin,children:(0,_jsxRuntime.jsx)(Expander,{expanded:k,onPress:u})})]})}),k&&s.length>0&&!b&&(0,_jsxRuntime.jsx)(TypeLegend,{visibleTypes:s})]}),k&&(0,_jsxRuntime.jsx)(_jsxRuntime.Fragment,{children:m?(0,_jsxRuntime.jsx)(_reactNative.View,{style:STABLE_STYLES.loadingContainer,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:STABLE_STYLES.loadingText,children:["Processing data... (isProcessing=",String(m),")"]})}):(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{height:a.length*ITEM_HEIGHT,position:"relative"},children:[(0,_jsxRuntime.jsx)(_IndentGuidesOverlay.IndentGuidesOverlay,{items:a,visibleRange:H,itemHeight:ITEM_HEIGHT,indentWidth:INDENT_WIDTH,activeDepth:h}),(0,_jsxRuntime.jsx)(_reactNative.FlatList,{ref:L,"sentry-label":"ignore devtools data explorer collapsed list",data:a,renderItem:y,keyExtractor:W,showsVerticalScrollIndicator:true,contentContainerStyle:STABLE_STYLES.listContent,initialNumToRender:15,maxToRenderPerBatch:10,windowSize:10,scrollEnabled:false,onViewableItemsChanged:p,viewabilityConfig:t.current})]})})]})};exports.VirtualizedDataExplorer=VirtualizedDataExplorer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getDeviceInfo=getDeviceInfo;exports.logDeviceInfo=logDeviceInfo;exports.useDeviceInfo=useDeviceInfo;var _react=require("react");var _reactNative=require("react-native");var _realAppState=require("../utils/realAppState.js");async function getAccessibilitySettings(){const[e,t,a]=await Promise.all([_reactNative.AccessibilityInfo.isScreenReaderEnabled(),_reactNative.AccessibilityInfo.isReduceMotionEnabled(),_reactNative.AccessibilityInfo.isReduceTransparencyEnabled()]);const n={isScreenReaderEnabled:e,isReduceMotionEnabled:t,isReduceTransparencyEnabled:a};if(_reactNative.Platform.OS==="ios"){const[l,d,f,c,u]=await Promise.all([_reactNative.AccessibilityInfo.isBoldTextEnabled?.()??Promise.resolve(false),_reactNative.AccessibilityInfo.isGrayscaleEnabled?.()??Promise.resolve(false),_reactNative.AccessibilityInfo.isInvertColorsEnabled?.()??Promise.resolve(false),_reactNative.AccessibilityInfo.isDarkerSystemColorsEnabled?.()??Promise.resolve(false),_reactNative.AccessibilityInfo.prefersCrossFadeTransitions?.()??Promise.resolve(false)]);n.isBoldTextEnabled=l;n.isGrayscaleEnabled=d;n.isInvertColorsEnabled=f;n.isDarkerSystemColorsEnabled=c;n.prefersCrossFadeTransitions=u}if(_reactNative.Platform.OS==="android"){const l=await _reactNative.AccessibilityInfo.isHighTextContrastEnabled?.()??false;n.isHighTextContrastEnabled=l}return n}function getPlatformInfo(){const e=_reactNative.Platform.constants;const t={os:_reactNative.Platform.OS,version:_reactNative.Platform.Version,reactNativeVersion:e.reactNativeVersion,isTesting:_reactNative.Platform.isTesting??false,isDisableAnimations:e.isDisableAnimations??false};if(_reactNative.Platform.OS==="ios"){return{...t,osVersion:e.osVersion,systemName:e.systemName,interfaceIdiom:e.interfaceIdiom,isPad:_reactNative.Platform.isPad,isTV:_reactNative.Platform.isTV,isVision:_reactNative.Platform.isVision??false,isMacCatalyst:_reactNative.Platform.isMacCatalyst??false,forceTouchAvailable:e.forceTouchAvailable}}if(_reactNative.Platform.OS==="android"){return{...t,apiLevel:e.Version,release:e.Release,brand:e.Brand,manufacturer:e.Manufacturer,model:e.Model,fingerprint:e.Fingerprint,serial:e.Serial,uiMode:e.uiMode}}return t}function getDisplayInfo(){const e=_reactNative.Dimensions.get("window");const t=_reactNative.Dimensions.get("screen");const a={window:{width:e.width,height:e.height,scale:e.scale,fontScale:e.fontScale},screen:{width:t.width,height:t.height,scale:t.scale,fontScale:t.fontScale},pixelRatio:_reactNative.PixelRatio.get(),fontScale:_reactNative.PixelRatio.getFontScale(),isLandscape:e.width>e.height,isPortrait:e.height>e.width};if(_reactNative.Platform.OS==="ios"){try{const n=_reactNative.NativeModules.DeviceInfo?.getConstants?.();a.isIPhoneNotched=n?.isIPhoneX_deprecated??false}catch{a.isIPhoneNotched=false}}if(_reactNative.Platform.OS==="android"){try{const n=_reactNative.NativeModules.DeviceInfo?.getConstants?.();a.isEdgeToEdge=n?.isEdgeToEdge??false;a.densityDpi=Math.round(e.scale*160)}catch{}}return a}async function getStatusBarHeight(){return new Promise(e=>{let t=false;if(_reactNative.Platform.OS==="ios"){_reactNative.NativeModules.StatusBarManager?.getHeight?.(a=>{if(!t){t=true;e(a?.height??null)}})??e(null)}else if(_reactNative.Platform.OS==="android"){t=true;e(_reactNative.StatusBar.currentHeight??null)}else{t=true;e(null)}setTimeout(()=>{if(!t){t=true;e(null)}},100)})}function getLocaleInfo(){const e={isRTL:_reactNative.I18nManager.isRTL,doLeftAndRightSwapInRTL:_reactNative.I18nManager.doLeftAndRightSwapInRTL};if(_reactNative.Platform.OS==="android"){e.localeIdentifier=_reactNative.I18nManager.localeIdentifier}return e}function getSettingsInfo(){if(_reactNative.Platform.OS==="ios"){try{const e=_reactNative.NativeModules.SettingsManager?.getConstants?.();return{userDefaults:e?.settings??{}}}catch{return{}}}return{}}function getUniqueIdentifiers(){const e={};if(_reactNative.Platform.OS==="android"){const t=_reactNative.Platform.constants;e.serial=t.Serial;e.fingerprint=t.Fingerprint;try{const a=_reactNative.NativeModules.PlatformConstants;if(a?.getAndroidID){e.androidId=a.getAndroidID()}}catch{}}return e}function generateFingerprint(e){const t=[e.platform.os,e.platform.version,e.display.window.width,e.display.window.height,e.display.pixelRatio,e.platform.interfaceIdiom??"",e.platform.forceTouchAvailable??false,e.display.isIPhoneNotched??false,e.platform.model??"",e.platform.brand??"",e.platform.manufacturer??"",e.platform.uiMode??""];const a=t.join("|");let n=0;for(let l=0;l<a.length;l++){const d=a.charCodeAt(l);n=(n<<5)-n+d;n=n&n}return Math.abs(n).toString(16).padStart(8,"0")}function useDeviceInfo(){const[e,t]=(0,_react.useState)(true);const[a,n]=(0,_react.useState)(getPlatformInfo());const[l,d]=(0,_react.useState)(getDisplayInfo());const[f,c]=(0,_react.useState)({isScreenReaderEnabled:false,isReduceMotionEnabled:false,isReduceTransparencyEnabled:false});const[u,h]=(0,_react.useState)(()=>{const o=_reactNative.Appearance.getColorScheme()??null;return{colorScheme:o,prefersDarkMode:o==="dark"}});const[S,P]=(0,_react.useState)(getLocaleInfo());const[p,v]=(0,_react.useState)({height:null,isVisible:true});const[m,b]=(0,_react.useState)({isVisible:false,height:0,animationDuration:0});const[y,T]=(0,_react.useState)({currentState:_reactNative.AppState.currentState,isActive:_reactNative.AppState.currentState==="active"});const[I,D]=(0,_react.useState)(getUniqueIdentifiers());const[E,C]=(0,_react.useState)(getSettingsInfo());const[A,O]=(0,_react.useState)(Date.now());const g=(0,_react.useCallback)(async()=>{t(true);const[o,s]=await Promise.all([getAccessibilitySettings(),getStatusBarHeight()]);n(getPlatformInfo());d(getDisplayInfo());c(o);const i=_reactNative.Appearance.getColorScheme()??null;h({colorScheme:i,prefersDarkMode:i==="dark"});P(getLocaleInfo());v(r=>({...r,height:s}));D(getUniqueIdentifiers());C(getSettingsInfo());O(Date.now());t(false)},[]);(0,_react.useEffect)(()=>{g()},[g]);(0,_react.useEffect)(()=>{const o=_reactNative.Dimensions.addEventListener("change",({window:s,screen:i})=>{d(r=>({...r,window:{width:s.width,height:s.height,scale:s.scale,fontScale:s.fontScale},screen:{width:i.width,height:i.height,scale:i.scale,fontScale:i.fontScale},isLandscape:s.width>s.height,isPortrait:s.height>s.width}))});return()=>o.remove()},[]);(0,_react.useEffect)(()=>{const o=_reactNative.Appearance.addChangeListener(({colorScheme:s})=>{const i=s??null;h({colorScheme:i,prefersDarkMode:i==="dark"})});return()=>o.remove()},[]);(0,_react.useEffect)(()=>{const o=_reactNative.Keyboard.addListener(_reactNative.Platform.OS==="ios"?"keyboardWillShow":"keyboardDidShow",i=>{b({isVisible:true,height:i.endCoordinates.height,animationDuration:i.duration??0})});const s=_reactNative.Keyboard.addListener(_reactNative.Platform.OS==="ios"?"keyboardWillHide":"keyboardDidHide",i=>{b({isVisible:false,height:0,animationDuration:i.duration??0})});return()=>{o.remove();s.remove()}},[]);(0,_react.useEffect)(()=>{const o=(0,_realAppState.subscribeRealAppState)(s=>{T({currentState:s,isActive:s==="active"})});return()=>o.remove()},[]);(0,_react.useEffect)(()=>{const o=[_reactNative.AccessibilityInfo.addEventListener("screenReaderChanged",s=>{c(i=>({...i,isScreenReaderEnabled:s}))}),_reactNative.AccessibilityInfo.addEventListener("reduceMotionChanged",s=>{c(i=>({...i,isReduceMotionEnabled:s}))}),_reactNative.AccessibilityInfo.addEventListener("reduceTransparencyChanged",s=>{c(i=>({...i,isReduceTransparencyEnabled:s}))})];if(_reactNative.Platform.OS==="ios"){const s=(i,r)=>{return _reactNative.AccessibilityInfo.addEventListener(i,r)};o.push(s("boldTextChanged",i=>{c(r=>({...r,isBoldTextEnabled:i}))}),s("grayscaleChanged",i=>{c(r=>({...r,isGrayscaleEnabled:i}))}),s("invertColorsChanged",i=>{c(r=>({...r,isInvertColorsEnabled:i}))}))}return()=>{o.forEach(s=>s.remove())}},[]);const L={platform:a,display:l,accessibility:f,appearance:u,locale:S,statusBar:p,keyboard:m,appState:y,identifiers:I,settings:E,timestamp:A,isLoading:e,refresh:g,generateFingerprint:()=>generateFingerprint({platform:a,display:l,accessibility:f,appearance:u,locale:S,statusBar:p,keyboard:m,appState:y,identifiers:I,settings:E,timestamp:A,isLoading:e})};return L}async function getDeviceInfo(){const[e,t]=await Promise.all([getAccessibilitySettings(),getStatusBarHeight()]);const a=_reactNative.Appearance.getColorScheme()??null;return{platform:getPlatformInfo(),display:getDisplayInfo(),accessibility:e,appearance:{colorScheme:a,prefersDarkMode:a==="dark"},locale:getLocaleInfo(),statusBar:{height:t,isVisible:true},keyboard:{isVisible:false,height:0,animationDuration:0},appState:{currentState:_reactNative.AppState.currentState,isActive:_reactNative.AppState.currentState==="active"},identifiers:getUniqueIdentifiers(),settings:getSettingsInfo(),timestamp:Date.now(),isLoading:false}}function logDeviceInfo(e){console.log("\n========================================");console.log(" DEVICE INFO REPORT");console.log("========================================\n");console.log("--- PLATFORM ---");console.log(JSON.stringify(e.platform,null,2));console.log("\n--- DISPLAY ---");console.log(JSON.stringify(e.display,null,2));console.log("\n--- ACCESSIBILITY ---");console.log(JSON.stringify(e.accessibility,null,2));console.log("\n--- APPEARANCE ---");console.log(JSON.stringify(e.appearance,null,2));console.log("\n--- LOCALE ---");console.log(JSON.stringify(e.locale,null,2));console.log("\n--- STATUS BAR ---");console.log(JSON.stringify(e.statusBar,null,2));console.log("\n--- KEYBOARD ---");console.log(JSON.stringify(e.keyboard,null,2));console.log("\n--- APP STATE ---");console.log(JSON.stringify(e.appState,null,2));console.log("\n--- IDENTIFIERS ---");console.log(JSON.stringify(e.identifiers,null,2));console.log("\n--- SETTINGS ---");const t=Object.keys(e.settings.userDefaults??{});console.log(`userDefaults: ${t.length} keys`);if(t.length>0&&t.length<=20){console.log(JSON.stringify(e.settings,null,2))}console.log("\n--- METADATA ---");console.log(`timestamp: ${e.timestamp}`);console.log(`isLoading: ${e.isLoading}`);console.log("\n========================================\n")}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getDeviceInfo=getDeviceInfo;exports.logDeviceInfo=logDeviceInfo;exports.useDeviceInfo=useDeviceInfo;var _react=require("react");var _reactNative=require("react-native");var _realAppState=require("../utils/realAppState.js");async function getAccessibilitySettings(){const[e,t,a]=await Promise.all([_reactNative.AccessibilityInfo.isScreenReaderEnabled(),_reactNative.AccessibilityInfo.isReduceMotionEnabled(),_reactNative.AccessibilityInfo.isReduceTransparencyEnabled()]);const o={isScreenReaderEnabled:e,isReduceMotionEnabled:t,isReduceTransparencyEnabled:a};if(_reactNative.Platform.OS==="ios"){const[l,d,u,c,f]=await Promise.all([_reactNative.AccessibilityInfo.isBoldTextEnabled?.()??Promise.resolve(false),_reactNative.AccessibilityInfo.isGrayscaleEnabled?.()??Promise.resolve(false),_reactNative.AccessibilityInfo.isInvertColorsEnabled?.()??Promise.resolve(false),_reactNative.AccessibilityInfo.isDarkerSystemColorsEnabled?.()??Promise.resolve(false),_reactNative.AccessibilityInfo.prefersCrossFadeTransitions?.()??Promise.resolve(false)]);o.isBoldTextEnabled=l;o.isGrayscaleEnabled=d;o.isInvertColorsEnabled=u;o.isDarkerSystemColorsEnabled=c;o.prefersCrossFadeTransitions=f}if(_reactNative.Platform.OS==="android"){const l=await _reactNative.AccessibilityInfo.isHighTextContrastEnabled?.()??false;o.isHighTextContrastEnabled=l}return o}function getPlatformInfo(){const e=_reactNative.Platform.constants;const t={os:_reactNative.Platform.OS,version:_reactNative.Platform.Version,reactNativeVersion:e.reactNativeVersion,isTesting:_reactNative.Platform.isTesting??false,isDisableAnimations:e.isDisableAnimations??false};if(_reactNative.Platform.OS==="ios"){return{...t,osVersion:e.osVersion,systemName:e.systemName,interfaceIdiom:e.interfaceIdiom,isPad:_reactNative.Platform.isPad,isTV:_reactNative.Platform.isTV,isVision:_reactNative.Platform.isVision??false,isMacCatalyst:_reactNative.Platform.isMacCatalyst??false,forceTouchAvailable:e.forceTouchAvailable}}if(_reactNative.Platform.OS==="android"){return{...t,apiLevel:e.Version,release:e.Release,brand:e.Brand,manufacturer:e.Manufacturer,model:e.Model,fingerprint:e.Fingerprint,serial:e.Serial,uiMode:e.uiMode}}return t}function getDisplayInfo(){const e=_reactNative.Dimensions.get("window");const t=_reactNative.Dimensions.get("screen");const a={window:{width:e.width,height:e.height,scale:e.scale,fontScale:e.fontScale},screen:{width:t.width,height:t.height,scale:t.scale,fontScale:t.fontScale},pixelRatio:_reactNative.PixelRatio.get(),fontScale:_reactNative.PixelRatio.getFontScale(),isLandscape:e.width>e.height,isPortrait:e.height>e.width};if(_reactNative.Platform.OS==="ios"){try{const o=_reactNative.NativeModules.DeviceInfo?.getConstants?.();a.isIPhoneNotched=o?.isIPhoneX_deprecated??false}catch{a.isIPhoneNotched=false}}if(_reactNative.Platform.OS==="android"){try{const o=_reactNative.NativeModules.DeviceInfo?.getConstants?.();a.isEdgeToEdge=o?.isEdgeToEdge??false;a.densityDpi=Math.round(e.scale*160)}catch{}}return a}async function getStatusBarHeight(){return new Promise(e=>{let t=false;if(_reactNative.Platform.OS==="ios"){_reactNative.NativeModules.StatusBarManager?.getHeight?.(a=>{if(!t){t=true;e(a?.height??null)}})??e(null)}else if(_reactNative.Platform.OS==="android"){t=true;e(_reactNative.StatusBar.currentHeight??null)}else{t=true;e(null)}setTimeout(()=>{if(!t){t=true;e(null)}},100)})}function getLocaleInfo(){const e={isRTL:_reactNative.I18nManager.isRTL,doLeftAndRightSwapInRTL:_reactNative.I18nManager.doLeftAndRightSwapInRTL};if(_reactNative.Platform.OS==="android"){e.localeIdentifier=_reactNative.I18nManager.localeIdentifier}return e}function getSettingsInfo(){if(_reactNative.Platform.OS==="ios"){try{const e=_reactNative.NativeModules.SettingsManager?.getConstants?.();return{userDefaults:e?.settings??{}}}catch{return{}}}return{}}function getUniqueIdentifiers(){const e={};if(_reactNative.Platform.OS==="android"){const t=_reactNative.Platform.constants;e.serial=t.Serial;e.fingerprint=t.Fingerprint;try{const a=_reactNative.NativeModules.PlatformConstants;if(a?.getAndroidID){e.androidId=a.getAndroidID()}}catch{}}return e}function generateFingerprint(e){const t=[e.platform.os,e.platform.version,e.display.window.width,e.display.window.height,e.display.pixelRatio,e.platform.interfaceIdiom??"",e.platform.forceTouchAvailable??false,e.display.isIPhoneNotched??false,e.platform.model??"",e.platform.brand??"",e.platform.manufacturer??"",e.platform.uiMode??""];const a=t.join("|");let o=0;for(let l=0;l<a.length;l++){const d=a.charCodeAt(l);o=(o<<5)-o+d;o=o&o}return Math.abs(o).toString(16).padStart(8,"0")}function useDeviceInfo(){const[e,t]=(0,_react.useState)(true);const[a,o]=(0,_react.useState)(getPlatformInfo());const[l,d]=(0,_react.useState)(getDisplayInfo());const[u,c]=(0,_react.useState)({isScreenReaderEnabled:false,isReduceMotionEnabled:false,isReduceTransparencyEnabled:false});const[f,h]=(0,_react.useState)(()=>{const n=_reactNative.Appearance.getColorScheme()??null;return{colorScheme:n,prefersDarkMode:n==="dark"}});const[S,P]=(0,_react.useState)(getLocaleInfo());const[y,v]=(0,_react.useState)({height:null,isVisible:true});const[p,m]=(0,_react.useState)({isVisible:false,height:0,animationDuration:0});const[b,B]=(0,_react.useState)({currentState:_reactNative.AppState.currentState,isActive:_reactNative.AppState.currentState==="active"});const[I,T]=(0,_react.useState)(getUniqueIdentifiers());const[E,D]=(0,_react.useState)(getSettingsInfo());const[A,C]=(0,_react.useState)(Date.now());const g=(0,_react.useCallback)(async()=>{t(true);const[n,s]=await Promise.all([getAccessibilitySettings(),getStatusBarHeight()]);o(getPlatformInfo());d(getDisplayInfo());c(n);const i=_reactNative.Appearance.getColorScheme()??null;h({colorScheme:i,prefersDarkMode:i==="dark"});P(getLocaleInfo());v(r=>({...r,height:s}));T(getUniqueIdentifiers());D(getSettingsInfo());C(Date.now());t(false)},[]);(0,_react.useEffect)(()=>{g()},[g]);(0,_react.useEffect)(()=>{const n=_reactNative.Dimensions.addEventListener("change",({window:s,screen:i})=>{d(r=>({...r,window:{width:s.width,height:s.height,scale:s.scale,fontScale:s.fontScale},screen:{width:i.width,height:i.height,scale:i.scale,fontScale:i.fontScale},isLandscape:s.width>s.height,isPortrait:s.height>s.width}))});return()=>n.remove()},[]);(0,_react.useEffect)(()=>{const n=_reactNative.Appearance.addChangeListener(({colorScheme:s})=>{const i=s??null;h({colorScheme:i,prefersDarkMode:i==="dark"})});return()=>n.remove()},[]);(0,_react.useEffect)(()=>{const n=_reactNative.Keyboard.addListener(_reactNative.Platform.OS==="ios"?"keyboardWillShow":"keyboardDidShow",i=>{m({isVisible:true,height:i.endCoordinates.height,animationDuration:i.duration??0})});const s=_reactNative.Keyboard.addListener(_reactNative.Platform.OS==="ios"?"keyboardWillHide":"keyboardDidHide",i=>{m({isVisible:false,height:0,animationDuration:i.duration??0})});return()=>{n.remove();s.remove()}},[]);(0,_react.useEffect)(()=>{const n=(0,_realAppState.subscribeRealAppState)(s=>{B({currentState:s,isActive:s==="active"})});return()=>n.remove()},[]);(0,_react.useEffect)(()=>{const n=[_reactNative.AccessibilityInfo.addEventListener("screenReaderChanged",s=>{c(i=>({...i,isScreenReaderEnabled:s}))}),_reactNative.AccessibilityInfo.addEventListener("reduceMotionChanged",s=>{c(i=>({...i,isReduceMotionEnabled:s}))}),_reactNative.AccessibilityInfo.addEventListener("reduceTransparencyChanged",s=>{c(i=>({...i,isReduceTransparencyEnabled:s}))})];if(_reactNative.Platform.OS==="ios"){const s=(i,r)=>{return _reactNative.AccessibilityInfo.addEventListener(i,r)};n.push(s("boldTextChanged",i=>{c(r=>({...r,isBoldTextEnabled:i}))}),s("grayscaleChanged",i=>{c(r=>({...r,isGrayscaleEnabled:i}))}),s("invertColorsChanged",i=>{c(r=>({...r,isInvertColorsEnabled:i}))}))}return()=>{n.forEach(s=>s.remove())}},[]);const O={platform:a,display:l,accessibility:u,appearance:f,locale:S,statusBar:y,keyboard:p,appState:b,identifiers:I,settings:E,timestamp:A,isLoading:e,refresh:g,generateFingerprint:()=>generateFingerprint({platform:a,display:l,accessibility:u,appearance:f,locale:S,statusBar:y,keyboard:p,appState:b,identifiers:I,settings:E,timestamp:A,isLoading:e})};return O}async function getDeviceInfo(){const[e,t]=await Promise.all([getAccessibilitySettings(),getStatusBarHeight()]);const a=_reactNative.Appearance.getColorScheme()??null;return{platform:getPlatformInfo(),display:getDisplayInfo(),accessibility:e,appearance:{colorScheme:a,prefersDarkMode:a==="dark"},locale:getLocaleInfo(),statusBar:{height:t,isVisible:true},keyboard:{isVisible:false,height:0,animationDuration:0},appState:{currentState:_reactNative.AppState.currentState,isActive:_reactNative.AppState.currentState==="active"},identifiers:getUniqueIdentifiers(),settings:getSettingsInfo(),timestamp:Date.now(),isLoading:false}}function logDeviceInfo(e){console.log("[Buoy]","\n========================================");console.log("[Buoy]"," DEVICE INFO REPORT");console.log("[Buoy]","========================================\n");console.log("[Buoy]","--- PLATFORM ---");console.log("[Buoy]",JSON.stringify(e.platform,null,2));console.log("[Buoy]","\n--- DISPLAY ---");console.log("[Buoy]",JSON.stringify(e.display,null,2));console.log("[Buoy]","\n--- ACCESSIBILITY ---");console.log("[Buoy]",JSON.stringify(e.accessibility,null,2));console.log("[Buoy]","\n--- APPEARANCE ---");console.log("[Buoy]",JSON.stringify(e.appearance,null,2));console.log("[Buoy]","\n--- LOCALE ---");console.log("[Buoy]",JSON.stringify(e.locale,null,2));console.log("[Buoy]","\n--- STATUS BAR ---");console.log("[Buoy]",JSON.stringify(e.statusBar,null,2));console.log("[Buoy]","\n--- KEYBOARD ---");console.log("[Buoy]",JSON.stringify(e.keyboard,null,2));console.log("[Buoy]","\n--- APP STATE ---");console.log("[Buoy]",JSON.stringify(e.appState,null,2));console.log("[Buoy]","\n--- IDENTIFIERS ---");console.log("[Buoy]",JSON.stringify(e.identifiers,null,2));console.log("[Buoy]","\n--- SETTINGS ---");const t=Object.keys(e.settings.userDefaults??{});console.log("[Buoy]",`userDefaults: ${t.length} keys`);if(t.length>0&&t.length<=20){console.log("[Buoy]",JSON.stringify(e.settings,null,2))}console.log("[Buoy]","\n--- METADATA ---");console.log("[Buoy]",`timestamp: ${e.timestamp}`);console.log("[Buoy]",`isLoading: ${e.isLoading}`);console.log("[Buoy]","\n========================================\n")}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AccountSetup=AccountSetup;var _react=require("react");var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AccountSetup=AccountSetup;var _react=require("react");var _portalHostWeb=require("../ui/floating/portalHost.web.js");var _AccountSetupContent=require("./AccountSetupContent.js");var _nightTheme=require("../ui/night/nightTheme.js");var _jsxRuntime=require("react/jsx-runtime");function AccountSetup(){const[n,r]=(0,_react.useState)(false);const o=(0,_react.useRef)(null);const a=(0,_react.useRef)(null);const u=(0,_react.useId)();const c=(e=true)=>{r(false);if(e)o.current?.querySelector('[data-account-launcher] [role="button"]')?.focus({preventScroll:true})};(0,_react.useEffect)(()=>{if(!n)return;a.current?.focus({preventScroll:true});const e=t=>{if(t.target instanceof Node&&!o.current?.contains(t.target))r(false)};const s=t=>{if(t.key!=="Escape")return;t.preventDefault();t.stopPropagation();r(false);o.current?.querySelector('[data-account-launcher] [role="button"]')?.focus({preventScroll:true})};document.addEventListener("pointerdown",e);document.addEventListener("keydown",s);return()=>{document.removeEventListener("pointerdown",e);document.removeEventListener("keydown",s)}},[n]);if(typeof document==="undefined")return null;return(0,_jsxRuntime.jsx)(_portalHostWeb.BuoyPortal,{children:(0,_jsxRuntime.jsxs)("div",{ref:o,"data-buoy-account":"",style:{position:"fixed",right:"max(16px, env(safe-area-inset-right))",bottom:"max(20px, env(safe-area-inset-bottom))",zIndex:99999,colorScheme:"dark",fontFamily:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"},children:[(0,_jsxRuntime.jsx)("style",{children:`
|
|
2
2
|
[data-buoy-account] { font-size: 14px; line-height: 1.5; text-align: left; }
|
|
3
3
|
[data-buoy-account] [role="button"], [data-buoy-account] [role="link"] { cursor: pointer; }
|
|
4
4
|
[data-buoy-account] [role="button"]:focus-visible, [data-buoy-account] [role="link"]:focus-visible { outline: 2px solid ${_nightTheme.night.color.accent}; outline-offset: 3px; }
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
box-shadow: 0 18px 60px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.2);
|
|
12
12
|
outline: none;
|
|
13
13
|
}
|
|
14
|
-
`}),(0,_jsxRuntime.jsx)("div",{"data-account-launcher":"",children:(0,_jsxRuntime.jsx)(_AccountSetupContent.AccountSetupButton,{expanded:n,onPress:()=>r(e=>!e)})}),n&&(0,_jsxRuntime.jsx)("section",{ref:a,className:"buoy-account-panel",role:"dialog","aria-labelledby":
|
|
14
|
+
`}),(0,_jsxRuntime.jsx)("div",{"data-account-launcher":"",children:(0,_jsxRuntime.jsx)(_AccountSetupContent.AccountSetupButton,{expanded:n,onPress:()=>r(e=>!e)})}),n&&(0,_jsxRuntime.jsx)("section",{ref:a,className:"buoy-account-panel",role:"dialog","aria-labelledby":u,tabIndex:-1,onBlur:e=>{if(e.relatedTarget instanceof Node&&!o.current?.contains(e.relatedTarget))c(false)},children:(0,_jsxRuntime.jsx)(_AccountSetupContent.AccountSetupCard,{titleId:u,onClose:()=>c()})})]})})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BubbleSettingsDetail=BubbleSettingsDetail;exports.BubbleSettingsSection=BubbleSettingsSection;exports.getBubbleVisibilitySettings=getBubbleVisibilitySettings;var _reactNative=require("react-native");var _index=require("../../icons/index.js");var _react=require("react");var _CyberpunkSectionButton=require("../../ui/console/CyberpunkSectionButton.js");var _devToolsStorageKeys=require("../../storage/devToolsStorageKeys.js");var _persistentStorage=require("../../utils/persistentStorage");var _macOSDesignSystemColors=require("../../ui/gameUI/constants/macOSDesignSystemColors.js");var _gameUIColors=require("../../ui/gameUI/constants/gameUIColors.js");var _jsxRuntime=require("react/jsx-runtime");const STORAGE_KEY=_devToolsStorageKeys.devToolsStorageKeys.bubble.settings();const USER_PREFERENCES_KEY=_devToolsStorageKeys.devToolsStorageKeys.bubble.userPreferences();const DEFAULT_SETTINGS={showEnvironment:true,showQueryButton:true,showWifiToggle:true,showEnvButton:false,showSentryButton:false,showStorageButton:false};function BubbleSettingsSection({onPress:t}){const[o,n]=(0,_react.useState)(DEFAULT_SETTINGS);(0,_react.useEffect)(()=>{s()},[]);const s=async()=>{try{const r=await _persistentStorage.persistentStorage.getItem(STORAGE_KEY);if(r){n(JSON.parse(r))}}catch(r){console.error("Failed to load bubble settings:",r)}};const a=()=>{return Object.values(o).filter(Boolean).length};return(0,_jsxRuntime.jsx)(_CyberpunkSectionButton.CyberpunkSectionButton,{id:"bubble-settings",title:"SETTINGS",subtitle:`${a()}/6 visible`,icon:_index.Settings,iconColor:"#10B981",iconBackgroundColor:"rgba(16, 185, 129, 0.1)",onPress:t||(()=>{}),index:5})}function BubbleSettingsDetail({onSettingsChange:t}){const[o,n]=(0,_react.useState)(DEFAULT_SETTINGS);const[s,a]=(0,_react.useState)(true);(0,_react.useEffect)(()=>{r()},[]);const r=async()=>{try{const e=await _persistentStorage.persistentStorage.getItem(STORAGE_KEY);if(e){n(JSON.parse(e))}}catch(e){console.error("Failed to load bubble settings:",e)}finally{a(false)}};const c=async e=>{try{await _persistentStorage.persistentStorage.setItem(STORAGE_KEY,JSON.stringify(e));n(e);t?.(e)}catch(l){console.error("Failed to save bubble settings:",l)}};const d=async e=>{const l={...o,[e]:!o[e]};try{const i=await _persistentStorage.persistentStorage.getItem(USER_PREFERENCES_KEY);const u=i?JSON.parse(i):{};const b=e.replace("show","hasSet");const y={...u,[b]:true};await _persistentStorage.persistentStorage.setItem(USER_PREFERENCES_KEY,JSON.stringify(y))}catch(i){console.error("Failed to save user preference marker:",i)}c(l)};if(s){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.detailContainer,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.loadingText,children:"Loading settings..."})})}const g=[{key:"showEnvironment",label:"Environment Indicator",description:"Shows current environment (dev, staging, prod)",icon:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.indicator,{backgroundColor:"#10B981"}]})},{key:"showQueryButton",label:"React Query Button",description:"Opens React Query dev tools",icon:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.indicator,{backgroundColor:"#F59E0B"}]})},{key:"showWifiToggle",label:"WiFi",description:"Toggle WiFi for testing offline scenarios",icon:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.indicator,{backgroundColor:"#8B5CF6"}]})},{key:"showEnvButton",label:"Environment Variables",description:"View and check environment variables",icon:(0,_jsxRuntime.jsx)(_index.Settings,{size:16,color:"#10B981"})},{key:"showSentryButton",label:"Sentry Events",description:"View captured Sentry events and errors",icon:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.indicator,{backgroundColor:"#a855f7"}]})},{key:"showStorageButton",label:"Storage Browser",description:"Browse and inspect AsyncStorage data",icon:(0,_jsxRuntime.jsx)(_index.Database,{size:16,color:"#3B82F6"})}];return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.detailContainer,children:(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{showsVerticalScrollIndicator:false,contentContainerStyle:styles.scrollContent,"sentry-label":"ignore bubble settings scroll",children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.header,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.headerTitle,children:"Developer Tools Settings"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.headerDescription,children:"Configure bubble button visibility"})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.sectionDivider,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"Bubble Button Visibility"})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.settingsList,children:g.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingItem,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.settingIconContainer,children:e.icon}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingContent,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingLabel,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingDescription,children:e.description})]}),(0,_jsxRuntime.jsx)(_reactNative.Switch,{"sentry-label":"ignore bubble settings section",value:o[e.key],onValueChange:()=>d(e.key),trackColor:{false:"#4B5563",true:"#10B981"},thumbColor:o[e.key]?"#fff":_gameUIColors.buoyColors.textSecondary})]},e.key))}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.footer,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.noteContainer,children:[(0,_jsxRuntime.jsx)(_index.EyeOff,{size:16,color:_gameUIColors.buoyColors.textSecondary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noteText,children:"User status indicator is always visible and cannot be disabled"})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.restartNote,children:"Changes are saved automatically and will persist across app restarts"})]})]})})}async function getBubbleVisibilitySettings(){try{const t=await _persistentStorage.persistentStorage.getItem(STORAGE_KEY);if(t){return JSON.parse(t)}}catch(t){console.error("Failed to load bubble settings:",t)}return DEFAULT_SETTINGS}const styles=_reactNative.StyleSheet.create({scrollContent:{flexGrow:1},sectionCard:{backgroundColor:_gameUIColors.buoyColors.input,borderRadius:8,padding:16,flexDirection:"row",alignItems:"center",marginBottom:12},iconContainer:{width:36,height:36,borderRadius:8,backgroundColor:"rgba(16, 185, 129, 0.1)",justifyContent:"center",alignItems:"center",marginRight:12},textContainer:{flex:1},title:{color:_gameUIColors.buoyColors.text,fontSize:14,fontWeight:"600",marginBottom:2},subtitle:{color:_gameUIColors.buoyColors.textSecondary,fontSize:12},chevron:{color:_macOSDesignSystemColors.macOSColors.text.icon,fontSize:20},detailContainer:{flex:1,backgroundColor:_gameUIColors.buoyColors.card},loadingText:{color:_gameUIColors.buoyColors.textSecondary,fontSize:14,textAlign:"center",marginTop:20},header:{padding:16,borderBottomWidth:1,borderBottomColor:"rgba(128, 128, 128, 0.2)"},headerTitle:{color:_gameUIColors.buoyColors.text,fontSize:16,fontWeight:"600",marginBottom:4},headerDescription:{color:_gameUIColors.buoyColors.textSecondary,fontSize:12},settingsList:{padding:16},settingItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,borderBottomWidth:1,borderBottomColor:"rgba(128, 128, 128, 0.1)"},settingIconContainer:{width:32,height:32,justifyContent:"center",alignItems:"center",marginRight:12},settingContent:{flex:1,marginRight:12},settingLabel:{color:_gameUIColors.buoyColors.text,fontSize:14,fontWeight:"500",marginBottom:2},settingDescription:{color:_macOSDesignSystemColors.macOSColors.text.icon,fontSize:11},indicator:{width:8,height:8,borderRadius:4},footer:{padding:16,borderTopWidth:1,borderTopColor:"rgba(128, 128, 128, 0.2)"},noteContainer:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:8},noteText:{color:_gameUIColors.buoyColors.textSecondary,fontSize:12,flex:1},restartNote:{color:_macOSDesignSystemColors.macOSColors.text.icon,fontSize:11,fontStyle:"italic"},sectionDivider:{paddingHorizontal:16,paddingVertical:8,marginTop:8,borderTopWidth:1,borderTopColor:"rgba(128, 128, 128, 0.12)"},sectionTitle:{color:_gameUIColors.buoyColors.textSecondary,fontSize:12,fontWeight:"600",letterSpacing:.5,textTransform:"uppercase"}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.BubbleSettingsDetail=BubbleSettingsDetail;exports.BubbleSettingsSection=BubbleSettingsSection;exports.getBubbleVisibilitySettings=getBubbleVisibilitySettings;var _reactNative=require("react-native");var _index=require("../../icons/index.js");var _react=require("react");var _CyberpunkSectionButton=require("../../ui/console/CyberpunkSectionButton.js");var _devToolsStorageKeys=require("../../storage/devToolsStorageKeys.js");var _persistentStorage=require("../../utils/persistentStorage");var _macOSDesignSystemColors=require("../../ui/gameUI/constants/macOSDesignSystemColors.js");var _gameUIColors=require("../../ui/gameUI/constants/gameUIColors.js");var _jsxRuntime=require("react/jsx-runtime");const STORAGE_KEY=_devToolsStorageKeys.devToolsStorageKeys.bubble.settings();const USER_PREFERENCES_KEY=_devToolsStorageKeys.devToolsStorageKeys.bubble.userPreferences();const DEFAULT_SETTINGS={showEnvironment:true,showQueryButton:true,showWifiToggle:true,showEnvButton:false,showSentryButton:false,showStorageButton:false};function BubbleSettingsSection({onPress:t}){const[o,n]=(0,_react.useState)(DEFAULT_SETTINGS);(0,_react.useEffect)(()=>{s()},[]);const s=async()=>{try{const r=await _persistentStorage.persistentStorage.getItem(STORAGE_KEY);if(r){n(JSON.parse(r))}}catch(r){console.error("[Buoy]","Failed to load bubble settings:",r)}};const a=()=>{return Object.values(o).filter(Boolean).length};return(0,_jsxRuntime.jsx)(_CyberpunkSectionButton.CyberpunkSectionButton,{id:"bubble-settings",title:"SETTINGS",subtitle:`${a()}/6 visible`,icon:_index.Settings,iconColor:"#10B981",iconBackgroundColor:"rgba(16, 185, 129, 0.1)",onPress:t||(()=>{}),index:5})}function BubbleSettingsDetail({onSettingsChange:t}){const[o,n]=(0,_react.useState)(DEFAULT_SETTINGS);const[s,a]=(0,_react.useState)(true);(0,_react.useEffect)(()=>{r()},[]);const r=async()=>{try{const e=await _persistentStorage.persistentStorage.getItem(STORAGE_KEY);if(e){n(JSON.parse(e))}}catch(e){console.error("[Buoy]","Failed to load bubble settings:",e)}finally{a(false)}};const c=async e=>{try{await _persistentStorage.persistentStorage.setItem(STORAGE_KEY,JSON.stringify(e));n(e);t?.(e)}catch(l){console.error("[Buoy]","Failed to save bubble settings:",l)}};const d=async e=>{const l={...o,[e]:!o[e]};try{const i=await _persistentStorage.persistentStorage.getItem(USER_PREFERENCES_KEY);const u=i?JSON.parse(i):{};const b=e.replace("show","hasSet");const y={...u,[b]:true};await _persistentStorage.persistentStorage.setItem(USER_PREFERENCES_KEY,JSON.stringify(y))}catch(i){console.error("[Buoy]","Failed to save user preference marker:",i)}c(l)};if(s){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.detailContainer,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.loadingText,children:"Loading settings..."})})}const g=[{key:"showEnvironment",label:"Environment Indicator",description:"Shows current environment (dev, staging, prod)",icon:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.indicator,{backgroundColor:"#10B981"}]})},{key:"showQueryButton",label:"React Query Button",description:"Opens React Query dev tools",icon:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.indicator,{backgroundColor:"#F59E0B"}]})},{key:"showWifiToggle",label:"WiFi",description:"Toggle WiFi for testing offline scenarios",icon:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.indicator,{backgroundColor:"#8B5CF6"}]})},{key:"showEnvButton",label:"Environment Variables",description:"View and check environment variables",icon:(0,_jsxRuntime.jsx)(_index.Settings,{size:16,color:"#10B981"})},{key:"showSentryButton",label:"Sentry Events",description:"View captured Sentry events and errors",icon:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.indicator,{backgroundColor:"#a855f7"}]})},{key:"showStorageButton",label:"Storage Browser",description:"Browse and inspect AsyncStorage data",icon:(0,_jsxRuntime.jsx)(_index.Database,{size:16,color:"#3B82F6"})}];return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.detailContainer,children:(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{showsVerticalScrollIndicator:false,contentContainerStyle:styles.scrollContent,"sentry-label":"ignore bubble settings scroll",children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.header,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.headerTitle,children:"Developer Tools Settings"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.headerDescription,children:"Configure bubble button visibility"})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.sectionDivider,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"Bubble Button Visibility"})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.settingsList,children:g.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingItem,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.settingIconContainer,children:e.icon}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.settingContent,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingLabel,children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.settingDescription,children:e.description})]}),(0,_jsxRuntime.jsx)(_reactNative.Switch,{"sentry-label":"ignore bubble settings section",value:o[e.key],onValueChange:()=>d(e.key),trackColor:{false:"#4B5563",true:"#10B981"},thumbColor:o[e.key]?"#fff":_gameUIColors.buoyColors.textSecondary})]},e.key))}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.footer,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.noteContainer,children:[(0,_jsxRuntime.jsx)(_index.EyeOff,{size:16,color:_gameUIColors.buoyColors.textSecondary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noteText,children:"User status indicator is always visible and cannot be disabled"})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.restartNote,children:"Changes are saved automatically and will persist across app restarts"})]})]})})}async function getBubbleVisibilitySettings(){try{const t=await _persistentStorage.persistentStorage.getItem(STORAGE_KEY);if(t){return JSON.parse(t)}}catch(t){console.error("[Buoy]","Failed to load bubble settings:",t)}return DEFAULT_SETTINGS}const styles=_reactNative.StyleSheet.create({scrollContent:{flexGrow:1},sectionCard:{backgroundColor:_gameUIColors.buoyColors.input,borderRadius:8,padding:16,flexDirection:"row",alignItems:"center",marginBottom:12},iconContainer:{width:36,height:36,borderRadius:8,backgroundColor:"rgba(16, 185, 129, 0.1)",justifyContent:"center",alignItems:"center",marginRight:12},textContainer:{flex:1},title:{color:_gameUIColors.buoyColors.text,fontSize:14,fontWeight:"600",marginBottom:2},subtitle:{color:_gameUIColors.buoyColors.textSecondary,fontSize:12},chevron:{color:_macOSDesignSystemColors.macOSColors.text.icon,fontSize:20},detailContainer:{flex:1,backgroundColor:_gameUIColors.buoyColors.card},loadingText:{color:_gameUIColors.buoyColors.textSecondary,fontSize:14,textAlign:"center",marginTop:20},header:{padding:16,borderBottomWidth:1,borderBottomColor:"rgba(128, 128, 128, 0.2)"},headerTitle:{color:_gameUIColors.buoyColors.text,fontSize:16,fontWeight:"600",marginBottom:4},headerDescription:{color:_gameUIColors.buoyColors.textSecondary,fontSize:12},settingsList:{padding:16},settingItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,borderBottomWidth:1,borderBottomColor:"rgba(128, 128, 128, 0.1)"},settingIconContainer:{width:32,height:32,justifyContent:"center",alignItems:"center",marginRight:12},settingContent:{flex:1,marginRight:12},settingLabel:{color:_gameUIColors.buoyColors.text,fontSize:14,fontWeight:"500",marginBottom:2},settingDescription:{color:_macOSDesignSystemColors.macOSColors.text.icon,fontSize:11},indicator:{width:8,height:8,borderRadius:4},footer:{padding:16,borderTopWidth:1,borderTopColor:"rgba(128, 128, 128, 0.2)"},noteContainer:{flexDirection:"row",alignItems:"center",gap:8,marginBottom:8},noteText:{color:_gameUIColors.buoyColors.textSecondary,fontSize:12,flex:1},restartNote:{color:_macOSDesignSystemColors.macOSColors.text.icon,fontSize:11,fontStyle:"italic"},sectionDivider:{paddingHorizontal:16,paddingVertical:8,marginTop:8,borderTopWidth:1,borderTopColor:"rgba(128, 128, 128, 0.12)"},sectionTitle:{color:_gameUIColors.buoyColors.textSecondary,fontSize:12,fontWeight:"600",letterSpacing:.5,textTransform:"uppercase"}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.appStorageEvent=appStorageEvent;exports.buoyFetch=buoyFetch;exports.isBuoyAssetPath=isBuoyAssetPath;exports.isBuoyElement=isBuoyElement;exports.isBuoyLog=isBuoyLog;exports.isBuoyRequest=isBuoyRequest;var _devToolsStorageKeys=require("./devToolsStorageKeys.js");function appStorageEvent(t){if(t.instanceId&&(0,_devToolsStorageKeys.isDevToolsStorageKey)(t.instanceId))return null;const e=t.data;if(!e)return t;if(typeof e.key==="string"&&(0,_devToolsStorageKeys.isDevToolsStorageKey)(e.key))return null;const o={...e};let r=false;let n=false;let u=false;for(const s of["keys","pairs","prevPairs"]){if(!Array.isArray(e[s]))continue;n||=e[s].length>0;o[s]=e[s].filter(a=>!(0,_devToolsStorageKeys.isDevToolsStorageKey)(s==="keys"?a:a[0]));u||=o[s].length>0;r||=o[s].length!==e[s].length}if(n&&!u)return null;return r?{...t,data:o}:t}function isBuoyRequest(t){try{const e=new URL(t,typeof location==="undefined"?"http://localhost":location.href);const o=e.hostname.toLowerCase();if(["api.buoy.gg","ai.buoy.gg","gateway.buoy.gg"].includes(o))return true;if(o==="keygen.sh"||o.endsWith(".keygen.sh"))return true;if(["buoy.gg","www.buoy.gg"].includes(o)&&/^\/api\/(license|settings|auth|session|install|t)(?:\/|$)/.test(e.pathname))return true;if(e.pathname==="/buoy-assets.json")return true;const r=globalThis.__BUOY_INTERNAL_HOSTS__;return r instanceof Set&&[...r].some(n=>typeof n==="string"&&n.toLowerCase()===e.host.toLowerCase())}catch{return false}}function buoyFetch(t,e){return fetch(t,{...e,__buoyInternal:true})}function isBuoyLog(t){return typeof t[0]==="string"&&/^\[(?:buoy(?:[^\]]*)?|@buoy-gg\/[^\]]+|RnBetterDevTools|React ?Buoy|RN-BUOY DEBUG|js-top|perf-monitor|impersonate|RenderCause|HighlightUpdates|RenderTracker|ProfilerInterceptor|HighlightPerf|DebugBorders|optional-module|route-events|RouteObserver)\]/i.test(t[0])}function isBuoyAssetPath(t){if(!t)return false;if(isBuoyRequest(t))return true;let e=t;try{e=decodeURIComponent(e)}catch{}e=e.replace(/\\/g,"/");return/(?:^|\/)node_modules\/@buoy-gg\/[^/]+(?:\/|$)/.test(e)||/(?:^|\/)buoy-packages\/packages\/[^/]+(?:\/|$)/.test(e)||/(?:^|\/)packages\/floating-tools-core\/(?:src|lib\/(?:module|commonjs))\/icons\/assets(?:\/|$)/.test(e)}function isBuoyElement(t){let e=t;while(e){if(e.closest("[data-buoy-root], [data-buoy-portal-host]"))return true;const o=e.getRootNode?.();e=o&&"host"in o?o.host:null}return false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var _vitest=require("vitest");var _devToolsStorageKeys=require("./devToolsStorageKeys.js");var _buoyOwnership=require("./buoyOwnership.js");(0,_vitest.describe)("Buoy data stays out of app tools",()=>{_vitest.it.each(["@react_buoy_sync_device_id","@react_buoy_time_machine:snap:1","@buoy/session:desktop","buoy-gg-license","buoy-gg-device-fingerprint","buoy.notifications.v1.token","buoy.settings","buoy_state","__buoy_session","react-buoy-settings","@AsyncStorage:@react_buoy_modal_hint_acknowledged","CapacitorStorage.@buoy/session:web"])("hides %s",e=>{(0,_vitest.expect)((0,_devToolsStorageKeys.isDevToolsStorageKey)(e)).toBe(true)});_vitest.it.each(["cart","session","license","my-buoy-score","buoyancy","@AsyncStorage:cart"])("keeps %s",e=>{(0,_vitest.expect)((0,_devToolsStorageKeys.isDevToolsStorageKey)(e)).toBe(false)});(0,_vitest.it)("covers every key in the shared key factory",()=>{const e=t=>{if(typeof t==="function"){const s=t("test");if(typeof s==="string")(0,_vitest.expect)((0,_devToolsStorageKeys.isDevToolsStorageKey)(s)).toBe(true);else e(s)}else if(t&&typeof t==="object")Object.values(t).forEach(e)};e(_devToolsStorageKeys.devToolsStorageKeys)});(0,_vitest.it)("keeps app pairs in a mixed batch without changing the input",()=>{const e={data:{keys:["cart","@buoy/session:web"],pairs:[["cart","2"],["@buoy/session:web","secret"]],prevPairs:[["cart","1"],["@buoy/session:web","old"]]}};(0,_vitest.expect)((0,_buoyOwnership.appStorageEvent)(e)?.data).toEqual({keys:["cart"],pairs:[["cart","2"]],prevPairs:[["cart","1"]]});(0,_vitest.expect)(e.data.keys).toHaveLength(2);(0,_vitest.expect)((0,_buoyOwnership.appStorageEvent)({data:{key:"buoy-gg-license",value:"secret"}})).toBeNull();(0,_vitest.expect)((0,_buoyOwnership.appStorageEvent)({data:{pairs:[["@buoy/session:web","secret"]]}})).toBeNull()});_vitest.it.each(["https://api.buoy.gg/v1/ping","https://ai.buoy.gg/v1/messages","https://buoy.gg/api/settings/x","https://api.keygen.sh/v1/x","/buoy-assets.json"])("hides tool URL %s",e=>(0,_vitest.expect)((0,_buoyOwnership.isBuoyRequest)(e)).toBe(true));_vitest.it.each(["https://api.buoy.gg.example.com/v1/ping","https://example.com/ai.buoy.gg","https://buoy.gg/blog","/app-assets.json"])("keeps app URL %s",e=>(0,_vitest.expect)((0,_buoyOwnership.isBuoyRequest)(e)).toBe(false));(0,_vitest.it)("marks only the tool fetch",async()=>{const e=_vitest.vi.fn().mockResolvedValue({ok:true});_vitest.vi.stubGlobal("fetch",e);try{await(0,_buoyOwnership.buoyFetch)("/app.js.map");(0,_vitest.expect)(e).toHaveBeenCalledWith("/app.js.map",{__buoyInternal:true})}finally{_vitest.vi.unstubAllGlobals()}});(0,_vitest.it)("hides tool log prefixes without hiding app mentions",()=>{(0,_vitest.expect)((0,_buoyOwnership.isBuoyLog)(["[Buoy] sync"])).toBe(true);(0,_vitest.expect)((0,_buoyOwnership.isBuoyLog)(["[RnBetterDevTools] failed"])).toBe(true);(0,_vitest.expect)((0,_buoyOwnership.isBuoyLog)(["App uses Buoy"])).toBe(false)})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.devToolsStorageKeys=void 0;exports.filterOutDevToolsKeys=filterOutDevToolsKeys;exports.getAllDevToolsStorageKeys=getAllDevToolsStorageKeys;exports.isDevToolsStorageKey=isDevToolsStorageKey;const devToolsStorageKeys=exports.devToolsStorageKeys={base:"@react_buoy",bubble:{root:()=>`${devToolsStorageKeys.base}_bubble`,settings:()=>`${devToolsStorageKeys.bubble.root()}_settings`,userPreferences:()=>`${devToolsStorageKeys.bubble.root()}_user_preferences`,position:()=>`${devToolsStorageKeys.bubble.root()}_position`},modal:{root:()=>`${devToolsStorageKeys.base}_modal`,state:()=>`${devToolsStorageKeys.modal.root()}_state`,position:()=>`${devToolsStorageKeys.modal.root()}_position`,dimensions:()=>`${devToolsStorageKeys.modal.root()}_dimensions`,hintAcknowledged:()=>`${devToolsStorageKeys.modal.root()}_hint_acknowledged`},custom:e=>{const o=`${devToolsStorageKeys.base}_custom_${e}`;return{root:()=>o,modal:()=>`${o}_modal`,settings:()=>`${o}_settings`,key:t=>`${o}_${t}`}},settings:{root:()=>`${devToolsStorageKeys.base}_settings`,theme:()=>`${devToolsStorageKeys.settings.root()}_theme`,preferences:()=>`${devToolsStorageKeys.settings.root()}_preferences`,wifiEnabled:()=>`${devToolsStorageKeys.settings.root()}_wifi_enabled`,global:()=>`${devToolsStorageKeys.settings.root()}_global`,activeTab:()=>`${devToolsStorageKeys.settings.root()}_active_tab`,modalOpen:()=>`${devToolsStorageKeys.settings.root()}_modal_open`},dial:{root:()=>`${devToolsStorageKeys.base}_dial`,isOpen:()=>`${devToolsStorageKeys.dial.root()}_is_open`,usage:()=>`${devToolsStorageKeys.dial.root()}_usage`},clipboard:{root:()=>`${devToolsStorageKeys.base}_clipboard`,hintAcknowledged:()=>`${devToolsStorageKeys.clipboard.root()}_hint_acknowledged`},env:{root:()=>`${devToolsStorageKeys.base}_env`,modal:()=>`${devToolsStorageKeys.env.root()}_modal`,currentEnv:()=>`${devToolsStorageKeys.env.root()}_current`,overrides:()=>`${devToolsStorageKeys.env.root()}_overrides`},sentry:{root:()=>`${devToolsStorageKeys.base}_sentry`,modal:()=>`${devToolsStorageKeys.sentry.root()}_modal`,filters:()=>`${devToolsStorageKeys.sentry.root()}_filters`,preferences:()=>`${devToolsStorageKeys.sentry.root()}_preferences`},storage:{root:()=>`${devToolsStorageKeys.base}_storage`,modal:()=>`${devToolsStorageKeys.storage.root()}_modal`,eventsModal:()=>`${devToolsStorageKeys.storage.root()}_events_modal`,filters:()=>`${devToolsStorageKeys.storage.root()}_filters`,eventFilters:()=>`${devToolsStorageKeys.storage.root()}_event_filters`,keyFilters:()=>`${devToolsStorageKeys.storage.root()}_key_filters`,pinnedKeys:()=>`${devToolsStorageKeys.storage.root()}_pinned_keys`,preferences:()=>`${devToolsStorageKeys.storage.root()}_preferences`,activeTab:()=>`${devToolsStorageKeys.storage.root()}_active_tab`,isMonitoring:()=>`${devToolsStorageKeys.storage.root()}_is_monitoring`,diffViewerMode:()=>`${devToolsStorageKeys.storage.root()}_diff_viewer_mode`},clock:{root:()=>`${devToolsStorageKeys.base}_clock`,state:()=>`${devToolsStorageKeys.clock.root()}_state`},permissions:{root:()=>`${devToolsStorageKeys.base}_permissions`,state:()=>`${devToolsStorageKeys.permissions.root()}_state`},lifecycle:{root:()=>`${devToolsStorageKeys.base}_lifecycle`,state:()=>`${devToolsStorageKeys.lifecycle.root()}_state`},location:{root:()=>`${devToolsStorageKeys.base}_location`,state:()=>`${devToolsStorageKeys.location.root()}_state`},timeMachine:{root:()=>`${devToolsStorageKeys.base}_time_machine`,diffViewerMode:()=>`${devToolsStorageKeys.timeMachine.root()}_diff_viewer_mode`,armedPoint:()=>`${devToolsStorageKeys.timeMachine.root()}_armed_point`,barReloadMode:()=>`${devToolsStorageKeys.timeMachine.root()}_bar_reload_mode`,disabledSources:()=>`${devToolsStorageKeys.timeMachine.root()}_disabled_sources`},scenarios:{root:()=>`${devToolsStorageKeys.base}_scenarios`,modal:()=>`${devToolsStorageKeys.scenarios.root()}_modal`,library:()=>`${devToolsStorageKeys.scenarios.root()}_library`,active:()=>`${devToolsStorageKeys.scenarios.root()}_active`},reactQuery:{root:()=>`${devToolsStorageKeys.base}_rq`,modal:()=>`${devToolsStorageKeys.reactQuery.root()}_modal`,browserModal:()=>`${devToolsStorageKeys.reactQuery.root()}_browser_modal`,mutationModal:()=>`${devToolsStorageKeys.reactQuery.root()}_mutation_modal`,filters:()=>`${devToolsStorageKeys.reactQuery.root()}_filters`,ignoredPatterns:()=>`${devToolsStorageKeys.reactQuery.root()}_ignored_patterns`,includedPatterns:()=>`${devToolsStorageKeys.reactQuery.root()}_included_patterns`,preferences:()=>`${devToolsStorageKeys.reactQuery.root()}_preferences`},network:{root:()=>`${devToolsStorageKeys.base}_network`,modal:()=>`${devToolsStorageKeys.network.root()}_modal`,copyModal:()=>`${devToolsStorageKeys.network.root()}_copy_modal`,filters:()=>`${devToolsStorageKeys.network.root()}_filters`,ignoredDomains:()=>`${devToolsStorageKeys.network.root()}_ignored_domains`,ignoredUrls:()=>`${devToolsStorageKeys.network.root()}_ignored_urls`,preferences:()=>`${devToolsStorageKeys.network.root()}_preferences`,copyOptions:()=>`${devToolsStorageKeys.network.root()}_copy_options`,saved:()=>`${devToolsStorageKeys.network.root()}_saved`,overrides:()=>`${devToolsStorageKeys.network.root()}_overrides`},routeEvents:{root:()=>`${devToolsStorageKeys.base}_route_events`,modal:()=>`${devToolsStorageKeys.routeEvents.root()}_modal`,eventFilters:()=>`${devToolsStorageKeys.routeEvents.root()}_event_filters`,activeTab:()=>`${devToolsStorageKeys.routeEvents.root()}_active_tab`,isMonitoring:()=>`${devToolsStorageKeys.routeEvents.root()}_is_monitoring`,detailView:()=>`${devToolsStorageKeys.routeEvents.root()}_detail_view`,diffViewerMode:()=>`${devToolsStorageKeys.routeEvents.root()}_diff_viewer_mode`},highlightUpdates:{root:()=>`${devToolsStorageKeys.base}_highlight_updates`,modal:()=>`${devToolsStorageKeys.highlightUpdates.root()}_modal`,isTracking:()=>`${devToolsStorageKeys.highlightUpdates.root()}_is_tracking`,filters:()=>`${devToolsStorageKeys.highlightUpdates.root()}_filters`,settings:()=>`${devToolsStorageKeys.highlightUpdates.root()}_settings`,copySettings:()=>`${devToolsStorageKeys.highlightUpdates.root()}_copy_settings`},benchmark:{root:()=>`${devToolsStorageKeys.base}_benchmark`,modal:()=>`${devToolsStorageKeys.benchmark.root()}_modal`,isRecording:()=>`${devToolsStorageKeys.benchmark.root()}_is_recording`,activeTab:()=>`${devToolsStorageKeys.benchmark.root()}_active_tab`,settings:()=>`${devToolsStorageKeys.benchmark.root()}_settings`,selectedReports:()=>`${devToolsStorageKeys.benchmark.root()}_selected_reports`},debugBorders:{root:()=>`${devToolsStorageKeys.base}_debug_borders`,infoModal:()=>`${devToolsStorageKeys.debugBorders.root()}_info_modal`},events:{root:()=>`${devToolsStorageKeys.base}_events`,modal:()=>`${devToolsStorageKeys.events.root()}_modal`,enabledSources:()=>`${devToolsStorageKeys.events.root()}_enabled_sources`,isCapturing:()=>`${devToolsStorageKeys.events.root()}_is_capturing`,pausedAt:()=>`${devToolsStorageKeys.events.root()}_paused_at`,copySettings:()=>`${devToolsStorageKeys.events.root()}_copy_settings`},sync:{root:()=>`${devToolsStorageKeys.base}_sync`,deviceId:()=>`${devToolsStorageKeys.sync.root()}_device_id`}};const LEGACY_DEV_TOOL_PATTERNS=["@devtools","@dev_tools_","@modal_state_","@react_query_browser_modal","@react_query_modal","@react_query_mutation_modal","@sentry_logs_modal","@floating_rn_better_dev_tools_","@floating_tools_","@apphost_","@bubble_settings_","@env_vars_modal","@storage_modal","@floating_@devtools_","dev_last_route"];function isDevToolsStorageKey(e){if(!e)return false;if(e.startsWith(devToolsStorageKeys.base)){return true}if(e.startsWith("buoy-")){return true}if(e.startsWith("@buoy")){return true}if(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.devToolsStorageKeys=void 0;exports.filterOutDevToolsKeys=filterOutDevToolsKeys;exports.getAllDevToolsStorageKeys=getAllDevToolsStorageKeys;exports.isDevToolsStorageKey=isDevToolsStorageKey;const devToolsStorageKeys=exports.devToolsStorageKeys={base:"@react_buoy",bubble:{root:()=>`${devToolsStorageKeys.base}_bubble`,settings:()=>`${devToolsStorageKeys.bubble.root()}_settings`,userPreferences:()=>`${devToolsStorageKeys.bubble.root()}_user_preferences`,position:()=>`${devToolsStorageKeys.bubble.root()}_position`},modal:{root:()=>`${devToolsStorageKeys.base}_modal`,state:()=>`${devToolsStorageKeys.modal.root()}_state`,position:()=>`${devToolsStorageKeys.modal.root()}_position`,dimensions:()=>`${devToolsStorageKeys.modal.root()}_dimensions`,hintAcknowledged:()=>`${devToolsStorageKeys.modal.root()}_hint_acknowledged`},custom:e=>{const o=`${devToolsStorageKeys.base}_custom_${e}`;return{root:()=>o,modal:()=>`${o}_modal`,settings:()=>`${o}_settings`,key:t=>`${o}_${t}`}},settings:{root:()=>`${devToolsStorageKeys.base}_settings`,theme:()=>`${devToolsStorageKeys.settings.root()}_theme`,preferences:()=>`${devToolsStorageKeys.settings.root()}_preferences`,wifiEnabled:()=>`${devToolsStorageKeys.settings.root()}_wifi_enabled`,global:()=>`${devToolsStorageKeys.settings.root()}_global`,activeTab:()=>`${devToolsStorageKeys.settings.root()}_active_tab`,modalOpen:()=>`${devToolsStorageKeys.settings.root()}_modal_open`},dial:{root:()=>`${devToolsStorageKeys.base}_dial`,isOpen:()=>`${devToolsStorageKeys.dial.root()}_is_open`,usage:()=>`${devToolsStorageKeys.dial.root()}_usage`},clipboard:{root:()=>`${devToolsStorageKeys.base}_clipboard`,hintAcknowledged:()=>`${devToolsStorageKeys.clipboard.root()}_hint_acknowledged`},env:{root:()=>`${devToolsStorageKeys.base}_env`,modal:()=>`${devToolsStorageKeys.env.root()}_modal`,currentEnv:()=>`${devToolsStorageKeys.env.root()}_current`,overrides:()=>`${devToolsStorageKeys.env.root()}_overrides`},sentry:{root:()=>`${devToolsStorageKeys.base}_sentry`,modal:()=>`${devToolsStorageKeys.sentry.root()}_modal`,filters:()=>`${devToolsStorageKeys.sentry.root()}_filters`,preferences:()=>`${devToolsStorageKeys.sentry.root()}_preferences`},storage:{root:()=>`${devToolsStorageKeys.base}_storage`,modal:()=>`${devToolsStorageKeys.storage.root()}_modal`,eventsModal:()=>`${devToolsStorageKeys.storage.root()}_events_modal`,filters:()=>`${devToolsStorageKeys.storage.root()}_filters`,eventFilters:()=>`${devToolsStorageKeys.storage.root()}_event_filters`,keyFilters:()=>`${devToolsStorageKeys.storage.root()}_key_filters`,pinnedKeys:()=>`${devToolsStorageKeys.storage.root()}_pinned_keys`,preferences:()=>`${devToolsStorageKeys.storage.root()}_preferences`,activeTab:()=>`${devToolsStorageKeys.storage.root()}_active_tab`,isMonitoring:()=>`${devToolsStorageKeys.storage.root()}_is_monitoring`,diffViewerMode:()=>`${devToolsStorageKeys.storage.root()}_diff_viewer_mode`},clock:{root:()=>`${devToolsStorageKeys.base}_clock`,state:()=>`${devToolsStorageKeys.clock.root()}_state`},permissions:{root:()=>`${devToolsStorageKeys.base}_permissions`,state:()=>`${devToolsStorageKeys.permissions.root()}_state`},lifecycle:{root:()=>`${devToolsStorageKeys.base}_lifecycle`,state:()=>`${devToolsStorageKeys.lifecycle.root()}_state`},location:{root:()=>`${devToolsStorageKeys.base}_location`,state:()=>`${devToolsStorageKeys.location.root()}_state`},timeMachine:{root:()=>`${devToolsStorageKeys.base}_time_machine`,diffViewerMode:()=>`${devToolsStorageKeys.timeMachine.root()}_diff_viewer_mode`,armedPoint:()=>`${devToolsStorageKeys.timeMachine.root()}_armed_point`,barReloadMode:()=>`${devToolsStorageKeys.timeMachine.root()}_bar_reload_mode`,disabledSources:()=>`${devToolsStorageKeys.timeMachine.root()}_disabled_sources`},scenarios:{root:()=>`${devToolsStorageKeys.base}_scenarios`,modal:()=>`${devToolsStorageKeys.scenarios.root()}_modal`,library:()=>`${devToolsStorageKeys.scenarios.root()}_library`,active:()=>`${devToolsStorageKeys.scenarios.root()}_active`},reactQuery:{root:()=>`${devToolsStorageKeys.base}_rq`,modal:()=>`${devToolsStorageKeys.reactQuery.root()}_modal`,browserModal:()=>`${devToolsStorageKeys.reactQuery.root()}_browser_modal`,mutationModal:()=>`${devToolsStorageKeys.reactQuery.root()}_mutation_modal`,filters:()=>`${devToolsStorageKeys.reactQuery.root()}_filters`,ignoredPatterns:()=>`${devToolsStorageKeys.reactQuery.root()}_ignored_patterns`,includedPatterns:()=>`${devToolsStorageKeys.reactQuery.root()}_included_patterns`,preferences:()=>`${devToolsStorageKeys.reactQuery.root()}_preferences`},network:{root:()=>`${devToolsStorageKeys.base}_network`,modal:()=>`${devToolsStorageKeys.network.root()}_modal`,copyModal:()=>`${devToolsStorageKeys.network.root()}_copy_modal`,filters:()=>`${devToolsStorageKeys.network.root()}_filters`,ignoredDomains:()=>`${devToolsStorageKeys.network.root()}_ignored_domains`,ignoredUrls:()=>`${devToolsStorageKeys.network.root()}_ignored_urls`,preferences:()=>`${devToolsStorageKeys.network.root()}_preferences`,copyOptions:()=>`${devToolsStorageKeys.network.root()}_copy_options`,saved:()=>`${devToolsStorageKeys.network.root()}_saved`,overrides:()=>`${devToolsStorageKeys.network.root()}_overrides`},routeEvents:{root:()=>`${devToolsStorageKeys.base}_route_events`,modal:()=>`${devToolsStorageKeys.routeEvents.root()}_modal`,eventFilters:()=>`${devToolsStorageKeys.routeEvents.root()}_event_filters`,activeTab:()=>`${devToolsStorageKeys.routeEvents.root()}_active_tab`,isMonitoring:()=>`${devToolsStorageKeys.routeEvents.root()}_is_monitoring`,detailView:()=>`${devToolsStorageKeys.routeEvents.root()}_detail_view`,diffViewerMode:()=>`${devToolsStorageKeys.routeEvents.root()}_diff_viewer_mode`},highlightUpdates:{root:()=>`${devToolsStorageKeys.base}_highlight_updates`,modal:()=>`${devToolsStorageKeys.highlightUpdates.root()}_modal`,isTracking:()=>`${devToolsStorageKeys.highlightUpdates.root()}_is_tracking`,filters:()=>`${devToolsStorageKeys.highlightUpdates.root()}_filters`,settings:()=>`${devToolsStorageKeys.highlightUpdates.root()}_settings`,copySettings:()=>`${devToolsStorageKeys.highlightUpdates.root()}_copy_settings`},benchmark:{root:()=>`${devToolsStorageKeys.base}_benchmark`,modal:()=>`${devToolsStorageKeys.benchmark.root()}_modal`,isRecording:()=>`${devToolsStorageKeys.benchmark.root()}_is_recording`,activeTab:()=>`${devToolsStorageKeys.benchmark.root()}_active_tab`,settings:()=>`${devToolsStorageKeys.benchmark.root()}_settings`,selectedReports:()=>`${devToolsStorageKeys.benchmark.root()}_selected_reports`},debugBorders:{root:()=>`${devToolsStorageKeys.base}_debug_borders`,infoModal:()=>`${devToolsStorageKeys.debugBorders.root()}_info_modal`},events:{root:()=>`${devToolsStorageKeys.base}_events`,modal:()=>`${devToolsStorageKeys.events.root()}_modal`,enabledSources:()=>`${devToolsStorageKeys.events.root()}_enabled_sources`,isCapturing:()=>`${devToolsStorageKeys.events.root()}_is_capturing`,pausedAt:()=>`${devToolsStorageKeys.events.root()}_paused_at`,copySettings:()=>`${devToolsStorageKeys.events.root()}_copy_settings`},sync:{root:()=>`${devToolsStorageKeys.base}_sync`,deviceId:()=>`${devToolsStorageKeys.sync.root()}_device_id`}};const LEGACY_DEV_TOOL_PATTERNS=["@devtools","@dev_tools_","@modal_state_","@react_query_browser_modal","@react_query_modal","@react_query_mutation_modal","@sentry_logs_modal","@floating_rn_better_dev_tools_","@floating_tools_","@apphost_","@bubble_settings_","@env_vars_modal","@storage_modal","@floating_@devtools_","dev_last_route"];function isDevToolsStorageKey(e){if(!e)return false;for(const o of["@AsyncStorage:","CapacitorStorage."]){if(e.startsWith(o))e=e.slice(o.length)}if(e.startsWith(devToolsStorageKeys.base)){return true}if(e.startsWith("buoy-")){return true}if(e.startsWith("@buoy")){return true}if(/^(?:buoy[._]|__buoy|react-buoy)/i.test(e)){return true}for(const o of LEGACY_DEV_TOOL_PATTERNS){if(e.startsWith(o)){return true}}return false}function filterOutDevToolsKeys(e){return e.filter(o=>!isDevToolsStorageKey(o))}function getAllDevToolsStorageKeys(){const e=[];e.push(devToolsStorageKeys.bubble.settings());e.push(devToolsStorageKeys.bubble.userPreferences());e.push(devToolsStorageKeys.bubble.position());e.push(devToolsStorageKeys.modal.state());e.push(devToolsStorageKeys.modal.position());e.push(devToolsStorageKeys.modal.dimensions());e.push(devToolsStorageKeys.settings.theme());e.push(devToolsStorageKeys.settings.preferences());e.push(devToolsStorageKeys.env.currentEnv());e.push(devToolsStorageKeys.env.overrides());e.push(devToolsStorageKeys.sentry.filters());e.push(devToolsStorageKeys.sentry.preferences());e.push(devToolsStorageKeys.storage.filters());e.push(devToolsStorageKeys.storage.preferences());e.push(devToolsStorageKeys.reactQuery.filters());e.push(devToolsStorageKeys.reactQuery.preferences());return e}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"callCapacitorNative",{enumerable:true,get:function(){return _license.callCapacitorNative}});Object.defineProperty(exports,"definePersistedSetting",{enumerable:true,get:function(){return _definePersistedSetting.definePersistedSetting}});Object.defineProperty(exports,"devToolsStorageKeys",{enumerable:true,get:function(){return _devToolsStorageKeys.devToolsStorageKeys}});Object.defineProperty(exports,"getCapacitorAppStorage",{enumerable:true,get:function(){return _capacitorAppStorage.getCapacitorAppStorage}});Object.defineProperty(exports,"hasCapacitorPlugin",{enumerable:true,get:function(){return _license.hasCapacitorPlugin}});Object.defineProperty(exports,"isCapacitorNative",{enumerable:true,get:function(){return _license.isCapacitorNative}});Object.defineProperty(exports,"isDevToolsStorageKey",{enumerable:true,get:function(){return _devToolsStorageKeys.isDevToolsStorageKey}});var _devToolsStorageKeys=require("./devToolsStorageKeys.js");var _definePersistedSetting=require("./definePersistedSetting.js");var _capacitorAppStorage=require("./capacitorAppStorage.js");var _license=require("@buoy-gg/license");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"appStorageEvent",{enumerable:true,get:function(){return _buoyOwnership.appStorageEvent}});Object.defineProperty(exports,"buoyFetch",{enumerable:true,get:function(){return _buoyOwnership.buoyFetch}});Object.defineProperty(exports,"callCapacitorNative",{enumerable:true,get:function(){return _license.callCapacitorNative}});Object.defineProperty(exports,"definePersistedSetting",{enumerable:true,get:function(){return _definePersistedSetting.definePersistedSetting}});Object.defineProperty(exports,"devToolsStorageKeys",{enumerable:true,get:function(){return _devToolsStorageKeys.devToolsStorageKeys}});Object.defineProperty(exports,"getCapacitorAppStorage",{enumerable:true,get:function(){return _capacitorAppStorage.getCapacitorAppStorage}});Object.defineProperty(exports,"hasCapacitorPlugin",{enumerable:true,get:function(){return _license.hasCapacitorPlugin}});Object.defineProperty(exports,"isBuoyAssetPath",{enumerable:true,get:function(){return _buoyOwnership.isBuoyAssetPath}});Object.defineProperty(exports,"isBuoyElement",{enumerable:true,get:function(){return _buoyOwnership.isBuoyElement}});Object.defineProperty(exports,"isBuoyLog",{enumerable:true,get:function(){return _buoyOwnership.isBuoyLog}});Object.defineProperty(exports,"isBuoyRequest",{enumerable:true,get:function(){return _buoyOwnership.isBuoyRequest}});Object.defineProperty(exports,"isCapacitorNative",{enumerable:true,get:function(){return _license.isCapacitorNative}});Object.defineProperty(exports,"isDevToolsStorageKey",{enumerable:true,get:function(){return _devToolsStorageKeys.isDevToolsStorageKey}});var _devToolsStorageKeys=require("./devToolsStorageKeys.js");var _definePersistedSetting=require("./definePersistedSetting.js");var _capacitorAppStorage=require("./capacitorAppStorage.js");var _license=require("@buoy-gg/license");var _buoyOwnership=require("./buoyOwnership.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ChangeRow=ChangeRow;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _gameUIColors=require("../gameUI/constants/gameUIColors.js");var _CompactRow=require("./CompactRow.js");var _index=require("../../icons/index.js");var _RelativeTime=require("../../utils/time/RelativeTime.js");var _fonts=require("../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ChangeRow=ChangeRow;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _gameUIColors=require("../gameUI/constants/gameUIColors.js");var _CompactRow=require("./CompactRow.js");var _index=require("../../icons/index.js");var _RelativeTime=require("../../utils/time/RelativeTime.js");var _fonts=require("../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(i){return i&&i.__esModule?i:{default:i}}function ChangeRow({statusColor:i,statusLabel:s,sublabel:l,primaryText:u,timestamp:d,badgeText:n,changed:r=false,slow:a=false,badgePrefix:t,customBadge:c,plainBadgeText:f,onPress:m,testID:e,accessibilityLabel:g}){const o=c??(n!==void 0||t||r||a?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.badgeContainer,children:[t,n!==void 0?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.badgeText,{color:i}],numberOfLines:1,ellipsizeMode:"tail",testID:e?`${e}-badge`:void 0,children:n}):null,a?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.iconBadge,testID:e?`${e}-slow`:void 0,children:(0,_jsxRuntime.jsx)(_index.Clock,{size:12,color:_gameUIColors.buoyColors.error})}):r?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.iconBadge,testID:e?`${e}-change`:void 0,children:(0,_jsxRuntime.jsx)(_index.Zap,{size:12,color:_gameUIColors.buoyColors.warning})}):null]}):void 0);return(0,_jsxRuntime.jsx)(_CompactRow.CompactRow,{statusDotColor:i,statusLabel:s,statusSublabel:l,primaryText:u,bottomRightText:(0,_jsxRuntime.jsx)(_RelativeTime.RelativeTime,{timestamp:d}),customBadge:o,badgeText:o?void 0:f,badgeColor:i,showChevron:true,onPress:m,testID:e,statusTestID:e?`${e}-status`:void 0,statusSublabelTestID:e?`${e}-sublabel`:void 0,primaryTestID:e?`${e}-keys`:void 0,accessibilityLabel:g})}const styles=_reactNative.StyleSheet.create({badgeContainer:{flexDirection:"row",alignItems:"center",gap:4},badgeText:{maxWidth:96,fontSize:11,fontWeight:"600",fontFamily:_fonts.monoFont},iconBadge:{paddingHorizontal:4}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.CompactRow=CompactRow;var _reactNative=require("react-native");var _index=require("../../icons/index.js");var _nightTheme=require("../night/nightTheme.js");var _fonts=require("../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function CompactRow({statusDotColor:t,statusLabel:g,statusSublabel:a,primaryText:u,secondaryText:r,secondaryAccessory:c,expandedContent:d,isExpanded:e,badgeText:o,badgeColor:f,customBadge:i,showChevron:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.CompactRow=CompactRow;var _reactNative=require("react-native");var _index=require("../../icons/index.js");var _nightTheme=require("../night/nightTheme.js");var _fonts=require("../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function CompactRow({statusDotColor:t,statusLabel:g,statusSublabel:a,primaryText:u,secondaryText:r,secondaryAccessory:c,expandedContent:d,isExpanded:e,badgeText:o,badgeColor:f,customBadge:i,showChevron:x,bottomRightText:n,isSelected:w,onPress:s,disabled:m,expandedGlowColor:l,testID:y,statusTestID:p,statusSublabelTestID:b,primaryTestID:j,secondaryTestID:T,accessibilityLabel:v,trailingAction:h}){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.rowWrapper,e&&styles.rowWrapperExpanded],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.row,w&&styles.selectedRow,e&&[styles.expandedRowActive,{borderColor:l||_nightTheme.night.color.accent,borderBottomColor:l||_nightTheme.night.color.accent,shadowColor:l||_nightTheme.night.color.accent}]],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.headerRow,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.headerPress,onPress:s,activeOpacity:.8,disabled:m||!s,testID:y,accessibilityLabel:v,accessibilityRole:s?"button":void 0,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rowContent,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statusSection,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.statusDot,{backgroundColor:t}]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statusInfo,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.statusLabel,{color:t}],numberOfLines:1,testID:p,children:g}),a?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.observerText,numberOfLines:1,testID:b,children:a}):null]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.querySection,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.queryHash,numberOfLines:e?void 0:2,testID:j,children:u}),!e&&(r||c)?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.secondaryRow,children:[r?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.secondaryText,numberOfLines:1,testID:T,children:r}):null,c]}):null]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.rightSection,children:[(i||o!==void 0||!e&&n)&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.badgeContainer,children:[i?i:o!==void 0?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.statusBadge,{color:f||t}],numberOfLines:1,ellipsizeMode:"tail",children:o}):null,!e&&n?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.bottomRightText,numberOfLines:1,children:n}):null]}),x&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chevronContainer,children:e?(0,_jsxRuntime.jsx)(_index.ChevronDown,{size:14,color:_nightTheme.night.color.textTertiary}):(0,_jsxRuntime.jsx)(_index.ChevronRight,{size:14,color:_nightTheme.night.color.textTertiary})})]})]})}),h?(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.trailingAction,children:h}):null]}),e&&d&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.expandedContent,children:d})]})})}const styles=_reactNative.StyleSheet.create({rowWrapper:{position:"relative",marginHorizontal:8,marginVertical:3},rowWrapperExpanded:{marginVertical:12},row:{backgroundColor:"rgba(12, 12, 12, 0.9)",borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border,borderBottomWidth:1,borderBottomColor:_nightTheme.night.color.separator,padding:12,paddingHorizontal:12,transform:[{scale:1}]},selectedRow:{backgroundColor:_nightTheme.night.color.accentSoft,borderColor:_nightTheme.night.color.accentBorderStrong,transform:[{scale:1.01}],shadowColor:_nightTheme.night.color.accent,shadowOffset:{width:0,height:0},shadowOpacity:.1,shadowRadius:8,elevation:2},expandedRowActive:{transform:[{scale:1.02}],borderWidth:2,paddingBottom:16,shadowOffset:{width:0,height:0},shadowOpacity:.8,shadowRadius:20,elevation:10},headerRow:{flexDirection:"row",alignItems:"center"},headerPress:{flex:1,minWidth:0},trailingAction:{marginLeft:8,justifyContent:"center"},rowContent:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},statusSection:{flexDirection:"row",alignItems:"center",gap:8,width:90,minWidth:90},statusDot:{width:8,height:8,borderRadius:4},statusInfo:{flex:1,maxWidth:70},statusLabel:{fontSize:11,fontWeight:"600",lineHeight:14},observerText:{fontSize:10,color:_nightTheme.night.color.textTertiary,marginTop:1},querySection:{flex:2,minWidth:0,paddingHorizontal:12},queryHash:{fontFamily:_fonts.monoFont,fontSize:12,color:_nightTheme.night.color.text,lineHeight:16},secondaryRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:1},secondaryText:{fontSize:10,color:_nightTheme.night.color.textTertiary,marginTop:1,flexShrink:1},rightSection:{flexDirection:"row",alignItems:"center",gap:8},badgeContainer:{flexDirection:"column",alignItems:"flex-end",gap:2},statusBadge:{maxWidth:96,fontSize:12,fontWeight:"600",fontVariant:["tabular-nums"]},chevronContainer:{padding:2},expandedContent:{marginTop:8,paddingTop:8,borderTopWidth:1,borderTopColor:_nightTheme.night.color.separator,marginLeft:24},bottomRightText:{fontSize:9,color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DataInspector=DataInspector;var _react=require("react");var _reactNative=require("react-native");var _index=require("../../icons/index.js");var _index2=require("../gameUI/index.js");var _CopyButton=require("./CopyButton.js");var _fonts=require("../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function DataInspector({data:i,mode:e="view",syntax:t="json",theme:n="dark",collapsible:o=true,searchable:s=true,onEdit:j,style:p,title:d}){const[l,C]=(0,_react.useState)("");const[r,c]=(0,_react.useState)(false);const[f,u]=(0,_react.useState)("");const g=()=>{if(t==="json"){try{return JSON.stringify(i,null,2)}catch{return String(i)}}return String(i)};const m=a=>{if(!l)return a;const I=a.split(new RegExp(`(${l})`,"gi"));return I.map((x,b)=>{if(x.toLowerCase()===l.toLowerCase()){return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.highlight,children:x},b)}return x})};const y=()=>{if(!r){u(g());c(true)}else{try{const a=t==="json"?JSON.parse(f):f;j?.(a);c(false)}catch(a){console.error("Failed to parse edited data",a)}}};const w=()=>{c(false);u("")};const h=g();return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,p],children:[(d||s||e==="edit")&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.header,children:[d&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.title,children:d}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.controls,children:[s&&!r&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.searchContainer,children:[(0,_jsxRuntime.jsx)(_index.Search,{size:12,color:_index2.gameUIColors.secondary}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.searchInput,placeholder:"Search...",placeholderTextColor:_index2.gameUIColors.tertiary,value:l,onChangeText:C})]}),e==="edit"&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.editButton,onPress:r?y:()=>y(),children:r?(0,_jsxRuntime.jsx)(_index.Check,{size:14,color:_index2.gameUIColors.success}):(0,_jsxRuntime.jsx)(_index.Edit3,{size:14,color:_index2.gameUIColors.primary})}),r&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.cancelButton,onPress:w,children:(0,_jsxRuntime.jsx)(_index.X,{size:14,color:_index2.gameUIColors.error})}),!r&&(0,_jsxRuntime.jsx)(_CopyButton.CopyButton,{value:h,size:12})]})]}),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.scrollView,horizontal:true,showsHorizontalScrollIndicator:false,children:(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{showsVerticalScrollIndicator:false,children:r?(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.editor,value:f,onChangeText:u,multiline:true,autoCapitalize:"none",autoCorrect:false}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.codeText,children:l?m(h):h})})})]})}DataInspector.Json=function i({data:e,searchable:t,style:n}){return(0,_jsxRuntime.jsx)(DataInspector,{data:e,syntax:"json",mode:"view",searchable:t,style:n})};DataInspector.Editable=function i({data:e,onSave:t,style:n}){return(0,_jsxRuntime.jsx)(DataInspector,{data:e,mode:"edit",onEdit:t,style:n})};DataInspector.Diff=function i({oldData:e,newData:t,style:n}){const[o,s]=(0,_react.useState)("diff");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:n,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffControls,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.diffButton,o==="old"&&styles.diffButtonActive],onPress:()=>s("old"),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffButtonText,children:"Old"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.diffButton,o==="new"&&styles.diffButtonActive],onPress:()=>s("new"),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffButtonText,children:"New"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.diffButton,o==="diff"&&styles.diffButtonActive],onPress:()=>s("diff"),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffButtonText,children:"Diff"})})]}),o==="old"&&(0,_jsxRuntime.jsx)(DataInspector,{data:e,searchable:false}),o==="new"&&(0,_jsxRuntime.jsx)(DataInspector,{data:t,searchable:false}),o==="diff"&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffPane,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffPaneTitle,children:"Old"}),(0,_jsxRuntime.jsx)(DataInspector,{data:e,searchable:false})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffPane,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffPaneTitle,children:"New"}),(0,_jsxRuntime.jsx)(DataInspector,{data:t,searchable:false})]})]})]})};const styles=_reactNative.StyleSheet.create({container:{backgroundColor:_index2.gameUIColors.background,borderRadius:8,overflow:"hidden"},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:8,borderBottomWidth:1,borderBottomColor:_index2.gameUIColors.border+"20"},title:{fontSize:12,fontWeight:"600",color:_index2.gameUIColors.text},controls:{flexDirection:"row",gap:8},searchContainer:{flexDirection:"row",alignItems:"center",backgroundColor:_index2.gameUIColors.panel,borderRadius:4,paddingHorizontal:8,gap:4},searchInput:{fontSize:11,color:_index2.gameUIColors.text,minWidth:100,paddingVertical:4},editButton:{padding:4,borderRadius:4,backgroundColor:_index2.gameUIColors.primary+"20"},cancelButton:{padding:4,borderRadius:4,backgroundColor:_index2.gameUIColors.error+"20"},scrollView:{maxHeight:300},codeText:{fontFamily:_fonts.monoFont,fontSize:11,color:_index2.gameUIColors.text,padding:12,lineHeight:16},editor:{fontFamily:_fonts.monoFont,fontSize:11,color:_index2.gameUIColors.text,padding:12,lineHeight:16,minHeight:200},highlight:{backgroundColor:_index2.gameUIColors.warning+"40",color:_index2.gameUIColors.text},diffControls:{flexDirection:"row",gap:8,padding:8},diffButton:{paddingHorizontal:12,paddingVertical:4,borderRadius:4,backgroundColor:_index2.gameUIColors.panel},diffButtonActive:{backgroundColor:_index2.gameUIColors.primary},diffButtonText:{fontSize:11,color:_index2.gameUIColors.text,fontWeight:"500"},diffContainer:{flexDirection:"row",gap:8},diffPane:{flex:1},diffPaneTitle:{fontSize:10,fontWeight:"600",color:_index2.gameUIColors.secondary,padding:8,textTransform:"uppercase"}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DataInspector=DataInspector;var _react=require("react");var _reactNative=require("react-native");var _index=require("../../icons/index.js");var _index2=require("../gameUI/index.js");var _CopyButton=require("./CopyButton.js");var _fonts=require("../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function DataInspector({data:i,mode:e="view",syntax:t="json",theme:n="dark",collapsible:o=true,searchable:s=true,onEdit:j,style:p,title:d}){const[l,C]=(0,_react.useState)("");const[r,c]=(0,_react.useState)(false);const[f,u]=(0,_react.useState)("");const g=()=>{if(t==="json"){try{return JSON.stringify(i,null,2)}catch{return String(i)}}return String(i)};const m=a=>{if(!l)return a;const I=a.split(new RegExp(`(${l})`,"gi"));return I.map((x,b)=>{if(x.toLowerCase()===l.toLowerCase()){return(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.highlight,children:x},b)}return x})};const y=()=>{if(!r){u(g());c(true)}else{try{const a=t==="json"?JSON.parse(f):f;j?.(a);c(false)}catch(a){console.error("[Buoy]","Failed to parse edited data",a)}}};const w=()=>{c(false);u("")};const h=g();return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,p],children:[(d||s||e==="edit")&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.header,children:[d&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.title,children:d}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.controls,children:[s&&!r&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.searchContainer,children:[(0,_jsxRuntime.jsx)(_index.Search,{size:12,color:_index2.gameUIColors.secondary}),(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.searchInput,placeholder:"Search...",placeholderTextColor:_index2.gameUIColors.tertiary,value:l,onChangeText:C})]}),e==="edit"&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.editButton,onPress:r?y:()=>y(),children:r?(0,_jsxRuntime.jsx)(_index.Check,{size:14,color:_index2.gameUIColors.success}):(0,_jsxRuntime.jsx)(_index.Edit3,{size:14,color:_index2.gameUIColors.primary})}),r&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.cancelButton,onPress:w,children:(0,_jsxRuntime.jsx)(_index.X,{size:14,color:_index2.gameUIColors.error})}),!r&&(0,_jsxRuntime.jsx)(_CopyButton.CopyButton,{value:h,size:12})]})]}),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.scrollView,horizontal:true,showsHorizontalScrollIndicator:false,children:(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{showsVerticalScrollIndicator:false,children:r?(0,_jsxRuntime.jsx)(_reactNative.TextInput,{style:styles.editor,value:f,onChangeText:u,multiline:true,autoCapitalize:"none",autoCorrect:false}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.codeText,children:l?m(h):h})})})]})}DataInspector.Json=function i({data:e,searchable:t,style:n}){return(0,_jsxRuntime.jsx)(DataInspector,{data:e,syntax:"json",mode:"view",searchable:t,style:n})};DataInspector.Editable=function i({data:e,onSave:t,style:n}){return(0,_jsxRuntime.jsx)(DataInspector,{data:e,mode:"edit",onEdit:t,style:n})};DataInspector.Diff=function i({oldData:e,newData:t,style:n}){const[o,s]=(0,_react.useState)("diff");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:n,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffControls,children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.diffButton,o==="old"&&styles.diffButtonActive],onPress:()=>s("old"),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffButtonText,children:"Old"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.diffButton,o==="new"&&styles.diffButtonActive],onPress:()=>s("new"),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffButtonText,children:"New"})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.diffButton,o==="diff"&&styles.diffButtonActive],onPress:()=>s("diff"),children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffButtonText,children:"Diff"})})]}),o==="old"&&(0,_jsxRuntime.jsx)(DataInspector,{data:e,searchable:false}),o==="new"&&(0,_jsxRuntime.jsx)(DataInspector,{data:t,searchable:false}),o==="diff"&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffPane,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffPaneTitle,children:"Old"}),(0,_jsxRuntime.jsx)(DataInspector,{data:e,searchable:false})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffPane,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.diffPaneTitle,children:"New"}),(0,_jsxRuntime.jsx)(DataInspector,{data:t,searchable:false})]})]})]})};const styles=_reactNative.StyleSheet.create({container:{backgroundColor:_index2.gameUIColors.background,borderRadius:8,overflow:"hidden"},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",padding:8,borderBottomWidth:1,borderBottomColor:_index2.gameUIColors.border+"20"},title:{fontSize:12,fontWeight:"600",color:_index2.gameUIColors.text},controls:{flexDirection:"row",gap:8},searchContainer:{flexDirection:"row",alignItems:"center",backgroundColor:_index2.gameUIColors.panel,borderRadius:4,paddingHorizontal:8,gap:4},searchInput:{fontSize:11,color:_index2.gameUIColors.text,minWidth:100,paddingVertical:4},editButton:{padding:4,borderRadius:4,backgroundColor:_index2.gameUIColors.primary+"20"},cancelButton:{padding:4,borderRadius:4,backgroundColor:_index2.gameUIColors.error+"20"},scrollView:{maxHeight:300},codeText:{fontFamily:_fonts.monoFont,fontSize:11,color:_index2.gameUIColors.text,padding:12,lineHeight:16},editor:{fontFamily:_fonts.monoFont,fontSize:11,color:_index2.gameUIColors.text,padding:12,lineHeight:16,minHeight:200},highlight:{backgroundColor:_index2.gameUIColors.warning+"40",color:_index2.gameUIColors.text},diffControls:{flexDirection:"row",gap:8,padding:8},diffButton:{paddingHorizontal:12,paddingVertical:4,borderRadius:4,backgroundColor:_index2.gameUIColors.panel},diffButtonActive:{backgroundColor:_index2.gameUIColors.primary},diffButtonText:{fontSize:11,color:_index2.gameUIColors.text,fontWeight:"500"},diffContainer:{flexDirection:"row",gap:8},diffPane:{flex:1},diffPaneTitle:{fontSize:10,fontWeight:"600",color:_index2.gameUIColors.secondary,padding:8,textTransform:"uppercase"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DraggableHeader=void 0;var _react=require("react");var _reactNative=require("react-native");var _jsxRuntime=require("react/jsx-runtime");const DraggableHeader=exports.DraggableHeader=(0,_react.memo)(function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DraggableHeader=void 0;var _react=require("react");var _reactNative=require("react-native");var _jsxRuntime=require("react/jsx-runtime");const DraggableHeader=exports.DraggableHeader=(0,_react.memo)(function N({children:H,position:a,onDragStart:R,onDragEnd:m,onTap:i,onLongPress:y,longPressDelay:h=350,containerBounds:g=_reactNative.Dimensions.get("window"),elementSize:b={width:100,height:50},minPosition:p={x:0,y:0},style:T,enabled:P=true,claimOnMove:_=true,onLayout:j,hitSlop:q,maxOverflowX:v=0,testID:S,accessibilityLabel:A}){const t=(0,_react.useRef)(false);const d=(0,_react.useRef)(0);const x=(0,_react.useRef)({x:0,y:0});const n=(0,_react.useRef)(null);const s=(0,_react.useRef)(false);(0,_react.useEffect)(()=>{return()=>{if(n.current!=null){clearTimeout(n.current);n.current=null}}},[]);const r=(0,_react.useRef)({onDragStart:R,onDragEnd:m,onTap:i,onLongPress:y,longPressDelay:h,containerBounds:g,elementSize:b,minPosition:p,enabled:P,claimOnMove:_,maxOverflowX:v});r.current={onDragStart:R,onDragEnd:m,onTap:i,onLongPress:y,longPressDelay:h,containerBounds:g,elementSize:b,minPosition:p,enabled:P,claimOnMove:_,maxOverflowX:v};const E=(0,_react.useMemo)(()=>{const u=()=>{if(n.current!=null){clearTimeout(n.current);n.current=null}};return _reactNative.PanResponder.create({onStartShouldSetPanResponder:()=>r.current.enabled,onMoveShouldSetPanResponder:(o,e)=>r.current.enabled&&r.current.claimOnMove&&(Math.abs(e.dx)>1||Math.abs(e.dy)>1),onPanResponderTerminationRequest:()=>false,onPanResponderGrant:()=>{t.current=false;d.current=0;s.current=false;const o=a.x.__getValue();const e=a.y.__getValue();x.current={x:o,y:e};const{onLongPress:c,longPressDelay:l}=r.current;if(c){n.current=setTimeout(()=>{n.current=null;if(!t.current&&d.current<=5){s.current=true;c()}},l)}},onPanResponderMove:(o,e)=>{const c=Math.abs(e.dx)+Math.abs(e.dy);d.current=c;if(c>5&&!t.current){t.current=true;u();r.current.onDragStart?.()}const l=x.current.x+e.dx;const f=x.current.y+e.dy;a.setValue({x:l,y:f})},onPanResponderRelease:()=>{u();const o=s.current;s.current=false;const e=d.current<=5&&!t.current;if(e){if(!o)r.current.onTap?.();t.current=false;return}const c=a.x.__getValue();const l=a.y.__getValue();const{containerBounds:f,elementSize:M,minPosition:D,maxOverflowX:L,onDragEnd:O}=r.current;const X=f.width-M.width+L;const w=Math.max(D.x,Math.min(c,X));const V=Math.max(D.y,Math.min(l,f.height-M.height));a.setValue({x:w,y:V});O?.({x:w,y:V});t.current=false},onPanResponderTerminate:()=>{u();s.current=false;t.current=false}})},[a]);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:T,onLayout:j,hitSlop:q,testID:S,accessibilityLabel:A,accessibilityRole:i&&_reactNative.Platform.OS!=="web"?"button":void 0,accessibilityActions:i?[{name:"activate",label:"Hide or show"}]:void 0,onAccessibilityAction:u=>{if(u.nativeEvent.actionName==="activate")r.current.onTap?.()},...E.panHandlers,children:H})});
|