@ngrok/mantle 0.90.4 → 0.91.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 +3 -5
- package/dist/agent.json +7 -7
- package/dist/{alert-CTAmHdLa.d.ts → alert-BV0VWU2o.d.ts} +5 -7
- package/dist/{alert-xJELJxL4.js → alert-BVQcPzmf.js} +1 -1
- package/dist/alert-center.d.ts +2 -4
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +5 -7
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js +1 -1
- package/dist/anchor.d.ts +2 -6
- package/dist/app-layout.d.ts +3 -7
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +2 -4
- package/dist/area-chart.js +1 -1
- package/dist/{as-child-D23mGo4f.d.ts → as-child-DFxX3U2i.d.ts} +0 -2
- package/dist/avatar.d.ts +2 -4
- package/dist/badge.d.ts +3 -5
- package/dist/bar-chart.d.ts +2 -4
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +2 -6
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only.d.ts +0 -2
- package/dist/{button-BZT5f79d.d.ts → button-BFAvonp1.d.ts} +3 -7
- package/dist/{button-mzUR1U0Y.d.ts → button-BOCRKR5v.d.ts} +3 -7
- package/dist/button-CZ-q7fYv.js +1 -0
- package/dist/button-Cwrv2Mwv.js +1 -0
- package/dist/{button-BRjAW1ec.d.ts → button-Dt9LZMT5.d.ts} +5 -7
- package/dist/{button-BCoI4bhP.d.ts → button-L4exxu_L.d.ts} +0 -2
- package/dist/button.d.ts +4 -4
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +1 -3
- package/dist/card.d.ts +3 -5
- package/dist/centered-layout.d.ts +9 -32
- package/dist/chart-D2LtDZtV.js +2 -0
- package/dist/{chart-23KQ1ZNO.d.ts → chart-ynMysD16.d.ts} +40 -15
- package/dist/checkbox.d.ts +2 -4
- package/dist/{choice-BCiyqLgO.d.ts → choice-BLR0_MeB.d.ts} +3 -5
- package/dist/choice.d.ts +1 -1
- package/dist/{code-block-D5eDP379.d.ts → code-block-Bqw9VyK_.d.ts} +0 -22
- package/dist/code-block.d.ts +4 -12
- package/dist/code-block.js +6 -6
- package/dist/code-block_highlight-utils.d.ts +1 -1
- package/dist/code.d.ts +2 -4
- package/dist/color.d.ts +1 -1
- package/dist/combobox.d.ts +4 -6
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +3 -13
- package/dist/command.js +1 -1
- package/dist/cx.d.ts +0 -6
- package/dist/{data-slot-CChfb_cv.d.ts → data-slot-B-LqAcBB.d.ts} +0 -2
- package/dist/data-table.d.ts +5 -9
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +3 -5
- package/dist/{dialog-C9QGvVNG.js → dialog-D333NTyf.js} +1 -1
- package/dist/{dialog-CgwSNHs1.d.ts → dialog-DedsCsnk.d.ts} +3 -5
- package/dist/{dialog-CZYD3xL-.d.ts → dialog-Dp0QGWwo.d.ts} +0 -2
- package/dist/dialog.d.ts +2 -2
- package/dist/dialog.js +1 -1
- package/dist/{direction-BjU0bPST.d.ts → direction-CpRzTtZh.d.ts} +0 -2
- package/dist/{dropdown-menu-Cef0Cz2B.d.ts → dropdown-menu-ByQQIsQE.d.ts} +2 -4
- package/dist/dropdown-menu.d.ts +1 -2
- package/dist/empty.d.ts +3 -5
- package/dist/{field-7QeiTFwl.d.ts → field-V_gnkcmN.d.ts} +0 -2
- package/dist/field.d.ts +7 -15
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +1 -5
- package/dist/hooks.d.ts +1 -37
- package/dist/hover-card.d.ts +1 -3
- package/dist/{icon-ucVgZeXn.d.ts → icon-ByLVhdYq.d.ts} +2 -4
- package/dist/{icon-D1RY5Tcj.d.ts → icon-CgNqu-fl.d.ts} +0 -2
- package/dist/{icon-r2NvfTWW.d.ts → icon-DXDyhy2N.d.ts} +2 -4
- package/dist/icon.d.ts +3 -3
- package/dist/icons-DykpsXNX.js +1 -0
- package/dist/icons.d.ts +3 -17
- package/dist/icons.js +1 -1
- package/dist/{in-view-Ch5vJtWo.d.ts → in-view-B3nMAzfE.d.ts} +0 -6
- package/dist/{index-DorCusfG.d.ts → index-BZhHLrBi.d.ts} +0 -2
- package/dist/{index-DA4ig3gj.d.ts → index-C6s5cGCr.d.ts} +2 -10
- package/dist/{input-eEKzP3cE.js → input-CpQ6jlpI.js} +1 -1
- package/dist/{input-bbB1tC0h.d.ts → input-Dx5owTCc.d.ts} +2 -6
- package/dist/input.d.ts +3 -7
- package/dist/input.js +1 -1
- package/dist/kbd.d.ts +1 -3
- package/dist/{label-C-KbNls8.d.ts → label-Dn5CPJUj.d.ts} +1 -3
- package/dist/label.d.ts +1 -1
- package/dist/layer-container.d.ts +0 -2
- package/dist/line-chart.d.ts +2 -4
- package/dist/line-chart.js +1 -1
- package/dist/list.d.ts +2 -8
- package/dist/live-region.d.ts +2 -4
- package/dist/llms.txt +4 -4
- package/dist/main.d.ts +1 -3
- package/dist/mantle-dark.css +2 -12
- package/dist/mantle.css +75 -13
- package/dist/media-object.d.ts +2 -4
- package/dist/migrations/0011-eliminate-high-contrast.yml +869 -0
- package/dist/multi-select.d.ts +4 -6
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +3 -5
- package/dist/pagination.d.ts +3 -7
- package/dist/pagination.js +1 -1
- package/dist/{popover-Dvls7-j4.d.ts → popover-BfB2I9G0.d.ts} +1 -3
- package/dist/popover.d.ts +1 -1
- package/dist/progress.d.ts +1 -7
- package/dist/qr-code.d.ts +2 -4
- package/dist/radio-group.d.ts +2 -4
- package/dist/radio-group.js +1 -1
- package/dist/sandbar.d.ts +5 -8
- package/dist/sandbar.js +1 -1
- package/dist/sandboxed-on-click.d.ts +1 -3
- package/dist/scatter-plot.d.ts +2 -4
- package/dist/scatter-plot.js +1 -1
- package/dist/{select-DlohFa54.d.ts → select-CRp_ndSJ.d.ts} +3 -5
- package/dist/select-iMsy6TFv.js +1 -0
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +3 -5
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-BWGjCIl7.d.ts → separator-DNovVsrx.d.ts} +3 -5
- package/dist/separator.d.ts +1 -1
- package/dist/{sheet-CAFS09pT.js → sheet-gMTepUM_.js} +1 -1
- package/dist/sheet.d.ts +3 -5
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +5 -9
- package/dist/sidebar.js +1 -1
- package/dist/{skeleton-zfqoDAxT.js → skeleton-DBpI-ko5.js} +1 -1
- package/dist/skeleton.d.ts +2 -4
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.d.ts +1 -3
- package/dist/slider.d.ts +1 -3
- package/dist/{slot-Q996Hqk9.d.ts → slot-C0OCJjdJ.d.ts} +2 -4
- package/dist/slot.d.ts +1 -1
- package/dist/split-button.d.ts +5 -7
- package/dist/split-button.js +1 -1
- package/dist/strata.d.ts +2 -4
- package/dist/switch.d.ts +2 -4
- package/dist/{table-BhzITa19.d.ts → table-vT6Okwfa.d.ts} +1 -3
- package/dist/table.d.ts +1 -1
- package/dist/tabs.d.ts +3 -5
- package/dist/text-area.d.ts +2 -4
- package/dist/text-area.js +1 -1
- package/dist/theme-BD0ly6jo.js +1 -0
- package/dist/theme-switcher.d.ts +67 -213
- package/dist/theme-switcher.js +1 -1
- package/dist/{theme-6OxNhf6l.d.ts → theme-w1CrMM-x.d.ts} +3 -5
- package/dist/theme.d.ts +78 -177
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +4 -6
- package/dist/toast.js +1 -1
- package/dist/{tooltip-CngH7Kl6.d.ts → tooltip-NcLIeBy5.d.ts} +1 -3
- package/dist/tooltip.d.ts +1 -1
- package/dist/truncated-text.d.ts +2 -4
- package/dist/types.d.ts +3 -3
- package/dist/utils.d.ts +2 -4
- package/dist/visually-hidden.d.ts +2 -4
- package/dist/well.d.ts +3 -5
- package/dist/{with-style-props-Dq5Vntqy.d.ts → with-style-props-CuT30s0W.d.ts} +0 -2
- package/package.json +2 -10
- package/dist/button-Bkl_QYpp.js +0 -1
- package/dist/button-b2HKEIE2.js +0 -1
- package/dist/chart-BfJ835dr.js +0 -2
- package/dist/dropdown-menu-DMA8dGxZ.d.ts +0 -1
- package/dist/icons-CW9lV9E1.js +0 -1
- package/dist/mantle-dark-high-contrast.css +0 -354
- package/dist/mantle-light-high-contrast.css +0 -353
- package/dist/select-Os5GVejP.js +0 -1
- package/dist/theme-Dzem-qRB.js +0 -1
package/dist/theme.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
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-w1CrMM-x.js";
|
|
2
2
|
import { PropsWithChildren } from "react";
|
|
3
|
-
//#region src/components/theme/mantle-style-sheets.d.ts
|
|
4
3
|
/**
|
|
5
|
-
* Browser-accessible
|
|
4
|
+
* Browser-accessible URL for mantle's lazy-loaded dark theme stylesheet.
|
|
6
5
|
*
|
|
7
|
-
* Use {@link mantleStyleSheetUrls} to create this object from Vite `?url`
|
|
6
|
+
* Use {@link mantleStyleSheetUrls} to create this object from a Vite `?url` import.
|
|
8
7
|
*
|
|
9
8
|
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
10
9
|
*/
|
|
@@ -18,198 +17,86 @@ type MantleThemeCssUrls = {
|
|
|
18
17
|
* ```
|
|
19
18
|
*/
|
|
20
19
|
darkCssUrl: string;
|
|
21
|
-
/**
|
|
22
|
-
* Browser-accessible URL for `mantle-light-high-contrast.css`.
|
|
23
|
-
* @example
|
|
24
|
-
* ```tsx
|
|
25
|
-
* // in vite app
|
|
26
|
-
* import lightHighContrastCssUrl from "@ngrok/mantle/mantle-light-high-contrast.css?url"
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
lightHighContrastCssUrl: string;
|
|
30
|
-
/**
|
|
31
|
-
* Browser-accessible URL for `mantle-dark-high-contrast.css`.
|
|
32
|
-
* @example
|
|
33
|
-
* ```tsx
|
|
34
|
-
* // in vite app
|
|
35
|
-
* import darkHighContrastCssUrl from "@ngrok/mantle/mantle-dark-high-contrast.css?url"
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
darkHighContrastCssUrl: string;
|
|
39
20
|
};
|
|
40
21
|
/**
|
|
41
|
-
* Collects the
|
|
22
|
+
* Collects the Vite `?url` import for mantle's dark theme stylesheet into a typed object
|
|
42
23
|
* that can be spread directly into `<MantleStyleSheets>`.
|
|
43
24
|
*
|
|
44
|
-
*
|
|
25
|
+
* @see https://mantle.ngrok.com/components/primitives/theme#mantlestylesheeturls
|
|
45
26
|
*
|
|
46
|
-
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
47
29
|
* import darkCssUrl from "@ngrok/mantle/mantle-dark.css?url";
|
|
48
|
-
* import darkHighContrastCssUrl from "@ngrok/mantle/mantle-dark-high-contrast.css?url";
|
|
49
|
-
* import lightHighContrastCssUrl from "@ngrok/mantle/mantle-light-high-contrast.css?url";
|
|
50
30
|
*
|
|
51
|
-
* const themeUrls = mantleStyleSheetUrls({ darkCssUrl
|
|
31
|
+
* const themeUrls = mantleStyleSheetUrls({ darkCssUrl });
|
|
52
32
|
*
|
|
53
|
-
*
|
|
54
|
-
* <MantleStyleSheets {...themeUrls} nonce={nonce} ssrCookie={ssrCookie} />
|
|
33
|
+
* <MantleStyleSheets {...themeUrls} />
|
|
55
34
|
* ```
|
|
56
|
-
*
|
|
57
|
-
* @see https://mantle.ngrok.com/components/primitives/theme#mantlestylesheeturls
|
|
58
35
|
*/
|
|
59
36
|
declare function mantleStyleSheetUrls(urls: MantleThemeCssUrls): MantleThemeCssUrls;
|
|
60
37
|
/**
|
|
61
|
-
* Props for {@link MantleStyleSheets}
|
|
62
|
-
* `forceTheme`, `ssrCookie`, and `nonce`.
|
|
38
|
+
* Props for {@link MantleStyleSheets}: the dark theme stylesheet URL.
|
|
63
39
|
*
|
|
64
40
|
* @see https://mantle.ngrok.com/components/primitives/theme#mantlestylesheets
|
|
65
41
|
*/
|
|
66
|
-
type MantleStyleSheetsProps = MantleThemeCssUrls
|
|
67
|
-
/**
|
|
68
|
-
* Force a specific resolved theme's stylesheet *pair* to load unconditionally
|
|
69
|
-
* (`media="all"`), regardless of the user's OS preference. Use this when your app is locked
|
|
70
|
-
* to a single theme (e.g. a dark-only page) so the required CSS is render-blocking as
|
|
71
|
-
* intended.
|
|
72
|
-
*
|
|
73
|
-
* Pairs, not single themes: the partner stylesheet (light ⇄ dark, light-high-contrast ⇄
|
|
74
|
-
* dark-high-contrast) is what `invert-theme` islands resolve against, so it is loaded and
|
|
75
|
-
* applied too. `forceTheme="light"` therefore renders the dark link (light itself is the
|
|
76
|
-
* base theme in `mantle.css`), and `forceTheme="light-high-contrast"` renders both
|
|
77
|
-
* high-contrast links. Only the *other* pair is omitted.
|
|
78
|
-
*
|
|
79
|
-
* Because the partner is *applied*, this prop only controls half the picture: which
|
|
80
|
-
* theme block wins is decided by the class on `<html>`. Mirror the same value into
|
|
81
|
-
* `PreventWrongThemeFlashScript` and `ThemeProvider` (and `useInitialHtmlThemeProps`
|
|
82
|
-
* if you use it) — those own that class. Forcing here alone leaves a user whose stored
|
|
83
|
-
* preference is dark with `<html class="dark">` and the dark sheet applied, so a
|
|
84
|
-
* `forceTheme="light"` page paints dark.
|
|
85
|
-
*
|
|
86
|
-
* When omitted, each stylesheet uses its OS media query and becomes non-render-blocking
|
|
87
|
-
* for users whose OS preference does not match.
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* // Dark-only app — always load the dark/light pair eagerly, and pin the root class
|
|
91
|
-
* <PreventWrongThemeFlashScript forceTheme="dark" nonce={nonce} />
|
|
92
|
-
* <MantleStyleSheets forceTheme="dark" {...themeUrls} />
|
|
93
|
-
* // …and <ThemeProvider forceTheme="dark"> around the app
|
|
94
|
-
*/
|
|
95
|
-
forceTheme?: ResolvedTheme;
|
|
96
|
-
/**
|
|
97
|
-
* The theme cookie string from the incoming HTTP request (e.g. `request.headers.get("Cookie")`
|
|
98
|
-
* or the pre-extracted value from {@link extractThemeCookie}). When set, the server can
|
|
99
|
-
* resolve the stored theme and render the correct `media` attribute directly in the SSR HTML.
|
|
100
|
-
* When the cookie stores a non-system theme, that removes the need for the inline fix script.
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```tsx
|
|
104
|
-
* // root.tsx loader
|
|
105
|
-
* export async function loader({ request }: Route.LoaderArgs) {
|
|
106
|
-
* return { ssrCookie: extractThemeCookie(request.headers.get("Cookie")) };
|
|
107
|
-
* }
|
|
108
|
-
*
|
|
109
|
-
* // root.tsx component
|
|
110
|
-
* <MantleStyleSheets {...themeUrls} ssrCookie={loaderData.ssrCookie} nonce={nonce} />
|
|
111
|
-
* ```
|
|
112
|
-
*/
|
|
113
|
-
ssrCookie?: string;
|
|
114
|
-
/**
|
|
115
|
-
* An optional CSP nonce to allowlist the inline script that fixes `media` attributes
|
|
116
|
-
* synchronously after the `<link>` tags are parsed. Mirror the same nonce you pass
|
|
117
|
-
* to {@link PreventWrongThemeFlashScript}.
|
|
118
|
-
*
|
|
119
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce
|
|
120
|
-
*/
|
|
121
|
-
nonce?: string;
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* Returns the raw JavaScript string for the inline `<script>` that runs synchronously
|
|
125
|
-
* after the `<link>` tags are parsed to fix their `media` attributes based on the applied
|
|
126
|
-
* theme already written to `html[data-applied-theme]` by `PreventWrongThemeFlashScript`.
|
|
127
|
-
* This eliminates FOUC for users who have manually selected a theme that differs from
|
|
128
|
-
* their OS preference.
|
|
129
|
-
*
|
|
130
|
-
* Use this when you need to inline the script directly into SSR HTML outside of a React
|
|
131
|
-
* context — for example, in a legacy Go service that renders the initial HTML response.
|
|
132
|
-
*
|
|
133
|
-
* @see https://mantle.ngrok.com/components/primitives/theme#fixmediascriptcontent
|
|
134
|
-
*
|
|
135
|
-
* @example
|
|
136
|
-
* ```go
|
|
137
|
-
* // In a Go template, inline script content that was pre-generated by mantle
|
|
138
|
-
* // (e.g., via fixMediaScriptContent(undefined) in a JS/Node build step)
|
|
139
|
-
* fmt.Fprintf(w, `<script nonce="%s">%s</script>`, nonce, scriptContent)
|
|
140
|
-
* ```
|
|
141
|
-
*/
|
|
142
|
-
declare function fixMediaScriptContent(forceTheme?: ResolvedTheme): string;
|
|
42
|
+
type MantleStyleSheetsProps = MantleThemeCssUrls;
|
|
143
43
|
/**
|
|
144
|
-
* Renders `<link rel="stylesheet">`
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* imports and spread them in:
|
|
150
|
-
*
|
|
151
|
-
* ```ts
|
|
152
|
-
* import darkCssUrl from "@ngrok/mantle/mantle-dark.css?url";
|
|
153
|
-
* import darkHighContrastCssUrl from "@ngrok/mantle/mantle-dark-high-contrast.css?url";
|
|
154
|
-
* import lightHighContrastCssUrl from "@ngrok/mantle/mantle-light-high-contrast.css?url";
|
|
155
|
-
*
|
|
156
|
-
* const themeUrls = mantleStyleSheetUrls({ darkCssUrl, lightHighContrastCssUrl, darkHighContrastCssUrl });
|
|
157
|
-
* ```
|
|
44
|
+
* Renders the `<link rel="stylesheet">` for mantle's dark theme. Every page
|
|
45
|
+
* needs it, light pages included: light and dark are a pair, and an
|
|
46
|
+
* `invert-theme` subtree on a light page paints in dark. The sheet scopes each
|
|
47
|
+
* rule to the dark theme class, so it changes nothing on a light page outside
|
|
48
|
+
* those subtrees.
|
|
158
49
|
*
|
|
159
50
|
* Place this component in `<head>`, after `<PreventWrongThemeFlashScript>`.
|
|
160
51
|
*
|
|
161
|
-
* On the client, a `MutationObserver` watches `html[data-applied-theme]` (kept in sync by
|
|
162
|
-
* `ThemeProvider`) and updates the `media` attributes to `"all"` when the user manually
|
|
163
|
-
* selects a theme that differs from their OS preference, so the browser applies the correct CSS.
|
|
164
|
-
*
|
|
165
|
-
* Theme pairs load together — the active theme's pair partner (light ⇄ dark,
|
|
166
|
-
* light-high-contrast ⇄ dark-high-contrast) also gets `media="all"` — so
|
|
167
|
-
* `invert-theme` subtrees always have their opposite theme's CSS applied.
|
|
168
|
-
*
|
|
169
|
-
* When `forceTheme` is set, only the link tags for that theme's pair are rendered — the other
|
|
170
|
-
* pair is omitted entirely to avoid unnecessary network requests. Note the pair partner is
|
|
171
|
-
* applied (`media="all"`), not merely fetched, so it is render-blocking; that is what lets
|
|
172
|
-
* `invert-theme` islands resolve under a forced theme.
|
|
173
|
-
*
|
|
174
52
|
* @see https://mantle.ngrok.com/components/primitives/theme#mantlestylesheets
|
|
175
53
|
*
|
|
176
54
|
* @example
|
|
177
55
|
* ```tsx
|
|
178
56
|
* // root.tsx
|
|
179
57
|
* import darkCssUrl from "@ngrok/mantle/mantle-dark.css?url";
|
|
180
|
-
* import darkHighContrastCssUrl from "@ngrok/mantle/mantle-dark-high-contrast.css?url";
|
|
181
|
-
* import lightHighContrastCssUrl from "@ngrok/mantle/mantle-light-high-contrast.css?url";
|
|
182
58
|
* import { mantleStyleSheetUrls, MantleStyleSheets, PreventWrongThemeFlashScript } from "@ngrok/mantle/theme";
|
|
183
59
|
*
|
|
184
|
-
* const themeUrls = mantleStyleSheetUrls({ darkCssUrl
|
|
60
|
+
* const themeUrls = mantleStyleSheetUrls({ darkCssUrl });
|
|
185
61
|
*
|
|
186
62
|
* <head>
|
|
187
63
|
* <PreventWrongThemeFlashScript nonce={nonce} />
|
|
188
|
-
* <MantleStyleSheets {...themeUrls}
|
|
64
|
+
* <MantleStyleSheets {...themeUrls} />
|
|
189
65
|
* </head>
|
|
190
66
|
* ```
|
|
191
67
|
*/
|
|
192
|
-
declare function MantleStyleSheets({ darkCssUrl
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
68
|
+
declare function MantleStyleSheets({ darkCssUrl }: MantleStyleSheetsProps): import("react").JSX.Element;
|
|
69
|
+
/**
|
|
70
|
+
* The options for the `setTheme` function that `useTheme` returns.
|
|
71
|
+
*/
|
|
72
|
+
type SetThemeOptions = {
|
|
73
|
+
/**
|
|
74
|
+
* The element the new theme grows from in the reveal, such as the control
|
|
75
|
+
* the user pressed. When omitted, the reveal grows from the focused
|
|
76
|
+
* element, else from the center of the viewport.
|
|
77
|
+
*/
|
|
78
|
+
origin?: Element | null;
|
|
79
|
+
};
|
|
80
|
+
type ThemeProviderState = [theme: Theme, setTheme: (theme: Theme | ((theme: Theme) => Theme), options?: SetThemeOptions) => void];
|
|
196
81
|
type ThemeProviderProps = PropsWithChildren<{
|
|
197
82
|
/**
|
|
198
83
|
* Pin the theme that renders, ignoring the stored preference and the OS. Pass
|
|
199
|
-
* the same value you pass `
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
84
|
+
* the same value you pass `PreventWrongThemeFlashScript` and
|
|
85
|
+
* `useInitialHtmlThemeProps`: each one writes the `<html>` class. Leaving them
|
|
86
|
+
* out of sync makes a page paint in a theme nobody asked for, because the dark
|
|
87
|
+
* stylesheet is always applied and a stale `.dark` on the root takes over a
|
|
88
|
+
* `forceTheme="light"` page.
|
|
204
89
|
*
|
|
205
|
-
* The stored preference is still read and still written by `setTheme`, so
|
|
206
|
-
*
|
|
90
|
+
* The stored preference is still read and still written by `setTheme`, so
|
|
91
|
+
* unforced pages honor the user's choice. `useAppliedTheme` returns the forced
|
|
92
|
+
* theme, and `ThemeSwitcher` is disabled, because a click cannot change what
|
|
93
|
+
* this page shows.
|
|
207
94
|
*/
|
|
208
95
|
forceTheme?: ResolvedTheme;
|
|
209
96
|
/**
|
|
210
97
|
* The theme cookie pair from the incoming request, read on the server only.
|
|
211
98
|
* Pass the value `extractThemeCookie` returns. Pass the same value to
|
|
212
|
-
* `
|
|
99
|
+
* `useInitialHtmlThemeProps`. The server then seeds
|
|
213
100
|
* the context with the stored theme, so the hydrated client agrees with the
|
|
214
101
|
* server HTML. When omitted, the server renders `"system"`. A client with a
|
|
215
102
|
* stored theme then reports a hydration mismatch. The client always reads
|
|
@@ -243,7 +130,21 @@ type ThemeProviderProps = PropsWithChildren<{
|
|
|
243
130
|
*/
|
|
244
131
|
declare function ThemeProvider({ children, forceTheme, ssrCookie }: ThemeProviderProps): import("react").JSX.Element;
|
|
245
132
|
/**
|
|
246
|
-
*
|
|
133
|
+
* Returns the stored theme and a function to set it. A `setTheme` call that
|
|
134
|
+
* changes the applied theme grows the new theme in a circle from
|
|
135
|
+
* `options.origin` in a view transition. It swaps at once under reduced
|
|
136
|
+
* motion, or when the browser has no view transitions. Pass an updater, such
|
|
137
|
+
* as `(theme) => next`, when the next theme depends on the current one: it
|
|
138
|
+
* reads the latest theme, even when a second call comes before the first
|
|
139
|
+
* swap runs.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```tsx
|
|
143
|
+
* const [theme, setTheme] = useTheme();
|
|
144
|
+
* <Button type="button" onClick={(event) => setTheme("dark", { origin: event.currentTarget })}>
|
|
145
|
+
* Dark
|
|
146
|
+
* </Button>;
|
|
147
|
+
* ```
|
|
247
148
|
*
|
|
248
149
|
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
249
150
|
*
|
|
@@ -256,16 +157,17 @@ declare function useTheme(): ThemeProviderState;
|
|
|
256
157
|
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
257
158
|
*/
|
|
258
159
|
declare function readThemeFromHtmlElement(): {
|
|
259
|
-
appliedTheme: "dark" | "
|
|
260
|
-
theme: "dark" | "
|
|
160
|
+
appliedTheme: "dark" | "light" | undefined;
|
|
161
|
+
theme: "dark" | "light" | "system" | undefined;
|
|
261
162
|
};
|
|
262
163
|
/**
|
|
263
|
-
*
|
|
264
|
-
*
|
|
164
|
+
* Returns the theme the page paints in: the provider's `forceTheme` when it
|
|
165
|
+
* has one, else the stored theme with `"system"` resolved against the OS
|
|
166
|
+
* dark-mode preference. The result mirrors what lands on the `<html>` element.
|
|
265
167
|
*
|
|
266
168
|
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
267
169
|
*/
|
|
268
|
-
declare function useAppliedTheme(): "dark" | "
|
|
170
|
+
declare function useAppliedTheme(): "dark" | "light";
|
|
269
171
|
/**
|
|
270
172
|
* preventWrongThemeFlashScriptContent generates a script that prevents the wrong theme from flashing on initial page load.
|
|
271
173
|
* It checks cookies for a stored theme, and if none is found, it sets the default theme.
|
|
@@ -274,7 +176,7 @@ declare function useAppliedTheme(): "dark" | "dark-high-contrast" | "light" | "l
|
|
|
274
176
|
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
275
177
|
*
|
|
276
178
|
* @param forceTheme - Pin the applied theme, bypassing the stored preference and
|
|
277
|
-
* the OS. Mirror the value passed to `
|
|
179
|
+
* the OS. Mirror the value passed to `ThemeProvider` and `useInitialHtmlThemeProps`.
|
|
278
180
|
*
|
|
279
181
|
* @example
|
|
280
182
|
* ```ts
|
|
@@ -286,9 +188,9 @@ declare function preventWrongThemeFlashScriptContent(forceTheme?: ResolvedTheme)
|
|
|
286
188
|
type PreventWrongThemeFlashScriptProps = {
|
|
287
189
|
/**
|
|
288
190
|
* Pin the theme this page paints in, bypassing the stored preference and the
|
|
289
|
-
* OS. Mirror the same value you pass `
|
|
290
|
-
*
|
|
291
|
-
*
|
|
191
|
+
* OS. Mirror the same value you pass `ThemeProvider` and
|
|
192
|
+
* `useInitialHtmlThemeProps`. This one writes the `<html>` class before first
|
|
193
|
+
* paint.
|
|
292
194
|
*/
|
|
293
195
|
forceTheme?: ResolvedTheme;
|
|
294
196
|
/**
|
|
@@ -328,7 +230,7 @@ type PreventWrongThemeFlashScriptProps = {
|
|
|
328
230
|
* </head>
|
|
329
231
|
* ```
|
|
330
232
|
*
|
|
331
|
-
* @param forceTheme - Optional theme to pin, mirroring `
|
|
233
|
+
* @param forceTheme - Optional theme to pin, mirroring `ThemeProvider` and `useInitialHtmlThemeProps`.
|
|
332
234
|
* @param nonce - Optional CSP nonce to allowlist the inline script under a strict CSP.
|
|
333
235
|
* @returns {JSX.Element} A script tag injected before first paint.
|
|
334
236
|
* @see preloadFontLink
|
|
@@ -345,8 +247,8 @@ type UseInitialHtmlThemePropsOptions = {
|
|
|
345
247
|
className?: string;
|
|
346
248
|
/**
|
|
347
249
|
* Pin the resolved theme in the returned props, bypassing the cookie and the
|
|
348
|
-
* OS. Mirror the same value you pass `
|
|
349
|
-
* `
|
|
250
|
+
* OS. Mirror the same value you pass `PreventWrongThemeFlashScript` and
|
|
251
|
+
* `ThemeProvider`.
|
|
350
252
|
*/
|
|
351
253
|
forceTheme?: ResolvedTheme;
|
|
352
254
|
/**
|
|
@@ -371,24 +273,26 @@ type GetStoredThemeOptions = {
|
|
|
371
273
|
/**
|
|
372
274
|
* Returns the persisted UI theme from a Cookie header string.
|
|
373
275
|
*
|
|
374
|
-
* Looks for a cookie named by {@link THEME_STORAGE_KEY}
|
|
375
|
-
*
|
|
376
|
-
* {@link DEFAULT_THEME}. This function never
|
|
377
|
-
*
|
|
276
|
+
* Looks for a cookie named by {@link THEME_STORAGE_KEY}. A retired
|
|
277
|
+
* high-contrast value returns its base theme (`"light"` or `"dark"`). Any other
|
|
278
|
+
* value that is not a `Theme` returns {@link DEFAULT_THEME}. This function never
|
|
279
|
+
* throws.
|
|
378
280
|
*
|
|
379
281
|
* @see https://mantle.ngrok.com/components/primitives/theme
|
|
380
282
|
*
|
|
381
283
|
* @example
|
|
382
284
|
* getStoredTheme({ cookie: `${THEME_STORAGE_KEY}=dark; session=abc` }) // "dark"
|
|
383
285
|
* @example
|
|
286
|
+
* getStoredTheme({ cookie: `${THEME_STORAGE_KEY}=dark-high-contrast` }) // "dark"
|
|
287
|
+
* @example
|
|
384
288
|
* getStoredTheme({ cookie: "" }) // DEFAULT_THEME
|
|
385
289
|
*/
|
|
386
290
|
declare function getStoredTheme({ cookie }: GetStoredThemeOptions): Theme;
|
|
387
291
|
/**
|
|
388
292
|
* Extract only the mantle theme cookie from a raw `Cookie` header string.
|
|
389
293
|
*
|
|
390
|
-
* Use this in SSR loaders to pass the theme cookie to {@link ThemeProvider}
|
|
391
|
-
*
|
|
294
|
+
* Use this in SSR loaders to pass the theme cookie to {@link ThemeProvider}
|
|
295
|
+
* and {@link useInitialHtmlThemeProps} without exposing
|
|
392
296
|
* the full `Cookie` header (which may contain HttpOnly/session cookies) in
|
|
393
297
|
* serialized loader data.
|
|
394
298
|
*
|
|
@@ -407,8 +311,6 @@ declare function getStoredTheme({ cookie }: GetStoredThemeOptions): Theme;
|
|
|
407
311
|
* @returns The `mantle-ui-theme=<value>` cookie string, or undefined if not found.
|
|
408
312
|
*/
|
|
409
313
|
declare function extractThemeCookie(cookieHeader: string | null | undefined): string | undefined;
|
|
410
|
-
//#endregion
|
|
411
|
-
//#region src/components/theme/fonts.d.ts
|
|
412
314
|
/**
|
|
413
315
|
* @file Helpers for preloading ngrok brand fonts from the CDN.
|
|
414
316
|
* All font URLs resolve to `${assetsCdnOrigin}/fonts`.
|
|
@@ -509,5 +411,4 @@ declare function preloadFontLink(name: CoreFontName): string;
|
|
|
509
411
|
* ```
|
|
510
412
|
*/
|
|
511
413
|
declare const PreloadFont: ({ name }: PreloadFontProps) => import("react").JSX.Element;
|
|
512
|
-
|
|
513
|
-
export { $resolvedTheme, $theme, type CoreFontName, MantleStyleSheets, type MantleStyleSheetsProps, type MantleThemeCssUrls, PreloadFont, PreventWrongThemeFlashScript, type ResolvedTheme, type Theme, ThemeProvider, assetsCdnOrigin, extractThemeCookie, fixMediaScriptContent, fontHref, getStoredTheme, isResolvedTheme, isTheme, mantleStyleSheetUrls, preloadFontLink, preventWrongThemeFlashScriptContent, readThemeFromHtmlElement, resolvedThemes, themes, useAppliedTheme, useInitialHtmlThemeProps, useTheme };
|
|
414
|
+
export { $resolvedTheme, $theme, type CoreFontName, MantleStyleSheets, type MantleStyleSheetsProps, type MantleThemeCssUrls, PreloadFont, PreventWrongThemeFlashScript, type ResolvedTheme, type SetThemeOptions, type Theme, ThemeProvider, assetsCdnOrigin, extractThemeCookie, fontHref, getStoredTheme, isResolvedTheme, isTheme, mantleStyleSheetUrls, preloadFontLink, preventWrongThemeFlashScriptContent, readThemeFromHtmlElement, resolvedThemes, themes, useAppliedTheme, useInitialHtmlThemeProps, useTheme };
|
package/dist/theme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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-BD0ly6jo.js";import{c as h}from"react/compiler-runtime";import{jsx as g}from"react/jsx-runtime";function _(e){return e}function v(e){let t=h(2),{darkCssUrl:n}=e,r;return t[0]===n?r=t[1]:(r=/* @__PURE__ */ g(`link`,{rel:`stylesheet`,id:`mantle-dark-styles`,href:n}),t[0]=n,t[1]=r),r}const y=`https://assets.ngrok.com`,b=`${y}/fonts`,x={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 S(e){let t=e.startsWith(`/`)?e:`/${e}`;return`${b}${t}`}function C(e){return`<${S(x[e])}>; rel=preload; as=font; type="font/woff2"; crossorigin`}const w=e=>{let t=h(4),{name:n}=e,r=x[n],i;t[0]===r?i=t[1]:(i=S(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,v as MantleStyleSheets,w as PreloadFont,p as PreventWrongThemeFlashScript,l as ThemeProvider,y as assetsCdnOrigin,d as extractThemeCookie,S as fontHref,o as getStoredTheme,c as isResolvedTheme,a as isTheme,_ as mantleStyleSheetUrls,C 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.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { n as WithAsChild } from "./as-child-
|
|
2
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
3
|
-
import { t as WithStyleProps } from "./with-style-props-
|
|
4
|
-
import { n as SvgOnlyProps } from "./icon-
|
|
1
|
+
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
+
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
3
|
+
import { t as WithStyleProps } from "./with-style-props-CuT30s0W.js";
|
|
4
|
+
import { n as SvgOnlyProps } from "./icon-DXDyhy2N.js";
|
|
5
5
|
import { ComponentProps, ReactNode } from "react";
|
|
6
6
|
import { Toaster as Toaster$1 } from "sonner";
|
|
7
|
-
//#region src/components/toast/toast.d.ts
|
|
8
7
|
type ToasterPrimitiveProps = ComponentProps<typeof Toaster$1>;
|
|
9
8
|
type ToasterProps = WithStyleProps & Pick<ToasterPrimitiveProps, "containerAriaLabel" | "dir" | "position"> & {
|
|
10
9
|
/**
|
|
@@ -277,5 +276,4 @@ declare const Toast: {
|
|
|
277
276
|
*/
|
|
278
277
|
readonly Message: typeof Message;
|
|
279
278
|
};
|
|
280
|
-
//#endregion
|
|
281
279
|
export { Toast, type ToastIntent, Toaster, makeToast };
|
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-
|
|
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-BD0ly6jo.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,7 +1,6 @@
|
|
|
1
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
1
|
+
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
2
2
|
import { ComponentProps, ComponentPropsWithoutRef } from "react";
|
|
3
3
|
import { Content, Provider, Root, Trigger } from "@radix-ui/react-tooltip";
|
|
4
|
-
//#region src/components/tooltip/tooltip.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Wraps your app to set shared global behavior for your tooltips, such
|
|
7
6
|
* as consistent delay and hover settings. Mount exactly one instance, preferably
|
|
@@ -274,5 +273,4 @@ declare const Tooltip: {
|
|
|
274
273
|
*/
|
|
275
274
|
readonly Trigger: typeof Trigger$1;
|
|
276
275
|
};
|
|
277
|
-
//#endregion
|
|
278
276
|
export { TooltipProvider as n, Tooltip as t };
|
package/dist/tooltip.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as TooltipProvider, t as Tooltip } from "./tooltip-
|
|
1
|
+
import { n as TooltipProvider, t as Tooltip } from "./tooltip-NcLIeBy5.js";
|
|
2
2
|
export { Tooltip, TooltipProvider };
|
package/dist/truncated-text.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { t as SelfClosingWithAsChild } from "./as-child-
|
|
2
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
1
|
+
import { t as SelfClosingWithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
+
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
3
3
|
import { ComponentProps } from "react";
|
|
4
|
-
//#region src/components/truncated-text/truncated-text.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Props for `TruncatedText`. The type omits `children`: `value` is the content,
|
|
7
6
|
* and `asChild` takes the single element to render it in.
|
|
@@ -142,5 +141,4 @@ type TruncatedTextProps = Omit<ComponentProps<"span">, "children" | "translate">
|
|
|
142
141
|
* ```
|
|
143
142
|
*/
|
|
144
143
|
declare const TruncatedText: ({ "aria-describedby": describedBy, asChild, children, className, "data-slot": dataSlot, onFocus, onPointerMove, ref, style, tabIndex, tail, translate, value, ...props }: TruncatedTextProps) => import("react").JSX.Element;
|
|
145
|
-
//#endregion
|
|
146
144
|
export { TruncatedText, type TruncatedTextProps };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as WithAsChild } from "./as-child-
|
|
2
|
-
import { a as Booleanish, i as DeepNonNullable, n as CssProperties, o as parseBooleanish, r as VariantProps, t as $cssProperties } from "./index-
|
|
3
|
-
import { t as WithStyleProps } from "./with-style-props-
|
|
1
|
+
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
+
import { a as Booleanish, i as DeepNonNullable, n as CssProperties, o as parseBooleanish, r as VariantProps, t as $cssProperties } from "./index-C6s5cGCr.js";
|
|
3
|
+
import { t as WithStyleProps } from "./with-style-props-CuT30s0W.js";
|
|
4
4
|
export { $cssProperties, type Booleanish, type CssProperties, type DeepNonNullable, type VariantProps, type WithAsChild, type WithStyleProps, parseBooleanish };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { _ as timeSortingDirections, a as AlphanumericSortingDirection, c as TimeSortingDirection, d as isSortingDirection, f as isSortingMode, g as timeSortingByDirection, h as sortingModes, i as $timeSortingDirection, l as alphanumericSortingDirections, m as sortingDirections, n as $sortingDirection, o as SortingDirection, p as isTimeSortingDirection, r as $sortingMode, s as SortingMode, t as $alphanumericSortingDirection, u as isAlphanumericSortingDirection } from "./direction-
|
|
2
|
-
import { a as composeRefs, i as inView, n as MarginType, r as ViewChangeHandler, s as copyToClipboard, t as InViewOptions } from "./in-view-
|
|
3
|
-
//#region src/utils/sorting/compare.d.ts
|
|
1
|
+
import { _ as timeSortingDirections, a as AlphanumericSortingDirection, c as TimeSortingDirection, d as isSortingDirection, f as isSortingMode, g as timeSortingByDirection, h as sortingModes, i as $timeSortingDirection, l as alphanumericSortingDirections, m as sortingDirections, n as $sortingDirection, o as SortingDirection, p as isTimeSortingDirection, r as $sortingMode, s as SortingMode, t as $alphanumericSortingDirection, u as isAlphanumericSortingDirection } from "./direction-CpRzTtZh.js";
|
|
2
|
+
import { a as composeRefs, i as inView, n as MarginType, r as ViewChangeHandler, s as copyToClipboard, t as InViewOptions } from "./in-view-B3nMAzfE.js";
|
|
4
3
|
/**
|
|
5
4
|
* Compare dates in newest-to-oldest (descending) order.
|
|
6
5
|
* Used for chronological sorting use cases.
|
|
@@ -15,5 +14,4 @@ declare function compareDatesNewestToOldest(a: Date, b: Date): number;
|
|
|
15
14
|
* @returns A negative number if `a` comes earlier in time than `b`; positive if `a` comes later in time than `b`; 0 if they are equivalent.
|
|
16
15
|
*/
|
|
17
16
|
declare function compareDatesOldestToNewest(a: Date, b: Date): number;
|
|
18
|
-
//#endregion
|
|
19
17
|
export { $alphanumericSortingDirection, $sortingDirection, $sortingMode, $timeSortingDirection, type AlphanumericSortingDirection, type InViewOptions, type MarginType, type SortingDirection, type SortingMode, type TimeSortingDirection, type ViewChangeHandler, alphanumericSortingDirections, compareDatesNewestToOldest, compareDatesOldestToNewest, composeRefs, copyToClipboard, inView, isAlphanumericSortingDirection, isSortingDirection, isSortingMode, isTimeSortingDirection, sortingDirections, sortingModes, timeSortingByDirection, timeSortingDirections };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { n as WithAsChild } from "./as-child-
|
|
2
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
1
|
+
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
+
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
3
3
|
import { ComponentProps } from "react";
|
|
4
|
-
//#region src/components/visually-hidden/visually-hidden.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Content for assistive technology only. Renders a native `<span>` clipped to
|
|
7
6
|
* a one-pixel box (the `sr-only` technique, never `display: none`). Screen
|
|
@@ -38,5 +37,4 @@ import { ComponentProps } from "react";
|
|
|
38
37
|
* ```
|
|
39
38
|
*/
|
|
40
39
|
declare const VisuallyHidden: ({ "data-slot": dataSlot, asChild, className, ref, ...props }: ComponentProps<"span"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
41
|
-
//#endregion
|
|
42
40
|
export { VisuallyHidden };
|
package/dist/well.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { n as WithAsChild } from "./as-child-
|
|
2
|
-
import { t as WithDataSlot } from "./data-slot-
|
|
3
|
-
import "./index-
|
|
1
|
+
import { n as WithAsChild } from "./as-child-DFxX3U2i.js";
|
|
2
|
+
import { t as WithDataSlot } from "./data-slot-B-LqAcBB.js";
|
|
3
|
+
import "./index-C6s5cGCr.js";
|
|
4
4
|
import { ComponentProps } from "react";
|
|
5
|
-
//#region src/components/well/well.d.ts
|
|
6
5
|
type WellProps = ComponentProps<"div"> & WithAsChild & WithDataSlot;
|
|
7
6
|
/**
|
|
8
7
|
* A recessed, inset container used to visually group and de-emphasize content
|
|
@@ -37,5 +36,4 @@ type WellProps = ComponentProps<"div"> & WithAsChild & WithDataSlot;
|
|
|
37
36
|
* ```
|
|
38
37
|
*/
|
|
39
38
|
declare const Well: ({ "data-slot": dataSlot, asChild, className, ref, ...props }: WellProps) => import("react").JSX.Element;
|
|
40
|
-
//#endregion
|
|
41
39
|
export { Well };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CSSProperties } from "react";
|
|
2
|
-
//#region src/types/with-style-props.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Helper type that includes an optional className and style prop for react
|
|
5
4
|
* components.
|
|
@@ -23,5 +22,4 @@ type WithStyleProps = {
|
|
|
23
22
|
*/
|
|
24
23
|
style?: CSSProperties;
|
|
25
24
|
};
|
|
26
|
-
//#endregion
|
|
27
25
|
export { WithStyleProps as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngrok/mantle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.91.0",
|
|
4
4
|
"description": "mantle is ngrok's UI library and design system.",
|
|
5
5
|
"homepage": "https://mantle.ngrok.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,14 +26,6 @@
|
|
|
26
26
|
"style": "./dist/mantle-dark.css",
|
|
27
27
|
"default": "./dist/mantle-dark.css"
|
|
28
28
|
},
|
|
29
|
-
"./mantle-light-high-contrast.css": {
|
|
30
|
-
"style": "./dist/mantle-light-high-contrast.css",
|
|
31
|
-
"default": "./dist/mantle-light-high-contrast.css"
|
|
32
|
-
},
|
|
33
|
-
"./mantle-dark-high-contrast.css": {
|
|
34
|
-
"style": "./dist/mantle-dark-high-contrast.css",
|
|
35
|
-
"default": "./dist/mantle-dark-high-contrast.css"
|
|
36
|
-
},
|
|
37
29
|
"./source-all.css": {
|
|
38
30
|
"style": "./dist/source-all.css",
|
|
39
31
|
"default": "./dist/source-all.css"
|
|
@@ -135,7 +127,7 @@
|
|
|
135
127
|
"@radix-ui/react-tabs": "1.2.1",
|
|
136
128
|
"@radix-ui/react-tooltip": "1.4.1",
|
|
137
129
|
"@tanstack/react-table": "9.3.1",
|
|
138
|
-
"@tanstack/react-virtual": "3.14.
|
|
130
|
+
"@tanstack/react-virtual": "3.14.22",
|
|
139
131
|
"class-variance-authority": "0.7.1",
|
|
140
132
|
"cmdk": "1.1.1",
|
|
141
133
|
"d3-scale": "4.0.2",
|
package/dist/button-Bkl_QYpp.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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{t as i}from"./booleanish-BfvnW6vy.js";import{n as a}from"./button-b2HKEIE2.js";import{t as o}from"./button-DTpsT864.js";import{c as s}from"react/compiler-runtime";import{Children as c,cloneElement as l,isValidElement as u}from"react";import d from"tiny-invariant";import{jsx as f}from"react/jsx-runtime";import{CircleNotchIcon as p}from"@phosphor-icons/react/CircleNotch";const m=m=>{let h=s(57),g,_,v,y,b,x,S,C,w,T,E,D,O,k,A;h[0]===m?(g=h[1],_=h[2],v=h[3],y=h[4],b=h[5],x=h[6],S=h[7],C=h[8],w=h[9],T=h[10],E=h[11],D=h[12],O=h[13],k=h[14],A=h[15]):({"aria-disabled":g,"data-slot":x,appearance:v,asChild:D,children:y,className:b,disabled:_,icon:w,intent:S,isLoading:O,label:C,ref:E,size:k,type:A,...T}=m,h[0]=m,h[1]=g,h[2]=_,h[3]=v,h[4]=y,h[5]=b,h[6]=x,h[7]=S,h[8]=C,h[9]=w,h[10]=T,h[11]=E,h[12]=D,h[13]=O,h[14]=k,h[15]=A);let j=D!==void 0&&D,M=O!==void 0&&O,N=k===void 0?`md`:k,P;h[16]!==g||h[17]!==_||h[18]!==M?(P=i(_??M)||i(g),h[16]=g,h[17]=_,h[18]=M,h[19]=P):P=h[19];let F=P,I;h[20]!==M||h[21]!==w?(I=M?/* @__PURE__ */ f(p,{className:`animate-spin`}):w,h[20]=M,h[21]=w,h[22]=I):I=h[22];let L=I,R;h[23]===x?R=h[24]:(R=t(x,`icon-button`),h[23]=x,h[24]=R);let z;h[25]!==v||h[26]!==b||h[27]!==S||h[28]!==M||h[29]!==N?(z=e(o({appearance:v,intent:S,isLoading:M,size:N}),b),h[25]=v,h[26]=b,h[27]=S,h[28]=M,h[29]=N,h[30]=z):z=h[30];let B=F?``:void 0,V=M?``:void 0,H;h[31]!==v||h[32]!==F||h[33]!==S||h[34]!==C||h[35]!==T||h[36]!==E||h[37]!==N||h[38]!==R||h[39]!==z||h[40]!==B||h[41]!==V?(H={"aria-disabled":F,"data-slot":R,className:z,"data-appearance":v,"data-disabled":B,"data-icon-button":!0,"data-intent":S,"data-loading":V,"data-size":N,ref:E,...T,"aria-label":C},h[31]=v,h[32]=F,h[33]=S,h[34]=C,h[35]=T,h[36]=E,h[37]=N,h[38]=R,h[39]=z,h[40]=B,h[41]=V,h[42]=H):H=h[42];let U=H,W;h[43]===L?W=h[44]:(W=/* @__PURE__ */ f(n,{svg:L}),h[43]=L,h[44]=W);let G=W;if(j){d(u(y)&&c.only(y),"When using `asChild`, IconButton must be passed a single child as a JSX tag.");let e;h[45]!==y||h[46]!==F||h[47]!==G?(e=l(y,F?a:{},G),h[45]=y,h[46]=F,h[47]=G,h[48]=e):e=h[48];let t;return h[49]!==U||h[50]!==e?(t=/* @__PURE__ */ f(r,{...U,children:e}),h[49]=U,h[50]=e,h[51]=t):t=h[51],t}let K=A??`button`,q;return h[52]!==U||h[53]!==F||h[54]!==G||h[55]!==K?(q=/* @__PURE__ */ f(`button`,{...U,disabled:F,type:K,children:G}),h[52]=U,h[53]=F,h[54]=G,h[55]=K,h[56]=q):q=h[56],q};export{m as t};
|