@buoy-gg/shared-ui 7.0.78 → 7.0.80
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/lib/commonjs/JsModal.js +1 -1
- package/lib/commonjs/bugCase/appInfo.js +1 -0
- package/lib/commonjs/bugCase/appInfo.web.js +1 -0
- package/lib/commonjs/bugCase/capture.js +1 -1
- package/lib/commonjs/bugCase/format.js +2 -2
- package/lib/commonjs/bugCase/index.js +1 -1
- package/lib/commonjs/bugCase/lock.js +1 -1
- package/lib/commonjs/bugCase/media.js +1 -0
- package/lib/commonjs/bugCase/recorder.js +1 -1
- package/lib/commonjs/bugCase/scrub.js +1 -1
- package/lib/commonjs/bugCase/steps.js +1 -1
- package/lib/commonjs/bugCase/teamKey.js +1 -0
- package/lib/commonjs/bugCase/validate.js +1 -0
- package/lib/commonjs/clipboard/autoDetectClipboard.js +1 -1
- package/lib/commonjs/clipboard/clipboard-impl.js +1 -1
- package/lib/commonjs/clipboard/clipboard-impl.web.js +1 -1
- package/lib/commonjs/clipboard/index.js +1 -1
- package/lib/commonjs/dataViewer/LiveExplorer.js +1 -1
- package/lib/commonjs/dataViewer/VirtualizedDataExplorer.js +1 -1
- package/lib/commonjs/dataViewer/flattenTree.js +1 -0
- package/lib/commonjs/dataViewer/liveEntries.js +1 -0
- package/lib/commonjs/icons/index.js +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/license/BuoyUpgradeSheet.js +1 -1
- package/lib/commonjs/license/index.js +1 -1
- package/lib/commonjs/sync/keyedArrays.js +1 -1
- package/lib/commonjs/sync/valuePath.js +1 -1
- package/lib/commonjs/ui/components/DynamicFilterView.js +1 -1
- package/lib/commonjs/ui/components/EntityFilterView.js +1 -1
- package/lib/commonjs/ui/components/WindowControls.js +1 -1
- package/lib/commonjs/ui/floating/FloatingTool.js +1 -1
- package/lib/commonjs/ui/listPresets.js +1 -1
- package/lib/commonjs/utils/fiberRootAnchor.js +1 -0
- package/lib/commonjs/utils/index.js +1 -1
- package/lib/commonjs/utils/loadOptionalModule.js +1 -1
- package/lib/commonjs/utils/loadToolModule.js +1 -1
- package/lib/commonjs/utils/minimalSuperJSON.js +1 -1
- package/lib/commonjs/utils/persistentStorage.js +1 -1
- package/lib/commonjs/utils/persistentStorage.web.js +1 -1
- package/lib/commonjs/utils/reloadPlatform.js +1 -1
- package/lib/commonjs/utils/snapshotProviderKit.js +1 -1
- package/lib/module/JsModal.js +1 -1
- package/lib/module/bugCase/appInfo.js +1 -0
- package/lib/module/bugCase/appInfo.web.js +1 -0
- package/lib/module/bugCase/capture.js +1 -1
- package/lib/module/bugCase/format.js +2 -2
- package/lib/module/bugCase/index.js +1 -1
- package/lib/module/bugCase/lock.js +1 -1
- package/lib/module/bugCase/media.js +1 -0
- package/lib/module/bugCase/recorder.js +1 -1
- package/lib/module/bugCase/scrub.js +1 -1
- package/lib/module/bugCase/steps.js +1 -1
- package/lib/module/bugCase/teamKey.js +1 -0
- package/lib/module/bugCase/validate.js +1 -0
- package/lib/module/clipboard/autoDetectClipboard.js +1 -1
- package/lib/module/clipboard/clipboard-impl.js +1 -1
- package/lib/module/clipboard/clipboard-impl.web.js +1 -1
- package/lib/module/clipboard/index.js +1 -1
- package/lib/module/dataViewer/LiveExplorer.js +1 -1
- package/lib/module/dataViewer/VirtualizedDataExplorer.js +1 -1
- package/lib/module/dataViewer/flattenTree.js +1 -0
- package/lib/module/dataViewer/liveEntries.js +1 -0
- package/lib/module/icons/index.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/license/BuoyUpgradeSheet.js +1 -1
- package/lib/module/license/index.js +1 -1
- package/lib/module/sync/keyedArrays.js +1 -1
- package/lib/module/sync/valuePath.js +1 -1
- package/lib/module/ui/components/DynamicFilterView.js +1 -1
- package/lib/module/ui/components/EntityFilterView.js +1 -1
- package/lib/module/ui/components/WindowControls.js +1 -1
- package/lib/module/ui/floating/FloatingTool.js +1 -1
- package/lib/module/ui/listPresets.js +1 -1
- package/lib/module/utils/fiberRootAnchor.js +1 -0
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/loadOptionalModule.js +1 -1
- package/lib/module/utils/loadToolModule.js +1 -1
- package/lib/module/utils/minimalSuperJSON.js +1 -1
- package/lib/module/utils/persistentStorage.js +1 -1
- package/lib/module/utils/persistentStorage.web.js +1 -1
- package/lib/module/utils/reloadPlatform.js +1 -1
- package/lib/module/utils/snapshotProviderKit.js +1 -1
- package/lib/typescript/commonjs/JsModal.d.ts +3 -4
- package/lib/typescript/commonjs/JsModal.web.d.ts +2 -0
- package/lib/typescript/commonjs/bugCase/appInfo.d.ts +17 -0
- package/lib/typescript/commonjs/bugCase/appInfo.web.d.ts +14 -0
- package/lib/typescript/commonjs/bugCase/format.d.ts +2 -1
- package/lib/typescript/commonjs/bugCase/index.d.ts +7 -0
- package/lib/typescript/commonjs/bugCase/lock.d.ts +13 -0
- package/lib/typescript/commonjs/bugCase/media.d.ts +90 -0
- package/lib/typescript/commonjs/bugCase/recorder.d.ts +1 -0
- package/lib/typescript/commonjs/bugCase/scrub.d.ts +2 -2
- package/lib/typescript/commonjs/bugCase/steps.d.ts +10 -0
- package/lib/typescript/commonjs/bugCase/teamKey.d.ts +185 -0
- package/lib/typescript/commonjs/bugCase/types.d.ts +10 -0
- package/lib/typescript/commonjs/bugCase/validate.d.ts +14 -0
- package/lib/typescript/commonjs/clipboard/autoDetectClipboard.d.ts +1 -1
- package/lib/typescript/commonjs/clipboard/clipboard-impl.d.ts +6 -0
- package/lib/typescript/commonjs/clipboard/clipboard-impl.web.d.ts +2 -0
- package/lib/typescript/commonjs/clipboard/index.d.ts +1 -1
- package/lib/typescript/commonjs/dataViewer/flattenTree.d.ts +35 -0
- package/lib/typescript/commonjs/dataViewer/liveEntries.d.ts +19 -0
- package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/commonjs/icons/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts +3 -2
- package/lib/typescript/commonjs/license/BuoyUpgradeSheet.d.ts +8 -0
- package/lib/typescript/commonjs/license/index.d.ts +1 -1
- package/lib/typescript/commonjs/sync/keyedArrays.d.ts +6 -1
- package/lib/typescript/commonjs/ui/floating/FloatingTool.d.ts +6 -1
- package/lib/typescript/commonjs/ui/listPresets.d.ts +2 -2
- package/lib/typescript/commonjs/utils/fiberRootAnchor.d.ts +19 -0
- package/lib/typescript/commonjs/utils/index.d.ts +2 -1
- package/lib/typescript/commonjs/utils/minimalSuperJSON.d.ts +4 -2
- package/lib/typescript/commonjs/utils/persistentStorage.d.ts +19 -0
- package/lib/typescript/commonjs/utils/persistentStorage.web.d.ts +17 -0
- package/lib/typescript/module/JsModal.d.ts +3 -4
- package/lib/typescript/module/JsModal.web.d.ts +2 -0
- package/lib/typescript/module/bugCase/appInfo.d.ts +17 -0
- package/lib/typescript/module/bugCase/appInfo.web.d.ts +14 -0
- package/lib/typescript/module/bugCase/format.d.ts +2 -1
- package/lib/typescript/module/bugCase/index.d.ts +7 -0
- package/lib/typescript/module/bugCase/lock.d.ts +13 -0
- package/lib/typescript/module/bugCase/media.d.ts +90 -0
- package/lib/typescript/module/bugCase/recorder.d.ts +1 -0
- package/lib/typescript/module/bugCase/scrub.d.ts +2 -2
- package/lib/typescript/module/bugCase/steps.d.ts +10 -0
- package/lib/typescript/module/bugCase/teamKey.d.ts +185 -0
- package/lib/typescript/module/bugCase/types.d.ts +10 -0
- package/lib/typescript/module/bugCase/validate.d.ts +14 -0
- package/lib/typescript/module/clipboard/autoDetectClipboard.d.ts +1 -1
- package/lib/typescript/module/clipboard/clipboard-impl.d.ts +6 -0
- package/lib/typescript/module/clipboard/clipboard-impl.web.d.ts +2 -0
- package/lib/typescript/module/clipboard/index.d.ts +1 -1
- package/lib/typescript/module/dataViewer/flattenTree.d.ts +35 -0
- package/lib/typescript/module/dataViewer/liveEntries.d.ts +19 -0
- package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/module/icons/index.d.ts +1 -0
- package/lib/typescript/module/index.d.ts +3 -2
- package/lib/typescript/module/license/BuoyUpgradeSheet.d.ts +8 -0
- package/lib/typescript/module/license/index.d.ts +1 -1
- package/lib/typescript/module/sync/keyedArrays.d.ts +6 -1
- package/lib/typescript/module/ui/floating/FloatingTool.d.ts +6 -1
- package/lib/typescript/module/ui/listPresets.d.ts +2 -2
- package/lib/typescript/module/utils/fiberRootAnchor.d.ts +19 -0
- package/lib/typescript/module/utils/index.d.ts +2 -1
- package/lib/typescript/module/utils/minimalSuperJSON.d.ts +4 -2
- package/lib/typescript/module/utils/persistentStorage.d.ts +19 -0
- package/lib/typescript/module/utils/persistentStorage.web.d.ts +17 -0
- package/lib/web/chunks/chunk-36A4T5PL.mjs +1 -0
- package/lib/web/chunks/{chunk-XUYN4NOF.mjs → chunk-5UII72AQ.mjs} +1 -1
- package/lib/web/chunks/chunk-A3N3WVKC.mjs +1 -0
- package/lib/web/chunks/chunk-BPL65J3F.mjs +1 -0
- package/lib/web/chunks/chunk-EY7GXWGI.mjs +1 -1
- package/lib/web/chunks/chunk-IE2U5SN2.mjs +15 -0
- package/lib/web/chunks/chunk-IEAXJZCR.mjs +6 -0
- package/lib/web/chunks/chunk-OF3VWR6K.mjs +2 -2
- package/lib/web/chunks/{chunk-OVTASJUJ.mjs → chunk-SUG6TLF5.mjs} +1 -1
- package/lib/web/chunks/chunk-SXWOOYFL.mjs +1 -0
- package/lib/web/chunks/chunk-T44OT3CI.mjs +6 -0
- package/lib/web/chunks/{chunk-OQB3GW44.mjs → chunk-UVVRCZX5.mjs} +1 -1
- package/lib/web/chunks/chunk-Y7FM4WZ7.mjs +6 -0
- package/lib/web/chunks/persistentStorage.web-BFPYMY5C.mjs +1 -0
- package/lib/web/dataViewer.mjs +2 -2
- package/lib/web/history.mjs +1 -1
- package/lib/web/hooks.mjs +1 -1
- package/lib/web/index.mjs +12 -6
- package/lib/web/ui.mjs +1 -1
- package/lib/web/utils.mjs +1 -1
- package/package.json +5 -5
- package/scripts/detect-clipboard.js +18 -2
- package/lib/web/chunks/chunk-BMITMQVB.mjs +0 -6
- package/lib/web/chunks/chunk-DJD42EPL.mjs +0 -1
- package/lib/web/chunks/chunk-GN75GBYZ.mjs +0 -1
- package/lib/web/chunks/chunk-GTRVOJUH.mjs +0 -1
- package/lib/web/chunks/chunk-HE5ONCAL.mjs +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.parsePath=parsePath;exports.patchFromPath=patchFromPath;exports.readPath=readPath;var _keyedArrays=require("./keyedArrays.js");const isPlainObject=r=>typeof r==="object"&&r!==null&&!Array.isArray(r);function findFieldPath(r,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.parsePath=parsePath;exports.patchFromPath=patchFromPath;exports.readPath=readPath;var _keyedArrays=require("./keyedArrays.js");const isPlainObject=r=>typeof r==="object"&&r!==null&&!Array.isArray(r);function findFieldPath(r,s,n=2e3){const e=[{node:r,path:""}];let f=0;while(e.length&&f<n){const{node:i,path:d}=e.shift();f++;if(Array.isArray(i)){i.slice(0,20).forEach((t,l)=>e.push({node:t,path:`${d}[${l}]`}))}else if(isPlainObject(i)){for(const[t,l]of Object.entries(i)){const o=d?`${d}.${t}`:t;if(t===s)return o;if(isPlainObject(l)||Array.isArray(l))e.push({node:l,path:o})}}}return void 0}function missingFieldError(r,s,n,e,f){const i=findFieldPath(r,f??n);const d=e.slice(0,12).join(", ")||"(no fields)";return i?`No field "${n}" at "${s}" \u2014 did you mean path "${i}"? "${s}" has: ${d}.`:`No field "${n}" at "${s}". It has: ${d}.`}function fieldOf(r,s){let n=r;for(const e of s.split(".")){if(!isPlainObject(n))return void 0;n=n[e]}return n}function parsePath(r){if(!r.trim())return void 0;const s=[];let n=0;while(n<r.length){if(r[n]==="."){n++;continue}if(r[n]==="["){const i=r.indexOf("]",n);if(i===-1)return void 0;const d=r.slice(n+1,i);if(/^\d+$/.test(d))s.push({kind:"index",index:Number(d)});else{const t=d.indexOf("=");if(t<=0)return void 0;s.push({kind:"match",field:d.slice(0,t).trim(),value:d.slice(t+1).trim()})}n=i+1;continue}let e=n;while(e<r.length&&r[e]!=="."&&r[e]!=="[")e++;const f=r.slice(n,e);if(!f)return void 0;s.push({kind:"key",key:f});n=e}return s.length?s:void 0}function readPath(r,s){const n=parsePath(s);if(!n)return{ok:false,error:`Could not read the path "${s}". Use dotted keys with optional [0] or [field=value], like "item.name" or "lines[lineId=seed-1].qty".`};let e=r;const f=[];for(const i of n){if(e===null||e===void 0){return{ok:false,error:`"${f.join(".")||"(root)"}" is ${e===null?"null":"not set"}, so there is nothing at "${s}".`}}if(i.kind==="key"){if(!isPlainObject(e))return{ok:false,error:`"${f.join(".")||"(root)"}" is not an object, so it has no field "${i.key}".`};if(!(i.key in e)){const d=n[n.length-1];return{ok:false,error:missingFieldError(r,f.join(".")||"(root)",i.key,Object.keys(e),d?.kind==="key"?d.key:void 0)}}e=e[i.key];f.push(i.key)}else if(i.kind==="index"){if(!Array.isArray(e))return{ok:false,error:`"${f.join(".")||"(root)"}" is not a list, so [${i.index}] means nothing.`};e=e[i.index];f.push(`[${i.index}]`)}else{if(!Array.isArray(e))return{ok:false,error:`"${f.join(".")||"(root)"}" is not a list, so [${i.field}=${i.value}] means nothing.`};const d=e.find(t=>isPlainObject(t)&&String(fieldOf(t,i.field))===i.value);if(d===void 0)return{ok:false,error:`No item with ${i.field}="${i.value}" in "${f.join(".")||"(root)"}".`};e=d;f.push(`[${i.field}=${i.value}]`)}}return{ok:true,value:e}}function patchFromPath(r,s,n){const e=parsePath(s);if(!e)return{ok:false,error:`Could not read the path "${s}". Use dotted keys with optional [0] or [field=value], like "item.name" or "lines[lineId=seed-1].qty".`};if(e[0]?.kind!=="key"&&!Array.isArray(r))return{ok:false,error:`A path must start with a field name, not a list index \u2014 "${s}" does not say which list.`};const f=(t,l)=>{if(l>=e.length)return{ok:true,patch:n};const o=e[l];if(o.kind==="key"){if(isPlainObject(t)&&!(o.key in t)&&l+1<e.length){const g=e[e.length-1];return{ok:false,error:missingFieldError(r,pathUpTo(e,l),o.key,Object.keys(t),g?.kind==="key"?g.key:void 0)}}const k=isPlainObject(t)?t[o.key]:void 0;const y=f(k,l+1);return y.ok?{ok:true,patch:{[o.key]:y.patch}}:y}if(!Array.isArray(t)){return{ok:false,error:`"${pathUpTo(e,l)}" is not a list, so "${s}" cannot be resolved. Read it first \u2014 \`shape\` on the read says what each field holds.`}}const u=o.kind==="index"?o.index:t.findIndex(k=>isPlainObject(k)&&String(fieldOf(k,o.field))===o.value);const a=u>=0?t[u]:void 0;const h=o.kind==="index"?u<0||u>=t.length:u<0;if(h){return{ok:false,error:o.kind==="index"?`"${pathUpTo(e,l)}" has ${t.length} item(s), so there is nothing at [${o.index}].`:`No item with ${o.field}="${o.value}" in "${pathUpTo(e,l)}".`}}if(!isPlainObject(a)){if(l<e.length-1){return{ok:false,error:`"${pathUpTo(e,l)}[${o.kind==="index"?o.index:`${o.field}=${o.value}`}]" holds ${a===null?"null":typeof a}, not an object, so "${s}" cannot go any deeper. Set the item itself.`}}const k=t.slice();k[u]=n;return{ok:true,patch:k}}const c=f(a,l+1);if(!c.ok)return c;const $=(0,_keyedArrays.identityField)(t);if($)return{ok:true,patch:{[String(a[$])]:c.patch}};const p=t.slice();p[u]=i(a,l+1);return{ok:true,patch:p}};const i=(t,l)=>{if(l>=e.length)return n;const o=e[l];if(o.kind==="key"){const c=isPlainObject(t)?t:{};return{...c,[o.key]:i(c[o.key],l+1)}}const u=t;const a=o.kind==="index"?o.index:u.findIndex(c=>isPlainObject(c)&&String(fieldOf(c,o.field))===o.value);const h=u.slice();h[a]=i(u[a],l+1);return h};const d=f(r,0);if(!d.ok)return d;return{ok:true,patch:d.patch}}function pathUpTo(r,s){return r.slice(0,s).map(n=>n.kind==="key"?n.key:n.kind==="index"?`[${n.index}]`:`[${n.field}=${n.value}]`).join(".").replace(/\.\[/g,"[")||"(root)"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DynamicFilterView=DynamicFilterView;var _reactNative=require("react-native");var _react=require("react");var _index=require("../../icons/index.js");var _SectionHeader=require("./SectionHeader.js");var _FilterComponents=require("./FilterComponents.js");var _useFilterManager=require("../../hooks/useFilterManager.js");var _gameUIColors=require("../gameUI/constants/gameUIColors.js");var _nightTheme=require("../night/nightTheme.js");var _fonts=require("../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function DynamicFilterView({sections:y=[],filterSummarySection:l,addFilterSection:h,includeOnlySection:t,availableItemsSection:c,howItWorksSection:a,previewSection:d,onFilterChange:b,onPatternToggle:f,onPatternAdd:g,activePatterns:n=new Set,renderPatternMeta:C,tabs:s,activeTab:T,onTabChange:p}){const o=(0,_useFilterManager.useFilterManager)(n);const i=(0,_useFilterManager.useFilterManager)(t?.patterns||new Set);const[j,w]=(0,_react.useState)(s?.[0]?.id||"");const u=T||j;(0,_react.useEffect)(()=>{if(n.size!==o.filters.size||!Array.from(n).every(e=>o.filters.has(e))){}},[n,o.filters]);const S=()=>{if(o.newFilter.trim()&&g){g(o.newFilter.trim());o.addFilter(o.newFilter)}};const F=()=>{if(i.newFilter.trim()&&t?.onPatternAdd){t.onPatternAdd(i.newFilter.trim());i.addFilter(i.newFilter)}};const x=c?.items?.filter(e=>{return!Array.from(n).some(r=>e.includes(r))})||[];const z=()=>{if(!s||s.length===0)return null;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tabContainer,children:s.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{onPress:()=>{if(p)p(e.id);else w(e.id)},style:[styles.tabButton,u===e.id?styles.tabButtonActive:styles.tabButtonInactive],children:[e.icon&&(0,_jsxRuntime.jsx)(e.icon,{size:14,color:u===e.id?_gameUIColors.buoyColors.primary:_nightTheme.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.tabButtonText,u===e.id?styles.tabButtonTextActive:styles.tabButtonTextInactive],children:e.label}),e.count!==void 0&&e.count>0&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tabBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tabBadgeText,children:e.count})})]},e.id))})};const I=e=>{if(e.type==="custom"&&e.renderCustom){return e.renderCustom()}if(e.type==="patterns"){return null}if(!e.data||e.data.length===0)return null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[e.icon&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:e.icon,color:e.color||_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:e.title})]}),e.description&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionDescription,children:e.description}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.filterGrid,children:e.data.map(r=>{const m=r.count!==void 0;const v=m&&r.count===0;const B=e.type!=="method"||r.icon;return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{testID:`buoy-filter-option-${r.id}`,accessibilityRole:"button",accessibilityLabel:String(r.label??r.id),style:[styles.filterCard,r.isActive&&styles.activeFilterCard],onPress:()=>b?.(r.id,r.value),children:[r.icon?(0,_jsxRuntime.jsx)(r.icon,{size:24,color:r.color,style:styles.filterIcon}):e.type==="method"?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.methodBadgeCompact,{backgroundColor:`${r.color}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.methodTextCompact,{color:r.color}],numberOfLines:1,adjustsFontSizeToFit:true,minimumFontScale:.8,children:r.label})}):null,m&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[v?styles.filterCountZero:styles.filterCountActive],children:r.count}),B&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.filterLabelCompact,children:r.label}),r.description&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.filterDescriptionBottom,children:r.description})]},r.id)})})]},e.id)};const H=()=>{if(s&&u){const e=s.find(r=>r.id===u);if(e?.content){return e.content()}}return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[l?.enabled&&(l.includePatterns?.size||l.excludePatterns?.size)?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.filterSummarySection,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.filterSummaryHeader,children:[(0,_jsxRuntime.jsx)(_index.Info,{size:14,color:_gameUIColors.buoyColors.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.filterSummaryTitle,children:"Filters Active"})]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.filterSummaryText,children:["Showing ",l.filteredCount," of ",l.totalCount," queries",l.includePatterns?.size?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.filterSummaryInclude,children:[" ","\u2022 Including: ",Array.from(l.includePatterns).join(", ")]}):null,l.excludePatterns?.size?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.filterSummaryExclude,children:[" ","\u2022 Excluding: ",Array.from(l.excludePatterns).join(", ")]}):null]})]}):null,y.map(I),t?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.includeOnlySection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:t.icon||_index.Eye,color:_gameUIColors.buoyColors.success,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:t.title||"INCLUDE ONLY FILTERS"}),t.patterns.size>0&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:t.patterns.size,color:_gameUIColors.buoyColors.success})]}),t.description&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.includeOnlyDescription,children:t.description}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.includeOnlyInputWrapper,children:!i.showAddInput?(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterButton,{onPress:()=>i.setShowAddInput(true),color:_gameUIColors.buoyColors.success,label:"Add include pattern",testID:"buoy-filter-include-add-open"}):(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterInput,{value:i.newFilter,onChange:i.setNewFilter,onSubmit:F,onCancel:()=>{i.setShowAddInput(false);i.setNewFilter("")},placeholder:t.placeholder||"Enter pattern to include...",color:_gameUIColors.buoyColors.success,testID:"buoy-filter-include-input"})}),t.patterns.size>0&&(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",testID:"buoy-filter-include-scroll",style:styles.includeOnlyFiltersContent,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,children:(0,_jsxRuntime.jsx)(_FilterComponents.FilterList,{filters:t.patterns,onRemoveFilter:t.onPatternToggle,color:_gameUIColors.buoyColors.success,renderItemMeta:t.renderPatternMeta})})]}),h?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.excludeFiltersSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:_index.Filter,color:_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:h.title||"EXCLUDE FILTERS"}),n.size>0&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:n.size,color:_gameUIColors.buoyColors.primary})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.excludeFiltersDescription,children:"Hide queries matching these patterns from the list."}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.excludeFiltersInputWrapper,children:!o.showAddInput?(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterButton,{onPress:()=>o.setShowAddInput(true),color:_gameUIColors.buoyColors.primary,label:"Add exclude pattern"}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[h.renderExtra?.(),(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterInput,{value:o.newFilter,onChange:o.setNewFilter,onSubmit:S,onCancel:()=>{o.setShowAddInput(false);o.setNewFilter("")},placeholder:h.placeholder||"Enter pattern to exclude...",color:_gameUIColors.buoyColors.primary})]})}),n.size>0&&(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",testID:"buoy-filter-active-scroll",style:styles.excludeFiltersContent,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,children:(0,_jsxRuntime.jsx)(_FilterComponents.FilterList,{filters:n,onRemoveFilter:f,color:_gameUIColors.buoyColors.primary,renderItemMeta:C})})]}),c?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.availableKeysSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:c.icon||_index.Plus,color:_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:c.title||"AVAILABLE ITEMS"}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:x.length,color:_gameUIColors.buoyColors.primary})]}),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.availableKeysScroll,horizontal:false,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,scrollEnabled:true,children:x.length>0?x.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{onPress:()=>{if(g){g(e);o.addFilter(e)}},style:styles.availableKeyItem,"sentry-label":"ignore-touchable-opacity",testID:`buoy-filter-available-${e}`,accessibilityRole:"button",accessibilityLabel:`Add filter ${e}`,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.availableKeyText,numberOfLines:1,children:e}),(0,_jsxRuntime.jsx)(_index.Plus,{size:12,color:_gameUIColors.buoyColors.primary})]},e)):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyStateText,children:c.emptyMessage||"No items available"})})]}),a?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.howItWorksSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:a.icon||_index.Filter,color:_nightTheme.night.color.textSecondary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:a.title||"HOW FILTERS WORK"})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.howItWorksText,children:a.description||"Filters help you focus on relevant data by hiding unwanted items."}),a.examples&&a.examples.length>0&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.examplesContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.examplesTitle,children:"EXAMPLES:"}),a.examples.map((e,r)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.exampleItem,children:e},r))]})]}),d?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.previewSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:d.icon||_index.Copy,color:_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:d.title||"PREVIEW"}),d.headerActions&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Actions,{children:d.headerActions()})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.previewContent,children:d.content()})]})]})};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[z(),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",testID:"buoy-filter-scroll",style:styles.content,contentContainerStyle:styles.scrollContent,showsVerticalScrollIndicator:false,"sentry-label":"ignore-scrollview",children:H()})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},content:{flex:1},scrollContent:{paddingTop:16,paddingHorizontal:16,paddingBottom:24},tabContainer:{flexDirection:"row",paddingHorizontal:16,paddingVertical:12,gap:8,backgroundColor:_nightTheme.night.color.surface,borderBottomWidth:1,borderBottomColor:_nightTheme.night.color.border},tabButton:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,paddingHorizontal:16,borderRadius:8,borderWidth:1},tabButtonActive:{backgroundColor:_gameUIColors.buoyColors.primary+"20",borderColor:_gameUIColors.buoyColors.primary,borderWidth:2},tabButtonInactive:{backgroundColor:_nightTheme.night.color.surfaceElevated,borderColor:_nightTheme.night.color.border},tabButtonText:{fontSize:11,fontWeight:"600",letterSpacing:.5},tabButtonTextActive:{color:_gameUIColors.buoyColors.primary},tabButtonTextInactive:{color:_nightTheme.night.color.textTertiary},tabBadge:{backgroundColor:_gameUIColors.buoyColors.primary+"40",paddingHorizontal:6,paddingVertical:1,borderRadius:8,minWidth:18,alignItems:"center"},tabBadgeText:{fontSize:9,color:_gameUIColors.buoyColors.primary,fontWeight:"700"},section:{marginBottom:8},filterInputWrapper:{marginBottom:4},filterGrid:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:8},filterCard:{backgroundColor:_nightTheme.night.color.surface,borderRadius:12,paddingHorizontal:8,paddingVertical:10,flexDirection:"column",alignItems:"center",justifyContent:"center",borderWidth:1,borderColor:_nightTheme.night.color.border,width:72,minHeight:68},activeFilterCard:{backgroundColor:_gameUIColors.buoyColors.primary+"33",borderColor:_gameUIColors.buoyColors.primary,borderWidth:2,shadowColor:_gameUIColors.buoyColors.primary,shadowOffset:{width:0,height:0},shadowOpacity:.3,shadowRadius:8,elevation:4},filterIcon:{marginBottom:0},filterCountActive:{fontSize:14,fontWeight:"700",color:_nightTheme.night.color.text,fontFamily:_fonts.monoFont,marginTop:3,marginBottom:1,textShadowColor:"rgba(0, 0, 0, 0.2)",textShadowOffset:{width:0,height:.5},textShadowRadius:1},filterCountZero:{fontSize:11,fontWeight:"500",color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,marginTop:3,marginBottom:1},filterLabelCompact:{fontSize:10,color:_nightTheme.night.color.text,fontWeight:"600",textAlign:"center",textTransform:"capitalize",textShadowColor:"rgba(0, 0, 0, 0.3)",textShadowOffset:{width:0,height:.5},textShadowRadius:1},filterDescriptionBottom:{fontSize:8,color:_nightTheme.night.color.textTertiary,textAlign:"center",marginTop:2,lineHeight:11},sectionDescription:{fontSize:10,color:_nightTheme.night.color.textSecondary,marginTop:4,marginBottom:4,lineHeight:14},methodBadgeCompact:{paddingHorizontal:8,paddingVertical:4,borderRadius:5,minWidth:48,maxWidth:60,alignItems:"center",justifyContent:"center"},methodTextCompact:{fontSize:13,fontWeight:"700",letterSpacing:.3,fontFamily:_fonts.monoFont},activeFiltersSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},activeFiltersContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:16,maxHeight:200},includeOnlySection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},includeOnlyDescription:{fontSize:10,color:_nightTheme.night.color.textSecondary,paddingHorizontal:16,paddingTop:8,lineHeight:14},includeOnlyInputWrapper:{paddingHorizontal:16,paddingTop:8,paddingBottom:8},includeOnlyFiltersContent:{paddingHorizontal:16,paddingBottom:16,maxHeight:150},excludeFiltersSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},excludeFiltersDescription:{fontSize:10,color:_nightTheme.night.color.textSecondary,paddingHorizontal:16,paddingTop:8,lineHeight:14},excludeFiltersInputWrapper:{paddingHorizontal:16,paddingTop:8,paddingBottom:8},excludeFiltersContent:{paddingHorizontal:16,paddingBottom:16,maxHeight:150},filterSummarySection:{backgroundColor:_gameUIColors.buoyColors.warning+"15",borderRadius:8,borderWidth:1,borderColor:_gameUIColors.buoyColors.warning+"40",padding:12,marginBottom:12},filterSummaryHeader:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:6},filterSummaryTitle:{fontSize:12,fontWeight:"600",color:_gameUIColors.buoyColors.warning},filterSummaryText:{fontSize:11,color:_nightTheme.night.color.text,lineHeight:16},filterSummaryInclude:{color:_gameUIColors.buoyColors.success,fontWeight:"500"},filterSummaryExclude:{color:_gameUIColors.buoyColors.primary,fontWeight:"500"},emptyStateText:{fontSize:11,color:_nightTheme.night.color.textTertiary,fontStyle:"italic",textAlign:"center",paddingVertical:12},availableKeysSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},availableKeysScroll:{maxHeight:150,paddingHorizontal:16,paddingTop:8,paddingBottom:16},availableKeyItem:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,paddingHorizontal:12,backgroundColor:_nightTheme.night.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border,marginBottom:8},availableKeyText:{flex:1,fontSize:11,color:_nightTheme.night.color.text,fontFamily:_fonts.monoFont,marginRight:8},howItWorksSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},howItWorksText:{fontSize:11,color:_nightTheme.night.color.textSecondary,lineHeight:16,marginBottom:12,marginTop:8,paddingHorizontal:16,fontFamily:_fonts.monoFont},examplesContainer:{paddingTop:8,paddingHorizontal:16,paddingBottom:16,borderTopWidth:1,borderTopColor:_nightTheme.night.color.border},examplesTitle:{fontSize:10,fontWeight:"600",color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,letterSpacing:.5,marginBottom:6},exampleItem:{fontSize:10,color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,lineHeight:16},previewSection:{backgroundColor:_nightTheme.night.color.surfaceElevated,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.fillTertiary,marginTop:16,overflow:"hidden"},previewContent:{paddingHorizontal:16,paddingTop:12,paddingBottom:16,backgroundColor:_nightTheme.night.color.bg,marginHorizontal:12,marginBottom:12,borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border}});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DynamicFilterView=DynamicFilterView;var _reactNative=require("react-native");var _react=require("react");var _index=require("../../icons/index.js");var _SectionHeader=require("./SectionHeader.js");var _FilterComponents=require("./FilterComponents.js");var _useFilterManager=require("../../hooks/useFilterManager.js");var _gameUIColors=require("../gameUI/constants/gameUIColors.js");var _nightTheme=require("../night/nightTheme.js");var _fonts=require("../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function DynamicFilterView({sections:H=[],filterSummarySection:n,addFilterSection:h,includeOnlySection:t,availableItemsSection:c,howItWorksSection:a,previewSection:d,onFilterChange:v,onPatternToggle:B,onPatternAdd:g,activePatterns:l=new Set,renderPatternMeta:A,tabs:s,activeTab:V,onTabChange:b}){const o=(0,_useFilterManager.useFilterManager)(l);const i=(0,_useFilterManager.useFilterManager)(t?.patterns||new Set);const[W,R]=(0,_react.useState)(s?.[0]?.id||"");const u=V||W;const f=(0,_react.useRef)(null);const C=(0,_react.useRef)(0);const T=(0,_react.useRef)(null);const j=(0,_react.useRef)(null);const w=i.showAddInput;const S=o.showAddInput;const F=e=>{if(!e||_reactNative.Platform.OS!=="ios")return()=>{};let r;const x=()=>{const I=_reactNative.Keyboard.metrics()?.screenY;if(I==null)return;e.measureInWindow((M,_,q,K)=>{const z=_+K-(I-16);if(z<=0)return;f.current?.scrollTo({y:C.current+z,animated:true})})};const m=()=>{clearTimeout(r);r=setTimeout(x,300)};if(_reactNative.Keyboard.isVisible())m();const y=_reactNative.Keyboard.addListener("keyboardDidShow",m);return()=>{clearTimeout(r);y.remove()}};(0,_react.useEffect)(()=>w?F(T.current):void 0,[w]);(0,_react.useEffect)(()=>S?F(j.current):void 0,[S]);(0,_react.useEffect)(()=>{if(l.size!==o.filters.size||!Array.from(l).every(e=>o.filters.has(e))){}},[l,o.filters]);const E=()=>{if(o.newFilter.trim()&&g){g(o.newFilter.trim());o.addFilter(o.newFilter)}};const D=()=>{if(i.newFilter.trim()&&t?.onPatternAdd){t.onPatternAdd(i.newFilter.trim());i.addFilter(i.newFilter)}};const p=c?.items?.filter(e=>{return!Array.from(l).some(r=>e.includes(r))})||[];const k=()=>{if(!s||s.length===0)return null;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tabContainer,children:s.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{onPress:()=>{if(b)b(e.id);else R(e.id)},style:[styles.tabButton,u===e.id?styles.tabButtonActive:styles.tabButtonInactive],children:[e.icon&&(0,_jsxRuntime.jsx)(e.icon,{size:14,color:u===e.id?_gameUIColors.buoyColors.primary:_nightTheme.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.tabButtonText,u===e.id?styles.tabButtonTextActive:styles.tabButtonTextInactive],children:e.label}),e.count!==void 0&&e.count>0&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tabBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.tabBadgeText,children:e.count})})]},e.id))})};const L=e=>{if(e.type==="custom"&&e.renderCustom){return e.renderCustom()}if(e.type==="patterns"){return null}if(!e.data||e.data.length===0)return null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[e.icon&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:e.icon,color:e.color||_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:e.title})]}),e.description&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionDescription,children:e.description}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.filterGrid,children:e.data.map(r=>{const x=r.count!==void 0;const m=x&&r.count===0;const y=e.type!=="method"||r.icon;return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{testID:`buoy-filter-option-${r.id}`,accessibilityRole:"button",accessibilityLabel:String(r.label??r.id),style:[styles.filterCard,r.isActive&&styles.activeFilterCard],onPress:()=>v?.(r.id,r.value),children:[r.icon?(0,_jsxRuntime.jsx)(r.icon,{size:24,color:r.color,style:styles.filterIcon}):e.type==="method"?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.methodBadgeCompact,{backgroundColor:`${r.color}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.methodTextCompact,{color:r.color}],numberOfLines:1,adjustsFontSizeToFit:true,minimumFontScale:.8,children:r.label})}):null,x&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[m?styles.filterCountZero:styles.filterCountActive],children:r.count}),y&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.filterLabelCompact,children:r.label}),r.description&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.filterDescriptionBottom,children:r.description})]},r.id)})})]},e.id)};const P=()=>{if(s&&u){const e=s.find(r=>r.id===u);if(e?.content){return e.content()}}return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[n?.enabled&&(n.includePatterns?.size||n.excludePatterns?.size)?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.filterSummarySection,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.filterSummaryHeader,children:[(0,_jsxRuntime.jsx)(_index.Info,{size:14,color:_gameUIColors.buoyColors.warning}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.filterSummaryTitle,children:"Filters Active"})]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.filterSummaryText,children:["Showing ",n.filteredCount," of ",n.totalCount," queries",n.includePatterns?.size?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.filterSummaryInclude,children:[" ","\u2022 Including: ",Array.from(n.includePatterns).join(", ")]}):null,n.excludePatterns?.size?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.filterSummaryExclude,children:[" ","\u2022 Excluding: ",Array.from(n.excludePatterns).join(", ")]}):null]})]}):null,H.map(L),t?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.includeOnlySection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:t.icon||_index.Eye,color:_gameUIColors.buoyColors.success,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:t.title||"INCLUDE ONLY FILTERS"}),t.patterns.size>0&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:t.patterns.size,color:_gameUIColors.buoyColors.success})]}),t.description&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.includeOnlyDescription,children:t.description}),(0,_jsxRuntime.jsx)(_reactNative.View,{ref:T,style:styles.includeOnlyInputWrapper,children:!i.showAddInput?(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterButton,{onPress:()=>i.setShowAddInput(true),color:_gameUIColors.buoyColors.success,label:"Add include pattern",testID:"buoy-filter-include-add-open"}):(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterInput,{value:i.newFilter,onChange:i.setNewFilter,onSubmit:D,onCancel:()=>{i.setShowAddInput(false);i.setNewFilter("")},placeholder:t.placeholder||"Enter pattern to include...",color:_gameUIColors.buoyColors.success,testID:"buoy-filter-include-input"})}),t.patterns.size>0&&(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",testID:"buoy-filter-include-scroll",style:styles.includeOnlyFiltersContent,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,children:(0,_jsxRuntime.jsx)(_FilterComponents.FilterList,{filters:t.patterns,onRemoveFilter:t.onPatternToggle,color:_gameUIColors.buoyColors.success,renderItemMeta:t.renderPatternMeta})})]}),h?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.excludeFiltersSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:_index.Filter,color:_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:h.title||"EXCLUDE FILTERS"}),l.size>0&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:l.size,color:_gameUIColors.buoyColors.primary})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.excludeFiltersDescription,children:"Hide queries matching these patterns from the list."}),(0,_jsxRuntime.jsx)(_reactNative.View,{ref:j,style:styles.excludeFiltersInputWrapper,children:!o.showAddInput?(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterButton,{onPress:()=>o.setShowAddInput(true),color:_gameUIColors.buoyColors.primary,label:"Add exclude pattern"}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[h.renderExtra?.(),(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterInput,{value:o.newFilter,onChange:o.setNewFilter,onSubmit:E,onCancel:()=>{o.setShowAddInput(false);o.setNewFilter("")},placeholder:h.placeholder||"Enter pattern to exclude...",color:_gameUIColors.buoyColors.primary})]})}),l.size>0&&(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",testID:"buoy-filter-active-scroll",style:styles.excludeFiltersContent,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,children:(0,_jsxRuntime.jsx)(_FilterComponents.FilterList,{filters:l,onRemoveFilter:B,color:_gameUIColors.buoyColors.primary,renderItemMeta:A})})]}),c?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.availableKeysSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:c.icon||_index.Plus,color:_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:c.title||"AVAILABLE ITEMS"}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:p.length,color:_gameUIColors.buoyColors.primary})]}),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",style:styles.availableKeysScroll,horizontal:false,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,scrollEnabled:true,children:p.length>0?p.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{onPress:()=>{if(g){g(e);o.addFilter(e)}},style:styles.availableKeyItem,"sentry-label":"ignore-touchable-opacity",testID:`buoy-filter-available-${e}`,accessibilityRole:"button",accessibilityLabel:`Add filter ${e}`,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.availableKeyText,numberOfLines:1,children:e}),(0,_jsxRuntime.jsx)(_index.Plus,{size:12,color:_gameUIColors.buoyColors.primary})]},e)):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyStateText,children:c.emptyMessage||"No items available"})})]}),a?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.howItWorksSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:a.icon||_index.Filter,color:_nightTheme.night.color.textSecondary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:a.title||"HOW FILTERS WORK"})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.howItWorksText,children:a.description||"Filters help you focus on relevant data by hiding unwanted items."}),a.examples&&a.examples.length>0&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.examplesContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.examplesTitle,children:"EXAMPLES:"}),a.examples.map((e,r)=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.exampleItem,children:e},r))]})]}),d?.enabled&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.previewSection,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:d.icon||_index.Copy,color:_gameUIColors.buoyColors.primary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:d.title||"PREVIEW"}),d.headerActions&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Actions,{children:d.headerActions()})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.previewContent,children:d.content()})]})]})};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[k(),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{ref:f,onScroll:e=>{C.current=e.nativeEvent.contentOffset.y},scrollEventThrottle:32,keyboardShouldPersistTaps:"handled",testID:"buoy-filter-scroll",style:styles.content,contentContainerStyle:styles.scrollContent,showsVerticalScrollIndicator:false,"sentry-label":"ignore-scrollview",children:P()})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},content:{flex:1},scrollContent:{paddingTop:16,paddingHorizontal:16,paddingBottom:24},tabContainer:{flexDirection:"row",paddingHorizontal:16,paddingVertical:12,gap:8,backgroundColor:_nightTheme.night.color.surface,borderBottomWidth:1,borderBottomColor:_nightTheme.night.color.border},tabButton:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:6,paddingVertical:10,paddingHorizontal:16,borderRadius:8,borderWidth:1},tabButtonActive:{backgroundColor:_gameUIColors.buoyColors.primary+"20",borderColor:_gameUIColors.buoyColors.primary,borderWidth:2},tabButtonInactive:{backgroundColor:_nightTheme.night.color.surfaceElevated,borderColor:_nightTheme.night.color.border},tabButtonText:{fontSize:11,fontWeight:"600",letterSpacing:.5},tabButtonTextActive:{color:_gameUIColors.buoyColors.primary},tabButtonTextInactive:{color:_nightTheme.night.color.textTertiary},tabBadge:{backgroundColor:_gameUIColors.buoyColors.primary+"40",paddingHorizontal:6,paddingVertical:1,borderRadius:8,minWidth:18,alignItems:"center"},tabBadgeText:{fontSize:9,color:_gameUIColors.buoyColors.primary,fontWeight:"700"},section:{marginBottom:8},filterInputWrapper:{marginBottom:4},filterGrid:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:8},filterCard:{backgroundColor:_nightTheme.night.color.surface,borderRadius:12,paddingHorizontal:8,paddingVertical:10,flexDirection:"column",alignItems:"center",justifyContent:"center",borderWidth:1,borderColor:_nightTheme.night.color.border,width:72,minHeight:68},activeFilterCard:{backgroundColor:_gameUIColors.buoyColors.primary+"33",borderColor:_gameUIColors.buoyColors.primary,borderWidth:2,shadowColor:_gameUIColors.buoyColors.primary,shadowOffset:{width:0,height:0},shadowOpacity:.3,shadowRadius:8,elevation:4},filterIcon:{marginBottom:0},filterCountActive:{fontSize:14,fontWeight:"700",color:_nightTheme.night.color.text,fontFamily:_fonts.monoFont,marginTop:3,marginBottom:1,textShadowColor:"rgba(0, 0, 0, 0.2)",textShadowOffset:{width:0,height:.5},textShadowRadius:1},filterCountZero:{fontSize:11,fontWeight:"500",color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,marginTop:3,marginBottom:1},filterLabelCompact:{fontSize:10,color:_nightTheme.night.color.text,fontWeight:"600",textAlign:"center",textTransform:"capitalize",textShadowColor:"rgba(0, 0, 0, 0.3)",textShadowOffset:{width:0,height:.5},textShadowRadius:1},filterDescriptionBottom:{fontSize:8,color:_nightTheme.night.color.textTertiary,textAlign:"center",marginTop:2,lineHeight:11},sectionDescription:{fontSize:10,color:_nightTheme.night.color.textSecondary,marginTop:4,marginBottom:4,lineHeight:14},methodBadgeCompact:{paddingHorizontal:8,paddingVertical:4,borderRadius:5,minWidth:48,maxWidth:60,alignItems:"center",justifyContent:"center"},methodTextCompact:{fontSize:13,fontWeight:"700",letterSpacing:.3,fontFamily:_fonts.monoFont},activeFiltersSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},activeFiltersContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:16,maxHeight:200},includeOnlySection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},includeOnlyDescription:{fontSize:10,color:_nightTheme.night.color.textSecondary,paddingHorizontal:16,paddingTop:8,lineHeight:14},includeOnlyInputWrapper:{paddingHorizontal:16,paddingTop:8,paddingBottom:8},includeOnlyFiltersContent:{paddingHorizontal:16,paddingBottom:16,maxHeight:150},excludeFiltersSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},excludeFiltersDescription:{fontSize:10,color:_nightTheme.night.color.textSecondary,paddingHorizontal:16,paddingTop:8,lineHeight:14},excludeFiltersInputWrapper:{paddingHorizontal:16,paddingTop:8,paddingBottom:8},excludeFiltersContent:{paddingHorizontal:16,paddingBottom:16,maxHeight:150},filterSummarySection:{backgroundColor:_gameUIColors.buoyColors.warning+"15",borderRadius:8,borderWidth:1,borderColor:_gameUIColors.buoyColors.warning+"40",padding:12,marginBottom:12},filterSummaryHeader:{flexDirection:"row",alignItems:"center",gap:6,marginBottom:6},filterSummaryTitle:{fontSize:12,fontWeight:"600",color:_gameUIColors.buoyColors.warning},filterSummaryText:{fontSize:11,color:_nightTheme.night.color.text,lineHeight:16},filterSummaryInclude:{color:_gameUIColors.buoyColors.success,fontWeight:"500"},filterSummaryExclude:{color:_gameUIColors.buoyColors.primary,fontWeight:"500"},emptyStateText:{fontSize:11,color:_nightTheme.night.color.textTertiary,fontStyle:"italic",textAlign:"center",paddingVertical:12},availableKeysSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},availableKeysScroll:{maxHeight:150,paddingHorizontal:16,paddingTop:8,paddingBottom:16},availableKeyItem:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,paddingHorizontal:12,backgroundColor:_nightTheme.night.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border,marginBottom:8},availableKeyText:{flex:1,fontSize:11,color:_nightTheme.night.color.text,fontFamily:_fonts.monoFont,marginRight:8},howItWorksSection:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,marginTop:16,overflow:"hidden"},howItWorksText:{fontSize:11,color:_nightTheme.night.color.textSecondary,lineHeight:16,marginBottom:12,marginTop:8,paddingHorizontal:16,fontFamily:_fonts.monoFont},examplesContainer:{paddingTop:8,paddingHorizontal:16,paddingBottom:16,borderTopWidth:1,borderTopColor:_nightTheme.night.color.border},examplesTitle:{fontSize:10,fontWeight:"600",color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,letterSpacing:.5,marginBottom:6},exampleItem:{fontSize:10,color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,lineHeight:16},previewSection:{backgroundColor:_nightTheme.night.color.surfaceElevated,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.fillTertiary,marginTop:16,overflow:"hidden"},previewContent:{paddingHorizontal:16,paddingTop:12,paddingBottom:16,backgroundColor:_nightTheme.night.color.bg,marginHorizontal:12,marginBottom:12,borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EntityFilterView=EntityFilterView;var _react=require("react");var _reactNative=require("react-native");var _index=require("../../icons/index.js");var _nightTheme=require("../night/nightTheme.js");var _SectionHeader=require("./SectionHeader.js");var _FilterComponents=require("./FilterComponents.js");var _fonts=require("../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function isHidden(o,n){return Array.from(n).some(i=>o.name.toLowerCase().includes(i.toLowerCase()))}function colorForPattern(o,n){const i=n.find(l=>l.name.toLowerCase()===o.toLowerCase());return i?i.color:null}function EntityFilterView({entities:o,ignoredPatterns:n,onTogglePattern:i,onAddPattern:l,entityNoun:h,entitySingular:d,entityKey:a,testIDPrefix:r,slug:p,howItWorks:u,examples:m,addPlaceholder:y,emptyMessage:x}){const[T,c]=(0,_react.useState)(false);const[g,s]=(0,_react.useState)("");const b=()=>{const e=g.trim();if(e){l(e);s("");c(false)}};return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EntityFilterView=EntityFilterView;var _react=require("react");var _reactNative=require("react-native");var _index=require("../../icons/index.js");var _nightTheme=require("../night/nightTheme.js");var _SectionHeader=require("./SectionHeader.js");var _FilterComponents=require("./FilterComponents.js");var _fonts=require("../fonts.js");var _jsxRuntime=require("react/jsx-runtime");function isHidden(o,n){return Array.from(n).some(i=>o.name.toLowerCase().includes(i.toLowerCase()))}function colorForPattern(o,n){const i=n.find(l=>l.name.toLowerCase()===o.toLowerCase());return i?i.color:null}function EntityFilterView({entities:o,ignoredPatterns:n,onTogglePattern:i,onAddPattern:l,entityNoun:h,entitySingular:d,entityKey:a,testIDPrefix:r,slug:p,howItWorks:u,examples:m,addPlaceholder:y,emptyMessage:x}){const[T,c]=(0,_react.useState)(false);const[g,s]=(0,_react.useState)("");const b=()=>{const e=g.trim();if(e){l(e);s("");c(false)}};return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.container,contentContainerStyle:styles.scrollContent,showsVerticalScrollIndicator:false,nestedScrollEnabled:true,keyboardShouldPersistTaps:"handled",testID:`${r}-filters-scroll`,children:[o.length===0&&x?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader,{children:(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader.Title,{children:["REGISTERED ",h]})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyText,testID:`${r}-filters-${a}s-empty`,children:x})]}):null,o.length>0&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader.Title,{children:["REGISTERED ",h]}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:o.length,color:_nightTheme.night.color.accent,testID:`${r}-filters-${a}-count`})]}),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{keyboardShouldPersistTaps:"handled",style:styles.entityList,contentContainerStyle:styles.entityListContent,showsVerticalScrollIndicator:true,nestedScrollEnabled:true,testID:`${r}-filters-${a}-list`,children:o.map(e=>{const t=isHidden(e,n);return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:[styles.entityRow,t&&styles.entityRowHidden],onPress:()=>l(e.name),disabled:t,testID:`${r}-filters-${a}-${p(e.name)}`,accessibilityRole:"button",accessibilityLabel:`Hide ${e.name}`,accessibilityState:{disabled:t},children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.dot,{backgroundColor:t?_nightTheme.night.color.textTertiary:e.color}]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.entityText,t?styles.entityTextHidden:{color:e.color}],numberOfLines:1,children:e.name}),t?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.hiddenLabel,children:"hidden"}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.addLabel,{color:e.color+"99"}],children:"+ hide"})]},e.name)})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:_index.Filter,color:_nightTheme.night.color.accent,size:12}),(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader.Title,{children:[d.toUpperCase()," NAME FILTERS"]}),n.size>0&&(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Badge,{count:n.size,color:_nightTheme.night.color.accent,testID:`${r}-filters-count`})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.addInputWrapper,children:!T?(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterButton,{onPress:()=>c(true),color:_nightTheme.night.color.accent,label:`Add ${d} name pattern`,testID:`${r}-filters-add-open`}):(0,_jsxRuntime.jsx)(_FilterComponents.AddFilterInput,{value:g,onChange:s,onSubmit:b,onCancel:()=>{c(false);s("")},placeholder:y??`Enter ${d} name pattern to hide...`,color:_nightTheme.night.color.accent,testID:`${r}-filters-add-input`})}),n.size>0&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.patternList,children:Array.from(n).map(e=>{const t=colorForPattern(e,o);return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.patternRow,onPress:()=>i(e),activeOpacity:.8,testID:`${r}-filters-chip-${p(e)}`,accessibilityRole:"button",accessibilityLabel:`Remove filter ${e}`,children:[t?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.dot,{backgroundColor:t}]}):null,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.patternText,t?{color:t}:null],numberOfLines:1,children:e}),(0,_jsxRuntime.jsx)(_index.X,{size:12,color:_nightTheme.night.color.accent+"80"})]},e)})})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.section,children:[(0,_jsxRuntime.jsxs)(_SectionHeader.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Icon,{icon:_index.Filter,color:_nightTheme.night.color.textSecondary,size:12}),(0,_jsxRuntime.jsx)(_SectionHeader.SectionHeader.Title,{children:"HOW EVENT FILTERS WORK"})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.howItWorksText,children:u}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.examplesContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.examplesTitle,children:"EXAMPLES:"}),m.map(e=>(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.exampleItem,children:e},e))]})]})]})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:"transparent"},scrollContent:{paddingTop:16,paddingHorizontal:16,paddingBottom:24,gap:16},section:{backgroundColor:_nightTheme.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_nightTheme.night.color.border,overflow:"hidden"},entityList:{maxHeight:180},entityListContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:16,gap:10},entityRow:{flexDirection:"row",alignItems:"center",gap:10,paddingVertical:10,paddingHorizontal:12,backgroundColor:_nightTheme.night.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border},entityRowHidden:{opacity:.45},dot:{width:7,height:7,borderRadius:3.5},entityText:{flex:1,fontSize:12,fontWeight:"600",fontFamily:_fonts.monoFont},entityTextHidden:{color:_nightTheme.night.color.textTertiary,textDecorationLine:"line-through"},hiddenLabel:{fontSize:10,fontWeight:"500",color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont},addLabel:{fontSize:10,fontWeight:"600",fontFamily:_fonts.monoFont},addInputWrapper:{paddingHorizontal:16,paddingTop:8,paddingBottom:8},patternList:{paddingHorizontal:16,paddingBottom:16,gap:8},patternRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,paddingHorizontal:12,backgroundColor:_nightTheme.night.color.surfaceElevated,borderRadius:8,borderWidth:1,borderColor:_nightTheme.night.color.border,gap:8},patternText:{flex:1,fontSize:12,fontFamily:_fonts.monoFont,color:_nightTheme.night.color.text},emptyText:{fontSize:11,color:_nightTheme.night.color.textTertiary,paddingHorizontal:16,paddingTop:8,paddingBottom:16,fontFamily:_fonts.monoFont},howItWorksText:{fontSize:11,color:_nightTheme.night.color.textSecondary,lineHeight:16,marginTop:8,paddingHorizontal:16,fontFamily:_fonts.monoFont},examplesContainer:{paddingTop:8,paddingHorizontal:16,paddingBottom:16,borderTopWidth:1,borderTopColor:_nightTheme.night.color.border,marginTop:12},examplesTitle:{fontSize:10,fontWeight:"600",color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,letterSpacing:.5,marginBottom:6},exampleItem:{fontSize:10,color:_nightTheme.night.color.textTertiary,fontFamily:_fonts.monoFont,lineHeight:16}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.WindowControls=WindowControls;Object.defineProperty(exports,"setExpandableWindowControls",{enumerable:true,get:function(){return _windowControlsSetting.setExpandableWindowControls}});var _react=require("react");var _reactNative=require("react-native");var _index=require("../../icons/index.js");var _gameUIColors=require("../gameUI/constants/gameUIColors.js");var _nightTheme=require("../night/nightTheme.js");var _windowControlsSetting=require("./windowControlsSetting.js");var _jsxRuntime=require("react/jsx-runtime");const COLORS={close:"#FF5F57",minimize:"#FEBC2E",toggleMode:"#28C840"};const BUTTON_SIZE=12;const BUTTON_SPACING=8;const ICON_SIZE=8;const EXPANDED_BUTTON_SIZE=36;const EXPANDED_BUTTON_SPACING=12;const EXPANDED_ICON_SIZE=16;const EXPANDED_PADDING=8;const AUTO_DISMISS_MS=3e3;function WindowControls({onClose:s,onMinimize:t,onToggleMode:o,mode:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.WindowControls=WindowControls;Object.defineProperty(exports,"setExpandableWindowControls",{enumerable:true,get:function(){return _windowControlsSetting.setExpandableWindowControls}});var _react=require("react");var _reactNative=require("react-native");var _index=require("../../icons/index.js");var _gameUIColors=require("../gameUI/constants/gameUIColors.js");var _nightTheme=require("../night/nightTheme.js");var _windowControlsSetting=require("./windowControlsSetting.js");var _jsxRuntime=require("react/jsx-runtime");const COLORS={close:"#FF5F57",minimize:"#FEBC2E",toggleMode:"#28C840"};const BUTTON_SIZE=12;const BUTTON_SPACING=8;const ICON_SIZE=8;const EXPANDED_BUTTON_SIZE=36;const EXPANDED_BUTTON_SPACING=12;const EXPANDED_ICON_SIZE=16;const EXPANDED_PADDING=8;const AUTO_DISMISS_MS=3e3;function WindowControls({onClose:s,onMinimize:t,onToggleMode:o,mode:i,variant:d="night",defaultExpanded:a}){const e=i==="floating"?_index.DockBottom:_index.FloatWindow;const u=i==="floating"?"Dock to bottom sheet":"Make floating window";if(!(0,_windowControlsSetting.isExpandableWindowControlsEnabled)()||!(0,_windowControlsSetting.expandableWindowControlsSupported)(_reactNative.Platform.OS==="web")){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[t&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:t,style:[styles.dot,styles.minimizeDot],activeOpacity:.8,accessibilityLabel:"Minimize modal",accessibilityRole:"button",children:(0,_jsxRuntime.jsx)(_index.Minus,{size:ICON_SIZE,color:"#7A5A00",strokeWidth:1.5})}),o&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:o,style:[styles.dot,styles.expandDot],activeOpacity:.8,accessibilityLabel:u,accessibilityRole:"button",children:(0,_jsxRuntime.jsx)(e,{size:ICON_SIZE,color:"#004A1A",strokeWidth:1.5})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:s,style:[styles.dot,styles.closeDot],activeOpacity:.8,accessibilityLabel:"Close modal",testID:"tool-window-close",accessibilityRole:"button",children:(0,_jsxRuntime.jsx)(_index.X,{size:ICON_SIZE,color:"#4A0000",strokeWidth:1.5})})]})}return(0,_jsxRuntime.jsx)(ExpandableWindowControls,{onClose:s,onMinimize:t,onToggleMode:o,mode:i,variant:d,defaultExpanded:a})}function ExpandableWindowControls({onClose:s,onMinimize:t,onToggleMode:o,mode:i,variant:d="night",defaultExpanded:a=false}){const e=d==="night";const[u,b]=(0,_react.useState)(a);const n=(0,_react.useRef)(new _reactNative.Animated.Value(a?1:0)).current;const l=(0,_react.useRef)(null);const h=i==="floating"?_index.DockBottom:_index.FloatWindow;const p=i==="floating"?"Dock to bottom sheet":"Make floating window";const r=(0,_react.useCallback)(()=>{if(l.current){clearTimeout(l.current);l.current=null}},[]);const c=(0,_react.useCallback)(()=>{r();_reactNative.Animated.spring(n,{toValue:0,tension:200,friction:20,useNativeDriver:false}).start(()=>{b(false)})},[n,r]);const x=(0,_react.useCallback)(()=>{_reactNative.Keyboard.dismiss();b(true);_reactNative.Animated.spring(n,{toValue:1,tension:180,friction:18,useNativeDriver:false}).start();r();l.current=setTimeout(c,AUTO_DISMISS_MS)},[n,c,r]);(0,_react.useEffect)(()=>{return r},[r]);const g=(0,_react.useCallback)(C=>{c();C()},[c]);const m=n.interpolate({inputRange:[0,1],outputRange:[.3,1]});const y=n.interpolate({inputRange:[0,.5,1],outputRange:[0,.8,1]});return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:x,activeOpacity:.7,accessibilityLabel:"Open window controls",testID:"tool-window-controls",accessibilityRole:"button",style:styles.trigger,hitSlop:{top:8,bottom:8,left:8,right:8},children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[t&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.dot,styles.minimizeDot],children:(0,_jsxRuntime.jsx)(_index.Minus,{size:ICON_SIZE,color:"#7A5A00",strokeWidth:1.5})}),o&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.dot,styles.expandDot],children:(0,_jsxRuntime.jsx)(h,{size:ICON_SIZE,color:"#004A1A",strokeWidth:1.5})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.dot,styles.closeDot],children:(0,_jsxRuntime.jsx)(_index.X,{size:ICON_SIZE,color:"#4A0000",strokeWidth:1.5})})]})}),u&&(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.expandedPanelInline,{transform:[{scale:m}],opacity:y}],children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.expandedContainer,e&&styles.nightExpandedContainer],children:[t&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>g(t),style:[styles.expandedButton,e?styles.nightMinimizeButton:styles.minimizeButtonExpanded],activeOpacity:.7,accessibilityLabel:"Minimize modal",testID:"tool-window-minimize",accessibilityRole:"button",children:(0,_jsxRuntime.jsx)(_index.Minus,{size:EXPANDED_ICON_SIZE,color:e?_nightTheme.night.color.warning:"#7A5A00",strokeWidth:2})}),o&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>g(o),style:[styles.expandedButton,e?styles.nightToggleButton:styles.expandButtonExpanded],activeOpacity:.7,accessibilityLabel:p,testID:"tool-window-mode",accessibilityRole:"button",children:(0,_jsxRuntime.jsx)(h,{size:EXPANDED_ICON_SIZE,color:e?_nightTheme.night.color.accent:"#004A1A",strokeWidth:2})}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>g(s),style:[styles.expandedButton,e?styles.nightCloseButton:styles.closeButtonExpanded],activeOpacity:.7,accessibilityLabel:"Close modal",testID:"tool-window-close",accessibilityRole:"button",children:(0,_jsxRuntime.jsx)(_index.X,{size:EXPANDED_ICON_SIZE,color:e?_nightTheme.night.color.danger:"#4A0000",strokeWidth:2})})]})})]})}const styles=_reactNative.StyleSheet.create({trigger:{padding:2},container:{flexDirection:"row",alignItems:"center",gap:BUTTON_SPACING},dot:{width:BUTTON_SIZE,height:BUTTON_SIZE,borderRadius:BUTTON_SIZE/2,alignItems:"center",justifyContent:"center"},closeDot:{backgroundColor:COLORS.close},minimizeDot:{backgroundColor:COLORS.minimize},expandDot:{backgroundColor:COLORS.toggleMode},expandedPanelInline:{position:"absolute",top:-EXPANDED_PADDING,right:-EXPANDED_PADDING,zIndex:9999},expandedContainer:{flexDirection:"row",alignItems:"center",gap:EXPANDED_BUTTON_SPACING,backgroundColor:_gameUIColors.buoyColors.card,borderRadius:(EXPANDED_BUTTON_SIZE+EXPANDED_PADDING*2)/2,paddingHorizontal:EXPANDED_PADDING,paddingVertical:EXPANDED_PADDING,borderWidth:1,borderColor:_gameUIColors.buoyColors.border,shadowColor:"#000",shadowOffset:{width:0,height:4},shadowOpacity:.4,shadowRadius:12,elevation:30},expandedButton:{width:EXPANDED_BUTTON_SIZE,height:EXPANDED_BUTTON_SIZE,borderRadius:EXPANDED_BUTTON_SIZE/2,alignItems:"center",justifyContent:"center"},closeButtonExpanded:{backgroundColor:COLORS.close},minimizeButtonExpanded:{backgroundColor:COLORS.minimize},expandButtonExpanded:{backgroundColor:COLORS.toggleMode},nightExpandedContainer:{backgroundColor:_nightTheme.night.color.surface,borderColor:_nightTheme.night.color.border},nightMinimizeButton:{backgroundColor:_nightTheme.night.color.warningSoft,borderWidth:1,borderColor:_nightTheme.night.color.warning+"59"},nightToggleButton:{backgroundColor:_nightTheme.night.color.accentSoft,borderWidth:1,borderColor:_nightTheme.night.color.accentBorderStrong},nightCloseButton:{backgroundColor:_nightTheme.night.color.dangerSoft,borderWidth:1,borderColor:_nightTheme.night.color.danger+"59"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Divider=Divider;exports.FloatingTool=FloatingTool;exports.UserStatus=UserStatus;exports.getBubbleAnchorPosition=getBubbleAnchorPosition;var _react=require("react");var _reactNative=require("react-native");var _nightTheme=require("../night/nightTheme.js");var _DraggableHeader=require("../components/DraggableHeader.js");var _EnvironmentSelectorInline=require("../../env/EnvironmentSelectorInline");var _GripVerticalIcon=require("../components/GripVerticalIcon.js");var _gameUIColors=require("../gameUI/constants/gameUIColors.js");var _index=require("../../utils/index.js");var _index2=require("../../hooks/index.js");var _onboardingConstants=require("./onboardingConstants");var _floatingToolsCore=require("@buoy-gg/floating-tools-core");var _jsxRuntime=require("react/jsx-runtime");const STORAGE_KEYS={BUBBLE_POSITION_X:"@react_buoy_bubble_position_x",BUBBLE_POSITION_Y:"@react_buoy_bubble_position_y"};const VISIBLE_HANDLE_WIDTH=32;const EDGE_PADDING=20;const LAYOUT_SETTLE_DELAY_MS=150;const getAnimatedValue=c=>c.__getValue();function useFloatingToolsPosition({animatedPosition:c,bubbleWidth:_=100,bubbleHeight:m=32,enabled:a=true,visibleHandleWidth:v=32,listenersSuspended:T=false,defaultPlacement:V="top",onPositionLoaded:N,storageKey:y}){const[A,S]=(0,_react.useState)(false);const C=(0,_react.useRef)(void 0);const x=(0,_react.useRef)(true);(0,_react.useEffect)(()=>{x.current=true;return()=>{x.current=false;if(C.current){clearTimeout(C.current);C.current=void 0}}},[]);const D=(0,_react.useCallback)(async(u,g)=>{if(!a)return;if(!x.current)return;const{width:t}=_reactNative.Dimensions.get("window");if(t<=0||u<0||g<0)return;try{await Promise.all([_index.persistentStorage.setItem(y?`${y}:x`:STORAGE_KEYS.BUBBLE_POSITION_X,u.toString()),_index.persistentStorage.setItem(y?`${y}:y`:STORAGE_KEYS.BUBBLE_POSITION_Y,g.toString())])}catch(n){}},[a,y]);const B=(0,_react.useCallback)((u,g)=>{if(!x.current)return;if(C.current)clearTimeout(C.current);C.current=setTimeout(()=>{if(x.current){D(u,g)}},500)},[D]);const j=(0,_react.useCallback)(async()=>{if(!a)return null;try{const[u,g]=await Promise.all([_index.persistentStorage.getItem(y?`${y}:x`:STORAGE_KEYS.BUBBLE_POSITION_X),_index.persistentStorage.getItem(y?`${y}:y`:STORAGE_KEYS.BUBBLE_POSITION_Y)]);if(u!==null&&g!==null){const t=parseFloat(u);const n=parseFloat(g);if(!Number.isNaN(t)&&!Number.isNaN(n)){return{x:t,y:n}}}}catch(u){}return null},[a,y]);const L=(0,_react.useCallback)(u=>{const{width:g,height:t}=_reactNative.Dimensions.get("window");const n=(0,_index.getSafeAreaInsets)();if(g<=0||t<=0){return{...u,isValid:false}}const M=n.left;const e=g-v;const E=n.top+EDGE_PADDING;const l=t-m-n.bottom;const d={x:Math.max(M,Math.min(u.x,e)),y:Math.max(E,Math.min(u.y,l)),isValid:true};return d},[v,m]);(0,_react.useEffect)(()=>{if(!a||A)return;let u=false;const g=async()=>{const t=await j();if(u||!x.current)return;const{width:n,height:M}=_reactNative.Dimensions.get("window");const e=(0,_index.getSafeAreaInsets)();if(n<=0||M<=0){setTimeout(()=>{if(x.current&&!u){g()}},100);return}let E;let l=false;if(t){const d=L(t);if(!d.isValid){setTimeout(()=>{if(x.current&&!u){g()}},100);return}const Y=Math.abs(t.x-d.x)>5||Math.abs(t.y-d.y)>5;if(Y){await D(d.x,d.y)}E={x:d.x,y:d.y};l=d.x>=n-v-5}else{const d=V==="bottom"?Math.max(e.top+EDGE_PADDING,M-m-e.bottom-EDGE_PADDING):Math.max(e.top+EDGE_PADDING,Math.min(100,M-m-e.bottom));E={x:n-_-EDGE_PADDING,y:d}}if(u||!x.current)return;c.setValue(E);S(true);N?.(E,l)};g();return()=>{u=true}},[a,A,c,j,L,D,_,m,v,N]);(0,_react.useEffect)(()=>{if(!a||!A||T)return;const u=c.addListener(g=>{B(g.x,g.y)});return()=>{c.removeListener(u);if(C.current){clearTimeout(C.current);C.current=void 0}}},[a,A,T,c,B]);return{savePosition:D,isInitialized:A}}function Divider(){const c={width:1,height:12,backgroundColor:_gameUIColors.buoyColors.textMuted+"66",flexShrink:0};return(0,_jsxRuntime.jsx)(_reactNative.View,{style:c})}const gameUIColorsCompat={success:"#20C997",warning:"#FFA94D",error:"#EF4444",muted:_gameUIColors.buoyColors.textMuted,secondary:_gameUIColors.buoyColors.textSecondary,info:"#20C997",primary:"#20C997",optional:_gameUIColors.buoyColors.textSecondary};function getUserStatusConfig(c){return(0,_floatingToolsCore.getUserStatusConfig)(c,gameUIColorsCompat)}const FloatingToolsContext=(0,_react.createContext)({isDragging:false});function UserStatus({userRole:c,onPress:_}){const{isDragging:m}=(0,_react.useContext)(FloatingToolsContext);const a=getUserStatusConfig(c);const v={flexDirection:"row",alignItems:"center",paddingVertical:6,paddingHorizontal:8,flexShrink:0};const T={width:6,height:6,borderRadius:3,backgroundColor:a.dotColor,marginRight:4};const V={fontSize:10,fontWeight:"500",color:a.textColor,letterSpacing:.3};if(!_){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:v,accessibilityLabel:`User status: ${a.label}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:T}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:V,children:a.label})]})}return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{accessibilityRole:"button",accessibilityLabel:"Open Dev Tools Menu",testID:"open-dev-tools-button",onPress:_,hitSlop:{top:10,bottom:10,left:0,right:10},disabled:m,activeOpacity:.85,style:v,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:T}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:V,children:a.label})]})}function interleaveWithDividers(c){const _=(0,_floatingToolsCore.filterValidChildren)(c);const m=[];_.forEach((a,v)=>{m.push(a);if(v<_.length-1)m.push((0,_jsxRuntime.jsx)(Divider,{},`divider-${v}`))});return m}function FloatingTool({id:c,suspendPointerEvents:_=false,revealToken:m,variant:a="bubble",dragFromSurface:v=false,accessibilityLabel:T="Move dev tools bubble",minimizedStack:V,hasMinimizedStack:N=false,accessory:y,handleAdornment:A,enablePositionPersistence:S=true,defaultPlacement:C="top",pushToSide:x=false,centerOnboarding:D=false,children:B,environment:j,availableEnvironments:L,onEnvironmentSwitch:u,showEnvironmentSelector:g=false}){const t=(0,_react.useRef)(new _reactNative.Animated.ValueXY).current;const[n,M]=(0,_react.useState)(false);const[e,E]=(0,_react.useState)({width:100,height:32});const[l,d]=(0,_react.useState)(false);const[Y,Z]=(0,_react.useState)(0);const[K,tt]=(0,_react.useState)(false);const f=(0,_react.useRef)(null);const W=(0,_react.useRef)(false);const O=(0,_react.useRef)(false);const $=(0,_react.useRef)(x);const X=(0,_react.useRef)(null);const[z,et]=(0,_react.useState)(false);const h=(0,_index2.useSafeAreaInsets)();const{width:o,height:p}=(0,_reactNative.useWindowDimensions)();const rt=(0,_react.useCallback)((i,r)=>{if(r){d(true)}},[]);const{savePosition:w,isInitialized:R}=useFloatingToolsPosition({animatedPosition:t,bubbleWidth:e.width,bubbleHeight:e.height,enabled:S,visibleHandleWidth:VISIBLE_HANDLE_WIDTH,listenersSuspended:n,defaultPlacement:C,onPositionLoaded:rt,storageKey:c?`@buoy/floating-tool/${c}`:void 0});(0,_react.useEffect)(()=>{if(S&&!R)return;if(!$.current&&x){O.current=false}$.current=x;if(x&&!l&&!n&&!O.current){const i=getAnimatedValue(t.x);const r=getAnimatedValue(t.y);f.current={x:i,y:r};const s=o-VISIBLE_HANDLE_WIDTH;W.current=true;d(true);_reactNative.Animated.timing(t,{toValue:{x:s,y:r},duration:200,useNativeDriver:false}).start(()=>{w(s,r)})}else if(!x&&l&&W.current){if(f.current){const{x:i,y:r}=f.current;W.current=false;O.current=false;d(false);_reactNative.Animated.timing(t,{toValue:{x:i,y:r},duration:200,useNativeDriver:false}).start(()=>{w(i,r)})}}},[S,R,x,l,n,o,t,w]);(0,_react.useEffect)(()=>{if(!R||z)return;const i=setTimeout(()=>{X.current=e.width;et(true);if(!l&&!n){const r=getAnimatedValue(t.x);const s=o-e.width-EDGE_PADDING;if(r>s){const b=Math.max(h.left,s);const I=getAnimatedValue(t.y);t.setValue({x:b,y:I});w(b,I)}}},LAYOUT_SETTLE_DELAY_MS);return()=>clearTimeout(i)},[R,z,e.width]);(0,_react.useEffect)(()=>{if(!R)return;if(!z)return;if(X.current===null)return;if(n){X.current=e.width;return}const i=X.current;const r=e.width;const s=r-i;if(Math.abs(s)<2){return}X.current=r;if(l){if(f.current){const ct=f.current.x-s;f.current.x=Math.max(h.left,Math.min(ct,o-r-EDGE_PADDING))}return}const b=getAnimatedValue(t.x);const I=getAnimatedValue(t.y);const H=b-s;const U=Math.max(h.left,Math.min(H,o-VISIBLE_HANDLE_WIDTH));if(Math.abs(U-b)>1){_reactNative.Animated.timing(t,{toValue:{x:U,y:I},duration:150,useNativeDriver:false}).start(()=>{w(U,I);if(f.current){f.current.x=U}})}},[e.width,R,z,n,l,t,o,h.left,w]);(0,_react.useEffect)(()=>{if(!S){if(D){const i=(0,_onboardingConstants.calculateTargetPosition)();const r=(o-e.width)/2;const s=p-e.height-i;t.setValue({x:r,y:s})}else{const i=C==="bottom"?Math.max(h.top+EDGE_PADDING,p-e.height-h.bottom-EDGE_PADDING):Math.max(h.top+EDGE_PADDING,Math.min(100,p-e.height-h.bottom));t.setValue({x:o-e.width-EDGE_PADDING,y:i})}}},[S,D,t,e.width,e.height,h.top,h.bottom,o,p]);const k=(0,_react.useCallback)(()=>{const i=getAnimatedValue(t.x);const r=getAnimatedValue(t.y);const s=i>o-e.width/2;if(l||s){let b;let I;if(f.current&&f.current.x<o-e.width/2){b=f.current.x;I=f.current.y}else{b=o-e.width-EDGE_PADDING;I=r}W.current=false;O.current=true;d(false);_reactNative.Animated.timing(t,{toValue:{x:b,y:I},duration:200,useNativeDriver:false}).start(()=>{w(b,I)})}else{f.current={x:i,y:r};O.current=false;const b=o-VISIBLE_HANDLE_WIDTH;d(true);_reactNative.Animated.timing(t,{toValue:{x:b,y:r},duration:200,useNativeDriver:false}).start(()=>{w(b,r)})}},[t,l,e.width,w,o]);const G=(0,_react.useCallback)(()=>{M(true)},[]);const P=(0,_react.useCallback)(i=>{let{x:r,y:s}=i;const b=r+e.width/2;const I=b>o;if(I){const H=o-VISIBLE_HANDLE_WIDTH;d(true);if(f.current){f.current.y=s}else{f.current={x:o-e.width-EDGE_PADDING,y:s}}_reactNative.Animated.timing(t,{toValue:{x:H,y:s},duration:200,useNativeDriver:false}).start(()=>{w(H,s)})}else{if(l&&r<o-VISIBLE_HANDLE_WIDTH-10){d(false)}if(r<o-e.width/2){f.current={x:r,y:s}}w(r,s)}M(false)},[t,e.width,l,w,o]);const q=(0,_react.useRef)({width:o,height:p});(0,_react.useEffect)(()=>{if(S&&!R)return;if(q.current.width===o&&q.current.height===p)return;q.current={width:o,height:p};const i=s=>({x:Math.max(h.left,Math.min(s.x,o-e.width-EDGE_PADDING)),y:Math.max(h.top+EDGE_PADDING,Math.min(s.y,p-e.height-h.bottom))});const r=i({x:getAnimatedValue(t.x),y:getAnimatedValue(t.y)});if(l)r.x=o-VISIBLE_HANDLE_WIDTH;if(f.current)f.current=i(f.current);t.stopAnimation();t.setValue(r);void w(r.x,r.y)},[o,p,R,S,e,h,l,t,w]);const J=Boolean(y);(0,_react.useEffect)(()=>{if(!J)return;const i=({y:s})=>tt(s+e.height+Y>p-h.bottom);i({y:getAnimatedValue(t.y)});const r=t.addListener(i);return()=>t.removeListener(r)},[t,e.height,Y,p,h.bottom,J]);const nt=(0,_react.useMemo)(()=>({position:"absolute",zIndex:1001,transform:t.getTranslateTransform()}),[t]);const Q=(0,_react.useRef)(void 0);(0,_react.useEffect)(()=>{if(S&&!R)return;if(Q.current===m)return;Q.current=m;if(m!==void 0&&m>0&&l)k()},[m,R,S,l,k]);const F=N;const ot={flexDirection:"row",alignItems:"center",backgroundColor:_gameUIColors.buoyColors.card,borderTopLeftRadius:F?0:6,borderTopRightRadius:6,borderBottomLeftRadius:6,borderBottomRightRadius:6,borderLeftWidth:n?2:1,borderRightWidth:n?2:1,borderBottomWidth:n?2:1,borderTopWidth:n?2:F?0:1,borderColor:n?_floatingToolsCore.floatingToolsColors.dragActive:_gameUIColors.buoyColors.textMuted+"66",overflow:"visible",elevation:8,shadowColor:n?_floatingToolsCore.floatingToolsColors.dragActive+"99":"#000",shadowOffset:{width:0,height:n?6:4},shadowOpacity:n?.6:.3,shadowRadius:n?12:8,...a==="strip"?{borderRadius:_nightTheme.night.radius.card,borderTopLeftRadius:_nightTheme.night.radius.card,borderTopRightRadius:_nightTheme.night.radius.card,borderBottomLeftRadius:_nightTheme.night.radius.card,borderBottomRightRadius:_nightTheme.night.radius.card,minHeight:48,backgroundColor:_nightTheme.night.color.surface,borderColor:n?_nightTheme.night.color.accentBorderStrong:_nightTheme.night.color.separator,shadowOpacity:.24,shadowRadius:16}:{}};const it={paddingHorizontal:6,paddingVertical:6,backgroundColor:_gameUIColors.buoyColors.textMuted+"1A",alignItems:"center",justifyContent:"center",width:32,...a==="strip"?{minHeight:48}:{},borderRightWidth:1,borderRightColor:_gameUIColors.buoyColors.textMuted+"66",borderTopLeftRadius:F?0:void 0,...a==="strip"?{backgroundColor:"transparent",borderRightWidth:0}:{}};const st={flexDirection:"row",alignItems:"center",gap:6,paddingRight:8};const at=(0,_react.useMemo)(()=>a==="strip"?_react.Children.toArray(B):interleaveWithDividers(_react.Children.toArray(B)),[B,a]);const ut=32;if(S&&!R){return null}return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:_?"none":"box-none",testID:c??"buoy-floating-tool",style:nt,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{overflow:"visible"},children:[V&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:"absolute",bottom:"100%",left:0,width:ut,overflow:"visible",zIndex:1001},children:V}),(0,_jsxRuntime.jsxs)(_DraggableHeader.DraggableHeader,{position:t,enabled:v,claimOnMove:false,onDragStart:G,onDragEnd:P,containerBounds:{width:o,height:p},elementSize:e,minPosition:{x:h.left,y:h.top+EDGE_PADDING},maxOverflowX:e.width,hitSlop:{top:10,bottom:10,left:10,right:10},style:ot,onLayout:i=>{const{width:r,height:s}=i.nativeEvent.layout;E({width:r,height:s})},children:[(0,_jsxRuntime.jsxs)(_DraggableHeader.DraggableHeader,{position:t,testID:c?`${c}-grip`:"buoy-floating-grip",accessibilityLabel:T,onDragStart:G,onDragEnd:P,onTap:k,containerBounds:{width:o,height:p},elementSize:e,minPosition:{x:h.left,y:h.top+EDGE_PADDING},style:it,enabled:true,maxOverflowX:e.width,children:[(0,_jsxRuntime.jsx)(_GripVerticalIcon.GripVerticalIcon,{size:a==="strip"?20:12,color:_gameUIColors.buoyColors.textSecondary+"CC"}),A]}),(0,_jsxRuntime.jsx)(FloatingToolsContext.Provider,{value:{isDragging:n},children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:st,children:[g&&j&&L&&u&&(0,_jsxRuntime.jsx)(_EnvironmentSelectorInline.EnvironmentSelectorInline,{currentEnvironment:j,availableEnvironments:L,onSelect:u}),at]})})]}),!l&&y&&(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:i=>Z(i.nativeEvent.layout.height),style:{position:"absolute",...K?{bottom:"100%"}:{top:"100%"},left:0,width:"100%",zIndex:1002},children:y})]})})}function getBubbleAnchorPosition(){return null}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Divider=Divider;exports.FloatingTool=FloatingTool;exports.UserStatus=UserStatus;exports.getBubbleAnchorPosition=getBubbleAnchorPosition;var _react=require("react");var _reactNative=require("react-native");var _nightTheme=require("../night/nightTheme.js");var _DraggableHeader=require("../components/DraggableHeader.js");var _EnvironmentSelectorInline=require("../../env/EnvironmentSelectorInline");var _GripVerticalIcon=require("../components/GripVerticalIcon.js");var _gameUIColors=require("../gameUI/constants/gameUIColors.js");var _index=require("../../utils/index.js");var _index2=require("../../hooks/index.js");var _onboardingConstants=require("./onboardingConstants");var _floatingToolsCore=require("@buoy-gg/floating-tools-core");var _jsxRuntime=require("react/jsx-runtime");const STORAGE_KEYS={BUBBLE_POSITION_X:"@react_buoy_bubble_position_x",BUBBLE_POSITION_Y:"@react_buoy_bubble_position_y"};const VISIBLE_HANDLE_WIDTH=32;const EDGE_PADDING=20;const LAYOUT_SETTLE_DELAY_MS=150;const getAnimatedValue=d=>d.__getValue();function useFloatingToolsPosition({animatedPosition:d,bubbleWidth:M=100,bubbleHeight:x=32,enabled:c=true,visibleHandleWidth:S=32,listenersSuspended:A=false,skipAutoSaveRef:V,defaultPlacement:F="top",bottomClearance:N=0,onPositionLoaded:q,storageKey:f}){const[C,B]=(0,_react.useState)(false);const m=(0,_react.useRef)(void 0);const I=(0,_react.useRef)(true);(0,_react.useEffect)(()=>{I.current=true;return()=>{I.current=false;if(m.current){clearTimeout(m.current);m.current=void 0}}},[]);const _=(0,_react.useCallback)(async(l,t)=>{if(!c)return;if(!I.current)return;const{width:n}=_reactNative.Dimensions.get("window");if(n<=0||l<0||t<0)return;try{await Promise.all([_index.persistentStorage.setItem(f?`${f}:x`:STORAGE_KEYS.BUBBLE_POSITION_X,l.toString()),_index.persistentStorage.setItem(f?`${f}:y`:STORAGE_KEYS.BUBBLE_POSITION_Y,t.toString())])}catch(w){}},[c,f]);const Y=(0,_react.useCallback)((l,t)=>{if(!I.current)return;if(m.current)clearTimeout(m.current);m.current=setTimeout(()=>{if(I.current){_(l,t)}},500)},[_]);const W=(0,_react.useCallback)(async()=>{if(!c)return null;try{const[l,t]=await Promise.all([_index.persistentStorage.getItem(f?`${f}:x`:STORAGE_KEYS.BUBBLE_POSITION_X),_index.persistentStorage.getItem(f?`${f}:y`:STORAGE_KEYS.BUBBLE_POSITION_Y)]);if(l!==null&&t!==null){const n=parseFloat(l);const w=parseFloat(t);if(!Number.isNaN(n)&&!Number.isNaN(w)){return{x:n,y:w}}}}catch(l){}return null},[c,f]);const z=(0,_react.useCallback)(l=>{const{width:t,height:n}=_reactNative.Dimensions.get("window");const w=(0,_index.getSafeAreaInsets)();if(t<=0||n<=0){return{...l,isValid:false}}const e=w.left;const E=t-S;const R=w.top+EDGE_PADDING;const O=n-x-w.bottom;const o={x:Math.max(e,Math.min(l.x,E)),y:Math.max(R,Math.min(l.y,O)),isValid:true};return o},[S,x]);(0,_react.useEffect)(()=>{if(!c||C)return;let l=false;const t=async()=>{const n=await W();if(l||!I.current)return;const{width:w,height:e}=_reactNative.Dimensions.get("window");const E=(0,_index.getSafeAreaInsets)();if(w<=0||e<=0){setTimeout(()=>{if(I.current&&!l){t()}},100);return}let R;let O=false;if(n){const o=z(n);if(!o.isValid){setTimeout(()=>{if(I.current&&!l){t()}},100);return}const D=Math.abs(n.x-o.x)>5||Math.abs(n.y-o.y)>5;if(D){await _(o.x,o.y)}R={x:o.x,y:o.y};O=o.x>=w-S-5}else{const o=F==="bottom"?Math.max(E.top+EDGE_PADDING,e-x-E.bottom-EDGE_PADDING-N):Math.max(E.top+EDGE_PADDING,Math.min(100,e-x-E.bottom));R={x:w-M-EDGE_PADDING,y:o}}if(l||!I.current)return;d.setValue(R);B(true);q?.(R,O)};t();return()=>{l=true}},[c,C,d,W,z,_,M,x,S,q]);(0,_react.useEffect)(()=>{if(!c||!C||A)return;const l=d.addListener(t=>{if(V?.current)return;Y(t.x,t.y)});return()=>{d.removeListener(l);if(m.current){clearTimeout(m.current);m.current=void 0}}},[c,C,A,V,d,Y]);return{savePosition:_,isInitialized:C}}function Divider(){const d={width:1,height:12,backgroundColor:_gameUIColors.buoyColors.textMuted+"66",flexShrink:0};return(0,_jsxRuntime.jsx)(_reactNative.View,{style:d})}const gameUIColorsCompat={success:"#20C997",warning:"#FFA94D",error:"#EF4444",muted:_gameUIColors.buoyColors.textMuted,secondary:_gameUIColors.buoyColors.textSecondary,info:"#20C997",primary:"#20C997",optional:_gameUIColors.buoyColors.textSecondary};function getUserStatusConfig(d){return(0,_floatingToolsCore.getUserStatusConfig)(d,gameUIColorsCompat)}const FloatingToolsContext=(0,_react.createContext)({isDragging:false});function UserStatus({userRole:d,onPress:M}){const{isDragging:x}=(0,_react.useContext)(FloatingToolsContext);const c=getUserStatusConfig(d);const S={flexDirection:"row",alignItems:"center",paddingVertical:6,paddingHorizontal:8,flexShrink:0};const A={width:6,height:6,borderRadius:3,backgroundColor:c.dotColor,marginRight:4};const V={fontSize:10,fontWeight:"500",color:c.textColor,letterSpacing:.3};if(!M){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:S,accessibilityLabel:`User status: ${c.label}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:A}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:V,children:c.label})]})}return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{accessibilityRole:"button",accessibilityLabel:"Open Dev Tools Menu",testID:"open-dev-tools-button",onPress:M,hitSlop:{top:10,bottom:10,left:0,right:10},disabled:x,activeOpacity:.85,style:S,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:A}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:V,children:c.label})]})}function interleaveWithDividers(d){const M=(0,_floatingToolsCore.filterValidChildren)(d);const x=[];M.forEach((c,S)=>{x.push(c);if(S<M.length-1)x.push((0,_jsxRuntime.jsx)(Divider,{},`divider-${S}`))});return x}function FloatingTool({id:d,suspendPointerEvents:M=false,revealToken:x,variant:c="bubble",dragFromSurface:S=false,accessibilityLabel:A="Move dev tools bubble",minimizedStack:V,hasMinimizedStack:F=false,accessory:N,handleAdornment:q,enablePositionPersistence:f=true,defaultPlacement:C="top",bottomClearance:B=0,pushToSide:m=false,centerOnboarding:I=false,children:_,environment:Y,availableEnvironments:W,onEnvironmentSwitch:z,showEnvironmentSelector:l=false}){const t=(0,_react.useRef)(new _reactNative.Animated.ValueXY).current;const[n,w]=(0,_react.useState)(false);const[e,E]=(0,_react.useState)({width:100,height:32});const[R,O]=(0,_react.useState)(false);const[o,D]=(0,_react.useState)(false);const[J,rt]=(0,_react.useState)(0);const[nt,ot]=(0,_react.useState)(false);const g=(0,_react.useRef)(null);const T=(0,_react.useRef)(false);const H=(0,_react.useRef)(false);const Q=(0,_react.useRef)(m);const U=(0,_react.useRef)(null);const[X,it]=(0,_react.useState)(false);const u=(0,_index2.useSafeAreaInsets)();const{width:a,height:y}=(0,_reactNative.useWindowDimensions)();const st=(0,_react.useCallback)((i,r)=>{if(r){D(true)}},[]);const{savePosition:b,isInitialized:v}=useFloatingToolsPosition({animatedPosition:t,bubbleWidth:e.width,bubbleHeight:e.height,enabled:f,visibleHandleWidth:VISIBLE_HANDLE_WIDTH,listenersSuspended:n,skipAutoSaveRef:T,defaultPlacement:C,bottomClearance:B,onPositionLoaded:st,storageKey:d?`@buoy/floating-tool/${d}`:void 0});(0,_react.useEffect)(()=>{if(f&&!v)return;if(!Q.current&&m){H.current=false}Q.current=m;if(m&&!o&&!n&&!H.current){const i=getAnimatedValue(t.x);const r=getAnimatedValue(t.y);g.current={x:i,y:r};const s=a-VISIBLE_HANDLE_WIDTH;T.current=true;D(true);_reactNative.Animated.timing(t,{toValue:{x:s,y:r},duration:200,useNativeDriver:false}).start()}else if(!m&&o&&T.current){if(g.current){const{x:i,y:r}=g.current;T.current=false;H.current=false;D(false);_reactNative.Animated.timing(t,{toValue:{x:i,y:r},duration:200,useNativeDriver:false}).start(()=>{b(i,r)})}}},[f,v,m,o,n,a,t,b]);(0,_react.useEffect)(()=>{if(!v||X)return;const i=setTimeout(()=>{U.current=e.width;it(true);if(!o&&!n){const r=getAnimatedValue(t.x);const s=a-e.width-EDGE_PADDING;if(r>s){const h=Math.max(u.left,s);const p=getAnimatedValue(t.y);t.setValue({x:h,y:p});b(h,p)}}},LAYOUT_SETTLE_DELAY_MS);return()=>clearTimeout(i)},[v,X,e.width]);(0,_react.useEffect)(()=>{if(!v||!X||o||n)return;const i=getAnimatedValue(t.y);const r=y-e.height-u.bottom-EDGE_PADDING-(C==="bottom"?B:0);if(i<=r)return;const s=getAnimatedValue(t.x);const h=Math.max(u.top+EDGE_PADDING,r);t.setValue({x:s,y:h});b(s,h)},[v,X,o,n,e.height,y,u.top,u.bottom,B,C]);(0,_react.useEffect)(()=>{if(!v)return;if(!X)return;if(U.current===null)return;if(n){U.current=e.width;return}const i=U.current;const r=e.width;const s=r-i;if(Math.abs(s)<2){return}U.current=r;if(o){if(g.current){const k=g.current.x-s;g.current.x=Math.max(u.left,Math.min(k,a-r-EDGE_PADDING))}return}const h=getAnimatedValue(t.x);const p=getAnimatedValue(t.y);const j=h-s;const L=Math.max(u.left,Math.min(j,a-VISIBLE_HANDLE_WIDTH));if(Math.abs(L-h)>1){_reactNative.Animated.timing(t,{toValue:{x:L,y:p},duration:150,useNativeDriver:false}).start(()=>{b(L,p);if(g.current){g.current.x=L}})}},[e.width,v,X,n,o,t,a,u.left,b]);(0,_react.useEffect)(()=>{if(!f){if(I){const i=(0,_onboardingConstants.calculateTargetPosition)();const r=(a-e.width)/2;const s=y-e.height-i;t.setValue({x:r,y:s})}else{const i=C==="bottom"?Math.max(u.top+EDGE_PADDING,y-e.height-u.bottom-EDGE_PADDING-B):Math.max(u.top+EDGE_PADDING,Math.min(100,y-e.height-u.bottom));t.setValue({x:a-e.width-EDGE_PADDING,y:i})}}},[f,I,t,e.width,e.height,u.top,u.bottom,a,y]);const $=(0,_react.useCallback)(()=>{const i=getAnimatedValue(t.x);const r=getAnimatedValue(t.y);const s=i>a-e.width/2;if(o||s){let h;let p;if(g.current&&g.current.x<a-e.width/2){h=g.current.x;p=g.current.y}else{h=a-e.width-EDGE_PADDING;p=r}T.current=false;H.current=true;D(false);_reactNative.Animated.timing(t,{toValue:{x:h,y:p},duration:200,useNativeDriver:false}).start(()=>{b(h,p)})}else{g.current={x:i,y:r};H.current=false;const h=a-VISIBLE_HANDLE_WIDTH;D(true);_reactNative.Animated.timing(t,{toValue:{x:h,y:r},duration:200,useNativeDriver:false}).start(()=>{b(h,r)})}},[t,o,e.width,b,a]);const Z=(0,_react.useCallback)(()=>{w(true)},[]);const K=(0,_react.useCallback)(i=>{let{x:r,y:s}=i;const h=r+e.width/2;const p=h>a;if(p){const j=a-VISIBLE_HANDLE_WIDTH;D(true);if(g.current){g.current.y=s}else{g.current={x:a-e.width-EDGE_PADDING,y:s}}_reactNative.Animated.timing(t,{toValue:{x:j,y:s},duration:200,useNativeDriver:false}).start(()=>{b(j,s)})}else{if(o&&r<a-VISIBLE_HANDLE_WIDTH-10){D(false);T.current=false}if(r<a-e.width/2){g.current={x:r,y:s}}b(r,s)}w(false)},[t,e.width,o,b,a]);const G=(0,_react.useRef)({width:a,height:y});(0,_react.useEffect)(()=>{if(f&&!v)return;if(G.current.width===a&&G.current.height===y)return;G.current={width:a,height:y};const i=s=>({x:Math.max(u.left,Math.min(s.x,a-e.width-EDGE_PADDING)),y:Math.max(u.top+EDGE_PADDING,Math.min(s.y,y-e.height-u.bottom))});const r=i({x:getAnimatedValue(t.x),y:getAnimatedValue(t.y)});if(o)r.x=a-VISIBLE_HANDLE_WIDTH;if(g.current)g.current=i(g.current);t.stopAnimation();t.setValue(r);if(T.current)return;void b(r.x,r.y)},[a,y,v,f,e,u,o,t,b]);const tt=Boolean(N);(0,_react.useEffect)(()=>{if(!tt)return;const i=({y:s})=>ot(s+e.height+J>y-u.bottom);i({y:getAnimatedValue(t.y)});const r=t.addListener(i);return()=>t.removeListener(r)},[t,e.height,J,y,u.bottom,tt]);const at=(0,_react.useMemo)(()=>({position:"absolute",zIndex:1001,opacity:R?1:0,transform:t.getTranslateTransform()}),[t,R]);const et=(0,_react.useRef)(void 0);(0,_react.useEffect)(()=>{if(f&&!v)return;if(et.current===x)return;et.current=x;if(x!==void 0&&x>0&&o)$()},[x,v,f,o,$]);const P=F;const ut={flexDirection:"row",alignItems:"center",backgroundColor:_gameUIColors.buoyColors.card,borderTopLeftRadius:P?0:6,borderTopRightRadius:6,borderBottomLeftRadius:6,borderBottomRightRadius:6,borderLeftWidth:n?2:1,borderRightWidth:n?2:1,borderBottomWidth:n?2:1,borderTopWidth:n?2:P?0:1,borderColor:n?_floatingToolsCore.floatingToolsColors.dragActive:_gameUIColors.buoyColors.textMuted+"66",overflow:"visible",elevation:8,shadowColor:n?_floatingToolsCore.floatingToolsColors.dragActive+"99":"#000",shadowOffset:{width:0,height:n?6:4},shadowOpacity:n?.6:.3,shadowRadius:n?12:8,...c==="strip"?{borderRadius:_nightTheme.night.radius.card,borderTopLeftRadius:_nightTheme.night.radius.card,borderTopRightRadius:_nightTheme.night.radius.card,borderBottomLeftRadius:_nightTheme.night.radius.card,borderBottomRightRadius:_nightTheme.night.radius.card,minHeight:48,backgroundColor:_nightTheme.night.color.surface,borderColor:n?_nightTheme.night.color.accentBorderStrong:_nightTheme.night.color.separator,shadowOpacity:.24,shadowRadius:16}:{}};const ct={paddingHorizontal:6,paddingVertical:6,backgroundColor:_gameUIColors.buoyColors.textMuted+"1A",alignItems:"center",justifyContent:"center",width:32,...c==="strip"?{minHeight:48}:{},borderRightWidth:1,borderRightColor:_gameUIColors.buoyColors.textMuted+"66",borderTopLeftRadius:P?0:void 0,...c==="strip"?{backgroundColor:"transparent",borderRightWidth:0}:{}};const lt={flexDirection:"row",alignItems:"center",gap:6,paddingRight:8};const dt=(0,_react.useMemo)(()=>c==="strip"?_react.Children.toArray(_):interleaveWithDividers(_react.Children.toArray(_)),[_,c]);const ft=32;if(f&&!v){return null}return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:M?"none":"box-none",testID:d??"buoy-floating-tool",style:at,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{overflow:"visible"},children:[V&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:{position:"absolute",bottom:"100%",left:0,width:ft,overflow:"visible",zIndex:1001},children:V}),(0,_jsxRuntime.jsxs)(_DraggableHeader.DraggableHeader,{position:t,enabled:S,claimOnMove:false,onDragStart:Z,onDragEnd:K,containerBounds:{width:a,height:y},elementSize:e,minPosition:{x:u.left,y:u.top+EDGE_PADDING},maxOverflowX:e.width,hitSlop:{top:10,bottom:10,left:10,right:10},style:ut,onLayout:i=>{const{width:r,height:s}=i.nativeEvent.layout;E({width:r,height:s});if(R)return;O(true);if(o||n||T.current)return;const h=getAnimatedValue(t.x);const p=getAnimatedValue(t.y);const j=a-r-EDGE_PADDING;const L=y-s-u.bottom-EDGE_PADDING-(C==="bottom"?B:0);if(h<=j&&p<=L)return;const k={x:Math.max(u.left,Math.min(h,j)),y:Math.max(u.top+EDGE_PADDING,Math.min(p,L))};t.setValue(k);b(k.x,k.y)},children:[(0,_jsxRuntime.jsxs)(_DraggableHeader.DraggableHeader,{position:t,testID:d?`${d}-grip`:"buoy-floating-grip",accessibilityLabel:A,onDragStart:Z,onDragEnd:K,onTap:$,containerBounds:{width:a,height:y},elementSize:e,minPosition:{x:u.left,y:u.top+EDGE_PADDING},style:ct,enabled:true,maxOverflowX:e.width,children:[(0,_jsxRuntime.jsx)(_GripVerticalIcon.GripVerticalIcon,{size:c==="strip"?20:12,color:_gameUIColors.buoyColors.textSecondary+"CC"}),q]}),(0,_jsxRuntime.jsx)(FloatingToolsContext.Provider,{value:{isDragging:n},children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:lt,children:[l&&Y&&W&&z&&(0,_jsxRuntime.jsx)(_EnvironmentSelectorInline.EnvironmentSelectorInline,{currentEnvironment:Y,availableEnvironments:W,onSelect:z}),dt]})})]}),!o&&N&&(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:i=>rt(i.nativeEvent.layout.height),style:{position:"absolute",...nt?{bottom:"100%"}:{top:"100%"},left:0,width:"100%",zIndex:1002},children:N})]})})}function getBubbleAnchorPosition(){return null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.LOG_LIST_PRESET=exports.EVENT_LIST_PRESET=exports.CLIP_OFFSCREEN_CELLS=void 0;const CLIP_OFFSCREEN_CELLS=exports.CLIP_OFFSCREEN_CELLS=!(typeof process!=="undefined"&&process.env?.EXPO_PUBLIC_E2E);const EVENT_LIST_PRESET=exports.EVENT_LIST_PRESET={initialNumToRender:12,maxToRenderPerBatch:8,windowSize:5,updateCellsBatchingPeriod:50,removeClippedSubviews:CLIP_OFFSCREEN_CELLS};const LOG_LIST_PRESET=exports.LOG_LIST_PRESET={initialNumToRender:30,maxToRenderPerBatch:30,windowSize:21,removeClippedSubviews:CLIP_OFFSCREEN_CELLS};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.LOG_LIST_PRESET=exports.EVENT_LIST_PRESET=exports.CLIP_OFFSCREEN_CELLS=void 0;var _reactNative=require("react-native");const CLIP_OFFSCREEN_CELLS=exports.CLIP_OFFSCREEN_CELLS=!(typeof process!=="undefined"&&process.env?.EXPO_PUBLIC_E2E);const KEYBOARD_TAPS={keyboardShouldPersistTaps:"handled",keyboardDismissMode:_reactNative.Platform.OS==="web"?"none":"on-drag"};const EVENT_LIST_PRESET=exports.EVENT_LIST_PRESET={initialNumToRender:12,maxToRenderPerBatch:8,windowSize:5,updateCellsBatchingPeriod:50,removeClippedSubviews:CLIP_OFFSCREEN_CELLS,...KEYBOARD_TAPS};const LOG_LIST_PRESET=exports.LOG_LIST_PRESET={initialNumToRender:30,maxToRenderPerBatch:30,windowSize:21,removeClippedSubviews:CLIP_OFFSCREEN_CELLS,...KEYBOARD_TAPS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.FiberRootAnchor=void 0;exports.getAnchoredFiberRoots=getAnchoredFiberRoots;var _react=require("react");const ANCHORS="__buoyFiberRootAnchors";const HOST_ROOT=3;function anchors(){const t=globalThis;return t[ANCHORS]??=new Set}class FiberRootAnchor extends _react.Component{componentDidMount(){anchors().add(this)}componentWillUnmount(){anchors().delete(this)}render(){return null}}exports.FiberRootAnchor=FiberRootAnchor;function getAnchoredFiberRoots(){const t=new Set;for(const r of anchors()){let e=r._reactInternals;for(let o=0;e&&o<1e4;o++){if(e.tag===HOST_ROOT&&!e.return){if(e.stateNode?.current)t.add(e.stateNode);break}e=e.return}}return[...t]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"BUOY_SYNTHETIC_MARK",{enumerable:true,get:function(){return _realAppState.BUOY_SYNTHETIC_MARK}});Object.defineProperty(exports,"REMOTE_RELOAD_DELAY_MS",{enumerable:true,get:function(){return _reloadApp.REMOTE_RELOAD_DELAY_MS}});Object.defineProperty(exports,"Subscribable",{enumerable:true,get:function(){return _subscribable.Subscribable}});Object.defineProperty(exports,"absoluteFill",{enumerable:true,get:function(){return _absoluteFill.absoluteFill}});Object.defineProperty(exports,"browserRouter",{enumerable:true,get:function(){return _browserNavigation.browserRouter}});Object.defineProperty(exports,"countBuoyListener",{enumerable:true,get:function(){return _realAppState.countBuoyListener}});Object.defineProperty(exports,"displayValue",{enumerable:true,get:function(){return _displayValue.displayValue}});Object.defineProperty(exports,"flattenObject",{enumerable:true,get:function(){return _valueFormatting.flattenObject}});Object.defineProperty(exports,"formatPath",{enumerable:true,get:function(){return _valueFormatting.formatPath}});Object.defineProperty(exports,"formatValue",{enumerable:true,get:function(){return _valueFormatting.formatValue}});Object.defineProperty(exports,"getBrowserHref",{enumerable:true,get:function(){return _browserNavigation.getBrowserHref}});Object.defineProperty(exports,"getBrowserRouteURL",{enumerable:true,get:function(){return _browserNavigation.getBrowserRouteURL}});Object.defineProperty(exports,"getBrowserStorage",{enumerable:true,get:function(){return _browserAsyncStorage.getBrowserStorage}});Object.defineProperty(exports,"getCachedOptionalModule",{enumerable:true,get:function(){return _loadOptionalModule.getCachedOptionalModule}});Object.defineProperty(exports,"getConstructorName",{enumerable:true,get:function(){return _typeHelpers.getConstructorName}});Object.defineProperty(exports,"getDOMControlProps",{enumerable:true,get:function(){return _domRuntime.getDOMControlProps}});Object.defineProperty(exports,"getDOMFiber",{enumerable:true,get:function(){return _domRuntime.getDOMFiber}});Object.defineProperty(exports,"getDOMNodeHandle",{enumerable:true,get:function(){return _domRuntime.getDOMNodeHandle}});Object.defineProperty(exports,"getDOMPublicInstance",{enumerable:true,get:function(){return _domRuntime.getDOMPublicInstance}});Object.defineProperty(exports,"getDevServerOrigin",{enumerable:true,get:function(){return _devServer.getDevServerOrigin}});Object.defineProperty(exports,"getRealAppState",{enumerable:true,get:function(){return _realAppState.getRealAppState}});Object.defineProperty(exports,"getRegisteredToolModule",{enumerable:true,get:function(){return _toolModules.getRegisteredToolModule}});Object.defineProperty(exports,"getRenderCaptureProvider",{enumerable:true,get:function(){return _renderCaptureRegistry.getRenderCaptureProvider}});Object.defineProperty(exports,"getSafeAreaInsets",{enumerable:true,get:function(){return _getSafeAreaInsets.getSafeAreaInsets}});Object.defineProperty(exports,"getSafeCurrentPathname",{enumerable:true,get:function(){return _safeExpoRouter.getSafeCurrentPathname}});Object.defineProperty(exports,"getSafeCurrentRoute",{enumerable:true,get:function(){return _safeExpoRouter.getSafeCurrentRoute}});Object.defineProperty(exports,"getSafeRouter",{enumerable:true,get:function(){return _safeExpoRouter.getSafeRouter}});Object.defineProperty(exports,"getStateSnapshotProvider",{enumerable:true,get:function(){return _stateSnapshotRegistry.getStateSnapshotProvider}});Object.defineProperty(exports,"getStateSnapshotProviders",{enumerable:true,get:function(){return _stateSnapshotRegistry.getStateSnapshotProviders}});Object.defineProperty(exports,"getStorageBackendType",{enumerable:true,get:function(){return _persistentStorage.getStorageBackendType}});Object.defineProperty(exports,"getToolModuleVersion",{enumerable:true,get:function(){return _toolModules.getToolModuleVersion}});Object.defineProperty(exports,"getTypeColor",{enumerable:true,get:function(){return _valueFormatting.getTypeColor}});Object.defineProperty(exports,"getValueSize",{enumerable:true,get:function(){return _typeHelpers.getValueSize}});Object.defineProperty(exports,"getValueType",{enumerable:true,get:function(){return _typeHelpers.getValueType}});Object.defineProperty(exports,"isDOMElement",{enumerable:true,get:function(){return _domRuntime.isDOMElement}});Object.defineProperty(exports,"isEmpty",{enumerable:true,get:function(){return _typeHelpers.isEmpty}});Object.defineProperty(exports,"isExpoRouterAvailable",{enumerable:true,get:function(){return _safeExpoRouter.isExpoRouterAvailable}});Object.defineProperty(exports,"isJsonSerializable",{enumerable:true,get:function(){return _typeHelpers.isJsonSerializable}});Object.defineProperty(exports,"isPrimitive",{enumerable:true,get:function(){return _typeHelpers.isPrimitive}});Object.defineProperty(exports,"isUsingPersistentStorage",{enumerable:true,get:function(){return _persistentStorage.isUsingPersistentStorage}});Object.defineProperty(exports,"isValidJson",{enumerable:true,get:function(){return _typeHelpers.isValidJson}});Object.defineProperty(exports,"loadOptionalModule",{enumerable:true,get:function(){return _loadOptionalModule.loadOptionalModule}});Object.defineProperty(exports,"loadToolModule",{enumerable:true,get:function(){return _loadToolModule.loadToolModule}});Object.defineProperty(exports,"notifySubscriberCountChange",{enumerable:true,get:function(){return _subscriberCountNotifier.notifySubscriberCountChange}});Object.defineProperty(exports,"parseDisplayValue",{enumerable:true,get:function(){return _displayValue.parseDisplayValue}});Object.defineProperty(exports,"parseValue",{enumerable:true,get:function(){return _valueFormatting.parseValue}});Object.defineProperty(exports,"persistentStorage",{enumerable:true,get:function(){return _persistentStorage.persistentStorage}});Object.defineProperty(exports,"realNow",{enumerable:true,get:function(){return _realNow.realNow}});Object.defineProperty(exports,"registerBrowserRouter",{enumerable:true,get:function(){return _browserNavigation.registerBrowserRouter}});Object.defineProperty(exports,"registerStateSnapshotProvider",{enumerable:true,get:function(){return _stateSnapshotRegistry.registerStateSnapshotProvider}});Object.defineProperty(exports,"registerToolModules",{enumerable:true,get:function(){return _toolModules.registerToolModules}});Object.defineProperty(exports,"reloadApp",{enumerable:true,get:function(){return _reloadApp.reloadApp}});Object.defineProperty(exports,"resolveDOMEventEmitter",{enumerable:true,get:function(){return _domRuntime.resolveDOMEventEmitter}});Object.defineProperty(exports,"resolveReloadStrategy",{enumerable:true,get:function(){return _reloadApp.resolveReloadStrategy}});Object.defineProperty(exports,"safeStringify",{enumerable:true,get:function(){return _safeStringify.safeStringify}});Object.defineProperty(exports,"scheduleReloadApp",{enumerable:true,get:function(){return _reloadApp.scheduleReloadApp}});Object.defineProperty(exports,"setRenderCaptureProvider",{enumerable:true,get:function(){return _renderCaptureRegistry.setRenderCaptureProvider}});Object.defineProperty(exports,"subscribeBrowserNavigation",{enumerable:true,get:function(){return _browserNavigation.subscribeBrowserNavigation}});Object.defineProperty(exports,"subscribeRealAppState",{enumerable:true,get:function(){return _realAppState.subscribeRealAppState}});Object.defineProperty(exports,"subscribeToBrowserStorage",{enumerable:true,get:function(){return _browserAsyncStorage.subscribeToBrowserStorage}});Object.defineProperty(exports,"subscribeToStateSnapshotProviders",{enumerable:true,get:function(){return _stateSnapshotRegistry.subscribeToStateSnapshotProviders}});Object.defineProperty(exports,"subscribeToSubscriberCountChanges",{enumerable:true,get:function(){return _subscriberCountNotifier.subscribeToSubscriberCountChanges}});Object.defineProperty(exports,"subscriberCountNotifier",{enumerable:true,get:function(){return _subscriberCountNotifier.subscriberCountNotifier}});Object.defineProperty(exports,"superJsonDeserialize",{enumerable:true,get:function(){return _minimalSuperJSON.deserialize}});Object.defineProperty(exports,"superJsonDropAnnotations",{enumerable:true,get:function(){return _minimalSuperJSON.dropAnnotations}});Object.defineProperty(exports,"superJsonSerialize",{enumerable:true,get:function(){return _minimalSuperJSON.serialize}});Object.defineProperty(exports,"truncateText",{enumerable:true,get:function(){return _valueFormatting.truncateText}});Object.defineProperty(exports,"useSafeGlobalSearchParams",{enumerable:true,get:function(){return _safeExpoRouter.useSafeGlobalSearchParams}});Object.defineProperty(exports,"useSafePathname",{enumerable:true,get:function(){return _safeExpoRouter.useSafePathname}});Object.defineProperty(exports,"useSafeRouter",{enumerable:true,get:function(){return _safeExpoRouter.useSafeRouter}});Object.defineProperty(exports,"useSafeSegments",{enumerable:true,get:function(){return _safeExpoRouter.useSafeSegments}});var _absoluteFill=require("./absoluteFill.js");var _displayValue=require("./displayValue.js");var _getSafeAreaInsets=require("./getSafeAreaInsets");var _persistentStorage=require("./persistentStorage");var _safeStringify=require("./safeStringify.js");var _typeHelpers=require("./typeHelpers.js");var _valueFormatting=require("./valueFormatting.js");var _loadOptionalModule=require("./loadOptionalModule.js");var _renderCaptureRegistry=require("./renderCaptureRegistry.js");var _stateSnapshotRegistry=require("./stateSnapshotRegistry.js");var _minimalSuperJSON=require("./minimalSuperJSON.js");var _reloadApp=require("./reloadApp.js");var _devServer=require("./devServer");var _realNow=require("./realNow.js");var _realAppState=require("./realAppState.js");var _subscribable=require("./subscribable.js");var _subscriberCountNotifier=require("./subscriberCountNotifier.js");var _safeExpoRouter=require("./safeExpoRouter");var _browserAsyncStorage=require("./browserAsyncStorage.js");var _browserNavigation=require("./browserNavigation.js");var _domRuntime=require("./domRuntime.js");var _toolModules=require("./toolModules.js");var _loadToolModule=require("./loadToolModule");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"BUOY_SYNTHETIC_MARK",{enumerable:true,get:function(){return _realAppState.BUOY_SYNTHETIC_MARK}});Object.defineProperty(exports,"FiberRootAnchor",{enumerable:true,get:function(){return _fiberRootAnchor.FiberRootAnchor}});Object.defineProperty(exports,"REMOTE_RELOAD_DELAY_MS",{enumerable:true,get:function(){return _reloadApp.REMOTE_RELOAD_DELAY_MS}});Object.defineProperty(exports,"Subscribable",{enumerable:true,get:function(){return _subscribable.Subscribable}});Object.defineProperty(exports,"absoluteFill",{enumerable:true,get:function(){return _absoluteFill.absoluteFill}});Object.defineProperty(exports,"browserRouter",{enumerable:true,get:function(){return _browserNavigation.browserRouter}});Object.defineProperty(exports,"countBuoyListener",{enumerable:true,get:function(){return _realAppState.countBuoyListener}});Object.defineProperty(exports,"displayValue",{enumerable:true,get:function(){return _displayValue.displayValue}});Object.defineProperty(exports,"flattenObject",{enumerable:true,get:function(){return _valueFormatting.flattenObject}});Object.defineProperty(exports,"formatPath",{enumerable:true,get:function(){return _valueFormatting.formatPath}});Object.defineProperty(exports,"formatValue",{enumerable:true,get:function(){return _valueFormatting.formatValue}});Object.defineProperty(exports,"getAnchoredFiberRoots",{enumerable:true,get:function(){return _fiberRootAnchor.getAnchoredFiberRoots}});Object.defineProperty(exports,"getBrowserHref",{enumerable:true,get:function(){return _browserNavigation.getBrowserHref}});Object.defineProperty(exports,"getBrowserRouteURL",{enumerable:true,get:function(){return _browserNavigation.getBrowserRouteURL}});Object.defineProperty(exports,"getBrowserStorage",{enumerable:true,get:function(){return _browserAsyncStorage.getBrowserStorage}});Object.defineProperty(exports,"getCachedOptionalModule",{enumerable:true,get:function(){return _loadOptionalModule.getCachedOptionalModule}});Object.defineProperty(exports,"getConstructorName",{enumerable:true,get:function(){return _typeHelpers.getConstructorName}});Object.defineProperty(exports,"getDOMControlProps",{enumerable:true,get:function(){return _domRuntime.getDOMControlProps}});Object.defineProperty(exports,"getDOMFiber",{enumerable:true,get:function(){return _domRuntime.getDOMFiber}});Object.defineProperty(exports,"getDOMNodeHandle",{enumerable:true,get:function(){return _domRuntime.getDOMNodeHandle}});Object.defineProperty(exports,"getDOMPublicInstance",{enumerable:true,get:function(){return _domRuntime.getDOMPublicInstance}});Object.defineProperty(exports,"getDevServerOrigin",{enumerable:true,get:function(){return _devServer.getDevServerOrigin}});Object.defineProperty(exports,"getItemChecked",{enumerable:true,get:function(){return _persistentStorage.getItemChecked}});Object.defineProperty(exports,"getRealAppState",{enumerable:true,get:function(){return _realAppState.getRealAppState}});Object.defineProperty(exports,"getRegisteredToolModule",{enumerable:true,get:function(){return _toolModules.getRegisteredToolModule}});Object.defineProperty(exports,"getRenderCaptureProvider",{enumerable:true,get:function(){return _renderCaptureRegistry.getRenderCaptureProvider}});Object.defineProperty(exports,"getSafeAreaInsets",{enumerable:true,get:function(){return _getSafeAreaInsets.getSafeAreaInsets}});Object.defineProperty(exports,"getSafeCurrentPathname",{enumerable:true,get:function(){return _safeExpoRouter.getSafeCurrentPathname}});Object.defineProperty(exports,"getSafeCurrentRoute",{enumerable:true,get:function(){return _safeExpoRouter.getSafeCurrentRoute}});Object.defineProperty(exports,"getSafeRouter",{enumerable:true,get:function(){return _safeExpoRouter.getSafeRouter}});Object.defineProperty(exports,"getStateSnapshotProvider",{enumerable:true,get:function(){return _stateSnapshotRegistry.getStateSnapshotProvider}});Object.defineProperty(exports,"getStateSnapshotProviders",{enumerable:true,get:function(){return _stateSnapshotRegistry.getStateSnapshotProviders}});Object.defineProperty(exports,"getStorageBackendType",{enumerable:true,get:function(){return _persistentStorage.getStorageBackendType}});Object.defineProperty(exports,"getToolModuleVersion",{enumerable:true,get:function(){return _toolModules.getToolModuleVersion}});Object.defineProperty(exports,"getTypeColor",{enumerable:true,get:function(){return _valueFormatting.getTypeColor}});Object.defineProperty(exports,"getValueSize",{enumerable:true,get:function(){return _typeHelpers.getValueSize}});Object.defineProperty(exports,"getValueType",{enumerable:true,get:function(){return _typeHelpers.getValueType}});Object.defineProperty(exports,"isDOMElement",{enumerable:true,get:function(){return _domRuntime.isDOMElement}});Object.defineProperty(exports,"isEmpty",{enumerable:true,get:function(){return _typeHelpers.isEmpty}});Object.defineProperty(exports,"isExpoRouterAvailable",{enumerable:true,get:function(){return _safeExpoRouter.isExpoRouterAvailable}});Object.defineProperty(exports,"isJsonSerializable",{enumerable:true,get:function(){return _typeHelpers.isJsonSerializable}});Object.defineProperty(exports,"isPrimitive",{enumerable:true,get:function(){return _typeHelpers.isPrimitive}});Object.defineProperty(exports,"isUsingPersistentStorage",{enumerable:true,get:function(){return _persistentStorage.isUsingPersistentStorage}});Object.defineProperty(exports,"isValidJson",{enumerable:true,get:function(){return _typeHelpers.isValidJson}});Object.defineProperty(exports,"loadOptionalModule",{enumerable:true,get:function(){return _loadOptionalModule.loadOptionalModule}});Object.defineProperty(exports,"loadToolModule",{enumerable:true,get:function(){return _loadToolModule.loadToolModule}});Object.defineProperty(exports,"notifySubscriberCountChange",{enumerable:true,get:function(){return _subscriberCountNotifier.notifySubscriberCountChange}});Object.defineProperty(exports,"parseDisplayValue",{enumerable:true,get:function(){return _displayValue.parseDisplayValue}});Object.defineProperty(exports,"parseValue",{enumerable:true,get:function(){return _valueFormatting.parseValue}});Object.defineProperty(exports,"persistentStorage",{enumerable:true,get:function(){return _persistentStorage.persistentStorage}});Object.defineProperty(exports,"realNow",{enumerable:true,get:function(){return _realNow.realNow}});Object.defineProperty(exports,"registerBrowserRouter",{enumerable:true,get:function(){return _browserNavigation.registerBrowserRouter}});Object.defineProperty(exports,"registerStateSnapshotProvider",{enumerable:true,get:function(){return _stateSnapshotRegistry.registerStateSnapshotProvider}});Object.defineProperty(exports,"registerToolModules",{enumerable:true,get:function(){return _toolModules.registerToolModules}});Object.defineProperty(exports,"reloadApp",{enumerable:true,get:function(){return _reloadApp.reloadApp}});Object.defineProperty(exports,"resolveDOMEventEmitter",{enumerable:true,get:function(){return _domRuntime.resolveDOMEventEmitter}});Object.defineProperty(exports,"resolveReloadStrategy",{enumerable:true,get:function(){return _reloadApp.resolveReloadStrategy}});Object.defineProperty(exports,"safeStringify",{enumerable:true,get:function(){return _safeStringify.safeStringify}});Object.defineProperty(exports,"scheduleReloadApp",{enumerable:true,get:function(){return _reloadApp.scheduleReloadApp}});Object.defineProperty(exports,"setItemChecked",{enumerable:true,get:function(){return _persistentStorage.setItemChecked}});Object.defineProperty(exports,"setRenderCaptureProvider",{enumerable:true,get:function(){return _renderCaptureRegistry.setRenderCaptureProvider}});Object.defineProperty(exports,"storageIsMemoryOnly",{enumerable:true,get:function(){return _persistentStorage.storageIsMemoryOnly}});Object.defineProperty(exports,"subscribeBrowserNavigation",{enumerable:true,get:function(){return _browserNavigation.subscribeBrowserNavigation}});Object.defineProperty(exports,"subscribeRealAppState",{enumerable:true,get:function(){return _realAppState.subscribeRealAppState}});Object.defineProperty(exports,"subscribeToBrowserStorage",{enumerable:true,get:function(){return _browserAsyncStorage.subscribeToBrowserStorage}});Object.defineProperty(exports,"subscribeToStateSnapshotProviders",{enumerable:true,get:function(){return _stateSnapshotRegistry.subscribeToStateSnapshotProviders}});Object.defineProperty(exports,"subscribeToSubscriberCountChanges",{enumerable:true,get:function(){return _subscriberCountNotifier.subscribeToSubscriberCountChanges}});Object.defineProperty(exports,"subscriberCountNotifier",{enumerable:true,get:function(){return _subscriberCountNotifier.subscriberCountNotifier}});Object.defineProperty(exports,"superJsonDeserialize",{enumerable:true,get:function(){return _minimalSuperJSON.deserialize}});Object.defineProperty(exports,"superJsonDropAnnotations",{enumerable:true,get:function(){return _minimalSuperJSON.dropAnnotations}});Object.defineProperty(exports,"superJsonSerialize",{enumerable:true,get:function(){return _minimalSuperJSON.serialize}});Object.defineProperty(exports,"truncateText",{enumerable:true,get:function(){return _valueFormatting.truncateText}});Object.defineProperty(exports,"useSafeGlobalSearchParams",{enumerable:true,get:function(){return _safeExpoRouter.useSafeGlobalSearchParams}});Object.defineProperty(exports,"useSafePathname",{enumerable:true,get:function(){return _safeExpoRouter.useSafePathname}});Object.defineProperty(exports,"useSafeRouter",{enumerable:true,get:function(){return _safeExpoRouter.useSafeRouter}});Object.defineProperty(exports,"useSafeSegments",{enumerable:true,get:function(){return _safeExpoRouter.useSafeSegments}});var _absoluteFill=require("./absoluteFill.js");var _displayValue=require("./displayValue.js");var _getSafeAreaInsets=require("./getSafeAreaInsets");var _persistentStorage=require("./persistentStorage");var _safeStringify=require("./safeStringify.js");var _typeHelpers=require("./typeHelpers.js");var _valueFormatting=require("./valueFormatting.js");var _loadOptionalModule=require("./loadOptionalModule.js");var _renderCaptureRegistry=require("./renderCaptureRegistry.js");var _stateSnapshotRegistry=require("./stateSnapshotRegistry.js");var _minimalSuperJSON=require("./minimalSuperJSON.js");var _reloadApp=require("./reloadApp.js");var _devServer=require("./devServer");var _realNow=require("./realNow.js");var _realAppState=require("./realAppState.js");var _subscribable=require("./subscribable.js");var _subscriberCountNotifier=require("./subscriberCountNotifier.js");var _safeExpoRouter=require("./safeExpoRouter");var _browserAsyncStorage=require("./browserAsyncStorage.js");var _browserNavigation=require("./browserNavigation.js");var _domRuntime=require("./domRuntime.js");var _toolModules=require("./toolModules.js");var _loadToolModule=require("./loadToolModule");var _fiberRootAnchor=require("./fiberRootAnchor.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getCachedOptionalModule=getCachedOptionalModule;exports.loadOptionalModule=loadOptionalModule;const defaultLogger={log:()=>{},warn:()=>{},error:(...e)=>{console.error("[Buoy]","[optional-module]",...e)}};const resolvedModules=new Map;const pendingLoads=new Map;const warnedKeys=new Set;async function loadOptionalModule(e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getCachedOptionalModule=getCachedOptionalModule;exports.loadOptionalModule=loadOptionalModule;const defaultLogger={log:()=>{},warn:()=>{},error:(...e)=>{console.error("[Buoy]","[optional-module]",...e)}};const resolvedModules=new Map;const pendingLoads=new Map;const warnedKeys=new Set;async function loadOptionalModule(e,n={}){if(resolvedModules.has(e)){return resolvedModules.get(e)}const r={...defaultLogger,...n.logger??{}};if(!pendingLoads.has(e)){pendingLoads.set(e,(async()=>{try{const o=await loadModuleWithFallback(e,n);const a=o?.default??o;resolvedModules.set(e,a);r.log("Loaded optional module",e);return a}catch(o){r.log("Optional module unavailable",e,o);resolvedModules.set(e,null);return null}})())}const t=await pendingLoads.get(e);pendingLoads.delete(e);if(!t&&n.warnOnceKey&&!warnedKeys.has(n.warnOnceKey)){warnedKeys.add(n.warnOnceKey);r.warn(n.warningMessage??`Module '${e}' not found.`)}return t}let dynamicImportLoader;let dynamicRequire;function getDynamicImportLoader(){if(dynamicImportLoader===void 0){try{dynamicImportLoader=new Function("moduleName","return import(moduleName);")}catch{dynamicImportLoader=null}}return dynamicImportLoader}function getDynamicRequire(){if(dynamicRequire===void 0){try{dynamicRequire=new Function("return typeof require === 'function' ? require : undefined;")()??null}catch{dynamicRequire=null}}return dynamicRequire}async function loadModuleWithFallback(e,n){if(n.loader){return await Promise.resolve(n.loader())}const r=getDynamicImportLoader();if(r){return r(e)}const t=getDynamicRequire();if(t){return t(e)}throw new Error(`No dynamic loader available for optional module '${e}'.`)}function getCachedOptionalModule(e){if(!resolvedModules.has(e)){return null}return resolvedModules.get(e)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.loadToolModule=loadToolModule;var _toolModules=require("./toolModules.js");function loadToolModule(e){const r=(0,_toolModules.getRegisteredToolModule)(e);if(r)return r;try{switch(e){case"@buoy-gg/license":return require("@buoy-gg/license");case"@buoy-gg/storage":return require("@buoy-gg/storage");case"@buoy-gg/network":return require("@buoy-gg/network");case"@buoy-gg/redux":return require("@buoy-gg/redux");case"@buoy-gg/zustand":return require("@buoy-gg/zustand");case"@buoy-gg/jotai":return require("@buoy-gg/jotai");case"@buoy-gg/react-query":return require("@buoy-gg/react-query");case"@buoy-gg/route-events":return require("@buoy-gg/route-events");case"@buoy-gg/highlight-updates":return require("@buoy-gg/highlight-updates");case"@buoy-gg/core":return require("@buoy-gg/core");case"@buoy-gg/events":return require("@buoy-gg/events");case"@buoy-gg/clock":return require("@buoy-gg/clock");case"@buoy-gg/shared-ui":return require("../index");case"@buoy-gg/shared-ui/dataViewer":return require("../dataViewer");default:throw new Error(`Unknown tool module: ${e}`)}}catch(u){throw u}}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.loadToolModule=loadToolModule;var _toolModules=require("./toolModules.js");function loadToolModule(e){const r=(0,_toolModules.getRegisteredToolModule)(e);if(r)return r;try{switch(e){case"@buoy-gg/license":return require("@buoy-gg/license");case"@buoy-gg/storage":return require("@buoy-gg/storage");case"@buoy-gg/network":return require("@buoy-gg/network");case"@buoy-gg/redux":return require("@buoy-gg/redux");case"@buoy-gg/zustand":return require("@buoy-gg/zustand");case"@buoy-gg/jotai":return require("@buoy-gg/jotai");case"@buoy-gg/react-query":return require("@buoy-gg/react-query");case"@buoy-gg/route-events":return require("@buoy-gg/route-events");case"@buoy-gg/highlight-updates":return require("@buoy-gg/highlight-updates");case"@buoy-gg/core":return require("@buoy-gg/core");case"@buoy-gg/events":return require("@buoy-gg/events");case"@buoy-gg/memory-leaks":return require("@buoy-gg/memory-leaks");case"@buoy-gg/clock":return require("@buoy-gg/clock");case"@buoy-gg/shared-ui":return require("../index");case"@buoy-gg/shared-ui/dataViewer":return require("../dataViewer");default:throw new Error(`Unknown tool module: ${e}`)}}catch(u){throw u}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.deserialize=deserialize;exports.dropAnnotations=dropAnnotations;exports.serialize=serialize;const isUndefined=n=>typeof n==="undefined";const isPlainObject=n=>{if(typeof n!=="object"||n===null)return false;if(n===Object.prototype)return false;if(Object.getPrototypeOf(n)===null)return true;return Object.getPrototypeOf(n)===Object.prototype};const isArray=n=>Array.isArray(n);const isPrimitive=n=>typeof n==="boolean"||n===null||typeof n==="undefined"||typeof n==="number"||typeof n==="string"||typeof n==="symbol";const isDate=n=>n instanceof Date&&!isNaN(n.valueOf());const isError=n=>n instanceof Error;const isRegExp=n=>n instanceof RegExp;const isSet=n=>n instanceof Set;const isMap=n=>n instanceof Map;const isBigint=n=>typeof n==="bigint";const isNaNValue=n=>typeof n==="number"&&isNaN(n);const isInfinite=n=>n===Infinity||n===-Infinity;const isMinusZero=n=>n===0&&1/n===-Infinity;const isURL=n=>n instanceof URL;const isTypedArray=n=>ArrayBuffer.isView(n)&&!(n instanceof DataView);const TYPED_ARRAY_CONSTRUCTORS={Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray};const transformRules=[{isApplicable:isUndefined,annotation:"undefined",transform:()=>null,untransform:()=>void 0},{isApplicable:isBigint,annotation:"bigint",transform:n=>n.toString(),untransform:n=>{if(typeof BigInt!=="undefined"){return BigInt(n)}console.error("[Buoy]","BigInt is not supported in this environment");return n}},{isApplicable:isDate,annotation:"Date",transform:n=>n.toISOString(),untransform:n=>new Date(n)},{isApplicable:isError,annotation:"Error",transform:n=>({name:n.name,message:n.message,stack:n.stack,cause:"cause"in n?n.cause:void 0}),untransform:n=>{const t=new Error(n.message);t.name=n.name;t.stack=n.stack;if(n.cause!==void 0){t.cause=n.cause}return t}},{isApplicable:isRegExp,annotation:"regexp",transform:n=>""+n,untransform:n=>{const t=n.slice(1,n.lastIndexOf("/"));const e=n.slice(n.lastIndexOf("/")+1);return new RegExp(t,e)}},{isApplicable:isSet,annotation:"set",transform:n=>[...n.values()],untransform:n=>new Set(n)},{isApplicable:isMap,annotation:"map",transform:n=>[...n.entries()],untransform:n=>new Map(n)},{isApplicable:n=>isNaNValue(n)||isInfinite(n),annotation:"number",transform:n=>{if(isNaNValue(n))return"NaN";return n>0?"Infinity":"-Infinity"},untransform:n=>Number(n)},{isApplicable:isMinusZero,annotation:"number",transform:()=>"-0",untransform:()=>-0},{isApplicable:isURL,annotation:"URL",transform:n=>n.toString(),untransform:n=>new URL(n)},{isApplicable:isTypedArray,annotation:n=>["typed-array",n.constructor.name],transform:n=>[...n],untransform:(n,t)=>{const e=Array.isArray(t)?t[1]:"Uint8Array";const r=TYPED_ARRAY_CONSTRUCTORS[e];if(!r){throw new Error(`Unknown typed array: ${e}`)}return new r(n)}}];function transformValue(n){for(const t of transformRules){if(t.isApplicable(n)){const e=typeof t.annotation==="function"?t.annotation(n):t.annotation;return{value:t.transform(n),type:e}}}return void 0}function untransformValue(n,t){for(const e of transformRules){const r=typeof e.annotation==="function"?Array.isArray(t)
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.deserialize=deserialize;exports.dropAnnotations=dropAnnotations;exports.serialize=serialize;const isUndefined=n=>typeof n==="undefined";const isPlainObject=n=>{if(typeof n!=="object"||n===null)return false;if(n===Object.prototype)return false;if(Object.getPrototypeOf(n)===null)return true;return Object.getPrototypeOf(n)===Object.prototype};const isArray=n=>Array.isArray(n);const isPrimitive=n=>typeof n==="boolean"||n===null||typeof n==="undefined"||typeof n==="number"||typeof n==="string"||typeof n==="symbol";const isDate=n=>n instanceof Date&&!isNaN(n.valueOf());const isError=n=>n instanceof Error;const isRegExp=n=>n instanceof RegExp;const isSet=n=>n instanceof Set;const isMap=n=>n instanceof Map;const isBigint=n=>typeof n==="bigint";const isNaNValue=n=>typeof n==="number"&&isNaN(n);const isInfinite=n=>n===Infinity||n===-Infinity;const isMinusZero=n=>n===0&&1/n===-Infinity;const isURL=n=>n instanceof URL;const isTypedArray=n=>ArrayBuffer.isView(n)&&!(n instanceof DataView);function wantType(n,t){if(!n)throw new Error(`This ${t} value has the wrong shape.`)}const TYPED_ARRAY_CONSTRUCTORS={Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray};const transformRules=[{isApplicable:isUndefined,annotation:"undefined",transform:()=>null,untransform:()=>void 0},{isApplicable:isBigint,annotation:"bigint",transform:n=>n.toString(),untransform:n=>{wantType(typeof n==="string"||typeof n==="number","bigint");if(typeof BigInt!=="undefined"){return BigInt(n)}console.error("[Buoy]","BigInt is not supported in this environment");return n}},{isApplicable:isDate,annotation:"Date",transform:n=>n.toISOString(),untransform:n=>{wantType(typeof n==="string"||typeof n==="number","Date");const t=new Date(n);wantType(!Number.isNaN(t.getTime()),"Date");return t}},{isApplicable:isError,annotation:"Error",transform:n=>({name:n.name,message:n.message,stack:n.stack,cause:"cause"in n?n.cause:void 0}),untransform:n=>{wantType(!!n&&typeof n==="object"&&!Array.isArray(n),"Error");const t=new Error(typeof n.message==="string"?n.message:"");if(typeof n.name==="string")t.name=n.name;if(typeof n.stack==="string")t.stack=n.stack;if(n.cause!==void 0){t.cause=n.cause}return t}},{isApplicable:isRegExp,annotation:"regexp",transform:n=>""+n,untransform:n=>{wantType(typeof n==="string","regexp");const t=n.slice(1,n.lastIndexOf("/"));const e=n.slice(n.lastIndexOf("/")+1);return new RegExp(t,e)}},{isApplicable:isSet,annotation:"set",transform:n=>[...n.values()],untransform:n=>{wantType(Array.isArray(n),"set");return new Set(n)}},{isApplicable:isMap,annotation:"map",transform:n=>[...n.entries()],untransform:n=>{wantType(Array.isArray(n)&&n.every(t=>Array.isArray(t)&&t.length===2),"map");return new Map(n)}},{isApplicable:n=>isNaNValue(n)||isInfinite(n),annotation:"number",transform:n=>{if(isNaNValue(n))return"NaN";return n>0?"Infinity":"-Infinity"},untransform:n=>{wantType(typeof n==="string","number");return Number(n)}},{isApplicable:isMinusZero,annotation:"number",transform:()=>"-0",untransform:()=>-0},{isApplicable:isURL,annotation:"URL",transform:n=>n.toString(),untransform:n=>{wantType(typeof n==="string","URL");return new URL(n)}},{isApplicable:isTypedArray,annotation:n=>["typed-array",n.constructor.name],transform:n=>[...n],untransform:(n,t)=>{wantType(Array.isArray(n),"typed-array");const e=Array.isArray(t)?t[1]:"Uint8Array";const r=typeof e==="string"&&Object.prototype.hasOwnProperty.call(TYPED_ARRAY_CONSTRUCTORS,e)?TYPED_ARRAY_CONSTRUCTORS[e]:void 0;if(!r){throw new Error(`Unknown typed array: ${e}`)}return new r(n)}}];function transformValue(n){for(const t of transformRules){if(t.isApplicable(n)){const e=typeof t.annotation==="function"?t.annotation(n):t.annotation;return{value:t.transform(n),type:e}}}return void 0}function untransformValue(n,t){for(const e of transformRules){const r=typeof e.annotation==="function"?Array.isArray(t)&&t[0]==="typed-array"&&e.isApplicable===isTypedArray:e.annotation===t;if(r){return e.untransform(n,t)}}throw new Error(`Unknown transformation: ${t}`)}const isDeep=n=>isPlainObject(n)||isArray(n)||isMap(n)||isSet(n)||isError(n);function escapeKey(n){return n.replace(/\\/g,"\\\\").replace(/\./g,"\\.")}function walker(n,t=[],e=[]){const r=isPrimitive(n);if(!r&&!isDeep(n)){const s=transformValue(n);return s?{transformedValue:s.value,annotations:{[t.map(String).map(escapeKey).join(".")]:s.type}}:{transformedValue:n}}if(!r&&e.indexOf(n)!==-1){return{transformedValue:null}}if(!isDeep(n)){const s=transformValue(n);return s?{transformedValue:s.value,annotations:t.length>0?{[t.map(String).map(escapeKey).join(".")]:s.type}:{"":s.type}}:{transformedValue:n}}const o=transformValue(n);const i=o?.value??n;const f=isArray(i)?[]:{};const a={};if(o){const s=t.length>0?t.map(String).map(escapeKey).join("."):"";a[s]=o.type}const u=isArray(i)?i.map((s,l)=>[l,s]):Object.entries(i);for(const[s,l]of u){const c=String(s);if(c==="__proto__"||c==="constructor"||c==="prototype"){throw new Error(`Detected property ${c}. This is a prototype pollution risk, please remove it from your object.`)}const p=walker(l,[...t,s],[...e,n]);f[s]=p.transformedValue;if(p.annotations){Object.assign(a,p.annotations)}}return{transformedValue:f,annotations:Object.keys(a).length>0?a:void 0}}function parsePath(n){if(n==="")return[];const t=[];let e="";for(let r=0;r<n.length;r++){const o=n.charAt(r);if(o==="\\"){const i=n.charAt(r+1);if(i==="\\"){e+="\\";r++;continue}else if(i==="."){e+=".";r++;continue}}if(o==="."){t.push(e);e="";continue}e+=o}t.push(e);return t}function cloneJson(n){if(Array.isArray(n))return n.map(cloneJson);if(isPlainObject(n)){const t={};for(const e of Object.keys(n)){Object.defineProperty(t,e,{value:cloneJson(n[e]),enumerable:true,writable:true,configurable:true})}return t}return n}const UNSAFE_PATH_KEYS=new Set(["__proto__","constructor","prototype"]);function isSafePath(n){return n.every(t=>typeof t==="number"||!UNSAFE_PATH_KEYS.has(t))}function hasOwn(n,t){return n!==null&&typeof n==="object"&&Object.prototype.hasOwnProperty.call(n,t)}function setDeep(n,t,e){if(t.length===0||!isSafePath(t)){return false}let r=n;for(let i=0;i<t.length-1;i++){if(!hasOwn(r,t[i]))return false;r=r[t[i]]}const o=t[t.length-1];if(!hasOwn(r,o))return false;r[o]=e;return true}function getDeep(n,t){let e=n;for(const r of t){if(!hasOwn(e,r)||typeof r==="string"&&UNSAFE_PATH_KEYS.has(r))return void 0;e=e[r]}return e}function resolves(n,t){if(!isSafePath(t))return false;let e=n;for(const r of t){if(!hasOwn(e,r))return false;e=e[r]}return true}function serialize(n){const t=walker(n);const e={json:t.transformedValue};if(t.annotations){e.meta={values:t.annotations}}return e}function deserialize(n,t={}){const{json:e,meta:r}=n;if(!r?.values){return cloneJson(e)}let o=cloneJson(e);const i=Object.entries(r.values).map(([f,a])=>({pathString:f,type:a,path:parsePath(f)})).sort((f,a)=>a.path.length-f.path.length);for(const{type:f,path:a}of i){try{if(a.length===0){o=untransformValue(o,f)}else{if(!resolves(o,a))continue;const u=getDeep(o,a);const s=untransformValue(u,f);setDeep(o,a,s)}}catch(u){if(!t.skipBadAnnotations)throw u}}return o}function dropAnnotations(n,t){const e=n.meta?.values;if(!e)return n;const r={};for(const[o,i]of Object.entries(e)){let f;try{const a=parsePath(o);if(a.length>0&&!resolves(n.json,a))continue;f=getDeep(n.json,a)}catch{continue}if(!t(f,i))r[o]=i}return Object.keys(r).length?{json:n.json,meta:{values:r}}:{json:n.json}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getStorageBackendType=getStorageBackendType;exports.isUsingPersistentStorage=isUsingPersistentStorage;exports.persistentStorage=void 0;exports.resetStorageInit=resetStorageInit;var _devToolsStorageKeys=require("../storage/devToolsStorageKeys.js");var _storageWrites=require("./storageWrites.js");var _asyncStorageNative=require("./asyncStorageNative.js");let storageBackend=null;let initPromise=null;let initWarningShown=false;let FileSystem=null;let AsyncStorage=null;const memoryStore=new Map;function isWebEnvironment(){return typeof window!=="undefined"&&window?.localStorage!==void 0}const STORAGE_DIR_NAME="react-buoy";const HEALTH_CHECK_FILE_NAME=".health-check";function getStorageDir(){if(!FileSystem?.documentDirectory)return null;return`${FileSystem.documentDirectory}${STORAGE_DIR_NAME}/`}function encodeKeyForFs(t){return encodeURIComponent(t.replace(/~/g,"~0").replace(/\//g,"~1"))}function decodeKeyFromFs(t){return decodeURIComponent(t).replace(/~1/g,"/").replace(/~0/g,"~")}function getFilePath(t){const e=getStorageDir();if(!e)return null;return`${e}${encodeKeyForFs(t)}.json`}function loadFileSystem(){if(FileSystem)return FileSystem;try{const t=require("expo-file-system/legacy");FileSystem=t?.default||t;if(FileSystem&&FileSystem.documentDirectory){return FileSystem}FileSystem=null}catch{}try{const t=require("expo-file-system");FileSystem=t?.default||t;if(FileSystem&&FileSystem.documentDirectory){return FileSystem}FileSystem=null}catch{}return null}function loadAsyncStorage(){if(AsyncStorage)return AsyncStorage;if(!(0,_asyncStorageNative.hasAsyncStorageNative)())return null;try{const t=require("@react-native-async-storage/async-storage");AsyncStorage=t?.default||t;if(AsyncStorage&&typeof AsyncStorage.getItem==="function"){return AsyncStorage}AsyncStorage=null}catch{}return null}async function testFileSystem(){const t=loadFileSystem();if(!t||!t.documentDirectory){return false}const e=getStorageDir();if(!e)return false;const r=`${e}${HEALTH_CHECK_FILE_NAME}`;try{const n=await t.getInfoAsync(e);if(!n.exists){await t.makeDirectoryAsync(e,{intermediates:true})}const s=`health-check-${Date.now()}`;await t.writeAsStringAsync(r,s);const a=await t.readAsStringAsync(r);if(a!==s){return false}await t.deleteAsync(r,{idempotent:true});return true}catch(n){console.warn("[Buoy]","[React Buoy] FileSystem health check failed:",n);return false}}async function migrateFromAsyncStorage(){const t=loadAsyncStorage();if(!t)return;try{const e=await t.getAllKeys();const r=e.filter(a=>a.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base));if(r.length===0){return}const n=await t.multiGet(r);let s=0;for(const[a,o]of n){if(o!==null){await fileSystemStorage.setItem(a,o);s++}}void s}catch(e){console.warn("[Buoy]","[React Buoy] Migration failed:",e)}}const fileSystemStorage={async getItem(t){const e=loadFileSystem();if(!e)return null;const r=getFilePath(t);if(!r)return null;try{const n=await e.getInfoAsync(r);if(!n.exists){return null}const s=await e.readAsStringAsync(r);return s}catch{return null}},async setItem(t,e){const r=loadFileSystem();if(!r)return;const n=getStorageDir();const s=getFilePath(t);if(!n||!s)return;try{const a=await r.getInfoAsync(n);if(!a.exists){await r.makeDirectoryAsync(n,{intermediates:true})}await r.writeAsStringAsync(s,e)}catch(a){console.warn("[Buoy]","[React Buoy] FileSystem write failed:",a)}},async removeItem(t){const e=loadFileSystem();if(!e)return;const r=getFilePath(t);if(!r)return;try{await e.deleteAsync(r,{idempotent:true})}catch{}},async getAllKeys(){const t=loadFileSystem();if(!t)return[];const e=getStorageDir();if(!e)return[];try{const r=await t.getInfoAsync(e);if(!r.exists)return[];const n=await t.readDirectoryAsync(e);return n.filter(s=>s.endsWith(".json")).map(s=>decodeKeyFromFs(s.replace(".json","")))}catch{return[]}},async multiGet(t){const e=[];for(const r of t){const n=await this.getItem(r);e.push([r,n])}return e},async multiRemove(t){for(const e of t){await this.removeItem(e)}},async clear(){const t=loadFileSystem();if(!t)return;const e=getStorageDir();if(!e)return;try{await t.deleteAsync(e,{idempotent:true})}catch{}}};const asyncStorageAdapter={async getItem(t){const e=loadAsyncStorage();if(!e)return memoryStore.get(t)??null;try{return await e.getItem(t)}catch{return memoryStore.get(t)??null}},async setItem(t,e){const r=loadAsyncStorage();if(!r){memoryStore.set(t,e);return}try{await r.setItem(t,e)}catch{memoryStore.set(t,e)}},async removeItem(t){const e=loadAsyncStorage();memoryStore.delete(t);if(!e)return;try{await e.removeItem(t)}catch{}},async getAllKeys(){const t=loadAsyncStorage();if(!t)return Array.from(memoryStore.keys());try{const e=await t.getAllKeys();return e.filter(r=>r.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base))}catch{return Array.from(memoryStore.keys())}},async multiGet(t){const e=loadAsyncStorage();if(!e){return t.map(r=>[r,memoryStore.get(r)??null])}try{const r=await e.multiGet(t);return r}catch{return t.map(r=>[r,memoryStore.get(r)??null])}},async multiRemove(t){t.forEach(r=>memoryStore.delete(r));const e=loadAsyncStorage();if(!e)return;try{await e.multiRemove(t)}catch{}},async clear(){memoryStore.clear();const t=loadAsyncStorage();if(!t)return;try{const e=await t.getAllKeys();const r=e.filter(n=>n.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base));if(r.length>0){await t.multiRemove(r)}}catch{}}};const localStorageAdapter={async getItem(t){if(!isWebEnvironment())return memoryStore.get(t)??null;try{return window.localStorage.getItem(t)}catch{return memoryStore.get(t)??null}},async setItem(t,e){if(!isWebEnvironment()){memoryStore.set(t,e);return}try{window.localStorage.setItem(t,e)}catch{memoryStore.set(t,e)}},async removeItem(t){memoryStore.delete(t);if(!isWebEnvironment())return;try{window.localStorage.removeItem(t)}catch{}},async getAllKeys(){if(!isWebEnvironment())return Array.from(memoryStore.keys());try{const t=[];const e=window.localStorage;for(let r=0;r<e.length;r++){const n=e.key(r);if(n&&n.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base)){t.push(n)}}return t}catch{return Array.from(memoryStore.keys())}},async multiGet(t){const e=[];for(const r of t){const n=await this.getItem(r);e.push([r,n])}return e},async multiRemove(t){for(const e of t){await this.removeItem(e)}},async clear(){memoryStore.clear();if(!isWebEnvironment())return;try{const t=await this.getAllKeys();const e=window.localStorage;for(const r of t){e.removeItem(r)}}catch{}}};const memoryStorage={async getItem(t){return memoryStore.get(t)??null},async setItem(t,e){memoryStore.set(t,e)},async removeItem(t){memoryStore.delete(t)},async getAllKeys(){return Array.from(memoryStore.keys())},async multiGet(t){return t.map(e=>[e,memoryStore.get(e)??null])},async multiRemove(t){t.forEach(e=>memoryStore.delete(e))},async clear(){memoryStore.clear()}};async function initStorage(){if(storageBackend!==null)return;const t=await testFileSystem();if(t){const e=await fileSystemStorage.getAllKeys();if(e.length===0){await migrateFromAsyncStorage()}storageBackend="filesystem"}else if(isWebEnvironment()){storageBackend="localstorage"}else{const e=loadAsyncStorage();if(e){storageBackend="asyncstorage";if(!initWarningShown){initWarningShown=true;console.warn("[Buoy]","[React Buoy] Using AsyncStorage fallback. Settings may be lost if AsyncStorage is cleared. Install expo-file-system for persistent storage.")}}else{storageBackend="memory";if(!initWarningShown){initWarningShown=true;console.warn("[Buoy]","[React Buoy] Using in-memory storage. Settings will be lost on app restart.")}}}}function ensureInit(){if(!initPromise){initPromise=initStorage()}return initPromise}function getStorage(){switch(storageBackend){case"filesystem":return fileSystemStorage;case"asyncstorage":return asyncStorageAdapter;case"localstorage":return localStorageAdapter;case"memory":default:return memoryStorage}}const persistentStorage=exports.persistentStorage={async getItem(t){await ensureInit();return getStorage().getItem(t)},async setItem(t,e){await ensureInit();await getStorage().setItem(t,e);(0,_storageWrites.notifyStorageWrite)(t,e)},async removeItem(t){await ensureInit();await getStorage().removeItem(t);(0,_storageWrites.notifyStorageWrite)(t,null)},async getAllKeys(){await ensureInit();return getStorage().getAllKeys()},async multiGet(t){await ensureInit();return getStorage().multiGet(t)},async multiRemove(t){await ensureInit();return getStorage().multiRemove(t)},async clear(){await ensureInit();return getStorage().clear()}};async function isUsingPersistentStorage(){await ensureInit();return storageBackend==="filesystem"}async function getStorageBackendType(){await ensureInit();return storageBackend??"memory"}function resetStorageInit(){storageBackend=null;initPromise=null;initWarningShown=false}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getItemChecked=getItemChecked;exports.getStorageBackendType=getStorageBackendType;exports.isUsingPersistentStorage=isUsingPersistentStorage;exports.persistentStorage=void 0;exports.resetStorageInit=resetStorageInit;exports.setFileSystemForTests=setFileSystemForTests;exports.setItemChecked=setItemChecked;exports.storageIsMemoryOnly=storageIsMemoryOnly;var _devToolsStorageKeys=require("../storage/devToolsStorageKeys.js");var _storageWrites=require("./storageWrites.js");var _asyncStorageNative=require("./asyncStorageNative.js");let storageBackend=null;let initPromise=null;let initWarningShown=false;let FileSystem=null;let AsyncStorage=null;const memoryStore=new Map;function isWebEnvironment(){return typeof window!=="undefined"&&window?.localStorage!==void 0}const STORAGE_DIR_NAME="react-buoy";const HEALTH_CHECK_FILE_NAME=".health-check";function getStorageDir(){if(!FileSystem?.documentDirectory)return null;return`${FileSystem.documentDirectory}${STORAGE_DIR_NAME}/`}function encodeKeyForFs(t){return encodeURIComponent(t.replace(/~/g,"~0").replace(/\//g,"~1"))}function decodeKeyFromFs(t){return decodeURIComponent(t).replace(/~1/g,"/").replace(/~0/g,"~")}function getFilePath(t){const e=getStorageDir();if(!e)return null;return`${e}${encodeKeyForFs(t)}.json`}function loadFileSystem(){if(FileSystem)return FileSystem;try{const t=require("expo-file-system/legacy");FileSystem=t?.default||t;if(FileSystem&&FileSystem.documentDirectory){return FileSystem}FileSystem=null}catch{}try{const t=require("expo-file-system");FileSystem=t?.default||t;if(FileSystem&&FileSystem.documentDirectory){return FileSystem}FileSystem=null}catch{}return null}function loadAsyncStorage(){if(AsyncStorage)return AsyncStorage;if(!(0,_asyncStorageNative.hasAsyncStorageNative)())return null;try{const t=require("@react-native-async-storage/async-storage");AsyncStorage=t?.default||t;if(AsyncStorage&&typeof AsyncStorage.getItem==="function"){return AsyncStorage}AsyncStorage=null}catch{}return null}async function testFileSystem(){const t=loadFileSystem();if(!t||!t.documentDirectory){return false}const e=getStorageDir();if(!e)return false;const r=`${e}${HEALTH_CHECK_FILE_NAME}`;try{const n=await t.getInfoAsync(e);if(!n.exists){await t.makeDirectoryAsync(e,{intermediates:true})}const a=`health-check-${Date.now()}`;await t.writeAsStringAsync(r,a);const s=await t.readAsStringAsync(r);if(s!==a){return false}await t.deleteAsync(r,{idempotent:true});return true}catch(n){console.warn("[Buoy]","[React Buoy] FileSystem health check failed:",n);return false}}async function migrateFromAsyncStorage(){const t=loadAsyncStorage();if(!t)return;try{const e=await t.getAllKeys();const r=e.filter(s=>s.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base));if(r.length===0){return}const n=await t.multiGet(r);let a=0;for(const[s,o]of n){if(o!==null){await fileSystemStorage.setItem(s,o);a++}}void a}catch(e){console.warn("[Buoy]","[React Buoy] Migration failed:",e)}}const wholeWrites=new Map;function fileSystemWriteWhole(t,e){const r=(wholeWrites.get(t)??Promise.resolve()).catch(()=>{}).then(()=>writeWholeNow(t,e));const n=r.catch(()=>{});wholeWrites.set(t,n);void n.then(()=>{if(wholeWrites.get(t)===n)wholeWrites.delete(t)});return r}async function writeWholeNow(t,e){const r=loadFileSystem();const n=getStorageDir();const a=getFilePath(t);if(!r||!n||!a)return false;if(!r.moveAsync)return fileSystemWrite(t,e);const s=`${a}.tmp`;let o=false;let c=false;try{const i=await r.getInfoAsync(n);if(!i.exists)await r.makeDirectoryAsync(n,{intermediates:true});if(!(await r.getInfoAsync(a)).exists&&(await r.getInfoAsync(s)).exists){try{await r.moveAsync({from:s,to:a})}catch{return false}}c=true;await r.writeAsStringAsync(s,e);try{await r.moveAsync({from:s,to:a})}catch{await r.deleteAsync(a,{idempotent:true});o=true;await r.moveAsync({from:s,to:a})}return true}catch(i){console.warn("[Buoy]","[React Buoy] FileSystem write failed:",i);if(!o){if(c)await r.deleteAsync(s,{idempotent:true}).catch(()=>{});return false}return r.getInfoAsync(s).then(l=>l.exists,()=>false)}}async function readFileChecked(t,e){if((await t.getInfoAsync(e)).exists)return t.readAsStringAsync(e);const r=`${e}.tmp`;if(t.moveAsync&&(await t.getInfoAsync(r)).exists)return t.readAsStringAsync(r);return null}function fileStoreDown(){return storageBackend!=="filesystem"&&!!loadFileSystem()&&!!getStorageDir()}async function fileSystemWrite(t,e){const r=loadFileSystem();if(!r)return false;const n=getStorageDir();const a=getFilePath(t);if(!n||!a)return false;try{const s=await r.getInfoAsync(n);if(!s.exists){await r.makeDirectoryAsync(n,{intermediates:true})}await r.writeAsStringAsync(a,e);return true}catch(s){console.warn("[Buoy]","[React Buoy] FileSystem write failed:",s);return false}}async function asyncStorageWrite(t,e){const r=loadAsyncStorage();if(!r){memoryStore.set(t,e);return false}try{await r.setItem(t,e);return true}catch{memoryStore.set(t,e);return false}}async function localStorageWrite(t,e){if(!isWebEnvironment()){memoryStore.set(t,e);return false}try{window.localStorage.setItem(t,e);return true}catch{memoryStore.set(t,e);return false}}const fileSystemStorage={async getItem(t){const e=loadFileSystem();if(!e)return null;const r=getFilePath(t);if(!r)return null;try{return await readFileChecked(e,r)}catch{return null}},async setItem(t,e){await fileSystemWrite(t,e)},async removeItem(t){const e=loadFileSystem();if(!e)return;const r=getFilePath(t);if(!r)return;try{await e.deleteAsync(`${r}.tmp`,{idempotent:true});await e.deleteAsync(r,{idempotent:true})}catch{}},async getAllKeys(){const t=loadFileSystem();if(!t)return[];const e=getStorageDir();if(!e)return[];try{const r=await t.getInfoAsync(e);if(!r.exists)return[];const n=await t.readDirectoryAsync(e);const a=new Set;for(const s of n){const o=s.endsWith(".json")?s.slice(0,-".json".length):s.endsWith(".json.tmp")?s.slice(0,-".json.tmp".length):null;if(o!==null)a.add(decodeKeyFromFs(o))}return[...a]}catch{return[]}},async multiGet(t){const e=[];for(const r of t){const n=await this.getItem(r);e.push([r,n])}return e},async multiRemove(t){for(const e of t){await this.removeItem(e)}},async clear(){const t=loadFileSystem();if(!t)return;const e=getStorageDir();if(!e)return;try{await t.deleteAsync(e,{idempotent:true})}catch{}}};const asyncStorageAdapter={async getItem(t){const e=loadAsyncStorage();if(!e)return memoryStore.get(t)??null;try{return await e.getItem(t)}catch{return memoryStore.get(t)??null}},async setItem(t,e){await asyncStorageWrite(t,e)},async removeItem(t){const e=loadAsyncStorage();memoryStore.delete(t);if(!e)return;try{await e.removeItem(t)}catch{}},async getAllKeys(){const t=loadAsyncStorage();if(!t)return Array.from(memoryStore.keys());try{const e=await t.getAllKeys();return e.filter(r=>r.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base))}catch{return Array.from(memoryStore.keys())}},async multiGet(t){const e=loadAsyncStorage();if(!e){return t.map(r=>[r,memoryStore.get(r)??null])}try{const r=await e.multiGet(t);return r}catch{return t.map(r=>[r,memoryStore.get(r)??null])}},async multiRemove(t){t.forEach(r=>memoryStore.delete(r));const e=loadAsyncStorage();if(!e)return;try{await e.multiRemove(t)}catch{}},async clear(){memoryStore.clear();const t=loadAsyncStorage();if(!t)return;try{const e=await t.getAllKeys();const r=e.filter(n=>n.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base));if(r.length>0){await t.multiRemove(r)}}catch{}}};const localStorageAdapter={async getItem(t){if(!isWebEnvironment())return memoryStore.get(t)??null;try{return window.localStorage.getItem(t)}catch{return memoryStore.get(t)??null}},async setItem(t,e){await localStorageWrite(t,e)},async removeItem(t){memoryStore.delete(t);if(!isWebEnvironment())return;try{window.localStorage.removeItem(t)}catch{}},async getAllKeys(){if(!isWebEnvironment())return Array.from(memoryStore.keys());try{const t=[];const e=window.localStorage;for(let r=0;r<e.length;r++){const n=e.key(r);if(n&&n.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base)){t.push(n)}}return t}catch{return Array.from(memoryStore.keys())}},async multiGet(t){const e=[];for(const r of t){const n=await this.getItem(r);e.push([r,n])}return e},async multiRemove(t){for(const e of t){await this.removeItem(e)}},async clear(){memoryStore.clear();if(!isWebEnvironment())return;try{const t=await this.getAllKeys();const e=window.localStorage;for(const r of t){e.removeItem(r)}}catch{}}};const memoryStorage={async getItem(t){return memoryStore.get(t)??null},async setItem(t,e){memoryStore.set(t,e)},async removeItem(t){memoryStore.delete(t)},async getAllKeys(){return Array.from(memoryStore.keys())},async multiGet(t){return t.map(e=>[e,memoryStore.get(e)??null])},async multiRemove(t){t.forEach(e=>memoryStore.delete(e))},async clear(){memoryStore.clear()}};async function initStorage(){if(storageBackend!==null)return;const t=await testFileSystem();if(t){const e=await fileSystemStorage.getAllKeys();if(e.length===0){await migrateFromAsyncStorage()}storageBackend="filesystem"}else if(isWebEnvironment()){storageBackend="localstorage"}else{const e=loadAsyncStorage();if(e){storageBackend="asyncstorage";if(!initWarningShown){initWarningShown=true;console.warn("[Buoy]","[React Buoy] Using AsyncStorage fallback. Settings may be lost if AsyncStorage is cleared. Install expo-file-system for persistent storage.")}}else{storageBackend="memory";if(!initWarningShown){initWarningShown=true;console.warn("[Buoy]","[React Buoy] Using in-memory storage. Settings will be lost on app restart.")}}}}function ensureInit(){if(!initPromise){initPromise=initStorage()}return initPromise}function getStorage(){switch(storageBackend){case"filesystem":return fileSystemStorage;case"asyncstorage":return asyncStorageAdapter;case"localstorage":return localStorageAdapter;case"memory":default:return memoryStorage}}const persistentStorage=exports.persistentStorage={async getItem(t){await ensureInit();return getStorage().getItem(t)},async setItem(t,e){await ensureInit();await getStorage().setItem(t,e);(0,_storageWrites.notifyStorageWrite)(t,e)},async removeItem(t){await ensureInit();await getStorage().removeItem(t);(0,_storageWrites.notifyStorageWrite)(t,null)},async getAllKeys(){await ensureInit();return getStorage().getAllKeys()},async multiGet(t){await ensureInit();return getStorage().multiGet(t)},async multiRemove(t){await ensureInit();return getStorage().multiRemove(t)},async clear(){await ensureInit();return getStorage().clear()}};async function setItemChecked(t,e,r){await ensureInit();if(r?.strict&&fileStoreDown())return false;let n;switch(storageBackend){case"filesystem":n=await fileSystemWriteWhole(t,e);break;case"asyncstorage":n=await asyncStorageWrite(t,e);break;case"localstorage":n=await localStorageWrite(t,e);break;default:await persistentStorage.setItem(t,e);return false}(0,_storageWrites.notifyStorageWrite)(t,e);return n}async function getItemChecked(t){await ensureInit();if(fileStoreDown())throw new Error("The saved files can't be used right now.");switch(storageBackend){case"filesystem":{const e=loadFileSystem();const r=getFilePath(t);if(!e||!r)throw new Error("Storage isn't ready.");return readFileChecked(e,r)}case"asyncstorage":{const e=loadAsyncStorage();if(!e)throw new Error("Storage isn't ready.");return e.getItem(t)}case"localstorage":if(!isWebEnvironment())throw new Error("Storage isn't ready.");return window.localStorage.getItem(t);default:return memoryStore.get(t)??null}}async function isUsingPersistentStorage(){await ensureInit();return storageBackend==="filesystem"}async function storageIsMemoryOnly(){await ensureInit();return(storageBackend??"memory")==="memory"}async function getStorageBackendType(){await ensureInit();return storageBackend??"memory"}function resetStorageInit(){storageBackend=null;initPromise=null;initWarningShown=false}function setFileSystemForTests(t){FileSystem=t??null;resetStorageInit()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getStorageBackendType=getStorageBackendType;exports.isUsingPersistentStorage=isUsingPersistentStorage;exports.persistentStorage=void 0;var _devToolsStorageKeys=require("../storage/devToolsStorageKeys.js");var _storageWrites=require("./storageWrites.js");const pending=new Map;function storage(){try{return typeof window==="undefined"?null:window.localStorage}catch{return null}}const persistentStorage=exports.persistentStorage={async getItem(e){if(pending.has(e))return pending.get(e)??null;try{return storage()?.getItem(e)??null}catch{return null}},async setItem(e,t){pending.set(e,t);try{const r=storage();if(r){r.setItem(e,t);pending.delete(e)}}catch{}(0,_storageWrites.notifyStorageWrite)(e,t)},async removeItem(e){pending.set(e,null);try{const t=storage();if(t){t.removeItem(e);pending.delete(e)}}catch{}(0,_storageWrites.notifyStorageWrite)(e,null)},async getAllKeys(){const e=new Set;try{const t=storage();if(t)for(let r=0;r<t.length;r++){const s=t.key(r);if(s?.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base))e.add(s)}}catch{}for(const[t,r]of pending){if(!t.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base))continue;if(r===null)e.delete(t);else e.add(t)}return[...e]},async multiGet(e){return Promise.all(e.map(async t=>[t,await persistentStorage.getItem(t)]))},async multiRemove(e){await Promise.all(e.map(t=>persistentStorage.removeItem(t)))},async clear(){await persistentStorage.multiRemove(await persistentStorage.getAllKeys())}};async function isUsingPersistentStorage(){return storage()!==null}async function getStorageBackendType(){return storage()?"localstorage":"memory"}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getItemChecked=getItemChecked;exports.getStorageBackendType=getStorageBackendType;exports.isUsingPersistentStorage=isUsingPersistentStorage;exports.persistentStorage=void 0;exports.setItemChecked=setItemChecked;exports.storageIsMemoryOnly=storageIsMemoryOnly;var _devToolsStorageKeys=require("../storage/devToolsStorageKeys.js");var _storageWrites=require("./storageWrites.js");const pending=new Map;function storage(){try{return typeof window==="undefined"?null:window.localStorage}catch{return null}}const persistentStorage=exports.persistentStorage={async getItem(e){if(pending.has(e))return pending.get(e)??null;try{return storage()?.getItem(e)??null}catch{return null}},async setItem(e,t){pending.set(e,t);try{const r=storage();if(r){r.setItem(e,t);pending.delete(e)}}catch{}(0,_storageWrites.notifyStorageWrite)(e,t)},async removeItem(e){pending.set(e,null);try{const t=storage();if(t){t.removeItem(e);pending.delete(e)}}catch{}(0,_storageWrites.notifyStorageWrite)(e,null)},async getAllKeys(){const e=new Set;try{const t=storage();if(t)for(let r=0;r<t.length;r++){const s=t.key(r);if(s?.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base))e.add(s)}}catch{}for(const[t,r]of pending){if(!t.startsWith(_devToolsStorageKeys.devToolsStorageKeys.base))continue;if(r===null)e.delete(t);else e.add(t)}return[...e]},async multiGet(e){return Promise.all(e.map(async t=>[t,await persistentStorage.getItem(t)]))},async multiRemove(e){await Promise.all(e.map(t=>persistentStorage.removeItem(t)))},async clear(){await persistentStorage.multiRemove(await persistentStorage.getAllKeys())}};async function isUsingPersistentStorage(){return storage()!==null}async function getStorageBackendType(){return storage()?"localstorage":"memory"}async function setItemChecked(e,t,r){await persistentStorage.setItem(e,t);try{return storage()?.getItem(e)===t}catch{return false}}async function getItemChecked(e){const t=storage();if(!t)return pending.get(e)??null;return t.getItem(e)}async function storageIsMemoryOnly(){return storage()===null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.loadBrowserReload=loadBrowserReload;exports.loadDevSettings=loadDevSettings;exports.loadExpoUpdates=loadExpoUpdates;function loadExpoGoReload(){const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.loadBrowserReload=loadBrowserReload;exports.loadDevSettings=loadDevSettings;exports.loadExpoUpdates=loadExpoUpdates;function loadExpoGoReload(){const o=globalThis.expo;if(!o?.modules?.ExpoGo||typeof o.reloadAppAsync!=="function")return null;const e=o.reloadAppAsync.bind(o);return t=>{void e(t)}}function loadDevSettings(){const o=loadExpoGoReload();if(o)return{reload:o};try{const e=require("react-native");const t=e?.DevSettings;if(t&&typeof t.reload==="function"){return t}}catch{}return null}function loadExpoUpdates(){const o=globalThis.expo?.modules;if(!o?.ExpoUpdates)return null;try{const e=require("expo-updates");if(e&&typeof e.reloadAsync==="function"){return e}}catch{}return null}function loadBrowserReload(){return null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.PREVIEW_ITEM_RENDER_BYTE_LIMIT=void 0;exports.classifyPreviewItem=classifyPreviewItem;exports.createRestoreScope=createRestoreScope;exports.emptyRestoreResult=emptyRestoreResult;exports.failedRestore=failedRestore;exports.skippedRestore=skippedRestore;exports.unionKeys=unionKeys;exports.wontApply=wontApply;var _objectDiff=require("../dataViewer/objectDiff.js");const PREVIEW_ITEM_RENDER_BYTE_LIMIT=exports.PREVIEW_ITEM_RENDER_BYTE_LIMIT=256*1024;function createRestoreScope(t){const n=new Set(t?.excludeKeys??[]);const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.PREVIEW_ITEM_RENDER_BYTE_LIMIT=void 0;exports.classifyPreviewItem=classifyPreviewItem;exports.createRestoreScope=createRestoreScope;exports.emptyRestoreResult=emptyRestoreResult;exports.failedRestore=failedRestore;exports.skippedRestore=skippedRestore;exports.unionKeys=unionKeys;exports.wontApply=wontApply;var _objectDiff=require("../dataViewer/objectDiff.js");const PREVIEW_ITEM_RENDER_BYTE_LIMIT=exports.PREVIEW_ITEM_RENDER_BYTE_LIMIT=256*1024;function createRestoreScope(t){const n=new Set(t?.excludeKeys??[]);const s=t?.includeKeys?new Set(t.includeKeys):null;let e=0;const o=(r,i)=>{if(r.has(i))return true;const d=i.indexOf("/");return i.startsWith("mmkv:")&&d>5&&r.has(i.slice(0,d))};const u=r=>!o(n,r)&&(!s||o(s,r));return{touch:u,allows(r){if(u(r))return true;e+=1;return false},countExcluded(r){e+=r},get excludedHits(){return e},excludedWarning(r){return e>0?`${e} ${r} excluded by you`:null}}}function emptyRestoreResult(){return{ok:true,applied:0,skipped:[],warnings:[]}}function failedRestore(t){return{ok:false,applied:0,skipped:[],warnings:[t]}}function skippedRestore(t,n){return{ok:false,applied:0,skipped:[{id:t,reason:n}],warnings:[]}}function classifyPreviewItem(t,n={}){const{key:s,label:e,oldValue:o,newValue:u,inOld:r,inNew:i}=t;if(!i)return{key:s,label:e,verdict:"removed",oldValue:o};if(!r)return{key:s,label:e,verdict:"added",newValue:u};const d=n.equal??_objectDiff.boundedDeepEqual;if(d(o,u))return{key:s,label:e,verdict:"unchanged"};const l=n.tooLarge??(c=>(0,_objectDiff.jsonLikelyLargerThan)(c,PREVIEW_ITEM_RENDER_BYTE_LIMIT));if(l(o)||l(u)){return{key:s,label:e,verdict:"too-large",reason:n.tooLargeReason??"value too large to render a diff \u2014 restore still applies it"}}return{key:s,label:e,verdict:"changed",oldValue:o,newValue:u}}function wontApply(t,n){if(t.verdict==="unchanged")return t;return{...t,verdict:"wont-apply",reason:n}}function unionKeys(t,n){const s=e=>e===void 0?[]:e instanceof Map?Array.from(e.keys()):Object.keys(e);return new Set([...s(t),...s(n)])}
|