Skip to content

Commit

Permalink
Merge pull request #233 from irihitech/wasm
Browse files Browse the repository at this point in the history
support WASM
  • Loading branch information
rabbitism authored Jul 20, 2023
2 parents 07074eb + a8b141b commit 694a9b4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 25 deletions.
8 changes: 4 additions & 4 deletions demo/Semi.Avalonia.Demo.Web/App.axaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Application
x:Class="Semi.Avalonia.Demo.Web.App"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Semi.Avalonia.Demo.Web">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Styles>
<FluentTheme />
<StyleInclude Source="avares://Semi.Avalonia/Themes/LightTheme.axaml" />
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
<StyleInclude Source="avares://Semi.Avalonia.ColorPicker/Index.axaml" />
</Application.Styles>
</Application>
9 changes: 8 additions & 1 deletion demo/Semi.Avalonia.Demo.Web/AppBundle/app.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
/* HTML styles for the splash screen */
:root {
--sat: env(safe-area-inset-top);
--sar: env(safe-area-inset-right);
--sab: env(safe-area-inset-bottom);
--sal: env(safe-area-inset-left);
}

/* HTML styles for the splash screen */

.highlight {
color: white;
Expand Down
1 change: 0 additions & 1 deletion demo/Semi.Avalonia.Demo.Web/AppBundle/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<link rel="modulepreload" href="./dotnet.js" />
<link rel="modulepreload" href="./avalonia.js" />
<link rel="stylesheet" href="./app.css" />
<link rel="preconnect" href="https://fonts.googleapis.com">
</head>

<body style="margin: 0px; overflow: hidden">
Expand Down
3 changes: 0 additions & 3 deletions demo/Semi.Avalonia.Demo.Web/AppBundle/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
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`);
Expand All @@ -9,8 +8,6 @@ const dotnetRuntime = await dotnet
.withApplicationArgumentsFromQuery()
.create();

await registerAvaloniaModule(dotnetRuntime);

const config = dotnetRuntime.getConfig();

await dotnetRuntime.runMainAndExit(config.mainAssemblyName, [window.location.search]);
11 changes: 5 additions & 6 deletions demo/Semi.Avalonia.Demo.Web/Program.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using System.Runtime.Versioning;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Media;
using Semi.Avalonia.Demo.Web;
using Avalonia.Browser;

[assembly: SupportedOSPlatform("browser")]

namespace Semi.Avalonia.Demo.Web;

internal partial class Program
{
private static void Main(string[] args)
{
BuildAvaloniaApp(); //.SetupBrowserApp("out");
}
private static async Task Main(string[] args) => await BuildAvaloniaApp()
.StartBrowserAppAsync("out");

public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>();
Expand Down
11 changes: 1 addition & 10 deletions demo/Semi.Avalonia.Demo.Web/Semi.Avalonia.Demo.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,11 @@
<WasmExtraFilesToDeploy Include="AppBundle\**" />
</ItemGroup>

<ItemGroup>
<None Remove="Assets\SourceHanSansCN-Regular.otf" />
</ItemGroup>

<ItemGroup>
<AvaloniaResource Include="Assets\SourceHanSansCN-Regular.otf" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Browser" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj" />
<ProjectReference Include="..\Semi.Avalonia.Demo\Semi.Avalonia.Demo.csproj" />
</ItemGroup>
</Project>

0 comments on commit 694a9b4

Please sign in to comment.