@buoy-gg/shared-ui 7.0.56 → 7.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/lib/commonjs/JsModal.web.js +1 -1
- package/lib/commonjs/env/EnvironmentSelectorInline.web.js +1 -1
- package/lib/commonjs/storage/capacitorAppStorage.js +1 -0
- package/lib/commonjs/storage/devToolsStorageKeys.js +1 -1
- package/lib/commonjs/storage/index.js +1 -1
- package/lib/commonjs/ui/components/ModalHeader.js +1 -1
- package/lib/commonjs/ui/components/SearchBar.js +1 -1
- package/lib/commonjs/ui/components/WindowControls.js +1 -1
- package/lib/commonjs/ui/components/index.js +1 -1
- package/lib/commonjs/ui/components/windowControlsSetting.js +1 -0
- package/lib/commonjs/ui/floating/FloatingTool.web.js +1 -1
- package/lib/commonjs/utils/asyncStorageNative.js +1 -0
- package/lib/commonjs/utils/browserNavigation.js +1 -1
- package/lib/commonjs/utils/persistentStorage.js +1 -1
- package/lib/commonjs/utils/realAppState.js +1 -1
- package/lib/module/JsModal.web.js +1 -1
- package/lib/module/env/EnvironmentSelectorInline.web.js +1 -1
- package/lib/module/storage/capacitorAppStorage.js +1 -0
- package/lib/module/storage/devToolsStorageKeys.js +1 -1
- package/lib/module/storage/index.js +1 -1
- package/lib/module/ui/components/ModalHeader.js +1 -1
- package/lib/module/ui/components/SearchBar.js +1 -1
- package/lib/module/ui/components/WindowControls.js +1 -1
- package/lib/module/ui/components/index.js +1 -1
- package/lib/module/ui/components/windowControlsSetting.js +1 -0
- package/lib/module/ui/floating/FloatingTool.web.js +1 -1
- package/lib/module/utils/asyncStorageNative.js +1 -0
- package/lib/module/utils/browserNavigation.js +1 -1
- package/lib/module/utils/persistentStorage.js +1 -1
- package/lib/module/utils/realAppState.js +1 -1
- package/lib/typescript/commonjs/JsModal.web.d.ts +2 -1
- package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/commonjs/storage/capacitorAppStorage.d.ts +15 -0
- package/lib/typescript/commonjs/storage/index.d.ts +2 -0
- package/lib/typescript/commonjs/ui/components/WindowControls.d.ts +1 -6
- package/lib/typescript/commonjs/ui/components/index.d.ts +1 -0
- package/lib/typescript/commonjs/ui/components/windowControlsSetting.d.ts +14 -0
- package/lib/typescript/commonjs/utils/asyncStorageNative.d.ts +2 -0
- package/lib/typescript/module/JsModal.web.d.ts +2 -1
- package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/module/storage/capacitorAppStorage.d.ts +15 -0
- package/lib/typescript/module/storage/index.d.ts +2 -0
- package/lib/typescript/module/ui/components/WindowControls.d.ts +1 -6
- package/lib/typescript/module/ui/components/index.d.ts +1 -0
- package/lib/typescript/module/ui/components/windowControlsSetting.d.ts +14 -0
- package/lib/typescript/module/utils/asyncStorageNative.d.ts +2 -0
- package/lib/web/asyncStorage.mjs +1 -1
- package/lib/web/chunks/chunk-4IM4VIMP.mjs +1 -0
- package/lib/web/chunks/chunk-ASHW3TI7.mjs +1 -0
- package/lib/web/chunks/{chunk-T7RZZG4A.mjs → chunk-E2MI3FII.mjs} +1 -1
- package/lib/web/chunks/{chunk-DEEKIG2L.mjs → chunk-FP44YK4E.mjs} +1 -1
- package/lib/web/chunks/chunk-L63X3LPR.mjs +1 -0
- package/lib/web/chunks/{chunk-T3WLUEET.mjs → chunk-NVD5LLXD.mjs} +1 -1
- package/lib/web/chunks/chunk-PXAINEZK.mjs +14 -0
- package/lib/web/chunks/chunk-QNLAFQET.mjs +1 -0
- package/lib/web/chunks/persistentStorage.web-3QA77BIL.mjs +1 -0
- package/lib/web/colors.mjs +1 -1
- package/lib/web/dataViewer.mjs +1 -1
- package/lib/web/floating.mjs +1 -1
- package/lib/web/history.mjs +1 -1
- package/lib/web/hooks.mjs +1 -1
- package/lib/web/index.mjs +3 -3
- package/lib/web/native.mjs +1 -1
- package/lib/web/ui.mjs +1 -1
- package/lib/web/utils.mjs +1 -1
- package/package.json +5 -5
- package/lib/web/chunks/chunk-3S2CBY6A.mjs +0 -14
- package/lib/web/chunks/chunk-46TKOKMV.mjs +0 -1
- package/lib/web/chunks/chunk-5NZOQR6Q.mjs +0 -1
- package/lib/web/chunks/chunk-T6KN54NS.mjs +0 -1
- package/lib/web/chunks/chunk-XYUAUO57.mjs +0 -1
- package/lib/web/chunks/persistentStorage.web-56ENKXFJ.mjs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{H as m,aa as y,u as p}from"./chunk-3UTMGIUG.mjs";function v(){let e={top:0,bottom:0,left:0,right:0,hasNotch:false};if(typeof document>"u"||!document.body)return e;let t=document.createElement("div");t.style.cssText="position:fixed;visibility:hidden;pointer-events:none;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom);padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)",document.body.appendChild(t);try{let n=getComputedStyle(t),o=parseFloat(n.paddingTop)||0,r=parseFloat(n.paddingBottom)||0,d=parseFloat(n.paddingLeft)||0,s=parseFloat(n.paddingRight)||0;return{top:o,bottom:r,left:d,right:s,hasNotch:o>0||r>0||d>0||s>0}}finally{t.remove()}}var u="__buoySynthetic";function c(e,t){let n=globalThis,o=n.__buoyOwnDeviceListeners??(n.__buoyOwnDeviceListeners={});o[e]=Math.max(0,(o[e]??0)+t)}var i=new Set,a="unknown",f=false;function l(){try{return p?.currentState??"unknown"}catch{return"unknown"}}function h(e){if(e!==a){a=e;for(let t of Array.from(i))try{t(e)}catch{}}}function g(){if(!f){f=true,a=l();try{if(m.OS==="web"){p.addEventListener("change",e=>h(e));return}c("appStateDidChange",1),y.addListener("appStateDidChange",e=>{!e||e[u]||e.app_state&&h(e.app_state)})}catch{}}}function b(){return g(),a==="unknown"&&(a=l()),a}function w(e){return g(),i.add(e),{remove:()=>i.delete(e)}}export{v as a,u as b,c,b as d,w as e};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";var o=process.env.NODE_ENV!=="production";typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);export{o as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{d as c}from"./chunk-CE5U3CSQ.mjs";import{a as G}from"./chunk-5NZOQR6Q.mjs";var X=e=>{if(e===null)return"null";if(e===void 0)return"undefined";if(Array.isArray(e))return"array";let t=typeof e;return t==="object"?e instanceof Date?"date":e instanceof RegExp?"regexp":e instanceof Map?"map":e instanceof Set?"set":e instanceof Error?"error":"object":t},Y=e=>{let t=typeof e;return e==null||t==="string"||t==="number"||t==="boolean"||t==="bigint"||t==="symbol"},H=e=>{try{return JSON.stringify(e),true}catch{return false}},Q=e=>{try{return JSON.parse(e),true}catch{return false}},Z=e=>{if(e===null)return"null";if(e===void 0)return"undefined";try{return e.constructor?.name||typeof e}catch{return typeof e}},ee=e=>e==null?true:typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:false,te=e=>{if(Array.isArray(e)){let t=e.length;return t===0?"empty array":t===1?"1 item":`${t} items`}if(e&&typeof e=="object"){let t=Object.keys(e).length;return t===0?"empty object":t===1?"1 key":`${t} keys`}if(typeof e=="string"){let t=e.length;return t===0?"empty string":t===1?"1 character":`${t} characters`}return""},ne=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&e.constructor===Object;var re=e=>{if(e==null)return e;if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},ae=e=>e===null?"null":e===void 0?"undefined":typeof e=="string"?`"${e}"`:typeof e=="boolean"?e?"true":"false":typeof e=="number"?String(e):typeof e=="function"?`[Function: ${e.name||"anonymous"}]`:typeof e=="object"?Array.isArray(e)?`[Array: ${e.length} items]`:`{Object: ${Object.keys(e).length} keys}`:String(e),oe=e=>{if(e===null)return c.dataTypes.null;if(e===void 0)return c.dataTypes.undefined;switch(typeof e){case"string":return c.dataTypes.string;case"number":return c.dataTypes.number;case"boolean":return c.dataTypes.boolean;case"function":return c.dataTypes.function;case"object":return Array.isArray(e)?c.dataTypes.array:c.dataTypes.object;default:return c.primary}},se=(e,t)=>e.length<=t?e:e.slice(0,t-3)+"...",v=(e,t="")=>{let n={};return e==null?n:typeof e!="object"?(n[t||"root"]=e,n):(Array.isArray(e)?e.forEach((r,a)=>{let o=t?`${t}[${a}]`:`[${a}]`;typeof r=="object"&&r!==null?Object.assign(n,v(r,o)):n[o]=r}):Object.keys(e).forEach(r=>{let a=t?`${t}.${r}`:r,o=e[r];typeof o=="object"&&o!==null?Object.assign(n,v(o,a)):n[a]=o}),n)},ie=e=>e.length===0?"root":e.map((t,n)=>typeof t=="number"?`[${t}]`:n===0?t:`.${t}`).join("");var ue={log:()=>{},warn:()=>{},error:(...e)=>{console.error("[optional-module]",...e)}},f=new Map,g=new Map,R=new Set;async function le(e,t={}){if(f.has(e))return f.get(e);let n={...ue,...t.logger??{}};g.has(e)||g.set(e,(async()=>{try{let a=await ce(e,t),o=a?.default??a;return f.set(e,o),n.log("Loaded optional module",e),o}catch(a){return n.log("Optional module unavailable",e,a),f.set(e,null),null}})());let r=await g.get(e);return g.delete(e),!r&&t.warnOnceKey&&!R.has(t.warnOnceKey)&&(R.add(t.warnOnceKey),n.warn(t.warningMessage??`Module '${e}' not found.`)),r}var L=(()=>{try{return new Function("moduleName","return import(moduleName);")}catch{return null}})(),N=(()=>{try{return new Function("return typeof require === 'function' ? require : undefined;")()}catch{return}})();async function ce(e,t){if(t.loader)return await Promise.resolve(t.loader());if(L)return L(e);if(N)return N(e);throw new Error(`No dynamic loader available for optional module '${e}'.`)}function pe(e){return f.has(e)?f.get(e):null}var _="__buoyRenderCaptureProvider";function C(){return globalThis}function de(e){C()[_]=e}function fe(){return C()[_]??null}var y=new Map,E=new Set;function M(){E.forEach(e=>{try{e()}catch{}})}function he(e){return y.set(e.id,e),M(),()=>{y.get(e.id)===e&&(y.delete(e.id),M())}}function ye(){return Array.from(y.values())}function be(e){return y.get(e)??null}function we(e){return E.add(e),()=>{E.delete(e)}}function S(){return null}function $(){return null}function j(){return typeof window>"u"?null:()=>window.location.reload()}function x(e="auto"){return e==="browser"?j()?"browser":null:e==="auto"&&j()?"browser":e==="dev-settings"?S()?"dev-settings":null:e==="expo-updates"?$()?"expo-updates":null:G&&S()?"dev-settings":$()?"expo-updates":null}function D(e){return e==="browser"?"[buoy] Browser reload requires a browser window.":e==="dev-settings"?"[buoy] DevSettings.reload() unavailable \u2014 strategy 'dev-settings' requires React Native dev mode.":e==="expo-updates"?"[buoy] expo-updates not installed \u2014 strategy 'expo-updates' requires the host app to add the dependency.":"[buoy] No reload mechanism available. Run in __DEV__ or install expo-updates."}async function P(e="auto",t="buoy reload"){let n=x(e);if(!n)throw new Error(D(e));return n==="browser"?j()():n==="dev-settings"?S().reload(t):await $().reloadAsync(),await new Promise(()=>{})}var B=250;function ge(e){let t=e?.strategy??"auto",n=x(t);if(!n)throw new Error(D(t));let r=Math.max(0,e?.delayMs??B),a=e?.reason??"buoy remote reload";return setTimeout(()=>{P(n,a).catch(()=>{})},r),{strategy:n,delayMs:r}}function me(){return null}function ve(){let e=globalThis.__buoyRealNow;return typeof e=="function"?e():Date.now()}var Ee=class{constructor(){this.listeners=new Set;this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}getListenerCount(){return this.listeners.size}notify(...e){this.listeners.forEach(t=>{t(...e)})}onSubscribe(){}onUnsubscribe(){}};var Se=class{constructor(){this.listeners=new Set}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(e){this.listeners.forEach(t=>{try{t(e)}catch{}})}},O=new Se,$e=e=>O.subscribe(e),je=e=>O.notify(e);import{useSyncExternalStore as U}from"react";var l,b=new Set,k;function xe(e){return l=e,()=>{l===e&&(l=void 0)}}function d(){return typeof location>"u"?"/":location.href}function W(e=d()){let t=new URL(e,"http://localhost");return t.hash.startsWith("#/")?new URL(t.hash.slice(1),t.origin):t}function V(e){if(!b.size&&typeof window<"u"){let t=window.history,n=t.pushState,r=t.replaceState,a=s=>{for(let p of[...b])try{p({href:d(),kind:s})}catch{}},o=function(...s){let p=Reflect.apply(n,this,s);return a("push"),p},i=function(...s){let p=Reflect.apply(r,this,s);return a("replace"),p};t.pushState=o,t.replaceState=i;let u=()=>a("pop");window.addEventListener("popstate",u),window.addEventListener("hashchange",u),k=()=>{t.pushState===o&&(t.pushState=n),t.replaceState===i&&(t.replaceState=r),window.removeEventListener("popstate",u),window.removeEventListener("hashchange",u),k=void 0}}return b.add(e),()=>{b.delete(e),b.size||k?.()}}function q(e){let t=typeof e=="string"?e:e.pathname,n=new URL(t,d());if(n.origin!==window.location.origin)throw new Error("Tool navigation must stay on the current origin.");if(typeof e!="string")for(let[r,a]of Object.entries(e.params??{}))n.searchParams.set(r,String(a));return`${n.pathname}${n.search}${n.hash}`}var w={push(e){let t=q(e);if(l)return l.push(t);window.history.pushState(null,"",window.location.hash.startsWith("#/")?`#${t}`:t),window.dispatchEvent(new PopStateEvent("popstate",{state:window.history.state}))},replace(e){let t=q(e);if(l)return l.replace(t);window.history.replaceState(window.history.state,"",window.location.hash.startsWith("#/")?`#${t}`:t),window.dispatchEvent(new PopStateEvent("popstate",{state:window.history.state}))},back(){l?l.back():window.history.back()},canGoBack(){return l?.canGoBack?.()??(typeof window<"u"&&window.history.length>1)},navigate(e){w.push(e)},setParams(e){w.replace({pathname:d(),params:e})},dismiss(e=1){window.history.go(-e)},dismissAll(){throw new Error("Use the captured browser history to select a destination.")}};var F=e=>V(e),m=W;function Oe(){return w}function I(){return U(F,d,()=>"/"),m().pathname}function ke(){return I().split("/").filter(Boolean)}function Te(){return U(F,d,()=>"/"),Object.fromEntries(m().searchParams)}function Ae(){return typeof window>"u"?null:w}function Re(){return m().pathname}function Le(){let e=m();return{pathname:e.pathname,href:`${e.pathname}${e.search}${e.hash}`,segments:e.pathname.split("/").filter(Boolean)}}function Ne(){return false}var z=new WeakMap,_e=1;function h(e){return!!e&&typeof e=="object"&&e.nodeType===1&&typeof e.getBoundingClientRect=="function"}function T(e){if(!h(e))return null;let t=z.get(e);return t===void 0&&(t=_e++,z.set(e,t)),t}function Ce(e){if(!h(e))return null;let t=Object.keys(e).find(n=>n.startsWith("__reactFiber$"));return t?e[t]:null}function Me(e,t){if(!h(e)||!t)return t;let n=e,r=e.tagName.toLowerCase(),a=r==="input"&&(n.type==="checkbox"||n.type==="radio"),o=r==="input"&&n.type==="range",i=r==="textarea"||r==="select"||r==="input"&&!a&&!o&&!["button","submit","reset","file","hidden"].includes(n.type),u=s=>{if(a){n.checked!==!!s&&n.click();return}let p=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(n),"value")?.set;p?p.call(n,String(s)):n.value=String(s),n.dispatchEvent(new Event("input",{bubbles:true})),n.dispatchEvent(new Event("change",{bubbles:true}))};return{...t,__buoyDevToolsRoot:t.__buoyDevToolsRoot||t["data-buoy-root"]!==void 0,testID:t.testID??t["data-testid"],nativeID:t.nativeID??t.id,accessibilityLabel:t.accessibilityLabel??t["aria-label"],accessibilityRole:t.accessibilityRole??t.role??(r==="button"?"button":r==="a"?"link":a?n.type:i?"textbox":o?"slider":void 0),onPress:t.onPress??(typeof t.onClick=="function"||r==="button"||r==="a"?()=>n.click():void 0),...a||o?{onValueChange:u,value:a?n.checked:Number(n.value),...o?{minimumValue:Number(n.min||0),maximumValue:Number(n.max||100)}:{}}:{},...i?{onChangeText:u,value:n.value}:{}}}function De(e){return h(e)?{__nativeTag:T(e),measure(t){let n=e.getBoundingClientRect();t(n.x,n.y,n.width,n.height,n.x,n.y)},measureInWindow(t){let n=e.getBoundingClientRect();t(n.x,n.y,n.width,n.height)},requestTVFocus(){e.focus()},focus(){e.focus()}}:null}var Pe={topFocus:"focus",topBlur:"blur",topTouchStart:"pointerdown",topTouchMove:"pointermove",topTouchEnd:"pointerup",topTouchCancel:"pointercancel",topChange:"input",topValueChange:"input",topSlidingComplete:"change"};function Be(){return typeof document>"u"?{emitter:null,reason:"DOM events are unavailable during server rendering."}:{reason:null,emitter:{addListener(e,t){let n=Pe[e];if(!n)throw new Error(`Unsupported DOM event: ${e}`);let r=a=>{let o=a.composedPath()[0]??a.target;if(!h(o))return;let i=o,u=a,s={target:T(o),pageX:u.clientX,pageY:u.clientY};(n==="input"||n==="change")&&(i.type==="checkbox"||i.type==="radio"?s.value=i.checked:i.type==="range"?s.value=Number(i.value):s.text=i.value??o.textContent??""),t({eventName:e,nativeEvent:s})};return document.addEventListener(n,r,true),{remove:()=>document.removeEventListener(n,r,true)}}}}}var A=new Map,J=0;function Ue(e){for(let[t,n]of Object.entries(e)){let r=t.startsWith("@buoy-gg/")?t.replace(/\/web$/,""):`@buoy-gg/${t}`;A.get(r)!==n&&(A.set(r,n),J++)}}function K(e){return A.get(e)??null}function We(){return J}function Ve(e){let t=K(e);if(!t)throw new Error(`Register ${e} with createWebTools before opening tools that use it.`);return t}export{Ee as a,O as b,$e as c,je as d,X as e,Y as f,H as g,Q as h,Z as i,ee as j,te as k,ne as l,ve as m,re as n,ae as o,oe as p,se as q,v as r,ie as s,le as t,pe as u,de as v,fe as w,he as x,ye as y,be as z,we as A,x as B,P as C,B as D,ge as E,me as F,xe as G,d as H,W as I,V as J,w as K,Oe as L,I as M,ke as N,Te as O,Ae as P,Re as Q,Le as R,Ne as S,h as T,T as U,Ce as V,Me as W,De as X,Be as Y,Ue as Z,K as _,We as $,Ve as aa};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{a as F}from"./chunk-GF5C5DVX.mjs";var me=-40,he=20,fe=10;function Q(){return window.innerHeight/2}function Z(){return Q()-130}function ee(){return Z()+-40-20-10}import{useState as te,useRef as S,useCallback as B,useEffect as w,useMemo as ie,Children as ne}from"react";import{useFloatingTools as be,FloatingToolsProvider as we,useFloatingToolsContext as ve,interleaveWithDividers as ye,floatingToolsColors as h,withAlpha as D,getUserStatusConfig as xe,getGripIconLayout as Se,interpolatePosition as Ce,easing as De,VISIBLE_HANDLE_WIDTH as oe,ANIMATION_DURATION as Ie}from"@buoy-gg/floating-tools-react/web/floating";import{jsx as c,jsxs as j}from"react/jsx-runtime";var X={getItem:e=>localStorage.getItem(e),setItem:(e,i)=>localStorage.setItem(e,i)},re="#A0A0A0";function Pe({size:e=24,color:i=D(re,"CC")}){let n=Se(e);return c("div",{style:{width:e,height:e,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center"},children:[0,1].map(s=>c("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",marginLeft:n.columnGap/2,marginRight:n.columnGap/2},children:[0,1,2].map(p=>c("div",{style:{width:n.dotSize,height:n.dotSize,borderRadius:n.dotSize/2,backgroundColor:i,marginTop:n.rowGap/2,marginBottom:n.rowGap/2}},p))},s))})}function ae(){return c("div",{style:{width:1,height:12,backgroundColor:D(h.muted,"66"),flexShrink:0}})}var Re={success:h.success,optional:h.optional,muted:h.muted,secondary:re};function ke({userRole:e,onPress:i}){let{isDragging:n}=ve(),s=xe(e,Re),p=d=>{!n&&i&&(d.stopPropagation(),d.currentTarget.focus(),i())};return j("button",{role:"button","aria-label":`User status: ${s.label}`,onClick:p,style:{display:"flex",flexDirection:"row",alignItems:"center",paddingTop:6,paddingBottom:6,paddingLeft:8,paddingRight:8,flexShrink:0,cursor:i&&!n?"pointer":"default",background:"none",border:"none",margin:0},children:[c("div",{style:{width:6,height:6,borderRadius:3,backgroundColor:s.dotColor,marginRight:4}}),c("span",{style:{fontSize:10,fontWeight:500,color:s.textColor,letterSpacing:.3,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',lineHeight:"normal"},children:s.label})]})}function Te(){let e=S(null),[i,n]=te({x:0,y:0}),s=B((p,d,C)=>{e.current&&cancelAnimationFrame(e.current);let I=performance.now(),l=v=>{let M=v-I,P=Math.min(M/Ie,1),T=Ce(p,d,P,De.easeOutCubic);n(T),P<1?e.current=requestAnimationFrame(l):(n(d),C?.())};e.current=requestAnimationFrame(l)},[]);return w(()=>()=>{e.current&&cancelAnimationFrame(e.current)},[]),{position:i,setPosition:n,animateTo:s}}var se=null;function He(){return se}function ze({id:e,revealToken:i,variant:n="bubble",dragFromSurface:s=false,accessibilityLabel:p="Drag handle",accessory:d,handleAdornment:C,enablePositionPersistence:I=true,children:l,pushToSide:v=false,suspendPointerEvents:M=false,centerOnboarding:P=false,minimizedStack:T,hasMinimizedStack:_=false}){let y=S(null),ce=ie(()=>e?{getItem:t=>X.getItem(`@buoy/floating-tool/${e}/${t}`),setItem:(t,r)=>X.setItem(`@buoy/floating-tool/${e}/${t}`,r)}:X,[e]),{state:o,actions:a,isInitialized:u}=be({screenSize:{width:window.innerWidth,height:window.innerHeight},enablePositionPersistence:I,storage:ce}),{position:x,setPosition:H,animateTo:f}=Te();w(()=>{u&&H(o.position)},[u,o.position,H]),w(()=>{e||(se={x:x.x,y:x.y})},[x,e]),w(()=>{if(!u)return;let t=()=>{let m=y.current?.getBoundingClientRect();m&&m.width>0&&m.height>0&&a.setBubbleSize({width:m.width,height:m.height})},r=()=>{a.setScreenSize(window.innerWidth,window.innerHeight),t()};t();let b=typeof ResizeObserver<"u"?new ResizeObserver(t):null;return y.current&&b?.observe(y.current),window.addEventListener("resize",r),()=>{b?.disconnect(),window.removeEventListener("resize",r)}},[a,u]),w(()=>{let t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top);left:env(safe-area-inset-left);visibility:hidden;pointer-events:none",document.body.appendChild(t);let r=t.getBoundingClientRect();document.body.removeChild(t),(r.top>0||r.left>0)&&a.setMinPosition({x:Math.max(r.left,10),y:Math.max(r.top,10)})},[a]);let[J,K]=te(false),V=B(t=>{t.stopPropagation(),t.preventDefault(),K(true),a.handleDragStart({clientX:t.clientX,clientY:t.clientY})},[a]),W=S(false),ge=t=>{t.button!==0||!(t.target instanceof Element)||t.target.closest('button, a, input, select, textarea, [role="button"], [role="switch"], [role="slider"], [role="checkbox"], [role="radio"], [contenteditable="true"], [data-floating-accessory]')||(W.current=true,V(t))},$=B(t=>{let r=a.handleDragMove({clientX:t.clientX,clientY:t.clientY});r.isDragging&&H(r.position)},[a,H]),R=B(t=>{K(false);let r=a.handleDragEnd({clientX:t.clientX,clientY:t.clientY}),b=W.current;if(W.current=false,r.wasTap&&!b){let m=a.toggleHideShow();f(o.position,m.targetPosition,()=>{a.commitPosition(m.targetPosition)})}else r.shouldHide&&f(o.position,r.position,()=>{a.commitPosition(r.position)})},[a,f,o.position]);w(()=>{if(J)return window.addEventListener("pointermove",$),window.addEventListener("pointerup",R),window.addEventListener("pointercancel",R),()=>{window.removeEventListener("pointermove",$),window.removeEventListener("pointerup",R),window.removeEventListener("pointercancel",R)}},[J,$,R]);let z=S(o.position);z.current=o.position;let Y=S(o.isHidden);Y.current=o.isHidden;let E=S(false);w(()=>{if(u){if(v&&!E.current){if(Y.current)return;E.current=true;let{targetPosition:t}=a.forceHide();f(z.current,t,()=>{})}else if(!v&&E.current){if(E.current=false,!Y.current)return;let{targetPosition:t}=a.forceShow(),r=y.current?.getBoundingClientRect().width??100,b={x:Math.max(10,Math.min(t.x,window.innerWidth-r-10)),y:t.y};f(z.current,b,()=>{a.commitPosition(b)})}}},[v,u]),w(()=>{if(!P||!u)return;let t=y.current?.getBoundingClientRect().width??100,r=y.current?.getBoundingClientRect().height??32,b=ee(),m={x:(window.innerWidth-t)/2,y:window.innerHeight-b-r};f(z.current,m,()=>{})},[P,u]);let q=S(void 0);w(()=>{if(!(!u||q.current===i)&&(q.current=i,i!==void 0&&i>0&&o.isHidden)){let{targetPosition:t}=a.forceShow();f(o.position,t,()=>a.commitPosition(t))}},[i,u,o.isHidden,o.position,a,f]);let ue=ie(()=>n==="strip"?ne.toArray(l):ye(ne.toArray(l),t=>c(ae,{},t)),[l,n]);if(!u)return null;let k=Math.max(0,x.y-8),A=Math.max(0,window.innerHeight-x.y-o.bubbleSize.height-8),pe=k>A,L=k>=48||k>=A;return j("div",{ref:y,"data-testid":e??"buoy-floating-tool",role:"toolbar","aria-label":"Floating Tools",onPointerDown:s?ge:void 0,style:{position:"fixed",left:x.x,top:x.y,zIndex:v?8999:9999,display:"flex",flexDirection:"row",alignItems:"center",backgroundColor:h.panel,borderTopLeftRadius:_?0:6,borderTopRightRadius:6,borderBottomLeftRadius:6,borderBottomRightRadius:6,borderWidth:o.isDragging?2:1,borderTopWidth:o.isDragging?2:_?0:1,borderStyle:"solid",borderColor:o.isDragging?h.dragActive:D(h.muted,"66"),boxShadow:o.isDragging?`0 6px 12px ${D(h.dragActive,.36)}`:"0 4px 8px rgba(0, 0, 0, 0.3)",cursor:s?o.isDragging?"grabbing":"grab":void 0,userSelect:"none",touchAction:"none",pointerEvents:M?"none":"auto",...n==="strip"?{borderRadius:F.radius.card,minHeight:48,backgroundColor:F.color.surface,borderColor:o.isDragging?F.color.accentBorderStrong:F.color.separator,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.24)"}:{}},children:[T&&c("div",{style:{position:"absolute",...L?{bottom:"100%"}:{top:"100%"},"--buoy-stack-bottom":L?"0px":"auto","--buoy-stack-top":L?"auto":"0px","--buoy-stack-space":`${L?k:A}px`,left:-1,width:oe,overflow:"visible",zIndex:1001},children:T}),j("div",{role:"button","aria-label":p,"data-testid":e?`${e}-grip`:"buoy-floating-grip",tabIndex:0,onPointerDown:V,onKeyDown:t=>{if(t.key!=="Enter"&&t.key!==" ")return;t.preventDefault();let r=a.toggleHideShow();f(o.position,r.targetPosition,()=>a.commitPosition(r.targetPosition))},style:{touchAction:"none",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,backgroundColor:D(h.muted,"1A"),display:"flex",alignItems:"center",justifyContent:"center",width:oe,boxSizing:"border-box",borderRight:`1px solid ${D(h.muted,"66")}`,cursor:o.isDragging?"grabbing":"grab",...n==="strip"?{minHeight:48,backgroundColor:"transparent",borderRight:"none",flexDirection:"column"}:{}},children:[c(Pe,{size:n==="strip"?20:12}),C]}),c(we,{value:{isDragging:o.isDragging,isHidden:o.isHidden},children:c("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:6,paddingRight:8},children:ue})}),!o.isHidden&&d&&c("div",{"data-floating-accessory":true,style:{position:"absolute",...pe?{bottom:"100%"}:{top:"100%"},left:0,width:"100%",maxHeight:Math.max(k,A),overflowY:"auto",zIndex:1002},children:d})]})}var g=[],Ee=0,O=new Set,G=()=>O.forEach(e=>e()),N=()=>g,U=e=>(O.add(e),()=>{O.delete(e)});function Ae(e){if(!e.id.trim())throw new Error("Floating tools need a non-empty id");let i={...e,revealToken:++Ee};g=g.some(n=>n.id===e.id)?g.map(n=>n.id===e.id?i:n):[...g,i],G()}function le(e){g.some(i=>i.id===e)&&(g=g.filter(i=>i.id!==e),G())}function Le(e,i){if(!e.id.trim())throw new Error("Floating tools need a non-empty id");let n=`@buoy/floating-tool/${e.id}/open`,s=false,p=false,d=g.some(l=>l.id===e.id),C=Promise.resolve(),I=U(()=>{let l=g.some(v=>v.id===e.id);l!==d&&(d=l,p=true,C=C.then(()=>i.setItem(n,l?"1":"0")).then(()=>{},()=>{}))});return i.getItem(n).then(l=>{s||p||d||l!=="1"||(g=[...g,{...e,revealToken:0}],G())}).catch(()=>{}),()=>{s=true,I()}}import{Fragment as Fe,useSyncExternalStore as Be}from"react";import{jsx as de}from"react/jsx-runtime";function Me(){let e=Be(U,N,N);return de("div",{style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:1e4},children:e.map(i=>de(Fe,{children:i.render({id:i.id,revealToken:i.revealToken,dismiss:()=>le(i.id)})},i.id))})}export{me as a,he as b,fe as c,Q as d,Z as e,ee as f,ae as g,ke as h,He as i,ze as j,N as k,U as l,Ae as m,le as n,Le as o,Me as p};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{d as e,e as s,f as t}from"./chunk-DEEKIG2L.mjs";import"./chunk-5NZOQR6Q.mjs";export{t as getStorageBackendType,s as isUsingPersistentStorage,e as persistentStorage};
|