From 1b7a1e7b59ed46f4f42c7801c2016384c0ffc783 Mon Sep 17 00:00:00 2001 From: Ivan Josipovic <9521987+IvanJosipovic@users.noreply.github.com> Date: Thu, 31 Oct 2024 21:43:58 -0700 Subject: [PATCH] wip --- src/AvaloniaTetris.Browser/AppBundle/Logo.svg | 5 -- src/AvaloniaTetris.Browser/AppBundle/app.css | 74 ------------------ .../AppBundle/index.html | 30 ------- .../AvaloniaTetris.Browser.csproj | 11 +-- src/AvaloniaTetris.Browser/Program.cs | 4 +- .../Properties/launchSettings.json | 2 +- .../runtimeconfig.template.json | 17 ++-- src/AvaloniaTetris.Browser/wwwroot/app.css | 58 ++++++++++++++ .../{AppBundle => wwwroot}/favicon.ico | Bin src/AvaloniaTetris.Browser/wwwroot/index.html | 36 +++++++++ .../{AppBundle => wwwroot}/main.js | 4 +- 11 files changed, 109 insertions(+), 132 deletions(-) delete mode 100644 src/AvaloniaTetris.Browser/AppBundle/Logo.svg delete mode 100644 src/AvaloniaTetris.Browser/AppBundle/app.css delete mode 100644 src/AvaloniaTetris.Browser/AppBundle/index.html create mode 100644 src/AvaloniaTetris.Browser/wwwroot/app.css rename src/AvaloniaTetris.Browser/{AppBundle => wwwroot}/favicon.ico (100%) create mode 100644 src/AvaloniaTetris.Browser/wwwroot/index.html rename src/AvaloniaTetris.Browser/{AppBundle => wwwroot}/main.js (69%) diff --git a/src/AvaloniaTetris.Browser/AppBundle/Logo.svg b/src/AvaloniaTetris.Browser/AppBundle/Logo.svg deleted file mode 100644 index 9685a23..0000000 --- a/src/AvaloniaTetris.Browser/AppBundle/Logo.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/src/AvaloniaTetris.Browser/AppBundle/app.css b/src/AvaloniaTetris.Browser/AppBundle/app.css deleted file mode 100644 index a424538..0000000 --- a/src/AvaloniaTetris.Browser/AppBundle/app.css +++ /dev/null @@ -1,74 +0,0 @@ -: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; - font-size: 2.5rem; - display: block; -} - -.purple { - color: #8b44ac; -} - -.icon { - opacity: 0.05; - height: 35%; - width: 35%; - position: absolute; - background-repeat: no-repeat; - right: 0px; - bottom: 0px; - margin-right: 3%; - margin-bottom: 5%; - z-index: 5000; - background-position: right bottom; - pointer-events: none; -} - -#avalonia-splash a { - color: whitesmoke; - text-decoration: none; -} - -.center { - display: flex; - justify-content: center; - align-items: center; - height: 100vh; -} - -#avalonia-splash { - position: relative; - height: 100%; - width: 100%; - color: whitesmoke; - background: #1b2a4e; - font-family: 'Nunito', sans-serif; - background-position: center; - background-size: cover; - background-repeat: no-repeat; - justify-content: center; - align-items: center; -} - -.splash-close { - animation: fadeout 0.25s linear forwards; -} - -@keyframes fadeout { - 0% { - opacity: 100%; - } - - 100% { - opacity: 0; - visibility: collapse; - } -} diff --git a/src/AvaloniaTetris.Browser/AppBundle/index.html b/src/AvaloniaTetris.Browser/AppBundle/index.html deleted file mode 100644 index 964dbf3..0000000 --- a/src/AvaloniaTetris.Browser/AppBundle/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - Avalonia Tetris - - - - - - - - - - -
-
-
-

- Powered by - Avalonia UI -

-
- Avalonia Logo -
-
- - - - diff --git a/src/AvaloniaTetris.Browser/AvaloniaTetris.Browser.csproj b/src/AvaloniaTetris.Browser/AvaloniaTetris.Browser.csproj index 2cdf143..ee060f4 100644 --- a/src/AvaloniaTetris.Browser/AvaloniaTetris.Browser.csproj +++ b/src/AvaloniaTetris.Browser/AvaloniaTetris.Browser.csproj @@ -1,15 +1,10 @@ - + - net8.0 - browser-wasm - AppBundle\main.js + net8.0-browser Exe + true - - - - diff --git a/src/AvaloniaTetris.Browser/Program.cs b/src/AvaloniaTetris.Browser/Program.cs index a695db5..2e83a2e 100644 --- a/src/AvaloniaTetris.Browser/Program.cs +++ b/src/AvaloniaTetris.Browser/Program.cs @@ -6,11 +6,9 @@ using AvaloniaTetris; -[assembly: SupportedOSPlatform("browser")] - internal partial class Program { - private static async Task Main(string[] args) => await BuildAvaloniaApp() + private static Task Main(string[] args) => BuildAvaloniaApp() .WithInterFont() .StartBrowserAppAsync("out"); diff --git a/src/AvaloniaTetris.Browser/Properties/launchSettings.json b/src/AvaloniaTetris.Browser/Properties/launchSettings.json index d71fe45..c6149be 100644 --- a/src/AvaloniaTetris.Browser/Properties/launchSettings.json +++ b/src/AvaloniaTetris.Browser/Properties/launchSettings.json @@ -7,7 +7,7 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "https://localhost:5001;http://localhost:5000", - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/debug?browser={browserInspectUri}" + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" } } } diff --git a/src/AvaloniaTetris.Browser/runtimeconfig.template.json b/src/AvaloniaTetris.Browser/runtimeconfig.template.json index c6990ba..b96a943 100644 --- a/src/AvaloniaTetris.Browser/runtimeconfig.template.json +++ b/src/AvaloniaTetris.Browser/runtimeconfig.template.json @@ -1,11 +1,10 @@ { - "wasmHostProperties": { - "perHostConfig": [ - { - "name": "browser", - "html-path": "index.html", - "Host": "browser" - } - ] - } + "wasmHostProperties": { + "perHostConfig": [ + { + "name": "browser", + "host": "browser" + } + ] + } } \ No newline at end of file diff --git a/src/AvaloniaTetris.Browser/wwwroot/app.css b/src/AvaloniaTetris.Browser/wwwroot/app.css new file mode 100644 index 0000000..1d6f754 --- /dev/null +++ b/src/AvaloniaTetris.Browser/wwwroot/app.css @@ -0,0 +1,58 @@ +/* HTML styles for the splash screen */ +.avalonia-splash { + position: absolute; + height: 100%; + width: 100%; + background: white; + font-family: 'Outfit', sans-serif; + justify-content: center; + align-items: center; + display: flex; + pointer-events: none; +} + +/* Light theme styles */ +@media (prefers-color-scheme: light) { + .avalonia-splash { + background: white; + } + + .avalonia-splash h2 { + color: #1b2a4e; + } + + .avalonia-splash a { + color: #0D6EFD; + } +} + +@media (prefers-color-scheme: dark) { + .avalonia-splash { + background: #1b2a4e; + } + + .avalonia-splash h2 { + color: white; + } + + .avalonia-splash a { + color: white; + } +} + +.avalonia-splash h2 { + font-weight: 400; + font-size: 1.5rem; +} + +.avalonia-splash a { + text-decoration: none; + font-size: 2.5rem; + display: block; +} + +.avalonia-splash.splash-close { + transition: opacity 200ms, display 200ms; + display: none; + opacity: 0; +} diff --git a/src/AvaloniaTetris.Browser/AppBundle/favicon.ico b/src/AvaloniaTetris.Browser/wwwroot/favicon.ico similarity index 100% rename from src/AvaloniaTetris.Browser/AppBundle/favicon.ico rename to src/AvaloniaTetris.Browser/wwwroot/favicon.ico diff --git a/src/AvaloniaTetris.Browser/wwwroot/index.html b/src/AvaloniaTetris.Browser/wwwroot/index.html new file mode 100644 index 0000000..ca8b932 --- /dev/null +++ b/src/AvaloniaTetris.Browser/wwwroot/index.html @@ -0,0 +1,36 @@ + + + + + AvaloniaTetris + + + + + + +
+
+

+ Powered by + + + + + + + + + + + + + + +

+
+
+ + + + diff --git a/src/AvaloniaTetris.Browser/AppBundle/main.js b/src/AvaloniaTetris.Browser/wwwroot/main.js similarity index 69% rename from src/AvaloniaTetris.Browser/AppBundle/main.js rename to src/AvaloniaTetris.Browser/wwwroot/main.js index 0dbe2e4..bf1555e 100644 --- a/src/AvaloniaTetris.Browser/AppBundle/main.js +++ b/src/AvaloniaTetris.Browser/wwwroot/main.js @@ -1,4 +1,4 @@ -import { dotnet } from './dotnet.js' +import { dotnet } from './_framework/dotnet.js' const is_browser = typeof window != "undefined"; if (!is_browser) throw new Error(`Expected to be running in a browser`); @@ -10,4 +10,4 @@ const dotnetRuntime = await dotnet const config = dotnetRuntime.getConfig(); -await dotnetRuntime.runMainAndExit(config.mainAssemblyName, [window.location.search]); \ No newline at end of file +await dotnetRuntime.runMain(config.mainAssemblyName, [globalThis.location.href]);