efficient-shell 8.30.0 → 8.32.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 +12 -0
- package/dist/{Browser-5DL5WHEM.js → Browser-Y335UIBR.js} +11 -11
- package/dist/Calculator-4JDJKSA7.js +29 -0
- package/dist/{CurrencyConverter-XBC732QI.js → CurrencyConverter-S7LG5PMX.js} +6 -6
- package/dist/{Documents-7MFHD73Z.js → Documents-SP25WN7V.js} +2 -2
- package/dist/{Files-4DKRC3S2.js → Files-SEGSJMVA.js} +34 -34
- package/dist/{Notepad-BCK4LMG2.js → Notepad-ZJ7N4TZM.js} +10 -10
- package/dist/{PomodoroTimer-KH4PYCYQ.js → PomodoroTimer-ZR2VLO6G.js} +32 -32
- package/dist/{Preview-FP6XMPQR.js → Preview-AZQSMBW5.js} +18 -18
- package/dist/{Sidebar-3HM646LN.js → Sidebar-YB4OVUG5.js} +34 -34
- package/dist/{Spreadsheet-FSDGQCKT.js → Spreadsheet-UWD62JIM.js} +12 -12
- package/dist/{Stock-M4EEWA57.js → Stock-VNFYS73L.js} +7 -7
- package/dist/{Weather-WLAS7FBY.js → Weather-DS4YZ6SH.js} +17 -17
- package/dist/{WorldClock-WRD7DV2S.js → WorldClock-7S4TITSF.js} +6 -6
- package/dist/ai/index.d.ts +40 -2
- package/dist/ai/index.js +38 -37
- package/dist/apps/index.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/chunk-37JDUDCO.js +22 -0
- package/dist/chunk-3JJFBUK6.js +3 -0
- package/dist/{chunk-VEO34YZK.js → chunk-3Z6ASFGL.js} +1 -1
- package/dist/{chunk-3ZRZWOFZ.js → chunk-3ZVRB3CV.js} +1 -1
- package/dist/{chunk-Z37R2OCE.js → chunk-4AAGZQX7.js} +1 -1
- package/dist/{chunk-REOSJZED.js → chunk-74TPCYHX.js} +15 -15
- package/dist/{chunk-WSODT2L5.js → chunk-AX7KPMDV.js} +2 -2
- package/dist/{chunk-53ROHXAV.js → chunk-B55IXYDR.js} +2 -2
- package/dist/{chunk-I62MCTYI.js → chunk-DCUBOLIR.js} +3 -3
- package/dist/{chunk-3H74IBFS.js → chunk-F64DN4BV.js} +3 -3
- package/dist/{chunk-ETNNJUAX.js → chunk-GWIPZKZJ.js} +3 -3
- package/dist/{chunk-MXVJHVVI.js → chunk-JCMP5KMS.js} +5 -5
- package/dist/{chunk-Q4TGK2K6.js → chunk-JOIWDQRJ.js} +4 -4
- package/dist/{chunk-E6ZXYTTQ.js → chunk-KNVE7CMS.js} +1 -1
- package/dist/chunk-L2OSJ2YC.js +1 -0
- package/dist/{chunk-WPTG7ZC5.js → chunk-L3NYH4QV.js} +32 -32
- package/dist/{chunk-GECH6THP.js → chunk-LLLAIPFX.js} +1 -1
- package/dist/{chunk-4SQNLU2Q.js → chunk-MTXTJLFK.js} +1 -1
- package/dist/{chunk-ZZNOQQWE.js → chunk-NFR4QZL2.js} +4 -4
- package/dist/chunk-NT26CWMZ.js +5 -0
- package/dist/{chunk-O6JX6RDX.js → chunk-PJCVNFWM.js} +7 -7
- package/dist/{chunk-6YH7JKRE.js → chunk-QFA5COE6.js} +2 -2
- package/dist/{chunk-2OLSY4GE.js → chunk-QPX35URZ.js} +11 -11
- package/dist/{chunk-VP3CMJTT.js → chunk-UX6HNRFV.js} +7 -7
- package/dist/chunk-W7S56JZ7.js +7 -0
- package/dist/{chunk-OVVXSAGE.js → chunk-X7XJBK2E.js} +4 -4
- package/dist/{chunk-6CNFVUT6.js → chunk-XC55NMXR.js} +1 -1
- package/dist/{chunk-3IYMTPGR.js → chunk-YGZMD6TZ.js} +12 -12
- package/dist/{chunk-M2AIC7IK.js → chunk-ZEKM6HAA.js} +2 -2
- package/dist/data/ListLoadError.js +1 -1
- package/dist/format/index.js +1 -1
- package/dist/forms/BorderInput.js +1 -1
- package/dist/forms/BrandAssetEditor.js +1 -1
- package/dist/forms/ColorPicker.js +1 -1
- package/dist/forms/ComposerAttachments.js +1 -1
- package/dist/forms/CornersInput.js +1 -1
- package/dist/forms/DisplayChips.js +1 -1
- package/dist/forms/IconPicker.js +1 -1
- package/dist/forms/InputNumber.js +1 -1
- package/dist/forms/LinkPicker.js +1 -1
- package/dist/forms/MediaLibrary.js +1 -1
- package/dist/forms/MediaUploadField.js +1 -1
- package/dist/forms/MediaUsedInList.js +1 -1
- package/dist/forms/PositionInput.js +1 -1
- package/dist/forms/SidesInput.js +1 -1
- package/dist/forms/Slider.js +1 -1
- package/dist/forms/Snippet.js +1 -1
- package/dist/forms/SplitButton.js +1 -1
- package/dist/forms/TextToolbar.js +1 -1
- package/dist/forms/WidthsBar.js +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.js +124 -124
- package/dist/map/index.js +1 -1
- package/dist/page-tabs/index.js +5 -5
- package/dist/shell/AppUpdateBanner.js +1 -1
- package/dist/shell/ContextMenu.js +1 -1
- package/dist/shell/DropdownMenu.js +1 -1
- package/dist/shell/HelpCenter.js +1 -1
- package/dist/shell/ImageLightbox.js +1 -1
- package/dist/shell/LanguageSelect.js +1 -1
- package/dist/shell/Markdown.d.ts +9 -2
- package/dist/shell/Markdown.js +1 -1
- package/dist/shell/PopupMenu.js +1 -1
- package/dist/shell/SearchableSelect.js +1 -1
- package/dist/shell/SettingReset.js +1 -1
- package/dist/shell/SettingRow.js +1 -1
- package/dist/shell/TopNav.js +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/ChatTemplate.js +1 -1
- package/dist/templates/CheckoutTemplate.js +1 -1
- package/dist/templates/DataTablePage.js +1 -1
- package/dist/templates/EmailTemplate.js +1 -1
- package/dist/templates/FormLayoutPage.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/Calculator-WW7WTG43.js +0 -29
- package/dist/chunk-7FI6NVC7.js +0 -3
- package/dist/chunk-DPDA3AJL.js +0 -1
- package/dist/chunk-EMXR74QM.js +0 -7
- package/dist/chunk-U6BEF6GQ.js +0 -5
- package/dist/chunk-V3UIAX5G.js +0 -21
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{useSettingAuto as e,useInSettingRow as t}from"./chunk-E4Z5OXBI.js";import{
|
|
1
|
+
import{useSettingAuto as e,useInSettingRow as t}from"./chunk-E4Z5OXBI.js";import{IconButton_default as r}from"./chunk-4CANQ3B3.js";import{inputClasses as n}from"./chunk-JFSYWEHD.js";import{Icon as i}from"./chunk-KIBL6M3T.js";import{registerModalEscapeInterceptor as o}from"./chunk-TWVUQUUD.js";import{useShellStrings as a}from"./chunk-E6UCGCOC.js";import{forwardRef as l,useId as c,useState as u,useRef as s,useCallback as d,useEffect as p}from"react";import{jsx as m,jsxs as f,Fragment as b}from"react/jsx-runtime";function v(e){const t=String(e),r=/e-(\d+)$/.exec(t);return r?Number(r[1]):t.split(".")[1]?.length??0}var h=(e,t)=>null==e?"":null!=t?e.toFixed(t):String(e);function y({dir:e,compact:t,label:n,disabled:o,onStep:a}){const l=s(a);l.current=a;const c=s({}),u=d(()=>{const e=c.current;void 0!==e.wait&&clearTimeout(e.wait),void 0!==e.every&&clearInterval(e.every),e.off?.(),c.current={}},[]);p(()=>u,[u]),p(()=>{o&&u()},[o,u]);const f=/* @__PURE__ */m(i,{name:e>0?"chevron-up":"chevron-down","aria-hidden":"true",focusable:"false",className:t?"h-2.5 w-2.5":"h-3.5 w-3.5",strokeWidth:t?2.6:2}),b={tabIndex:-1,"aria-label":n,disabled:o,onPointerDown:e=>{if(0!==e.button||o)return;e.preventDefault(),u();const t=e.shiftKey;l.current(t);const r=e.currentTarget.ownerDocument.defaultView??window;r.addEventListener("pointerup",u),c.current={off:()=>r.removeEventListener("pointerup",u),wait:setTimeout(()=>{c.current.every=setInterval(()=>l.current(t),60)},400)}},onPointerLeave:u,onPointerCancel:u,onClick:e=>{0===e.detail&&l.current(e.shiftKey)}};return t?/* @__PURE__ */m("button",{type:"button",...b,className:"flex min-h-0 flex-1 items-center justify-center text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-40",children:f}):/* @__PURE__ */m(r,{size:"sm",...b,children:f})}var g=l(function({value:r,onChange:i,min:l,max:g,precision:x,step:w,shiftStep:k,disabled:E,readOnly:N,invalid:j,placeholder:D,size:C,prefix:B,suffix:F,id:S,name:K,className:O="",onBlur:U,onFocus:W,steppers:L,stepFrom:M,snap:T=!1,allowEmpty:I=!0,appearance:P="box",display:$,reportWhileTyping:z=!0,onRevert:A,"aria-label":V,"aria-labelledby":Q,"aria-describedby":X,auto:Y,...G},H){const J="bare"===P,R=e(),Z=Y??R,q=c(),_="string"==typeof F&&""!==F.trim()?F.trim():void 0,ee=e=>function(e,t){let r=e.trim();if(t&&r.endsWith(t)&&(r=r.slice(0,-t.length).trim()),r=r.replace(",","."),""===r||"-"===r||"."===r||"-."===r)return null;const n=Number(r);return Number.isFinite(n)?n:null}(e,_),te=Object.fromEntries(Object.entries(G).filter(([e])=>e.startsWith("data-"))),re=a(),[ne,ie]=u(()=>h(r,x)),oe=s(ne);oe.current=ne;const ae=s(null),le=d(e=>{ae.current=e,"function"==typeof H?H(e):H&&(H.current=e)},[H]),ce=s(r),ue=s(r);ue.current=r;const se=Boolean(E||N),de=t(),pe=L??(!!de&&"compact"),me="compact"===pe;p(()=>{ee(oe.current)!==r&&ie(h(r,x))},[r,x]);const fe=e=>{if(se)return;let t=(ee(oe.current)??M??(D?ee(D):null)??0)+e;null!=l&&t<l&&(t=l),null!=g&&t>g&&(t=g);const r=x??String(w??1).split(".")[1]?.length??0;t=Number(t.toFixed(r));const n=h(t,x);oe.current=n,ie(n),i(t),we()},be=s(fe);be.current=fe;const ve=s({unit:w??1,big:k??10*(w??1),locked:se});ve.current={unit:w??1,big:k??10*(w??1),locked:se},p(()=>{const e=ae.current;if(!e)return;const t=t=>{const{unit:r,big:n,locked:i}=ve.current;if(i||e.ownerDocument.activeElement!==e)return;const o=t.deltaY||t.deltaX;o&&(t.preventDefault(),be.current((o<0?1:-1)*(t.shiftKey?n:r)))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[]);const[he,ye]=u(!1),[ge,xe]=u(0),we=()=>{J&&xe(e=>e+1)};p(()=>{J&&he&&document.activeElement===ae.current&&ae.current?.select()},[J,he,ge]);const ke=s(!1);p(()=>{if(he&&!se)return o(e=>{if("Escape"!==e.key||document.activeElement!==ae.current)return!1;const t=ce.current;if(ee(oe.current)===t)return!1;const r=h(t,x);return oe.current=r,ie(r),ue.current!==t&&(A??i)(t),we(),!0})},[he,se,x,i,A]);const Ee=()=>{const e=ee(oe.current);if(null==e){if(!I){const e=h(ue.current,x);return oe.current=e,ie(e),ue.current}return oe.current="",ie(""),null!==ue.current&&i(null),null}let t=e;const r=x??(T?Math.max(v(w??1),v(l??0)):void 0);T&&(t=function(e,t,r){const n=(e-r)/t;return r+Math.round(n+1e-9*Math.sign(e))*t}(t,w??1,l??0)),null!=l&&t<l&&(t=l),null!=g&&t>g&&(t=g),null!=r&&(t=Number(t.toFixed(r)));const n=h(t,x);return oe.current=n,ie(n),t===e&&t===ue.current||i(t),t},Ne=/* @__PURE__ */m("input",{ref:le,id:S,"data-number-input":"",name:K,type:"text",inputMode:0===x?"numeric":"decimal",value:!he&&$?$(r):ne,disabled:E,readOnly:N,placeholder:D,step:w,role:"spinbutton","aria-valuenow":r??void 0,"aria-valuemin":l,"aria-valuemax":g,"aria-valuetext":null==r?D||void 0:`${h(r,x)}${J&&_?_:""}`,"aria-describedby":[X,Z?q:void 0].filter(Boolean).join(" ")||void 0,"data-appearance":J?"bare":void 0,...te,autoComplete:J?"off":void 0,spellCheck:!J&&void 0,"aria-invalid":j||void 0,"aria-label":V,"aria-labelledby":Q,onChange:e=>(e=>{if(N)return;const t=_&&e.trimEnd().endsWith(_)?e.trimEnd().slice(0,-_.length).trimEnd():e;if(""!==t&&!/^-?\d*[.,]?\d*$/.test(t))return;if(ie(e),!z)return;const r=ee(e);(null!==r||I)&&i(r)})(e.target.value),onKeyDown:e=>{if("Enter"===e.key&&!se)return ce.current=Ee(),void we();const t=w??1,r=k??10*t,n="ArrowUp"===e.key?e.shiftKey?r:t:"ArrowDown"===e.key?-(e.shiftKey?r:t):"PageUp"===e.key?10*t:"PageDown"===e.key?10*-t:null;null===n||se||(e.preventDefault(),fe(n))},onFocus:()=>{ce.current=ue.current,ye(!0),ke.current=!0,W?.()},onMouseUp:J?e=>{ke.current&&(ke.current=!1,e.preventDefault())}:void 0,onBlur:()=>{ye(!1),ke.current=!1,Ee(),U?.()},className:J?["block min-w-0 m-0 rounded-(--radius-control) border-0 p-0 text-center tabular-nums","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",he?"bg-white":"bg-transparent",se?"cursor-default":"cursor-text",O].filter(Boolean).join(" "):n({invalid:j,size:C,readOnly:N,auto:Z,className:[B?"pl-6":"",me?F?"pr-10":"pr-6":pe?F?"pr-24":"pr-16":F?"pr-10":"","text-left tabular-nums",O].filter(Boolean).join(" ")})}),je=Z?/* @__PURE__ */m("span",{id:q,hidden:!0,children:re.settingView.auto}):null;if(J||!B&&!F&&!pe)return je?/* @__PURE__ */f(b,{children:[Ne,je]}):Ne;const De=ee(ne);/* @__PURE__ */
|
|
2
2
|
return f("div",{className:"relative","data-number-box":"",children:[B&&/* @__PURE__ */m("span",{className:"pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-sm text-gray-500",children:B}),Ne,je,F&&/* @__PURE__ */m("span",{className:`pointer-events-none absolute ${me?"right-6":pe?"right-16":"right-3"} top-1/2 -translate-y-1/2 text-xs text-gray-500`,children:F}),pe&&(()=>{const e=/* @__PURE__ */m(y,{dir:-1,compact:me,label:re.number.decrease,disabled:se||null!=l&&null!=De&&De<=l,onStep:e=>be.current(-(e?k??10*(w??1):w??1))}),t=/* @__PURE__ */m(y,{dir:1,compact:me,label:re.number.increase,disabled:se||null!=g&&null!=De&&De>=g,onStep:e=>be.current(e?k??10*(w??1):w??1)});/* @__PURE__ */
|
|
3
3
|
return f("span",me?{"data-steppers":"compact",className:"absolute inset-y-px right-px flex w-4 flex-col overflow-hidden rounded-r-(--radius-control)",children:[t,e]}:{className:"absolute right-1 top-1/2 flex -translate-y-1/2 items-center gap-0.5",children:[e,t]})})()]})});export{g as InputNumber_default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{
|
|
2
|
-
return t("div",{role:"group","aria-label":p?void 0:m,"aria-labelledby":p,"aria-describedby":f,className:`flex flex-wrap gap-2 ${u}`.trim(),children:b.map((l,n)=>{const b=`${g}-${n}-state`,m=`${g}-${n}-reason`,u=Boolean(l.disabled)&&null!=l.disabledReason&&""!==l.disabledReason,p=/* @__PURE__ */c("button",{type:"button","aria-pressed":l.shown,disabled:!(!l.disabled||u)||void 0,"aria-disabled":!!u||void 0,"aria-describedby":
|
|
3
|
-
/* @__PURE__ */t(
|
|
1
|
+
import{swallowPress as e,describedByWith as r,OffWithReason as i}from"./chunk-VH6GB73Q.js";import{Icon as a}from"./chunk-KIBL6M3T.js";import{OneLineLabel as o}from"./chunk-6KO5VTL7.js";import{Tooltip as s}from"./chunk-22S6LG6D.js";import{useShellStrings as l}from"./chunk-E6UCGCOC.js";import{useId as n,Fragment as d}from"react";import{jsx as t,jsxs as c}from"react/jsx-runtime";function b({items:b,onChange:h,label:m,className:u="","aria-labelledby":p,"aria-describedby":f}){const w=l().displayChips,g=n();/* @__PURE__ */
|
|
2
|
+
return t("div",{role:"group","aria-label":p?void 0:m,"aria-labelledby":p,"aria-describedby":f,className:`flex flex-wrap gap-2 ${u}`.trim(),children:b.map((l,n)=>{const b=`${g}-${n}-state`,m=`${g}-${n}-reason`,u=Boolean(l.disabled)&&null!=l.disabledReason&&""!==l.disabledReason,p=/* @__PURE__ */c("button",{type:"button","aria-pressed":l.shown,disabled:!(!l.disabled||u)||void 0,"aria-disabled":!!u||void 0,"aria-describedby":r(b,u?m:void 0),onClick:u?e:()=>h(l.id,!l.shown),className:"inline-flex h-6 max-w-full shrink-0 items-center gap-1 whitespace-nowrap rounded-full border pl-2 pr-3 text-xs font-medium transition-colors rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)] disabled:cursor-not-allowed disabled:opacity-60 aria-disabled:cursor-not-allowed aria-disabled:opacity-60 "+(l.shown?"border-blue-200 bg-blue-50 text-blue-700 hover:bg-blue-100":"border-gray-200 bg-white text-gray-500 hover:bg-gray-50 hover:text-gray-900"),children:[
|
|
3
|
+
/* @__PURE__ */t(a,{name:l.shown?"eye":"eye-off",className:"h-4 w-4 shrink-0",strokeWidth:"1.75"}),
|
|
4
4
|
/* @__PURE__ */t(o,{children:l.label})]}),f=/* @__PURE__ */t("span",{id:b,className:"sr-only",children:l.shown?w.shown:w.hidden});/* @__PURE__ */
|
|
5
|
-
return c(d,{children:[u?/* @__PURE__ */t(
|
|
5
|
+
return c(d,{children:[u?/* @__PURE__ */t(i,{reason:l.disabledReason,id:m,children:p}):/* @__PURE__ */t(s,{content:l.shown?w.shownHint:w.hiddenHint,describe:!1,className:"relative inline-flex max-w-full",children:p}),f]},l.id)})})}export{b as DisplayChips};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{InputNumber_default as e}from"./chunk-MTXTJLFK.js";import{useSettingAuto as t,useInSettingRow as i}from"./chunk-E4Z5OXBI.js";import{useShellStrings as n}from"./chunk-E6UCGCOC.js";import{createContext as r,useState as l,useMemo as a,useId as o,useRef as d,useContext as s,useEffect as u,useLayoutEffect as c}from"react";import{jsx as m,jsxs as f}from"react/jsx-runtime";var p=(e,t,i)=>Math.min(i,Math.max(t,e));function h(e){const t=String(e),i=/e-(\d+)$/.exec(t);return i?Number(i[1]):t.split(".")[1]?.length??0}var v=8,x=40;function b(e){return Math.max(1,...e.map(e=>(e??"").length))}var w="undefined"==typeof window?u:c;function y(e,t,i,n){return Number(p(e,t,i).toFixed(n))}var g=r(null);function S({children:e}){const[t,i]=l({}),n=a(()=>(e,t)=>i(i=>{if(null===t){if(!(e in i))return i;const t={...i};return delete t[e],t}return i[e]===t?i:{...i,[e]:t}}),[]),r=a(()=>{const e=Object.values(t);return{set:n,width:e.length?`max(${e.join(", ")})`:null}},[t,n]);/* @__PURE__ */
|
|
2
|
+
return m(g.Provider,{value:r,children:e})}function F({value:r,onChange:a,min:c,max:S,step:F=1,shiftStep:z,precision:$,inputMin:k,inputMax:C,suffix:L,showInput:N=!0,emptyLabel:j,placeholderValue:K,stepFrom:M,label:E,"aria-labelledby":A,valueText:D,id:O,disabled:R,size:T="md",className:B="",auto:I}){const U=n(),V=o(),W=t(),X=I??W,q=o(),G=O??V,J=$??h(F),P=k??c,Z=C??S,H=void 0!==j||void 0!==K,Q=M??K,Y=p(r??K??c,c,S),_=d(null),[ee,te]=l(null),ie=Boolean(L);w(()=>{const e=()=>{const e=_.current?.querySelector("input");if(!e)return;const t=getComputedStyle(e),i=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"].reduce((e,i)=>e+(parseFloat(t[i])||0),0);i<=0||te(e=>e&&e.frame===i&&e.fontSize===t.fontSize?e:{frame:i,fontSize:t.fontSize})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[ie,N]);const ne=e=>D?D(e):"string"==typeof L?`${e.toFixed(J)} ${L}`:void 0,re=null==r?j??(null!=K?ne(K)??String(K):void 0):ne(r),le=`calc(${b([c.toFixed(J),S.toFixed(J),r?.toFixed(J),j,K?.toFixed(J)])}ch + ${(ee?.frame??10+(ie?x:v))+2}px)`,ae=s(g),oe=o(),de=ae?.set;w(()=>{de&&de(oe,N?le:null)},[de,oe,le,N]),u(()=>()=>de?.(oe,null),[de,oe]);const se=i();/* @__PURE__ */
|
|
3
|
+
return f("div",{"data-slider":"",className:`flex w-full min-w-0 items-center ${se?"flex-wrap gap-2":"gap-3"} ${B}`.trim(),children:[
|
|
4
|
+
/* @__PURE__ */m("input",{id:G,type:"range",min:c,max:S,step:F,value:Y,disabled:R,"aria-label":A?void 0:E,"aria-labelledby":A,"aria-valuetext":re,"aria-describedby":X?q:void 0,onKeyDown:e=>{const t="ArrowUp"===e.key||"ArrowRight"===e.key?1:"ArrowDown"===e.key||"ArrowLeft"===e.key?-1:0;if(!t||e.altKey||e.ctrlKey||e.metaKey)return;const i=e.shiftKey&&null!=z;if(!i&&!(null==r&&null!=Q))return;e.preventDefault();a(y((r??Q??Y)+t*(i?z??F:F),c,S,J))},onChange:e=>a(y(Number(e.target.value),c,S,J)),className:`min-w-24 flex-1 ${se?"basis-24":""} cursor-pointer accent-blue-600 disabled:cursor-not-allowed disabled:opacity-60 ${"sm"===T?"h-1":"h-1.5"}`}),N&&
|
|
5
|
+
/* @__PURE__ */m("div",{ref:_,"data-slider-box":"",className:se?"ml-auto shrink-0":"shrink-0 text-xs",style:se?void 0:{width:ae?.width??le,...ee?{fontSize:ee.fontSize}:{}},children:/* @__PURE__ */m(e,{value:r,onChange:e=>{null!=e?e<P||e>Z||a(e):H&&a(null)},min:P,max:Z,step:F,shiftStep:z,stepFrom:Q,precision:J,snap:!0,allowEmpty:H,suffix:L,disabled:R,placeholder:j??(null!=K?K.toFixed(J):void 0),size:se?void 0:"sm",auto:X,"aria-label":E?U.slider.value(E):void 0,"aria-labelledby":E?void 0:A})}),X&&/* @__PURE__ */m("span",{id:q,hidden:!0,children:U.settingView.auto})]})}export{F as Slider,S as SliderGroup,y as settleSliderValue,b as sliderBoxChars,h as stepDecimals};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{
|
|
2
|
-
return k("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&&j}:{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:t&&j})}var P=d(function({onClick:
|
|
3
|
-
return x("button",{ref:f,id:d,role:"radio"===M?"menuitemradio":"checkbox"===M?"menuitemcheckbox":a??(C?"menuitem":void 0),"aria-checked":M?l:void 0,"aria-labelledby":b?w:void 0,"aria-describedby":b?N:void 0,tabIndex:u,onClick:()=>{
|
|
1
|
+
import{optionNoteClass as e}from"./chunk-QR4RM7PO.js";import{keepsNativeMenu as t}from"./chunk-5QFPTDQF.js";import{Icon as n}from"./chunk-KIBL6M3T.js";import{onOverlayOpen as r}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as o}from"./chunk-62LW225J.js";import{useHydrated as i,useBrowserLayoutEffect as a}from"./chunk-D65T4H6J.js";import{glassStyle as l,GLASS_DIVIDER as c}from"./chunk-DTJRIWFR.js";import{registerModalEscapeInterceptor as s}from"./chunk-TWVUQUUD.js";import{createContext as u,forwardRef as d,useContext as p,useId as m,useRef as h,useState as f,useEffect as g,useMemo as y,useCallback as b}from"react";import{createPortal as w}from"react-dom";import{jsxs as x,jsx as k,Fragment as v}from"react/jsx-runtime";function N(e,t,n){return e.length===t+1&&e[t].key===n.key?e:[...e.slice(0,t),n]}function C(e,t){const n=Math.max(0,t);return e.length>n?e.slice(0,n):e}function T(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 M(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 E(e,t,n,r,o,i=!1,a=8){const l=t+o,c=e-o-n,s=c>=a;return i&&s?{left:c,flipped:!0}:l+n<=r-a?{left:l,flipped:!1}:s?{left:c,flipped:!0}:i?{left:a,flipped:!0}:{left:Math.max(a,r-a-n),flipped:!1}}function W(){try{return getComputedStyle(document.documentElement).getPropertyValue("--menu-density")?.trim()||"normal"}catch{return"normal"}}var L=u(null),$=u(!1);function B({children:e,style:n,className:a="",onClose:c,minWidth:u=180,portal:d=!1}){const p=h(null),b=m(),[x,v]=f([]),T=h();g(()=>()=>clearTimeout(T.current),[]);const M=i(),E=y(()=>{const e=()=>clearTimeout(T.current);return{id:b,depth:0,path:x,open:(t,n)=>{e(),v(e=>N(e,t,n))},scheduleClose:t=>{e(),T.current=setTimeout(()=>v(e=>C(e,t)),200)},closeBelow:t=>{e(),v(e=>C(e,t))},cancelClose:e,closeTree:()=>{e(),v([]),c?.()},root:p}},[b,x,c]);g(()=>{if(!c)return;const e=e=>{e.target.closest("[data-menu-toggle]")||e.target.closest?.(`[data-popup-menu-tree="${b}"]`)||p.current&&!p.current.contains(e.target)&&c()},t=e=>{"Escape"===e.key&&c()};window.addEventListener("pointerdown",e),window.addEventListener("keydown",t);const n=r(c),o=s(()=>!1,()=>p.current);return()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t),n(),o()}},[c,b]),g(()=>{const e=p.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 $=W(),B=/(^|[\s:])!?z-/.test(a),R=/* @__PURE__ */k("div",{ref:p,"data-popup-menu-tree":b,className:`fixed rounded-(--radius-popup) ${"tight"===$?"py-1":"large"===$?"py-2":"py-1"} ${a}`,onContextMenu:e=>{t(e.target)||e.preventDefault()},style:{...B?{}:{zIndex:o.menu},minWidth:u,animation:"popup-in 0.12s ease-out",...l(),...n},children:/* @__PURE__ */k(L.Provider,{value:E,children:e})});return d?M?w(R,document.body):null:R}function R(e,t,n,r=!1){const o=W(),i="tight"===o?"0.25rem":"large"===o?"0.6rem":0;return{className:`w-full flex items-center gap-2 text-left transition-colors rounded-lg mx-auto\n ${e?"text-red-600 not-disabled:not-aria-disabled:hover:bg-red-50":r?"bg-blue-50 text-blue-700":"text-gray-700 not-disabled:not-aria-disabled:hover:bg-blue-50 not-disabled:not-aria-disabled: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,..."normal"===o?{minHeight:"calc(var(--row-height-menu, 2.25rem) + 2 * (var(--menu-padding-y, 0.5rem) - 0.5rem))"}:{}}}}var j=/* @__PURE__ */k(n,{name:"check","aria-hidden":!0,className:"h-4 w-4",strokeWidth:2});function D({kind:e,checked:t}){/* @__PURE__ */
|
|
2
|
+
return k("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&&j}:{"aria-hidden":!0,"data-menu-check":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:t&&j})}var P=d(function({onClick:t,children:n,className:r="",danger:o,disabled:i,role:a,checked:l,icon:c,description:s,tabIndex:u,id:d,onMouseEnter:h},f){const g=p(L),y=m(),b=null!=s&&!1!==s,w=`${d??y}-label`,N=`${d??y}-note`,C=p($),T=R(o,i,r),M=void 0===l?null:"menuitemradio"===a?"radio":"checkbox";/* @__PURE__ */
|
|
3
|
+
return x("button",{ref:f,id:d,role:"radio"===M?"menuitemradio":"checkbox"===M?"menuitemcheckbox":a??(C?"menuitem":void 0),"aria-checked":M?l:void 0,"aria-labelledby":b?w:void 0,"aria-describedby":b?N:void 0,tabIndex:u,onClick:()=>{t?.(),g&&g.depth>0&&"checkbox"!==M&&g.closeTree()},onMouseEnter:()=>{g?.scheduleClose(g.depth),h?.()},disabled:i,className:T.className,style:T.style,children:[M&&/* @__PURE__ */k(D,{kind:M,checked:!!l}),b?
|
|
4
4
|
/* @__PURE__ */x("span",{className:"block min-w-0 flex-1 py-2",children:[
|
|
5
5
|
/* @__PURE__ */x("span",{className:"flex items-center gap-2",children:[null!=c&&/* @__PURE__ */k(A,{children:c}),
|
|
6
6
|
/* @__PURE__ */k("span",{id:w,className:"min-w-0",children:n})]}),
|
|
7
|
-
/* @__PURE__ */k("span",{id:N,"data-menu-note":"",className:
|
|
8
|
-
return k("span",{"aria-hidden":"true","data-menu-icon":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e})}var F=/* @__PURE__ */k(n,{name:"chevron-right","aria-hidden":!0,className:"h-3.5 w-3.5 shrink-0 ml-auto",strokeWidth:2});function H(e){let t=o.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 I(e){return e?[...e.querySelectorAll("button:not([disabled]), a[href]")].filter(t=>t.closest("[data-popup-submenu-panel]")===e):[]}function z({label:
|
|
7
|
+
/* @__PURE__ */k("span",{id:N,"data-menu-note":"",className:e(),style:null!=c?{paddingLeft:"1.5rem"}:void 0,children:s})]}):/* @__PURE__ */x(v,{children:[null!=c&&/* @__PURE__ */k(A,{children:c}),n]})]})});function A({children:e}){/* @__PURE__ */
|
|
8
|
+
return k("span",{"aria-hidden":"true","data-menu-icon":"",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e})}var F=/* @__PURE__ */k(n,{name:"chevron-right","aria-hidden":!0,className:"h-3.5 w-3.5 shrink-0 ml-auto",strokeWidth:2});function H(e){let t=o.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 I(e){return e?[...e.querySelectorAll("button:not([disabled]), a[href]")].filter(t=>t.closest("[data-popup-submenu-panel]")===e):[]}function z({label:e,icon:n,children:r,disabled:o,className:i="",minWidth:c=180,maxHeight:u,rowProps:d}){const f=p(L),N=m(),C=h(null),T=h(null),$=h(),B=h(!1),j=`${N}-menu`;g(()=>()=>clearTimeout($.current),[]);const D=f?.depth??0,P=f?.path[D],A=!!P&&P.key===N&&!o,z=b(e=>{if(!f||o||!C.current)return;clearTimeout($.current),B.current=e;const t=C.current.getBoundingClientRect(),n=C.current.closest("[data-popup-submenu-panel]")??C.current.closest("[data-popup-menu-tree]"),r=n?.getBoundingClientRect()??t,i=D>0&&(f.path[D-1]?.flipped??!1),a=E(r.left,r.right,c,window.innerWidth,4,i);f.open(D,{key:N,y:t.top,...a})},[f,o,D,N,c]),S=e=>{f?.closeBelow(D),C.current?.focus()};g(()=>{if(A)return s(e=>"Escape"===e.key&&(!(f&&f.path.length>D+1)&&(S(),!0)),()=>T.current)}),a(()=>{if(!A||!P)return;const e=()=>{const e=T.current;if(!e||!C.current)return;const t=C.current.closest("[data-popup-submenu-panel]")??C.current.closest("[data-popup-menu-tree]"),n=t?.getBoundingClientRect()??C.current.getBoundingClientRect(),r=D>0&&(f?.path[D-1]?.flipped??!1),o=e.offsetWidth||c,i=E(n.left,n.right,o,window.innerWidth,4,r,8),a=e.offsetHeight,l=M(C.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)}}),g(()=>{A&&B.current&&(B.current=!1,I(T.current)[0]?.focus())},[A]);const q=y(()=>f&&{...f,depth:D+1},[f,D]);if(!f)throw new Error("PopupSubmenu must be rendered inside a PopupMenu");const Q=R(!1,o,i,A),U=W();/* @__PURE__ */
|
|
9
9
|
return x(v,{children:[
|
|
10
10
|
/* @__PURE__ */x("button",{ref:C,type:"button",role:"menuitem","aria-haspopup":"menu","aria-expanded":A,"aria-controls":A?j:void 0,disabled:o,"data-popup-submenu-row":!0,className:Q.className,style:Q.style,onClick:e=>{const t=0===e.detail;A?t&&I(T.current)[0]?.focus():z(t)},...d,onKeyDown:e=>{"ArrowRight"===e.key&&(e.preventDefault(),e.stopPropagation(),z(!0))},onMouseEnter:()=>{d?.onMouseEnter?.(),o||(f.cancelClose(),A?f.closeBelow(D+1):(clearTimeout($.current),$.current=setTimeout(()=>z(!1),120)))},onMouseLeave:()=>{clearTimeout($.current),f.scheduleClose(D)},children:[n,
|
|
11
|
-
/* @__PURE__ */k("span",{className:"min-w-0 flex-1 truncate",children:
|
|
12
|
-
/* @__PURE__ */k("div",{ref:T,id:j,role:"menu","data-popup-menu-tree":f.id,"data-popup-submenu-panel":!0,className:"fixed rounded-(--radius-popup) overflow-x-hidden overflow-y-auto overscroll-contain "+("tight"===U?"py-1":"large"===U?"py-2":"py-1"),style:{left:P.left,top:P.y,minWidth:c,maxHeight:void 0===u?"calc(100vh - 16px)":`min(${"number"==typeof u?`${u}px`:u}, calc(100vh - 16px))`,zIndex:H(f.root.current)+D+1,animation:(P.flipped?"popup-submenu-in-left":"popup-submenu-in")+" 0.1s ease-out",...l()},onKeyDown:e=>{if(e.target.closest("[data-popup-submenu-panel]")!==e.currentTarget)return;const t=I(T.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:()=>{f.cancelClose(),clearTimeout($.current)},onMouseLeave:()=>f.scheduleClose(D+1),onContextMenu:
|
|
11
|
+
/* @__PURE__ */k("span",{className:"min-w-0 flex-1 truncate",children:e}),F]}),A&&w(
|
|
12
|
+
/* @__PURE__ */k("div",{ref:T,id:j,role:"menu","data-popup-menu-tree":f.id,"data-popup-submenu-panel":!0,className:"fixed rounded-(--radius-popup) overflow-x-hidden overflow-y-auto overscroll-contain "+("tight"===U?"py-1":"large"===U?"py-2":"py-1"),style:{left:P.left,top:P.y,minWidth:c,maxHeight:void 0===u?"calc(100vh - 16px)":`min(${"number"==typeof u?`${u}px`:u}, calc(100vh - 16px))`,zIndex:H(f.root.current)+D+1,animation:(P.flipped?"popup-submenu-in-left":"popup-submenu-in")+" 0.1s ease-out",...l()},onKeyDown:e=>{if(e.target.closest("[data-popup-submenu-panel]")!==e.currentTarget)return;const t=I(T.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:()=>{f.cancelClose(),clearTimeout($.current)},onMouseLeave:()=>f.scheduleClose(D+1),onContextMenu:e=>{t(e.target)||e.preventDefault()},children:/* @__PURE__ */k(L.Provider,{value:q,children:r})}),document.body)]})}function S(){const e=W();/* @__PURE__ */
|
|
13
13
|
return k("div",{className:`border-t ${c} ${"tight"===e?"my-0.5":"large"===e?"my-2":"my-1"} mx-3`})}function q(){const e=W(),t="tight"===e?"0.125rem":"large"===e?"0.375rem":"0.25rem";return{color:"var(--ink-muted)",paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:t,paddingBottom:t}}function Q({children:e}){/* @__PURE__ */
|
|
14
14
|
return k("div",{className:"text-xs font-medium uppercase tracking-wide",style:q(),children:e})}function U({d:e,className:t="h-4 w-4"}){/* @__PURE__ */
|
|
15
15
|
return k("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:/* @__PURE__ */k("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e})})}export{D as MenuCheckMark,U as MenuIcon,$ as MenuSemanticsContext,B as PopupMenu,S as PopupMenuDivider,P as PopupMenuItem,Q as PopupMenuLabel,z as PopupSubmenu,M as clampMenuTop,C as closeMenuBelow,R as itemLook,E as menuPanelLeft,q as menuTextRowStyle,N as openMenuLevel,T as resolveMenuLevels};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{InputNumber_default as e}from"./chunk-
|
|
1
|
+
import{InputNumber_default as e}from"./chunk-MTXTJLFK.js";import{IconButton_default as a}from"./chunk-4CANQ3B3.js";import{Icon as r}from"./chunk-KIBL6M3T.js";import{Tooltip as i}from"./chunk-22S6LG6D.js";import{jsx as t,jsxs as n,Fragment as o}from"react/jsx-runtime";var d="h-3.5 w-3.5",s={padding:{top:/* @__PURE__ */t(r,{name:"padding-top","aria-hidden":"true",className:d}),right:/* @__PURE__ */t(r,{name:"padding-right","aria-hidden":"true",className:d}),bottom:/* @__PURE__ */t(r,{name:"padding-bottom","aria-hidden":"true",className:d}),left:/* @__PURE__ */t(r,{name:"padding-left","aria-hidden":"true",className:d}),vertical:/* @__PURE__ */t(r,{name:"padding-y","aria-hidden":"true",className:d}),horizontal:/* @__PURE__ */t(r,{name:"padding-left-right","aria-hidden":"true",className:d})},crop:{top:/* @__PURE__ */t(r,{name:"crop-top","aria-hidden":"true",className:d}),right:/* @__PURE__ */t(r,{name:"crop-right","aria-hidden":"true",className:d}),bottom:/* @__PURE__ */t(r,{name:"crop-bottom","aria-hidden":"true",className:d}),left:/* @__PURE__ */t(r,{name:"crop-left","aria-hidden":"true",className:d}),vertical:/* @__PURE__ */t(r,{name:"crop-y","aria-hidden":"true",className:d}),horizontal:/* @__PURE__ */t(r,{name:"crop-left-right","aria-hidden":"true",className:d})}},l=/* @__PURE__ */t(r,{name:"sides-each","aria-hidden":"true",className:"h-4 w-4"});var m=(e,a,r)=>null===e[r]?a[r]:String(e[r]);function c(e,a){const r=r=>m(e,a,r);return r("left")!==r("right")||r("top")!==r("bottom")}function h({label:a,value:r,onChange:i,each:d,placeholder:l,words:c,min:h=0,max:p=200,step:u=4,readOnly:g,glyphs:f="padding"}){const b=s[f],N=(a,n,o)=>{const d=function(e,a){const r=a.map(a=>e[a]);return r.every(e=>e===r[0])?r[0]:"mixed"}(r,a),s=a.map(e=>m(r,l,e)),f="mixed"!==d&&s.every(e=>e===s[0])?s[0]:"–";/* @__PURE__ */
|
|
2
2
|
return t("div",{"data-side":a.join("-"),className:"min-w-0",children:/* @__PURE__ */t(e,{value:"mixed"===d?null:d,onChange:e=>((e,a)=>{const t={...r};for(const r of e)t[r]=a;i(t)})(a,e),min:h,max:p,step:u,snap:!0,precision:0,steppers:"compact",readOnly:g,placeholder:f,prefix:o,suffix:c.unit,"aria-label":n})})};/* @__PURE__ */
|
|
3
|
-
return t("div",{role:"group","aria-label":a,"data-sides":d?"each":"pairs",className:"grid min-w-0 grid-cols-2 gap-2",children:/* @__PURE__ */n(o,d?{children:[
|
|
3
|
+
return t("div",{role:"group","aria-label":a,"data-sides":d?"each":"pairs",className:"grid min-w-0 grid-cols-2 gap-2",children:/* @__PURE__ */n(o,d?{children:[N(["left"],c.sides.left,b.left),N(["top"],c.sides.top,b.top),N(["right"],c.sides.right,b.right),N(["bottom"],c.sides.bottom,b.bottom)]}:{children:[N(["left","right"],c.horizontal,b.horizontal),N(["top","bottom"],c.vertical,b.vertical)]})})}function p({each:e,onChange:r,label:n,disabled:o}){/* @__PURE__ */
|
|
4
4
|
return t(i,{content:n,children:/* @__PURE__ */t(a,{size:"sm","aria-label":n,"aria-pressed":e,disabled:o,onClick:()=>r(!e),children:l})})}export{p as SidesEachToggle,h as SidesInput,c as sidesStartEach};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{Popover as e}from"./chunk-RNBM5JZI.js";import{InputNumber_default as r}from"./chunk-
|
|
2
|
-
return w("button",{ref:l,type:o,"aria-pressed":a,className:$({size:r,selected:a,className:n}),...t,children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(e)})})}),D=(e,r,a)=>Math.min(a,Math.max(r,e)),I=e=>"string"==typeof e?{value:e}:e;function M(e,r,a){const n=a?.1:.01,o={ArrowLeft:[-n,0],ArrowRight:[n,0],ArrowDown:[0,-n],ArrowUp:[0,n]}[r];return o?{...e,s:D(e.s+o[0],0,1),v:D(e.v+o[1],0,1)}:null}function P(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return D(e-n,0,359);case"ArrowRight":case"ArrowUp":return D(e+n,0,359);case"PageDown":return D(e-10,0,359);case"PageUp":return D(e+10,0,359);case"Home":return 0;case"End":return 359;default:return null}}var A={boxShadow:"0 0 0 2px white, 0 0 0 3px color-mix(in srgb, black 35%, transparent)"};function
|
|
1
|
+
import{Popover as e}from"./chunk-RNBM5JZI.js";import{InputNumber_default as r}from"./chunk-MTXTJLFK.js";import{InSettingRowContext as a}from"./chunk-E4Z5OXBI.js";import{parseHexColor as n,hexToHsv as o,hsvToHex as t,hexReadout as l,HUE_GRADIENT as i,HEX_MAX_LENGTH as s,svFromPoint as c,hueFromPoint as u}from"./chunk-S6OB6HJB.js";import{inputClasses as d}from"./chunk-JFSYWEHD.js";import{Tooltip as h}from"./chunk-22S6LG6D.js";import{useShellStrings as g}from"./chunk-E6UCGCOC.js";import{forwardRef as p,useState as b,useRef as m,useEffect as f,useId as v}from"react";import{jsx as w,jsxs as x}from"react/jsx-runtime";var y={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},k={backgroundImage:"conic-gradient(var(--line-strong) 25%, var(--surface) 0 50%, var(--line-strong) 0 75%, var(--surface) 0)",backgroundSize:"8px 8px"};function C(e){return null==e||Number.isNaN(e)?100:Math.round(Math.min(100,Math.max(0,e)))}function N(e,r){if(!e)return k;const a=C(r);if(a>=100)return{background:e};const n=`color-mix(in srgb, ${e} ${a}%, transparent)`;return{backgroundImage:`linear-gradient(${n}, ${n}), ${k.backgroundImage}`,backgroundSize:`auto, ${k.backgroundSize}`}}function $({size:e="md",selected:r=!1,className:a=""}={}){return["relative inline-flex shrink-0 overflow-hidden rounded-md p-0 transition-shadow","rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]","disabled:cursor-not-allowed disabled:opacity-60",r?"border-2 border-blue-500":"border border-gray-300 hover:shadow-sm",y[e],a].filter(Boolean).join(" ")}var z=p(function({color:e,size:r="md",selected:a,className:n,type:o="button",...t},l){/* @__PURE__ */
|
|
2
|
+
return w("button",{ref:l,type:o,"aria-pressed":a,className:$({size:r,selected:a,className:n}),...t,children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(e)})})}),D=(e,r,a)=>Math.min(a,Math.max(r,e)),I=e=>"string"==typeof e?{value:e}:e;function M(e,r,a){const n=a?.1:.01,o={ArrowLeft:[-n,0],ArrowRight:[n,0],ArrowDown:[0,-n],ArrowUp:[0,n]}[r];return o?{...e,s:D(e.s+o[0],0,1),v:D(e.v+o[1],0,1)}:null}function P(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return D(e-n,0,359);case"ArrowRight":case"ArrowUp":return D(e+n,0,359);case"PageDown":return D(e-10,0,359);case"PageUp":return D(e+10,0,359);case"Home":return 0;case"End":return 359;default:return null}}var A={boxShadow:"0 0 0 2px white, 0 0 0 3px color-mix(in srgb, black 35%, transparent)"};function j(e,r,a){const n=a?10:1;switch(r){case"ArrowLeft":case"ArrowDown":return D(e-n,0,100);case"ArrowRight":case"ArrowUp":return D(e+n,0,100);case"PageDown":return D(e-10,0,100);case"PageUp":return D(e+10,0,100);case"Home":return 0;case"End":return 100;default:return null}}function S({value:e,onChange:r,label:s,presets:d,clearable:p=!1,fallback:v,dragWrites:y="live",disabled:$=!1,opacity:D,onOpacityChange:S,onClose:T,id:B,className:K=""}){const L=g().color,R=C(D),U=e=>{const r=C(e);$||r===R||S?.(r)},H=e=>{const r=e.currentTarget.getBoundingClientRect();return r.width>0?(e.clientX-r.left)/r.width*100:R},X=n(v??""),[J,W]=b(()=>o(e||X||"")),q=m(e);f(()=>{e!==q.current&&(q.current=e,e?W(o(e)):X&&W(o(X)))},[e]);const F=a=>{$||a===e||(q.current=a,r(a))},G=e=>{const r=n(e);r&&(W(o(r)),F(r))},Y=e=>{W(e),F(t(e))},[Z,V]=b(!1),Q=m(J);Q.current=J;const _=e=>({onPointerDown:r=>{if($||0!==r.button)return;r.currentTarget.setPointerCapture?.(r.pointerId),r.currentTarget.focus({preventScroll:!0});const a=e(r,Q.current);"end"===y?(V(!0),W(a)):Y(a)},onPointerMove:r=>{if($||!(1&r.buttons))return;const a=e(r,Q.current);"end"===y?W(a):Y(a)},onPointerUp:r=>{"end"===y&&Z&&(V(!1),Y(e(r,Q.current)))}}),ee=_((e,r)=>({...r,...c(e.clientX,e.clientY,e.currentTarget.getBoundingClientRect())})),re=_((e,r)=>({...r,h:u(e.clientX,e.currentTarget.getBoundingClientRect())})),ae=Z?t(J):e,ne=e=>`${Math.round(100*e)}%`,oe=(d??[]).map(I),te=n(e),le=ae||X||"";
|
|
3
3
|
/* @__PURE__ */
|
|
4
|
-
return w(a.Provider,{value:!1,children:/* @__PURE__ */x("div",{id:
|
|
4
|
+
return w(a.Provider,{value:!1,children:/* @__PURE__ */x("div",{id:B,className:`flex w-56 flex-col gap-3 ${$?"opacity-60":""} ${K}`.trim(),onKeyDown:e=>{"Escape"===e.key&&T&&(e.preventDefault(),e.stopPropagation(),T())},children:[(oe.length>0||p)&&/* @__PURE__ */x("div",{role:"group","aria-label":L.presets,className:"flex flex-wrap gap-2",children:[p&&/* @__PURE__ */w(h,{content:L.clear,children:/* @__PURE__ */w(z,{color:"",size:"sm","aria-label":L.clear,selected:""===e,disabled:$,onClick:()=>{$||""===e||(q.current="",r(""))}})}),oe.map(e=>{const r=n(e.value),a=e.label?`${e.label} · ${l(r??e.value)}`:l(r??e.value);/* @__PURE__ */
|
|
5
5
|
return w(h,{content:a,children:/* @__PURE__ */w(z,{color:r??e.value,size:"sm","aria-label":a,selected:null!==r&&r===te,disabled:$,onClick:()=>G(e.value)})},`${e.label??""}:${e.value}`)})]}),
|
|
6
|
-
/* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":
|
|
7
|
-
/* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":
|
|
6
|
+
/* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":L.square,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(100*J.v),"aria-valuetext":L.squareValue(Math.round(100*J.s),Math.round(100*J.v)),"aria-disabled":$||void 0,"data-color-square":"",onKeyDown:e=>{if($)return;const r=M(J,e.key,e.shiftKey);r&&(e.preventDefault(),Y(r))},...ee,className:"relative h-36 w-full cursor-crosshair touch-none rounded-md rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundColor:t({h:J.h,s:1,v:1}),backgroundImage:"linear-gradient(to top, black, transparent), linear-gradient(to right, white, transparent)"},children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"pointer-events-none absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:ne(J.s),top:ne(1-J.v),...A}})}),
|
|
7
|
+
/* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":L.hue,"aria-valuemin":0,"aria-valuemax":359,"aria-valuenow":Math.round(J.h),"aria-orientation":"horizontal","aria-disabled":$||void 0,"data-color-hue":"",onKeyDown:e=>{if($)return;const r=P(J.h,e.key,e.shiftKey);null!==r&&(e.preventDefault(),Y({...J,h:r}))},...re,className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:i},children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:J.h/360*100+"%",background:t({h:J.h,s:1,v:1}),...A}})}),S&&/* @__PURE__ */w("div",{role:"slider",tabIndex:$?-1:0,"aria-label":L.opacity(s),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":R,"aria-valuetext":`${R}%`,"aria-orientation":"horizontal","aria-disabled":$||void 0,"data-color-opacity":"",onKeyDown:e=>{if($)return;const r=j(R,e.key,e.shiftKey);null!==r&&(e.preventDefault(),U(r))},onPointerDown:e=>{$||0!==e.button||(e.currentTarget.setPointerCapture?.(e.pointerId),e.currentTarget.focus({preventScroll:!0}),U(H(e)))},onPointerMove:e=>{!$&&1&e.buttons&&U(H(e))},className:"relative h-3 w-full cursor-pointer touch-none rounded-full rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)]",style:{backgroundImage:`linear-gradient(to right, transparent, ${le||"black"}), ${k.backgroundImage}`,backgroundSize:`auto, ${k.backgroundSize}`},children:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{left:`${R}%`,...N(le||"black",R),...A}})}),
|
|
8
8
|
/* @__PURE__ */x("div",{className:"flex items-center gap-2",children:[
|
|
9
|
-
/* @__PURE__ */w("span",{"aria-hidden":"true",className:"relative h-8 w-8 shrink-0 overflow-hidden rounded-md border border-gray-300",style:N(le,
|
|
10
|
-
/* @__PURE__ */w(
|
|
11
|
-
return w("input",{id:i,type:"text",value:g??(e?l(e):""),"aria-label":a,placeholder:o,maxLength:s,spellCheck:!1,autoComplete:"off",disabled:t,onChange:a=>{p(a.target.value);const o=n(a.target.value);null!==o&&o!==e&&r(o)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),p(null))},onBlur:()=>p(null),"data-hex-look":u,className:m})}function
|
|
12
|
-
return w("div",{"data-color-opacity-box":"",className:"w-20 shrink-0",children:/* @__PURE__ */w(r,{value:e,onChange:e=>{null!==e&&a(e)},min:0,max:100,precision:0,suffix:"%",size:t,"aria-label":n,disabled:o})})}function
|
|
9
|
+
/* @__PURE__ */w("span",{"aria-hidden":"true",className:"relative h-8 w-8 shrink-0 overflow-hidden rounded-md border border-gray-300",style:N(le,S?R:null)}),
|
|
10
|
+
/* @__PURE__ */w(O,{value:ae,placeholder:!e&&X?l(X):void 0,onChange:G,label:L.hex(s),disabled:$}),S&&/* @__PURE__ */w(E,{value:R,onChange:U,label:L.opacity(s),disabled:$})]})]})})}var T={sm:"w-[calc(7ch+1rem+4px)] min-w-[calc(7ch+1rem+4px)]",md:"w-[calc(7ch+1.5rem+4px)] min-w-[calc(7ch+1.5rem+4px)]",lg:"w-[calc(7ch+2rem+4px)] min-w-[calc(7ch+2rem+4px)]"},B={sm:"h-6",md:"h-8",lg:"h-10"},K=["block w-[calc(7ch+0.5rem+4px)] min-w-[calc(7ch+0.5rem+4px)] flex-none rounded-(--radius-control)","border border-transparent bg-transparent px-1 text-2xs font-mono uppercase","text-gray-800 placeholder:text-gray-400 hover:border-gray-300","focus:border-blue-400 focus:bg-(--surface) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring)]","disabled:cursor-not-allowed disabled:opacity-60"].join(" ");function O({value:e,onChange:r,label:a,placeholder:o,disabled:t,id:i,size:c="md",look:u="box",className:h=""}){const[g,p]=b(null),m="text"===u?`${K} ${B[c]} ${h}`.trim():d({size:c,className:`${T[c]} flex-1 font-mono uppercase ${h}`.trim()}).replace(/(^| )w-full( |$)/," ");/* @__PURE__ */
|
|
11
|
+
return w("input",{id:i,type:"text",value:g??(e?l(e):""),"aria-label":a,placeholder:o,maxLength:s,spellCheck:!1,autoComplete:"off",disabled:t,onChange:a=>{p(a.target.value);const o=n(a.target.value);null!==o&&o!==e&&r(o)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),p(null))},onBlur:()=>p(null),"data-hex-look":u,className:m})}function E({value:e,onChange:a,label:n,disabled:o,size:t="md"}){/* @__PURE__ */
|
|
12
|
+
return w("div",{"data-color-opacity-box":"",className:"w-20 shrink-0",children:/* @__PURE__ */w(r,{value:e,onChange:e=>{null!==e&&a(e)},min:0,max:100,precision:0,suffix:"%",size:t,"aria-label":n,disabled:o})})}function L({value:r,onChange:a,label:o,presets:t,clearable:i,fallback:s,dragWrites:c,disabled:u,id:d,showHexInput:h=!1,opacity:p,onOpacityChange:b,size:m="md",align:f="start",open:y,onOpenChange:k,className:z=""}){const D=g().color,I=C(p),M=v(),P=n(s??""),A=r||P||"",j=r?l(r):P?l(P):D.none;
|
|
13
13
|
/* @__PURE__ */
|
|
14
14
|
return x("div",{className:`inline-flex items-center ${b?"flex-wrap justify-end gap-1":h?"gap-1":"gap-2"} ${z}`.trim(),children:[
|
|
15
|
-
/* @__PURE__ */w(e,{id:d,trigger:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(A,b?I:null)}),triggerLabel:D.swatch(o,
|
|
16
|
-
/* @__PURE__ */w(
|
|
15
|
+
/* @__PURE__ */w(e,{id:d,trigger:/* @__PURE__ */w("span",{"aria-hidden":"true",className:"absolute inset-0",style:N(A,b?I:null)}),triggerLabel:D.swatch(o,j),triggerClassName:$({size:m}),"aria-label":D.panel(o),align:f,open:y,onOpenChange:k,disabled:u,children:/* @__PURE__ */w(S,{id:M,value:r,onChange:a,label:o,presets:t,clearable:i,fallback:s,dragWrites:c,disabled:u,opacity:p,onOpacityChange:b})}),h&&
|
|
16
|
+
/* @__PURE__ */w(O,{value:r,placeholder:!r&&P?l(P):void 0,onChange:e=>{u||e===r||a(e)},label:D.hex(o),disabled:u,size:m,look:"text"}),b&&/* @__PURE__ */w(E,{value:I,onChange:e=>{u||e===I||b(e)},label:D.opacity(o),disabled:u,size:m})]})}export{L as ColorPicker,S as ColorPickerPanel,z as ColorSwatch,O as HexInput,k as NO_COLOR_FILL,C as clampOpacity,N as colorFill,$ as colorSwatchClasses,P as stepHue,j as stepOpacity,M as stepSquare};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{resolveColumnShares as e,COLUMN_SHARES_EQUAL as t,COLUMN_SHARE_MIN as r,COLUMN_COUNT_MAX as n}from"./chunk-PLGJOHEG.js";import{InputNumber_default as o}from"./chunk-
|
|
2
|
-
return f("div",{role:"group","aria-label":P?void 0:N,"aria-labelledby":P,"aria-describedby":
|
|
1
|
+
import{resolveColumnShares as e,COLUMN_SHARES_EQUAL as t,COLUMN_SHARE_MIN as r,COLUMN_COUNT_MAX as n}from"./chunk-PLGJOHEG.js";import{InputNumber_default as o}from"./chunk-MTXTJLFK.js";import{Button_default as i}from"./chunk-4IU5BSVE.js";import{Tooltip as l}from"./chunk-22S6LG6D.js";import{useShellStrings as a}from"./chunk-E6UCGCOC.js";import{useId as s,useRef as c,useState as d,useEffect as u,Fragment as h}from"react";import{jsxs as f,jsx as m}from"react/jsx-runtime";var p=(e,t,r)=>Math.min(r,Math.max(t,e)),v=e=>e.reduce((e,t)=>e+t,0),g=(e,t)=>e.length===t.length&&e.every((e,r)=>e===t[r]);var y,b="w-0.5",w=`${b} group-hover/widths:w-1 group-focus-visible/widths:w-1`;var x=["text-blue-700","text-gray-600"];function k({count:k,value:C,onChange:$,label:N,"aria-labelledby":P,readOnly:j=!1,disabled:M=!1,footer:z=!0,className:R=""}){const S=a().widths,B=s(),T=p(Math.round(k)||1,1,n),A=e(C,T),D=A??[...t[T]??[]],E=[...D,100-v(D)],K=j||M,O=c(null),L=c({onChange:$,shown:D,locked:K,n:T,stored:A});L.current={onChange:$,shown:D,locked:K,n:T,stored:A};const G=t=>{const{onChange:r,shown:n,locked:o,n:i}=L.current;if(o)return!1;const l=e(t,i);return!(!l||g(l,n))&&(r(l),!0)},I=(e,t,n)=>{const o=e[t]+e[t+1],i=[...e];i[t]=p(Math.round(n),r,o-r),i[t+1]=o-i[t],G(i.slice(0,-1))&&(ie.current=null)},U=e=>t=>{if(t.altKey||t.ctrlKey||t.metaKey)return;const n=t.shiftKey?10:1,o=E[e]+E[e+1],i="ArrowRight"===t.key?E[e]+n:"ArrowLeft"===t.key?E[e]-n:"PageUp"===t.key?E[e]+10:"PageDown"===t.key?E[e]-10:"Home"===t.key?r:"End"===t.key?o-r:null;null!==i&&(t.preventDefault(),I(E,e,i))},F=c(null),[H,X]=d(null),J=()=>{F.current=null,X(null),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("user-select")};u(()=>J,[]);const V=e=>t=>{if(0!==t.button||K)return;t.preventDefault();const r=O.current?.getBoundingClientRect().width??0;r<=0||(F.current={i:e,x:t.clientX,width:r,from:E,moved:!1,pointer:t.pointerId},X(e),t.currentTarget.setPointerCapture?.(t.pointerId),document.body.style.cursor="col-resize",document.body.style.userSelect="none")},W=e=>{const t=F.current;if(!t)return;if(0===e.buttons)return void J();const r=e.clientX-t.x;if(!t.moved){if(Math.abs(r)<3)return;t.moved=!0}I(t.from,t.i,t.from[t.i]+r/t.width*100)},q=e=>{const t=F.current;t&&(e.currentTarget.hasPointerCapture?.(t.pointer)&&e.currentTarget.releasePointerCapture(t.pointer),J())},Q=(e,t)=>{const{shown:n}=L.current,o=function(e,t,n){const o=e.length,i=[...e];if(o<2)return i;const l=p(Math.round(n),r,100-(o-1)*r);let a=l-i[t];i[t]=l;const s=[...Array.from({length:o-1-t},(e,r)=>t+1+r),...Array.from({length:t},(e,r)=>t-1-r)];if(a<0)return i[s[0]]-=a,i;for(const e of s){if(a<=0)break;const t=Math.min(a,i[e]-r);i[e]-=t,a-=t}return i}([...n,100-v(n)],e,t);return G(o.slice(0,-1))?o:null},[Y,Z]=d(0);u(()=>{const e=O.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(()=>Z(e.getBoundingClientRect().width));return t.observe(e),()=>t.disconnect()},[]);const _=c(null),[ee,te]=d(null),[re,ne]=d([]),oe=(e,t)=>te(r=>t?e:r===e?null:r),ie=c(null),le=(e,t)=>{const r=ie.current;if(!r||r.column!==e||r.share!==t)return!1;const{onChange:n,locked:o,stored:i}=L.current;var l,a;return o||(l=i,a=r.stored,void 0===l||void 0===a?l===a:g(l,a))||n(r.stored),!0},ae=E.join(",");u(()=>{const e=null===ee?[]:function(e,t){if(!e)return[];const r=Array.from(e.querySelectorAll("input[data-widths-label]")),n=r[t]?.getBoundingClientRect();if(!n||0===n.width)return[];if(void 0===y&&(y=document.createElement("canvas").getContext("2d")),!y)return[];const o=y;return r.flatMap((e,r)=>{if(r===t)return[];const i=e.getBoundingClientRect(),l=getComputedStyle(e);o.font=`${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;const a=o.measureText(e.value).width/2,s=(i.left+i.right)/2;return s+a>n.left&&s-a<n.right?[r]:[]})}(_.current,ee);ne(t=>g(t,e)?t:e)},[ee,ae,Y]);const se=E.slice(0,-1).map((e,t)=>v(E.slice(0,t+1)));/* @__PURE__ */
|
|
2
|
+
return f("div",{role:"group","aria-label":P?void 0:N,"aria-labelledby":P,"aria-describedby":T>1?B:void 0,className:`flex w-full min-w-0 flex-col gap-2 ${M?"opacity-60":""} ${R}`.trim(),children:[
|
|
3
3
|
/* @__PURE__ */f("div",{ref:_,"data-widths-bar":"",className:"relative h-8",children:[
|
|
4
|
-
/* @__PURE__ */m("div",{ref:
|
|
5
|
-
/* @__PURE__ */m("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-gray-300"}),
|
|
6
|
-
return m("div",{className:"absolute inset-y-0 "+(n?"z-20":""),style:{left:`clamp(0px, calc(${i+e/2}% - ${l} / 2), calc(100% - ${l}))`,width:l},children:/* @__PURE__ */m(o,{appearance:"bare",value:e,display:()=>(e=>Y>0&&Y*e/100<36?String(e):`${e}%`)(e),suffix:"%",min:r,max:100-(
|
|
7
|
-
/* @__PURE__ */m("span",{id:B,"data-widths-hint":"",className:"text-2xs leading-tight text-gray-500 @max-[264px]:self-stretch",children:
|
|
8
|
-
/* @__PURE__ */m(i,{variant:"secondary",size:"sm",disabled:K,onClick:()=>{K||void 0===C||$(void 0)},className:"shrink-0",children:
|
|
4
|
+
/* @__PURE__ */m("div",{ref:O,"data-widths-track":"",className:"flex h-full w-full overflow-hidden rounded-(--radius-control) bg-white",children:E.map((e,t)=>/* @__PURE__ */m("div",{"data-widths-segment":"",style:{flexBasis:`${e}%`},className:`flex min-w-0 shrink-0 grow-0 items-center justify-center overflow-hidden whitespace-nowrap text-xs font-medium tabular-nums ${x[t%2]} ${t%2==0?"bg-blue-50":""}`,children:1===T&&/* @__PURE__ */m("span",{"data-widths-label":"",children:`${e}%`})},t))}),
|
|
5
|
+
/* @__PURE__ */m("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 rounded-(--radius-control) border border-gray-300"}),T>1&&E.map((e,t)=>/* @__PURE__ */f(h,{children:[(()=>{const n=ee===t,i=v(E.slice(0,t)),l=n?`max(${e}%, 40px)`:`${e}%`;/* @__PURE__ */
|
|
6
|
+
return m("div",{className:"absolute inset-y-0 "+(n?"z-20":""),style:{left:`clamp(0px, calc(${i+e/2}% - ${l} / 2), calc(100% - ${l}))`,width:l},children:/* @__PURE__ */m(o,{appearance:"bare",value:e,display:()=>(e=>Y>0&&Y*e/100<36?String(e):`${e}%`)(e),suffix:"%",min:r,max:100-(T-1)*r,step:1,shiftStep:10,precision:0,allowEmpty:!1,reportWhileTyping:!1,readOnly:j,disabled:M,"aria-label":S.column(t+1),"aria-describedby":B,"data-widths-label":"",onChange:e=>{null===e||le(t,e)||Q(t,e)},onRevert:e=>((e,t)=>{L.current.locked||null===t||le(e,t)||Q(e,t)})(t,e),onFocus:()=>{ie.current={column:t,share:e,stored:L.current.stored},oe(t,!0)},onBlur:()=>oe(t,!1),className:`absolute inset-0 text-xs font-medium ${x[t%2]} ${re.includes(t)&&!n?"opacity-0":""}`})})})(),t<T-1&&/* @__PURE__ */m("div",{className:"absolute inset-y-0 z-10 w-3 -translate-x-1/2",style:{left:`${se[t]}%`},children:/* @__PURE__ */m(l,{content:S.dragHint,delay:600,className:"relative flex h-full w-full",children:/* @__PURE__ */m("div",{role:"separator",tabIndex:M?-1:0,"aria-orientation":"vertical","aria-label":S.divider(t+1,t+2),"aria-valuenow":E[t],"aria-valuemin":r,"aria-valuemax":E[t]+E[t+1]-r,"aria-valuetext":S.dividerValue(t+1,E[t],t+2,E[t+1]),"aria-disabled":K||void 0,onKeyDown:K?void 0:U(t),onPointerDown:V(t),onPointerMove:W,onPointerUp:q,onPointerCancel:q,onLostPointerCapture:()=>{F.current&&J()},className:"group/widths flex h-full w-full touch-none justify-center rounded-(--radius-control) rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] "+(K?"cursor-default":"cursor-col-resize"),children:/* @__PURE__ */m("span",{"aria-hidden":"true","data-widths-line":"",className:"h-full rounded-full "+(K?`${b} bg-gray-300`:`bg-blue-600 transition-[width,background-color] duration-(--motion-fast) group-hover/widths:bg-blue-700 ${H===t?"w-1":w}`)})})})})]},t))]}),T>1&&!z&&/* @__PURE__ */m("span",{id:B,className:"sr-only",children:S.hint(T,r)}),T>1&&z&&/* @__PURE__ */m("div",{"data-widths-footer":"",className:"@container",children:/* @__PURE__ */f("div",{className:"flex items-center justify-between gap-2 @max-[264px]:flex-col @max-[264px]:items-end",children:[
|
|
7
|
+
/* @__PURE__ */m("span",{id:B,"data-widths-hint":"",className:"text-2xs leading-tight text-gray-500 @max-[264px]:self-stretch",children:S.hint(T,r)}),
|
|
8
|
+
/* @__PURE__ */m(i,{variant:"secondary",size:"sm",disabled:K,onClick:()=>{K||void 0===C||$(void 0)},className:"shrink-0",children:S.reset})]})})]})}export{k as WidthsBar};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{isFocusableEntry as e,menuStatusIds as t,renderMenuEntries as r}from"./chunk-B55IXYDR.js";import{useTabLayer as n,focusableIn as o}from"./chunk-CDAJKLGL.js";import{PopupMenu as i,PopupMenuDivider as a}from"./chunk-PJCVNFWM.js";import{onOverlayOpen as l}from"./chunk-PGN5ME7B.js";import{Z_LAYERS as s}from"./chunk-62LW225J.js";import{placeMenu as d,popupBounds as c,followAnchor as u}from"./chunk-GLUJS42B.js";import{useBrowserLayoutEffect as p}from"./chunk-D65T4H6J.js";import{registerModalEscapeInterceptor as f}from"./chunk-TWVUQUUD.js";import{useState as m,useRef as h,useId as g,useCallback as v,useEffect as b}from"react";import{jsxs as y,jsx as x}from"react/jsx-runtime";var k=/(^|[\s:])!?z-/,w={paddingLeft:"var(--menu-padding-x, 1rem)",paddingRight:"var(--menu-padding-x, 1rem)",paddingTop:"0.25rem",paddingBottom:"0.25rem"};function D({trigger:D,items:L,align:j="end",side:C="bottom","aria-label":W,className:A="",triggerClassName:E,menuClassName:K="",minWidth:S=180,linkAs:N,disabled:$,id:H,"aria-describedby":T,"aria-disabled":U=!1,onOpenChange:B,footer:I,footerLabel:J}){const[M,q]=m(!1),[G,P]=m(-1),R=h(null),z=h(null),V=h(null),Y=h(null),F=h(null),O=null!=I&&!1!==I,Q=h({text:"",at:0}),X=g(),Z=g(),_=H??Z,ee=h(B);ee.current=B;const te=h(M);te.current=M;const re=v(e=>{q(!1),te.current&&(te.current=!1,ee.current?.(!1)),e&&z.current?.focus()},[]),ne=(t,r)=>{const n=L.length;for(let o=0;o<n;o+=1){const i=((t+r*o)%n+n)%n;if(e(L[i]))return i}return-1},oe=()=>V.current?.closest("[data-popup-menu-tree]")??null;b(()=>{if(!M)return;const e=e=>{const t=e.target;if(R.current?.contains(t)||oe()?.contains(t))return;const r=oe()?.getAttribute("data-popup-menu-tree"),n=t.closest?.("[data-popup-menu-tree]");r&&n?.getAttribute("data-popup-menu-tree")===r||re(!1)};document.addEventListener("pointerdown",e,!0);const t=l(()=>re(!1));return()=>{document.removeEventListener("pointerdown",e,!0),t()}},[M,re]);const ie=v(()=>{const e=oe(),t=z.current;if(!e||!t)return;const r=e.style;r.left="0px",r.top="0px",r.maxWidth="none",r.maxHeight="none";const n={width:e.offsetWidth,height:e.offsetHeight},o=d({trigger:t.getBoundingClientRect(),menu:n,bounds:c(t),align:j,side:C});r.left=`${o.left}px`,r.top=`${o.top}px`,r.maxWidth=`${o.maxWidth}px`,r.maxHeight=`${o.maxHeight}px`,r.overflowY=n.height>o.maxHeight?"auto":"",e.dataset.side=o.side,e.dataset.align=j},[j,C]);p(()=>{M&&ie()}),b(()=>{if(M)return u(()=>z.current,ie)},[M,ie]),b(()=>{if(!M)return;const t=V.current,r=e(L[G])?t?.querySelector(`[data-dropdown-index="${G}"]`):null;(r??t)?.focus({preventScroll:!0})},[M,G]),b(()=>{if(M)return f(e=>"Escape"===e.key&&(re(!0),!0),()=>Y.current)},[M,re]),n(Y,M&&O);const ae=h(null),le=e=>"first"===e?ne(0,1):ne(L.length-1,-1),se=e=>{P(le(e)),q(!0),te.current||(te.current=!0,ae.current=e,B?.(!0))};p(()=>{const e=ae.current;if(!M||!e)return;ae.current=null;const t=le(e);t!==G&&P(t)});const de=t(L,X),ce="function"==typeof I?I({close:()=>re(!0)}):I,ue={...k.test(K)?{}:{zIndex:s.popup},minWidth:S};/* @__PURE__ */
|
|
2
|
+
return y("div",{ref:R,className:`relative inline-flex ${A}`.trim(),children:[
|
|
3
|
+
/* @__PURE__ */x("button",{ref:z,id:_,type:"button","aria-haspopup":"menu","aria-expanded":M,"aria-controls":M?X:void 0,"aria-label":W,"aria-describedby":T,"aria-disabled":U||void 0,disabled:$,onClick:()=>{U||(M?re(!1):se("first"))},onKeyDown:e=>{U||("ArrowDown"===e.key||"Enter"===e.key||" "===e.key?(e.preventDefault(),se("first")):"ArrowUp"===e.key&&(e.preventDefault(),se("last")))},className:E??"inline-flex items-center justify-center rounded-(--radius-control) text-gray-600 transition-colors not-disabled:not-aria-disabled:hover:bg-gray-100 not-disabled:not-aria-disabled:hover:text-gray-900 rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-solid)] disabled:cursor-not-allowed disabled:opacity-60 "+(W?"h-8 min-w-8 px-0":"h-8 min-w-8 gap-2 px-3"),children:D}),M&&
|
|
4
|
+
/* @__PURE__ */x(i,{portal:!0,className:K,style:ue,children:/* @__PURE__ */y("div",{ref:Y,children:[
|
|
5
|
+
/* @__PURE__ */x("div",{ref:V,id:X,role:"menu","aria-orientation":"vertical","aria-label":W,"aria-labelledby":W?void 0:_,"aria-describedby":de,tabIndex:-1,onKeyDown:t=>{if(!t.target.closest?.("[data-popup-submenu-panel]")||"Tab"===t.key)if("ArrowDown"===t.key)t.preventDefault(),P(ne(G+1,1));else if("ArrowUp"===t.key)t.preventDefault(),P(ne(G-1,-1));else if("Home"===t.key)t.preventDefault(),P(ne(0,1));else if("End"===t.key)t.preventDefault(),P(ne(L.length-1,-1));else if("Tab"===t.key){t.preventDefault();const e=!t.shiftKey&&F.current?o(F.current)[0]:void 0;e?e.focus({preventScroll:!0}):re(!0)}else if(" "===t.key){const e=t.target;e.matches?.("a[href]")&&(t.preventDefault(),e.click())}else 1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey||(t=>{const r=Date.now(),n=t.key.toLowerCase(),o=r-Q.current.at<500?Q.current.text+n:n;Q.current={text:o,at:r};const i=[...o].every(e=>e===o[0]),a=i?o[0]:o,l=i?G+1:Math.max(G,0),s=V.current,d=L.length;for(let r=0;r<d;r+=1){const n=((l+r)%d+d)%d;if(e(L[n])&&(s?.querySelector(`[data-dropdown-index="${n}"]`)?.textContent?.trim().toLowerCase()??"").startsWith(a))return t.preventDefault(),void P(n)}})(t)},children:r(L,{menuId:X,choose:e=>{e.disabled||(re(!0),e.onSelect())},toggle:e=>{e.disabled||e.onSelect()},followLink:()=>re(!0),rowProps:(e,t)=>({"data-dropdown-index":e,tabIndex:e===G?0:-1,onMouseEnter:()=>{t.disabled||F.current?.contains(document.activeElement)||P(e)}}),linkAs:N})}),O&&/* @__PURE__ */y("div",{ref:F,role:"group","aria-label":J,"data-dropdown-footer":"",onKeyDown:e=>{const t=F.current;if("Tab"!==e.key||!t||!t.contains(e.target))return;const r=o(t),n=document.activeElement;if(e.shiftKey){if(r.length>0&&n!==r[0])return;e.preventDefault();const t=V.current?.querySelector(`[data-dropdown-index="${G}"]`);return void(t??V.current)?.focus({preventScroll:!0})}r.length>0&&n!==r[r.length-1]||(e.preventDefault(),re(!0))},children:[
|
|
6
|
+
/* @__PURE__ */x("div",{"aria-hidden":"true",children:/* @__PURE__ */x(a,{})}),
|
|
7
|
+
/* @__PURE__ */x("div",{style:w,children:ce})]})]})})]})}export{D as DropdownMenu};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{CountBadge as e}from"./chunk-MAOJENIB.js";import{
|
|
1
|
+
import{CountBadge as e}from"./chunk-MAOJENIB.js";import{isShown as t}from"./chunk-HCP7WOAL.js";import{SettingAutoContext as a,InSettingRowContext as i}from"./chunk-E4Z5OXBI.js";import{useShellStrings as n}from"./chunk-E6UCGCOC.js";import{jsx as s,jsxs as r}from"react/jsx-runtime";var l={default:{pad:"p-4",gap:"gap-4",text:"text-sm",bodyTop:"mt-4",bodyPad:"pt-3"},compact:{pad:"py-2",gap:"gap-2",text:"text-sm",bodyTop:"mt-2",bodyPad:"pt-2"}};function d({label:d,icon:c,action:m,value:o,readout:p,description:h,children:x,controlId:u,unknownText:g="—",quiet:f=!1,size:v="default",viewState:y,divider:N=!0,showWhen:w,values:b,context:$,className:j=""}){const k=n();if(!t(w,b,$))return null;const P=l[v],C=void 0!==o||void 0===x&&null==m,O=null==o||""===o,T=f?"text-gray-500":"text-gray-800",B=O?"text-gray-400":f?"text-gray-500":"text-gray-900",E=null!=p&&!1!==p,I=`${P.text} font-medium ${T}${"compact"===v?" whitespace-nowrap":""}`,A=u?/* @__PURE__ */s("label",{htmlFor:u,className:I,children:d}):/* @__PURE__ */s("span",{className:I,children:d}),V="auto"===y?/* @__PURE__ */s("span",{"data-setting-auto":"","aria-hidden":"true",className:"shrink-0 rounded-sm border border-gray-200 px-1 text-2xs font-normal leading-4 text-gray-500",children:k.settingView.auto}):"edited"===y?/* @__PURE__ */r("span",{"data-setting-edited":"",className:"inline-flex shrink-0 items-center",children:[
|
|
2
2
|
/* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex",children:/* @__PURE__ */s(e,{dot:!0,tone:"accent"})}),
|
|
3
|
-
/* @__PURE__ */s("span",{className:"sr-only",children:k.settingView.edited})]}):null,W=/* @__PURE__ */s(
|
|
3
|
+
/* @__PURE__ */s("span",{className:"sr-only",children:k.settingView.edited})]}):null,W=/* @__PURE__ */s(a.Provider,{value:"auto"===y,children:O?g:o}),q=[N?"border-t border-gray-100 first:border-t-0":"",P.pad,j].filter(Boolean).join(" "),z=null!=x&&!1!==x&&/* @__PURE__ */s("div",{className:`${P.bodyTop} border-t border-gray-100 ${P.bodyPad}`,children:x});/* @__PURE__ */
|
|
4
4
|
return r("div",E?{className:q,"data-setting-row":"compact"===v?v:void 0,children:[
|
|
5
5
|
/* @__PURE__ */r("div",{"data-setting-line":"",className:"flex flex-wrap items-center justify-between gap-x-2 gap-y-2",children:[
|
|
6
6
|
/* @__PURE__ */s("div",{"data-setting-name":"compact"===v?"":void 0,className:"flex-1 basis-0",children:/* @__PURE__ */r("div",{className:`flex min-w-0 items-center gap-2 ${T}`,children:[null!=c&&/* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:c}),A,V]})}),
|
|
7
7
|
/* @__PURE__ */r("div",{"data-setting-end":"",className:"ml-auto flex shrink-0 items-center gap-1",children:[
|
|
8
|
-
/* @__PURE__ */s("span",{"data-setting-readout":"",className:`whitespace-nowrap ${P.text} ${f?"text-gray-500":"text-gray-900"}`,children:p}),("compact"===v||null!=m)&&/* @__PURE__ */s("span",{"data-setting-reset":"",className:"inline-flex h-6 w-6 shrink-0 items-center justify-center",children:m})]})]}),h&&/* @__PURE__ */s("p",{className:"mt-0.5 text-xs text-gray-500",children:h}),void 0!==o&&/* @__PURE__ */s("div",{"data-setting-value":"",className:`mt-2 flex justify-end ${P.text} ${B}`,children:/* @__PURE__ */s(
|
|
8
|
+
/* @__PURE__ */s("span",{"data-setting-readout":"",className:`whitespace-nowrap ${P.text} ${f?"text-gray-500":"text-gray-900"}`,children:p}),("compact"===v||null!=m)&&/* @__PURE__ */s("span",{"data-setting-reset":"",className:"inline-flex h-6 w-6 shrink-0 items-center justify-center",children:m})]})]}),h&&/* @__PURE__ */s("p",{className:"mt-0.5 text-xs text-gray-500",children:h}),void 0!==o&&/* @__PURE__ */s("div",{"data-setting-value":"",className:`mt-2 flex justify-end ${P.text} ${B}`,children:/* @__PURE__ */s(i.Provider,{value:"compact"===v,children:W})}),z]}:{className:q,"data-setting-row":"compact"===v?v:void 0,children:[
|
|
9
9
|
/* @__PURE__ */r("div",{className:"compact"===v?"flex flex-wrap items-center justify-between gap-x-2 gap-y-2":`flex items-center justify-between ${P.gap}`,children:[
|
|
10
10
|
/* @__PURE__ */r("div",{"data-setting-name":"compact"===v?"":void 0,className:"compact"===v?"flex-1 basis-0":"min-w-0 flex-1",children:[null!=c?
|
|
11
11
|
/* @__PURE__ */r("div",{className:`flex min-w-0 items-center gap-2 ${T}`,children:[
|
|
12
12
|
/* @__PURE__ */s("span",{"aria-hidden":"true",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:c}),A,V]}):V?/* @__PURE__ */r("div",{className:"flex min-w-0 items-center gap-2",children:[A,V]}):A,h&&/* @__PURE__ */s("p",{className:"mt-0.5 text-xs text-gray-500",children:h})]}),"compact"===v?
|
|
13
|
-
/* @__PURE__ */r("div",{"data-setting-end":"",className:"ml-auto flex shrink-0 items-center gap-1",children:[C&&/* @__PURE__ */s("div",{"data-setting-value":"",className:`flex items-center justify-end ${P.text} ${B}`,children:/* @__PURE__ */s(
|
|
13
|
+
/* @__PURE__ */r("div",{"data-setting-end":"",className:"ml-auto flex shrink-0 items-center gap-1",children:[C&&/* @__PURE__ */s("div",{"data-setting-value":"",className:`flex items-center justify-end ${P.text} ${B}`,children:/* @__PURE__ */s(i.Provider,{value:!0,children:W})}),
|
|
14
14
|
/* @__PURE__ */s("span",{"data-setting-reset":"",className:"inline-flex h-6 w-6 shrink-0 items-center justify-center",children:m})]}):null!=m?/* @__PURE__ */r("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[C&&/* @__PURE__ */s("div",{className:`${P.text} ${B}`,children:W}),m]}):C&&/* @__PURE__ */s("div",{className:`shrink-0 ${P.text} ${B}`,children:W})]}),z]})}export{d as SettingRow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{client_default as a}from"./chunk-
|
|
1
|
+
import{client_default as a}from"./chunk-L3NYH4QV.js";var t=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),e="uploaded:wallpaper";function r(a,t){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===e?t||"":a}var l=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=(t,e)=>{const r=new FormData;r.append("wallpaper",t);const l=e?{onUploadProgress:a=>e(a.total?Math.round(a.loaded/a.total*100):null)}:void 0;return a.post("/auth/me/wallpaper/",r,l).then(a=>a.data)},p=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function o(a){const t=a?.response?.status,e=a?.response?.data,r=Array.isArray(e?.wallpaper)?e.wallpaper[0]:void 0;return r||(413===t?"That picture is too large to use as a wallpaper.":415===t?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{e as WALLPAPER_PREF_TOKEN,p as deleteWallpaper,t as getNumberingConfigs,l as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,o as wallpaperUploadError};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import{useCopyText as e,CopyGlyph as t}from"./chunk-FL2PUQX7.js";import{PopupMenu as n,PopupMenuItem as r,PopupMenuDivider as i}from"./chunk-
|
|
1
|
+
import{useCopyText as e,CopyGlyph as t}from"./chunk-FL2PUQX7.js";import{PopupMenu as n,PopupMenuItem as r,PopupMenuDivider as i}from"./chunk-PJCVNFWM.js";import{Icon as l}from"./chunk-KIBL6M3T.js";import{useShellStrings as a}from"./chunk-E6UCGCOC.js";import{useState as o,useMemo as s,useRef as d,useEffect as c,Fragment as u,useLayoutEffect as m}from"react";import{jsxs as f,jsx as p,Fragment as y}from"react/jsx-runtime";function h(e){const t=[];let n=0;for(;n<e.length;){const r=e[n].group;let i=n;for(;void 0!==r&&i+1<e.length&&e[i+1].group===r;)i++;t.push(i>n?{group:r,start:n,end:i}:{start:n,end:n}),n=i+1}return t}function g(e,t){return e.find(e=>t>=e.start&&t<=e.end)}function b(e,t,n,r){const i=e.findIndex(e=>e.key===t.key);let l=e.findIndex(e=>e.key===n);if(i<0||l<0)return null;const a=h(e),o=g(a,i),s="group"===t.kind&&void 0!==o.group?e.slice(o.start,o.end+1).map(e=>e.key):[t.key];if(s.includes(n))return null;const d=g(a,l);if("tab"===t.kind&&void 0!==o.group){if(d!==o)return null}else void 0!==d.group&&(l="before"===r?d.start:d.end);return{key:e[l].key,side:r,moving:s}}function k(e,t,n,r){const i=b(e,t,n,r);if(!i)return null;const l=e.map(e=>e.key).filter(e=>!i.moving.includes(e)),a=l.indexOf(i.key)+("after"===i.side?1:0),o=[...l.slice(0,a),...i.moving,...l.slice(a)];return o.every((t,n)=>t===e[n].key)?null:o}var x="flex-[0_1_15rem]",v=x,w="outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-blue-500";function N(){/* @__PURE__ */
|
|
2
2
|
return p(l,{name:"close",look:"mini","aria-hidden":"true",className:"size-3.5"})}function C({text:n,label:r,copiedLabel:i}){const{copied:l,copy:a}=e(n);/* @__PURE__ */
|
|
3
|
-
return p("button",{type:"button",tabIndex:-1,"aria-label":l?i:r,title:l?i:r,onClick:a,className:"flex size-5 shrink-0 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 @max-[10rem]:hidden",children:/* @__PURE__ */p(t,{copied:l,className:"size-3.5"})})}function $({node:e}){const t=d(null);return m(()=>{const n=t.current;if(n)return n.appendChild(e),()=>{e.parentNode===n&&n.removeChild(e)}},[e]),/* @__PURE__ */p("span",{ref:t,className:"ml-1 flex shrink-0 items-center"})}function z({tabs:e,activeKey:t,idFor:m,panelMounted:g,onActivate:z,onClose:I,onCloseMany:
|
|
3
|
+
return p("button",{type:"button",tabIndex:-1,"aria-label":l?i:r,title:l?i:r,onClick:a,className:"flex size-5 shrink-0 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 @max-[10rem]:hidden",children:/* @__PURE__ */p(t,{copied:l,className:"size-3.5"})})}function $({node:e}){const t=d(null);return m(()=>{const n=t.current;if(n)return n.appendChild(e),()=>{e.parentNode===n&&n.removeChild(e)}},[e]),/* @__PURE__ */p("span",{ref:t,className:"ml-1 flex shrink-0 items-center"})}function z({tabs:e,activeKey:t,idFor:m,panelMounted:g,onActivate:z,onClose:I,onCloseMany:j,label:D,className:T,activeClassName:M,end:A,afterPinned:E,onIconMenu:_,menuItems:B,sizing:K="even",tall:L=!1,onReorder:O,groupInfo:R}){const S=a().pageTabs,[F,P]=o(null),W=L?"h-[34px]":"h-8",X=s(()=>e.map(e=>({key:e.key,group:R?e.group:void 0})),[e,R]),U=s(()=>h(X),[X]),[V,G]=o(()=>/* @__PURE__ */new Set),H=e=>G(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),J=s(()=>{const n=[];for(const r of U)for(let i=r.start;i<=r.end;i++)void 0!==r.group&&V.has(r.group)&&e[i].key!==t||n.push(e[i]);return n},[U,V,e,t]),Q=d(null),[Y,q]=o(null),Z=(t,n)=>O?{draggable:!0,onDragStart:n=>{Q.current=t,n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("text/plain",e.find(e=>e.key===t.key)?.title??"")},onDragOver:e=>{const r=Q.current;if(!r)return;const i=e.currentTarget.getBoundingClientRect(),l=n!==t.key||"tab"===t.kind?e.clientX<i.left+i.width/2?"before":"after":"before",a=k(X,r,n,l)?b(X,r,n,l):null;a?(e.preventDefault(),e.dataTransfer.dropEffect="move",Y?.key===a.key&&Y.side===a.side||q({key:a.key,side:a.side})):Y&&q(null)},onDrop:e=>{const t=Q.current;if(!t||!Y)return;e.preventDefault();const n=k(X,t,Y.key,Y.side);Q.current=null,q(null),n&&O(n)},onDragEnd:()=>{Q.current=null,q(null)}}:{},ee=s(()=>new Set(U.filter(e=>void 0!==e.group&&R).map(t=>e[t.start].key)),[U,e,R]),te=e=>"pointer-events-none absolute inset-y-1 z-[3] w-0.5 rounded-full bg-blue-500 "+("before"===e?"-left-px":"-right-px"),ne=e=>Y?.key===e&&!("before"===Y.side&&ee.has(e))&&/* @__PURE__ */p("span",{"aria-hidden":"true",className:te(Y.side)}),re=e.length;c(()=>{if(!t)return;const e=document.getElementById(m(t,"tab"));e?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[m,t,re]);const ie=E?J.findIndex(e=>!e.pinned):-1,le=J.some(e=>e.key===t)?t:J[0]?.key,ae=e=>{const t=J[(e+J.length)%J.length];t&&document.getElementById(m(t.key,"tab"))?.focus()},oe=(e,t)=>{const n=J[e+t];if(!O||!n)return;const r=k(X,{kind:"tab",key:J[e].key},n.key,t<0?"before":"after");r&&(O(r),setTimeout(()=>document.getElementById(m(J[e].key,"tab"))?.focus(),0))},se=F?e.find(e=>e.key===F.key):void 0,de=se&&B?B(se.key):[],ce=se?e.indexOf(se):-1,ue=e=>e.some(e=>!e.pinned),me=e=>()=>{P(null),e()},fe=(e,n)=>{const r=e.key===t,i=!!e.dirty,a=e.icon,o=r?M??"z-[1] border-gray-200 bg-gray-50 text-gray-900":"border-transparent text-gray-600 hover:bg-gray-200/70 hover:text-gray-900",s=!!n&&!r&&n.key!==t,d={type:"button",role:"tab",id:m(e.key,"tab"),"aria-selected":r,"aria-controls":g?.(e.key)?m(e.key,"panel"):void 0,tabIndex:e.key===le?0:-1,title:e.title,onClick:()=>z(e.key)},c={onContextMenu:t=>((e,t)=>{e.preventDefault(),P({x:e.clientX,y:e.clientY,key:t.key})})(t,e),onAuxClick:t=>((e,t)=>{1!==e.button||t.pinned||(e.preventDefault(),I(t.key))})(t,e),onMouseDown:e=>{1===e.button&&e.preventDefault()}},y=a&&
|
|
4
4
|
/* @__PURE__ */f("span",{className:"relative flex size-4 shrink-0 items-center justify-center text-gray-500 [&>svg]:size-4","aria-hidden":"true",children:[a,i&&!r&&!e.pinned&&
|
|
5
|
-
/* @__PURE__ */p("span",{className:"absolute -right-1 -top-1 hidden size-2 rounded-full bg-gray-500 ring-2 ring-gray-100 @max-[6.5rem]:block @max-[6.5rem]:group-hover:hidden"})]}),h=r&&!!_&&!!a;return e.pinned?/* @__PURE__ */f("div",{role:"presentation",className:`group relative flex flex-none items-center justify-center rounded-t-md border border-b-0 transition-colors ${
|
|
5
|
+
/* @__PURE__ */p("span",{className:"absolute -right-1 -top-1 hidden size-2 rounded-full bg-gray-500 ring-2 ring-gray-100 @max-[6.5rem]:block @max-[6.5rem]:group-hover:hidden"})]}),h=r&&!!_&&!!a;return e.pinned?/* @__PURE__ */f("div",{role:"presentation",className:`group relative flex flex-none items-center justify-center rounded-t-md border border-b-0 transition-colors ${W} ${a?"w-10":""} ${o}`,...c,...Z({kind:"tab",key:e.key},e.key),children:[ne(e.key),
|
|
6
6
|
/* @__PURE__ */f("button",{...d,className:`flex h-full items-center justify-center rounded-t-md ${a?"w-full":"px-3"} ${w}`,children:[y,
|
|
7
7
|
/* @__PURE__ */p("span",{className:a?"sr-only":"whitespace-nowrap text-sm",children:e.title})]})]},e.key):/* @__PURE__ */f(u,{children:[s&&/* @__PURE__ */p("span",{"aria-hidden":"true",className:"mb-3 h-4 w-px shrink-0 self-end border-l border-gray-300"}),
|
|
8
|
-
/* @__PURE__ */f("div",{role:"presentation",className:`group relative flex items-center rounded-t-md border border-b-0 text-sm transition-colors ${
|
|
8
|
+
/* @__PURE__ */f("div",{role:"presentation",className:`group relative flex items-center rounded-t-md border border-b-0 text-sm transition-colors ${W} ${"active-full"===K&&r?"":"@container"} ${"active-full"===K?r?"flex-[1_0_auto] min-w-[20rem] max-w-[40rem]":v:r&&(e.copy||h)?"flex-[0_1_20rem]":x} ${r?"active-full"===K?"":"min-w-[4.25rem]":"min-w-[4rem]"} ${o}`,...c,...Z({kind:"tab",key:e.key},e.key),children:[ne(e.key),h&&
|
|
9
9
|
/* @__PURE__ */p("button",{type:"button",tabIndex:-1,"aria-haspopup":"menu","aria-label":S.tabMenu,title:S.tabMenu,onClick:t=>{const n=t.currentTarget.getBoundingClientRect();_?.(e.key,n.left,n.bottom+4)},className:`ml-2 flex size-6 shrink-0 items-center justify-center rounded hover:bg-gray-200 @max-[5rem]:ml-2 ${w}`,children:y}),
|
|
10
10
|
/* @__PURE__ */f("button",{...d,className:`flex h-full min-w-0 flex-1 items-center gap-2 rounded-t-md pr-1 text-left ${h?"pl-2":"pl-3"} ${w} ${r?h?"":"@max-[5rem]:pl-3":"@max-[6.5rem]:pr-3 @max-[4.5rem]:justify-center @max-[4.5rem]:px-0 @max-[4.5rem]:group-hover:pl-2 @max-[4.5rem]:group-hover:pr-3"}`,children:[!h&&y,
|
|
11
|
-
/* @__PURE__ */f("span",{className:`min-w-0 flex-1 overflow-hidden whitespace-nowrap [mask-image:linear-gradient(to_right,#000_calc(100%-1rem),transparent)] ${"active-full"===
|
|
11
|
+
/* @__PURE__ */f("span",{className:`min-w-0 flex-1 overflow-hidden whitespace-nowrap [mask-image:linear-gradient(to_right,#000_calc(100%-1rem),transparent)] ${"active-full"===K&&r?"pr-4":""} ${a?r?"@max-[5rem]:sr-only":"@max-[4.5rem]:sr-only":""}`,children:[e.title,e.favorite&&
|
|
12
12
|
/* @__PURE__ */p("span",{role:"img","aria-label":S.favorite,title:S.favorite,className:"ml-1 inline-flex align-[-0.125em] text-yellow-500",children:/* @__PURE__ */p(l,{name:"star","aria-hidden":"true",className:"size-3.5",fill:"currentColor",strokeWidth:1.5})})]})]}),r&&e.actions&&/* @__PURE__ */p($,{node:e.actions}),r&&e.copy&&/* @__PURE__ */p(C,{text:e.copy,label:S.copy(e.copy),copiedLabel:S.copied}),
|
|
13
13
|
/* @__PURE__ */f("span",{className:"mr-2 flex size-5 shrink-0 items-center justify-center "+(r?"":"@max-[6.5rem]:hidden @max-[6.5rem]:group-hover:flex"),children:[i&&/* @__PURE__ */p("span",{role:"img","aria-label":S.unsaved,className:"size-2 rounded-full bg-gray-500 group-hover:hidden"}),
|
|
14
|
-
/* @__PURE__ */p("button",{type:"button",tabIndex:-1,"aria-label":S.closeTab?.(e.title)??`${S.close} ${e.title}`,onClick:()=>I(e.key),className:"size-5 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 "+(i?"hidden group-hover:flex":r?"flex":"flex opacity-0 group-hover:opacity-100 focus-visible:opacity-100"),children:/* @__PURE__ */p(N,{})})]})]})]},e.key)},pe=[];let ye,he=0,ge=!
|
|
14
|
+
/* @__PURE__ */p("button",{type:"button",tabIndex:-1,"aria-label":S.closeTab?.(e.title)??`${S.close} ${e.title}`,onClick:()=>I(e.key),className:"size-5 items-center justify-center rounded text-gray-400 hover:bg-gray-200 hover:text-gray-700 "+(i?"hidden group-hover:flex":r?"flex":"flex opacity-0 group-hover:opacity-100 focus-visible:opacity-100"),children:/* @__PURE__ */p(N,{})})]})]})]},e.key)},pe=[];let ye,he=0,ge=!E;for(const t of U){const n=J.filter(n=>{const r=e.indexOf(n);return r>=t.start&&r<=t.end});if(ge||he!==ie||(ge=!0,pe.push(/* @__PURE__ */p(u,{children:E},"rosh-after-pinned")),ye=void 0),he+=n.length,void 0===t.group||!R){for(const e of n)pe.push(fe(e,ye)),ye=e;continue}ye=void 0;const r=t.group,i=R(r),a=t.end-t.start+1,o=!V.has(r),s=e[t.start].key;pe.push(
|
|
15
15
|
/* @__PURE__ */f("div",{role:"group","aria-label":i.label,"data-tab-group":r,className:"relative mx-1 flex shrink-0 items-end first:ml-0 min-w-0",children:[
|
|
16
|
-
/* @__PURE__ */f("button",{type:"button",tabIndex:-1,"aria-expanded":o,title:S.groupToggle(i.label,a),onClick:()=>
|
|
16
|
+
/* @__PURE__ */f("button",{type:"button",tabIndex:-1,"aria-expanded":o,title:S.groupToggle(i.label,a),onClick:()=>H(r),...Z({kind:"group",key:s},s),className:`relative mb-1 mr-1 flex h-6 shrink-0 items-center gap-1 rounded-full bg-blue-100 px-2 text-xs font-medium text-blue-700 hover:bg-blue-200 ${w}`,children:[
|
|
17
17
|
/* @__PURE__ */p(l,{name:o?"chevron-down":"chevron-right","aria-hidden":"true",className:"size-3",strokeWidth:2}),i.icon&&/* @__PURE__ */p("span",{className:"flex size-3.5 items-center justify-center [&>svg]:size-3.5","aria-hidden":"true",children:i.icon}),
|
|
18
18
|
/* @__PURE__ */p("span",{className:"max-w-[8rem] truncate",children:i.label}),
|
|
19
19
|
/* @__PURE__ */p("span",{className:"tabular-nums text-blue-600",children:a})]}),Y?.key===s&&"before"===Y.side&&/* @__PURE__ */p("span",{"aria-hidden":"true",className:te("before")}),n.map((e,t)=>fe(e,t>0?n[t-1]:void 0)),
|
|
20
|
-
/* @__PURE__ */p("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 z-[2] h-0.5 bg-blue-500"})]},`rosh-group-${s}`))}return ge||pe.push(/* @__PURE__ */p(u,{children:
|
|
20
|
+
/* @__PURE__ */p("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 z-[2] h-0.5 bg-blue-500"})]},`rosh-group-${s}`))}return ge||pe.push(/* @__PURE__ */p(u,{children:E},"rosh-after-pinned")),/* @__PURE__ */f("div",{className:T??"relative flex h-10 shrink-0 items-end gap-3 bg-gray-100 px-3",children:[
|
|
21
21
|
/* @__PURE__ */p("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 h-px bg-gray-200"}),
|
|
22
|
-
/* @__PURE__ */p("div",{role:"tablist","aria-label":
|
|
22
|
+
/* @__PURE__ */p("div",{role:"tablist","aria-label":D,onKeyDown:e=>{const t=J.findIndex(t=>document.getElementById(m(t.key,"tab"))===e.target);if(t<0)return;const n=e.shiftKey&&(e.ctrlKey||e.metaKey);if(n&&"ArrowRight"===e.key)oe(t,1);else if(n&&"ArrowLeft"===e.key)oe(t,-1);else if("ArrowRight"===e.key)ae(t+1);else if("ArrowLeft"===e.key)ae(t-1);else if("Home"===e.key)ae(0);else if("End"===e.key)ae(J.length-1);else{if("Delete"!==e.key||J[t].pinned)return;I(J[t].key)}e.preventDefault()},className:"flex min-w-0 flex-1 items-end overflow-x-auto overflow-y-hidden [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:pe}),A&&/* @__PURE__ */p("div",{className:"flex shrink-0 items-center gap-2 self-center",children:A}),F&&se&&/* @__PURE__ */f(n,{portal:!0,style:{left:F.x,top:F.y},onClose:()=>P(null),children:[de.length>0&&/* @__PURE__ */f(y,{children:[de.map((e,t)=>/* @__PURE__ */f(r,{onClick:me(e.onSelect),children:[e.icon,e.label]},t)),
|
|
23
23
|
/* @__PURE__ */p(i,{})]}),
|
|
24
24
|
/* @__PURE__ */p(r,{disabled:se.pinned,onClick:me(()=>I(se.key)),children:S.close}),
|
|
25
25
|
/* @__PURE__ */p(i,{}),
|
|
26
|
-
/* @__PURE__ */p(r,{disabled:!ue(e.filter(e=>e.key!==se.key)),onClick:me(()=>
|
|
27
|
-
/* @__PURE__ */p(r,{disabled:!ue(e.slice(ce+1)),onClick:me(()=>
|
|
28
|
-
/* @__PURE__ */p(r,{disabled:!ue(e),onClick:me(()=>
|
|
26
|
+
/* @__PURE__ */p(r,{disabled:!ue(e.filter(e=>e.key!==se.key)),onClick:me(()=>j("others",se.key)),children:S.closeOthers}),
|
|
27
|
+
/* @__PURE__ */p(r,{disabled:!ue(e.slice(ce+1)),onClick:me(()=>j("right",se.key)),children:S.closeRight}),
|
|
28
|
+
/* @__PURE__ */p(r,{disabled:!ue(e),onClick:me(()=>j("all",null)),children:S.closeAll})]})]})}export{z as TabStrip};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
return(new Date).toISOString()}var K=null,L=[],X=!1,q=null,J=/* @__PURE__ */new Set;function $(){for(const t of J)t()}function z(t){L=t,$()}function H(){const t=K;return t?q=t.list().then(e=>{K===t&&(L=e,X=!0,$())}).catch(()=>{K===t&&(X=!0,$())}).finally(()=>{q=null}):(L=[],X=!0,$(),Promise.resolve())}function Q(t){K=t,L=[],X=!1,t?H():$()}function U(t){return J.add(t),!K||X||q||H(),()=>{J.delete(t)}}function Y(){return L}function Z(){const
|
|
1
|
+
import{useShellPrefs as t}from"./chunk-KC3EX26K.js";import{toast_default as e}from"./chunk-4NXMMWL6.js";import{useSyncExternalStore as n,useCallback as o,useMemo as a}from"react";var r=[{id:"bell",label:"Bell",description:"Soft bell with one harmonic"},{id:"chime",label:"Chime",description:"Two-note ascending chime"},{id:"bowl",label:"Singing Bowl",description:"Long-decay meditation tone"},{id:"wind-chimes",label:"Wind Chimes",description:"Four soft tones in succession"},{id:"off",label:"Off (silent)",description:"No sound — only desktop notification"}],i=[{id:"none",label:"None"},{id:"tick-fast",label:"Ticking Fast"},{id:"tick-slow",label:"Ticking Slow"},{id:"rain",label:"Rain"},{id:"fireplace",label:"Fireplace"},{id:"white",label:"White Noise"},{id:"pink",label:"Pink Noise"},{id:"brown",label:"Brown Noise"}],c=()=>`pomodoro-${/* @__PURE__ */(new Date).toISOString().slice(0,10)}`,l={focus:1500,short:300,long:900},s="bell",u=100,d=1,f="none",m=50,h={autoStartBreaks:!1,autoStartPomodoros:!1,longBreakInterval:4},g={running:!1,remaining:l.focus,mode:"focus",total:l.focus,streak:0,count:"undefined"!=typeof localStorage?(()=>{try{return parseInt(localStorage.getItem(c())||"0",10)||0}catch{return 0}})():0},p=null,k=/* @__PURE__ */new Set,w=t=>{g={...g,...t},k.forEach(t=>t())};function M(){return g}function S(t){return k.add(t),()=>{k.delete(t)}}function b(t){l=t,g.running||g.remaining!==g.total||w({remaining:t[g.mode],total:t[g.mode]})}function y(t){s=t}function v(t,e){u=Math.max(0,Math.min(100,Math.round(t))),d=Math.max(1,Math.min(5,Math.round(e)))}function T(t){h={autoStartBreaks:!!t.autoStartBreaks,autoStartPomodoros:!!t.autoStartPomodoros,longBreakInterval:Math.max(1,Math.min(20,Math.round(t.longBreakInterval||4)))}}function A(t,e){f=t,m=Math.max(0,Math.min(100,Math.round(e))),g.running&&"focus"===g.mode?(F(),R()):"none"!==t&&0!==m||F()}function I(){g.running||(w({running:!0}),p=setInterval(C,1e3),"focus"===g.mode&&R())}function x(){(g.running||null!==p)&&(null!==p&&(clearInterval(p),p=null),w({running:!1}),F())}function B(t){x(),w({mode:t,remaining:l[t],total:l[t]})}function C(){g.remaining<=1?function(){null!==p&&(clearInterval(p),p=null);F(),N(s,{volume:u,repeat:d});const t="focus"===g.mode?"Pomodoro complete — time for a break! 🍅":"Break's over — back to work!";if("undefined"!=typeof Notification&&"granted"===Notification.permission)try{new Notification(t)}catch{}try{e.info(t)}catch{}if("focus"===g.mode){const t=g.streak+1,e=g.count+1;(t=>{try{localStorage.setItem(c(),String(t))}catch{}})(e);const n=t%h.longBreakInterval===0?"long":"short";w({running:!1,streak:t,count:e,mode:n,remaining:l[n],total:l[n]}),h.autoStartBreaks&&setTimeout(()=>I(),50)}else w({running:!1,mode:"focus",remaining:l.focus,total:l.focus}),h.autoStartPomodoros&&setTimeout(()=>I(),50)}():w({remaining:g.remaining-1})}function N(t=s,e={}){if("off"===t)return;const n=Math.max(0,Math.min(100,e.volume??100))/100;if(0===n)return;const o=Math.max(1,Math.min(5,e.repeat??1));for(let e=0;e<o;e++)setTimeout(()=>P(t,n),2500*e)}function P(t,e){try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=(t,n,a,r=.22,i="sine")=>{const c=o.createOscillator(),l=o.createGain();c.connect(l),l.connect(o.destination),c.type=i,c.frequency.value=t;const s=o.currentTime+n;l.gain.setValueAtTime(0,s),l.gain.linearRampToValueAtTime(r*e,s+.03),l.gain.exponentialRampToValueAtTime(1e-4,s+a),c.start(s),c.stop(s+a)};let r=2;"bell"===t?(a(880,0,1.8),a(1320,0,1.4,.1),r=2):"chime"===t?(a(659.25,0,.7),a(880,.2,1.3),r=2):"bowl"===t?(a(440,0,3.4,.22),a(660,0,3,.08),a(880,.05,2.8,.05),r=4):"wind-chimes"===t&&(a(1175,0,1.1,.16),a(880,.15,1.3,.16),a(1318,.3,1.5,.16),a(1047,.5,1.7,.13),r=3),setTimeout(()=>{try{o.close()}catch{}},1e3*r+500)}catch{}}var D=null,_={none:0,white:.3,pink:.3,brown:.3,"tick-fast":.6,"tick-slow":.6,rain:.4,fireplace:.5};function O(t,e){if("none"===e)return null;const n=t.sampleRate,o="white"===e||"pink"===e||"brown"===e?2:4,a=n*o,r=t.createBuffer(1,a,n),i=r.getChannelData(0);if("white"===e)for(let t=0;t<a;t++)i[t]=.5*(2*Math.random()-1);else if("pink"===e){let t=0,e=0,n=0,o=0,r=0,c=0,l=0;for(let s=0;s<a;s++){const a=2*Math.random()-1;t=.99886*t+.0555179*a,e=.99332*e+.0750759*a,n=.969*n+.153852*a,o=.8665*o+.3104856*a,r=.55*r+.5329522*a,c=-.7616*c-.016898*a,i[s]=.11*(t+e+n+o+r+c+l+.5362*a)*.55,l=.115926*a}}else if("brown"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=3.5*t*.5}}else if("tick-fast"===e||"tick-slow"===e){const t="tick-fast"===e?.5:1,r=Math.floor(.045*n);for(let e=0;e<o;e+=t){const t=Math.floor(e*n);for(let e=0;e<r&&t+e<a;e++){const o=Math.exp(-e/n*180),a=2*Math.random()-1,r=Math.sin(2*Math.PI*1100*(e/n));i[t+e]+=(.7*a+.25*r)*o*.55}}}else if("rain"===e){let t=0;for(let e=0;e<a;e++){const o=2*Math.random()-1,a=o-.93*t;t=o;const r=.7+.3*Math.sin(e/n*2*Math.PI*.25);i[e]=a*r*.4}}else if("fireplace"===e){let t=0;for(let e=0;e<a;e++){t=(t+.02*(2*Math.random()-1))/1.02,i[e]=1.6*t}let e=.4*Math.random()*n;for(;e<a;){const t=Math.floor((.012+.05*Math.random())*n),o=.35+.45*Math.random(),r=Math.floor(e);for(let e=0;e<t&&r+e<a;e++){const t=Math.exp(-e/n*90);i[r+e]+=(2*Math.random()-1)*t*o}e+=(.08+.62*Math.random())*n}}return r}function R(){if(!D&&"none"!==f&&0!==m)try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return;const e=new t,n=O(e,f);if(!n){try{e.close()}catch{}return}const o=e.createBufferSource();o.buffer=n,o.loop=!0;const a=e.createGain();a.gain.value=m/100*_[f],o.connect(a).connect(e.destination),o.start(),D={ctx:e,src:o,gain:a}}catch{}}function F(){if(D){try{D.src.stop()}catch{}try{D.ctx.close()}catch{}D=null}}function G(t,e){if("none"!==t&&0!==e)try{const n=window.AudioContext||window.webkitAudioContext;if(!n)return;const o=new n,a=O(o,t);if(!a){try{o.close()}catch{}return}const r=o.createBufferSource();r.buffer=a,r.loop=!0;const i=o.createGain();i.gain.value=e/100*_[t],r.connect(i).connect(o.destination),r.start(),setTimeout(()=>{try{r.stop()}catch{}try{o.close()}catch{}},3e3)}catch{}}var V="pomodoro_tasks",W="pomodoro_tasks_migrated";function j(){return Math.random().toString(36).slice(2,11)}function E(){/* @__PURE__ */
|
|
2
|
+
return(new Date).toISOString()}var K=null,L=[],X=!1,q=null,J=/* @__PURE__ */new Set;function $(){for(const t of J)t()}function z(t){L=t,$()}function H(){const t=K;return t?q=t.list().then(e=>{K===t&&(L=e,X=!0,$())}).catch(()=>{K===t&&(X=!0,$())}).finally(()=>{q=null}):(L=[],X=!0,$(),Promise.resolve())}function Q(t){K=t,L=[],X=!1,t?H():$()}function U(t){return J.add(t),!K||X||q||H(),()=>{J.delete(t)}}function Y(){return L}function Z(){const e=function(){const{prefs:e,save:n}=t(),r=a(()=>{const t=e.todo_tasks;return Array.isArray(t)?t:[]},[e.todo_tasks]),i=o(t=>{n({todo_tasks:t})},[n]),c=o(t=>{const e=j(),n=E(),o={done:!1,...t,name:t.name.trim(),id:e,createdAt:n,updatedAt:n};return i([...r,o]),e},[r,i]),l=o((t,e)=>{i(r.map(n=>n.id===t?{...n,...e,id:n.id,updatedAt:E()}:n))},[r,i]),s=o(t=>{i(r.filter(e=>e.id!==t))},[r,i]),u=o(t=>{const e=r.find(e=>e.id===t);e&&l(t,{done:!e.done})},[r,l]);return{tasks:r,addTask:c,updateTask:l,removeTask:s,toggleDone:u,setAllTasks:i}}(),r=n(U,Y,Y),i=o(t=>{const n=K;if(!n)return e.addTask(t);const o="tmp-"+j(),a=E(),r={done:!1,...t,name:t.name.trim(),id:o,createdAt:a,updatedAt:a};return z([...L,r]),n.create({...t,name:t.name.trim()}).then(t=>z(L.map(e=>e.id===o?{...r,...t}:e))).catch(()=>z(L.filter(t=>t.id!==o))),o},[e]),c=o((t,n)=>{const o=K;if(!o)return e.updateTask(t,n);z(L.map(e=>e.id===t?{...e,...n,id:t,updatedAt:E()}:e)),o.update(t,n).catch(()=>{H()})},[e]),l=o(t=>{const n=K;if(!n)return e.removeTask(t);const o=L;z(L.filter(e=>e.id!==t)),n.remove(t).catch(()=>z(o))},[e]),s=o(t=>{if(!K)return e.toggleDone(t);const n=L.find(e=>e.id===t);n&&c(t,{done:!n.done})},[e,c]),u=o(t=>{K||e.setAllTasks(t)},[e]);return null===K?e:{tasks:r,addTask:i,updateTask:c,removeTask:l,toggleDone:s,setAllTasks:u}}function tt(t,e){try{if(localStorage.getItem(W))return;const n=localStorage.getItem(V);if(!n)return void localStorage.setItem(W,"1");const o=JSON.parse(n);if(!Array.isArray(o)||0===o.length)return localStorage.removeItem(V),void localStorage.setItem(W,"1");const a=E(),r=o.filter(t=>"string"==typeof t?.name).map(t=>({id:t.id||j(),name:String(t.name),done:!!t.done,estimated:"number"==typeof t.estimated?t.estimated:void 0,completed:"number"==typeof t.completed?t.completed:void 0,createdAt:a,updatedAt:a})),i=new Set(t.map(t=>t.id));e([...r.filter(t=>!i.has(t.id)),...t]),localStorage.removeItem(V),localStorage.setItem(W,"1")}catch{try{localStorage.setItem(W,"1")}catch{}}}export{r as ALARM_OPTIONS,i as FOCUS_SOUND_OPTIONS,M as getPomoSnapshot,tt as migratePomodoroTasksOnce,N as playAlarm,x as pomoPause,I as pomoStart,B as pomoSwitchMode,G as previewFocusSound,y as setPomoAlarm,v as setPomoAlarmConfig,T as setPomoBehaviour,b as setPomoDurations,A as setPomoFocusSound,Q as setShellTodoProvider,S as subscribePomo,Z as useTodoTasks};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{ListLoadError as default}from"../chunk-H3BC4KDE.js";import"../chunk-4IU5BSVE.js";import"../chunk-K7U4RWXJ.js";import"../chunk-
|
|
1
|
+
export{ListLoadError as default}from"../chunk-H3BC4KDE.js";import"../chunk-4IU5BSVE.js";import"../chunk-K7U4RWXJ.js";import"../chunk-VH6GB73Q.js";import"../chunk-KIBL6M3T.js";import"../chunk-J75ZT2JQ.js";import"../chunk-Q5MD3VY6.js";import"../chunk-MRJKZWWV.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-DTJRIWFR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
|
package/dist/format/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{slugify}from"../chunk-24AL3CDS.js";export{escapeHtml}from"../chunk-G6DKCCWH.js";export{addShowWhenFacts,isShown,lazyShowWhenContext,showWhenFactReaders,showWhenFactsContext,showWhenOf,shownForOption,truthy,withRowRules,withRowsShownWhen,withShowWhen,withShowWhenFacts}from"../chunk-HCP7WOAL.js";export{
|
|
1
|
+
export{slugify}from"../chunk-24AL3CDS.js";export{escapeHtml}from"../chunk-G6DKCCWH.js";export{addShowWhenFacts,isShown,lazyShowWhenContext,showWhenFactReaders,showWhenFactsContext,showWhenOf,shownForOption,truthy,withRowRules,withRowsShownWhen,withShowWhen,withShowWhenFacts}from"../chunk-HCP7WOAL.js";export{contrastRatio,hexToRgb,readableInk,relativeLuminance}from"../chunk-S6OB6HJB.js";export{FOCAL_DEFAULT,FOCAL_NUDGE_COARSE,FOCAL_NUDGE_STEP,focalFromRect,formatFocal,nudgeFocal,parseFocal}from"../chunk-25RR3GQW.js";export{currencyDecimals,currencySymbol,formatBytes,formatMoney,setCurrencyFormats,timeAgo}from"../chunk-X2S2XDZI.js";export{DATE_FORMAT_OPTIONS,TZ_AUTO,formatDate,formatDateTime,formatTime,getUserDateFormat,getUserTimezone,setUserDateFormat,setUserTimezone,syncTimezoneFromProfile}from"../chunk-5OTS2G3M.js";export{EMPTY_VALUE}from"../chunk-36BRD5J3.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export{BORDER_LINE_STYLES,borderSides,borderStartEach,BorderInput as default}from"../chunk-
|
|
2
|
+
export{BORDER_LINE_STYLES,borderSides,borderStartEach,BorderInput as default}from"../chunk-F64DN4BV.js";import"../chunk-QPX35URZ.js";import"../chunk-RNBM5JZI.js";import"../chunk-MTXTJLFK.js";import"../chunk-E4Z5OXBI.js";import"../chunk-S6OB6HJB.js";import"../chunk-N6DTTOB6.js";import"../chunk-4G5VLI7E.js";import"../chunk-4CANQ3B3.js";import"../chunk-JFSYWEHD.js";import"../chunk-CDAJKLGL.js";import"../chunk-K7U4RWXJ.js";import"../chunk-VH6GB73Q.js";import"../chunk-KIBL6M3T.js";import"../chunk-J75ZT2JQ.js";import"../chunk-22S6LG6D.js";import"../chunk-PGN5ME7B.js";import"../chunk-62LW225J.js";import"../chunk-GLUJS42B.js";import"../chunk-D65T4H6J.js";import"../chunk-DTJRIWFR.js";import"../chunk-TWVUQUUD.js";import"../chunk-E6UCGCOC.js";import"../chunk-C3QOHMR6.js";
|