@opencode/ui 0.0.0-dev-19826 → 0.0.0-dev-19833
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/package.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// A toast shows a few lines; the rest of a long description would only be retained (in the dedupe
|
|
2
|
+
// key, the active-toast registry and the toaster's store) for as long as the toast lives. Server
|
|
3
|
+
// errors have carried a whole data URL here.
|
|
4
|
+
export const toastDescriptionLimit = 2000
|
|
5
|
+
|
|
6
|
+
export function boundToastDescription<T extends { description?: string }>(options: T): T {
|
|
7
|
+
if (!options.description || options.description.length <= toastDescriptionLimit) return options
|
|
8
|
+
return { ...options, description: `${options.description.slice(0, toastDescriptionLimit)}…` }
|
|
9
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Toaster, toast, type ToasterProps } from "solid-sonner"
|
|
2
|
+
import { boundToastDescription } from "./description"
|
|
2
3
|
import { isRTL } from "@kobalte/core/i18n"
|
|
3
4
|
import type { ComponentProps, JSX } from "solid-js"
|
|
4
5
|
import { createContext, onCleanup, onMount, splitProps, useContext } from "solid-js"
|
|
@@ -205,7 +206,7 @@ const activeToastByKey = new Map<string, ActiveToast>()
|
|
|
205
206
|
const activeToastById = new Map<number, ActiveToast>()
|
|
206
207
|
|
|
207
208
|
export function showToast(options: ToastOptions | string) {
|
|
208
|
-
const opts
|
|
209
|
+
const opts = boundToastDescription(typeof options === "string" ? { description: options } : options)
|
|
209
210
|
const key = JSON.stringify({
|
|
210
211
|
title: opts.title,
|
|
211
212
|
description: opts.description,
|