Skip to content

Commit

Permalink
Merge branch 'main' into saved_settings
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzh0816 authored Aug 25, 2024
2 parents 31f2e10 + b61a64e commit f57f557
Show file tree
Hide file tree
Showing 77 changed files with 1,189 additions and 898 deletions.
8 changes: 4 additions & 4 deletions SukiUI/ColorTheme/NotificationColor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ namespace SukiUI.ColorTheme;

public static class NotificationColor
{
public static readonly SolidColorBrush InfoIconForeground = new(Color.FromRgb(47, 84, 235));
public static readonly SolidColorBrush SuccessIconForeground = new(Color.FromRgb(56, 158, 13));
public static readonly SolidColorBrush WarningIconForeground = new(Color.FromRgb(240, 140, 22));
public static readonly SolidColorBrush ErrorIconForeground = new(Color.FromRgb(236, 63, 48));
public static readonly SolidColorBrush InfoIconForeground = new(Color.FromRgb(47,84,235));
public static readonly SolidColorBrush SuccessIconForeground = new(Color.FromRgb(56,158,13));
public static readonly SolidColorBrush WarningIconForeground = new(Color.FromRgb(240,140,22));
public static readonly SolidColorBrush ErrorIconForeground = new(Color.FromRgb(236,63,48));
}
7 changes: 5 additions & 2 deletions SukiUI/Content/Icons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ namespace SukiUI.Content;
/// </summary>
public static class Icons
{
// Material Icons
public static readonly StreamGeometry WindowMinimize = Parse("M20,14H4V10H20");
public static readonly StreamGeometry Search = Parse("M11.5,2.75 C16.3324916,2.75 20.25,6.66750844 20.25,11.5 C20.25,13.6461673 19.4773285,15.6118676 18.1949905,17.1340957 L25.0303301,23.9696699 C25.3232233,24.2625631 25.3232233,24.7374369 25.0303301,25.0303301 C24.7640635,25.2965966 24.3473998,25.3208027 24.0537883,25.1029482 L23.9696699,25.0303301 L17.1340957,18.1949905 C15.6118676,19.4773285 13.6461673,20.25 11.5,20.25 C6.66750844,20.25 2.75,16.3324916 2.75,11.5 C2.75,6.66750844 6.66750844,2.75 11.5,2.75 Z M11.5,4.25 C7.49593556,4.25 4.25,7.49593556 4.25,11.5 C4.25,15.5040644 7.49593556,18.75 11.5,18.75 C15.5040644,18.75 18.75,15.5040644 18.75,11.5 C18.75,7.49593556 15.5040644,4.25 11.5,4.25 Z");


// Material Icons
public static readonly StreamGeometry WindowMinimize = Parse("M20,14H4V10H20");

// Material Icons
public static readonly StreamGeometry FileOpen = Parse("M17.0606622,9 C17.8933043,9 18.7000032,9.27703406 19.3552116,9.78392956 L19.5300545,9.92783739 L22.116207,12.1907209 C22.306094,12.356872 22.5408581,12.4608817 22.7890575,12.4909364 L22.9393378,12.5 L40.25,12.5 C42.2542592,12.5 43.8912737,14.0723611 43.994802,16.0508414 L44,16.25 L44,35.25 C44,37.2542592 42.4276389,38.8912737 40.4491586,38.994802 L40.25,39 L7.75,39 C5.74574083,39 4.10872626,37.4276389 4.00519801,35.4491586 L4,35.25 L4,12.75 C4,10.7457408 5.57236105,9.10872626 7.55084143,9.00519801 L7.75,9 L17.0606622,9 Z M22.8474156,14.9988741 L20.7205012,17.6147223 C20.0558881,18.4327077 19.0802671,18.9305178 18.0350306,18.993257 L17.8100737,19 L6.5,18.999 L6.5,35.25 C6.5,35.8972087 6.99187466,36.4295339 7.62219476,36.4935464 L7.75,36.5 L40.25,36.5 C40.8972087,36.5 41.4295339,36.0081253 41.4935464,35.3778052 L41.5,35.25 L41.5,16.25 C41.5,15.6027913 41.0081253,15.0704661 40.3778052,15.0064536 L40.25,15 L22.8474156,14.9988741 Z M17.0606622,11.5 L7.75,11.5 C7.10279131,11.5 6.5704661,11.9918747 6.50645361,12.6221948 L6.5,12.75 L6.5,16.499 L17.8100737,16.5 C18.1394331,16.5 18.4534488,16.3701335 18.6858203,16.1419575 L18.7802162,16.0382408 L20.415,14.025 L17.883793,11.8092791 C17.693906,11.643128 17.4591419,11.5391183 17.2109425,11.5090636 L17.0606622,11.5 Z");

Expand Down
2 changes: 1 addition & 1 deletion SukiUI/Controls/BusyArea.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
LastChildFill="True">
<TextBlock Margin="10"
DockPanel.Dock="Bottom"
FontWeight="DemiBold"
FontWeight="{DynamicResource DefaultDemiBold}"
IsVisible="{TemplateBinding BusyText,
Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Text="{TemplateBinding BusyText}" />
Expand Down
11 changes: 6 additions & 5 deletions SukiUI/Controls/CircleProgressBar.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Markup.Xaml;

namespace SukiUI.Controls
Expand All @@ -24,17 +25,17 @@ public double Value
set
{
_value = (int)(value * 3.6);
SetValue(ValueProperty, _value);
SetValue(ValueProperty,_value);
}
}

/// <summary>
/// Defines the <see cref="Value"/> property.
/// </summary>
public static readonly StyledProperty<double> ValueProperty =
AvaloniaProperty.Register<CircleProgressBar, double>(nameof(Value), defaultValue: 50, coerce: (o, d) => d * 3.6);


AvaloniaProperty.Register<CircleProgressBar, double>(nameof(Value), defaultValue: 50, coerce: (o, d) => d * 3.6);
public static readonly StyledProperty<int> HeightProperty =

Check warning on line 39 in SukiUI/Controls/CircleProgressBar.axaml.cs

View workflow job for this annotation

GitHub Actions / build

'CircleProgressBar.HeightProperty' hides inherited member 'Layoutable.HeightProperty'. Use the new keyword if hiding was intended.
AvaloniaProperty.Register<CircleProgressBar, int>(nameof(Height), defaultValue: 150);

Expand All @@ -61,7 +62,7 @@ public int StrokeWidth
get { return GetValue(StrokeWidthProperty); }
set { SetValue(StrokeWidthProperty, value); }
}

public static readonly StyledProperty<bool> IsIndeterminateProperty =
AvaloniaProperty.Register<CircleProgressBar, bool>(nameof(IsIndeterminate), false);

Expand Down
1 change: 1 addition & 0 deletions SukiUI/Controls/CodeView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using SukiUI.Content;
using SukiUI.Extensions;
using System;
using System.Threading;
using System.Threading.Tasks;

namespace SukiUI.Controls;
Expand Down
8 changes: 4 additions & 4 deletions SukiUI/Controls/ContentExpandControl.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;
using System;

namespace SukiUI.Controls
{
Expand All @@ -15,16 +15,16 @@ public double Multiplier
get => GetValue(MultiplierProperty);
set => SetValue(MultiplierProperty, value);
}

public static readonly StyledProperty<Orientation> OrientationProperty =
AvaloniaProperty.Register<ContentExpandControl, Orientation>(nameof(Orientation));

public Orientation Orientation
{
get => GetValue(OrientationProperty);
set => SetValue(OrientationProperty, value);
}

static ContentExpandControl()
{
AffectsArrange<ContentExpandControl>(MultiplierProperty, OrientationProperty);
Expand Down
21 changes: 13 additions & 8 deletions SukiUI/Controls/GlassMorphism/GlassCard.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
using Avalonia;
using System;
using System.ComponentModel;
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Presenters;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.LogicalTree;
using Avalonia.Rendering.Composition;
using Avalonia.Rendering.Composition.Animations;
using SukiUI.Helpers;
using System.ComponentModel;
using System.Windows.Input;

namespace SukiUI.Controls;

Expand All @@ -28,8 +33,8 @@ public class GlassCard : ContentControl
get => GetValue(BorderThicknessProperty);
set => SetValue(BorderThicknessProperty, value);
}


public static readonly StyledProperty<bool> IsAnimatedProperty =
AvaloniaProperty.Register<GlassCard, bool>(nameof(IsAnimated), true);

Expand All @@ -38,7 +43,7 @@ public bool IsAnimated
get => GetValue(IsAnimatedProperty);
set => SetValue(IsAnimatedProperty, value);
}

public static readonly StyledProperty<bool> IsOpaqueProperty =
AvaloniaProperty.Register<GlassCard, bool>(nameof(IsOpaque), false);

Expand Down Expand Up @@ -109,7 +114,7 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
}

}




Expand All @@ -122,7 +127,7 @@ protected override void OnPointerPressed(PointerPressedEventArgs e)
{
base.OnPointerPressed(e);
PseudoClasses.Set(":pointerdown", true);
if (IsInteractive && Command is not null && Command.CanExecute(CommandParameter))
if(IsInteractive && Command is not null && Command.CanExecute(CommandParameter))
Command.Execute(CommandParameter);
}

Expand Down
17 changes: 10 additions & 7 deletions SukiUI/Controls/InfoBadge.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
Height="400"
Margin="0,20,0,0"
Spacing="20">
<controls:InfoBadge Appearance="Info" Header="Info"
<controls:InfoBadge Appearance="Info"
CornerPosition="TopRight"
>
Header="Info">

<Button Content="Log In" />
</controls:InfoBadge>
<controls:InfoBadge Appearance="Warning"
Expand Down Expand Up @@ -72,14 +72,17 @@
CornerRadius="{TemplateBinding CornerRadius}"
IsVisible="{Binding !!Header, RelativeSource={RelativeSource TemplatedParent}}"
UseLayoutRounding="False">
<ContentPresenter Name="PART_HeaderPresenter" Margin="2"
HorizontalAlignment="Center" FontWeight="DemiBold"
VerticalAlignment="Center" Foreground="White"
<ContentPresenter Name="PART_HeaderPresenter"
Margin="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Focusable="False"
FontWeight="{DynamicResource DefaultDemiBold}"
Foreground="White"
IsTabStop="False">
<ContentPresenter.Styles>
<Style Selector="TextBlock">
<Setter Property="FontSize" Value="13"></Setter>
<Setter Property="FontSize" Value="13" />
</Style>
</ContentPresenter.Styles>
<ContentPresenter.Content>
Expand Down
13 changes: 6 additions & 7 deletions SukiUI/Controls/InfoBadge.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

namespace SukiUI.Controls;

public class InfoBadge : HeaderedContentControl
public class InfoBadge: HeaderedContentControl
{
private Border? _badgeContainer;

public static readonly StyledProperty<NotificationType> AppearanceProperty =
AvaloniaProperty.Register<InfoBadge, NotificationType>(nameof(Appearance), NotificationType.Info);

Expand All @@ -28,7 +28,7 @@ public NotificationType Appearance
NotificationType.Error => NotificationColor.ErrorIconForeground,
_ => NotificationColor.InfoIconForeground
};

SetValue(AppearanceProperty, value);
}
}
Expand All @@ -40,14 +40,13 @@ public CornerPosition CornerPosition
get => GetValue(CornerPositionProperty);
set => SetValue(CornerPositionProperty, value);
}

public static readonly StyledProperty<bool> IsDotProperty = AvaloniaProperty.Register<InfoBadge, bool>(
nameof(IsDot), false);
public bool IsDot
{
get => GetValue(IsDotProperty);
set
{
set {
UpdateBadgePosition();
SetValue(IsDotProperty, value);
}
Expand Down Expand Up @@ -97,7 +96,7 @@ private void UpdateBadgePosition()
{
horizontalOffset = 1;
}

if (_badgeContainer is not null && Presenter?.Child is not null)
{
_badgeContainer.RenderTransform = new TransformGroup
Expand Down
26 changes: 14 additions & 12 deletions SukiUI/Controls/InfoBar.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Avalonia;
using System.Windows.Input;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Interactivity;
using Avalonia.Media;
using SukiUI.ColorTheme;
using SukiUI.Content;
Expand All @@ -26,7 +28,7 @@ public NotificationType Severity
NotificationType.Error => Icons.AlertOutline,
_ => Icons.InformationOutline
};

IconForeground = value switch
{
NotificationType.Info => NotificationColor.InfoIconForeground,
Expand All @@ -35,11 +37,11 @@ public NotificationType Severity
NotificationType.Error => NotificationColor.ErrorIconForeground,
_ => NotificationColor.InfoIconForeground
};

SetValue(SeverityProperty, value);
}
}

public static readonly StyledProperty<object?> IconProperty =
AvaloniaProperty.Register<InfoBar, object?>(nameof(Icon), Icons.InformationOutline);

Expand All @@ -48,16 +50,16 @@ public object? Icon
get => GetValue(IconProperty);
private set => SetValue(IconProperty, value);
}

public static readonly StyledProperty<IBrush?> IconForegroundProperty =
AvaloniaProperty.Register<InfoBar, IBrush?>(nameof(IconForeground), NotificationColor.InfoIconForeground);

public IBrush? IconForeground
{
get => GetValue(IconForegroundProperty);
private set => SetValue(IconForegroundProperty, value);
}

public static readonly StyledProperty<bool> IsOpenProperty =
AvaloniaProperty.Register<InfoBar, bool>(nameof(IsOpen), true);

Expand All @@ -66,7 +68,7 @@ public bool IsOpen
get => GetValue(IsOpenProperty);
set => SetValue(IsOpenProperty, value);
}

public static readonly StyledProperty<bool> IsClosableProperty =
AvaloniaProperty.Register<InfoBar, bool>(nameof(IsClosable), true);

Expand All @@ -75,8 +77,8 @@ public bool IsClosable
get => GetValue(IsClosableProperty);
set => SetValue(IsClosableProperty, value);
}


public static readonly StyledProperty<bool> IsOpaqueProperty =
AvaloniaProperty.Register<InfoBar, bool>(nameof(IsOpaque), false);

Expand All @@ -85,7 +87,7 @@ public bool IsOpaque
get => GetValue(IsOpaqueProperty);
set => SetValue(IsOpaqueProperty, value);
}

public static readonly StyledProperty<string> TitleProperty =
AvaloniaProperty.Register<InfoBar, string>(nameof(Title), string.Empty);

Expand All @@ -108,7 +110,7 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
base.OnApplyTemplate(e);

e.NameScope.Get<Button>("PART_CloseButton").Click += (_, _) => { IsOpen = false; };
e.NameScope.Get<Button>("PART_CloseButton").Click += (_, _) => { IsOpen = false;};
}

protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
Expand Down
7 changes: 4 additions & 3 deletions SukiUI/Controls/Loading.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Markup.Xaml.MarkupExtensions;
using Avalonia.Media;

namespace SukiUI.Controls
Expand All @@ -16,8 +17,8 @@ private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}


public static readonly StyledProperty<IBrush> ForegroundProperty =

Check warning on line 22 in SukiUI/Controls/Loading.axaml.cs

View workflow job for this annotation

GitHub Actions / build

'Loading.ForegroundProperty' hides inherited member 'TemplatedControl.ForegroundProperty'. Use the new keyword if hiding was intended.
AvaloniaProperty.Register<Loading, IBrush>(nameof(Foreground), defaultValue: Brushes.Aqua);

Expand All @@ -26,6 +27,6 @@ public IBrush Foreground
get => GetValue(ForegroundProperty);
set => SetValue(ForegroundProperty, value);
}

}
}
Loading

0 comments on commit f57f557

Please sign in to comment.