restores Helder in all its glory

This commit is contained in:
2026-09-28 11:34:49 +02:00
parent c2b38b853c
commit 1d29d0952d
280 changed files with 29205 additions and 7 deletions
+28
View File
@@ -0,0 +1,28 @@
import Foundation
import Observation
public struct Toast: Identifiable, Equatable {
public let id = UUID()
public var title: String
/// A path or reference, shown in mono under the title.
public var detail: String?
}
/// Short confirmations in a corner. They may sit over an overlay; they are not one.
@Observable
@MainActor
public final class ToastStore {
public static let lifetime: Duration = .milliseconds(2300)
public private(set) var toasts: [Toast] = []
public init() {}
public func show(_ title: String, detail: String? = nil) {
let toast = Toast(title: title, detail: detail)
toasts.append(toast)
Task { [weak self] in
try? await Task.sleep(for: Self.lifetime)
self?.toasts.removeAll { $0.id == toast.id }
}
}
}