feat: Phase 0 shells, design system, server skeleton, Docker and CI
- Titano.Ui: DESIGN.md tokens (dark/light), generated 16-px icon set, styles for all standard controls, custom chrome window with snap layouts, rail, job bar, Auto/manual slider, chips, toasts. - Titano desktop shell with sections, Settings (language, theme), About and a --capture screenshot mode. - Titano Server skeleton: env/server.json configuration, self-signed TLS with fingerprint, /health, /server/info, i18n endpoint and the embedded admin panel; in-process server tests. - Docker image (multi-arch, PUID/PGID, health check), compose file, Unraid template; CI, release and nightly workflows; changelog tool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
122 files changed
+6838
-22
No files matched your search
@@ -0,0 +1,79 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using Titano.Ui.Mvvm;
|
||||
|
||||
namespace Titano.Ui.Controls;
|
||||
|
||||
/// <summary>One in-window notification (DESIGN §4: 420 px, accent left edge, one action, 8 s, hover pauses).</summary>
|
||||
public sealed class Toast : ObservableObject
|
||||
{
|
||||
public required string Title { get; init; }
|
||||
public string? Message { get; init; }
|
||||
public string? ActionText { get; init; }
|
||||
public ICommand? ActionCommand { get; init; }
|
||||
public string? ActionToolTip { get; init; }
|
||||
public TimeSpan Lifetime { get; init; } = TimeSpan.FromSeconds(8);
|
||||
}
|
||||
|
||||
/// <summary>Bottom-right stack of <see cref="Toast"/>s with auto-dismiss.</summary>
|
||||
public class ToastHost : ItemsControl
|
||||
{
|
||||
private readonly Dictionary<Toast, DispatcherTimer> _timers = [];
|
||||
|
||||
static ToastHost()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(ToastHost), new FrameworkPropertyMetadata(typeof(ToastHost)));
|
||||
}
|
||||
|
||||
public ToastHost()
|
||||
{
|
||||
ItemsSource = Toasts;
|
||||
CommandBindings.Add(new CommandBinding(DismissCommand, (_, e) =>
|
||||
{
|
||||
if (e.Parameter is Toast t) Dismiss(t);
|
||||
}));
|
||||
}
|
||||
|
||||
public static RoutedCommand DismissCommand { get; } = new(nameof(DismissCommand), typeof(ToastHost));
|
||||
|
||||
public ObservableCollection<Toast> Toasts { get; } = [];
|
||||
|
||||
public void Show(Toast toast)
|
||||
{
|
||||
Toasts.Add(toast);
|
||||
while (Toasts.Count > 3) Dismiss(Toasts[0]);
|
||||
var timer = new DispatcherTimer { Interval = toast.Lifetime };
|
||||
timer.Tick += (_, _) => Dismiss(toast);
|
||||
_timers[toast] = timer;
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
/// <summary>Pauses or resumes the dismissal timer (hover pauses).</summary>
|
||||
public void SetPaused(Toast toast, bool paused)
|
||||
{
|
||||
if (!_timers.TryGetValue(toast, out var timer)) return;
|
||||
if (paused) timer.Stop();
|
||||
else timer.Start();
|
||||
}
|
||||
|
||||
public void Dismiss(Toast toast)
|
||||
{
|
||||
if (_timers.Remove(toast, out var timer)) timer.Stop();
|
||||
Toasts.Remove(toast);
|
||||
}
|
||||
|
||||
protected override void OnPreviewMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnPreviewMouseMove(e);
|
||||
foreach (var t in Toasts.ToList()) SetPaused(t, true);
|
||||
}
|
||||
|
||||
protected override void OnMouseLeave(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseLeave(e);
|
||||
foreach (var t in Toasts.ToList()) SetPaused(t, false);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user