@ngrok/mantle 0.81.0 → 0.82.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/dist/accordion.d.ts +6 -6
- package/dist/accordion.js +1 -1
- package/dist/agent.json +4 -1
- package/dist/alert-BWwNPOMI.d.ts +391 -0
- package/dist/alert-QMs0PqMq.js +1 -0
- package/dist/alert-center.d.ts +449 -0
- package/dist/alert-center.js +1 -0
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +1 -288
- package/dist/alert.js +1 -1
- package/dist/{anchor-DfeXTpKW.js → anchor-DvbNsphX.js} +1 -1
- package/dist/anchor.js +1 -1
- package/dist/app-layout.d.ts +483 -0
- package/dist/app-layout.js +1 -0
- package/dist/area-chart.d.ts +4 -3
- package/dist/area-chart.js +1 -1
- package/dist/badge.js +1 -1
- package/dist/bar-chart.d.ts +4 -3
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only-CmEEzfU3.js +1 -0
- package/dist/browser-only.js +1 -1
- package/dist/{button-D9n09xUg.js → button-BO2CKsz6.js} +1 -1
- package/dist/{button-DjpEKt2X.js → button-BUospUB3.js} +1 -1
- package/dist/{button-BAno7KIU.js → button-C0S8RbaJ.js} +1 -1
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +9 -9
- package/dist/centered-layout.js +1 -1
- package/dist/{chart-BcOC6Qj0.d.ts → chart-1cVjAcj8.d.ts} +81 -22
- package/dist/chart-DdBQ3xwx.js +2 -0
- package/dist/checkbox.d.ts +12 -0
- package/dist/{choice-BHwFSSyv.js → choice-C9gLKECf.js} +1 -1
- package/dist/choice.js +1 -1
- package/dist/code-block.d.ts +46 -0
- package/dist/code-block.js +1 -1
- package/dist/code.js +1 -1
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +67 -9
- package/dist/command.js +1 -1
- package/dist/{copy-to-clipboard-BsCQ9m6K.js → copy-to-clipboard-B4UB6pts.js} +1 -1
- package/dist/data-slot-EM6s2WEU.js +1 -0
- package/dist/data-table.d.ts +1 -1
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +36 -16
- package/dist/description-list.js +1 -1
- package/dist/{dialog-DWZWd5Jt.js → dialog-Bsj_dX6r.js} +1 -1
- package/dist/dialog.d.ts +1 -1
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-BbbQuae2.d.ts +1 -0
- package/dist/{dropdown-menu-DZg-Cd69.d.ts → dropdown-menu-D6pMAY7I.d.ts} +138 -0
- package/dist/dropdown-menu-fUMqjRC0.js +1 -0
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.js +1 -1
- package/dist/field.d.ts +12 -9
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +1 -1
- package/dist/hooks.js +1 -1
- package/dist/{icons-DLCs1hLP.js → icons-CPbOq7cF.js} +1 -1
- package/dist/icons.d.ts +52 -1
- package/dist/icons.js +1 -1
- package/dist/input.js +1 -1
- package/dist/line-chart.d.ts +4 -3
- package/dist/line-chart.js +1 -1
- package/dist/{list-51KQvENW.js → list-CQFWx6Z8.js} +1 -1
- package/dist/list.js +1 -1
- package/dist/llms.txt +4 -1
- package/dist/main.d.ts +4 -1
- package/dist/main.js +1 -1
- package/dist/mantle.css +21 -1
- package/dist/media-object.d.ts +42 -0
- package/dist/media-object.js +1 -1
- package/dist/multi-select.d.ts +10 -2
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +6 -7
- package/dist/pagination.js +1 -1
- package/dist/{primitive-trJDqIXJ.js → primitive-Dv-3snU3.js} +1 -1
- package/dist/progress.d.ts +8 -8
- package/dist/qr-code.js +1 -1
- package/dist/radio-group.d.ts +129 -0
- package/dist/radio-group.js +1 -1
- package/dist/sandboxed-on-click.d.ts +2 -2
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot.d.ts +4 -3
- package/dist/scatter-plot.js +1 -1
- package/dist/{select-BCHWvmyC.js → select-B-9yWrif.js} +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-bpE_kooz.js → separator-BepAcFFy.js} +1 -1
- package/dist/separator.js +1 -1
- package/dist/sheet-_fXLjiq2.js +1 -0
- package/dist/sheet.d.ts +11 -11
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +2084 -0
- package/dist/sidebar.js +1 -0
- package/dist/{skeleton-CsbUHbBA.js → skeleton-DsHXIa9j.js} +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slot-Dpsqz16D.js +1 -0
- package/dist/slot.js +1 -1
- package/dist/split-button.d.ts +147 -8
- package/dist/split-button.js +1 -1
- package/dist/{table-Bo0vNxIJ.d.ts → table-CZBYEmyK.d.ts} +2 -2
- package/dist/table.d.ts +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +1 -1
- package/dist/{theme-CYNpplwN.d.ts → theme-FbfjYiD3.d.ts} +16 -0
- package/dist/{theme-C26-Xolp.js → theme-IAnQ35bd.js} +1 -1
- package/dist/theme-switcher.d.ts +2 -2
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +42 -2
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +4 -0
- package/dist/toast.js +1 -1
- package/dist/types.js +1 -1
- package/dist/use-breakpoint-Wd7_5-Mu.js +1 -0
- package/dist/use-copy-to-clipboard-CSyp4Zk0.js +1 -0
- package/dist/use-is-hydrated-DDCqXmju.js +1 -0
- package/dist/{use-prefers-reduced-motion-CagaNRgm.js → use-prefers-reduced-motion-Bk5zAfHY.js} +1 -1
- package/dist/utils.js +1 -1
- package/dist/well.js +1 -1
- package/package.json +18 -15
- package/dist/browser-only-CPH56Xw_.js +0 -1
- package/dist/chart-BROa2gqt.js +0 -2
- package/dist/dropdown-menu-Dw-OtXPm.d.ts +0 -1
- package/dist/dropdown-menu-RyDWoKHx.js +0 -1
- package/dist/slot-CDk0Bb9z.js +0 -1
- package/dist/use-copy-to-clipboard-DqQ0_N3E.js +0 -1
package/dist/sidebar.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./slot-Dpsqz16D.js";import{t as r}from"./button-C0S8RbaJ.js";import{t as i}from"./use-is-hydrated-DDCqXmju.js";import{n as a}from"./separator-BepAcFFy.js";import{t as o}from"./sheet-_fXLjiq2.js";import{i as s,r as c}from"./use-breakpoint-Wd7_5-Mu.js";import{createContext as l,useCallback as u,useContext as d,useEffect as f,useId as p,useMemo as m,useRef as h,useState as g}from"react";import _ from"tiny-invariant";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{SidebarSimpleIcon as b}from"@phosphor-icons/react/SidebarSimple";const x={sm:`hidden sm:block`,md:`hidden md:block`,lg:`hidden lg:block`},S=l(null);function C(){let e=d(S);return _(e,`useSidebar must be used within Sidebar.Root.`),e}function w(e){let t=d(S);return _(t,`Sidebar.${e} must be rendered inside Sidebar.Root.`),t}const T=[];function E(){let e=Symbol(`sidebar-keyboard-shortcut`);return T.push(e),{isOwner:()=>T[0]===e,release:()=>{let t=T.indexOf(e);t!==-1&&T.splice(t,1)}}}const D=({children:e,defaultOpen:t=!0,keyboardShortcut:n=!0,mobileBreakpoint:r=`lg`,onOpenChange:i,onOpenMobileChange:a,open:o,openMobile:l})=>{let d=c(r),_=p(),y=o!=null,[b,x]=g(t),C=y?o:b,w=u(e=>{y||x(e),i?.(e)},[y,i]),T=l!=null,[D,O]=g(!1),k=T?l:D,A=u(e=>{T||O(e),a?.(e)},[T,a]),j=h(d);f(()=>{let e=j.current&&!d;j.current=d,e&&k&&A(!1)},[d,k,A]);let M=u(()=>{d?A(!k):w(!C)},[d,C,k,w,A]),N=s(M);f(()=>{if(!n)return;let e=E(),t=t=>{if(!e.isOwner())return;let n=t.metaKey||t.ctrlKey;t.key.toLowerCase()===`b`&&n&&!t.altKey&&!t.shiftKey&&(t.preventDefault(),N())};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t),e.release()}},[n,N]);let P=m(()=>({isMobile:d,mobileBreakpoint:r,navId:_,open:C,openMobile:k,setOpen:w,setOpenMobile:A,toggle:M}),[d,r,_,C,k,w,A,M]);return v(S.Provider,{value:P,children:e})},O=({"aria-label":n,"aria-labelledby":r,children:a,className:s,"data-slot":c,...l})=>{let{isMobile:u,mobileBreakpoint:d,navId:f,open:p,openMobile:m,setOpenMobile:h}=w(`Nav`),g=i(),_=n??(r==null?`Main`:void 0);return u?v(o.Root,{open:m,onOpenChange:h,children:y(o.Content,{side:`left`,preferredWidth:`sm:max-w-[var(--sidebar-width-mobile,18rem)]`,"data-slot":t(c,`sidebar-nav`),"data-mobile":``,...r==null?null:{"aria-labelledby":r},className:e(`bg-base w-[var(--sidebar-width-mobile,18rem)] max-w-full p-0`,s),...l,children:[v(o.Title,{className:`sr-only`,children:_??`Sidebar`}),v(`nav`,{id:f,"aria-label":_,"aria-labelledby":r,className:`flex h-full w-full min-w-0 flex-col text-sm`,children:a})]})}):v(`div`,{"data-slot":t(c,`sidebar-nav`),"data-state":p?`expanded`:`collapsed`,"data-hydrated":g?``:void 0,className:e(`group/sidebar-nav bg-base relative h-full w-[var(--sidebar-width,16rem)] shrink-0 overflow-hidden`,`data-[state=collapsed]:w-[var(--sidebar-width-icon,3.25rem)]`,!g&&x[d],g&&[`transition-[width] duration-200 ease-linear motion-reduce:transition-none`],s),...l,children:v(`nav`,{id:f,"aria-label":_,"aria-labelledby":r,className:`absolute inset-y-0 left-0 flex w-full min-w-0 flex-col text-sm`,children:a})})},k=v(b,{}),A=({appearance:e=`ghost`,"data-slot":n,icon:i=k,intent:a=`neutral`,label:o=`Toggle Sidebar`,onClick:s,...c})=>{let{isMobile:l,navId:u,open:d,openMobile:f,toggle:p}=w(`Trigger`),m=l?f:d;return v(r,{appearance:e,"aria-controls":!l||f?u:void 0,"aria-expanded":m,"data-slot":t(n,`sidebar-trigger`),"data-state":m?`expanded`:`collapsed`,icon:i,intent:a,label:o,onClick:e=>{s?.(e),e.defaultPrevented||p()},...c})},j=({asChild:r,children:i,className:a,"data-slot":o,...s})=>v(r?n:`div`,{"data-slot":t(o,`sidebar-header`),className:e(`flex h-[var(--sidebar-header-height,4.5rem)] shrink-0 flex-col justify-center gap-2 px-3`,`group-data-[state=expanded]/sidebar-nav:pr-1`,a),...s,children:i}),M=({asChild:r,children:i,className:a,"data-slot":o,...s})=>v(r?n:`div`,{"data-slot":t(o,`sidebar-body`),className:e(`scrollbar scrollbar-gutter-stable scroll-fade-y flex-1 scroll-py-6 space-y-2 overflow-y-auto overflow-x-hidden px-3 pt-1.5 pb-4`,`group-data-[state=expanded]/sidebar-nav:pr-1`,`group-data-[state=collapsed]/sidebar-nav:scrollbar-none`,`group-data-[state=collapsed]/sidebar-nav:scrollbar-gutter-auto`,`group-data-[state=collapsed]/sidebar-nav:[&::-webkit-scrollbar]:hidden`,a),...s,children:i}),N=({asChild:r,children:i,className:a,"data-slot":o,...s})=>v(r?n:`div`,{"data-slot":t(o,`sidebar-footer`),className:e(`shrink-0 px-3 pt-3 pb-3.5`,`group-data-[state=expanded]/sidebar-nav:pr-1`,a),...s,children:i}),P=l(null),F=({asChild:r,children:i,className:a,"data-slot":o,...s})=>{let[c,l]=g(null),u=m(()=>({mountedLabelId:c,setMountedLabelId:l}),[c]),d=r?n:`div`;return v(P.Provider,{value:u,children:v(d,{"data-slot":t(o,`sidebar-group`),className:e(`pt-0.5`,a),...s,children:i})})},I=({asChild:r,children:i,className:a,"data-slot":o,id:s,...c})=>{let l=d(P),u=p(),m=s??(l==null?void 0:u),h=l?.setMountedLabelId;return f(()=>{if(h!=null&&m!=null)return h(m),()=>{h(null)}},[h,m]),v(r?n:`div`,{id:m,"data-slot":t(o,`sidebar-group-label`),className:e(`text-muted flex min-w-0 items-center gap-2 truncate px-2 py-1 text-xs font-medium`,`group-data-[state=collapsed]/sidebar-nav:opacity-0`,`group-data-[state=collapsed]/sidebar-nav:pointer-events-none`,`group-data-[hydrated]/sidebar-nav:transition-opacity group-data-[hydrated]/sidebar-nav:duration-200 group-data-[hydrated]/sidebar-nav:ease-linear group-data-[hydrated]/sidebar-nav:motion-reduce:transition-none`,a),...c,children:i})},L=({"aria-labelledby":r,asChild:i,children:a,className:o,"data-slot":s,...c})=>{let l=d(P);return v(i?n:`ul`,{"aria-labelledby":r??l?.mountedLabelId??void 0,"data-slot":t(s,`sidebar-list`),className:e(`mb-2 space-y-px`,o),...c,children:a})},R=({asChild:r,children:i,className:a,"data-slot":o,...s})=>v(r?n:`li`,{"data-slot":t(o,`sidebar-item`),className:e(`list-none`,a),...s,children:i}),z=({asChild:r,children:i,className:a,current:o,"data-slot":s,type:c,...l})=>v(r?n:`button`,{"data-slot":t(s,`sidebar-item-button`),"data-current":o?``:void 0,"aria-current":o?`page`:void 0,type:r?c:c??`button`,className:e(`ring-focus-accent flex w-full min-w-0 items-center gap-2 truncate rounded-md px-2 py-1 text-left font-normal transition-none focus:outline-hidden focus-visible:ring-4`,`text-body hover:text-strong hover:bg-neutral-500/10`,`data-current:bg-neutral-500/15 data-current:text-strong`,`data-state-open:bg-neutral-500/15 data-state-open:text-strong`,`[&>svg]:text-muted hover:[&>svg]:text-strong data-current:[&>svg]:text-strong [&>svg:first-child]:size-5 [&>svg]:shrink-0`,`group-data-[state=collapsed]/sidebar-nav:ml-1`,`group-data-[state=collapsed]/sidebar-nav:w-7`,`group-data-[state=collapsed]/sidebar-nav:p-1`,a),...l,children:i}),B=({asChild:r,children:i,className:a,"data-slot":o,type:s,...c})=>v(r?n:`button`,{"data-slot":t(o,`sidebar-switcher-trigger`),type:r?s:s??`button`,className:e(`text-body hover:text-strong hover:bg-neutral-500/10 flex w-full min-w-0 items-center gap-2 [border-radius:0.625rem] py-1 pr-1.5 pl-1 text-left font-medium transition-none`,`data-state-open:bg-neutral-500/15 data-state-open:text-strong`,`ring-focus-accent focus:outline-hidden focus-visible:ring-4`,`[&>:first-child]:size-7`,`group-data-[state=collapsed]/sidebar-nav:w-9`,`group-data-[state=collapsed]/sidebar-nav:p-1`,`group-data-[state=collapsed]/sidebar-nav:[&>:not(:first-child)]:sr-only`,a),...c,children:i}),V=({className:t,...n})=>v(a,{"data-slot":`sidebar-separator`,className:e(`my-3`,`group-data-[state=collapsed]/sidebar-nav:w-9`,t),...n}),H=[`bg-emerald-500`,`bg-gray-500`,`bg-red-500`,`bg-violet-500`,`bg-cyan-500`,`bg-rose-500`,`bg-purple-500`,`bg-fuchsia-500`,`bg-green-500`,`bg-orange-500`,`bg-indigo-500`,`bg-teal-500`,`bg-yellow-500`,`bg-sky-500`,`bg-pink-500`,`bg-blue-500`,`bg-amber-500`];function U(e){let t=5381;for(let n=0;n<e.length;n+=1)t=t*33^e.charCodeAt(n);return t>>>0}function W(e){let t=U(e??``)%H.length;return H[t]??`bg-neutral-500`}function G(e){return(e??``).replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>{}[\]\\/]/gi,``).trim().split(` `).map(e=>e.trim()).filter(e=>e.length>0).slice(0,2).map(e=>Array.from(e)[0]??``).join(``).toUpperCase()||`?`}const K=({accountId:t,accountName:n,className:r,...i})=>v(`div`,{"data-slot":`sidebar-account-avatar`,className:e(`text-static-white flex size-7 shrink-0 items-center justify-center rounded-md text-xs font-medium`,W(t),r),"aria-hidden":`true`,...i,children:G(n)}),q=({className:t,...n})=>y(`svg`,{className:e(`block size-full`,t),viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...n,children:[v(`circle`,{cx:`12`,cy:`12`,r:`12`,opacity:.15}),v(`circle`,{cx:`12`,cy:`10`,r:`3.5`}),v(`path`,{d:`M5.25 19.5C6.6 16.7 9.1 15 12 15s5.4 1.7 6.75 4.5A12 12 0 0 1 12 22a12 12 0 0 1-6.75-2.5Z`})]}),J={Root:D,Nav:O,Trigger:A,Header:j,Body:M,Footer:N,Group:F,GroupLabel:I,List:L,Item:R,ItemButton:z,SwitcherTrigger:B,Separator:V,AccountAvatar:K,UserAvatar:({alt:t=`Your account`,className:n,src:r,...i})=>v(`div`,{"data-slot":`sidebar-user-avatar`,className:e(`text-muted bg-neutral-500/15 relative flex size-7 shrink-0 items-center justify-center overflow-hidden rounded-full`,n),role:r?void 0:`img`,"aria-label":r?void 0:t,...i,children:r?v(`img`,{src:r,alt:t,className:`size-full object-cover`}):v(q,{})})};export{J as Sidebar,C as useSidebar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-Dpsqz16D.js";import{jsx as n}from"react/jsx-runtime";const r=({asChild:r=!1,className:i,ref:a,...o})=>n(r?t:`div`,{"data-slot":`skeleton`,className:e(`dark-high-contrast:bg-black/30 high-contrast:bg-black/30 h-4 animate-pulse rounded-md bg-gray-300/25 dark:bg-gray-950/10`,i),ref:a,...o});export{r as t};
|
package/dist/skeleton.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./skeleton-
|
|
1
|
+
import{t as e}from"./skeleton-DsHXIa9j.js";export{e as Skeleton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./anchor-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./anchor-DvbNsphX.js";import{jsx as n}from"react/jsx-runtime";const r=({children:r=`Skip to main content`,className:i,onClick:a,targetId:o=`main`,...s})=>n(t,{...s,"data-slot":`skip-to-main-link`,href:`#${o}`,onClick:e=>{e.preventDefault(),window.history.replaceState(null,``,`#${o}`),document.getElementById(o)?.focus({preventScroll:!0}),a?.(e)},className:e(`not-focus:sr-only bg-card fixed top-2 left-2 z-max px-4 py-2 shadow-lg`,i),children:r});export{r as SkipToMainLink};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./data-slot-EM6s2WEU.js";import{Children as n,cloneElement as r,isValidElement as i}from"react";import{jsx as a}from"react/jsx-runtime";import{Slot as o}from"@radix-ui/react-slot";const s=({children:s,className:c,"data-slot":l,ref:u,...d})=>i(s)?a(o,{ref:u,...d,children:r(s,{...s.props,className:e(c,s.props.className),"data-slot":t(l,s.props[`data-slot`])})}):n.only(s);export{s as t};
|
package/dist/slot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./slot-
|
|
1
|
+
import{t as e}from"./slot-Dpsqz16D.js";export{e as Slot};
|
package/dist/split-button.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as Button } from "./button-DARFK2KJ.js";
|
|
2
2
|
import { t as IconButton } from "./button-C7vAl6lS.js";
|
|
3
3
|
import { t as ButtonSize } from "./button-BCoI4bhP.js";
|
|
4
|
-
import { t as DropdownMenu } from "./dropdown-menu-
|
|
4
|
+
import { t as DropdownMenu } from "./dropdown-menu-D6pMAY7I.js";
|
|
5
5
|
import { ComponentProps, ReactNode } from "react";
|
|
6
6
|
//#region src/components/split-button/split-button.d.ts
|
|
7
7
|
type RootProps = ComponentProps<typeof DropdownMenu.Root> & ComponentProps<"div"> & {
|
|
@@ -13,21 +13,160 @@ type RootProps = ComponentProps<typeof DropdownMenu.Root> & ComponentProps<"div"
|
|
|
13
13
|
*/
|
|
14
14
|
size?: ButtonSize;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* A button group which provides a default action with one click while revealing
|
|
18
|
+
* related alternatives through a dropdown menu. Best for when users typically
|
|
19
|
+
* want one action but occasionally need variants.
|
|
20
|
+
*
|
|
21
|
+
* @see https://mantle.ngrok.com/components/actions/split-button#splitbuttonroot
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <SplitButton.Root>
|
|
26
|
+
* <SplitButton.PrimaryAction icon={<CopyIcon />} onClick={copyMarkdownPage}>
|
|
27
|
+
* Copy page
|
|
28
|
+
* </SplitButton.PrimaryAction>
|
|
29
|
+
* <SplitButton.MenuTrigger label="Open doc actions menu" />
|
|
30
|
+
* <SplitButton.MenuContent>
|
|
31
|
+
* <SplitButton.MenuItem onClick={copyMarkdownPage}>
|
|
32
|
+
* Copy page
|
|
33
|
+
* <Icon svg={<CopyIcon />} />
|
|
34
|
+
* </SplitButton.MenuItem>
|
|
35
|
+
* <SplitButton.MenuItem asChild onClick={copyMarkdownPage}>
|
|
36
|
+
* <a href={markdownUrl} target="_blank" rel="noopener noreferrer">
|
|
37
|
+
* View as Markdown
|
|
38
|
+
* <Icon svg={<FileTextIcon />} />
|
|
39
|
+
* </a>
|
|
40
|
+
* </SplitButton.MenuItem>
|
|
41
|
+
* </SplitButton.MenuContent>
|
|
42
|
+
* </SplitButton.Root>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
16
45
|
declare const Root: ({ className, children, dir, open, defaultOpen, onOpenChange, modal, size, ref, ...props }: RootProps) => import("react").JSX.Element;
|
|
17
46
|
type PrimaryActionProps = Omit<ComponentProps<typeof Button>, "appearance" | "intent" | "size">;
|
|
47
|
+
/**
|
|
48
|
+
* The most common action users can trigger with a single click.
|
|
49
|
+
*
|
|
50
|
+
* @see https://mantle.ngrok.com/components/actions/split-button#splitbuttonprimaryaction
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <SplitButton.Root>
|
|
55
|
+
* <SplitButton.PrimaryAction icon={<CopyIcon />} onClick={copyMarkdownPage}>
|
|
56
|
+
* Copy page
|
|
57
|
+
* </SplitButton.PrimaryAction>
|
|
58
|
+
* <SplitButton.MenuTrigger label="Open doc actions menu" />
|
|
59
|
+
* <SplitButton.MenuContent>
|
|
60
|
+
* <SplitButton.MenuItem onClick={copyMarkdownPage}>
|
|
61
|
+
* Copy page
|
|
62
|
+
* <Icon svg={<CopyIcon />} />
|
|
63
|
+
* </SplitButton.MenuItem>
|
|
64
|
+
* <SplitButton.MenuItem asChild onClick={copyMarkdownPage}>
|
|
65
|
+
* <a href={markdownUrl} target="_blank" rel="noopener noreferrer">
|
|
66
|
+
* View as Markdown
|
|
67
|
+
* <Icon svg={<FileTextIcon />} />
|
|
68
|
+
* </a>
|
|
69
|
+
* </SplitButton.MenuItem>
|
|
70
|
+
* </SplitButton.MenuContent>
|
|
71
|
+
* </SplitButton.Root>
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
18
74
|
declare const PrimaryAction: (props: PrimaryActionProps) => import("react").JSX.Element;
|
|
19
75
|
type MenuTriggerProps = Omit<ComponentProps<typeof IconButton>, "appearance" | "intent" | "size" | "asChild" | "icon"> & {
|
|
20
76
|
icon?: ReactNode;
|
|
21
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* The button that opens the split button dropdown menu.
|
|
80
|
+
*
|
|
81
|
+
* @see https://mantle.ngrok.com/components/actions/split-button#splitbuttonmenutrigger
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* <SplitButton.Root>
|
|
86
|
+
* <SplitButton.PrimaryAction icon={<CopyIcon />} onClick={copyMarkdownPage}>
|
|
87
|
+
* Copy page
|
|
88
|
+
* </SplitButton.PrimaryAction>
|
|
89
|
+
* <SplitButton.MenuTrigger label="Open doc actions menu" />
|
|
90
|
+
* <SplitButton.MenuContent>
|
|
91
|
+
* <SplitButton.MenuItem onClick={copyMarkdownPage}>
|
|
92
|
+
* Copy page
|
|
93
|
+
* <Icon svg={<CopyIcon />} />
|
|
94
|
+
* </SplitButton.MenuItem>
|
|
95
|
+
* <SplitButton.MenuItem asChild onClick={copyMarkdownPage}>
|
|
96
|
+
* <a href={markdownUrl} target="_blank" rel="noopener noreferrer">
|
|
97
|
+
* View as Markdown
|
|
98
|
+
* <Icon svg={<FileTextIcon />} />
|
|
99
|
+
* </a>
|
|
100
|
+
* </SplitButton.MenuItem>
|
|
101
|
+
* </SplitButton.MenuContent>
|
|
102
|
+
* </SplitButton.Root>
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
22
105
|
declare const MenuTrigger: ({ icon, ...props }: MenuTriggerProps) => import("react").JSX.Element;
|
|
106
|
+
/**
|
|
107
|
+
* The container for the split button dropdown menu content. Appears in a
|
|
108
|
+
* portal with scrolling and animations.
|
|
109
|
+
*
|
|
110
|
+
* @see https://mantle.ngrok.com/components/actions/split-button#splitbuttonmenucontent
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```tsx
|
|
114
|
+
* <SplitButton.Root>
|
|
115
|
+
* <SplitButton.PrimaryAction icon={<CopyIcon />} onClick={copyMarkdownPage}>
|
|
116
|
+
* Copy page
|
|
117
|
+
* </SplitButton.PrimaryAction>
|
|
118
|
+
* <SplitButton.MenuTrigger label="Open doc actions menu" />
|
|
119
|
+
* <SplitButton.MenuContent>
|
|
120
|
+
* <SplitButton.MenuItem onClick={copyMarkdownPage}>
|
|
121
|
+
* Copy page
|
|
122
|
+
* <Icon svg={<CopyIcon />} />
|
|
123
|
+
* </SplitButton.MenuItem>
|
|
124
|
+
* <SplitButton.MenuItem asChild onClick={copyMarkdownPage}>
|
|
125
|
+
* <a href={markdownUrl} target="_blank" rel="noopener noreferrer">
|
|
126
|
+
* View as Markdown
|
|
127
|
+
* <Icon svg={<FileTextIcon />} />
|
|
128
|
+
* </a>
|
|
129
|
+
* </SplitButton.MenuItem>
|
|
130
|
+
* </SplitButton.MenuContent>
|
|
131
|
+
* </SplitButton.Root>
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
23
134
|
declare const MenuContent: ({ align, ...props }: ComponentProps<typeof DropdownMenu.Content>) => import("react").JSX.Element;
|
|
135
|
+
/**
|
|
136
|
+
* A standard item in the split button dropdown menu that can be selected or
|
|
137
|
+
* activated.
|
|
138
|
+
*
|
|
139
|
+
* @see https://mantle.ngrok.com/components/actions/split-button#splitbuttonmenuitem
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```tsx
|
|
143
|
+
* <SplitButton.Root>
|
|
144
|
+
* <SplitButton.PrimaryAction icon={<CopyIcon />} onClick={copyMarkdownPage}>
|
|
145
|
+
* Copy page
|
|
146
|
+
* </SplitButton.PrimaryAction>
|
|
147
|
+
* <SplitButton.MenuTrigger label="Open doc actions menu" />
|
|
148
|
+
* <SplitButton.MenuContent>
|
|
149
|
+
* <SplitButton.MenuItem onClick={copyMarkdownPage}>
|
|
150
|
+
* Copy page
|
|
151
|
+
* <Icon svg={<CopyIcon />} />
|
|
152
|
+
* </SplitButton.MenuItem>
|
|
153
|
+
* <SplitButton.MenuItem asChild onClick={copyMarkdownPage}>
|
|
154
|
+
* <a href={markdownUrl} target="_blank" rel="noopener noreferrer">
|
|
155
|
+
* View as Markdown
|
|
156
|
+
* <Icon svg={<FileTextIcon />} />
|
|
157
|
+
* </a>
|
|
158
|
+
* </SplitButton.MenuItem>
|
|
159
|
+
* </SplitButton.MenuContent>
|
|
160
|
+
* </SplitButton.Root>
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
24
163
|
declare const MenuItem: ({ className, ...props }: ComponentProps<typeof DropdownMenu.Item>) => import("react").JSX.Element;
|
|
25
164
|
/**
|
|
26
165
|
* A button group which provides a default action with one click while revealing
|
|
27
166
|
* related alternatives through a dropdown menu. Best for when users typically
|
|
28
167
|
* want one action but occasionally need variants.
|
|
29
168
|
*
|
|
30
|
-
* @see https://mantle.ngrok.com/components/actions/split-button
|
|
169
|
+
* @see https://mantle.ngrok.com/components/actions/split-button
|
|
31
170
|
*
|
|
32
171
|
* @example
|
|
33
172
|
* Composition:
|
|
@@ -52,7 +191,7 @@ declare const MenuItem: ({ className, ...props }: ComponentProps<typeof Dropdown
|
|
|
52
191
|
* Copy page
|
|
53
192
|
* </SplitButton.MenuItem>
|
|
54
193
|
* <SplitButton.MenuItem asChild onClick={copyMarkdownPage}>
|
|
55
|
-
* <a href={markdownUrl} target="_blank">
|
|
194
|
+
* <a href={markdownUrl} target="_blank" rel="noopener noreferrer">
|
|
56
195
|
* <Icon svg={<FileTextIcon />} />
|
|
57
196
|
* View as Markdown
|
|
58
197
|
* </a>
|
|
@@ -82,7 +221,7 @@ declare const SplitButton: {
|
|
|
82
221
|
* <Icon svg={<CopyIcon />} />
|
|
83
222
|
* </SplitButton.MenuItem>
|
|
84
223
|
* <SplitButton.MenuItem asChild onClick={copyMarkdownPage}>
|
|
85
|
-
* <a href={markdownUrl} target="_blank">
|
|
224
|
+
* <a href={markdownUrl} target="_blank" rel="noopener noreferrer">
|
|
86
225
|
* View as Markdown
|
|
87
226
|
* <Icon svg={<FileTextIcon />} />
|
|
88
227
|
* </a>
|
|
@@ -110,7 +249,7 @@ declare const SplitButton: {
|
|
|
110
249
|
* <Icon svg={<CopyIcon />} />
|
|
111
250
|
* </SplitButton.MenuItem>
|
|
112
251
|
* <SplitButton.MenuItem asChild onClick={copyMarkdownPage}>
|
|
113
|
-
* <a href={markdownUrl} target="_blank">
|
|
252
|
+
* <a href={markdownUrl} target="_blank" rel="noopener noreferrer">
|
|
114
253
|
* View as Markdown
|
|
115
254
|
* <Icon svg={<FileTextIcon />} />
|
|
116
255
|
* </a>
|
|
@@ -138,7 +277,7 @@ declare const SplitButton: {
|
|
|
138
277
|
* <Icon svg={<CopyIcon />} />
|
|
139
278
|
* </SplitButton.MenuItem>
|
|
140
279
|
* <SplitButton.MenuItem asChild onClick={copyMarkdownPage}>
|
|
141
|
-
* <a href={markdownUrl} target="_blank">
|
|
280
|
+
* <a href={markdownUrl} target="_blank" rel="noopener noreferrer">
|
|
142
281
|
* View as Markdown
|
|
143
282
|
* <Icon svg={<FileTextIcon />} />
|
|
144
283
|
* </a>
|
|
@@ -167,7 +306,7 @@ declare const SplitButton: {
|
|
|
167
306
|
* <Icon svg={<CopyIcon />} />
|
|
168
307
|
* </SplitButton.MenuItem>
|
|
169
308
|
* <SplitButton.MenuItem asChild onClick={copyMarkdownPage}>
|
|
170
|
-
* <a href={markdownUrl} target="_blank">
|
|
309
|
+
* <a href={markdownUrl} target="_blank" rel="noopener noreferrer">
|
|
171
310
|
* View as Markdown
|
|
172
311
|
* <Icon svg={<FileTextIcon />} />
|
|
173
312
|
* </a>
|
|
@@ -196,7 +335,7 @@ declare const SplitButton: {
|
|
|
196
335
|
* <Icon svg={<CopyIcon />} />
|
|
197
336
|
* </SplitButton.MenuItem>
|
|
198
337
|
* <SplitButton.MenuItem asChild onClick={copyMarkdownPage}>
|
|
199
|
-
* <a href={markdownUrl} target="_blank">
|
|
338
|
+
* <a href={markdownUrl} target="_blank" rel="noopener noreferrer">
|
|
200
339
|
* View as Markdown
|
|
201
340
|
* <Icon svg={<FileTextIcon />} />
|
|
202
341
|
* </a>
|
package/dist/split-button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./button-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./button-BUospUB3.js";import{t as r}from"./button-C0S8RbaJ.js";import{t as i}from"./dropdown-menu-fUMqjRC0.js";import{CaretDownIcon as a}from"@phosphor-icons/react/CaretDown";import{createContext as o,useContext as s,useMemo as c}from"react";import{jsx as l}from"react/jsx-runtime";const u=o({size:`md`}),d={Root:({className:t,children:n,dir:r,open:a,defaultOpen:o,onOpenChange:s,modal:d,size:f=`md`,ref:p,...m})=>{let h=c(()=>({size:f}),[f]);return l(i.Root,{dir:r,open:a,defaultOpen:o,onOpenChange:s,modal:d,children:l(u.Provider,{value:h,children:l(`div`,{"data-slot":`split-button`,"data-size":f,className:e(`flex flex-row [&>*:first-child]:rounded-r-none [&>*:last-child]:rounded-l-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:not(:first-child)]:-ml-px [&>*:focus]:relative [&>*:focus]:z-10 [&>*:hover]:relative [&>*:hover]:z-10 *:active:scale-100!`,t),ref:p,...m,children:n})})})},PrimaryAction:e=>{let{size:t}=s(u);return l(n,{appearance:`outlined`,intent:`neutral`,size:t,...e})},MenuTrigger:({icon:e,...n})=>{let{size:o}=s(u);return l(i.Trigger,{asChild:!0,className:`group`,children:l(r,{icon:e??l(t,{svg:l(a,{weight:`bold`,className:`size-4 group-data-[state=open]:-rotate-180 transition-transform ease-out duration-150`})}),appearance:`outlined`,intent:`neutral`,size:o,...n})})},MenuContent:({align:e=`end`,...t})=>l(i.Content,{align:e,...t}),MenuItem:({className:t,...n})=>l(i.Item,{className:e(`gap-2`,t),...n})};export{d as SplitButton};
|
|
@@ -154,7 +154,7 @@ declare const Element: ({ children, className, ref, ...props }: ComponentProps<"
|
|
|
154
154
|
* </Table.Root>
|
|
155
155
|
* ```
|
|
156
156
|
*
|
|
157
|
-
* @see https://mantle.ngrok.com/components/data-display/table#
|
|
157
|
+
* @see https://mantle.ngrok.com/components/data-display/table#tablehead
|
|
158
158
|
*/
|
|
159
159
|
declare const Head: ({ children, className, ref, ...props }: ComponentProps<"thead">) => import("react").JSX.Element;
|
|
160
160
|
/**
|
|
@@ -690,7 +690,7 @@ declare const Table: {
|
|
|
690
690
|
/**
|
|
691
691
|
* The head section of a table. Contains the table's column headers information.
|
|
692
692
|
*
|
|
693
|
-
* @see https://mantle.ngrok.com/components/data-display/table#
|
|
693
|
+
* @see https://mantle.ngrok.com/components/data-display/table#tablehead
|
|
694
694
|
*
|
|
695
695
|
* @example
|
|
696
696
|
* ```tsx
|
package/dist/table.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Table } from "./table-
|
|
1
|
+
import { t as Table } from "./table-CZBYEmyK.js";
|
|
2
2
|
export { Table };
|
package/dist/tabs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./booleanish-BfvnW6vy.js";import{t as r}from"./clsx-DUGZgXfJ.js";import{t as i}from"./use-prefers-reduced-motion-
|
|
1
|
+
import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./booleanish-BfvnW6vy.js";import{t as r}from"./clsx-DUGZgXfJ.js";import{t as i}from"./use-prefers-reduced-motion-Bk5zAfHY.js";import{Children as a,cloneElement as o,createContext as s,isValidElement as c,useContext as l,useEffect as u,useMemo as d,useRef as f}from"react";import p from"tiny-invariant";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import{cva as _}from"class-variance-authority";import{Content as v,List as y,Root as b,Trigger as x}from"@radix-ui/react-tabs";const S=s({orientation:`horizontal`,appearance:`classic`}),C=({className:e,children:n,orientation:r=`horizontal`,appearance:i=`classic`,...a})=>{let o=d(()=>({orientation:r,appearance:i}),[r,i]);return h(b,{"data-slot":`tabs`,"data-appearance":i,className:t(`flex gap-4`,r===`horizontal`?`flex-col`:`flex-row`,e),orientation:r,...a,children:h(S.Provider,{value:o,children:n})})},w=_(`flex`,{variants:{orientation:{horizontal:`scroll-fade-x flex-row items-center overflow-x-auto overscroll-x-none w-full min-w-0 pt-1 -mt-1 px-1 -mx-1`,vertical:`flex-col items-end gap-3.5 self-stretch`},appearance:{classic:``,pill:``},hideBorder:{true:``,false:``}},compoundVariants:[{orientation:`horizontal`,appearance:`pill`,className:`gap-1 pb-1 -mb-1`},{orientation:`horizontal`,appearance:`classic`,className:`gap-6`},{orientation:`horizontal`,appearance:`classic`,hideBorder:!1,className:t(`pb-px bg-origin-content bg-no-repeat bg-size-[100%_1px] bg-position-[0_calc(100%+1px)]`,`bg-[image:linear-gradient(var(--color-separator),var(--color-separator))]`,`[--_fade-bottom-border:black]`)},{orientation:`vertical`,appearance:`classic`,hideBorder:!1,className:`border-r border-separator`}],defaultVariants:{hideBorder:!1}}),T=({className:n,hideBorder:r=!1,ref:a,...o})=>{let{orientation:s,appearance:c}=l(S),d=f(null);return u(()=>{let e=d.current;if(!e||s!==`horizontal`)return;let t=new AbortController;return e.addEventListener(`focusin`,t=>{if(t.target instanceof Element&&t.target!==e){let e=i()?`auto`:`smooth`;t.target.scrollIntoView({behavior:e,inline:`center`,block:`nearest`})}},{signal:t.signal}),()=>{t.abort()}},[s]),h(y,{"aria-orientation":s,"data-slot":`tabs-list`,"data-hide-border":r?``:void 0,className:t(w({orientation:s,appearance:c,hideBorder:r}),n),ref:e(d,a),...o})},E=_(`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`}}}),D=()=>{let{orientation:e,appearance:t}=l(S);return h(`span`,{"aria-hidden":!0,className:r(E({orientation:e,appearance:t}))})},O=_(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`,`[&>svg]:shrink-0 [&>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`)}}}),k={Root:C,Content:({className:e,...n})=>h(v,{"data-slot":`tabs-content`,className:t(`focus-visible:ring-focus-accent outline-hidden focus-visible:ring-4`,e),...n}),List:T,Trigger:({"aria-disabled":e,asChild:r=!1,children:i,className:s,disabled:u,ref:d,...f})=>{let{orientation:_,appearance:v}=l(S),y=n(e??u),b={"aria-disabled":e??u,className:t(O({orientation:_,appearance:v}),s),disabled:y,...f};if(r){let e=a.only(i);p(c(e),"When using `asChild`, TabsTrigger must be passed a single child as a JSX tag.");let t=e.props?.children,n=y?{href:void 0,to:void 0}:{tabIndex:0};return h(x,{asChild:!0,"data-slot":`tabs-trigger`,...b,ref:d,children:o(y?h(`button`,{type:`button`}):e,n,g(m,{children:[h(D,{}),t]}))})}return g(x,{"data-slot":`tabs-trigger`,ref:d,...b,children:[h(D,{}),i]})},Badge:({className:e,children:n,...r})=>h(`span`,{"data-slot":`tabs-badge`,className: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`,e),...r,children:n})};export{k as Tabs};
|
package/dist/text-area.d.ts
CHANGED
|
@@ -30,4 +30,4 @@ type Props = ComponentProps<"textarea"> & WithValidation & {
|
|
|
30
30
|
*/
|
|
31
31
|
declare const TextArea: ({ appearance, "aria-invalid": _ariaInvalid, className, onDragEnter, onDragLeave, onDropCapture, ref, validation: _validation, ...props }: Props) => import("react").JSX.Element;
|
|
32
32
|
//#endregion
|
|
33
|
-
export { TextArea };
|
|
33
|
+
export { TextArea, type Props as TextAreaProps };
|
|
@@ -1,34 +1,50 @@
|
|
|
1
1
|
//#region src/components/theme/themes.d.ts
|
|
2
2
|
/**
|
|
3
3
|
* resolvedThemes is a tuple of valid themes that have been resolved from "system" to a specific theme.
|
|
4
|
+
*
|
|
5
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
4
6
|
*/
|
|
5
7
|
declare const resolvedThemes: readonly ["light", "dark", "light-high-contrast", "dark-high-contrast"];
|
|
6
8
|
/**
|
|
7
9
|
* ResolvedTheme is a type that represents a theme that has been resolved from "system" to a specific theme.
|
|
10
|
+
*
|
|
11
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
8
12
|
*/
|
|
9
13
|
type ResolvedTheme = (typeof resolvedThemes)[number];
|
|
10
14
|
/**
|
|
11
15
|
* themes is a tuple of valid themes.
|
|
16
|
+
*
|
|
17
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
12
18
|
*/
|
|
13
19
|
declare const themes: readonly ["system", "light", "dark", "light-high-contrast", "dark-high-contrast"];
|
|
14
20
|
/**
|
|
15
21
|
* Theme is a string literal type that represents a valid theme.
|
|
22
|
+
*
|
|
23
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
16
24
|
*/
|
|
17
25
|
type Theme = (typeof themes)[number];
|
|
18
26
|
/**
|
|
19
27
|
* $theme is a helper which translates the Theme type into a string literal type.
|
|
28
|
+
*
|
|
29
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
20
30
|
*/
|
|
21
31
|
declare const $theme: <T extends Theme = Theme>(value: T) => T;
|
|
22
32
|
/**
|
|
23
33
|
* Type predicate that checks if a value is a valid theme.
|
|
34
|
+
*
|
|
35
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
24
36
|
*/
|
|
25
37
|
declare function isTheme(value: unknown): value is Theme;
|
|
26
38
|
/**
|
|
27
39
|
* $resolvedTheme is a helper which translates the ResolvedTheme type into a string literal type.
|
|
40
|
+
*
|
|
41
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
28
42
|
*/
|
|
29
43
|
declare const $resolvedTheme: <T extends ResolvedTheme = ResolvedTheme>(value: T) => T;
|
|
30
44
|
/**
|
|
31
45
|
* Type predicate that checks if a value is a valid resolved theme.
|
|
46
|
+
*
|
|
47
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
32
48
|
*/
|
|
33
49
|
declare function isResolvedTheme(value: unknown): value is ResolvedTheme;
|
|
34
50
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{n as t}from"./browser-only-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{n as t}from"./browser-only-CmEEzfU3.js";import{t as n}from"./use-matches-media-query-CMSxHR9n.js";import{createContext as r,useContext as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";import l from"tiny-invariant";import{jsx as u}from"react/jsx-runtime";const d=[`light`,`dark`,`light-high-contrast`,`dark-high-contrast`],f=[`system`,...d],p=e=>e;function m(e){return typeof e==`string`&&f.includes(e)}const h=e=>e;function g(e){return typeof e==`string`&&d.includes(e)}const _=`(prefers-color-scheme: dark)`,v=`(prefers-contrast: more)`,y=`mantle-ui-theme`,b=`system`,x=r([`system`,()=>null]);function S({children:e}){let[n,r]=c(()=>{let e=N({cookie:t()?document.cookie:null});return w(e),e}),i=s(null);a(()=>{function e(e){let t=e??N({cookie:document.cookie});r(t),w(t)}e();try{`BroadcastChannel`in window&&(i.current=new BroadcastChannel(y),i.current.addEventListener(`message`,t=>{let n=t?.data?.theme;m(n)&&e(n)}))}catch{}function t(t){t.key===`${y}__ping`&&e()}window.addEventListener(`storage`,t);let n=window.matchMedia(_),a=window.matchMedia(v);function o(){e()}function s(){document.visibilityState===`visible`&&e()}return n.addEventListener(`change`,o),a.addEventListener(`change`,o),window.addEventListener(`pageshow`,o),document.addEventListener(`visibilitychange`,s),()=>{window.removeEventListener(`storage`,t),n.removeEventListener(`change`,o),a.removeEventListener(`change`,o),window.removeEventListener(`pageshow`,o),document.removeEventListener(`visibilitychange`,s);try{i.current?.close()}catch{}i.current=null}},[]);let l=o(()=>[n,e=>{L(e),r(e),w(e),F(e,{broadcastChannel:i.current,pingKey:`${y}__ping`})}],[n]);return u(x.Provider,{value:l,children:e})}function C(){let e=i(x);return l(e,`useTheme must be used within a ThemeProvider`),e}function w(e){if(!t())return;let n=window.document.documentElement,r=window.matchMedia(_).matches,i=window.matchMedia(v).matches,a=E(e,{prefersDarkMode:r,prefersHighContrast:i}),o=n.dataset.theme,s=n.dataset.appliedTheme,c=m(o)?o:void 0,l=g(s)?s:void 0;(c!==e||l!==a)&&(n.classList.remove(...d),n.classList.add(a),n.dataset.theme=e,n.dataset.appliedTheme=a)}function T(){if(!t())return{appliedTheme:void 0,theme:void 0};let e=window.document.documentElement,n=m(e.dataset.theme)?e.dataset.theme:void 0;return{appliedTheme:g(e.dataset.appliedTheme)?e.dataset.appliedTheme:void 0,theme:n}}function E(e,{prefersDarkMode:t,prefersHighContrast:n}){return e===`system`?O({prefersDarkMode:t,prefersHighContrast:n}):e}function D(){let e=i(x);return E(e==null?`system`:e[0],{prefersDarkMode:n(_),prefersHighContrast:n(v)})}function O({prefersDarkMode:e,prefersHighContrast:t}){return t?e?`dark-high-contrast`:`light-high-contrast`:e?`dark`:`light`}function k(e){let{storageKey:t,defaultTheme:n,themes:r,resolvedThemes:i,prefersDarkModeMediaQuery:a,prefersHighContrastMediaQuery:o}=e;function s(e){return typeof e==`string`&&r.includes(e)}function c(e){let t=document.cookie;if(!t)return null;try{let n=t.split(`;`).find(t=>t.trim().startsWith(`${e}=`))?.split(`=`)[1];return n?decodeURIComponent(n):null}catch{return null}}function l(e,t){let n=new Date;n.setFullYear(n.getFullYear()+1);let r=window.location.hostname,i=window.location.protocol,a=r===`ngrok.com`||r.endsWith(`.ngrok.com`)?`; domain=.ngrok.com`:``,o=i===`https:`?`; Secure`:``;return`${e}=${encodeURIComponent(t)}; expires=${n.toUTCString()}; path=/${a}; SameSite=Lax${o}`}function u(e,t){try{document.cookie=l(e,t)}catch{}}function d(e,t,n){return e===`system`?n?t?`dark-high-contrast`:`light-high-contrast`:t?`dark`:`light`:e}let f=null,p=null,m=null;try{f=c(t)}catch{}if(s(f))m=f;else{try{p=window.localStorage?.getItem(t)??null}catch{}s(p)&&(m=p)}let h=s(m)?m:n,g=matchMedia(a).matches,_=matchMedia(o).matches,v=d(h,g,_),y=document.documentElement;if(y.dataset.appliedTheme!==v||y.dataset.theme!==h){for(let e of i)y.classList.remove(e);y.classList.add(v),y.dataset.theme=h,y.dataset.appliedTheme=v}let b=s(f);try{if(s(p)&&!b){u(t,p);try{window.localStorage.removeItem(t)}catch{}}else b||u(t,h)}catch{}}function A(){let e={storageKey:y,defaultTheme:b,themes:f,resolvedThemes:d,prefersDarkModeMediaQuery:_,prefersHighContrastMediaQuery:v};return`(${k.toString()})(${JSON.stringify(e)})`}const j=({nonce:e})=>u(`script`,{dangerouslySetInnerHTML:{__html:A()},nonce:e,suppressHydrationWarning:!0});function M(n={}){let{className:r=``,ssrCookie:i}=n??{};return o(()=>{let n,a;if(!t())n=N({cookie:i}),a=E(n,{prefersDarkMode:!1,prefersHighContrast:!1});else{let e=window.matchMedia(_).matches,t=window.matchMedia(v).matches;n=N({cookie:document.cookie}),a=E(n,{prefersDarkMode:e,prefersHighContrast:t})}return{className:e(r,a),"data-applied-theme":a,"data-theme":n}},[r,i])}function N({cookie:e}){if(!e)return b;try{let t=e.split(`;`).find(e=>e.trim().startsWith(`${y}=`))?.split(`=`)[1],n=t?globalThis.decodeURIComponent(t):null;return m(n)?n:b}catch{return b}}function P(e){if(e)return e.split(`;`).map(e=>e.trim()).find(e=>e.startsWith(`${y}=`))}function F(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{}}function I(e){let t=new Date;t.setFullYear(t.getFullYear()+1);let{hostname:n,protocol:r}=window.location,i=n===`ngrok.com`||n.endsWith(`.ngrok.com`)?`; domain=.ngrok.com`:``,a=r===`https:`?`; Secure`:``;return`${y}=${encodeURIComponent(e)}; expires=${t.toUTCString()}; path=/${i}; SameSite=Lax${a}`}function L(e){if(t())try{document.cookie=I(e)}catch{}}export{A as a,M as c,p as d,g as f,f as h,N as i,C as l,d as m,S as n,T as o,m as p,P as r,D as s,j as t,h as u};
|
package/dist/theme-switcher.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as WithStyleProps } from "./with-style-props-Dq5Vntqy.js";
|
|
2
2
|
import { n as IconButtonProps, r as IconButtonAppearance } from "./button-C7vAl6lS.js";
|
|
3
3
|
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
4
|
-
import { t as DropdownMenu } from "./dropdown-menu-
|
|
5
|
-
import "./dropdown-menu-
|
|
4
|
+
import { t as DropdownMenu } from "./dropdown-menu-D6pMAY7I.js";
|
|
5
|
+
import "./dropdown-menu-BbbQuae2.js";
|
|
6
6
|
import { ComponentProps } from "react";
|
|
7
7
|
//#region src/components/theme-switcher/theme-switcher.d.ts
|
|
8
8
|
/**
|
package/dist/theme-switcher.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./icon-lZ48P8Nn.js";import{
|
|
1
|
+
import{t as e}from"./icon-lZ48P8Nn.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./button-C0S8RbaJ.js";import{t as r}from"./browser-only-CmEEzfU3.js";import{t as i}from"./dropdown-menu-fUMqjRC0.js";import{d as a,h as o,l as s,p as c}from"./theme-IAnQ35bd.js";import{n as l,t as u}from"./icons-CPbOq7cF.js";import{t as d}from"./skeleton-DsHXIa9j.js";import{jsx as f,jsxs as p}from"react/jsx-runtime";const m={system:`System Preference`,light:`Light Mode`,dark:`Dark Mode`,"light-high-contrast":`Light High Contrast`,"dark-high-contrast":`Dark High Contrast`},h=({className:t,style:n})=>{let[r,u]=s();return f(i.RadioGroup,{"data-slot":`theme-dropdown-menu-radio-group`,className:t,style:n,value:r,onValueChange:e=>{c(e)&&u(e)},children:o.map(t=>p(i.RadioItem,{value:a(t),children:[f(e,{svg:f(l,{theme:t})}),m[t]]},t))})},g={Root:e=>f(i.Root,{...e}),Trigger:({appearance:e=`ghost`,"data-slot":a,disabled:o,label:s=`Change Theme`,ref:c,...l})=>f(i.Trigger,{asChild:!0,disabled:o,children:f(n,{ref:c,appearance:e,disabled:o,"data-slot":t(a,`theme-switcher-trigger`),intent:`neutral`,icon:f(r,{fallback:f(d,{className:`rounded-full size-5`}),children:()=>f(u,{className:`size-5`})}),label:s,...l})}),Content:({children:e,"data-slot":n,...r})=>f(i.Content,{"data-slot":t(n,`theme-switcher-content`),...r,children:e??f(h,{})})};export{h as ThemeDropdownMenuRadioGroup,g as ThemeSwitcher};
|
package/dist/theme.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { a as isResolvedTheme, c as themes, i as Theme, n as $theme, o as isTheme, r as ResolvedTheme, s as resolvedThemes, t as $resolvedTheme } from "./theme-
|
|
1
|
+
import { a as isResolvedTheme, c as themes, i as Theme, n as $theme, o as isTheme, r as ResolvedTheme, s as resolvedThemes, t as $resolvedTheme } from "./theme-FbfjYiD3.js";
|
|
2
2
|
import { PropsWithChildren } from "react";
|
|
3
3
|
//#region src/components/theme/mantle-style-sheets.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Browser-accessible URLs for mantle's three lazy-loaded theme stylesheets.
|
|
6
6
|
*
|
|
7
7
|
* Use {@link mantleStyleSheetUrls} to create this object from Vite `?url` imports.
|
|
8
|
+
*
|
|
9
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
8
10
|
*/
|
|
9
11
|
type MantleThemeCssUrls = {
|
|
10
12
|
/**
|
|
@@ -51,8 +53,16 @@ type MantleThemeCssUrls = {
|
|
|
51
53
|
* // In JSX:
|
|
52
54
|
* <MantleStyleSheets {...themeUrls} nonce={nonce} ssrCookie={ssrCookie} />
|
|
53
55
|
* ```
|
|
56
|
+
*
|
|
57
|
+
* @see https://mantle.ngrok.com/components/primitives/theme#mantlestylesheeturls
|
|
54
58
|
*/
|
|
55
59
|
declare function mantleStyleSheetUrls(urls: MantleThemeCssUrls): MantleThemeCssUrls;
|
|
60
|
+
/**
|
|
61
|
+
* Props for {@link MantleStyleSheets} — the three theme stylesheet URLs plus optional
|
|
62
|
+
* `forceTheme`, `ssrCookie`, and `nonce`.
|
|
63
|
+
*
|
|
64
|
+
* @see https://mantle.ngrok.com/components/primitives/theme#mantlestylesheets
|
|
65
|
+
*/
|
|
56
66
|
type MantleStyleSheetsProps = MantleThemeCssUrls & {
|
|
57
67
|
/**
|
|
58
68
|
* Force a specific resolved theme's stylesheet to load unconditionally (`media="all"`),
|
|
@@ -105,6 +115,8 @@ type MantleStyleSheetsProps = MantleThemeCssUrls & {
|
|
|
105
115
|
* Use this when you need to inline the script directly into SSR HTML outside of a React
|
|
106
116
|
* context — for example, in a legacy Go service that renders the initial HTML response.
|
|
107
117
|
*
|
|
118
|
+
* @see https://mantle.ngrok.com/components/primitives/theme#fixmediascriptcontent
|
|
119
|
+
*
|
|
108
120
|
* @example
|
|
109
121
|
* ```go
|
|
110
122
|
* // In a Go template, inline script content that was pre-generated by mantle
|
|
@@ -138,6 +150,8 @@ declare function fixMediaScriptContent(forceTheme?: ResolvedTheme): string;
|
|
|
138
150
|
* When `forceTheme` is set, only the link tag for that theme is rendered — the others are
|
|
139
151
|
* omitted entirely to avoid unnecessary network requests.
|
|
140
152
|
*
|
|
153
|
+
* @see https://mantle.ngrok.com/components/primitives/theme#mantlestylesheets
|
|
154
|
+
*
|
|
141
155
|
* @example
|
|
142
156
|
* ```tsx
|
|
143
157
|
* // root.tsx
|
|
@@ -169,7 +183,7 @@ type ThemeProviderProps = PropsWithChildren;
|
|
|
169
183
|
*
|
|
170
184
|
* @example
|
|
171
185
|
* ```tsx
|
|
172
|
-
* <ThemeProvider
|
|
186
|
+
* <ThemeProvider>
|
|
173
187
|
* <App />
|
|
174
188
|
* </ThemeProvider>
|
|
175
189
|
* ```
|
|
@@ -178,11 +192,15 @@ declare function ThemeProvider({ children }: ThemeProviderProps): import("react"
|
|
|
178
192
|
/**
|
|
179
193
|
* useTheme returns the current theme and a function to set the theme.
|
|
180
194
|
*
|
|
195
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
196
|
+
*
|
|
181
197
|
* @note This function will throw an error if used outside of a ThemeProvider context tree.
|
|
182
198
|
*/
|
|
183
199
|
declare function useTheme(): ThemeProviderState;
|
|
184
200
|
/**
|
|
185
201
|
* Read the theme and applied theme from the `<html>` element.
|
|
202
|
+
*
|
|
203
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
186
204
|
*/
|
|
187
205
|
declare function readThemeFromHtmlElement(): {
|
|
188
206
|
appliedTheme: "dark" | "dark-high-contrast" | "light" | "light-high-contrast" | undefined;
|
|
@@ -191,12 +209,16 @@ declare function readThemeFromHtmlElement(): {
|
|
|
191
209
|
/**
|
|
192
210
|
* If the theme is "system", it will resolve the theme based on the user's media query preferences, otherwise it will return the theme as is.
|
|
193
211
|
* This will mirror the result that gets applied to the <html> element.
|
|
212
|
+
*
|
|
213
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
194
214
|
*/
|
|
195
215
|
declare function useAppliedTheme(): "dark" | "dark-high-contrast" | "light" | "light-high-contrast";
|
|
196
216
|
/**
|
|
197
217
|
* preventWrongThemeFlashScriptContent generates a script that prevents the wrong theme from flashing on initial page load.
|
|
198
218
|
* It checks cookies for a stored theme, and if none is found, it sets the default theme.
|
|
199
219
|
* It also applies the correct theme to the `<html>` element based on the user's media query preferences.
|
|
220
|
+
*
|
|
221
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
200
222
|
*/
|
|
201
223
|
declare function preventWrongThemeFlashScriptContent(): string;
|
|
202
224
|
type PreventWrongThemeFlashScriptProps = {
|
|
@@ -220,6 +242,8 @@ type PreventWrongThemeFlashScriptProps = {
|
|
|
220
242
|
*
|
|
221
243
|
* Place this as early as possible in the `<head>`.
|
|
222
244
|
*
|
|
245
|
+
* @see https://mantle.ngrok.com/components/primitives/theme#preventwrongthemeflashscript
|
|
246
|
+
*
|
|
223
247
|
* @example
|
|
224
248
|
* ```tsx
|
|
225
249
|
* // entry.server.tsx — send font preloads as HTTP headers (preferred for SSR)
|
|
@@ -258,6 +282,8 @@ type UseInitialHtmlThemePropsOptions = {
|
|
|
258
282
|
};
|
|
259
283
|
/**
|
|
260
284
|
* useInitialHtmlThemeProps returns the initial props that should be applied to the <html> element to prevent react hydration errors.
|
|
285
|
+
*
|
|
286
|
+
* @see https://mantle.ngrok.com/components/primitives/theme#useinitialhtmlthemeprops
|
|
261
287
|
*/
|
|
262
288
|
declare function useInitialHtmlThemeProps(props?: UseInitialHtmlThemePropsOptions): InitialThemeProps;
|
|
263
289
|
type GetStoredThemeOptions = {
|
|
@@ -274,6 +300,8 @@ type GetStoredThemeOptions = {
|
|
|
274
300
|
* {@link DEFAULT_THEME}. This function never throws; malformed encodings or
|
|
275
301
|
* missing cookies quietly return the default.
|
|
276
302
|
*
|
|
303
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
304
|
+
*
|
|
277
305
|
* @example
|
|
278
306
|
* getStoredTheme({ cookie: `${THEME_STORAGE_KEY}=dark; session=abc` }) // "dark"
|
|
279
307
|
* @example
|
|
@@ -287,6 +315,8 @@ declare function getStoredTheme({ cookie }: GetStoredThemeOptions): Theme;
|
|
|
287
315
|
* {@link useInitialHtmlThemeProps} without exposing the full `Cookie` header
|
|
288
316
|
* (which may contain HttpOnly/session cookies) in serialized loader data.
|
|
289
317
|
*
|
|
318
|
+
* @see https://mantle.ngrok.com/components/primitives/theme#extractthemecookie
|
|
319
|
+
*
|
|
290
320
|
* @example
|
|
291
321
|
* ```ts
|
|
292
322
|
* // app/root.tsx loader
|
|
@@ -310,12 +340,16 @@ declare function extractThemeCookie(cookieHeader: string | null | undefined): st
|
|
|
310
340
|
* The origin for the assets CDN where custom ngrok fonts and assets are hosted.
|
|
311
341
|
*
|
|
312
342
|
* Keep this stable across the app so we can preconnect/DNS-prefetch consistently.
|
|
343
|
+
*
|
|
344
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
313
345
|
* @public
|
|
314
346
|
*/
|
|
315
347
|
declare const assetsCdnOrigin = "https://assets.ngrok.com";
|
|
316
348
|
declare const coreFontNames: readonly ["roobert", "jetbrains-mono", "jetbrains-mono-italic", "family-regular", "family-italic"];
|
|
317
349
|
/**
|
|
318
350
|
* Named keys identifying each individual core font.
|
|
351
|
+
*
|
|
352
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
319
353
|
* @public
|
|
320
354
|
*/
|
|
321
355
|
type CoreFontName = (typeof coreFontNames)[number];
|
|
@@ -323,6 +357,8 @@ type FontPath = `/${string}` | (string & {});
|
|
|
323
357
|
/**
|
|
324
358
|
* Builds an absolute CDN URL for a given font.
|
|
325
359
|
*
|
|
360
|
+
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
361
|
+
*
|
|
326
362
|
* @returns {`https://assets.ngrok.com/fonts${T}`} An absolute, literal-typed CDN URL.
|
|
327
363
|
*
|
|
328
364
|
* @example
|
|
@@ -354,6 +390,8 @@ type PreloadFontProps = {
|
|
|
354
390
|
* addition to) an HTML `<link>` element. Sending this as a `Link` header lets
|
|
355
391
|
* the browser start the font fetch before it has parsed any HTML.
|
|
356
392
|
*
|
|
393
|
+
* @see https://mantle.ngrok.com/components/primitives/theme#preloadfontlink
|
|
394
|
+
*
|
|
357
395
|
* @remarks
|
|
358
396
|
* For best performance, also send a `preconnect` hint to {@link assetsCdnOrigin}
|
|
359
397
|
* in the same `Link` header.
|
|
@@ -378,6 +416,8 @@ declare function preloadFontLink(name: CoreFontName): string;
|
|
|
378
416
|
* Use this when you only need one or two specific fonts rather than all core
|
|
379
417
|
* fonts. Include it as early as possible in the document `<head>`.
|
|
380
418
|
*
|
|
419
|
+
* @see https://mantle.ngrok.com/components/primitives/theme#preloadfont
|
|
420
|
+
*
|
|
381
421
|
* @remarks
|
|
382
422
|
* For best performance, pair this with preconnect/dns-prefetch hints to the CDN.
|
|
383
423
|
*
|
package/dist/theme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,d as n,f as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./theme-
|
|
1
|
+
import{a as e,c as t,d as n,f as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./theme-IAnQ35bd.js";import{useEffect as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";const y=`mantle-dark-styles`,b=`mantle-light-high-contrast-styles`,x=`mantle-dark-high-contrast-styles`,S=`(prefers-color-scheme: dark)`,C=`(prefers-contrast: more) and (prefers-color-scheme: light)`,w=`(prefers-contrast: more) and (prefers-color-scheme: dark)`;function T(e,t){let n=t??e;return{dark:n===`dark`?`all`:S,lightHighContrast:n===`light-high-contrast`?`all`:C,darkHighContrast:n===`dark-high-contrast`?`all`:w}}function E(e){return e}function D(e){let{darkLinkId:t,lightHcLinkId:n,darkHcLinkId:r,mediaDark:i,mediaLightHc:a,mediaDarkHc:o,forceTheme:s}=e,c=document.documentElement.dataset.appliedTheme,l=s??c,u=document.getElementById(t),d=document.getElementById(n),f=document.getElementById(r);u&&(u.media=l===`dark`?`all`:i),d&&(d.media=l===`light-high-contrast`?`all`:a),f&&(f.media=l===`dark-high-contrast`?`all`:o)}function O(e){let t={darkLinkId:y,lightHcLinkId:b,darkHcLinkId:x,mediaDark:S,mediaLightHc:C,mediaDarkHc:w,forceTheme:e};return`(${D.toString()})(${JSON.stringify(t)})`}function k({darkCssUrl:e,lightHighContrastCssUrl:t,darkHighContrastCssUrl:n,forceTheme:i,nonce:o,ssrCookie:s}){h(()=>{function e(){let e=document.documentElement.dataset.appliedTheme;return r(e)?e:void 0}function t(){let{dark:t,lightHighContrast:n,darkHighContrast:r}=T(e(),i),a=document.getElementById(y),o=document.getElementById(b),s=document.getElementById(x);a&&(a.media=t),o&&(o.media=n),s&&(s.media=r)}t();let n=new MutationObserver(t);return n.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-applied-theme`]}),()=>{n.disconnect()}},[i]);let c=s==null?void 0:a({cookie:s}),l=c===`system`?void 0:c,{dark:u,lightHighContrast:d,darkHighContrast:f}=T(l,i);return v(g,{children:[(!i||i===`dark`)&&_(`link`,{rel:`stylesheet`,id:y,href:e,media:u,suppressHydrationWarning:!0}),(!i||i===`light-high-contrast`)&&_(`link`,{rel:`stylesheet`,id:b,href:t,media:d,suppressHydrationWarning:!0}),(!i||i===`dark-high-contrast`)&&_(`link`,{rel:`stylesheet`,id:x,href:n,media:f,suppressHydrationWarning:!0}),!i&&l==null&&_(`script`,{dangerouslySetInnerHTML:{__html:O(i)},nonce:o,suppressHydrationWarning:!0})]})}const A=`https://assets.ngrok.com`,j=`${A}/fonts`,M={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 N(e){let t=e.startsWith(`/`)?e:`/${e}`;return`${j}${t}`}function P(e){return`<${N(M[e])}>; rel=preload; as=font; type="font/woff2"; crossorigin`}const F=({name:e})=>_(`link`,{rel:`preload`,href:N(M[e]),as:`font`,type:`font/woff2`,crossOrigin:`anonymous`});export{m as $resolvedTheme,n as $theme,k as MantleStyleSheets,F as PreloadFont,p as PreventWrongThemeFlashScript,c as ThemeProvider,A as assetsCdnOrigin,d as extractThemeCookie,O as fixMediaScriptContent,N as fontHref,a as getStoredTheme,r as isResolvedTheme,u as isTheme,E as mantleStyleSheetUrls,P as preloadFontLink,e as preventWrongThemeFlashScriptContent,l as readThemeFromHtmlElement,s as resolvedThemes,i as themes,f as useAppliedTheme,t as useInitialHtmlThemeProps,o as useTheme};
|