committed by
GitHub
1022 changed files with 33768 additions and 21017 deletions
@ -1 +1,2 @@ |
|||
github: avaloniaui |
|||
open_collective: avalonia |
|||
|
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -1,7 +1,3 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<AdditionalFilesToIncludeForProject> |
|||
<Value>..\..\tools\MicroComGenerator\bin\Debug\net6.0\**.*</Value> |
|||
</AdditionalFilesToIncludeForProject> |
|||
</Settings> |
|||
<Settings /> |
|||
</ProjectConfiguration> |
|||
@ -1,7 +1,3 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<AdditionalFilesToIncludeForProject> |
|||
<Value>..\..\tools\MicroComGenerator\bin\Debug\net6.0\**.*</Value> |
|||
</AdditionalFilesToIncludeForProject> |
|||
</Settings> |
|||
<Settings /> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -0,0 +1,148 @@ |
|||
{ |
|||
"$schema": "http://json-schema.org/draft-04/schema#", |
|||
"title": "Build Schema", |
|||
"$ref": "#/definitions/build", |
|||
"definitions": { |
|||
"build": { |
|||
"type": "object", |
|||
"properties": { |
|||
"Configuration": { |
|||
"type": "string", |
|||
"description": "configuration" |
|||
}, |
|||
"Continue": { |
|||
"type": "boolean", |
|||
"description": "Indicates to continue a previously failed build attempt" |
|||
}, |
|||
"ForceNugetVersion": { |
|||
"type": "string", |
|||
"description": "force-nuget-version" |
|||
}, |
|||
"Help": { |
|||
"type": "boolean", |
|||
"description": "Shows the help text for this build assembly" |
|||
}, |
|||
"Host": { |
|||
"type": "string", |
|||
"description": "Host for execution. Default is 'automatic'", |
|||
"enum": [ |
|||
"AppVeyor", |
|||
"AzurePipelines", |
|||
"Bamboo", |
|||
"Bitbucket", |
|||
"Bitrise", |
|||
"GitHubActions", |
|||
"GitLab", |
|||
"Jenkins", |
|||
"Rider", |
|||
"SpaceAutomation", |
|||
"TeamCity", |
|||
"Terminal", |
|||
"TravisCI", |
|||
"VisualStudio", |
|||
"VSCode" |
|||
] |
|||
}, |
|||
"NoLogo": { |
|||
"type": "boolean", |
|||
"description": "Disables displaying the NUKE logo" |
|||
}, |
|||
"Partition": { |
|||
"type": "string", |
|||
"description": "Partition to use on CI" |
|||
}, |
|||
"Plan": { |
|||
"type": "boolean", |
|||
"description": "Shows the execution plan (HTML)" |
|||
}, |
|||
"Profile": { |
|||
"type": "array", |
|||
"description": "Defines the profiles to load", |
|||
"items": { |
|||
"type": "string" |
|||
} |
|||
}, |
|||
"Root": { |
|||
"type": "string", |
|||
"description": "Root directory during build execution" |
|||
}, |
|||
"Skip": { |
|||
"type": "array", |
|||
"description": "List of targets to be skipped. Empty list skips all dependencies", |
|||
"items": { |
|||
"type": "string", |
|||
"enum": [ |
|||
"CiAzureLinux", |
|||
"CiAzureOSX", |
|||
"CiAzureWindows", |
|||
"Clean", |
|||
"Compile", |
|||
"CompileHtmlPreviewer", |
|||
"CompileNative", |
|||
"CreateIntermediateNugetPackages", |
|||
"CreateNugetPackages", |
|||
"GenerateCppHeaders", |
|||
"Package", |
|||
"RunCoreLibsTests", |
|||
"RunDesignerTests", |
|||
"RunHtmlPreviewerTests", |
|||
"RunLeakTests", |
|||
"RunRenderTests", |
|||
"RunTests", |
|||
"ZipFiles" |
|||
] |
|||
} |
|||
}, |
|||
"SkipPreviewer": { |
|||
"type": "boolean", |
|||
"description": "skip-previewer" |
|||
}, |
|||
"SkipTests": { |
|||
"type": "boolean", |
|||
"description": "skip-tests" |
|||
}, |
|||
"Solution": { |
|||
"type": "string", |
|||
"description": "Path to a solution file that is automatically loaded. Default is Avalonia.sln" |
|||
}, |
|||
"Target": { |
|||
"type": "array", |
|||
"description": "List of targets to be invoked. Default is '{default_target}'", |
|||
"items": { |
|||
"type": "string", |
|||
"enum": [ |
|||
"CiAzureLinux", |
|||
"CiAzureOSX", |
|||
"CiAzureWindows", |
|||
"Clean", |
|||
"Compile", |
|||
"CompileHtmlPreviewer", |
|||
"CompileNative", |
|||
"CreateIntermediateNugetPackages", |
|||
"CreateNugetPackages", |
|||
"GenerateCppHeaders", |
|||
"Package", |
|||
"RunCoreLibsTests", |
|||
"RunDesignerTests", |
|||
"RunHtmlPreviewerTests", |
|||
"RunLeakTests", |
|||
"RunRenderTests", |
|||
"RunTests", |
|||
"ZipFiles" |
|||
] |
|||
} |
|||
}, |
|||
"Verbosity": { |
|||
"type": "string", |
|||
"description": "Logging verbosity during build execution. Default is 'Normal'", |
|||
"enum": [ |
|||
"Minimal", |
|||
"Normal", |
|||
"Quiet", |
|||
"Verbose" |
|||
] |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
{ |
|||
"$schema": "./build.schema.json", |
|||
"Solution": "" |
|||
} |
|||
@ -0,0 +1,60 @@ |
|||
{ |
|||
"solution": { |
|||
"path": "Avalonia.sln", |
|||
"projects": [ |
|||
"packages\\Avalonia\\Avalonia.csproj", |
|||
"samples\\ControlCatalog.NetCore\\ControlCatalog.NetCore.csproj", |
|||
"samples\\ControlCatalog\\ControlCatalog.csproj", |
|||
"samples\\IntegrationTestApp\\IntegrationTestApp.csproj", |
|||
"samples\\MiniMvvm\\MiniMvvm.csproj", |
|||
"samples\\SampleControls\\ControlSamples.csproj", |
|||
"samples\\Sandbox\\Sandbox.csproj", |
|||
"src\\Avalonia.Base\\Avalonia.Base.csproj", |
|||
"src\\Avalonia.Build.Tasks\\Avalonia.Build.Tasks.csproj", |
|||
"src\\Avalonia.Controls.ColorPicker\\Avalonia.Controls.ColorPicker.csproj", |
|||
"src\\Avalonia.Controls.DataGrid\\Avalonia.Controls.DataGrid.csproj", |
|||
"src\\Avalonia.Controls\\Avalonia.Controls.csproj", |
|||
"src\\Avalonia.DesignerSupport\\Avalonia.DesignerSupport.csproj", |
|||
"src\\Avalonia.Desktop\\Avalonia.Desktop.csproj", |
|||
"src\\Avalonia.Diagnostics\\Avalonia.Diagnostics.csproj", |
|||
"src\\Avalonia.Dialogs\\Avalonia.Dialogs.csproj", |
|||
"src\\Avalonia.FreeDesktop\\Avalonia.FreeDesktop.csproj", |
|||
"src\\Avalonia.Headless.Vnc\\Avalonia.Headless.Vnc.csproj", |
|||
"src\\Avalonia.Headless\\Avalonia.Headless.csproj", |
|||
"src\\Avalonia.MicroCom\\Avalonia.MicroCom.csproj", |
|||
"src\\Avalonia.Native\\Avalonia.Native.csproj", |
|||
"src\\Avalonia.OpenGL\\Avalonia.OpenGL.csproj", |
|||
"src\\Avalonia.ReactiveUI\\Avalonia.ReactiveUI.csproj", |
|||
"src\\Avalonia.Remote.Protocol\\Avalonia.Remote.Protocol.csproj", |
|||
"src\\Avalonia.Themes.Fluent\\Avalonia.Themes.Fluent.csproj", |
|||
"src\\Avalonia.Themes.Simple\\Avalonia.Themes.Simple.csproj", |
|||
"src\\Avalonia.X11\\Avalonia.X11.csproj", |
|||
"src\\Linux\\Avalonia.LinuxFramebuffer\\Avalonia.LinuxFramebuffer.csproj", |
|||
"src\\Markup\\Avalonia.Markup.Xaml.Loader\\Avalonia.Markup.Xaml.Loader.csproj", |
|||
"src\\Markup\\Avalonia.Markup.Xaml\\Avalonia.Markup.Xaml.csproj", |
|||
"src\\Markup\\Avalonia.Markup\\Avalonia.Markup.csproj", |
|||
"src\\Skia\\Avalonia.Skia\\Avalonia.Skia.csproj", |
|||
"src\\Windows\\Avalonia.Direct2D1\\Avalonia.Direct2D1.csproj", |
|||
"src\\Windows\\Avalonia.Win32.Interop\\Avalonia.Win32.Interop.csproj", |
|||
"src\\Windows\\Avalonia.Win32\\Avalonia.Win32.csproj", |
|||
"src\\tools\\DevAnalyzers\\DevAnalyzers.csproj", |
|||
"src\\tools\\DevGenerators\\DevGenerators.csproj", |
|||
"tests\\Avalonia.Base.UnitTests\\Avalonia.Base.UnitTests.csproj", |
|||
"tests\\Avalonia.Benchmarks\\Avalonia.Benchmarks.csproj", |
|||
"tests\\Avalonia.Controls.DataGrid.UnitTests\\Avalonia.Controls.DataGrid.UnitTests.csproj", |
|||
"tests\\Avalonia.Controls.UnitTests\\Avalonia.Controls.UnitTests.csproj", |
|||
"tests\\Avalonia.DesignerSupport.TestApp\\Avalonia.DesignerSupport.TestApp.csproj", |
|||
"tests\\Avalonia.DesignerSupport.Tests\\Avalonia.DesignerSupport.Tests.csproj", |
|||
"tests\\Avalonia.Direct2D1.RenderTests\\Avalonia.Direct2D1.RenderTests.csproj", |
|||
"tests\\Avalonia.Direct2D1.UnitTests\\Avalonia.Direct2D1.UnitTests.csproj", |
|||
"tests\\Avalonia.IntegrationTests.Appium\\Avalonia.IntegrationTests.Appium.csproj", |
|||
"tests\\Avalonia.LeakTests\\Avalonia.LeakTests.csproj", |
|||
"tests\\Avalonia.Markup.UnitTests\\Avalonia.Markup.UnitTests.csproj", |
|||
"tests\\Avalonia.Markup.Xaml.UnitTests\\Avalonia.Markup.Xaml.UnitTests.csproj", |
|||
"tests\\Avalonia.ReactiveUI.UnitTests\\Avalonia.ReactiveUI.UnitTests.csproj", |
|||
"tests\\Avalonia.Skia.RenderTests\\Avalonia.Skia.RenderTests.csproj", |
|||
"tests\\Avalonia.Skia.UnitTests\\Avalonia.Skia.UnitTests.csproj", |
|||
"tests\\Avalonia.UnitTests\\Avalonia.UnitTests.csproj" |
|||
] |
|||
} |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
<Project> |
|||
<PropertyGroup Condition="$(NETCoreSdkVersion.StartsWith('7.0'))"> |
|||
<DefineConstants>$(DefineConstants);NET7SDK</DefineConstants> |
|||
</PropertyGroup> |
|||
</Project> |
|||
@ -0,0 +1,7 @@ |
|||
:; set -eo pipefail |
|||
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) |
|||
:; ${SCRIPT_DIR}/build.sh "$@" |
|||
:; exit $? |
|||
|
|||
@ECHO OFF |
|||
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %* |
|||
@ -1,7 +1,7 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="HarfBuzzSharp" Version="2.8.2" /> |
|||
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.8.2" /> |
|||
<PackageReference Condition="'$(IncludeWasmSkia)' == 'true'" Include="HarfBuzzSharp.NativeAssets.WebAssembly" Version="2.8.2" /> |
|||
<PackageReference Include="HarfBuzzSharp" Version="2.8.2.1-preview.108" /> |
|||
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.8.2.1-preview.108" /> |
|||
<PackageReference Condition="'$(IncludeWasmSkia)' == 'true'" Include="HarfBuzzSharp.NativeAssets.WebAssembly" Version="2.8.2.1-preview.108" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -0,0 +1,5 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup> |
|||
<EnableNETAnalyzers>true</EnableNETAnalyzers> |
|||
</PropertyGroup> |
|||
</Project> |
|||
@ -1,5 +1,5 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="ReactiveUI" Version="13.2.10" /> |
|||
<PackageReference Include="ReactiveUI" Version="18.3.1" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -1,7 +1,7 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.1" /> |
|||
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="SkiaSharp.NativeAssets.Linux" Version="2.88.1-preview.1" /> |
|||
<PackageReference Condition="'$(IncludeWasmSkia)' == 'true'" Include="SkiaSharp.NativeAssets.WebAssembly" Version="2.88.1-preview.1" /> |
|||
<PackageReference Include="SkiaSharp" Version="2.88.1" /> |
|||
<PackageReference Condition="'$(IncludeLinuxSkia)' == 'true'" Include="SkiaSharp.NativeAssets.Linux" Version="2.88.1" /> |
|||
<PackageReference Condition="'$(IncludeWasmSkia)' == 'true'" Include="SkiaSharp.NativeAssets.WebAssembly" Version="2.88.1" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -0,0 +1,57 @@ |
|||
using System.Globalization; |
|||
using JetBrains.Annotations; |
|||
using Nuke.Common.Tools.DotNet; |
|||
// ReSharper disable ReturnValueOfPureMethodIsNotUsed
|
|||
|
|||
public class DotNetConfigHelper |
|||
{ |
|||
public DotNetBuildSettings Build; |
|||
public DotNetPackSettings Pack; |
|||
public DotNetTestSettings Test; |
|||
|
|||
public DotNetConfigHelper(DotNetBuildSettings s) |
|||
{ |
|||
Build = s; |
|||
} |
|||
|
|||
public DotNetConfigHelper(DotNetPackSettings s) |
|||
{ |
|||
Pack = s; |
|||
} |
|||
|
|||
public DotNetConfigHelper(DotNetTestSettings s) |
|||
{ |
|||
Test = s; |
|||
} |
|||
|
|||
public DotNetConfigHelper AddProperty(string key, bool value) => |
|||
AddProperty(key, value.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()); |
|||
public DotNetConfigHelper AddProperty(string key, string value) |
|||
{ |
|||
Build = Build?.AddProperty(key, value); |
|||
Pack = Pack?.AddProperty(key, value); |
|||
Test = Test?.AddProperty(key, value); |
|||
|
|||
return this; |
|||
} |
|||
|
|||
public DotNetConfigHelper SetConfiguration(string configuration) |
|||
{ |
|||
Build = Build?.SetConfiguration(configuration); |
|||
Pack = Pack?.SetConfiguration(configuration); |
|||
Test = Test?.SetConfiguration(configuration); |
|||
return this; |
|||
} |
|||
|
|||
public DotNetConfigHelper SetVerbosity(DotNetVerbosity verbosity) |
|||
{ |
|||
Build = Build?.SetVerbosity(verbosity); |
|||
Pack = Pack?.SetVerbosity(verbosity); |
|||
Test = Test?.SetVerbosity(verbosity); |
|||
return this; |
|||
} |
|||
|
|||
public static implicit operator DotNetConfigHelper(DotNetBuildSettings s) => new DotNetConfigHelper(s); |
|||
public static implicit operator DotNetConfigHelper(DotNetPackSettings s) => new DotNetConfigHelper(s); |
|||
public static implicit operator DotNetConfigHelper(DotNetTestSettings s) => new DotNetConfigHelper(s); |
|||
} |
|||
@ -1,14 +0,0 @@ |
|||
using System.IO; |
|||
using MicroCom.CodeGenerator; |
|||
using Nuke.Common; |
|||
|
|||
partial class Build : NukeBuild |
|||
{ |
|||
Target GenerateCppHeaders => _ => _.Executes(() => |
|||
{ |
|||
var file = MicroComCodeGenerator.Parse( |
|||
File.ReadAllText(RootDirectory / "src" / "Avalonia.Native" / "avn.idl")); |
|||
File.WriteAllText(RootDirectory / "native" / "Avalonia.Native" / "inc" / "avalonia-native.h", |
|||
file.GenerateCppHeader()); |
|||
}); |
|||
} |
|||
@ -1,41 +1,48 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<OutputType>Exe</OutputType> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> |
|||
<RootNamespace></RootNamespace> |
|||
<IsPackable>False</IsPackable> |
|||
<NoWarn>CS0649;CS0169</NoWarn> |
|||
<NoWarn>CS0649;CS0169;SYSLIB0011</NoWarn> |
|||
<NukeTelemetryVersion>1</NukeTelemetryVersion> |
|||
<TargetFramework>net7.0</TargetFramework> |
|||
</PropertyGroup> |
|||
|
|||
<Import Project="..\build\JetBrains.dotMemoryUnit.props" /> |
|||
<ItemGroup> |
|||
<PackageReference Include="Nuke.Common" Version="5.0.0" /> |
|||
<PackageReference Include="xunit.runner.console" Version="2.3.1" /> |
|||
<PackageReference Include="Nuke.Common" Version="6.2.1" /> |
|||
<PackageReference Include="vswhere" Version="2.6.7" Condition=" '$(OS)' == 'Windows_NT' " /> |
|||
<PackageReference Include="ILRepack.NETStandard" Version="2.0.4" /> |
|||
<PackageReference Include="MicroCom.CodeGenerator" Version="0.10.4" /> |
|||
<PackageReference Include="MicroCom.CodeGenerator" Version="0.11.0" /> |
|||
<!-- Keep in sync with Avalonia.Build.Tasks --> |
|||
<PackageReference Include="Mono.Cecil" Version="0.11.2" /> |
|||
<PackageReference Include="Mono.Cecil" Version="0.11.4" /> |
|||
<PackageReference Include="SourceLink" Version="1.1.0" GeneratePathProperty="true" /> |
|||
<PackageReference Include="Microsoft.Build.Framework" Version="17.3.2" PrivateAssets="All" /> |
|||
<PackageReference Include="xunit.runner.console" Version="2.4.2"> |
|||
<PrivateAssets>all</PrivateAssets> |
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
|||
</PackageReference> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<NukeMetadata Include="**\*.json" Exclude="bin\**;obj\**" /> |
|||
<NukeExternalFiles Include="**\*.*.ext" Exclude="bin\**;obj\**" /> |
|||
<None Remove="*.csproj.DotSettings;*.ref.*.txt" /> |
|||
|
|||
<!-- Common build related files --> |
|||
<None Include="..\build.ps1" /> |
|||
<None Include="..\build.sh" /> |
|||
<None Include="..\.nuke" /> |
|||
<None Include="..\global.json" Condition="Exists('..\global.json')" /> |
|||
<None Include="..\nuget.config" Condition="Exists('..\nuget.config')" /> |
|||
<None Include="..\Jenkinsfile" Condition="Exists('..\Jenkinsfile')" /> |
|||
<None Include="..\appveyor.yml" Condition="Exists('..\appveyor.yml')" /> |
|||
<None Include="..\.travis.yml" Condition="Exists('..\.travis.yml')" /> |
|||
<None Include="..\GitVersion.yml" Condition="Exists('..\GitVersion.yml')" /> |
|||
<Compile Remove="Numerge/**/*.*" /> |
|||
<Compile Include="Numerge/Numerge/**/*.cs" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<EmbeddedResource Include="$(NuGetPackageRoot)sourcelink/1.1.0/tools/pdbstr.exe"></EmbeddedResource> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Compile Remove="il-repack\ILRepack\Application.cs" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Folder Include="Numerge\Numerge.Console\" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
|
|||
@ -0,0 +1,17 @@ |
|||
using Avalonia; |
|||
using Avalonia.Web.Blazor; |
|||
|
|||
namespace ControlCatalog.Blazor.Web; |
|||
|
|||
public partial class App |
|||
{ |
|||
protected override void OnParametersSet() |
|||
{ |
|||
AppBuilder.Configure<ControlCatalog.App>() |
|||
.UseBlazor() |
|||
// .With(new SkiaOptions { CustomGpuFactory = null }) // uncomment to disable GPU/GL rendering
|
|||
.SetupWithSingleViewLifetime(); |
|||
|
|||
base.OnParametersSet(); |
|||
} |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> |
|||
<PropertyGroup> |
|||
<TargetFramework>net7.0</TargetFramework> |
|||
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier> |
|||
<Nullable>enable</Nullable> |
|||
<EmccTotalMemory>16777216</EmccTotalMemory> |
|||
<BlazorEnableTimeZoneSupport>false</BlazorEnableTimeZoneSupport> |
|||
<BlazorWebAssemblyPreserveCollationData>false</BlazorWebAssemblyPreserveCollationData> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-rc.1.22427.2" /> |
|||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0-rc.1.22427.2" PrivateAssets="all" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Skia\Avalonia.Skia\Avalonia.Skia.csproj" /> |
|||
<ProjectReference Include="..\..\src\Web\Avalonia.Web.Blazor\Avalonia.Web.Blazor.csproj" /> |
|||
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<Import Project="..\..\build\ReferenceCoreLibraries.props" /> |
|||
<Import Project="..\..\build\BuildTargets.targets" /> |
|||
|
|||
<Import Project="..\..\src\Web\Avalonia.Web\Avalonia.Web.props" /> |
|||
<Import Project="..\..\src\Web\Avalonia.Web\Avalonia.Web.targets" /> |
|||
|
|||
</Project> |
|||
|
|||
@ -0,0 +1,29 @@ |
|||
using System; |
|||
using System.Net.Http; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using ControlCatalog.Blazor.Web; |
|||
|
|||
public class Program |
|||
{ |
|||
public static async Task Main(string[] args) |
|||
{ |
|||
await CreateHostBuilder(args).Build().RunAsync(); |
|||
} |
|||
|
|||
public static WebAssemblyHostBuilder CreateHostBuilder(string[] args) |
|||
{ |
|||
var builder = WebAssemblyHostBuilder.CreateDefault(args); |
|||
|
|||
builder.RootComponents.Add<App>("#app"); |
|||
|
|||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); |
|||
|
|||
return builder; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 172 KiB |
@ -1,19 +0,0 @@ |
|||
using Avalonia.Web.Blazor; |
|||
|
|||
namespace ControlCatalog.Web; |
|||
|
|||
public partial class App |
|||
{ |
|||
protected override void OnParametersSet() |
|||
{ |
|||
WebAppBuilder.Configure<ControlCatalog.App>() |
|||
.AfterSetup(_ => |
|||
{ |
|||
ControlCatalog.Pages.EmbedSample.Implementation = new EmbedSampleWeb(); |
|||
}) |
|||
//.With(new SkiaOptions { CustomGpuFactory = null }) // uncomment to disable GPU/GL rendering
|
|||
.SetupWithSingleViewLifetime(); |
|||
|
|||
base.OnParametersSet(); |
|||
} |
|||
} |
|||
@ -1,34 +1,42 @@ |
|||
using System; |
|||
|
|||
using Avalonia; |
|||
using System.Runtime.InteropServices.JavaScript; |
|||
using Avalonia.Platform; |
|||
using Avalonia.Web.Blazor; |
|||
using Avalonia.Web; |
|||
|
|||
using ControlCatalog.Pages; |
|||
|
|||
using Microsoft.JSInterop; |
|||
|
|||
namespace ControlCatalog.Web; |
|||
|
|||
public class EmbedSampleWeb : INativeDemoControl |
|||
{ |
|||
public IPlatformHandle CreateControl(bool isSecond, IPlatformHandle parent, Func<IPlatformHandle> createDefault) |
|||
{ |
|||
var runtime = AvaloniaLocator.Current.GetRequiredService<IJSInProcessRuntime>(); |
|||
|
|||
if (isSecond) |
|||
{ |
|||
var iframe = runtime.Invoke<IJSInProcessObjectReference>("document.createElement", "iframe"); |
|||
iframe.InvokeVoid("setAttribute", "src", "https://www.youtube.com/embed/kZCIporjJ70"); |
|||
var iframe = EmbedInterop.CreateElement("iframe"); |
|||
iframe.SetProperty("src", "https://www.youtube.com/embed/kZCIporjJ70"); |
|||
|
|||
return new JSObjectControlHandle(iframe); |
|||
} |
|||
else |
|||
{ |
|||
// window.createAppButton source is defined in "app.js" file.
|
|||
var button = runtime.Invoke<IJSInProcessObjectReference>("window.createAppButton"); |
|||
var defaultHandle = (JSObjectControlHandle)createDefault(); |
|||
|
|||
_ = JSHost.ImportAsync("embed.js", "./embed.js").ContinueWith(_ => |
|||
{ |
|||
EmbedInterop.AddAppButton(defaultHandle.Object); |
|||
}); |
|||
|
|||
return new JSObjectControlHandle(button); |
|||
return defaultHandle; |
|||
} |
|||
} |
|||
} |
|||
|
|||
internal static partial class EmbedInterop |
|||
{ |
|||
[JSImport("globalThis.document.createElement")] |
|||
public static partial JSObject CreateElement(string tagName); |
|||
|
|||
[JSImport("addAppButton", "embed.js")] |
|||
public static partial void AddAppButton(JSObject parentObject); |
|||
} |
|||
|
|||
|
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,7 @@ |
|||
<linker> |
|||
<assembly fullname="ControlCatalog" preserve="All" /> |
|||
<assembly fullname="ControlCatalog.Web" preserve="All" /> |
|||
<assembly fullname="Avalonia.Themes.Fluent" preserve="All" /> |
|||
<assembly fullname="Avalonia.Themes.Simple" preserve="All" /> |
|||
<assembly fullname="Avalonia.Controls.ColorPicker" preserve="All" /> |
|||
</linker> |
|||
@ -0,0 +1,49 @@ |
|||
#out { |
|||
height: 100vh; |
|||
width: 100vw |
|||
} |
|||
|
|||
#avalonia-splash { |
|||
position: relative; |
|||
height: 100%; |
|||
width: 100%; |
|||
color: whitesmoke; |
|||
background: #171C2C; |
|||
font-family: 'Nunito', sans-serif; |
|||
background-position: center; |
|||
background-size: cover; |
|||
background-repeat: no-repeat; |
|||
} |
|||
|
|||
#avalonia-splash a{ |
|||
color: whitesmoke; |
|||
text-decoration: none; |
|||
} |
|||
|
|||
.center { |
|||
display: flex; |
|||
justify-content: center; |
|||
height: 250px; |
|||
} |
|||
|
|||
.splash-close { |
|||
animation: slide 0.5s linear 1s forwards; |
|||
} |
|||
|
|||
@keyframes slide { |
|||
0% { |
|||
top: 0%; |
|||
} |
|||
|
|||
50% { |
|||
opacity: 80%; |
|||
} |
|||
|
|||
100% { |
|||
top: 100%; |
|||
overflow: hidden; |
|||
opacity: 0; |
|||
display: none; |
|||
visibility: collapse; |
|||
} |
|||
} |
|||
@ -1,10 +1,11 @@ |
|||
window.createAppButton = function () { |
|||
var button = document.createElement('button'); |
|||
export function addAppButton(parent) { |
|||
var button = globalThis.document.createElement('button'); |
|||
button.innerText = 'Hello world'; |
|||
var clickCount = 0; |
|||
button.onclick = () => { |
|||
clickCount++; |
|||
button.innerText = 'Click count ' + clickCount; |
|||
}; |
|||
parent.appendChild(button); |
|||
return button; |
|||
} |
|||
|
After Width: | Height: | Size: 172 KiB |
@ -0,0 +1,31 @@ |
|||
<!DOCTYPE html> |
|||
<!-- Licensed to the .NET Foundation under one or more agreements. --> |
|||
<!-- The .NET Foundation licenses this file to you under the MIT license. --> |
|||
<html> |
|||
|
|||
<head> |
|||
<title>AvaloniaUI - ControlCatalog</title> |
|||
<meta charset="UTF-8"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|||
<link rel="modulepreload" href="./main.js" /> |
|||
<link rel="modulepreload" href="./dotnet.js" /> |
|||
<link rel="modulepreload" href="./avalonia.js" /> |
|||
<link rel="stylesheet" href="./app.css" /> |
|||
</head> |
|||
|
|||
<body style="margin: 0px"> |
|||
<div id="out"> |
|||
<div id="avalonia-splash"> |
|||
<div class="center"> |
|||
<h2>Powered by</h2> |
|||
<a class="navbar-brand" href="https://www.avaloniaui.net/" target="_blank"> |
|||
<img src="Logo.svg" alt="Avalonia Logo" width="30" height="24" /> |
|||
Avalonia |
|||
</a> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<script type='module' src="./main.js"></script> |
|||
</body> |
|||
|
|||
</html> |
|||
@ -0,0 +1,19 @@ |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
|
|||
import { dotnet } from './dotnet.js' |
|||
import { registerAvaloniaModule } from './avalonia.js'; |
|||
|
|||
const is_browser = typeof window != "undefined"; |
|||
if (!is_browser) throw new Error(`Expected to be running in a browser`); |
|||
|
|||
const dotnetRuntime = await dotnet |
|||
.withDiagnosticTracing(false) |
|||
.withApplicationArgumentsFromQuery() |
|||
.create(); |
|||
|
|||
await registerAvaloniaModule(dotnetRuntime); |
|||
|
|||
const config = dotnetRuntime.getConfig(); |
|||
|
|||
await dotnetRuntime.runMainAndExit(config.mainAssemblyName, ["dotnet", "is", "great!"]); |
|||
@ -0,0 +1,11 @@ |
|||
{ |
|||
"wasmHostProperties": { |
|||
"perHostConfig": [ |
|||
{ |
|||
"name": "browser", |
|||
"html-path": "index.html", |
|||
"Host": "browser" |
|||
} |
|||
] |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
using System; |
|||
using System.Globalization; |
|||
using Avalonia; |
|||
using Avalonia.Data.Converters; |
|||
|
|||
namespace ControlCatalog.Converter; |
|||
|
|||
public class HexConverter : IValueConverter |
|||
{ |
|||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) |
|||
{ |
|||
var str = value?.ToString(); |
|||
if (str == null) |
|||
return AvaloniaProperty.UnsetValue; |
|||
if (int.TryParse(str, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out int x)) |
|||
return (decimal)x; |
|||
return AvaloniaProperty.UnsetValue; |
|||
|
|||
} |
|||
|
|||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) |
|||
{ |
|||
try |
|||
{ |
|||
if (value is decimal d) |
|||
return ((int)d).ToString("X8"); |
|||
return AvaloniaProperty.UnsetValue; |
|||
} |
|||
catch |
|||
{ |
|||
return AvaloniaProperty.UnsetValue; |
|||
} |
|||
} |
|||
} |
|||
@ -1,14 +1,10 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace ControlCatalog.Models |
|||
namespace ControlCatalog.Models |
|||
{ |
|||
public enum CatalogTheme |
|||
{ |
|||
FluentLight, |
|||
FluentDark, |
|||
DefaultLight, |
|||
DefaultDark |
|||
SimpleLight, |
|||
SimpleDark |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,66 @@ |
|||
<UserControl x:Class="ControlCatalog.Pages.AdornerLayerPage" |
|||
xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
d:DesignHeight="800" |
|||
d:DesignWidth="400" |
|||
mc:Ignorable="d"> |
|||
|
|||
<DockPanel> |
|||
<Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto" Margin="16" DockPanel.Dock="Top"> |
|||
<TextBlock Grid.Column="0" Grid.Row="0">Rotation</TextBlock> |
|||
<Slider Name="rotation" Maximum="360" Grid.Column="1" Grid.Row="0"/> |
|||
</Grid> |
|||
|
|||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" DockPanel.Dock="Top"> |
|||
<Button Name="AddAdorner" |
|||
Click="AddAdorner_OnClick" |
|||
Content="Add Adorner" |
|||
Margin="6" /> |
|||
<Button Name="RemoveAdorner" |
|||
Click="RemoveAdorner_OnClick" |
|||
Content="Remove Adorner" |
|||
Margin="6" /> |
|||
</StackPanel> |
|||
|
|||
<Grid ColumnDefinitions="24,Auto,24" |
|||
RowDefinitions="24,Auto,24" |
|||
HorizontalAlignment="Center" |
|||
VerticalAlignment="Center"> |
|||
<Border Background="{DynamicResource SystemAccentColor}" Grid.Column="1" Grid.Row="0"/> |
|||
<Border Background="{DynamicResource SystemAccentColor}" Grid.Column="0" Grid.Row="1"/> |
|||
<Border Background="{DynamicResource SystemAccentColor}" Grid.Column="2" Grid.Row="1"/> |
|||
<Border Background="{DynamicResource SystemAccentColor}" Grid.Column="1" Grid.Row="2"/> |
|||
|
|||
<LayoutTransformControl Name="layoutTransform" Grid.Column="1" Grid.Row="1"> |
|||
<LayoutTransformControl.LayoutTransform> |
|||
<RotateTransform Angle="{Binding #rotation.Value}"/> |
|||
</LayoutTransformControl.LayoutTransform> |
|||
|
|||
<Button Name="AdornerButton" |
|||
Content="Adorned Button" |
|||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" |
|||
VerticalContentAlignment="Center" VerticalAlignment="Stretch" |
|||
Width="200" Height="42"> |
|||
<AdornerLayer.Adorner> |
|||
<Canvas x:Name="AdornerCanvas" |
|||
HorizontalAlignment="Stretch" |
|||
VerticalAlignment="Stretch" |
|||
Background="Cyan" |
|||
IsHitTestVisible="False" |
|||
Opacity="0.3" |
|||
IsVisible="True"> |
|||
<Line StartPoint="-10000,0" EndPoint="10000,0" Stroke="Cyan" StrokeThickness="1" /> |
|||
<Line StartPoint="-10000,42" EndPoint="10000,42" Stroke="Cyan" StrokeThickness="1" /> |
|||
<Line StartPoint="0,-10000" EndPoint="0,10000" Stroke="Cyan" StrokeThickness="1" /> |
|||
<Line StartPoint="200,-10000" EndPoint="200,10000" Stroke="Cyan" StrokeThickness="1" /> |
|||
</Canvas> |
|||
</AdornerLayer.Adorner> |
|||
</Button> |
|||
|
|||
</LayoutTransformControl> |
|||
</Grid> |
|||
</DockPanel> |
|||
|
|||
</UserControl> |
|||
@ -0,0 +1,48 @@ |
|||
using Avalonia.Controls; |
|||
using Avalonia.Controls.Primitives; |
|||
using Avalonia.Interactivity; |
|||
using Avalonia.Markup.Xaml; |
|||
|
|||
namespace ControlCatalog.Pages |
|||
{ |
|||
public class AdornerLayerPage : UserControl |
|||
{ |
|||
private Control? _adorner; |
|||
|
|||
public AdornerLayerPage() |
|||
{ |
|||
this.InitializeComponent(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
|
|||
private void RemoveAdorner_OnClick(object? sender, RoutedEventArgs e) |
|||
{ |
|||
var adornerButton = this.FindControl<Button>("AdornerButton"); |
|||
if (adornerButton is { }) |
|||
{ |
|||
var adorner = AdornerLayer.GetAdorner(adornerButton); |
|||
if (adorner is { }) |
|||
{ |
|||
_adorner = adorner; |
|||
} |
|||
AdornerLayer.SetAdorner(adornerButton, null); |
|||
} |
|||
} |
|||
|
|||
private void AddAdorner_OnClick(object? sender, RoutedEventArgs e) |
|||
{ |
|||
var adornerButton = this.FindControl<Button>("AdornerButton"); |
|||
if (adornerButton is { }) |
|||
{ |
|||
if (_adorner is { }) |
|||
{ |
|||
AdornerLayer.SetAdorner(adornerButton, _adorner); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue