efficient-shell 4.165.0 → 4.166.0
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 +75 -2
- package/dist/{Browser-ZX5GWPSM.js → Browser-2MBG34IR.js} +14 -14
- package/dist/Calculator-R3WJTNZ6.js +29 -0
- package/dist/ConfirmDialog-ZDVMT74Y.js +1 -0
- package/dist/{CurrencyConverter-7OPRFA5D.js → CurrencyConverter-PEXSQQUK.js} +7 -7
- package/dist/{Documents-QV63346J.js → Documents-YL4RIOZO.js} +15 -15
- package/dist/{Files-BU5V56YF.js → Files-3ZRUTRSB.js} +22 -22
- package/dist/Notepad-3ZM2FR6C.js +25 -0
- package/dist/{PomodoroTimer-FJV6MGE3.js → PomodoroTimer-5QHA5UOY.js} +14 -14
- package/dist/{Preview-PMQKG6FH.js → Preview-32F4DTCK.js} +9 -9
- package/dist/{Sidebar-E6GLVCJL.js → Sidebar-QQSRLMJG.js} +22 -22
- package/dist/Spreadsheet-GOZI7I4L.js +37 -0
- package/dist/{Stock-SSNUY34E.js → Stock-XJFITZZA.js} +4 -4
- package/dist/{Weather-T5WM66B2.js → Weather-BDC633GV.js} +16 -16
- package/dist/{WorldClock-C3GT27AV.js → WorldClock-ROOVRRCJ.js} +7 -7
- package/dist/apps/index.js +1 -1
- package/dist/brand.css +1 -1
- package/dist/{chunk-QTPVA26D.js → chunk-7TQ7NMT3.js} +1 -1
- package/dist/{chunk-PLX2N4N6.js → chunk-7YFAFXQG.js} +2 -2
- package/dist/chunk-AFYQTVZO.js +1 -0
- package/dist/chunk-BKDE67DB.js +12 -0
- package/dist/{chunk-A7Q4BCPI.js → chunk-CRI4UFBU.js} +5 -5
- package/dist/{chunk-DJ6UVHAZ.js → chunk-DTRXR6JQ.js} +11 -11
- package/dist/chunk-G5J6YSN5.js +5 -0
- package/dist/{chunk-YWXYBJ5Y.js → chunk-HA2WG27U.js} +2 -2
- package/dist/{chunk-D7EJSASN.js → chunk-HGG5M5AB.js} +1 -1
- package/dist/chunk-HZZNJHRH.js +1 -0
- package/dist/chunk-JKVDTKBE.js +988 -0
- package/dist/chunk-M4DB7UBZ.js +29 -0
- package/dist/{chunk-RKEHUV7U.js → chunk-QASZIYLG.js} +1 -1
- package/dist/chunk-SOI4LR67.js +27 -0
- package/dist/chunk-UVZIPXIA.js +10 -0
- package/dist/chunk-VRHUY4P4.js +1 -0
- package/dist/{chunk-ZLJCWBDF.js → chunk-VXBJNMAA.js} +60 -60
- package/dist/chunk-X4FJ54PP.js +1 -0
- package/dist/{index-DRkpyISn.d.ts → index-DcLqfJX3.d.ts} +182 -13
- package/dist/index.d.ts +3 -13
- package/dist/index.js +83 -83
- package/dist/map/index.js +3 -3
- package/dist/page-tabs/index.js +5 -5
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-NZH4FVRW.js +0 -29
- package/dist/ConfirmDialog-WEVZTFLU.js +0 -1
- package/dist/Notepad-KZIJ5ZTF.js +0 -25
- package/dist/Spreadsheet-DE5HPVE2.js +0 -37
- package/dist/chunk-4UCRT4ST.js +0 -5
- package/dist/chunk-ELSUXC3N.js +0 -1
- package/dist/chunk-FGPWGHNT.js +0 -27
- package/dist/chunk-KRTZFHYW.js +0 -29
- package/dist/chunk-MAIHBBWT.js +0 -1
- package/dist/chunk-SHVGZW2J.js +0 -1
- package/dist/chunk-SQ7BPUZG.js +0 -9
- package/dist/chunk-VDL2RLZG.js +0 -10
- package/dist/chunk-XYITV4EC.js +0 -983
package/dist/chunk-KRTZFHYW.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import{useDismissPopupsOnOpen as e,registerModalEscapeInterceptor as t,Z_LAYERS as n}from"./chunk-ELSUXC3N.js";import{useShellStrings as r,splitAround as o}from"./chunk-NCQLGQYR.js";import{createContext as l,useEffect as i,useRef as a,useId as s,useContext as c,useState as d,useCallback as u}from"react";import{jsxs as m,jsx as f,Fragment as h}from"react/jsx-runtime";var b=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function g(e){return Array.from(e.querySelectorAll(b)).filter(e=>null!==e.offsetParent||e===document.activeElement)}var p=[];function v(e){const t=p.findIndex(t=>t!==e&&e.contains(t));-1===t?p.push(e):p.splice(t,0,e)}function x(e){const t=p.lastIndexOf(e);-1!==t&&p.splice(t,1)}var y=/* @__PURE__ */new WeakSet;function w(e){return g(e)}function N(e,t){i(()=>{if(!t)return;const n=e.current;return n?(y.add(n),v(n),()=>{x(n),y.delete(n)}):void 0},[e,t])}function k(e,t){const n=p.lastIndexOf(t),r=n>0?p[n-1]:-1===n?p[p.length-1]??null:null,o=g(r??e.ownerDocument.body).filter(n=>!t.contains(n)&&!e.contains(n)),l=o.find(t=>0!==(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING));return l||(r&&!y.has(r)?o[0]??null:null)}function C(e,t,n){i(()=>{if(!t)return;const r=e.current;if(!r)return;const o=document.activeElement,l=n?.current??g(r)[0]??r;l!==r||r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),l.focus();const i=e=>{if("Tab"!==e.key)return;if(p[p.length-1]!==r)return;const t=g(r);if(0===t.length)return void e.preventDefault();const n=t[0],o=t[t.length-1],l=document.activeElement;!e.shiftKey||l!==n&&r.contains(l)?e.shiftKey||l!==o&&r.contains(l)||(e.preventDefault(),n.focus()):(e.preventDefault(),o.focus())};return v(r),document.addEventListener("keydown",i,!0),()=>{x(r),document.removeEventListener("keydown",i,!0),(r.contains(document.activeElement)||document.activeElement===document.body)&&o?.focus?.()}},[e,t,n])}var L=0,E=null;function P(e){i(()=>{if(!e)return;const t=document.body;if(0===L){E={overflow:t.style.overflow,paddingRight:t.style.paddingRight};const e=window.innerWidth-document.documentElement.clientWidth;t.style.overflow="hidden",e>0&&(t.style.paddingRight=`${e}px`)}return L+=1,()=>{0===(L-=1)&&E&&(t.style.overflow=E.overflow,t.style.paddingRight=E.paddingRight,E=null)}},[e])}var j={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-4xl"};function D({open:o,onClose:l,title:c,description:d,role:u="dialog",children:h,footer:b,blocking:g=!1,size:p="md",initialFocus:v,"aria-label":x,"aria-labelledby":y,"aria-describedby":w,className:N=""}){const k=a(null),L=s(),E=s(),D=!g&&!b,T=s(),W=r().dialog;return e(o),C(k,o,v),P(o),i(()=>{if(o)return t(()=>(g||l(),!0),()=>k.current)},[o,g,l]),o?/* @__PURE__ */m("div",{className:"fixed inset-0",style:{zIndex:n.overlay},role:"presentation",children:[
|
|
2
|
-
/* @__PURE__ */f("div",{className:"fixed inset-0 bg-black/30","aria-hidden":"true"}),
|
|
3
|
-
/* @__PURE__ */f("div",{className:"fixed inset-0 flex items-center justify-center p-4",onClick:g?void 0:e=>{e.target===e.currentTarget&&l()},children:/* @__PURE__ */m("div",{ref:k,role:u,"aria-modal":"true","aria-labelledby":c?T:y,"aria-label":c||y?void 0:x,"aria-describedby":w??(d?E:h?L:void 0),className:`relative max-h-full w-full ${j[p]} overflow-y-auto overscroll-contain rounded-lg bg-white p-6 shadow-xl ${N}`.trim(),children:[c&&/* @__PURE__ */f("h2",{id:T,className:(D?"pr-8 ":"")+"text-base font-semibold text-gray-900",children:c}),d&&/* @__PURE__ */f("p",{id:E,className:((c?"mt-1":D?"pr-8":"")+" text-sm text-gray-500").trim(),children:d}),h&&/* @__PURE__ */f("div",{id:L,className:"mt-2 text-sm text-gray-600",children:h}),b&&/* @__PURE__ */f("div",{className:"mt-6 flex flex-wrap justify-end gap-3",children:b}),D&&/* @__PURE__ */f("button",{type:"button",onClick:l,"aria-label":W.close,className:"absolute right-3 top-3 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */f("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:/* @__PURE__ */f("path",{d:"M6 6l8 8M14 6l-8 8"})})})]})})]}):null}var T=l(()=>Promise.resolve(!1)),W=()=>c(T),F=()=>Promise.resolve(!1),I=e=>F(e),M=()=>Promise.resolve(!1),O=e=>M(e),$=()=>Promise.resolve(null),R=e=>$(e),z={danger:{icon:"text-red-600 bg-red-100",button:"bg-red-600 hover:bg-red-700 text-white"},warning:{icon:"text-yellow-600 bg-yellow-100",button:"bg-yellow-600 hover:bg-yellow-700 text-white"},info:{icon:"text-blue-600 bg-blue-100",button:"bg-blue-600 hover:bg-blue-700 text-white"}},A="bg-white text-gray-700 border border-gray-300 px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-50";function K(){/* @__PURE__ */
|
|
4
|
-
return f("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})})}function S(){/* @__PURE__ */
|
|
5
|
-
return f("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,"aria-hidden":"true",children:/* @__PURE__ */f("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}function B({children:e}){const[t,n]=d(!1),[l,s]=d({message:""}),[c,b]=d(0),g=a(),p=a(null),v=a(0),x=a([]),y=a(null),w=a(null),N=u(e=>{p.current=e.id,g.current=e.resolve,b(e.id),s(e.options),n(!0)},[]),k=u(e=>{const t="string"==typeof e?{message:e}:e;return new Promise(e=>{const n={id:++v.current,options:t,resolve:e};null===p.current?N(n):x.current.push(n)})},[N]),[C,L]=d(!1),[E,P]=d({message:""}),[j,W]=d(""),I=a(),O=u(e=>(P(e),W(""),L(!0),new Promise(e=>{I.current=e})),[]),[R,B]=d(!1),[G,Q]=d({}),[U,_]=d(""),q=a(),H=u(e=>{const t="string"==typeof e?{message:e}:e;return Q(t),_(t.defaultValue??""),B(!0),new Promise(e=>{q.current=e})},[]);i(()=>{F=k,M=O,$=H},[k,O,H]);const V=(e,t)=>{if(p.current!==e)return;const r=g.current,o=x.current.shift();o?N(o):(p.current=null,g.current=void 0,n(!1)),r?.(t)},X=e=>{L(!1),W(""),I.current?.(e)},Y=e=>{if(e){const e=U.trim();if(!e&&!G.allowEmpty)return B(!1),void q.current?.(null);B(!1),q.current?.(e)}else B(!1),q.current?.(null)},J=l.variant||(l.confirmLabel?.toLowerCase().includes("delete")||l.message.toLowerCase().includes("delete")?"danger":"info"),Z=z[J],ee=z["warning"===E.variant?"warning":"danger"],te=E.confirmWord,ne=null==te||j===te,re=r().dialog,[oe,le]=o(re.typeToConfirm);/* @__PURE__ */
|
|
6
|
-
return m(T.Provider,{value:k,children:[e,
|
|
7
|
-
/* @__PURE__ */f(D,{open:t,onClose:()=>V(c,!1),initialFocus:y,footer:/* @__PURE__ */m(h,{children:[
|
|
8
|
-
/* @__PURE__ */f("button",{ref:y,type:"button",onClick:()=>V(c,!1),className:A,children:l.cancelLabel||re.cancel}),
|
|
9
|
-
/* @__PURE__ */f("button",{type:"button",onClick:()=>V(c,!0),className:`px-4 py-2 text-sm font-medium rounded-lg ${Z.button}`,children:l.confirmLabel||re.ok})]}),children:/* @__PURE__ */m("div",{className:"flex gap-4",children:[
|
|
10
|
-
/* @__PURE__ */f("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${Z.icon}`,children:/* @__PURE__ */f(K,{})}),
|
|
11
|
-
/* @__PURE__ */m("div",{className:"flex-1",children:[
|
|
12
|
-
/* @__PURE__ */f("h2",{className:"text-base font-semibold text-gray-900",children:l.title||re.confirmTitle}),
|
|
13
|
-
/* @__PURE__ */f("p",{className:"mt-2 text-sm text-gray-600",children:l.message})]})]})}),
|
|
14
|
-
/* @__PURE__ */m(D,{open:C,onClose:()=>X(!1),initialFocus:null!=te?void 0:w,footer:/* @__PURE__ */m(h,{children:[
|
|
15
|
-
/* @__PURE__ */f("button",{ref:w,type:"button",onClick:()=>X(!1),className:A,children:E.cancelLabel||re.destructiveCancel}),
|
|
16
|
-
/* @__PURE__ */f("button",{type:"button",onClick:()=>X(!0),disabled:!ne,className:`px-4 py-2 text-sm font-medium rounded-lg disabled:opacity-40 ${ee.button}`,children:te??E.confirmLabel??re.destructiveConfirm})]}),children:[
|
|
17
|
-
/* @__PURE__ */f("button",{type:"button",onClick:()=>X(!1),"aria-label":re.close,className:"absolute right-4 top-4 rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",children:/* @__PURE__ */f(S,{})}),
|
|
18
|
-
/* @__PURE__ */m("div",{className:"flex gap-4",children:[
|
|
19
|
-
/* @__PURE__ */f("div",{className:`shrink-0 w-10 h-10 rounded-full flex items-center justify-center ${ee.icon}`,children:/* @__PURE__ */f(K,{})}),
|
|
20
|
-
/* @__PURE__ */m("div",{className:"flex-1",children:[
|
|
21
|
-
/* @__PURE__ */f("h2",{className:"text-base font-semibold text-gray-900 pr-6",children:E.title||re.destructiveTitle}),
|
|
22
|
-
/* @__PURE__ */f("p",{className:"mt-2 text-sm text-gray-600",children:E.message}),null!=te&&/* @__PURE__ */m(h,{children:[
|
|
23
|
-
/* @__PURE__ */m("p",{className:"mt-3 text-sm text-gray-700",children:[oe,
|
|
24
|
-
/* @__PURE__ */f("kbd",{className:"rounded border border-gray-300 bg-gray-50 px-1.5 py-0.5 text-xs font-bold text-red-600 font-mono",children:te}),le]}),
|
|
25
|
-
/* @__PURE__ */f("input",{autoFocus:!0,type:"text",value:j,onChange:e=>W(e.target.value),onKeyDown:e=>{"Enter"===e.key&&j===te&&X(!0)},placeholder:te,className:"mt-2 w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-red-500"})]})]})]})]}),
|
|
26
|
-
/* @__PURE__ */m(D,{open:R,onClose:()=>Y(!1),title:G.title||re.promptTitle,footer:/* @__PURE__ */m(h,{children:[
|
|
27
|
-
/* @__PURE__ */f("button",{type:"button",onClick:()=>Y(!1),className:A,children:G.cancelLabel||re.cancel}),
|
|
28
|
-
/* @__PURE__ */f("button",{type:"button",onClick:()=>Y(!0),disabled:!G.allowEmpty&&!U.trim(),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 text-sm font-medium rounded-lg disabled:opacity-40",children:G.confirmLabel||re.ok})]}),children:[G.message&&/* @__PURE__ */f("p",{className:"text-sm text-gray-600",children:G.message}),
|
|
29
|
-
/* @__PURE__ */f("input",{autoFocus:!0,type:"text",value:U,onChange:e=>_(e.target.value),onKeyDown:e=>{"Enter"===e.key?Y(!0):"Escape"===e.key&&Y(!1)},onFocus:e=>e.target.select(),placeholder:G.placeholder,className:"mt-3 w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 rosh-focus-ring focus-visible:ring-1 focus-visible:ring-[color:var(--rosh-focus-ring-accent)]"})]})]})}export{B as ConfirmProvider,D as Dialog,I as confirm,O as confirmDestructive,w as focusableIn,R as prompt,k as stopAfter,W as useConfirm,C as useFocusTrap,P as useScrollLock,N as useTabLayer};
|
package/dist/chunk-MAIHBBWT.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function t(){try{const t=document.documentElement;return"dark"===t.getAttribute("data-theme")||t.classList.contains("dark")}catch{return!1}}var e=["data-theme","class"];export{e as ROOT_THEME_ATTRIBUTES,t as rootIsDark};
|
package/dist/chunk-SHVGZW2J.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var r="4.165.0",a=r;export{a as APP_VERSION,r as VERSION};
|
package/dist/chunk-SQ7BPUZG.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{glassStyle as t,glassFill as e}from"./chunk-VDL2RLZG.js";import{registerModalEscapeInterceptor as o,escapeSurfaceAbove as r,onOverlayOpen as i,Z_LAYERS as n}from"./chunk-ELSUXC3N.js";import{useShellStrings as a}from"./chunk-NCQLGQYR.js";import{useBrowserLayoutEffect as l,useBrowserState as h}from"./chunk-D65T4H6J.js";import{useState as s,useRef as d,useId as c,useEffect as m,isValidElement as u,cloneElement as f,useCallback as g}from"react";import{createPortal as p}from"react-dom";import{jsxs as b,jsx as x,Fragment as w}from"react/jsx-runtime";var v=448,y=240,M=8,N=()=>({left:0,right:window.innerWidth,top:0,bottom:window.innerHeight});function W(t){const e=N(),o=t?.closest?.("[data-modal-panel]");if(!o)return e;const r=o.getBoundingClientRect();return r.width<=0||r.height<=0?e:{left:Math.max(e.left,r.left),right:Math.min(e.right,r.right),top:Math.max(e.top,r.top),bottom:Math.min(e.bottom,r.bottom)}}var z=/* @__PURE__ */new Set(["hidden","clip","auto","scroll"]);var k={top:"bottom",bottom:"top",left:"right",right:"left"},C={top:["right","left"],bottom:["right","left"],left:["top","bottom"],right:["top","bottom"]};function R(t,e,o){return{top:t.top-o-(e.top+8),bottom:e.bottom-8-(t.bottom+o),left:t.left-o-(e.left+8),right:e.right-8-(t.right+o)}}var H=(t,e,o)=>Math.max(e,Math.min(t,o));function E(t,e,o){let r=NaN,i=NaN,n=NaN,a=NaN,l=NaN;const h=()=>{const e=t()?.getBoundingClientRect();if(!e)return!1;const h=o?o():NaN,s=e.left!==r||e.top!==i||e.right!==n||e.bottom!==a||h!==l&&!(Number.isNaN(h)&&Number.isNaN(l));return r=e.left,i=e.top,n=e.right,a=e.bottom,l=h,s};h();const s=()=>{h(),e()};let d=requestAnimationFrame(function t(){h()&&e(),d=requestAnimationFrame(t)});return window.addEventListener("scroll",s,!0),window.addEventListener("resize",s),()=>{cancelAnimationFrame(d),window.removeEventListener("scroll",s,!0),window.removeEventListener("resize",s)}}function T({trigger:t,menu:e,bounds:o,align:r,side:i}){const n=R(t,o,4),a="bottom"===i?"top":"bottom",l=e.height>n[i]&&(e.height<=n[a]||n[a]>n[i])?a:i,h=Math.max(Math.min(e.height,96),n[l]),s=Math.min(e.height,h),d=H("bottom"===l?t.bottom+4:t.top-4-s,o.top+8,o.bottom-8-s),c=Math.max(0,o.right-o.left-16),m=Math.min(e.width,c);return{left:H("start"===r?t.left:t.right-m,o.left+8,o.right-8-m),top:d,side:l,maxHeight:h,maxWidth:c}}function L(t,e,o={}){const{matchTriggerWidth:r=!1,preferredMaxWidth:i=v,preferredMaxHeight:n=y,popupRef:a}=o,[h,d]=s(null);return l(()=>{if(!e)return void d(null);const o=()=>{const e=t.current,o=e?.getBoundingClientRect();if(!o)return;const l=W(e),h=l.bottom-o.bottom-4-8,s=o.top-l.top-4-8,c=h<Math.min(n,160)&&s>h,m=Math.max(96,Math.min(n,c?s:h)),u=Math.max(0,l.right-l.left-16),f={minWidth:o.width,maxWidth:Math.min(i,u),maxHeight:m};if(r){const t=Math.min(o.width,u);f.width=t,f.maxWidth=t,f.left=Math.min(Math.max(l.left+8,o.left),l.right-8-t)}else if(a&&l.right-8-o.left<f.maxWidth&&Math.min(o.right,l.right-8)-l.left-8<f.maxWidth){const t=a.current?.offsetWidth??0,e=t>0?Math.min(t,f.maxWidth):f.maxWidth;f.left=Math.max(l.left+8,Math.min(o.left,l.right-8-e))}else if(l.right-8-o.left<f.maxWidth){const t=Math.min(o.right,l.right-8);f.right=window.innerWidth-t,f.maxWidth=Math.min(f.maxWidth,Math.max(0,t-l.left-8))}else f.left=Math.max(l.left+8,o.left);c?f.bottom=window.innerHeight-o.top+4:f.top=o.bottom+4,d(f)};return o(),E(()=>t.current,o,a?()=>a.current?.offsetWidth??NaN:void 0)},[e,t,r,i,n,a]),h}function P({point:t,menu:e,bounds:o}){const r={left:t.x,right:t.x,top:t.y,bottom:t.y},i=o.right-8-t.x,n=t.x-(o.left+8);return T({trigger:r,menu:e,bounds:o,align:e.width<=i||i>=n?"start":"end",side:"bottom"})}var B={top:"bottom-full left-1/2 -translate-x-1/2 mb-3",bottom:"top-full left-1/2 -translate-x-1/2 mt-3",left:"right-full top-1/2 -translate-y-1/2 mr-3",right:"left-full top-1/2 -translate-y-1/2 ml-3"};function $({content:a,side:h="top",delay:g=200,children:w,className:v="relative inline-flex"}){const[y,M]=s(!1),[T,L]=s(null),P=d(void 0),$=d(null),D=d(null),S=c(),I=d(!1),j=()=>{window.clearTimeout(P.current),I.current||(P.current=window.setTimeout(()=>M(!0),g))},A=()=>{window.clearTimeout(P.current),M(!1)},F=()=>{I.current=!0,A()},K=()=>{I.current=!1,A()};m(()=>()=>window.clearTimeout(P.current),[]),l(()=>{if(!y)return void L(null);const t=()=>{const t=$.current,e=D.current;if(!t||!e)return;const o=W(t),r=Math.max(0,o.right-o.left-16),i=Math.max(0,o.bottom-o.top-16);e.style.maxWidth=`${r}px`,e.style.maxHeight=`${i}px`;const n=e.getBoundingClientRect();if(n.width<=0||n.height<=0)return;const a=t.getBoundingClientRect();if(!function(t){const e=t.getBoundingClientRect();if(e.width<=0&&e.height<=0&&0===e.left&&0===e.top)return null;const o=N(),r={left:Math.max(o.left,e.left),right:Math.min(o.right,e.right),top:Math.max(o.top,e.top),bottom:Math.min(o.bottom,e.bottom)};let i=getComputedStyle(t).position;for(let e=t.parentElement;e&&e!==document.documentElement&&"fixed"!==i;e=e.parentElement){const t=getComputedStyle(e);if("absolute"===i&&"static"===t.position)continue;i=t.position;const o=z.has(t.overflowX),n=z.has(t.overflowY);if(!o&&!n)continue;const a=e.getBoundingClientRect();a.width<=0&&a.height<=0||(o&&(r.left=Math.max(r.left,a.left),r.right=Math.min(r.right,a.right)),n&&(r.top=Math.max(r.top,a.top),r.bottom=Math.min(r.bottom,a.bottom)))}return r.right>=r.left&&r.bottom>=r.top?r:null}(t))return void A();const l=function(t,e,o,r,i){const n=R(t,r,i),a=t=>n[t]-("top"===t||"bottom"===t?e.height:e.width),l=[o,k[o],...C[o]],h=l.find(t=>a(t)>=0)??l.reduce((t,e)=>a(e)>a(t)?e:t),s=(t.left+t.right)/2,d=(t.top+t.bottom)/2;let c,m;switch(h){case"top":c=s-e.width/2,m=t.top-i-e.height;break;case"bottom":c=s-e.width/2,m=t.bottom+i;break;case"left":c=t.left-i-e.width,m=d-e.height/2;break;case"right":c=t.right+i,m=d-e.height/2}return{side:h,left:H(c,r.left+8,r.right-8-e.width),top:H(m,r.top+8,r.bottom-8-e.height)}}(a,n,h,o,12),s=function(t,e,o,r,i){const{side:n,left:a,top:l}=e,h=a+o.width,s=l+o.height;if({top:t.top-s,bottom:l-t.bottom,left:t.left-h,right:a-t.right}[n]<i)return null;const d=(t,e,o)=>o<2*r?e+o/2:Math.max(e+r,Math.min(t,e+o-r)),c=(t.left+t.right)/2,m=(t.top+t.bottom)/2;switch(n){case"top":return{side:n,x:d(c,a,o.width),y:s};case"bottom":return{side:n,x:d(c,a,o.width),y:l};case"left":return{side:n,x:h,y:d(m,l,o.height)};case"right":return{side:n,x:a,y:d(m,l,o.height)}}}(a,l,n,16,6),d={anchor:{left:a.left,top:a.top,width:a.width,height:a.height},left:l.left-a.left,top:l.top-a.top,maxWidth:r,maxHeight:i,side:l.side,arrow:s&&{left:s.x-a.left,top:s.y-a.top}};L(t=>{return t&&(o=d,(e=t).anchor.left===o.anchor.left&&e.anchor.top===o.anchor.top&&e.anchor.width===o.anchor.width&&e.anchor.height===o.anchor.height&&e.left===o.left&&e.top===o.top&&e.maxWidth===o.maxWidth&&e.maxHeight===o.maxHeight&&e.side===o.side&&e.arrow?.left===o.arrow?.left&&e.arrow?.top===o.arrow?.top)?t:d;var e,o})};return t(),E(()=>$.current,t)},[y,h,a]),m(()=>{if(!y)return;const t=o(t=>"Escape"===t.key&&(A(),!r($.current))),e=i(A);return()=>{t(),e()}},[y]);const X=y?S:void 0,q=u(w)?f(w,{"aria-describedby":[w.props["aria-describedby"],X].filter(Boolean).join(" ")||void 0}):w,G=y?t():void 0,Q=y?e():void 0;/* @__PURE__ */
|
|
2
|
-
return b("span",{ref:$,className:v,"aria-describedby":u(w)?void 0:X,onMouseEnter:j,onMouseLeave:K,onFocus:j,onBlur:K,onPointerDown:F,onClick:F,children:[q,y&&p(
|
|
3
|
-
/* @__PURE__ */b("span",{className:"pointer-events-none fixed left-0 top-0",style:{zIndex:n.popup,...T?.anchor},children:[
|
|
4
|
-
/* @__PURE__ */x("span",{ref:D,id:S,role:"tooltip",className:`pointer-events-none absolute z-[300] box-border w-max overflow-hidden whitespace-normal break-words text-start rounded-md px-2 py-1 text-xs text-gray-800 ${T?"":B[h]}`,style:{...G,...T&&{left:T.left,top:T.top,maxWidth:T.maxWidth,maxHeight:T.maxHeight}},children:a}),(!T||T.arrow)&&
|
|
5
|
-
/* @__PURE__ */x("span",{"aria-hidden":"true",className:"rosh-tooltip-arrow","data-side":T?.side??h,style:{background:Q,"--rosh-tooltip-edge":G?.border,...T?.arrow&&{left:T.arrow.left,top:T.arrow.top}}})]}),document.body)]})}var D=(t,e,o)=>Math.min(o,Math.max(e,t));function S(t,e,o,r,i){return Math.round(D("left"===o?t+e:t-e,r,i))}function I(t,e,o){let r=null;try{r=window.localStorage.getItem(t)}catch{return null}const i=r?parseInt(r,10):NaN;return Number.isNaN(i)?null:D(i,e,o)}function j({width:t,onResize:e,side:o,min:r,max:i,defaultWidth:n=r,step:h=16,storageKey:s,label:c,hint:u,controls:f,className:p=""}){const b=a().resizeHandle,w=d(null),v=d({onResize:e,min:r,max:i,side:o});v.current={onResize:e,min:r,max:i,side:o},l(()=>{if(!s)return;const o=I(s,r,i);null!==o&&o!==t&&e(o)},[s]),m(()=>{if(!s)return;const e=window.setTimeout(()=>{try{window.localStorage.setItem(s,String(Math.round(t)))}catch{}},200);return()=>window.clearTimeout(e)},[t,s]);const y=g(()=>{w.current=null,document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")},[]);m(()=>y,[y]);const M=t=>{w.current&&(t.currentTarget.hasPointerCapture?.(w.current.pointer)&&t.currentTarget.releasePointerCapture(w.current.pointer),y())},N="left"===o?"right-0":"left-0";/* @__PURE__ */
|
|
6
|
-
return x($,{content:u??b.hint,side:"left"===o?"right":"left",delay:600,className:`absolute inset-y-0 ${N} z-10 flex w-2 ${p}`.trim(),children:/* @__PURE__ */x("div",{role:"separator",tabIndex:0,"aria-orientation":"vertical","aria-label":c??b.label,"aria-valuenow":Math.round(t),"aria-valuemin":r,"aria-valuemax":i,"aria-controls":f,"data-resize-handle":o,onPointerDown:e=>{0===e.button&&(e.preventDefault(),w.current={x:e.clientX,width:t,moved:!1,pointer:e.pointerId},e.currentTarget.setPointerCapture?.(e.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none")},onPointerMove:t=>{const e=w.current;if(!e)return;if(0===t.buttons)return void y();const o=t.clientX-e.x;if(!e.moved){if(Math.abs(o)<3)return;e.moved=!0}const{onResize:r,min:i,max:n,side:a}=v.current;r(S(e.width,o,a,i,n))},onPointerUp:M,onPointerCancel:M,onLostPointerCapture:()=>{w.current&&y()},onDoubleClick:()=>e(D(n,r,i)),onKeyDown:a=>{const l="ArrowRight"===a.key?h:"ArrowLeft"===a.key?-h:null,s=null!==l?S(t,l,o,r,i):"Home"===a.key?r:"End"===a.key?i:"Enter"===a.key?D(n,r,i):null;null!==s&&(a.preventDefault(),s!==t&&e(s))},className:"group/resize relative h-full w-full cursor-col-resize touch-none rosh-focus-ring focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",children:/* @__PURE__ */x("div",{"aria-hidden":"true",className:`absolute inset-y-0 ${N} w-px bg-transparent transition-colors group-hover/resize:bg-[var(--accent-500,var(--rosh-resize-handle))] group-focus-visible/resize:w-0.5 group-focus-visible/resize:bg-[var(--accent-500,var(--rosh-resize-handle))]`})})})}var A=(t,e,o)=>Math.min(Math.max(t,e),o);function F({sidebar:t,sidebarTop:e,sidebarBottom:o,children:r,side:i="left",storageKey:n,defaultWidth:l=256,minWidth:s=180,maxWidth:d=480,className:c="",sidebarClassName:m=("right"===i?"border-l border-gray-200 bg-gray-50":"border-r border-gray-200 bg-gray-50"),contentClassName:u="bg-white"}){const f="right"===i,g=a().sidebar,[p,v]=h(()=>(n?I(n,s,d):null)??A(l,s,d),A(l,s,d)),y=null!=e||null!=o,M=/* @__PURE__ */b("div",{className:"relative flex h-full shrink-0 flex-col",style:{width:p},children:[
|
|
7
|
-
/* @__PURE__ */b("div",{className:`flex h-full flex-col ${y?"overflow-hidden":"overflow-y-auto"} ${m}`,children:[null!=e&&/* @__PURE__ */x("div",{className:"flex shrink-0 flex-col gap-2 px-2 pt-3 pb-2",children:e}),y?/* @__PURE__ */x("div",{className:"min-h-0 flex-1 overflow-y-auto",children:t}):t,null!=o&&/* @__PURE__ */x("div",{className:"mt-auto flex shrink-0 flex-col gap-2 border-t border-gray-200 px-2 py-3",children:o})]}),
|
|
8
|
-
/* @__PURE__ */x(j,{side:i,width:p,onResize:v,min:s,max:d,defaultWidth:A(l,s,d),storageKey:n,hint:g.resize})]}),N=/* @__PURE__ */x("div",{className:`flex min-w-0 flex-1 flex-col ${u}`,children:r});/* @__PURE__ */
|
|
9
|
-
return x("div",{className:`flex h-full w-full overflow-hidden ${c}`,children:/* @__PURE__ */b(w,f?{children:[N,M]}:{children:[M,N]})})}export{y as MENU_MAX_HEIGHT,v as POPUP_MAX_WIDTH,j as ResizeHandle,F as SidebarLayout,$ as Tooltip,M as VIEWPORT_MARGIN,E as followAnchor,P as placeAtPoint,T as placeMenu,W as popupBounds,L as useDropdownPosition};
|
package/dist/chunk-VDL2RLZG.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{onOverlayOpen as e,registerModalEscapeInterceptor as t,Z_LAYERS as n}from"./chunk-ELSUXC3N.js";import{rootIsDark as r}from"./chunk-MAIHBBWT.js";import{useHydrated as o,useBrowserLayoutEffect as i}from"./chunk-D65T4H6J.js";import{createContext as a,forwardRef as s,useContext as l,useRef as u,useId as c,useState as d,useEffect as p,useMemo as m,useCallback as h}from"react";import{createPortal as f}from"react-dom";import{jsxs as g,jsx as y,Fragment as b}from"react/jsx-runtime";function x(){try{const e=getComputedStyle(document.documentElement).getPropertyValue("--menu-opacity")?.trim();if(e)return parseFloat(e)}catch{}return.95}var w=r;function v(){try{return document.documentElement.classList.contains("rosh-reduce-transparency")}catch{return!1}}function k(e,t){return`color-mix(in srgb, ${e} ${+(Math.round(255*Math.min(1,Math.max(0,t)))/255*100).toFixed(4)}%, transparent)`}function C(e,t={}){const n=e??x();if(v()&&"light"===t.ink)return{background:"var(--rosh-glass-light-ink-surface)",border:"1px solid var(--rosh-glass-light-ink-solid-border)",boxShadow:"var(--rosh-glass-solid-shadow)"};if(v())return{background:"var(--rosh-glass-surface)",border:"1px solid var(--rosh-glass-solid-border)",boxShadow:"var(--rosh-glass-solid-shadow)"};const r="var(--rosh-glass-surface)",o="var(--rosh-glass-surface-mid)";return w()?{background:`linear-gradient(135deg in srgb, ${k(r,.85*n)} 0%, ${k(o,.75*n)} 50%, ${k(r,.85*n)} 100%)`,backdropFilter:"blur(40px) saturate(1.6)",WebkitBackdropFilter:"blur(40px) saturate(1.6)",border:"1px solid var(--rosh-glass-border)",boxShadow:"var(--rosh-glass-shadow)"}:{background:`linear-gradient(135deg in srgb, ${k(r,.85*n)} 0%, ${k(o,.65*n)} 50%, ${k(r,.75*n)} 100%)`,backdropFilter:"blur(40px) saturate(1.8)",WebkitBackdropFilter:"blur(40px) saturate(1.8)",border:"1px solid var(--rosh-glass-border)",boxShadow:"var(--rosh-glass-shadow)"}}function N(e){return v()?"var(--rosh-glass-surface)":k("var(--rosh-glass-surface)",.85*(e??x()))}var $="border-white/20",L="glass-input-bg",M=/* @__PURE__ */new Set(["text","search","url","tel","email","password","number","date","datetime-local","month","week","time"]),B="data-native-context-menu";function E(e,t){return e&&"function"==typeof e.closest?e.closest(t):null}function T(e){const t=e;if(!t||"function"!=typeof t.closest)return!1;if(E(t,`[${B}]`))return!0;if(E(t,"textarea"))return!0;if(E(t,"img, picture, canvas, video, audio"))return!0;const n=E(t,"input");if(n){const e=(n.type||"text").toLowerCase();if(M.has(e))return!0}const r=E(t,"[contenteditable]");if(r){const e=(r.getAttribute("contenteditable")||"").toLowerCase();if(""===e||"true"===e||"plaintext-only"===e)return!0}return!1}var W=/* @__PURE__ */new Set(["http:","https:","mailto:","tel:","blob:"]);function S(e,t,n){const r=E(e,"a[href]"),o=(t||"").trim(),i=function(e,t){if(e&&"#"!==e)try{const n=new URL(e,t??("undefined"!=typeof document?document.baseURI:void 0));return W.has(n.protocol)?n.href:void 0}catch{return}}(r?.getAttribute("href"),n);return{kind:o?"selection":i?"link":"default",...o?{selectionText:o}:{},...i?{linkUrl:i}:{}}}function A(e){if(e.defaultPrevented)return!0;if(e.shiftKey)return!0;if("touch"===e.pointerType)return!0;return T(("function"==typeof e.composedPath?e.composedPath()[0]:void 0)??e.target)}function F(e,t,n){return e.length===t+1&&e[t].key===n.key?e:[...e.slice(0,t),n]}function P(e,t){const n=Math.max(0,t);return e.length>n?e.slice(0,n):e}function R(e,t,n){if(0===t.length||0===e.length)return[];const r=[e];for(let e=1;e<t.length;e++){const o=r[e-1].find(n=>n.to===t[e].key),i=o?n(o):[];if(0===i.length)break;r.push(i)}return r}function H(e,t,n,r){const o=Math.max(0,r-n),i=Math.min(t,o),a=e-i/2;return a<n?n:a+i>r?Math.max(n,r-i):a}function j(e,t,n,r,o,i=!1,a=8){const s=t+o,l=e-o-n,u=l>=a;return i&&u?{left:l,flipped:!0}:s+n<=r-a?{left:s,flipped:!1}:u?{left:l,flipped:!0}:i?{left:a,flipped:!0}:{left:Math.max(a,r-a-n),flipped:!1}}function D(){try{return getComputedStyle(document.documentElement).getPropertyValue("--menu-density")?.trim()||"normal"}catch{return"normal"}}var I=a(null),z=a(!1);function U({children:r,style:i,className:a="",onClose:s,minWidth:l=180,portal:h=!1}){const g=u(null),b=c(),[x,w]=d([]),v=u();p(()=>()=>clearTimeout(v.current),[]);const k=o(),N=m(()=>{const e=()=>clearTimeout(v.current);return{id:b,depth:0,path:x,open:(t,n)=>{e(),w(e=>F(e,t,n))},scheduleClose:t=>{e(),v.current=setTimeout(()=>w(e=>P(e,t)),200)},closeBelow:t=>{e(),w(e=>P(e,t))},cancelClose:e,closeTree:()=>{e(),w([]),s?.()},root:g}},[b,x,s]);p(()=>{if(!s)return;const n=e=>{e.target.closest("[data-menu-toggle]")||e.target.closest?.(`[data-popup-menu-tree="${b}"]`)||g.current&&!g.current.contains(e.target)&&s()},r=e=>{"Escape"===e.key&&s()};window.addEventListener("pointerdown",n),window.addEventListener("keydown",r);const o=e(s),i=t(()=>!1,()=>g.current);return()=>{window.removeEventListener("pointerdown",n),window.removeEventListener("keydown",r),o(),i()}},[s,b]),p(()=>{const e=g.current;e&&requestAnimationFrame(()=>{const t=e.getBoundingClientRect();if(t.right>window.innerWidth-8){const n=t.right-window.innerWidth+8;e.style.left?e.style.left=parseFloat(e.style.left)-n+"px":e.style.right||(e.style.left=t.left-n+"px")}if(t.left<8&&(e.style.left?e.style.left="8px":e.style.right&&(e.style.right=window.innerWidth-t.width-8+"px")),t.bottom>window.innerHeight-8){const n=t.bottom-window.innerHeight+8;e.style.top?e.style.top=parseFloat(e.style.top)-n+"px":e.style.bottom?e.style.bottom="8px":e.style.top=t.top-n+"px"}t.top<8&&(e.style.top?e.style.top="8px":e.style.bottom&&(e.style.bottom=window.innerHeight-t.height-8+"px"))})});const $=D(),L=/(^|[\s:])!?z-/.test(a),M=/* @__PURE__ */y("div",{ref:g,"data-popup-menu-tree":b,className:`fixed rounded-2xl ${"tight"===$?"py-1":"large"===$?"py-2":"py-1.5"} ${a}`,onContextMenu:e=>{T(e.target)||e.preventDefault()},style:{...L?{}:{zIndex:n.menu},minWidth:l,animation:"popup-in 0.12s ease-out",...C(),...i},children:/* @__PURE__ */y(I.Provider,{value:N,children:r})});return h?k?f(M,document.body):null:M}function q(e,t,n,r=!1){const o=D(),i="tight"===o?"0.25rem":"large"===o?"0.6rem":"max(0.25rem, calc(var(--menu-padding-y, 0.5rem) - 0.1rem))";return{className:`w-full flex items-center gap-2 text-left transition-colors rounded-lg mx-auto\n ${e?"text-red-600 hover:bg-red-50":r?"bg-blue-50 text-blue-700":"text-gray-700 hover:bg-blue-50 hover:text-blue-700"}\n ${t?"opacity-40 cursor-not-allowed":""}\n ${n}`,style:{width:"calc(100% - 8px)",marginLeft:4,marginRight:4,fontSize:"var(--menu-font-size, 14px)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:i,paddingBottom:i}}}var K=/* @__PURE__ */y("svg",{"aria-hidden":!0,className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */y("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});function V({kind:e,checked:t}){/* @__PURE__ */
|
|
2
|
-
return y("span","checkbox"===e?{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded border "+(t?"border-blue-600 bg-blue-600 text-white":"border-gray-400"),children:t&&K}:{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:t&&K})}var J=s(function({onClick:e,children:t,className:n="",danger:r,disabled:o,role:i,checked:a,tabIndex:s,id:u,onMouseEnter:c},d){const p=l(I),m=l(z),h=q(r,o,n),f=void 0===a?null:"menuitemradio"===i?"radio":"checkbox";/* @__PURE__ */
|
|
3
|
-
return g("button",{ref:d,id:u,role:"radio"===f?"menuitemradio":"checkbox"===f?"menuitemcheckbox":i??(m?"menuitem":void 0),"aria-checked":f?a:void 0,tabIndex:s,onClick:()=>{e?.(),p&&p.depth>0&&"checkbox"!==f&&p.closeTree()},onMouseEnter:()=>{p?.scheduleClose(p.depth),c?.()},disabled:o,className:h.className,style:h.style,children:[f&&/* @__PURE__ */y(V,{kind:f,checked:!!a}),t]})}),O=/* @__PURE__ */y("svg",{"aria-hidden":!0,className:"h-3.5 w-3.5 shrink-0 ml-auto text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:/* @__PURE__ */y("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})});function X(e){let t=n.menu;for(let n=e;n&&n!==document.body;n=n.parentElement){const e=parseInt(getComputedStyle(n).zIndex,10);Number.isNaN(e)||(t=e)}return t}function G(e){return e?[...e.querySelectorAll("button:not([disabled])")].filter(t=>t.closest("[data-popup-submenu-panel]")===e):[]}function Q({label:e,icon:n,children:r,disabled:o,className:a="",minWidth:s=180,maxHeight:d}){const x=l(I),w=c(),v=u(null),k=u(null),N=u(),$=u(!1),L=`${w}-menu`;p(()=>()=>clearTimeout(N.current),[]);const M=x?.depth??0,B=x?.path[M],E=!!B&&B.key===w&&!o,W=h(e=>{if(!x||o||!v.current)return;clearTimeout(N.current),$.current=e;const t=v.current.getBoundingClientRect(),n=v.current.closest("[data-popup-submenu-panel]")??v.current.closest("[data-popup-menu-tree]"),r=n?.getBoundingClientRect()??t,i=M>0&&(x.path[M-1]?.flipped??!1),a=j(r.left,r.right,s,window.innerWidth,4,i);x.open(M,{key:w,y:t.top,...a})},[x,o,M,w,s]),S=e=>{x?.closeBelow(M),v.current?.focus()};p(()=>{if(E)return t(e=>"Escape"===e.key&&(!(x&&x.path.length>M+1)&&(S(),!0)),()=>k.current)}),i(()=>{if(!E||!B)return;const e=()=>{const e=k.current;if(!e||!v.current)return;const t=v.current.closest("[data-popup-submenu-panel]")??v.current.closest("[data-popup-menu-tree]"),n=t?.getBoundingClientRect()??v.current.getBoundingClientRect(),r=M>0&&(x?.path[M-1]?.flipped??!1),o=e.offsetWidth||s,i=j(n.left,n.right,o,window.innerWidth,4,r,8),a=e.offsetHeight,l=H(v.current.getBoundingClientRect().top+a/2,a,8,window.innerHeight-8);e.style.left=`${i.left}px`,e.style.top=`${l}px`,e.dataset.flipped=String(i.flipped)};e();let t=0;const n=requestAnimationFrame(()=>{t=requestAnimationFrame(e)});return()=>{cancelAnimationFrame(n),cancelAnimationFrame(t)}}),p(()=>{E&&$.current&&($.current=!1,G(k.current)[0]?.focus())},[E]);const A=m(()=>x&&{...x,depth:M+1},[x,M]);if(!x)throw new Error("PopupSubmenu must be rendered inside a PopupMenu");const F=q(!1,o,a,E),P=D();/* @__PURE__ */
|
|
4
|
-
return g(b,{children:[
|
|
5
|
-
/* @__PURE__ */g("button",{ref:v,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":E,"aria-controls":E?L:void 0,disabled:o,"data-popup-submenu-row":!0,className:F.className,style:F.style,onClick:e=>{const t=0===e.detail;E?t&&G(k.current)[0]?.focus():W(t)},onKeyDown:e=>{"ArrowRight"===e.key&&(e.preventDefault(),e.stopPropagation(),W(!0))},onMouseEnter:()=>{o||(x.cancelClose(),E?x.closeBelow(M+1):(clearTimeout(N.current),N.current=setTimeout(()=>W(!1),120)))},onMouseLeave:()=>{clearTimeout(N.current),x.scheduleClose(M)},children:[n,
|
|
6
|
-
/* @__PURE__ */y("span",{className:"min-w-0 flex-1 truncate",children:e}),O]}),E&&f(
|
|
7
|
-
/* @__PURE__ */y("div",{ref:k,id:L,role:"menu","data-popup-menu-tree":x.id,"data-popup-submenu-panel":!0,className:"fixed rounded-2xl overflow-x-hidden overflow-y-auto overscroll-contain "+("tight"===P?"py-1":"large"===P?"py-2":"py-1.5"),style:{left:B.left,top:B.y,minWidth:s,maxHeight:void 0===d?"calc(100vh - 16px)":`min(${"number"==typeof d?`${d}px`:d}, calc(100vh - 16px))`,zIndex:X(x.root.current)+M+1,animation:(B.flipped?"popup-submenu-in-left":"popup-submenu-in")+" 0.1s ease-out",...C()},onKeyDown:e=>{if(e.target.closest("[data-popup-submenu-panel]")!==e.currentTarget)return;const t=G(k.current),n=t.indexOf(document.activeElement),r=n=>{e.preventDefault(),e.stopPropagation(),t[(n+t.length)%t.length]?.focus()};"ArrowDown"===e.key?r(n+1):"ArrowUp"===e.key?r(n<0?t.length-1:n-1):"Home"===e.key?r(0):"End"===e.key?r(t.length-1):"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),S())},onMouseEnter:()=>{x.cancelClose(),clearTimeout(N.current)},onMouseLeave:()=>x.scheduleClose(M+1),onContextMenu:e=>{T(e.target)||e.preventDefault()},children:/* @__PURE__ */y(I.Provider,{value:A,children:r})}),document.body)]})}function Y(){const e=D();/* @__PURE__ */
|
|
8
|
-
return y("div",{className:`border-t ${$} ${"tight"===e?"my-0.5":"large"===e?"my-1.5":"my-1"} mx-3`})}function Z({children:e}){const t=D(),n="tight"===t?"0.125rem":"large"===t?"0.375rem":"0.25rem";/* @__PURE__ */
|
|
9
|
-
return y("div",{className:"text-xs font-medium uppercase tracking-wide",style:{color:"var(--ink-muted)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:n,paddingBottom:n},children:e})}function _({d:e,className:t="h-4 w-4 text-gray-400"}){/* @__PURE__ */
|
|
10
|
-
return y("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */y("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})})}export{$ as GLASS_DIVIDER,L as GLASS_INPUT_BG,V as MenuCheckMark,_ as MenuIcon,z as MenuSemanticsContext,B as NATIVE_MENU_ATTR,U as PopupMenu,Y as PopupMenuDivider,J as PopupMenuItem,Z as PopupMenuLabel,Q as PopupSubmenu,H as clampMenuTop,P as closeMenuBelow,S as describeContextTarget,N as glassFill,C as glassStyle,q as itemLook,T as keepsNativeMenu,A as leavesContextMenuAlone,j as menuPanelLeft,F as openMenuLevel,R as resolveMenuLevels};
|