-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into qodana-automation-1498580887
- Loading branch information
Showing
341 changed files
with
10,165 additions
and
2,481 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Publish Incremental Nuget Release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Bump build version | ||
id: bump | ||
uses: vers-one/[email protected] | ||
with: | ||
files: | | ||
"**/Consolonia.csproj" | ||
version: bump-build | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore src/Consolonia.sln | ||
|
||
- name: Build | ||
run: dotnet build src/Consolonia.sln -c Release --no-restore | ||
|
||
- name: dotnet pack | ||
run: | | ||
dotnet pack src/Consolonia.sln -c Release -o packages --include-symbols --property WarningLevel=0 | ||
- name: Publish NuGet and symbols | ||
id: nuget-push | ||
uses: edumserrano/nuget-push@v1 | ||
with: | ||
api-key: '${{ secrets.NUGET_KEY }}' | ||
working-directory: 'packages' | ||
fail-if-exists: false | ||
|
||
- name: Commit new version changes | ||
run: | | ||
git config --global user.name "Github Action" | ||
git config --global user.email "[email protected]" | ||
git commit -a -m "Bumped version for published nuget artifacts" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Publish Nuget Release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore src/Consolonia.sln | ||
|
||
- name: Build | ||
run: dotnet build src/Consolonia.sln -c Release --no-restore | ||
|
||
- name: dotnet pack | ||
run: | | ||
dotnet pack src/Consolonia.sln -c Release -o packages --include-symbols --property WarningLevel=0 | ||
- name: Publish NuGet and symbols | ||
id: nuget-push | ||
uses: edumserrano/nuget-push@v1 | ||
with: | ||
api-key: '${{ secrets.NUGET_KEY }}' | ||
working-directory: 'packages' | ||
fail-if-exists: false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -766,3 +766,4 @@ fabric.properties | |
.idea/ | ||
*.sln.iml | ||
|
||
/src/Tools/Consolonia.PreviewHost/Properties/launchSettings.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<!--todo: add mono--> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>disable</Nullable> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<VersionPrefix>11.0.9</VersionPrefix> | ||
<VersionPrefix>11.2.1</VersionPrefix> | ||
<Authors>https://github.com/jinek/Consolonia/graphs/contributors</Authors> | ||
<Description>Text User Interface implementation of Avalonia UI (GUI Framework)</Description> | ||
<Copyright>Copyright © Evgeny Gorbovoy 2021 - 2022</Copyright> | ||
<PackageIcon>Icon.png</PackageIcon> | ||
<NoWarn>AVA3001</NoWarn> | ||
<IsPackable>False</IsPackable> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<AvaloniaVersion>11.0.9</AvaloniaVersion> | ||
<AvaloniaVersion>11.2.1</AvaloniaVersion> | ||
</PropertyGroup> | ||
<ItemGroup Condition="'$(IsPackable)' != 'false'"> | ||
<None Include="$(SolutionDir)/../Icon.png" Pack="True" PackagePath="\" /> | ||
<None Include="README.md" Pack="true" PackagePath="\" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System; | ||
using Avalonia; | ||
using Avalonia.Controls.ApplicationLifetimes; | ||
using BlazorBindingsAvalonia; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
// ReSharper disable once CheckNamespace | ||
namespace Consolonia | ||
{ | ||
public static class BuilderExtensions | ||
{ | ||
/// <summary> | ||
/// Use Consolonize in Blazor mode | ||
/// </summary> | ||
/// <param name="builder"></param> | ||
/// <param name="configureServices"></param> | ||
/// <returns></returns> | ||
public static AppBuilder UseConsoloniaBlazor(this AppBuilder builder, | ||
Action<IServiceCollection> configureServices = null) | ||
{ | ||
return builder | ||
.UseConsolonia() | ||
.UseAvaloniaBlazorBindings(sc => | ||
{ | ||
// Register services for injectoin | ||
sc.AddSingleton(_ => | ||
{ | ||
var lifetime = | ||
(IClassicDesktopStyleApplicationLifetime)Application.Current?.ApplicationLifetime; | ||
ArgumentNullException.ThrowIfNull(lifetime); | ||
return lifetime; | ||
}); | ||
sc.AddTransient(sp => | ||
sp.GetRequiredService<IClassicDesktopStyleApplicationLifetime>().MainWindow?.StorageProvider); | ||
sc.AddTransient(sp => | ||
sp.GetRequiredService<IClassicDesktopStyleApplicationLifetime>().MainWindow?.Clipboard); | ||
sc.AddTransient(sp => | ||
sp.GetRequiredService<IClassicDesktopStyleApplicationLifetime>().MainWindow?.InsetsManager); | ||
sc.AddTransient(sp => | ||
sp.GetRequiredService<IClassicDesktopStyleApplicationLifetime>().MainWindow?.InputPane); | ||
sc.AddTransient(sp => | ||
sp.GetRequiredService<IClassicDesktopStyleApplicationLifetime>().MainWindow?.Launcher); | ||
sc.AddTransient(sp => | ||
sp.GetRequiredService<IClassicDesktopStyleApplicationLifetime>().MainWindow?.Screens); | ||
sc.AddTransient(sp => | ||
sp.GetRequiredService<IClassicDesktopStyleApplicationLifetime>().MainWindow?.FocusManager); | ||
sc.AddTransient(sp => | ||
sp.GetRequiredService<IClassicDesktopStyleApplicationLifetime>().MainWindow?.PlatformSettings); | ||
|
||
if (configureServices != null) configureServices(sc); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Core.Build.props', '$(MSBuildThisFileDirectory)../'))" /> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Consolonia\Consolonia.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="BlazorBindingsAvalonia" Version="0.1.2" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Avalonia; | ||
using Avalonia.Input; | ||
using BlazorBindingsAvalonia; | ||
using Consolonia.Core.Helpers; | ||
using Consolonia.Core.Infrastructure; | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace Consolonia.Blazor | ||
{ | ||
/// <summary> | ||
/// Use this application as your app base class to use Consolonia.Blazor Blazor engine. | ||
/// </summary> | ||
/// <typeparam name="TComponent">The root window for the application.</typeparam> | ||
public class ConsoloniaBlazorApplication<TComponent> : BlazorBindingsApplication<TComponent> | ||
where TComponent : IComponent | ||
{ | ||
public override void RegisterServices() | ||
{ | ||
base.RegisterServices(); | ||
|
||
AvaloniaLocator.CurrentMutable.Bind<IKeyboardNavigationHandler>() | ||
.ToTransient<ArrowsAndKeyboardNavigationHandler>(); | ||
} | ||
|
||
public override void OnFrameworkInitializationCompleted() | ||
{ | ||
base.OnFrameworkInitializationCompleted(); | ||
|
||
this.AddConsoloniaDesignMode(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Consolonia.Blazor | ||
This package provides the ability to use Blazor .razor files to create Consolonia applications. | ||
* Use [⚡ Blazor](https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor) syntax for [Avalonia](https://avaloniaui.net/) apps | ||
* 😎 Simpler syntax than XAML | ||
* 🪄 IntelliSense support | ||
* Get free [🔥 Hot Reload](https://devblogs.microsoft.com/dotnet/introducing-net-hot-reload/) support on-top | ||
* See https://github.com/Epictek/Avalonia-Blazor-Bindings | ||
|
||
## Background | ||
Consolonia is a TUI (Text User Interface) (GUI Framework) implementation for [Avalonia UI](https://github.com/AvaloniaUI) | ||
|
||
## Showcase (click picture to see video) | ||
[![datagridpic](https://user-images.githubusercontent.com/10516222/141980173-4eb4057a-6996-45bf-83f6-931316c98d88.png)](https://youtu.be/ttgZmbruk3Y) | ||
|
||
|
||
## Example Razor file | ||
Things to note: | ||
* Method binding to code behind | ||
* Conditional layout of elements | ||
* Full intellisense for renaming going to code behind autocomplete etc. | ||
* injection of **INavigation** so you can push and pop views off of the nav stack | ||
* injection of **IClassicDesktopStyleApplicationLifetime** so you can access Args and shutdown the app. | ||
* HOT RELOAD. simple save the file and your view gets rebuilt and rerendered! | ||
|
||
![blazor](https://github.com/user-attachments/assets/ae1ba484-b3a9-46c6-8c1b-99026e7f924c) | ||
|
||
```razor | ||
@page "/" | ||
@inject INavigation navigation | ||
@inject IClassicDesktopStyleApplicationLifetime lifetime | ||
@namespace Example.Blazor.Components | ||
<Window Title="Blazor Bindings for Consolonia" Topmost="true"> | ||
<StackPanel Orientation="Orientation.Vertical" VerticalAlignment="VerticalAlignment.Center"> | ||
@if (showCounter) | ||
{ | ||
<TextBlock HorizontalAlignment="HorizontalAlignment.Center">Counter: @CounterText</TextBlock> | ||
} | ||
<StackPanel Orientation="Orientation.Vertical" HorizontalAlignment="HorizontalAlignment.Center" Margin="@Thickness.Parse("4")"> | ||
<Button OnClick="@OnIncrement">Increment counter support</Button> | ||
<Button OnClick="@OnToggleCounter">@ToggleText</Button> | ||
<Button OnClick="@OnMessageBox">Message Box</Button> | ||
<Button OnClick="@OnGotoSubPage">Go to SubPage</Button> | ||
<Button OnClick="@OnExit">Exit</Button> | ||
</StackPanel> | ||
</StackPanel> | ||
</Window> | ||
@code { | ||
int counter = 0; | ||
bool showCounter = true; | ||
string CounterText => counter switch | ||
{ | ||
0 => "Not clicked", | ||
1 => $"Clicked 1 time", | ||
_ => $"Clicked {counter} times" | ||
}; | ||
string ToggleText => showCounter ? "Hide Counter" : "Show Counter"; | ||
void OnIncrement() | ||
=> counter++; | ||
void OnToggleCounter() | ||
=> showCounter = !showCounter; | ||
void OnGotoSubPage() | ||
=> navigation.PushAsync<SubPage>(); | ||
async void OnMessageBox(RoutedEventArgs args) | ||
{ | ||
await new MessageBox() | ||
.ShowDialogAsync((AC.Control)args.Source!, "Hello, Blazor!", "Blazor Bindings for Consolonia"); | ||
} | ||
void OnExit() | ||
=> lifetime.Shutdown(); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
using System; | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("Consolonia.TestsCore")] | ||
[assembly: InternalsVisibleTo("Consolonia.Core.Tests")] | ||
[assembly: InternalsVisibleTo("Consolonia.Designer")] | ||
|
||
[assembly: CLSCompliant(false)] //todo: should we make it compliant? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Core.Build.props', '$(MSBuildThisFileDirectory)../'))" /> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Core.Build.props', '$(MSBuildThisFileDirectory)../'))" /> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Avalonia.FreeDesktop" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="$(AvaloniaVersion)" /> | ||
<PackageReference Include="Crayon" Version="2.0.69" /> | ||
<PackageReference Include="NullLib.ConsoleEx" Version="1.0.4.4" /> | ||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" /> | ||
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.8" /> | ||
<PackageReference Include="Unicode.net" Version="2.0.0" /> | ||
<PackageReference Include="Wcwidth" Version="2.0.0" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> | ||
</ItemGroup> | ||
|
||
</Project> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ision/Templates/Controls/DialogWrap.axaml → ...nia.Core/Controls/Dialog/DialogWrap.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.