@fungi.computer/caps 0.10.0 → 0.10.1
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.
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { type ToasterProps } from "sonner";
|
|
2
|
-
|
|
2
|
+
import { toast } from "sonner";
|
|
3
|
+
export { toast };
|
|
4
|
+
/**
|
|
5
|
+
* Show a notice a hosted App asked for, on one named Toaster, with the
|
|
6
|
+
* notice's tone choosing the Caps status dot.
|
|
7
|
+
*/
|
|
8
|
+
export declare function showNotice(notice: Readonly<{
|
|
9
|
+
message: string;
|
|
10
|
+
tone?: "error" | "info" | "success" | "warning";
|
|
11
|
+
}>, toasterId: string): void;
|
|
3
12
|
/**
|
|
4
13
|
* Sonner owns gestures, stacking, focus and lifetime; Caps owns the surface.
|
|
5
14
|
* Colors come from the Stipe tokens in the cascade, so a `data-theme` switch
|
|
@@ -6,7 +6,19 @@ import { Loader } from "./loader.js";
|
|
|
6
6
|
import { Status } from "./status.js";
|
|
7
7
|
import { createPortal } from "react-dom";
|
|
8
8
|
import { useOverlayRoot } from "./overlay-root.js";
|
|
9
|
-
|
|
9
|
+
import { toast } from "sonner";
|
|
10
|
+
export { toast };
|
|
11
|
+
/**
|
|
12
|
+
* Show a notice a hosted App asked for, on one named Toaster, with the
|
|
13
|
+
* notice's tone choosing the Caps status dot.
|
|
14
|
+
*/
|
|
15
|
+
export function showNotice(notice, toasterId) {
|
|
16
|
+
const options = { toasterId, closeButton: true };
|
|
17
|
+
if (notice.tone === undefined)
|
|
18
|
+
toast(notice.message, options);
|
|
19
|
+
else
|
|
20
|
+
toast[notice.tone](notice.message, options);
|
|
21
|
+
}
|
|
10
22
|
/**
|
|
11
23
|
* Sonner owns gestures, stacking, focus and lifetime; Caps owns the surface.
|
|
12
24
|
* Colors come from the Stipe tokens in the cascade, so a `data-theme` switch
|
|
@@ -10,6 +10,28 @@
|
|
|
10
10
|
|
|
11
11
|
## Functions
|
|
12
12
|
|
|
13
|
+
### showNotice()
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
function showNotice(notice, toasterId): void;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Show a notice a hosted App asked for, on one named Toaster, with the notice's
|
|
20
|
+
tone choosing the Caps status dot.
|
|
21
|
+
|
|
22
|
+
#### Parameters
|
|
23
|
+
|
|
24
|
+
| Parameter | Type |
|
|
25
|
+
| ----------- | ------------------------------------------------------------------------------------------------------ |
|
|
26
|
+
| `notice` | `Readonly`\<\{ `message`: `string`; `tone?`: `"error"` \| `"info"` \| `"success"` \| `"warning"`; \}\> |
|
|
27
|
+
| `toasterId` | `string` |
|
|
28
|
+
|
|
29
|
+
#### Returns
|
|
30
|
+
|
|
31
|
+
`void`
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
13
35
|
### Toaster()
|
|
14
36
|
|
|
15
37
|
```ts
|