@ngrok/mantle 0.93.1 → 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 +1 -1
- package/dist/llms.txt +1 -1
- package/dist/mantle.css +4 -4
- package/dist/theme-switcher.d.ts +122 -10
- package/dist/theme-switcher.js +1 -1
- package/package.json +1 -1
package/dist/agent.json
CHANGED
package/dist/llms.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @ngrok/mantle (0.93.
|
|
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
|
|
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-
|
|
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-
|
|
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-
|
|
1888
|
+
:not([data-slot~="theme-switcher"] *, [data-slot~="theme-switcher-icon"] *)::after {
|
|
1889
1889
|
transition: none !important;
|
|
1890
1890
|
}
|
|
1891
1891
|
|
package/dist/theme-switcher.d.ts
CHANGED
|
@@ -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 `
|
|
6
|
+
* The props for the `ThemeSwitcherIcon` component.
|
|
6
7
|
*/
|
|
7
|
-
type
|
|
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
|
-
*
|
|
10
|
-
*
|
|
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
|
-
|
|
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 };
|
package/dist/theme-switcher.js
CHANGED
|
@@ -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-C-glc5Q-.js";import{n as p}from"./icons-DP3lQw5O.js";import{c as m}from"react/compiler-runtime";import{
|
|
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};
|