-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: trace list for waveform viewer (#60)
* WIP add trace list to viewer * use fluentui * improve project structure and rollup config * feat: trace list for waveform viewer
- Loading branch information
Showing
28 changed files
with
1,947 additions
and
841 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 |
---|---|---|
@@ -1,8 +1,12 @@ | ||
/* eslint-env node */ | ||
module.exports = { | ||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"], | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended-type-checked", | ||
"plugin:@typescript-eslint/stylistic-type-checked", | ||
], | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["@typescript-eslint"], | ||
root: true, | ||
ignorePatterns: ["**/wwwroot/**/*", "Pages/**/*.js"], | ||
ignorePatterns: ["wwwroot/**/*"], | ||
}; |
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,3 +1,2 @@ | ||
## Ignore bundled JS files | ||
**/*.razor.js | ||
**/*.razor.js.map | ||
wwwroot/dist/ |
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,12 +1,41 @@ | ||
<Router AppAssembly="@typeof(App).Assembly"> | ||
<Found Context="routeData"> | ||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> | ||
<FocusOnNavigate RouteData="@routeData" Selector="h1" /> | ||
</Found> | ||
<NotFound> | ||
<PageTitle>Not found</PageTitle> | ||
<LayoutView Layout="@typeof(MainLayout)"> | ||
<p role="alert">Sorry, there's nothing at this address.</p> | ||
</LayoutView> | ||
</NotFound> | ||
</Router> | ||
@inject IJSRuntime JS | ||
|
||
<FluentDesignSystemProvider BaseLayerLuminance="@BaseLayerLuminance"> | ||
<Router AppAssembly="@typeof(App).Assembly"> | ||
<Found Context="routeData"> | ||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> | ||
<FocusOnNavigate RouteData="@routeData" Selector="h1" /> | ||
</Found> | ||
<NotFound> | ||
<PageTitle>Not found</PageTitle> | ||
<LayoutView Layout="@typeof(MainLayout)"> | ||
<p role="alert">Sorry, there's nothing at this address.</p> | ||
</LayoutView> | ||
</NotFound> | ||
</Router> | ||
</FluentDesignSystemProvider> | ||
|
||
@code | ||
{ | ||
private bool _isDarkMode = false; | ||
private float BaseLayerLuminance => _isDarkMode ? 0.23f : 1f; | ||
|
||
protected override async Task OnAfterRenderAsync(bool firstRender) | ||
{ | ||
if (firstRender) | ||
{ | ||
await using var module = await JS.ImportComponentModule<App>(); | ||
var objRef = DotNetObjectReference.Create(this); | ||
await module.InvokeVoidAsync("init", objRef); | ||
_isDarkMode = await module.InvokeAsync<bool>("isSystemDarkMode"); | ||
StateHasChanged(); | ||
} | ||
} | ||
|
||
[JSInvokable] | ||
public async ValueTask OnDarkModeChanged(bool isDarkMode) | ||
{ | ||
_isDarkMode = isDarkMode; | ||
await InvokeAsync(StateHasChanged); | ||
} | ||
} |
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 @@ | ||
import { DotNet } from "@microsoft/dotnet-js-interop"; | ||
|
||
const darkModePreference = window.matchMedia("(prefers-color-scheme: dark)"); | ||
|
||
export function isSystemDarkMode() { | ||
return darkModePreference.matches; | ||
} | ||
|
||
export function init(objRef: DotNet.DotNetObject) { | ||
darkModePreference.addEventListener("change", (e) => { | ||
objRef.invokeMethodAsync("OnDarkModeChanged", e.matches); | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.JSInterop; | ||
|
||
namespace Qynit.PulseGen.Server; | ||
|
||
internal static class Extensions | ||
{ | ||
public static async ValueTask<IJSObjectReference> ImportComponentModule<T>(this IJSRuntime js) where T : ComponentBase | ||
{ | ||
var path = JsLocation.GetPath<T>(); | ||
return await js.InvokeAsync<IJSObjectReference>("import", path); | ||
} | ||
} |
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,25 @@ | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace Qynit.PulseGen.Server; | ||
|
||
internal class JsLocation | ||
{ | ||
public const string Root = "./dist"; | ||
|
||
public static string GetPath<T>() where T : ComponentBase | ||
{ | ||
return PathCache<T>.Path; | ||
} | ||
|
||
private class PathCache<T> | ||
{ | ||
public static readonly string Path = GetPath(); | ||
private static string GetPath() | ||
{ | ||
var type = typeof(T); | ||
var rootNamespace = typeof(JsLocation).Namespace!; | ||
var path = type.FullName!.Replace(rootNamespace, "").Replace(".", "/").TrimStart('/'); | ||
return $"{Root}/{path}.js"; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
@page "/Hello" | ||
|
||
<h3>Hello</h3> | ||
|
||
@code { | ||
|
||
} |
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,13 +1,13 @@ | ||
.box { | ||
display: flex; | ||
flex-flow: column; | ||
flex-flow: row; | ||
height: 100%; | ||
} | ||
|
||
.box .row.header { | ||
.aside { | ||
flex: 0 1 auto; | ||
} | ||
|
||
.box .row.content { | ||
.plot { | ||
flex: 1 1 auto; | ||
} |
Oops, something went wrong.