@ngrok/mantle 0.93.0 → 0.93.2

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/dist/agent.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngrok/mantle",
3
- "version": "0.93.0",
3
+ "version": "0.93.2",
4
4
  "origin": "https://mantle.ngrok.com",
5
5
  "endpoints": {
6
6
  "docs": "https://mantle.ngrok.com/",
@@ -1 +1 @@
1
- import{s as e}from"./theme-CwtpudOH.js";import{c as t}from"react/compiler-runtime";import{jsx as n}from"react/jsx-runtime";import{DesktopIcon as r}from"@phosphor-icons/react/Desktop";import{MoonIcon as i}from"@phosphor-icons/react/Moon";import{SunIcon as a}from"@phosphor-icons/react/Sun";function o(r){let i=t(3),a=e(),o;return i[0]!==a||i[1]!==r?(o=/* @__PURE__ */ n(s,{theme:a,...r}),i[0]=a,i[1]=r,i[2]=o):o=i[2],o}function s(e){let o=t(9),s,c;switch(o[0]===e?(s=o[1],c=o[2]):({theme:c,...s}=e,o[0]=e,o[1]=s,o[2]=c),c){case`system`:{let e;return o[3]===s?e=o[4]:(e=/* @__PURE__ */ n(r,{...s}),o[3]=s,o[4]=e),e}case`light`:{let e;return o[5]===s?e=o[6]:(e=/* @__PURE__ */ n(a,{...s}),o[5]=s,o[6]=e),e}case`dark`:{let e;return o[7]===s?e=o[8]:(e=/* @__PURE__ */ n(i,{...s}),o[7]=s,o[8]=e),e}}}export{s as n,o as t};
1
+ import{s as e}from"./theme-C-glc5Q-.js";import{c as t}from"react/compiler-runtime";import{jsx as n}from"react/jsx-runtime";import{DesktopIcon as r}from"@phosphor-icons/react/Desktop";import{MoonIcon as i}from"@phosphor-icons/react/Moon";import{SunIcon as a}from"@phosphor-icons/react/Sun";function o(r){let i=t(3),a=e(),o;return i[0]!==a||i[1]!==r?(o=/* @__PURE__ */ n(s,{theme:a,...r}),i[0]=a,i[1]=r,i[2]=o):o=i[2],o}function s(e){let o=t(9),s,c;switch(o[0]===e?(s=o[1],c=o[2]):({theme:c,...s}=e,o[0]=e,o[1]=s,o[2]=c),c){case`system`:{let e;return o[3]===s?e=o[4]:(e=/* @__PURE__ */ n(r,{...s}),o[3]=s,o[4]=e),e}case`light`:{let e;return o[5]===s?e=o[6]:(e=/* @__PURE__ */ n(a,{...s}),o[5]=s,o[6]=e),e}case`dark`:{let e;return o[7]===s?e=o[8]:(e=/* @__PURE__ */ n(i,{...s}),o[7]=s,o[8]=e),e}}}export{s as n,o as t};
package/dist/icons.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./icons-CSwTVV2m.js";import{t}from"./icons-CDLz5lpI.js";import{n,t as r}from"./icons-DGL0d2Il.js";import{c as i}from"react/compiler-runtime";import{jsx as a}from"react/jsx-runtime";function o(e){let t=i(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=/* @__PURE__ */ a(`path`,{d:`M32.272 12.011c-1.298-1.466-2.904-2.205-4.812-2.205-1.176 0-2.26.233-3.255.7a7.995 7.995 0 0 0-2.581 1.906 9.205 9.205 0 0 0-1.715 2.853 9.773 9.773 0 0 0-.628 3.546c0 1.25.194 2.39.58 3.419.362.98.918 1.877 1.635 2.636A7.543 7.543 0 0 0 24 26.584c.965.41 2.025.617 3.176.617.522 0 1.005-.041 1.445-.116.439-.075.858-.2 1.26-.37.4-.175.79-.398 1.18-.664.385-.27.792-.612 1.21-1.018v4.353h-.005v.421h-5.33l-4.005 4.64v.798h15.037v-24.98h-5.697v1.746Zm-.014 7.979a4.25 4.25 0 0 1-.786 1.215 3.555 3.555 0 0 1-2.592 1.1 3.627 3.627 0 0 1-1.464-.292 3.508 3.508 0 0 1-1.166-.808 3.93 3.93 0 0 1-1.054-2.72c0-.519.097-1.006.298-1.457a3.77 3.77 0 0 1 .804-1.181 4.114 4.114 0 0 1 1.162-.808 3.484 3.484 0 0 1 2.817-.016c.448.19.844.463 1.181.81.336.347.6.743.804 1.194.202.452.298.95.298 1.493 0 .505-.104 1.005-.302 1.47m-16.261-7.708a6.173 6.173 0 0 0-2.06-1.602 4.875 4.875 0 0 0-.57-.22 6.383 6.383 0 0 0-.923-.216H8.383L5.697 13.39v-3.082H.002v16.61h5.695V15.712h5.35l.444-.01v11.214h5.697V16.528c0-.885-.084-1.674-.25-2.366a4.655 4.655 0 0 0-.941-1.877zm38.367-2.018h-6.213l-2.47 2.863v-2.864h-5.7v16.61h5.71l.004-11.117h4.144l4.526-5.26zm31.051 7.672 7.79-7.392v-.281H85.7l-5.975 5.991V0h-5.696v26.87h5.696v-6.766l6.262 6.763h7.663v-.316l-8.233-8.617zm-16.11-5.78a9.436 9.436 0 0 0-3.085-1.842 10.953 10.953 0 0 0-3.855-.664c-1.407 0-2.705.226-3.884.678a9.611 9.611 0 0 0-3.072 1.858 8.488 8.488 0 0 0-2.016 2.788 8.281 8.281 0 0 0-.722 3.449c0 1.362.24 2.596.722 3.707a8.52 8.52 0 0 0 2.002 2.862c.85.798 1.86 1.415 3.036 1.847 1.177.432 2.455.647 3.842.647 1.406 0 2.707-.215 3.919-.647 1.204-.431 2.24-1.04 3.098-1.833a8.583 8.583 0 0 0 2.031-2.816c.493-1.09.742-2.29.742-3.611 0-1.316-.244-2.52-.722-3.612a8.424 8.424 0 0 0-2.035-2.81Zm-3.558 7.864c-.2.461-.463.869-.786 1.215a3.573 3.573 0 0 1-2.592 1.1c-.502 0-.981-.096-1.434-.291a3.44 3.44 0 0 1-1.16-.809 4.155 4.155 0 0 1-.788-1.215 3.825 3.825 0 0 1-.297-1.537c0-.517.098-1.004.297-1.456.201-.451.46-.849.787-1.194a3.579 3.579 0 0 1 2.597-1.1c.502 0 .98.096 1.43.29.448.19.839.461 1.16.81.328.345.586.752.786 1.214.2.461.297.954.297 1.471 0 .538-.096 1.04-.297 1.502`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=/* @__PURE__ */ a(`svg`,{fill:`currentColor`,height:`1em`,viewBox:`0 0 94 36`,width:`2.61em`,...e,children:n}),t[1]=e,t[2]=r),r}function s(e){let t=i(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=/* @__PURE__ */ a(`path`,{d:`M27.2 6.18a9.47 9.47 0 0 0-3.12-2.5A9.42 9.42 0 0 0 21.82 3h-6.14l-4.06 4.9V3.1H3V29h8.62V11.53h8.09l.67-.02v17.48H29V12.8c0-1.37-.13-2.6-.38-3.68a7.35 7.35 0 0 0-1.42-2.93Z`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=/* @__PURE__ */ a(`svg`,{fill:`currentColor`,height:`1em`,viewBox:`0 0 32 32`,width:`1em`,...e,children:n}),t[1]=e,t[2]=r),r}export{r as AutoThemeIcon,s as NgrokLettermarkIcon,o as NgrokWordmarkIcon,t as SortIcon,n as ThemeIcon,e as TrafficPolicyFileIcon};
1
+ import{t as e}from"./icons-CSwTVV2m.js";import{t}from"./icons-CDLz5lpI.js";import{n,t as r}from"./icons-DP3lQw5O.js";import{c as i}from"react/compiler-runtime";import{jsx as a}from"react/jsx-runtime";function o(e){let t=i(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=/* @__PURE__ */ a(`path`,{d:`M32.272 12.011c-1.298-1.466-2.904-2.205-4.812-2.205-1.176 0-2.26.233-3.255.7a7.995 7.995 0 0 0-2.581 1.906 9.205 9.205 0 0 0-1.715 2.853 9.773 9.773 0 0 0-.628 3.546c0 1.25.194 2.39.58 3.419.362.98.918 1.877 1.635 2.636A7.543 7.543 0 0 0 24 26.584c.965.41 2.025.617 3.176.617.522 0 1.005-.041 1.445-.116.439-.075.858-.2 1.26-.37.4-.175.79-.398 1.18-.664.385-.27.792-.612 1.21-1.018v4.353h-.005v.421h-5.33l-4.005 4.64v.798h15.037v-24.98h-5.697v1.746Zm-.014 7.979a4.25 4.25 0 0 1-.786 1.215 3.555 3.555 0 0 1-2.592 1.1 3.627 3.627 0 0 1-1.464-.292 3.508 3.508 0 0 1-1.166-.808 3.93 3.93 0 0 1-1.054-2.72c0-.519.097-1.006.298-1.457a3.77 3.77 0 0 1 .804-1.181 4.114 4.114 0 0 1 1.162-.808 3.484 3.484 0 0 1 2.817-.016c.448.19.844.463 1.181.81.336.347.6.743.804 1.194.202.452.298.95.298 1.493 0 .505-.104 1.005-.302 1.47m-16.261-7.708a6.173 6.173 0 0 0-2.06-1.602 4.875 4.875 0 0 0-.57-.22 6.383 6.383 0 0 0-.923-.216H8.383L5.697 13.39v-3.082H.002v16.61h5.695V15.712h5.35l.444-.01v11.214h5.697V16.528c0-.885-.084-1.674-.25-2.366a4.655 4.655 0 0 0-.941-1.877zm38.367-2.018h-6.213l-2.47 2.863v-2.864h-5.7v16.61h5.71l.004-11.117h4.144l4.526-5.26zm31.051 7.672 7.79-7.392v-.281H85.7l-5.975 5.991V0h-5.696v26.87h5.696v-6.766l6.262 6.763h7.663v-.316l-8.233-8.617zm-16.11-5.78a9.436 9.436 0 0 0-3.085-1.842 10.953 10.953 0 0 0-3.855-.664c-1.407 0-2.705.226-3.884.678a9.611 9.611 0 0 0-3.072 1.858 8.488 8.488 0 0 0-2.016 2.788 8.281 8.281 0 0 0-.722 3.449c0 1.362.24 2.596.722 3.707a8.52 8.52 0 0 0 2.002 2.862c.85.798 1.86 1.415 3.036 1.847 1.177.432 2.455.647 3.842.647 1.406 0 2.707-.215 3.919-.647 1.204-.431 2.24-1.04 3.098-1.833a8.583 8.583 0 0 0 2.031-2.816c.493-1.09.742-2.29.742-3.611 0-1.316-.244-2.52-.722-3.612a8.424 8.424 0 0 0-2.035-2.81Zm-3.558 7.864c-.2.461-.463.869-.786 1.215a3.573 3.573 0 0 1-2.592 1.1c-.502 0-.981-.096-1.434-.291a3.44 3.44 0 0 1-1.16-.809 4.155 4.155 0 0 1-.788-1.215 3.825 3.825 0 0 1-.297-1.537c0-.517.098-1.004.297-1.456.201-.451.46-.849.787-1.194a3.579 3.579 0 0 1 2.597-1.1c.502 0 .98.096 1.43.29.448.19.839.461 1.16.81.328.345.586.752.786 1.214.2.461.297.954.297 1.471 0 .538-.096 1.04-.297 1.502`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=/* @__PURE__ */ a(`svg`,{fill:`currentColor`,height:`1em`,viewBox:`0 0 94 36`,width:`2.61em`,...e,children:n}),t[1]=e,t[2]=r),r}function s(e){let t=i(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=/* @__PURE__ */ a(`path`,{d:`M27.2 6.18a9.47 9.47 0 0 0-3.12-2.5A9.42 9.42 0 0 0 21.82 3h-6.14l-4.06 4.9V3.1H3V29h8.62V11.53h8.09l.67-.02v17.48H29V12.8c0-1.37-.13-2.6-.38-3.68a7.35 7.35 0 0 0-1.42-2.93Z`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=/* @__PURE__ */ a(`svg`,{fill:`currentColor`,height:`1em`,viewBox:`0 0 32 32`,width:`1em`,...e,children:n}),t[1]=e,t[2]=r),r}export{r as AutoThemeIcon,s as NgrokLettermarkIcon,o as NgrokWordmarkIcon,t as SortIcon,n as ThemeIcon,e as TrafficPolicyFileIcon};
package/dist/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- # @ngrok/mantle (0.93.0)
1
+ # @ngrok/mantle (0.93.2)
2
2
 
3
3
  > Offline index shipped inside the @ngrok/mantle npm package. The full records, with examples and sibling boundaries, are in agent.json beside this file. Neither file lists props: read the bundled type declarations (`<subpath>.d.ts` beside this file) for every prop and its JSDoc. Live docs: https://mantle.ngrok.com/for-ai-agents.
4
4
 
package/dist/mantle.css CHANGED
@@ -1878,14 +1878,14 @@ pre[data-slot="code-block-code"]:has(.mantle-code-fold-toggle)
1878
1878
  /*
1879
1879
  * The new snapshot is live, so a color transition would fade inside the circle
1880
1880
  * while the rest of the page shows the new theme. Stop transitions during the
1881
- * swap. The icon of the switcher and of the menu item keeps its own swap.
1881
+ * swap. The icon of the switcher and each `ThemeSwitcherIcon` keep their own swap.
1882
1882
  */
1883
1883
  :root[data-theme-transition]
1884
- :not([data-slot~="theme-switcher"] *, [data-slot~="theme-dropdown-menu-item"] *),
1884
+ :not([data-slot~="theme-switcher"] *, [data-slot~="theme-switcher-icon"] *),
1885
1885
  :root[data-theme-transition]
1886
- :not([data-slot~="theme-switcher"] *, [data-slot~="theme-dropdown-menu-item"] *)::before,
1886
+ :not([data-slot~="theme-switcher"] *, [data-slot~="theme-switcher-icon"] *)::before,
1887
1887
  :root[data-theme-transition]
1888
- :not([data-slot~="theme-switcher"] *, [data-slot~="theme-dropdown-menu-item"] *)::after {
1888
+ :not([data-slot~="theme-switcher"] *, [data-slot~="theme-switcher-icon"] *)::after {
1889
1889
  transition: none !important;
1890
1890
  }
1891
1891
 
package/dist/tabs.d.ts CHANGED
@@ -145,6 +145,11 @@ type TabsTriggerProps = ComponentProps<typeof Trigger> & WithDataSlot;
145
145
  * variant instead: `[&>[data-slot=tabs-trigger-label]>svg]:size-4`. A `[&_svg]`
146
146
  * or a class on the icon loses to the default, which is more specific.
147
147
  *
148
+ * **Pointer press.** A mouse press focuses the trigger without the focus ring;
149
+ * keyboard focus still shows it. The label text is not selectable. An `asChild`
150
+ * link activates on click, not on the press, so a press released off the link
151
+ * switches no tab. The link does not drag.
152
+ *
148
153
  * **Data attributes:**
149
154
  *
150
155
  * | Data Attribute | Value | Description |
@@ -171,7 +176,7 @@ type TabsTriggerProps = ComponentProps<typeof Trigger> & WithDataSlot;
171
176
  * </Tabs.Root>
172
177
  * ```
173
178
  */
174
- declare const Trigger$1: ({ "aria-disabled": _ariaDisabled, asChild, children, className, "data-slot": dataSlot, disabled: _disabled, ref, ...props }: TabsTriggerProps) => import("react").JSX.Element;
179
+ declare const Trigger$1: ({ "aria-disabled": _ariaDisabled, asChild, children, className, "data-slot": dataSlot, disabled: _disabled, onClick, onMouseDown, ref, ...props }: TabsTriggerProps) => import("react").JSX.Element;
175
180
  /**
176
181
  * A badge to render inside a tab trigger, typically a count or a status indicator.
177
182
  *
package/dist/tabs.js CHANGED
@@ -1 +1 @@
1
- import{n as e}from"./compose-refs-sFdxsL7k.js";import{t}from"./cx-CK7o_rVv.js";import{t as n}from"./data-slot-EM6s2WEU.js";import{t as r}from"./booleanish-BfvnW6vy.js";import{t as i}from"./clsx-DUGZgXfJ.js";import{n as a}from"./separator-DfzxVutO.js";import{t as o}from"./use-prefers-reduced-motion-CU6mWmOe.js";import{c as s}from"react/compiler-runtime";import{Children as c,cloneElement as l,createContext as u,isValidElement as d,useContext as f,useEffect as p,useRef as m}from"react";import h from"tiny-invariant";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{cva as y}from"class-variance-authority";import{Content as b,List as x,Root as S,Trigger as C}from"@radix-ui/react-tabs";const w=u(null);function T(e){let t=f(w);return h(t!=null,`${e} must be rendered inside Tabs.Root.`),t}const E=e=>{let r=s(29),i,a,o,c,l,u,d;r[0]===e?(i=r[1],a=r[2],o=r[3],c=r[4],l=r[5],u=r[6],d=r[7]):({className:a,children:i,"data-slot":o,onValueChange:c,orientation:u,appearance:d,...l}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=c,r[5]=l,r[6]=u,r[7]=d);let f=u===void 0?`horizontal`:u,p=d===void 0?`classic`:d,h;r[8]!==p||r[9]!==f?(h={orientation:f,appearance:p},r[8]=p,r[9]=f,r[10]=h):h=r[10];let g=h,v=m(null),y;r[11]===c?y=r[12]:(y=e=>{e!==v.current&&(v.current=e,queueMicrotask(()=>{v.current=null}),c?.(e))},r[11]=c,r[12]=y);let b=y,x;r[13]===o?x=r[14]:(x=n(o,`tabs`),r[13]=o,r[14]=x);let C=f===`horizontal`?`flex-col`:`flex-row`,T;r[15]!==a||r[16]!==C?(T=t(`flex [--tabs-gap:--spacing(4)] gap-(--tabs-gap)`,C,a),r[15]=a,r[16]=C,r[17]=T):T=r[17];let E;r[18]!==p||r[19]!==i||r[20]!==b||r[21]!==f||r[22]!==l||r[23]!==x||r[24]!==T?(E=/* @__PURE__ */ _(S,{"data-slot":x,"data-appearance":p,className:T,orientation:f,onValueChange:b,...l,children:i}),r[18]=p,r[19]=i,r[20]=b,r[21]=f,r[22]=l,r[23]=x,r[24]=T,r[25]=E):E=r[25];let D;return r[26]!==g||r[27]!==E?(D=/* @__PURE__ */ _(w.Provider,{value:g,children:E}),r[26]=g,r[27]=E,r[28]=D):D=r[28],D},D=y(`flex`,{variants:{orientation:{horizontal:`scroll-fade-x flex-row items-center overflow-x-auto overscroll-x-none self-stretch min-w-0 pt-1 -mt-1 px-1 -mx-1`,vertical:`flex-col items-end gap-3.5 self-stretch`},appearance:{classic:``,pill:``}},compoundVariants:[{orientation:`horizontal`,appearance:`pill`,className:`gap-1 pb-1 -mb-1`},{orientation:`horizontal`,appearance:`classic`,className:`gap-6`}]}),O=r=>{let i=s(20),a,c,l,u;i[0]===r?(a=i[1],c=i[2],l=i[3],u=i[4]):({className:a,"data-slot":c,ref:u,...l}=r,i[0]=r,i[1]=a,i[2]=c,i[3]=l,i[4]=u);let{orientation:d,appearance:f}=T(`Tabs.List`),h=m(null),g=e(h,u),v,y;i[5]===d?(v=i[6],y=i[7]):(v=()=>{let e=h.current;if(!e||d!==`horizontal`)return;let t=new AbortController,{signal:n}=t,r=!1;e.addEventListener(`pointerdown`,()=>{r=!0},{signal:n});let i=()=>{r=!1};return e.addEventListener(`pointerup`,i,{signal:n}),e.addEventListener(`pointercancel`,i,{signal:n}),e.addEventListener(`keydown`,i,{signal:n}),e.addEventListener(`focusin`,t=>{if(!r&&t.target instanceof Element&&t.target!==e){let e=o()?`auto`:`smooth`;t.target.scrollIntoView({behavior:e,inline:`center`,block:`nearest`})}},{signal:n}),()=>{t.abort()}},y=[d],i[5]=d,i[6]=v,i[7]=y),p(v,y);let b;i[8]===c?b=i[9]:(b=n(c,`tabs-list`),i[8]=c,i[9]=b);let S;i[10]!==f||i[11]!==a||i[12]!==d?(S=t(D({orientation:d,appearance:f}),a),i[10]=f,i[11]=a,i[12]=d,i[13]=S):S=i[13];let C;return i[14]!==g||i[15]!==d||i[16]!==l||i[17]!==b||i[18]!==S?(C=/* @__PURE__ */ _(x,{"aria-orientation":d,"data-slot":b,className:S,ref:g,...l}),i[14]=g,i[15]=d,i[16]=l,i[17]=b,i[18]=S,i[19]=C):C=i[19],C},k=e=>{let r=s(14),i,o,c;r[0]===e?(i=r[1],o=r[2],c=r[3]):({className:i,"data-slot":o,...c}=e,r[0]=e,r[1]=i,r[2]=o,r[3]=c);let{orientation:l}=T(`Tabs.Separator`),u=l===`horizontal`?`[[data-slot~=tabs]>&]:-mt-(--tabs-gap)`:`h-auto self-stretch [[data-slot~=tabs]>&]:-ml-(--tabs-gap)`,d;r[4]===o?d=r[5]:(d=n(o,`tabs-separator`),r[4]=o,r[5]=d);let f;r[6]!==i||r[7]!==u?(f=t(u,i),r[6]=i,r[7]=u,r[8]=f):f=r[8];let p;return r[9]!==l||r[10]!==c||r[11]!==d||r[12]!==f?(p=/* @__PURE__ */ _(a,{"data-slot":d,orientation:l,className:f,...c}),r[9]=l,r[10]=c,r[11]=d,r[12]=f,r[13]=p):p=r[13],p},A=y(`absolute z-0`,{variants:{orientation:{horizontal:`bottom-0 left-0 right-0 h-0.75`,vertical:`-right-px bottom-0 top-0 w-0.75`},appearance:{classic:`group-data-state-active/tab-trigger:bg-neutral-950`,pill:`hidden`}}}),j=()=>{let e=s(5),{orientation:t,appearance:n}=T(`Tabs.Trigger`),r;e[0]!==n||e[1]!==t?(r=i(A({orientation:t,appearance:n})),e[0]=n,e[1]=t,e[2]=r):r=e[2];let a;return e[3]===r?a=e[4]:(a=/* @__PURE__ */ _(`span`,{"aria-hidden":!0,className:r}),e[3]=r,e[4]=a),a},M=y(t(`group/tab-trigger relative flex cursor-pointer items-center gap-1 whitespace-nowrap py-3 text-sm font-medium text-gray-600`,`ring-focus-accent outline-hidden`,`aria-disabled:cursor-default aria-disabled:opacity-50`,`focus-visible:ring-4`,`[&>[data-slot=tabs-trigger-label]>svg]:shrink-0 [&>[data-slot=tabs-trigger-label]>svg]:size-5`,`not-aria-disabled:hover:text-gray-900`),{variants:{orientation:{horizontal:`rounded-tl-md rounded-tr-md`,vertical:`rounded-bl-md rounded-tl-md pr-3`},appearance:{classic:t(`not-aria-disabled:hover:data-state-active:text-strong`,`data-state-active:text-strong`),pill:t(`not-aria-disabled:hover:data-state-active:text-strong`,`not-aria-disabled:hover:data-state-active:bg-neutral-500/15`,`data-state-active:text-strong`,`data-state-active:bg-neutral-500/15`,`rounded-full py-2 px-3`)}}}),N={Root:E,Content:e=>{let r=s(12),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:i,"data-slot":a,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let c;r[4]===a?c=r[5]:(c=n(a,`tabs-content`),r[4]=a,r[5]=c);let l;r[6]===i?l=r[7]:(l=t(`focus-visible:ring-focus-accent outline-hidden focus-visible:ring-4`,i),r[6]=i,r[7]=l);let u;return r[8]!==o||r[9]!==c||r[10]!==l?(u=/* @__PURE__ */ _(b,{"data-slot":c,className:l,...o}),r[8]=o,r[9]=c,r[10]=l,r[11]=u):u=r[11],u},List:O,Separator:k,Trigger:e=>{let i=s(44),a,o,u,f,p,m,y,b;i[0]===e?(a=i[1],o=i[2],u=i[3],f=i[4],p=i[5],m=i[6],y=i[7],b=i[8]):({"aria-disabled":a,asChild:b,children:u,className:f,"data-slot":p,disabled:o,ref:y,...m}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=u,i[4]=f,i[5]=p,i[6]=m,i[7]=y,i[8]=b);let x=b!==void 0&&b,{orientation:S,appearance:w}=T(`Tabs.Trigger`),E=a??o,D;i[9]===E?D=i[10]:(D=r(E),i[9]=E,i[10]=D);let O=D,k=a??o,A;i[11]!==w||i[12]!==f||i[13]!==S?(A=t(M({orientation:S,appearance:w}),f),i[11]=w,i[12]=f,i[13]=S,i[14]=A):A=i[14];let N;i[15]===p?N=i[16]:(N=n(p,`tabs-trigger`),i[15]=p,i[16]=N);let P;i[17]!==O||i[18]!==m||i[19]!==k||i[20]!==A||i[21]!==N?(P={"aria-disabled":k,className:A,"data-slot":N,disabled:O,...m},i[17]=O,i[18]=m,i[19]=k,i[20]=A,i[21]=N,i[22]=P):P=i[22];let F=P;if(x){let e;i[23]===u?e=i[24]:(e=c.only(u),h(d(e),"When using `asChild`, TabsTrigger must be passed a single child as a JSX tag."),i[23]=u,i[24]=e);let t=e.props?.children,n;if(i[25]!==O||i[26]!==t||i[27]!==y||i[28]!==e||i[29]!==F){let r=O?{href:void 0,to:void 0}:{},a;i[31]!==O||i[32]!==e?(a=O?/* @__PURE__ */ _(`button`,{type:`button`}):e,i[31]=O,i[32]=e,i[33]=a):a=i[33];let o;i[34]===Symbol.for(`react.memo_cache_sentinel`)?(o=/* @__PURE__ */ _(j,{}),i[34]=o):o=i[34];let s;i[35]===t?s=i[36]:(s=/* @__PURE__ */ v(g,{children:[o,/* @__PURE__ */ _(`span`,{"data-slot":`tabs-trigger-label`,className:`contents`,children:t})]}),i[35]=t,i[36]=s),n=/* @__PURE__ */ _(C,{asChild:!0,...F,ref:y,children:l(a,r,s)}),i[25]=O,i[26]=t,i[27]=y,i[28]=e,i[29]=F,i[30]=n}else n=i[30];return n}let I;i[37]===Symbol.for(`react.memo_cache_sentinel`)?(I=/* @__PURE__ */ _(j,{}),i[37]=I):I=i[37];let L;i[38]===u?L=i[39]:(L=/* @__PURE__ */ _(`span`,{"data-slot":`tabs-trigger-label`,className:`contents`,children:u}),i[38]=u,i[39]=L);let R;return i[40]!==y||i[41]!==L||i[42]!==F?(R=/* @__PURE__ */ v(C,{ref:y,...F,children:[I,L]}),i[40]=y,i[41]=L,i[42]=F,i[43]=R):R=i[43],R},Badge:e=>{let r=s(14),i,a,o,c;r[0]===e?(i=r[1],a=r[2],o=r[3],c=r[4]):({className:a,children:i,"data-slot":o,...c}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=c);let l;r[5]===o?l=r[6]:(l=n(o,`tabs-badge`),r[5]=o,r[6]=l);let u;r[7]===a?u=r[8]:(u=t(`rounded-full bg-neutral-500/20 px-1.5 text-xs font-medium text-gray-600`,`group-data-state-active/tab-trigger:bg-neutral-950/10 group-data-state-active/tab-trigger:text-strong group-hover/tab-trigger:group-enabled/tab-trigger:group-data-state-active/tab-trigger:text-strong`,`group-hover/tab-trigger:group-enabled/tab-trigger:text-gray-700`,a),r[7]=a,r[8]=u);let d;return r[9]!==i||r[10]!==c||r[11]!==l||r[12]!==u?(d=/* @__PURE__ */ _(`span`,{"data-slot":l,className:u,...c,children:i}),r[9]=i,r[10]=c,r[11]=l,r[12]=u,r[13]=d):d=r[13],d}};export{N as Tabs};
1
+ import{n as e}from"./compose-refs-sFdxsL7k.js";import{t}from"./cx-CK7o_rVv.js";import{t as n}from"./data-slot-EM6s2WEU.js";import{t as r}from"./booleanish-BfvnW6vy.js";import{t as i}from"./clsx-DUGZgXfJ.js";import{n as a}from"./separator-DfzxVutO.js";import{t as o}from"./use-prefers-reduced-motion-CU6mWmOe.js";import{c as s}from"react/compiler-runtime";import{Children as c,cloneElement as l,createContext as u,isValidElement as d,useContext as f,useEffect as p,useRef as m}from"react";import h from"tiny-invariant";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{cva as y}from"class-variance-authority";import{Content as b,List as x,Root as S,Trigger as C}from"@radix-ui/react-tabs";const w=u(null);function T(e){let t=f(w);return h(t!=null,`${e} must be rendered inside Tabs.Root.`),t}const E=e=>{let r=s(29),i,a,o,c,l,u,d;r[0]===e?(i=r[1],a=r[2],o=r[3],c=r[4],l=r[5],u=r[6],d=r[7]):({className:a,children:i,"data-slot":o,onValueChange:c,orientation:u,appearance:d,...l}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=c,r[5]=l,r[6]=u,r[7]=d);let f=u===void 0?`horizontal`:u,p=d===void 0?`classic`:d,h;r[8]!==p||r[9]!==f?(h={orientation:f,appearance:p},r[8]=p,r[9]=f,r[10]=h):h=r[10];let g=h,v=m(null),y;r[11]===c?y=r[12]:(y=e=>{e!==v.current&&(v.current=e,queueMicrotask(()=>{v.current=null}),c?.(e))},r[11]=c,r[12]=y);let b=y,x;r[13]===o?x=r[14]:(x=n(o,`tabs`),r[13]=o,r[14]=x);let C=f===`horizontal`?`flex-col`:`flex-row`,T;r[15]!==a||r[16]!==C?(T=t(`flex [--tabs-gap:--spacing(4)] gap-(--tabs-gap)`,C,a),r[15]=a,r[16]=C,r[17]=T):T=r[17];let E;r[18]!==p||r[19]!==i||r[20]!==b||r[21]!==f||r[22]!==l||r[23]!==x||r[24]!==T?(E=/* @__PURE__ */ _(S,{"data-slot":x,"data-appearance":p,className:T,orientation:f,onValueChange:b,...l,children:i}),r[18]=p,r[19]=i,r[20]=b,r[21]=f,r[22]=l,r[23]=x,r[24]=T,r[25]=E):E=r[25];let D;return r[26]!==g||r[27]!==E?(D=/* @__PURE__ */ _(w.Provider,{value:g,children:E}),r[26]=g,r[27]=E,r[28]=D):D=r[28],D},D=y(`flex`,{variants:{orientation:{horizontal:`scroll-fade-x flex-row items-center overflow-x-auto overscroll-x-none self-stretch min-w-0 pt-1 -mt-1 px-1 -mx-1`,vertical:`flex-col items-end gap-3.5 self-stretch`},appearance:{classic:``,pill:``}},compoundVariants:[{orientation:`horizontal`,appearance:`pill`,className:`gap-1 pb-1 -mb-1`},{orientation:`horizontal`,appearance:`classic`,className:`gap-6`}]}),O=r=>{let i=s(20),a,c,l,u;i[0]===r?(a=i[1],c=i[2],l=i[3],u=i[4]):({className:a,"data-slot":c,ref:u,...l}=r,i[0]=r,i[1]=a,i[2]=c,i[3]=l,i[4]=u);let{orientation:d,appearance:f}=T(`Tabs.List`),h=m(null),g=e(h,u),v,y;i[5]===d?(v=i[6],y=i[7]):(v=()=>{let e=h.current;if(!e||d!==`horizontal`)return;let t=new AbortController,{signal:n}=t,r=!1;e.addEventListener(`pointerdown`,()=>{r=!0},{signal:n});let i=()=>{r=!1};return e.addEventListener(`pointerup`,()=>setTimeout(i),{signal:n}),e.addEventListener(`pointercancel`,i,{signal:n}),e.addEventListener(`keydown`,i,{signal:n}),e.addEventListener(`focusin`,t=>{if(!r&&t.target instanceof Element&&t.target!==e){let e=o()?`auto`:`smooth`;t.target.scrollIntoView({behavior:e,inline:`center`,block:`nearest`})}},{signal:n}),()=>{t.abort()}},y=[d],i[5]=d,i[6]=v,i[7]=y),p(v,y);let b;i[8]===c?b=i[9]:(b=n(c,`tabs-list`),i[8]=c,i[9]=b);let S;i[10]!==f||i[11]!==a||i[12]!==d?(S=t(D({orientation:d,appearance:f}),a),i[10]=f,i[11]=a,i[12]=d,i[13]=S):S=i[13];let C;return i[14]!==g||i[15]!==d||i[16]!==l||i[17]!==b||i[18]!==S?(C=/* @__PURE__ */ _(x,{"aria-orientation":d,"data-slot":b,className:S,ref:g,...l}),i[14]=g,i[15]=d,i[16]=l,i[17]=b,i[18]=S,i[19]=C):C=i[19],C},k=e=>{let r=s(14),i,o,c;r[0]===e?(i=r[1],o=r[2],c=r[3]):({className:i,"data-slot":o,...c}=e,r[0]=e,r[1]=i,r[2]=o,r[3]=c);let{orientation:l}=T(`Tabs.Separator`),u=l===`horizontal`?`[[data-slot~=tabs]>&]:-mt-(--tabs-gap)`:`h-auto self-stretch [[data-slot~=tabs]>&]:-ml-(--tabs-gap)`,d;r[4]===o?d=r[5]:(d=n(o,`tabs-separator`),r[4]=o,r[5]=d);let f;r[6]!==i||r[7]!==u?(f=t(u,i),r[6]=i,r[7]=u,r[8]=f):f=r[8];let p;return r[9]!==l||r[10]!==c||r[11]!==d||r[12]!==f?(p=/* @__PURE__ */ _(a,{"data-slot":d,orientation:l,className:f,...c}),r[9]=l,r[10]=c,r[11]=d,r[12]=f,r[13]=p):p=r[13],p},A=y(`absolute z-0`,{variants:{orientation:{horizontal:`bottom-0 left-0 right-0 h-0.75`,vertical:`-right-px bottom-0 top-0 w-0.75`},appearance:{classic:`group-data-state-active/tab-trigger:bg-neutral-950`,pill:`hidden`}}}),j=()=>{let e=s(5),{orientation:t,appearance:n}=T(`Tabs.Trigger`),r;e[0]!==n||e[1]!==t?(r=i(A({orientation:t,appearance:n})),e[0]=n,e[1]=t,e[2]=r):r=e[2];let a;return e[3]===r?a=e[4]:(a=/* @__PURE__ */ _(`span`,{"aria-hidden":!0,className:r}),e[3]=r,e[4]=a),a},M=y(t(`group/tab-trigger relative flex cursor-pointer select-none items-center gap-1 whitespace-nowrap py-3 text-sm font-medium text-gray-600`,`ring-focus-accent outline-hidden`,`aria-disabled:cursor-default aria-disabled:opacity-50`,`focus-visible:ring-4`,`[&>[data-slot=tabs-trigger-label]>svg]:shrink-0 [&>[data-slot=tabs-trigger-label]>svg]:size-5`,`not-aria-disabled:hover:text-gray-900`),{variants:{orientation:{horizontal:`rounded-tl-md rounded-tr-md`,vertical:`rounded-bl-md rounded-tl-md pr-3`},appearance:{classic:t(`not-aria-disabled:hover:data-state-active:text-strong`,`data-state-active:text-strong`),pill:t(`not-aria-disabled:hover:data-state-active:text-strong`,`not-aria-disabled:hover:data-state-active:bg-neutral-500/15`,`data-state-active:text-strong`,`data-state-active:bg-neutral-500/15`,`rounded-full py-2 px-3`)}}}),N={Root:E,Content:e=>{let r=s(12),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:i,"data-slot":a,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let c;r[4]===a?c=r[5]:(c=n(a,`tabs-content`),r[4]=a,r[5]=c);let l;r[6]===i?l=r[7]:(l=t(`focus-visible:ring-focus-accent outline-hidden focus-visible:ring-4`,i),r[6]=i,r[7]=l);let u;return r[8]!==o||r[9]!==c||r[10]!==l?(u=/* @__PURE__ */ _(b,{"data-slot":c,className:l,...o}),r[8]=o,r[9]=c,r[10]=l,r[11]=u):u=r[11],u},List:O,Separator:k,Trigger:e=>{let i=s(54),a,o,u,f,p,y,b,x,S,w;i[0]===e?(a=i[1],o=i[2],u=i[3],f=i[4],p=i[5],y=i[6],b=i[7],x=i[8],S=i[9],w=i[10]):({"aria-disabled":a,asChild:w,children:u,className:f,"data-slot":p,disabled:o,onClick:y,onMouseDown:b,ref:S,...x}=e,i[0]=e,i[1]=a,i[2]=o,i[3]=u,i[4]=f,i[5]=p,i[6]=y,i[7]=b,i[8]=x,i[9]=S,i[10]=w);let E=w!==void 0&&w,{orientation:D,appearance:O}=T(`Tabs.Trigger`),k=a??o,A;i[11]===k?A=i[12]:(A=r(k),i[11]=k,i[12]=A);let N=A,P=m(!1),F=a??o,I;i[13]!==O||i[14]!==f||i[15]!==D?(I=t(M({orientation:D,appearance:O}),f),i[13]=O,i[14]=f,i[15]=D,i[16]=I):I=i[16];let L;i[17]===p?L=i[18]:(L=n(p,`tabs-trigger`),i[17]=p,i[18]=L);let R;i[19]!==N||i[20]!==y?(R=e=>{if(y?.(e),e.defaultPrevented||N||!e.currentTarget.matches(`a[href]`)||e.button!==0||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let t=e.currentTarget;t.focus({focusVisible:!1}),P.current=!0,t.dispatchEvent(new MouseEvent(`mousedown`,{bubbles:!0,button:0})),P.current=!1},i[19]=N,i[20]=y,i[21]=R):R=i[21];let z;i[22]!==N||i[23]!==b?(z=e=>{P.current||(b?.(e),!(e.defaultPrevented||N)&&(e.currentTarget.matches(`a[href]`)?e.preventDefault():e.button===0&&!e.ctrlKey&&e.currentTarget.focus({focusVisible:!1})))},i[22]=N,i[23]=b,i[24]=z):z=i[24];let B;i[25]!==N||i[26]!==x||i[27]!==F||i[28]!==I||i[29]!==L||i[30]!==R||i[31]!==z?(B={"aria-disabled":F,className:I,"data-slot":L,disabled:N,onClick:R,onMouseDown:z,...x},i[25]=N,i[26]=x,i[27]=F,i[28]=I,i[29]=L,i[30]=R,i[31]=z,i[32]=B):B=i[32];let V=B;if(E){let e;i[33]===u?e=i[34]:(e=c.only(u),h(d(e),"When using `asChild`, TabsTrigger must be passed a single child as a JSX tag."),i[33]=u,i[34]=e);let t=e.props?.children,n;if(i[35]!==N||i[36]!==t||i[37]!==S||i[38]!==e||i[39]!==V){let r=N?{href:void 0,to:void 0}:{},a;i[41]!==N||i[42]!==e?(a=N?/* @__PURE__ */ _(`button`,{type:`button`}):e,i[41]=N,i[42]=e,i[43]=a):a=i[43];let o;i[44]===Symbol.for(`react.memo_cache_sentinel`)?(o=/* @__PURE__ */ _(j,{}),i[44]=o):o=i[44];let s;i[45]===t?s=i[46]:(s=/* @__PURE__ */ v(g,{children:[o,/* @__PURE__ */ _(`span`,{"data-slot":`tabs-trigger-label`,className:`contents`,children:t})]}),i[45]=t,i[46]=s),n=/* @__PURE__ */ _(C,{asChild:!0,...V,ref:S,children:l(a,r,s)}),i[35]=N,i[36]=t,i[37]=S,i[38]=e,i[39]=V,i[40]=n}else n=i[40];return n}let H;i[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=/* @__PURE__ */ _(j,{}),i[47]=H):H=i[47];let U;i[48]===u?U=i[49]:(U=/* @__PURE__ */ _(`span`,{"data-slot":`tabs-trigger-label`,className:`contents`,children:u}),i[48]=u,i[49]=U);let W;return i[50]!==S||i[51]!==U||i[52]!==V?(W=/* @__PURE__ */ v(C,{ref:S,...V,children:[H,U]}),i[50]=S,i[51]=U,i[52]=V,i[53]=W):W=i[53],W},Badge:e=>{let r=s(14),i,a,o,c;r[0]===e?(i=r[1],a=r[2],o=r[3],c=r[4]):({className:a,children:i,"data-slot":o,...c}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=c);let l;r[5]===o?l=r[6]:(l=n(o,`tabs-badge`),r[5]=o,r[6]=l);let u;r[7]===a?u=r[8]:(u=t(`rounded-full bg-neutral-500/20 px-1.5 text-xs font-medium text-gray-600`,`group-data-state-active/tab-trigger:bg-neutral-950/10 group-data-state-active/tab-trigger:text-strong group-hover/tab-trigger:group-enabled/tab-trigger:group-data-state-active/tab-trigger:text-strong`,`group-hover/tab-trigger:group-enabled/tab-trigger:text-gray-700`,a),r[7]=a,r[8]=u);let d;return r[9]!==i||r[10]!==c||r[11]!==l||r[12]!==u?(d=/* @__PURE__ */ _(`span`,{"data-slot":l,className:u,...c,children:i}),r[9]=i,r[10]=c,r[11]=l,r[12]=u,r[13]=d):d=r[13],d}};export{N as Tabs};
@@ -0,0 +1 @@
1
+ import{n as e}from"./browser-only-BTSrYWLj.js";import{t}from"./cx-CK7o_rVv.js";import{t as n}from"./use-matches-media-query-m860lols.js";import{n as r,t as i}from"./cookie-ca4g5CKp.js";import{t as a}from"./use-prefers-reduced-motion-CU6mWmOe.js";import{c as o}from"react/compiler-runtime";import{createContext as s,useContext as c,useEffect as l,useRef as u,useState as d}from"react";import f from"tiny-invariant";import{jsx as p}from"react/jsx-runtime";import{flushSync as m}from"react-dom";let h=null;function g(e,{origin:t}={}){if(typeof document.startViewTransition!=`function`||a()||document.visibilityState!==`visible`){e();return}if(h!=null){h.skipTransition(),h.updateCallbackDone.finally(()=>m(e));return}let n=document.documentElement,r={width:window.innerWidth,height:window.innerHeight},i=v(_(t,r),r);n.dataset.themeTransition=``;let o=document.startViewTransition(()=>m(e));h=o;function s(e){if(e.target!==n)return;o.skipTransition();let t=document.elementFromPoint(e.clientX,e.clientY);t!=null&&t!==n&&t.dispatchEvent(new MouseEvent(`click`,e))}document.addEventListener(`click`,s,{capture:!0});let c=o.ready.then(()=>n.animate({clipPath:[i.from,i.to]},{duration:400,easing:`ease-out`,pseudoElement:`::view-transition-new(root)`}),()=>void 0),l=async()=>{(await c)?.cancel(),document.removeEventListener(`click`,s,{capture:!0}),h=null,delete n.dataset.themeTransition};o.finished.finally(()=>{l()})}function _(e,t){let n=document.activeElement,r=e??(n!=null&&n!==document.body?n:void 0);return r==null?{left:t.width/2,top:t.height/2,width:0,height:0}:r.getBoundingClientRect()}function v(e,t){let n=e.left+e.width/2,r=e.top+e.height/2,i=Math.hypot(Math.max(n,t.width-n),Math.max(r,t.height-r)),a=`at ${n}px ${r}px`;return{from:`circle(0px ${a})`,to:`circle(${Math.round(i*100)/100}px ${a})`}}const y=[`light`,`dark`],b=[`system`,...y],x=e=>e;function S(e){return typeof e==`string`&&b.some(t=>t===e)}const C=e=>e;function w(e){return typeof e==`string`&&y.some(t=>t===e)}function T({theme:e,prefersDarkMode:t}){let n=t?`dark`:`light`,r=(e===`system`?n:e)===`dark`?`light`:`dark`;return r===n?`system`:r}const E=`(prefers-color-scheme: dark)`,D=`mantle-ui-theme`,O=`system`,k={system:`system`,light:`light`,dark:`dark`,"light-high-contrast":`light`,"dark-high-contrast":`dark`},A=s(null),j=s(void 0);function M(t){let n=o(19),{children:i,forceTheme:a,ssrCookie:s}=t,c;n[0]!==a||n[1]!==s?(c=()=>{let t=U({cookie:e()?Y()??s:s});return P(t,{forceTheme:a}),t},n[0]=a,n[1]=s,n[2]=c):c=n[2];let[f,m]=d(c),h=u(null),_,v;n[3]!==a||n[4]!==s?(_=()=>{let e=function(){let e=U({cookie:Y()??s});m(e),P(e,{forceTheme:a})};e();let t=r(Y(),D);t!=null&&!S(t)&&Object.hasOwn(k,t)&&X(U({cookie:Y()}));try{`BroadcastChannel`in window&&(h.current=new BroadcastChannel(D),h.current.addEventListener(`message`,e))}catch{}let n=function(t){t.key===`${D}__ping`&&e()};window.addEventListener(`storage`,n);let i=window.matchMedia(E),o=function(){e()},c=function(){document.visibilityState===`visible`&&e()};return i.addEventListener(`change`,o),window.addEventListener(`pageshow`,o),document.addEventListener(`visibilitychange`,c),()=>{window.removeEventListener(`storage`,n),i.removeEventListener(`change`,o),window.removeEventListener(`pageshow`,o),document.removeEventListener(`visibilitychange`,c),Z(h.current),h.current=null}},v=[a,s],n[3]=a,n[4]=s,n[5]=_,n[6]=v):(_=n[5],v=n[6]),l(_,v);let y;n[7]!==a||n[8]!==f?(y=(e,t)=>{let{origin:n}=t===void 0?{}:t,r=()=>{if(typeof e!=`function`)return e;let t=document.documentElement.dataset.theme;return e(S(t)?t:f)},i=()=>{let e=r();X(e),m(e),P(e,{forceTheme:a}),G(e,{broadcastChannel:h.current,pingKey:`${D}__ping`})},o=window.matchMedia(E).matches;(a??I(r(),{prefersDarkMode:o}))===document.documentElement.dataset.appliedTheme?i():g(i,{origin:n})},n[7]=a,n[8]=f,n[9]=y):y=n[9];let b;n[10]!==y||n[11]!==f?(b=[f,y],n[10]=y,n[11]=f,n[12]=b):b=n[12];let x=b,C;n[13]!==i||n[14]!==x?(C=/* @__PURE__ */ p(A.Provider,{value:x,children:i}),n[13]=i,n[14]=x,n[15]=C):C=n[15];let w;return n[16]!==a||n[17]!==C?(w=/* @__PURE__ */ p(j.Provider,{value:a,children:C}),n[16]=a,n[17]=C,n[18]=w):w=n[18],w}function N(){let e=c(A);return f(e,`useTheme must be used within a ThemeProvider`),e}function P(t,{forceTheme:n}={}){if(!e())return;let r=window.document.documentElement,i=window.matchMedia(E).matches,a=n??I(t,{prefersDarkMode:i}),o=r.dataset.theme,s=r.dataset.appliedTheme,c=S(o)?o:void 0,l=w(s)?s:void 0;(c!==t||l!==a)&&(r.classList.remove(...y),r.classList.add(a),r.dataset.theme=t,r.dataset.appliedTheme=a)}function F(){if(!e())return{appliedTheme:void 0,theme:void 0};let t=window.document.documentElement,n=S(t.dataset.theme)?t.dataset.theme:void 0;return{appliedTheme:w(t.dataset.appliedTheme)?t.dataset.appliedTheme:void 0,theme:n}}function I(e,{prefersDarkMode:t}){return e===`system`?t?`dark`:`light`:e}function L(){let e=o(4),t=c(A),r=R(),i=t==null?`system`:t[0],a=n(E),s;return e[0]!==r||e[1]!==a||e[2]!==i?(s=r??I(i,{prefersDarkMode:a}),e[0]=r,e[1]=a,e[2]=i,e[3]=s):s=e[3],s}function R(){return c(j)}function z({storageKey:e,themeByCookieValue:t,forceTheme:n}){let r=`system`;try{let n=document.cookie.split(`;`).map(e=>e.trim()).find(t=>t.startsWith(`${e}=`)),i=decodeURIComponent(n?.slice(e.length+1)??``);Object.hasOwn(t,i)&&(r=t[i]??`system`)}catch{}let i=matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;n==null?r!==`system`&&(i=r):i=n;let a=document.documentElement;a.classList.remove(`light`,`dark`),a.classList.add(i),a.dataset.theme=r,a.dataset.appliedTheme=i}function B(e){let t={storageKey:D,themeByCookieValue:k,forceTheme:e};return`(${z.toString()})(${JSON.stringify(t)})`}const V=e=>{let t=o(7),{forceTheme:n,nonce:r}=e,i;t[0]===n?i=t[1]:(i=B(n),t[0]=n,t[1]=i);let a;t[2]===i?a=t[3]:(a={__html:i},t[2]=i,t[3]=a);let s;return t[4]!==r||t[5]!==a?(s=/* @__PURE__ */ p(`script`,{dangerouslySetInnerHTML:a,nonce:r,suppressHydrationWarning:!0}),t[4]=r,t[5]=a,t[6]=s):s=t[6],s};function H(n){let r=o(17),i;r[0]===n?i=r[1]:(i=n===void 0?{}:n,r[0]=n,r[1]=i);let a=i,s;r[2]===a?s=r[3]:(s=a??{},r[2]=a,r[3]=s);let{className:c,forceTheme:l,ssrCookie:u}=s,d=c===void 0?``:c,f,p;if(e()){let e;if(r[7]!==u){let t=window.matchMedia(E).matches;f=U({cookie:Y()??u}),e=I(f,{prefersDarkMode:t}),r[7]=u,r[8]=e,r[9]=f}else e=r[8],f=r[9];p=e}else{let e;r[4]===u?(e=r[5],f=r[6]):(f=U({cookie:u}),e=I(f,{prefersDarkMode:!1}),r[4]=u,r[5]=e,r[6]=f),p=e}let m=l??p,h;r[10]!==m||r[11]!==d?(h=t(d,m),r[10]=m,r[11]=d,r[12]=h):h=r[12];let g;return r[13]!==m||r[14]!==f||r[15]!==h?(g={className:h,"data-applied-theme":m,"data-theme":f},r[13]=m,r[14]=f,r[15]=h,r[16]=g):g=r[16],g}function U({cookie:e}){if(!e)return O;let t=r(e,D);return t==null||!Object.hasOwn(k,t)?O:k[t]??O}function W(e){return i(e,D)}function G(e,t){let{broadcastChannel:n,pingKey:r}=t;try{if(n){n.postMessage({theme:e,timestamp:Date.now()});return}}catch{}try{localStorage.setItem(r,JSON.stringify({theme:e,timestamp:Date.now()}))}catch{}}const K=[`ngrok.com`,`ngrok.ai`];function q(e){let t=K.find(t=>e===t||e.endsWith(`.${t}`));return t==null?void 0:`.${t}`}function J(e){let t=/* @__PURE__ */ new Date;t.setFullYear(t.getFullYear()+1);let{hostname:n,protocol:r}=window.location,i=q(n),a=i==null?``:`; domain=${i}`,o=r===`https:`?`; Secure`:``;return`${D}=${encodeURIComponent(e)}; expires=${t.toUTCString()}; path=/${a}; SameSite=Lax${o}`}function Y(){try{return document.cookie}catch{return}}function X(t){if(e())try{document.cookie=J(t)}catch{}}function Z(e){if(e!=null)try{e.close()}catch{}}export{b as _,B as a,R as c,C as d,x as f,y as g,S as h,U as i,H as l,w as m,M as n,F as o,T as p,W as r,L as s,V as t,N as u};
@@ -1,18 +1,110 @@
1
1
  import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
2
2
  import { t as WithStyleProps } from "./with-style-props-CuT30s0W.js";
3
3
  import { n as IconButtonProps, r as IconButtonAppearance } from "./button-Yxyu1XMd.js";
4
+ import { ReactNode } from "react";
4
5
  /**
5
- * The props for the `ThemeDropdownMenuItem` component.
6
+ * The props for the `ThemeSwitcherIcon` component.
6
7
  */
7
- type ThemeDropdownMenuItemProps = WithStyleProps & {
8
+ type ThemeSwitcherIconProps = WithStyleProps;
9
+ /**
10
+ * The `ThemeSwitcher` icon on its own: a sun or a moon for the applied theme,
11
+ * which swaps with a transition when the theme changes. Put it anywhere in the
12
+ * `children` of a `ThemeDropdownMenuItem`, or of a `DropdownMenu.Item` that
13
+ * uses `useThemeToggle`, and the new theme grows in a circle from it.
14
+ *
15
+ * Reads the applied theme via `useAppliedTheme`, so it must render inside a
16
+ * `ThemeProvider`. It is decorative (`aria-hidden`). Its box is the size of an
17
+ * `Icon`, so it lines up with the icons of other menu rows. It is SSR-safe: a
18
+ * `Skeleton` renders until hydration, then the icon of the applied theme.
19
+ *
20
+ * **Data attributes:**
21
+ *
22
+ * | Data Attribute | Value | Description |
23
+ * | --- | --- | --- |
24
+ * | `data-slot` | `"theme-switcher-icon"` | On the `<span>` that holds the icon. |
25
+ *
26
+ * @see https://mantle.ngrok.com/components/forms/theme-switcher#themeswitchericon
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * <ThemeDropdownMenuItem>
31
+ * <ThemeSwitcherIcon />
32
+ * Theme
33
+ * </ThemeDropdownMenuItem>
34
+ * ```
35
+ */
36
+ declare function ThemeSwitcherIcon({ className, style }: ThemeSwitcherIconProps): import("react").JSX.Element;
37
+ /**
38
+ * The value `useThemeToggle` returns.
39
+ */
40
+ type ThemeToggle = {
8
41
  /**
9
- * The visible label of the item. When set, it is also the accessible
10
- * name. When omitted, the label is "Theme", and the accessible name also
11
- * says which theme the next press shows, such as "Theme: Switch to dark
12
- * theme". Set it for localization.
42
+ * Whether a press cannot change the theme: `true` under a `ThemeProvider`
43
+ * with `forceTheme`. Pass it to the item as `disabled`.
13
44
  */
14
- label?: string;
45
+ disabled: boolean;
46
+ /**
47
+ * The accessible name of the next press, such as "Switch to dark theme" or
48
+ * "Switch to light theme (system default)".
49
+ */
50
+ label: string;
51
+ /**
52
+ * The `onSelect` handler for a `DropdownMenu.Item`. It flips the theme and
53
+ * keeps the menu open. The new theme grows in a circle from the
54
+ * `ThemeSwitcherIcon` in the item, else from the item.
55
+ */
56
+ onSelect: (event: Event) => void;
15
57
  };
58
+ /**
59
+ * The light/dark toggle of `ThemeDropdownMenuItem` for a `DropdownMenu.Item`
60
+ * that you compose yourself. A press flips the theme the same way a
61
+ * `ThemeSwitcher` click does.
62
+ *
63
+ * Reads and writes the theme via `useTheme`, so it must run inside a
64
+ * `ThemeProvider`. Call it in a component that menu content renders: menu
65
+ * content mounts only on the client, so the OS preference in `label` is
66
+ * always known.
67
+ *
68
+ * @see https://mantle.ngrok.com/components/forms/theme-switcher#usethemetoggle
69
+ *
70
+ * @example
71
+ * ```tsx
72
+ * function ThemeItem() {
73
+ * const toggle = useThemeToggle();
74
+ *
75
+ * return (
76
+ * <DropdownMenu.Item disabled={toggle.disabled} onSelect={toggle.onSelect}>
77
+ * <ThemeSwitcherIcon />
78
+ * Theme
79
+ * </DropdownMenu.Item>
80
+ * );
81
+ * }
82
+ * ```
83
+ */
84
+ declare function useThemeToggle(): ThemeToggle;
85
+ /**
86
+ * The props for the `ThemeDropdownMenuItem` component. Set `label` or
87
+ * `children`, not both.
88
+ */
89
+ type ThemeDropdownMenuItemProps = WithStyleProps & ({
90
+ /**
91
+ * The visible label of the default row. When set, it is also the
92
+ * accessible name. When omitted, the label is "Theme", and the
93
+ * accessible name also says which theme the next press shows, such as
94
+ * "Theme: Switch to dark theme". Set it for localization.
95
+ */
96
+ label?: string;
97
+ children?: never;
98
+ } | {
99
+ /**
100
+ * The content of the item, in place of the default row. Put a
101
+ * `ThemeSwitcherIcon` where the icon goes. The content is also the
102
+ * accessible name. Children that render nothing (`false`, `true`,
103
+ * or `""`) keep the default row.
104
+ */
105
+ children: ReactNode;
106
+ label?: never;
107
+ });
16
108
  /**
17
109
  * Must render inside a `DropdownMenu.Content` or `DropdownMenu.SubContent` —
18
110
  * the type system cannot express this constraint, so it is on you to uphold it.
@@ -23,6 +115,10 @@ type ThemeDropdownMenuItemProps = WithStyleProps & {
23
115
  * click does, and the icon swaps between the sun and the moon. The menu stays
24
116
  * open, and the new theme grows in a circle from the icon.
25
117
  *
118
+ * To lay out the row yourself, such as with the icon first, pass `children`
119
+ * and put a `ThemeSwitcherIcon` in them. To wire a `DropdownMenu.Item` of your
120
+ * own, call `useThemeToggle`.
121
+ *
26
122
  * Reads and writes the theme via `useTheme`, so it must render inside a
27
123
  * `ThemeProvider`. Under a provider with `forceTheme`, it shows the forced
28
124
  * theme and is disabled. For a control in a header or toolbar, use
@@ -33,7 +129,7 @@ type ThemeDropdownMenuItemProps = WithStyleProps & {
33
129
  * | Data Attribute | Value | Description |
34
130
  * | --- | --- | --- |
35
131
  * | `data-slot` | `"theme-dropdown-menu-item"` | On the item element. |
36
- * | `data-slot` | `"theme-dropdown-menu-item-label"` | On the `<span>` that holds the `label`. |
132
+ * | `data-slot` | `"theme-dropdown-menu-item-label"` | On the `<span>` that holds the `label`. The item renders it only when `children` is omitted. |
37
133
  *
38
134
  * @see https://mantle.ngrok.com/components/forms/theme-switcher#themedropdownmenuitem
39
135
  *
@@ -49,8 +145,24 @@ type ThemeDropdownMenuItemProps = WithStyleProps & {
49
145
  * </DropdownMenu.Content>
50
146
  * </DropdownMenu.Root>
51
147
  * ```
148
+ *
149
+ * @example
150
+ * ```tsx
151
+ * <DropdownMenu.Root>
152
+ * <DropdownMenu.Trigger asChild>
153
+ * <Button type="button" appearance="outlined" intent="neutral">Account</Button>
154
+ * </DropdownMenu.Trigger>
155
+ * <DropdownMenu.Content>
156
+ * <DropdownMenu.Item>Profile</DropdownMenu.Item>
157
+ * <ThemeDropdownMenuItem>
158
+ * <ThemeSwitcherIcon />
159
+ * Theme
160
+ * </ThemeDropdownMenuItem>
161
+ * </DropdownMenu.Content>
162
+ * </DropdownMenu.Root>
163
+ * ```
52
164
  */
53
- declare function ThemeDropdownMenuItem({ className, label, style }: ThemeDropdownMenuItemProps): import("react").JSX.Element;
165
+ declare function ThemeDropdownMenuItem({ children, className, label, style }: ThemeDropdownMenuItemProps): import("react").JSX.Element;
54
166
  /**
55
167
  * The props for the `ThemeSwitcher` component. Forwards `IconButton`'s props,
56
168
  * except the parts the switcher owns: `icon` (the SSR-safe themed icon) and
@@ -109,4 +221,4 @@ type ThemeSwitcherProps = Omit<IconButtonProps, "appearance" | "asChild" | "chil
109
221
  * ```
110
222
  */
111
223
  declare function ThemeSwitcher({ appearance, "data-slot": dataSlot, disabled, label, onClick, ...props }: ThemeSwitcherProps): import("react").JSX.Element;
112
- export { ThemeDropdownMenuItem, type ThemeDropdownMenuItemProps, ThemeSwitcher, type ThemeSwitcherProps };
224
+ export { ThemeDropdownMenuItem, type ThemeDropdownMenuItemProps, ThemeSwitcher, ThemeSwitcherIcon, type ThemeSwitcherIconProps, type ThemeSwitcherProps, type ThemeToggle, useThemeToggle };
@@ -1 +1 @@
1
- import{r as e,t}from"./browser-only-BTSrYWLj.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{r as i}from"./button-Dge0D5bl.js";import{t as a}from"./button-B8k98Pby.js";import{t as o}from"./use-matches-media-query-m860lols.js";import{t as s}from"./skeleton-DBpI-ko5.js";import{t as c}from"./dropdown-menu-BHBzCDSZ.js";import{c as l,p as u,s as d,u as f}from"./theme-CwtpudOH.js";import{n as p}from"./icons-DGL0d2Il.js";import{c as m}from"react/compiler-runtime";import{useRef as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";const v={light:/* @__PURE__ */ g(p,{theme:`light`}),dark:/* @__PURE__ */ g(p,{theme:`dark`})};function y(e){let t=m(23),{className:r,label:a,style:s}=e,[p,y]=f(),b=d(),S=l(),C=o(`(prefers-color-scheme: dark)`),w=h(null),T,E;if(t[0]!==a||t[1]!==C||t[2]!==p){let e=u({theme:p,prefersDarkMode:C});T=c.Item,E=a==null?`Theme: ${x(e,{prefersDarkMode:C})}`:void 0,t[0]=a,t[1]=C,t[2]=p,t[3]=T,t[4]=E}else T=t[3],E=t[4];let D;t[5]===r?D=t[6]:(D=n(`gap-2`,r),t[5]=r,t[6]=D);let O=S!=null,k;t[7]!==C||t[8]!==y?(k=e=>{e.preventDefault(),y(e=>u({theme:e,prefersDarkMode:C}),{origin:w.current})},t[7]=C,t[8]=y,t[9]=k):k=t[9];let A=a??`Theme`,j;t[10]===A?j=t[11]:(j=/* @__PURE__ */ g(`span`,{"data-slot":`theme-dropdown-menu-item-label`,className:`flex-1`,children:A}),t[10]=A,t[11]=j);let M;t[12]===b?M=t[13]:(M=/* @__PURE__ */ g(`span`,{ref:w,"aria-hidden":!0,className:`flex size-7 shrink-0 items-center justify-center text-muted [&_svg]:size-5`,children:/* @__PURE__ */ g(i,{active:b,icons:v})}),t[12]=b,t[13]=M);let N;return t[14]!==T||t[15]!==s||t[16]!==E||t[17]!==D||t[18]!==O||t[19]!==k||t[20]!==j||t[21]!==M?(N=/* @__PURE__ */ _(T,{"aria-label":E,"data-slot":`theme-dropdown-menu-item`,className:D,disabled:O,style:s,onSelect:k,children:[j,M]}),t[14]=T,t[15]=s,t[16]=E,t[17]=D,t[18]=O,t[19]=k,t[20]=j,t[21]=M,t[22]=N):N=t[22],N}function b(n){let c=m(28),p,h,_,y,b,S;c[0]===n?(p=c[1],h=c[2],_=c[3],y=c[4],b=c[5],S=c[6]):({appearance:S,"data-slot":p,disabled:h,label:_,onClick:y,...b}=n,c[0]=n,c[1]=p,c[2]=h,c[3]=_,c[4]=y,c[5]=b,c[6]=S);let C=S===void 0?`ghost`:S,[w,T]=f(),E=d(),D=l(),O=o(`(prefers-color-scheme: dark)`),k=e(),A;if(c[7]!==k||c[8]!==O||c[9]!==w){let e=u({theme:w,prefersDarkMode:O});A=k?x(e,{prefersDarkMode:O}):`Toggle theme`,c[7]=k,c[8]=O,c[9]=w,c[10]=A}else A=c[10];let j=A,M;c[11]===p?M=c[12]:(M=r(p,`theme-switcher`),c[11]=p,c[12]=M);let N=D!=null||h,P;c[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=/* @__PURE__ */ g(s,{asChild:!0,className:`rounded-full size-5`,children:/* @__PURE__ */ g(`span`,{})}),c[13]=P):P=c[13];let F;c[14]===E?F=c[15]:(F=/* @__PURE__ */ g(t,{fallback:P,children:()=>/* @__PURE__ */ g(i,{active:E,icons:v})}),c[14]=E,c[15]=F);let I=_??(D==null?j:`Theme set by this page`),L;c[16]!==y||c[17]!==O||c[18]!==T?(L=e=>{y?.(e),e.defaultPrevented||T(e=>u({theme:e,prefersDarkMode:O}),{origin:e.currentTarget})},c[16]=y,c[17]=O,c[18]=T,c[19]=L):L=c[19];let R;return c[20]!==C||c[21]!==b||c[22]!==M||c[23]!==N||c[24]!==F||c[25]!==I||c[26]!==L?(R=/* @__PURE__ */ g(a,{appearance:C,"data-slot":M,disabled:N,intent:`neutral`,icon:F,label:I,onClick:L,...b}),c[20]=C,c[21]=b,c[22]=M,c[23]=N,c[24]=F,c[25]=I,c[26]=L,c[27]=R):R=c[27],R}function x(e,{prefersDarkMode:t}){return e===`system`?t?`Switch to dark theme (system default)`:`Switch to light theme (system default)`:`Switch to ${e} theme`}export{y as ThemeDropdownMenuItem,b as ThemeSwitcher};
1
+ import{r as e,t}from"./browser-only-BTSrYWLj.js";import{t as n}from"./cx-CK7o_rVv.js";import{t as r}from"./data-slot-EM6s2WEU.js";import{r as i}from"./button-Dge0D5bl.js";import{t as a}from"./button-B8k98Pby.js";import{t as o}from"./use-matches-media-query-m860lols.js";import{t as s}from"./skeleton-DBpI-ko5.js";import{t as c}from"./dropdown-menu-BHBzCDSZ.js";import{c as l,p as u,s as d,u as f}from"./theme-C-glc5Q-.js";import{n as p}from"./icons-DP3lQw5O.js";import{c as m}from"react/compiler-runtime";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v={light:/* @__PURE__ */ g(p,{theme:`light`}),dark:/* @__PURE__ */ g(p,{theme:`dark`})};function y(e){let r=m(9),{className:a,style:o}=e,c=d(),l;r[0]===a?l=r[1]:(l=n(`flex shrink-0 items-center justify-center text-muted`,a),r[0]=a,r[1]=l);let u;r[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=/* @__PURE__ */ g(s,{asChild:!0,className:`rounded-full size-5`,children:/* @__PURE__ */ g(`span`,{})}),r[2]=u):u=r[2];let f;r[3]===c?f=r[4]:(f=/* @__PURE__ */ g(t,{fallback:u,children:()=>/* @__PURE__ */ g(i,{active:c,icons:v})}),r[3]=c,r[4]=f);let p;return r[5]!==o||r[6]!==l||r[7]!==f?(p=/* @__PURE__ */ g(`span`,{"aria-hidden":!0,"data-slot":`theme-switcher-icon`,className:l,style:o,children:f}),r[5]=o,r[6]=l,r[7]=f,r[8]=p):p=r[8],p}function b(){let e=m(10),[t,n]=f(),r=l(),i=o(`(prefers-color-scheme: dark)`),a=r!=null,s;e[0]!==i||e[1]!==t?(s=C(u({theme:t,prefersDarkMode:i}),{prefersDarkMode:i}),e[0]=i,e[1]=t,e[2]=s):s=e[2];let c;e[3]!==i||e[4]!==n?(c=e=>{e.preventDefault();let t=e.currentTarget instanceof Element?e.currentTarget:null;n(e=>u({theme:e,prefersDarkMode:i}),{origin:t?.querySelector(`[data-slot~="theme-switcher-icon"]`)??t})},e[3]=i,e[4]=n,e[5]=c):c=e[5];let d;return e[6]!==a||e[7]!==s||e[8]!==c?(d={disabled:a,label:s,onSelect:c},e[6]=a,e[7]=s,e[8]=c,e[9]=d):d=e[9],d}function x(e){let t=m(13),{children:r,className:i,label:a,style:o}=e,s=b(),l=r!=null&&typeof r!=`boolean`&&r!==``,u=a==null&&!l?`Theme: ${s.label}`:void 0,d;t[0]===i?d=t[1]:(d=n(`gap-2`,i),t[0]=i,t[1]=d);let f;t[2]!==r||t[3]!==l||t[4]!==a?(f=l?r:/* @__PURE__ */ _(h,{children:[/* @__PURE__ */ g(`span`,{"data-slot":`theme-dropdown-menu-item-label`,className:`flex-1`,children:a??`Theme`}),/* @__PURE__ */ g(y,{className:`size-7`})]}),t[2]=r,t[3]=l,t[4]=a,t[5]=f):f=t[5];let p;return t[6]!==o||t[7]!==u||t[8]!==d||t[9]!==f||t[10]!==s.disabled||t[11]!==s.onSelect?(p=/* @__PURE__ */ g(c.Item,{"aria-label":u,"data-slot":`theme-dropdown-menu-item`,className:d,disabled:s.disabled,style:o,onSelect:s.onSelect,children:f}),t[6]=o,t[7]=u,t[8]=d,t[9]=f,t[10]=s.disabled,t[11]=s.onSelect,t[12]=p):p=t[12],p}function S(n){let c=m(28),p,h,_,y,b,x;c[0]===n?(p=c[1],h=c[2],_=c[3],y=c[4],b=c[5],x=c[6]):({appearance:x,"data-slot":p,disabled:h,label:_,onClick:y,...b}=n,c[0]=n,c[1]=p,c[2]=h,c[3]=_,c[4]=y,c[5]=b,c[6]=x);let S=x===void 0?`ghost`:x,[w,T]=f(),E=d(),D=l(),O=o(`(prefers-color-scheme: dark)`),k=e(),A;if(c[7]!==k||c[8]!==O||c[9]!==w){let e=u({theme:w,prefersDarkMode:O});A=k?C(e,{prefersDarkMode:O}):`Toggle theme`,c[7]=k,c[8]=O,c[9]=w,c[10]=A}else A=c[10];let j=A,M;c[11]===p?M=c[12]:(M=r(p,`theme-switcher`),c[11]=p,c[12]=M);let N=D!=null||h,P;c[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=/* @__PURE__ */ g(s,{asChild:!0,className:`rounded-full size-5`,children:/* @__PURE__ */ g(`span`,{})}),c[13]=P):P=c[13];let F;c[14]===E?F=c[15]:(F=/* @__PURE__ */ g(t,{fallback:P,children:()=>/* @__PURE__ */ g(i,{active:E,icons:v})}),c[14]=E,c[15]=F);let I=_??(D==null?j:`Theme set by this page`),L;c[16]!==y||c[17]!==O||c[18]!==T?(L=e=>{y?.(e),e.defaultPrevented||T(e=>u({theme:e,prefersDarkMode:O}),{origin:e.currentTarget})},c[16]=y,c[17]=O,c[18]=T,c[19]=L):L=c[19];let R;return c[20]!==S||c[21]!==b||c[22]!==M||c[23]!==N||c[24]!==F||c[25]!==I||c[26]!==L?(R=/* @__PURE__ */ g(a,{appearance:S,"data-slot":M,disabled:N,intent:`neutral`,icon:F,label:I,onClick:L,...b}),c[20]=S,c[21]=b,c[22]=M,c[23]=N,c[24]=F,c[25]=I,c[26]=L,c[27]=R):R=c[27],R}function C(e,{prefersDarkMode:t}){return e===`system`?t?`Switch to dark theme (system default)`:`Switch to light theme (system default)`:`Switch to ${e} theme`}export{x as ThemeDropdownMenuItem,S as ThemeSwitcher,y as ThemeSwitcherIcon,b as useThemeToggle};
package/dist/theme.d.ts CHANGED
@@ -33,8 +33,8 @@ type ThemeProviderProps = PropsWithChildren<{
33
33
  * `useInitialHtmlThemeProps`. The server then seeds
34
34
  * the context with the stored theme, so the hydrated client agrees with the
35
35
  * server HTML. When omitted, the server renders `"system"`. A client with a
36
- * stored theme then reports a hydration mismatch. The client always reads
37
- * `document.cookie`.
36
+ * stored theme then reports a hydration mismatch. The client reads
37
+ * `document.cookie`, and reads `ssrCookie` only when the environment blocks cookies.
38
38
  */
39
39
  ssrCookie?: string;
40
40
  }>;
package/dist/theme.js CHANGED
@@ -1 +1 @@
1
- import{_ as e,a as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,r as d,s as f,t as p,u as m}from"./theme-CwtpudOH.js";import{c as h}from"react/compiler-runtime";import{jsx as g}from"react/jsx-runtime";const _=`https://assets.ngrok.com`,v=`${_}/fonts`,y={roobert:`/roobert/roobert-proportional-vf.woff2`,"jetbrains-mono":`/jetbrains/jetbrainsmono-wght.woff2`,"jetbrains-mono-italic":`/jetbrains/jetbrainsmono-italic-wght.woff2`,"family-regular":`/family/family-regular.woff2`,"family-italic":`/family/family-italic.woff2`};function b(e){let t=e.startsWith(`/`)?e:`/${e}`;return`${v}${t}`}function x(e){return`<${b(y[e])}>; rel=preload; as=font; type="font/woff2"; crossorigin`}const S=e=>{let t=h(4),{name:n}=e,r=y[n],i;t[0]===r?i=t[1]:(i=b(r),t[0]=r,t[1]=i);let a;return t[2]===i?a=t[3]:(a=/* @__PURE__ */ g(`link`,{rel:`preload`,href:i,as:`font`,type:`font/woff2`,crossOrigin:`anonymous`}),t[2]=i,t[3]=a),a};export{n as $resolvedTheme,r as $theme,S as PreloadFont,p as PreventWrongThemeFlashScript,l as ThemeProvider,_ as assetsCdnOrigin,d as extractThemeCookie,b as fontHref,o as getStoredTheme,c as isResolvedTheme,a as isTheme,x as preloadFontLink,t as preventWrongThemeFlashScriptContent,u as readThemeFromHtmlElement,i as resolvedThemes,e as themes,f as useAppliedTheme,s as useInitialHtmlThemeProps,m as useTheme};
1
+ import{_ as e,a as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,r as d,s as f,t as p,u as m}from"./theme-C-glc5Q-.js";import{c as h}from"react/compiler-runtime";import{jsx as g}from"react/jsx-runtime";const _=`https://assets.ngrok.com`,v=`${_}/fonts`,y={roobert:`/roobert/roobert-proportional-vf.woff2`,"jetbrains-mono":`/jetbrains/jetbrainsmono-wght.woff2`,"jetbrains-mono-italic":`/jetbrains/jetbrainsmono-italic-wght.woff2`,"family-regular":`/family/family-regular.woff2`,"family-italic":`/family/family-italic.woff2`};function b(e){let t=e.startsWith(`/`)?e:`/${e}`;return`${v}${t}`}function x(e){return`<${b(y[e])}>; rel=preload; as=font; type="font/woff2"; crossorigin`}const S=e=>{let t=h(4),{name:n}=e,r=y[n],i;t[0]===r?i=t[1]:(i=b(r),t[0]=r,t[1]=i);let a;return t[2]===i?a=t[3]:(a=/* @__PURE__ */ g(`link`,{rel:`preload`,href:i,as:`font`,type:`font/woff2`,crossOrigin:`anonymous`}),t[2]=i,t[3]=a),a};export{n as $resolvedTheme,r as $theme,S as PreloadFont,p as PreventWrongThemeFlashScript,l as ThemeProvider,_ as assetsCdnOrigin,d as extractThemeCookie,b as fontHref,o as getStoredTheme,c as isResolvedTheme,a as isTheme,x as preloadFontLink,t as preventWrongThemeFlashScriptContent,u as readThemeFromHtmlElement,i as resolvedThemes,e as themes,f as useAppliedTheme,s as useInitialHtmlThemeProps,m as useTheme};
package/dist/toast.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./icon-kK0c-POG.js";import{t as r}from"./slot-DdYN1L1C.js";import{s as i}from"./theme-CwtpudOH.js";import{c as a}from"react/compiler-runtime";import{createContext as o,useContext as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{CheckCircleIcon as u}from"@phosphor-icons/react/CheckCircle";import{InfoIcon as d}from"@phosphor-icons/react/Info";import{WarningIcon as f}from"@phosphor-icons/react/Warning";import{WarningDiamondIcon as p}from"@phosphor-icons/react/WarningDiamond";import{Toaster as m,toast as h}from"sonner";function g(e){return typeof e==`number`&&e<=0?1/0:e}const _=t=>{let n=a(13),{className:r,containerAriaLabel:o,dir:s,duration_ms:l,position:u,style:d}=t,f=l===void 0?4e3:l,p=u===void 0?`top-center`:u,h=i(),_;n[0]===r?_=n[1]:(_=e(`toaster overlay-prompt pointer-events-auto *:duration-200`,r),n[0]=r,n[1]=_);let v;n[2]===f?v=n[3]:(v=g(f),n[2]=f,n[3]=v);let y=p??`top-center`,b;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(b={unstyled:!0},n[4]=b):b=n[4];let x;return n[5]!==o||n[6]!==s||n[7]!==d||n[8]!==_||n[9]!==v||n[10]!==y||n[11]!==h?(x=/* @__PURE__ */ c(m,{"data-slot":`toaster`,className:_,containerAriaLabel:o,dir:s,duration:v,gap:12,position:y,style:d,theme:h,toastOptions:b}),n[5]=o,n[6]=s,n[7]=d,n[8]=_,n[9]=v,n[10]=y,n[11]=h,n[12]=x):x=n[12],x},v=o(``);function y(e,t){let n=g(t?.duration_ms);return h.custom(t=>/* @__PURE__ */ c(v.Provider,{value:t,children:e}),{duration:n,...t?.id?{id:t.id}:{},unstyled:!0})}const b=o({intent:`info`}),x={Root:n=>{let r=a(27),i,o,s,u,d,f;r[0]===n?(i=r[1],o=r[2],s=r[3],u=r[4],d=r[5],f=r[6]):({"data-slot":s,children:i,className:o,intent:u,ref:f,...d}=n,r[0]=n,r[1]=i,r[2]=o,r[3]=s,r[4]=u,r[5]=d,r[6]=f);let p;r[7]===u?p=r[8]:(p={intent:u},r[7]=u,r[8]=p);let m=p,h;r[9]===s?h=r[10]:(h=t(s,`toast`),r[9]=s,r[10]=h);let g;r[11]===o?g=r[12]:(g=e(`relative flex items-start gap-2 text-sm font-sans`,`p-3 pl-3.75`,`bg-popover rounded rounded-r-[0.3125rem] border border-gray-500/35 shadow-lg`,o),r[11]=o,r[12]=g);let _;r[13]===u?_=r[14]:(_=/* @__PURE__ */ c(C,{intent:u}),r[13]=u,r[14]=_);let v;r[15]===i?v=r[16]:(v=/* @__PURE__ */ c(`div`,{"data-slot":`toast-label`,className:`contents`,children:i}),r[15]=i,r[16]=v);let y;r[17]!==d||r[18]!==f||r[19]!==h||r[20]!==g||r[21]!==_||r[22]!==v?(y=/* @__PURE__ */ l(`div`,{"data-slot":h,className:g,ref:f,...d,children:[_,v]}),r[17]=d,r[18]=f,r[19]=h,r[20]=g,r[21]=_,r[22]=v,r[23]=y):y=r[23];let x;return r[24]!==m||r[25]!==y?(x=/* @__PURE__ */ c(b.Provider,{value:m,children:y}),r[24]=m,r[25]=y,r[26]=x):x=r[26],x},Action:n=>{let i=a(21),o,l,u,d,f,p;i[0]===n?(o=i[1],l=i[2],u=i[3],d=i[4],f=i[5],p=i[6]):({"data-slot":u,asChild:o,className:l,onClick:d,ref:p,...f}=n,i[0]=n,i[1]=o,i[2]=l,i[3]=u,i[4]=d,i[5]=f,i[6]=p);let m=s(v),g=o?r:`button`,_;i[7]===u?_=i[8]:(_=t(u,`toast-action`),i[7]=u,i[8]=_);let y;i[9]===l?y=i[10]:(y=e(`shrink-0`,`data-icon-button:-mr-0.5 data-icon-button:-mt-0.5 data-icon-button:rounded-xs`,l),i[9]=l,i[10]=y);let b;i[11]!==m||i[12]!==d?(b=e=>{d?.(e),!e.defaultPrevented&&h.dismiss(m)},i[11]=m,i[12]=d,i[13]=b):b=i[13];let x;return i[14]!==g||i[15]!==f||i[16]!==p||i[17]!==_||i[18]!==y||i[19]!==b?(x=/* @__PURE__ */ c(g,{"data-slot":_,className:y,onClick:b,ref:p,...f}),i[14]=g,i[15]=f,i[16]=p,i[17]=_,i[18]=y,i[19]=b,i[20]=x):x=i[20],x},Icon:r=>{let i=a(54),o,l,m,h,g;i[0]===r?(o=i[1],l=i[2],m=i[3],h=i[4],g=i[5]):({"data-slot":l,className:o,svg:g,ref:h,...m}=r,i[0]=r,i[1]=o,i[2]=l,i[3]=m,i[4]=h,i[5]=g);let _=s(b);switch(_.intent){case`danger`:{let r;i[6]===l?r=i[7]:(r=t(l,`toast-icon`),i[6]=l,i[7]=r);let a;i[8]===o?a=i[9]:(a=e(`text-danger-600`,o),i[8]=o,i[9]=a);let s;i[10]===g?s=i[11]:(s=g??/* @__PURE__ */ c(f,{weight:`fill`}),i[10]=g,i[11]=s);let u;return i[12]!==m||i[13]!==h||i[14]!==r||i[15]!==a||i[16]!==s?(u=/* @__PURE__ */ c(n,{"data-slot":r,className:a,ref:h,svg:s,...m}),i[12]=m,i[13]=h,i[14]=r,i[15]=a,i[16]=s,i[17]=u):u=i[17],u}case`warning`:{let r;i[18]===l?r=i[19]:(r=t(l,`toast-icon`),i[18]=l,i[19]=r);let a;i[20]===o?a=i[21]:(a=e(`text-warning-600`,o),i[20]=o,i[21]=a);let s;i[22]===g?s=i[23]:(s=g??/* @__PURE__ */ c(p,{weight:`fill`}),i[22]=g,i[23]=s);let u;return i[24]!==m||i[25]!==h||i[26]!==r||i[27]!==a||i[28]!==s?(u=/* @__PURE__ */ c(n,{"data-slot":r,className:a,ref:h,svg:s,...m}),i[24]=m,i[25]=h,i[26]=r,i[27]=a,i[28]=s,i[29]=u):u=i[29],u}case`success`:{let r;i[30]===l?r=i[31]:(r=t(l,`toast-icon`),i[30]=l,i[31]=r);let a;i[32]===o?a=i[33]:(a=e(`text-success-600`,o),i[32]=o,i[33]=a);let s;i[34]===g?s=i[35]:(s=g??/* @__PURE__ */ c(u,{weight:`fill`}),i[34]=g,i[35]=s);let d;return i[36]!==m||i[37]!==h||i[38]!==r||i[39]!==a||i[40]!==s?(d=/* @__PURE__ */ c(n,{"data-slot":r,className:a,ref:h,svg:s,...m}),i[36]=m,i[37]=h,i[38]=r,i[39]=a,i[40]=s,i[41]=d):d=i[41],d}case`info`:{let r;i[42]===l?r=i[43]:(r=t(l,`toast-icon`),i[42]=l,i[43]=r);let a;i[44]===o?a=i[45]:(a=e(`text-accent-600`,o),i[44]=o,i[45]=a);let s;i[46]===g?s=i[47]:(s=g??/* @__PURE__ */ c(d,{weight:`fill`}),i[46]=g,i[47]=s);let u;return i[48]!==m||i[49]!==h||i[50]!==r||i[51]!==a||i[52]!==s?(u=/* @__PURE__ */ c(n,{"data-slot":r,className:a,ref:h,svg:s,...m}),i[48]=m,i[49]=h,i[50]=r,i[51]=a,i[52]=s,i[53]=u):u=i[53],u}default:throw Error(`Unreachable Case: ${String(_.intent)}`)}},Message:n=>{let i=a(16),o,s,l,u,d;i[0]===n?(o=i[1],s=i[2],l=i[3],u=i[4],d=i[5]):({"data-slot":l,asChild:o,className:s,ref:d,...u}=n,i[0]=n,i[1]=o,i[2]=s,i[3]=l,i[4]=u,i[5]=d);let f=o?r:`p`,p;i[6]===l?p=i[7]:(p=t(l,`toast-message`),i[6]=l,i[7]=p);let m;i[8]===s?m=i[9]:(m=e(`text-strong flex-1 text-sm font-body`,s),i[8]=s,i[9]=m);let h;return i[10]!==f||i[11]!==u||i[12]!==d||i[13]!==p||i[14]!==m?(h=/* @__PURE__ */ c(f,{"data-slot":p,className:m,ref:d,...u}),i[10]=f,i[11]=u,i[12]=d,i[13]=p,i[14]=m,i[15]=h):h=i[15],h}},S={info:`bg-accent-600`,warning:`bg-warning-600`,success:`bg-success-600`,danger:`bg-danger-600`};function C(t){let n=a(10),r,i,o;n[0]===t?(r=n[1],i=n[2],o=n[3]):({className:r,intent:i,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o);let s=S[i],l;n[4]!==r||n[5]!==s?(l=e(`z-1 absolute -inset-px right-auto w-1.5 rounded-l`,s,r),n[4]=r,n[5]=s,n[6]=l):l=n[6];let u;return n[7]!==o||n[8]!==l?(u=/* @__PURE__ */ c(`div`,{"aria-hidden":!0,className:l,...o}),n[7]=o,n[8]=l,n[9]=u):u=n[9],u}export{x as Toast,_ as Toaster,y as makeToast};
1
+ import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./icon-kK0c-POG.js";import{t as r}from"./slot-DdYN1L1C.js";import{s as i}from"./theme-C-glc5Q-.js";import{c as a}from"react/compiler-runtime";import{createContext as o,useContext as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{CheckCircleIcon as u}from"@phosphor-icons/react/CheckCircle";import{InfoIcon as d}from"@phosphor-icons/react/Info";import{WarningIcon as f}from"@phosphor-icons/react/Warning";import{WarningDiamondIcon as p}from"@phosphor-icons/react/WarningDiamond";import{Toaster as m,toast as h}from"sonner";function g(e){return typeof e==`number`&&e<=0?1/0:e}const _=t=>{let n=a(13),{className:r,containerAriaLabel:o,dir:s,duration_ms:l,position:u,style:d}=t,f=l===void 0?4e3:l,p=u===void 0?`top-center`:u,h=i(),_;n[0]===r?_=n[1]:(_=e(`toaster overlay-prompt pointer-events-auto *:duration-200`,r),n[0]=r,n[1]=_);let v;n[2]===f?v=n[3]:(v=g(f),n[2]=f,n[3]=v);let y=p??`top-center`,b;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(b={unstyled:!0},n[4]=b):b=n[4];let x;return n[5]!==o||n[6]!==s||n[7]!==d||n[8]!==_||n[9]!==v||n[10]!==y||n[11]!==h?(x=/* @__PURE__ */ c(m,{"data-slot":`toaster`,className:_,containerAriaLabel:o,dir:s,duration:v,gap:12,position:y,style:d,theme:h,toastOptions:b}),n[5]=o,n[6]=s,n[7]=d,n[8]=_,n[9]=v,n[10]=y,n[11]=h,n[12]=x):x=n[12],x},v=o(``);function y(e,t){let n=g(t?.duration_ms);return h.custom(t=>/* @__PURE__ */ c(v.Provider,{value:t,children:e}),{duration:n,...t?.id?{id:t.id}:{},unstyled:!0})}const b=o({intent:`info`}),x={Root:n=>{let r=a(27),i,o,s,u,d,f;r[0]===n?(i=r[1],o=r[2],s=r[3],u=r[4],d=r[5],f=r[6]):({"data-slot":s,children:i,className:o,intent:u,ref:f,...d}=n,r[0]=n,r[1]=i,r[2]=o,r[3]=s,r[4]=u,r[5]=d,r[6]=f);let p;r[7]===u?p=r[8]:(p={intent:u},r[7]=u,r[8]=p);let m=p,h;r[9]===s?h=r[10]:(h=t(s,`toast`),r[9]=s,r[10]=h);let g;r[11]===o?g=r[12]:(g=e(`relative flex items-start gap-2 text-sm font-sans`,`p-3 pl-3.75`,`bg-popover rounded rounded-r-[0.3125rem] border border-gray-500/35 shadow-lg`,o),r[11]=o,r[12]=g);let _;r[13]===u?_=r[14]:(_=/* @__PURE__ */ c(C,{intent:u}),r[13]=u,r[14]=_);let v;r[15]===i?v=r[16]:(v=/* @__PURE__ */ c(`div`,{"data-slot":`toast-label`,className:`contents`,children:i}),r[15]=i,r[16]=v);let y;r[17]!==d||r[18]!==f||r[19]!==h||r[20]!==g||r[21]!==_||r[22]!==v?(y=/* @__PURE__ */ l(`div`,{"data-slot":h,className:g,ref:f,...d,children:[_,v]}),r[17]=d,r[18]=f,r[19]=h,r[20]=g,r[21]=_,r[22]=v,r[23]=y):y=r[23];let x;return r[24]!==m||r[25]!==y?(x=/* @__PURE__ */ c(b.Provider,{value:m,children:y}),r[24]=m,r[25]=y,r[26]=x):x=r[26],x},Action:n=>{let i=a(21),o,l,u,d,f,p;i[0]===n?(o=i[1],l=i[2],u=i[3],d=i[4],f=i[5],p=i[6]):({"data-slot":u,asChild:o,className:l,onClick:d,ref:p,...f}=n,i[0]=n,i[1]=o,i[2]=l,i[3]=u,i[4]=d,i[5]=f,i[6]=p);let m=s(v),g=o?r:`button`,_;i[7]===u?_=i[8]:(_=t(u,`toast-action`),i[7]=u,i[8]=_);let y;i[9]===l?y=i[10]:(y=e(`shrink-0`,`data-icon-button:-mr-0.5 data-icon-button:-mt-0.5 data-icon-button:rounded-xs`,l),i[9]=l,i[10]=y);let b;i[11]!==m||i[12]!==d?(b=e=>{d?.(e),!e.defaultPrevented&&h.dismiss(m)},i[11]=m,i[12]=d,i[13]=b):b=i[13];let x;return i[14]!==g||i[15]!==f||i[16]!==p||i[17]!==_||i[18]!==y||i[19]!==b?(x=/* @__PURE__ */ c(g,{"data-slot":_,className:y,onClick:b,ref:p,...f}),i[14]=g,i[15]=f,i[16]=p,i[17]=_,i[18]=y,i[19]=b,i[20]=x):x=i[20],x},Icon:r=>{let i=a(54),o,l,m,h,g;i[0]===r?(o=i[1],l=i[2],m=i[3],h=i[4],g=i[5]):({"data-slot":l,className:o,svg:g,ref:h,...m}=r,i[0]=r,i[1]=o,i[2]=l,i[3]=m,i[4]=h,i[5]=g);let _=s(b);switch(_.intent){case`danger`:{let r;i[6]===l?r=i[7]:(r=t(l,`toast-icon`),i[6]=l,i[7]=r);let a;i[8]===o?a=i[9]:(a=e(`text-danger-600`,o),i[8]=o,i[9]=a);let s;i[10]===g?s=i[11]:(s=g??/* @__PURE__ */ c(f,{weight:`fill`}),i[10]=g,i[11]=s);let u;return i[12]!==m||i[13]!==h||i[14]!==r||i[15]!==a||i[16]!==s?(u=/* @__PURE__ */ c(n,{"data-slot":r,className:a,ref:h,svg:s,...m}),i[12]=m,i[13]=h,i[14]=r,i[15]=a,i[16]=s,i[17]=u):u=i[17],u}case`warning`:{let r;i[18]===l?r=i[19]:(r=t(l,`toast-icon`),i[18]=l,i[19]=r);let a;i[20]===o?a=i[21]:(a=e(`text-warning-600`,o),i[20]=o,i[21]=a);let s;i[22]===g?s=i[23]:(s=g??/* @__PURE__ */ c(p,{weight:`fill`}),i[22]=g,i[23]=s);let u;return i[24]!==m||i[25]!==h||i[26]!==r||i[27]!==a||i[28]!==s?(u=/* @__PURE__ */ c(n,{"data-slot":r,className:a,ref:h,svg:s,...m}),i[24]=m,i[25]=h,i[26]=r,i[27]=a,i[28]=s,i[29]=u):u=i[29],u}case`success`:{let r;i[30]===l?r=i[31]:(r=t(l,`toast-icon`),i[30]=l,i[31]=r);let a;i[32]===o?a=i[33]:(a=e(`text-success-600`,o),i[32]=o,i[33]=a);let s;i[34]===g?s=i[35]:(s=g??/* @__PURE__ */ c(u,{weight:`fill`}),i[34]=g,i[35]=s);let d;return i[36]!==m||i[37]!==h||i[38]!==r||i[39]!==a||i[40]!==s?(d=/* @__PURE__ */ c(n,{"data-slot":r,className:a,ref:h,svg:s,...m}),i[36]=m,i[37]=h,i[38]=r,i[39]=a,i[40]=s,i[41]=d):d=i[41],d}case`info`:{let r;i[42]===l?r=i[43]:(r=t(l,`toast-icon`),i[42]=l,i[43]=r);let a;i[44]===o?a=i[45]:(a=e(`text-accent-600`,o),i[44]=o,i[45]=a);let s;i[46]===g?s=i[47]:(s=g??/* @__PURE__ */ c(d,{weight:`fill`}),i[46]=g,i[47]=s);let u;return i[48]!==m||i[49]!==h||i[50]!==r||i[51]!==a||i[52]!==s?(u=/* @__PURE__ */ c(n,{"data-slot":r,className:a,ref:h,svg:s,...m}),i[48]=m,i[49]=h,i[50]=r,i[51]=a,i[52]=s,i[53]=u):u=i[53],u}default:throw Error(`Unreachable Case: ${String(_.intent)}`)}},Message:n=>{let i=a(16),o,s,l,u,d;i[0]===n?(o=i[1],s=i[2],l=i[3],u=i[4],d=i[5]):({"data-slot":l,asChild:o,className:s,ref:d,...u}=n,i[0]=n,i[1]=o,i[2]=s,i[3]=l,i[4]=u,i[5]=d);let f=o?r:`p`,p;i[6]===l?p=i[7]:(p=t(l,`toast-message`),i[6]=l,i[7]=p);let m;i[8]===s?m=i[9]:(m=e(`text-strong flex-1 text-sm font-body`,s),i[8]=s,i[9]=m);let h;return i[10]!==f||i[11]!==u||i[12]!==d||i[13]!==p||i[14]!==m?(h=/* @__PURE__ */ c(f,{"data-slot":p,className:m,ref:d,...u}),i[10]=f,i[11]=u,i[12]=d,i[13]=p,i[14]=m,i[15]=h):h=i[15],h}},S={info:`bg-accent-600`,warning:`bg-warning-600`,success:`bg-success-600`,danger:`bg-danger-600`};function C(t){let n=a(10),r,i,o;n[0]===t?(r=n[1],i=n[2],o=n[3]):({className:r,intent:i,...o}=t,n[0]=t,n[1]=r,n[2]=i,n[3]=o);let s=S[i],l;n[4]!==r||n[5]!==s?(l=e(`z-1 absolute -inset-px right-auto w-1.5 rounded-l`,s,r),n[4]=r,n[5]=s,n[6]=l):l=n[6];let u;return n[7]!==o||n[8]!==l?(u=/* @__PURE__ */ c(`div`,{"aria-hidden":!0,className:l,...o}),n[7]=o,n[8]=l,n[9]=u):u=n[9],u}export{x as Toast,_ as Toaster,y as makeToast};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngrok/mantle",
3
- "version": "0.93.0",
3
+ "version": "0.93.2",
4
4
  "description": "mantle is ngrok's UI library and design system.",
5
5
  "homepage": "https://mantle.ngrok.com",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- import{n as e}from"./browser-only-BTSrYWLj.js";import{t}from"./cx-CK7o_rVv.js";import{t as n}from"./use-matches-media-query-m860lols.js";import{n as r,t as i}from"./cookie-ca4g5CKp.js";import{t as a}from"./use-prefers-reduced-motion-CU6mWmOe.js";import{c as o}from"react/compiler-runtime";import{createContext as s,useContext as c,useEffect as l,useRef as u,useState as d}from"react";import f from"tiny-invariant";import{jsx as p}from"react/jsx-runtime";import{flushSync as m}from"react-dom";let h=null;function g(e,{origin:t}={}){if(typeof document.startViewTransition!=`function`||a()||document.visibilityState!==`visible`){e();return}if(h!=null){h.skipTransition(),h.updateCallbackDone.finally(()=>m(e));return}let n=document.documentElement,r={width:window.innerWidth,height:window.innerHeight},i=v(_(t,r),r);n.dataset.themeTransition=``;let o=document.startViewTransition(()=>m(e));h=o;function s(e){if(e.target!==n)return;o.skipTransition();let t=document.elementFromPoint(e.clientX,e.clientY);t!=null&&t!==n&&t.dispatchEvent(new MouseEvent(`click`,e))}document.addEventListener(`click`,s,{capture:!0});let c=o.ready.then(()=>n.animate({clipPath:[i.from,i.to]},{duration:400,easing:`ease-out`,pseudoElement:`::view-transition-new(root)`}),()=>void 0),l=async()=>{(await c)?.cancel(),document.removeEventListener(`click`,s,{capture:!0}),h=null,delete n.dataset.themeTransition};o.finished.finally(()=>{l()})}function _(e,t){let n=document.activeElement,r=e??(n!=null&&n!==document.body?n:void 0);return r==null?{left:t.width/2,top:t.height/2,width:0,height:0}:r.getBoundingClientRect()}function v(e,t){let n=e.left+e.width/2,r=e.top+e.height/2,i=Math.hypot(Math.max(n,t.width-n),Math.max(r,t.height-r)),a=`at ${n}px ${r}px`;return{from:`circle(0px ${a})`,to:`circle(${Math.round(i*100)/100}px ${a})`}}const y=[`light`,`dark`],b=[`system`,...y],x=e=>e;function S(e){return typeof e==`string`&&b.some(t=>t===e)}const C=e=>e;function w(e){return typeof e==`string`&&y.some(t=>t===e)}function T({theme:e,prefersDarkMode:t}){let n=t?`dark`:`light`,r=(e===`system`?n:e)===`dark`?`light`:`dark`;return r===n?`system`:r}const E=`(prefers-color-scheme: dark)`,D=`mantle-ui-theme`,O=`system`,k={system:`system`,light:`light`,dark:`dark`,"light-high-contrast":`light`,"dark-high-contrast":`dark`},A=s(null),j=s(void 0);function M(t){let n=o(18),{children:i,forceTheme:a,ssrCookie:s}=t,c;n[0]!==a||n[1]!==s?(c=()=>{let t=U({cookie:e()?document.cookie:s});return P(t,{forceTheme:a}),t},n[0]=a,n[1]=s,n[2]=c):c=n[2];let[f,m]=d(c),h=u(null),_,v;n[3]===a?(_=n[4],v=n[5]):(_=()=>{let e=function(){let e=U({cookie:document.cookie});m(e),P(e,{forceTheme:a})};e();let t=r(document.cookie,D);t!=null&&!S(t)&&Object.hasOwn(k,t)&&Y(U({cookie:document.cookie}));try{`BroadcastChannel`in window&&(h.current=new BroadcastChannel(D),h.current.addEventListener(`message`,e))}catch{}let n=function(t){t.key===`${D}__ping`&&e()};window.addEventListener(`storage`,n);let i=window.matchMedia(E),o=function(){e()},s=function(){document.visibilityState===`visible`&&e()};return i.addEventListener(`change`,o),window.addEventListener(`pageshow`,o),document.addEventListener(`visibilitychange`,s),()=>{window.removeEventListener(`storage`,n),i.removeEventListener(`change`,o),window.removeEventListener(`pageshow`,o),document.removeEventListener(`visibilitychange`,s),X(h.current),h.current=null}},v=[a],n[3]=a,n[4]=_,n[5]=v),l(_,v);let y;n[6]!==a||n[7]!==f?(y=(e,t)=>{let{origin:n}=t===void 0?{}:t,r=()=>{if(typeof e!=`function`)return e;let t=document.documentElement.dataset.theme;return e(S(t)?t:f)},i=()=>{let e=r();Y(e),m(e),P(e,{forceTheme:a}),G(e,{broadcastChannel:h.current,pingKey:`${D}__ping`})},o=window.matchMedia(E).matches;(a??I(r(),{prefersDarkMode:o}))===document.documentElement.dataset.appliedTheme?i():g(i,{origin:n})},n[6]=a,n[7]=f,n[8]=y):y=n[8];let b;n[9]!==y||n[10]!==f?(b=[f,y],n[9]=y,n[10]=f,n[11]=b):b=n[11];let x=b,C;n[12]!==i||n[13]!==x?(C=/* @__PURE__ */ p(A.Provider,{value:x,children:i}),n[12]=i,n[13]=x,n[14]=C):C=n[14];let w;return n[15]!==a||n[16]!==C?(w=/* @__PURE__ */ p(j.Provider,{value:a,children:C}),n[15]=a,n[16]=C,n[17]=w):w=n[17],w}function N(){let e=c(A);return f(e,`useTheme must be used within a ThemeProvider`),e}function P(t,{forceTheme:n}={}){if(!e())return;let r=window.document.documentElement,i=window.matchMedia(E).matches,a=n??I(t,{prefersDarkMode:i}),o=r.dataset.theme,s=r.dataset.appliedTheme,c=S(o)?o:void 0,l=w(s)?s:void 0;(c!==t||l!==a)&&(r.classList.remove(...y),r.classList.add(a),r.dataset.theme=t,r.dataset.appliedTheme=a)}function F(){if(!e())return{appliedTheme:void 0,theme:void 0};let t=window.document.documentElement,n=S(t.dataset.theme)?t.dataset.theme:void 0;return{appliedTheme:w(t.dataset.appliedTheme)?t.dataset.appliedTheme:void 0,theme:n}}function I(e,{prefersDarkMode:t}){return e===`system`?t?`dark`:`light`:e}function L(){let e=o(4),t=c(A),r=R(),i=t==null?`system`:t[0],a=n(E),s;return e[0]!==r||e[1]!==a||e[2]!==i?(s=r??I(i,{prefersDarkMode:a}),e[0]=r,e[1]=a,e[2]=i,e[3]=s):s=e[3],s}function R(){return c(j)}function z({storageKey:e,themeByCookieValue:t,forceTheme:n}){let r=`system`;try{let n=document.cookie.split(`;`).map(e=>e.trim()).find(t=>t.startsWith(`${e}=`)),i=decodeURIComponent(n?.slice(e.length+1)??``);Object.hasOwn(t,i)&&(r=t[i]??`system`)}catch{}let i=matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;n==null?r!==`system`&&(i=r):i=n;let a=document.documentElement;a.classList.remove(`light`,`dark`),a.classList.add(i),a.dataset.theme=r,a.dataset.appliedTheme=i}function B(e){let t={storageKey:D,themeByCookieValue:k,forceTheme:e};return`(${z.toString()})(${JSON.stringify(t)})`}const V=e=>{let t=o(7),{forceTheme:n,nonce:r}=e,i;t[0]===n?i=t[1]:(i=B(n),t[0]=n,t[1]=i);let a;t[2]===i?a=t[3]:(a={__html:i},t[2]=i,t[3]=a);let s;return t[4]!==r||t[5]!==a?(s=/* @__PURE__ */ p(`script`,{dangerouslySetInnerHTML:a,nonce:r,suppressHydrationWarning:!0}),t[4]=r,t[5]=a,t[6]=s):s=t[6],s};function H(n){let r=o(16),i;r[0]===n?i=r[1]:(i=n===void 0?{}:n,r[0]=n,r[1]=i);let a=i,s;r[2]===a?s=r[3]:(s=a??{},r[2]=a,r[3]=s);let{className:c,forceTheme:l,ssrCookie:u}=s,d=c===void 0?``:c,f,p;if(e()){let e;if(r[7]===Symbol.for(`react.memo_cache_sentinel`)){let t=window.matchMedia(E).matches;f=U({cookie:document.cookie}),e=I(f,{prefersDarkMode:t}),r[7]=e,r[8]=f}else e=r[7],f=r[8];p=e}else{let e;r[4]===u?(e=r[5],f=r[6]):(f=U({cookie:u}),e=I(f,{prefersDarkMode:!1}),r[4]=u,r[5]=e,r[6]=f),p=e}let m=l??p,h;r[9]!==m||r[10]!==d?(h=t(d,m),r[9]=m,r[10]=d,r[11]=h):h=r[11];let g;return r[12]!==m||r[13]!==f||r[14]!==h?(g={className:h,"data-applied-theme":m,"data-theme":f},r[12]=m,r[13]=f,r[14]=h,r[15]=g):g=r[15],g}function U({cookie:e}){if(!e)return O;let t=r(e,D);return t==null||!Object.hasOwn(k,t)?O:k[t]??O}function W(e){return i(e,D)}function G(e,t){let{broadcastChannel:n,pingKey:r}=t;try{if(n){n.postMessage({theme:e,timestamp:Date.now()});return}}catch{}try{localStorage.setItem(r,JSON.stringify({theme:e,timestamp:Date.now()}))}catch{}}const K=[`ngrok.com`,`ngrok.ai`];function q(e){let t=K.find(t=>e===t||e.endsWith(`.${t}`));return t==null?void 0:`.${t}`}function J(e){let t=/* @__PURE__ */ new Date;t.setFullYear(t.getFullYear()+1);let{hostname:n,protocol:r}=window.location,i=q(n),a=i==null?``:`; domain=${i}`,o=r===`https:`?`; Secure`:``;return`${D}=${encodeURIComponent(e)}; expires=${t.toUTCString()}; path=/${a}; SameSite=Lax${o}`}function Y(t){if(e())try{document.cookie=J(t)}catch{}}function X(e){if(e!=null)try{e.close()}catch{}}export{b as _,B as a,R as c,C as d,x as f,y as g,S as h,U as i,H as l,w as m,M as n,F as o,T as p,W as r,L as s,V as t,N as u};