init
9
.gitignore
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
target
|
||||
frontend/wasm-bindgen*
|
||||
frontend/binaryen
|
||||
frontend/pkg
|
||||
MoonZoonCustom.toml
|
||||
frontend_dist/_api
|
||||
frontend_dist/index.html
|
||||
mzoon
|
||||
tauri
|
2
.taurignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
/*
|
||||
!/src-tauri
|
5567
Cargo.lock
generated
Normal file
25
Cargo.toml
Normal file
|
@ -0,0 +1,25 @@
|
|||
[workspace]
|
||||
members = [
|
||||
"frontend",
|
||||
"backend",
|
||||
"shared",
|
||||
"src-tauri",
|
||||
]
|
||||
resolver = "2"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
repository = "https://github.com/JoyOfHardware/FastWave2.0"
|
||||
authors = ["FastWave authors"]
|
||||
readme = "../README.md"
|
||||
publish = false
|
||||
|
||||
[workspace.dependencies]
|
||||
# wellen = { version = "0.9.9", features = ["serde1"] }
|
||||
# wellen = { path = "../wellen/wellen", features = ["serde1"] }
|
||||
wellen = { git = "https://github.com/MartinKavik/wellen", features = ["serde1"], branch = "new_pub_types" }
|
||||
# moon = { path = "../../crates/moon" }
|
||||
# zoon = { path = "../../crates/zoon" }
|
||||
zoon = { git = "https://github.com/MoonZoon/MoonZoon", rev = "fc73b0d90bf39be72e70fdcab4f319ea5b8e6cfc" }
|
||||
moon = { git = "https://github.com/MoonZoon/MoonZoon", rev = "fc73b0d90bf39be72e70fdcab4f319ea5b8e6cfc" }
|
224
Makefile.toml
Normal file
|
@ -0,0 +1,224 @@
|
|||
[config]
|
||||
default_to_workspace = false
|
||||
min_version = "0.35.13"
|
||||
unstable_features = ["CTRL_C_HANDLING"]
|
||||
skip_core_tasks = true
|
||||
|
||||
[config.modify_core_tasks]
|
||||
private = true
|
||||
namespace = "default"
|
||||
|
||||
####### MAIN TASKS #######
|
||||
|
||||
[tasks.install]
|
||||
description = "Install all dependencies. It's NoOp if all deps are already installed."
|
||||
dependencies = [
|
||||
"install_wasm_target",
|
||||
"install_tauri",
|
||||
"install_mzoon",
|
||||
"init_pixi_canvas",
|
||||
"init_tauri_glue",
|
||||
]
|
||||
|
||||
[tasks.start]
|
||||
description = "Run & watch Typescript and Rust in the debug mode"
|
||||
dependencies = ["store_current_process_id"]
|
||||
run_task = { fork = true, parallel = true, name = [
|
||||
"tauri_dev_with_cleanup",
|
||||
"watch_pixi_canvas",
|
||||
"watch_tauri_glue",
|
||||
]}
|
||||
|
||||
[tasks.bundle]
|
||||
description = "Compile in the release mode and create installation packages"
|
||||
dependencies = ["tauri_build", "show_release_paths"]
|
||||
|
||||
# @TODO: Format also Typescript and CSS
|
||||
[tasks.format]
|
||||
description = "Format code"
|
||||
command = "cargo"
|
||||
args = ["fmt", "--all"]
|
||||
|
||||
###### USEFUL TASKS ######
|
||||
|
||||
[tasks.tauri]
|
||||
description = "Run locally installed tauri"
|
||||
command = "tauri/bin/cargo-tauri"
|
||||
args = ["${@}"]
|
||||
|
||||
[tasks.mzoon]
|
||||
description = "Run locally installed mzoon"
|
||||
command = "mzoon/bin/mzoon"
|
||||
args = ["${@}"]
|
||||
|
||||
# [tasks.mzoon]
|
||||
# description = "Run mzoon from a cloned MoonZoon repo"
|
||||
# command = "cargo"
|
||||
# args = ["run", "--manifest-path", "../MoonZoon/crates/mzoon/Cargo.toml", "${@}"]
|
||||
|
||||
###### HELPER TASKS ######
|
||||
|
||||
[tasks.store_current_process_id]
|
||||
description = ""
|
||||
script_runner = "@duckscript"
|
||||
script = '''
|
||||
current_process_id = pid
|
||||
echo Current process id: ${current_process_id}
|
||||
set_env STORED_PROCESS_ID ${current_process_id}
|
||||
'''
|
||||
|
||||
[tasks.tauri_dev]
|
||||
description = "Run `tauri dev`"
|
||||
extend = "tauri"
|
||||
args = ["dev"]
|
||||
|
||||
[tasks.tauri_dev_with_cleanup]
|
||||
description = "Run forked `tauri dev` with cleanup"
|
||||
run_task = { fork = true, cleanup_task = "cleanup_after_tauri_dev", name = ["tauri_dev"] }
|
||||
|
||||
[tasks.cleanup_after_tauri_dev]
|
||||
description = "Kill the cargo-make/makers process and all its children / forked processes"
|
||||
script_runner = "@duckscript"
|
||||
script = '''
|
||||
os = os_family
|
||||
if equals ${os} windows
|
||||
output = exec taskkill /PID ${STORED_PROCESS_ID} /T /F
|
||||
else
|
||||
output = exec kill -INT -${STORED_PROCESS_ID}
|
||||
end
|
||||
'''
|
||||
|
||||
[tasks.tauri_build]
|
||||
description = "Run `tauri build`"
|
||||
extend = "tauri"
|
||||
args = ["build"]
|
||||
|
||||
[tasks.show_release_paths]
|
||||
description = "Show where to find build artifacts"
|
||||
script_runner = "@duckscript"
|
||||
script = '''
|
||||
echo "- See `target/release/` with built `FastWave(.exe)`"
|
||||
echo "- See `target/release/bundle/` with installation packages"
|
||||
'''
|
||||
|
||||
[tasks.install_wasm_target]
|
||||
description = "Install Rust target `wasm32-unknown-unknown`"
|
||||
command = "rustup"
|
||||
args = ["target", "add", "wasm32-unknown-unknown"]
|
||||
|
||||
[tasks.install_tauri]
|
||||
description = "Install Tauri CLI (tauri) locally"
|
||||
command = "cargo"
|
||||
args = [
|
||||
"install",
|
||||
"tauri-cli@=2.0.0-beta.17",
|
||||
"--locked",
|
||||
"--root",
|
||||
"tauri",
|
||||
]
|
||||
|
||||
[tasks.install_mzoon]
|
||||
description = "Install MoonZoon CLI (mzoon) locally"
|
||||
command = "cargo"
|
||||
args = [
|
||||
"install",
|
||||
"mzoon",
|
||||
"--git",
|
||||
"https://github.com/MoonZoon/MoonZoon",
|
||||
"--locked",
|
||||
"--rev",
|
||||
"fc73b0d90bf39be72e70fdcab4f319ea5b8e6cfc",
|
||||
"--root",
|
||||
"mzoon",
|
||||
]
|
||||
|
||||
## pixi_canvas ##
|
||||
|
||||
[tasks.init_pixi_canvas]
|
||||
description = "Initialize `frontend/typescript/pixi_canvas`"
|
||||
cwd = "frontend/typescript/pixi_canvas"
|
||||
command = "npm"
|
||||
args = ["install"]
|
||||
|
||||
[tasks.init_pixi_canvas.windows]
|
||||
command = "npm.cmd"
|
||||
|
||||
[tasks.watch_pixi_canvas]
|
||||
description = "Build and typescheck Typescript on change"
|
||||
run_task = { fork = true, parallel = true, name = [
|
||||
"watch_build_pixi_canvas",
|
||||
"watch_typecheck_pixi_canvas",
|
||||
]}
|
||||
|
||||
[tasks.watch_build_pixi_canvas]
|
||||
description = "Compile `frontend/typescript/pixi_canvas` on change"
|
||||
cwd = "frontend/typescript/pixi_canvas"
|
||||
command = "node_modules/.bin/esbuild"
|
||||
args = ["pixi_canvas.ts", "--bundle", "--outfile=../bundles/pixi_canvas.js", "--format=esm", "--watch"]
|
||||
|
||||
[tasks.watch_build_pixi_canvas.windows]
|
||||
command = "node_modules/.bin/esbuild.cmd"
|
||||
|
||||
[tasks.watch_typecheck_pixi_canvas]
|
||||
description = "Typecheck `frontend/typescript/pixi_canvas` on change"
|
||||
cwd = "frontend/typescript/pixi_canvas"
|
||||
command = "node_modules/.bin/tsc"
|
||||
args = [
|
||||
"pixi_canvas.ts",
|
||||
"--watch",
|
||||
"--noEmit",
|
||||
"--preserveWatchOutput",
|
||||
"--strict",
|
||||
"--target", "esnext",
|
||||
"--module", "esnext",
|
||||
"--moduleResolution", "bundler",
|
||||
]
|
||||
|
||||
[tasks.watch_typecheck_pixi_canvas.windows]
|
||||
command = "node_modules/.bin/tsc.cmd"
|
||||
|
||||
## tauri_glue ##
|
||||
|
||||
[tasks.init_tauri_glue]
|
||||
description = "Initialize `frontend/typescript/tauri_glue`"
|
||||
cwd = "frontend/typescript/tauri_glue"
|
||||
command = "npm"
|
||||
args = ["install"]
|
||||
|
||||
[tasks.init_tauri_glue.windows]
|
||||
command = "npm.cmd"
|
||||
|
||||
[tasks.watch_tauri_glue]
|
||||
description = "Build and typescheck Typescript on change"
|
||||
run_task = { fork = true, parallel = true, name = [
|
||||
"watch_build_tauri_glue",
|
||||
"watch_typecheck_tauri_glue",
|
||||
]}
|
||||
|
||||
[tasks.watch_build_tauri_glue]
|
||||
description = "Compile `frontend/typescript/tauri_glue` on change"
|
||||
cwd = "frontend/typescript/tauri_glue"
|
||||
command = "node_modules/.bin/esbuild"
|
||||
args = ["tauri_glue.ts", "--bundle", "--outfile=../bundles/tauri_glue.js", "--format=esm", "--watch"]
|
||||
|
||||
[tasks.watch_build_tauri_glue.windows]
|
||||
command = "node_modules/.bin/esbuild.cmd"
|
||||
|
||||
[tasks.watch_typecheck_tauri_glue]
|
||||
description = "Typecheck `frontend/typescript/tauri_glue` on change"
|
||||
cwd = "frontend/typescript/tauri_glue"
|
||||
command = "node_modules/.bin/tsc"
|
||||
args = [
|
||||
"tauri_glue.ts",
|
||||
"--watch",
|
||||
"--noEmit",
|
||||
"--preserveWatchOutput",
|
||||
"--strict",
|
||||
"--target", "esnext",
|
||||
"--module", "esnext",
|
||||
"--moduleResolution", "bundler",
|
||||
]
|
||||
|
||||
[tasks.watch_typecheck_tauri_glue.windows]
|
||||
command = "node_modules/.bin/tsc.cmd"
|
||||
|
24
MoonZoon.toml
Normal file
|
@ -0,0 +1,24 @@
|
|||
port = 8080
|
||||
# port = 8443
|
||||
https = false
|
||||
cache_busting = true
|
||||
backend_log_level = "warn" # "error" / "warn" / "info" / "debug" / "trace"
|
||||
|
||||
[redirect]
|
||||
port = 8081
|
||||
enabled = false
|
||||
|
||||
[cors]
|
||||
origins = ["*"]
|
||||
|
||||
[watch]
|
||||
frontend = [
|
||||
"public",
|
||||
"frontend/Cargo.toml",
|
||||
"frontend/typescript/bundles",
|
||||
"frontend/src",
|
||||
]
|
||||
backend = [
|
||||
"backend/Cargo.toml",
|
||||
"backend/src",
|
||||
]
|
37
README.md
Normal file
|
@ -0,0 +1,37 @@
|
|||
# FastWave
|
||||
> Cross-Platform Wave Viewer
|
||||
|
||||
---
|
||||
|
||||
### Start:
|
||||
|
||||
1. Install [Rust](https://www.rust-lang.org/tools/install)
|
||||
2. Install [Node.js](https://nodejs.org/)
|
||||
3. `cargo install cargo-make`
|
||||
4. `makers install`
|
||||
5. `makers start`
|
||||
|
||||
Troubleshooting:
|
||||
- In case of Tauri compilation errors, install system dependencies: https://beta.tauri.app/guides/prerequisites/
|
||||
|
||||
- Possible Tauri runtime errors in terminal of VSCode installed from Linux Snap package manager:
|
||||
```
|
||||
Failed to load module "colorreload-gtk-module"
|
||||
|
||||
/usr/lib/x86_64-linux-gnu/webkit2gtk-4.1/WebKitNetworkProcess: symbol lookup error: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE
|
||||
```
|
||||
Fix it by installing VSCode directly from official `.deb` bundle or try to unset multiple env variables - more info in https://stackoverflow.com/questions/75921414/java-symbol-lookup-error-snap-core20-current-lib-x86-64-linux-gnu-libpthread
|
||||
|
||||
---
|
||||
|
||||
### Steps before pushing:
|
||||
|
||||
1. `makers format`
|
||||
|
||||
---
|
||||
|
||||
### Production build:
|
||||
|
||||
1. `makers bundle`
|
||||
2. Runnable executable is in `target/release`
|
||||
3. Installable bundles specific for the platform are in `target/release/bundle`
|
11
backend/Cargo.toml
Normal file
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "backend"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
authors.workspace = true
|
||||
readme.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[dependencies]
|
||||
moon.workspace = true
|
2
backend/private/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
16
backend/src/main.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
use moon::*;
|
||||
|
||||
async fn frontend() -> Frontend {
|
||||
Frontend::new().title("FastWave").append_to_head(concat!(
|
||||
"<style>",
|
||||
include_str!("../style.css"),
|
||||
"</style>"
|
||||
))
|
||||
}
|
||||
|
||||
async fn up_msg_handler(_: UpMsgRequest<()>) {}
|
||||
|
||||
#[moon::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
start(frontend, up_msg_handler, |_| {}).await
|
||||
}
|
3
backend/style.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
html {
|
||||
background-color: DarkSlateBlue;
|
||||
}
|
16
frontend/Cargo.toml
Normal file
|
@ -0,0 +1,16 @@
|
|||
[package]
|
||||
name = "frontend"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
authors.workspace = true
|
||||
readme.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
wasm-bindgen-test = "0.3.19"
|
||||
|
||||
[dependencies]
|
||||
zoon.workspace = true
|
||||
wellen.workspace = true
|
||||
|
0
frontend/README.md
Normal file
312
frontend/src/controls_panel.rs
Normal file
|
@ -0,0 +1,312 @@
|
|||
use crate::tauri_bridge;
|
||||
use crate::HierarchyAndTimeTable;
|
||||
use std::collections::VecDeque;
|
||||
use std::rc::Rc;
|
||||
use wellen::GetItem;
|
||||
use zoon::{println, *};
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
struct VarForUI<'a> {
|
||||
name: &'a str,
|
||||
var_type: wellen::VarType,
|
||||
var_direction: wellen::VarDirection,
|
||||
var_ref: wellen::VarRef,
|
||||
signal_type: wellen::SignalType,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
struct ScopeForUI<'a> {
|
||||
level: u32,
|
||||
name: &'a str,
|
||||
scope_ref: wellen::ScopeRef,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ControlsPanel {
|
||||
selected_scope_ref: Mutable<Option<wellen::ScopeRef>>,
|
||||
hierarchy_and_time_table: Mutable<Option<HierarchyAndTimeTable>>,
|
||||
selected_var_refs: MutableVec<wellen::VarRef>,
|
||||
}
|
||||
|
||||
impl ControlsPanel {
|
||||
pub fn new(
|
||||
hierarchy_and_time_table: Mutable<Option<HierarchyAndTimeTable>>,
|
||||
selected_var_refs: MutableVec<wellen::VarRef>,
|
||||
) -> impl Element {
|
||||
Self {
|
||||
selected_scope_ref: <_>::default(),
|
||||
hierarchy_and_time_table,
|
||||
selected_var_refs,
|
||||
}
|
||||
.root()
|
||||
}
|
||||
|
||||
fn triggers(&self) -> Vec<TaskHandle> {
|
||||
vec![Task::start_droppable(
|
||||
self.hierarchy_and_time_table
|
||||
.signal_ref(Option::is_none)
|
||||
.for_each_sync(clone!((self => s) move |_| {
|
||||
s.selected_scope_ref.set(None);
|
||||
s.selected_var_refs.lock_mut().clear();
|
||||
})),
|
||||
)]
|
||||
}
|
||||
|
||||
fn root(&self) -> impl Element {
|
||||
let triggers = self.triggers();
|
||||
Column::new()
|
||||
.after_remove(move |_| drop(triggers))
|
||||
.s(Scrollbars::y_and_clip_x())
|
||||
.s(Height::fill())
|
||||
.s(Padding::all(20))
|
||||
.s(Gap::new().y(40))
|
||||
.s(Align::new().top())
|
||||
.item(self.load_button())
|
||||
.item_signal(
|
||||
self.hierarchy_and_time_table
|
||||
.signal_cloned()
|
||||
.map_some(clone!((self => s) move |(hierarchy, _)| s.scopes_panel(hierarchy))),
|
||||
)
|
||||
.item_signal(
|
||||
self.hierarchy_and_time_table
|
||||
.signal_cloned()
|
||||
.map_some(clone!((self => s) move |(hierarchy, _)| s.vars_panel(hierarchy))),
|
||||
)
|
||||
}
|
||||
|
||||
fn load_button(&self) -> impl Element {
|
||||
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||
let hierarchy_and_time_table = self.hierarchy_and_time_table.clone();
|
||||
Button::new()
|
||||
.s(Padding::new().x(20).y(10))
|
||||
.s(Background::new().color_signal(
|
||||
hovered_signal.map_bool(|| color!("MediumSlateBlue"), || color!("SlateBlue")),
|
||||
))
|
||||
.s(Align::new().left())
|
||||
.s(RoundedCorners::all(15))
|
||||
.label(
|
||||
El::new().s(Font::new().no_wrap()).child_signal(
|
||||
hierarchy_and_time_table
|
||||
.signal_ref(Option::is_some)
|
||||
.map_bool(|| "Unload simple.vcd", || "Load simple.vcd"),
|
||||
),
|
||||
)
|
||||
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||
// @TODO REMOVE
|
||||
.after_insert(clone!((hierarchy_and_time_table) move |_| {
|
||||
if crate::SIMULATE_CLICKS {
|
||||
let mut hierarchy_and_time_table_lock = hierarchy_and_time_table.lock_mut();
|
||||
if hierarchy_and_time_table_lock.is_some() {
|
||||
*hierarchy_and_time_table_lock = None;
|
||||
return;
|
||||
}
|
||||
drop(hierarchy_and_time_table_lock);
|
||||
let hierarchy_and_time_table = hierarchy_and_time_table.clone();
|
||||
Task::start(async move {
|
||||
tauri_bridge::load_waveform().await;
|
||||
let hierarchy = tauri_bridge::get_hierarchy().await;
|
||||
for variable in hierarchy.iter_vars() {
|
||||
println!("{variable:?}");
|
||||
}
|
||||
for scope in hierarchy.iter_scopes() {
|
||||
println!("{scope:?}");
|
||||
}
|
||||
let time_table = tauri_bridge::get_time_table().await;
|
||||
println!("{time_table:?}");
|
||||
hierarchy_and_time_table.set(Some((Rc::new(hierarchy), Rc::new(time_table))))
|
||||
})
|
||||
}
|
||||
}))
|
||||
.on_press(move || {
|
||||
let mut hierarchy_and_time_table_lock = hierarchy_and_time_table.lock_mut();
|
||||
if hierarchy_and_time_table_lock.is_some() {
|
||||
*hierarchy_and_time_table_lock = None;
|
||||
return;
|
||||
}
|
||||
drop(hierarchy_and_time_table_lock);
|
||||
let hierarchy_and_time_table = hierarchy_and_time_table.clone();
|
||||
Task::start(async move {
|
||||
tauri_bridge::load_waveform().await;
|
||||
let hierarchy = tauri_bridge::get_hierarchy().await;
|
||||
for variable in hierarchy.iter_vars() {
|
||||
println!("{variable:?}");
|
||||
}
|
||||
for scope in hierarchy.iter_scopes() {
|
||||
println!("{scope:?}");
|
||||
}
|
||||
let time_table = tauri_bridge::get_time_table().await;
|
||||
println!("{time_table:?}");
|
||||
hierarchy_and_time_table.set(Some((Rc::new(hierarchy), Rc::new(time_table))))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
fn scopes_panel(&self, hierarchy: Rc<wellen::Hierarchy>) -> impl Element {
|
||||
Column::new()
|
||||
.s(Gap::new().y(20))
|
||||
.item(El::new().child("Scopes"))
|
||||
.item(self.scopes_list(hierarchy))
|
||||
}
|
||||
|
||||
fn scopes_list(&self, hierarchy: Rc<wellen::Hierarchy>) -> impl Element {
|
||||
let mut scopes_for_ui = Vec::new();
|
||||
for scope_ref in hierarchy.scopes() {
|
||||
let mut scope_refs = VecDeque::new();
|
||||
scope_refs.push_back((0, scope_ref));
|
||||
while let Some((level, scope_ref)) = scope_refs.pop_front() {
|
||||
let scope = hierarchy.get(scope_ref);
|
||||
scopes_for_ui.push(ScopeForUI {
|
||||
level,
|
||||
name: scope.name(&hierarchy),
|
||||
scope_ref,
|
||||
});
|
||||
for scope_ref in scope.scopes(&hierarchy) {
|
||||
scope_refs.push_back((level + 1, scope_ref));
|
||||
}
|
||||
}
|
||||
}
|
||||
Column::new()
|
||||
.s(Align::new().left())
|
||||
.s(Gap::new().y(10))
|
||||
.items(
|
||||
scopes_for_ui
|
||||
.into_iter()
|
||||
.map(clone!((self => s) move |scope_for_ui| s.scope_button(scope_for_ui))),
|
||||
)
|
||||
}
|
||||
|
||||
fn scope_button(&self, scope_for_ui: ScopeForUI) -> impl Element {
|
||||
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||
let selected_scope_ref = self.selected_scope_ref.clone();
|
||||
let is_selected = selected_scope_ref
|
||||
.signal()
|
||||
.map(move |selected_scope_ref| selected_scope_ref == Some(scope_for_ui.scope_ref));
|
||||
let background_color = map_ref! {
|
||||
let is_selected = is_selected,
|
||||
let is_hovered = hovered_signal => match (*is_selected, *is_hovered) {
|
||||
(true, _) => color!("BlueViolet"),
|
||||
(false, true) => color!("MediumSlateBlue"),
|
||||
(false, false) => color!("SlateBlue"),
|
||||
}
|
||||
};
|
||||
El::new()
|
||||
// @TODO REMOVE
|
||||
.after_insert(
|
||||
clone!((selected_scope_ref, scope_for_ui.scope_ref => scope_ref) move |_| {
|
||||
if crate::SIMULATE_CLICKS {
|
||||
selected_scope_ref.set_neq(Some(scope_ref));
|
||||
}
|
||||
}),
|
||||
)
|
||||
.s(Padding::new().left(scope_for_ui.level * 30))
|
||||
.child(
|
||||
Button::new()
|
||||
.s(Padding::new().x(15).y(5))
|
||||
.s(Background::new().color_signal(background_color))
|
||||
.s(RoundedCorners::all(15))
|
||||
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||
.on_press(move || selected_scope_ref.set_neq(Some(scope_for_ui.scope_ref)))
|
||||
.label(scope_for_ui.name),
|
||||
)
|
||||
}
|
||||
|
||||
fn vars_panel(&self, hierarchy: Rc<wellen::Hierarchy>) -> impl Element {
|
||||
let selected_scope_ref = self.selected_scope_ref.clone();
|
||||
Column::new()
|
||||
.s(Gap::new().y(20))
|
||||
.item(El::new().child("Variables"))
|
||||
.item_signal(selected_scope_ref.signal().map_some(
|
||||
clone!((self => s) move |scope_ref| s.vars_list(scope_ref, hierarchy.clone())),
|
||||
))
|
||||
}
|
||||
|
||||
fn vars_list(
|
||||
&self,
|
||||
selected_scope_ref: wellen::ScopeRef,
|
||||
hierarchy: Rc<wellen::Hierarchy>,
|
||||
) -> impl Element {
|
||||
let vars_for_ui = hierarchy
|
||||
.get(selected_scope_ref)
|
||||
.vars(&hierarchy)
|
||||
.map(|var_ref| {
|
||||
let var = hierarchy.get(var_ref);
|
||||
VarForUI {
|
||||
name: var.name(&hierarchy),
|
||||
var_type: var.var_type(),
|
||||
var_direction: var.direction(),
|
||||
var_ref,
|
||||
signal_type: var.signal_tpe(),
|
||||
}
|
||||
});
|
||||
Column::new()
|
||||
.s(Align::new().left())
|
||||
.s(Gap::new().y(10))
|
||||
.items(vars_for_ui.map(clone!((self => s) move |var_for_ui| s.var_row(var_for_ui))))
|
||||
}
|
||||
|
||||
fn var_row(&self, var_for_ui: VarForUI) -> impl Element {
|
||||
Row::new()
|
||||
.s(Gap::new().x(10))
|
||||
.item(self.var_button(var_for_ui))
|
||||
.item(self.var_tag_type(var_for_ui))
|
||||
.item(self.var_tag_index(var_for_ui))
|
||||
.item(self.var_tag_bit(var_for_ui))
|
||||
.item(self.var_tag_direction(var_for_ui))
|
||||
}
|
||||
|
||||
fn var_button(&self, var_for_ui: VarForUI) -> impl Element {
|
||||
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||
let selected_var_ref = self.selected_var_refs.clone();
|
||||
El::new().child(
|
||||
Button::new()
|
||||
// @TODO REMOVE
|
||||
.after_insert(
|
||||
clone!((selected_var_ref, var_for_ui.var_ref => var_ref) move |_| {
|
||||
if crate::SIMULATE_CLICKS {
|
||||
selected_var_ref.lock_mut().extend([var_ref, var_ref]);
|
||||
}
|
||||
}),
|
||||
)
|
||||
.s(Padding::new().x(15).y(5))
|
||||
.s(Background::new().color_signal(
|
||||
hovered_signal.map_bool(|| color!("MediumSlateBlue"), || color!("SlateBlue")),
|
||||
))
|
||||
.s(RoundedCorners::all(15))
|
||||
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||
.on_press(move || selected_var_ref.lock_mut().push(var_for_ui.var_ref))
|
||||
.label(var_for_ui.name),
|
||||
)
|
||||
}
|
||||
|
||||
fn var_tag_type(&self, var_for_ui: VarForUI) -> impl Element {
|
||||
let var_type = var_for_ui.var_type;
|
||||
El::new().child(format!("{var_type:?}"))
|
||||
}
|
||||
|
||||
fn var_tag_index(&self, var_for_ui: VarForUI) -> Option<impl Element> {
|
||||
let wellen::SignalType::BitVector(_, Some(index)) = var_for_ui.signal_type else {
|
||||
None?
|
||||
};
|
||||
let msb = index.msb();
|
||||
let lsb = index.lsb();
|
||||
El::new().child(format!("[{msb}:{lsb}]")).apply(Some)
|
||||
}
|
||||
|
||||
fn var_tag_bit(&self, var_for_ui: VarForUI) -> Option<impl Element> {
|
||||
let wellen::SignalType::BitVector(length, _) = var_for_ui.signal_type else {
|
||||
None?
|
||||
};
|
||||
El::new()
|
||||
.s(Font::new().no_wrap())
|
||||
.child(format!("{length}-bit"))
|
||||
.apply(Some)
|
||||
}
|
||||
|
||||
fn var_tag_direction(&self, var_for_ui: VarForUI) -> impl Element {
|
||||
let direction = match var_for_ui.var_direction {
|
||||
wellen::VarDirection::Unknown => String::new(),
|
||||
direction => format!("{direction:?}"),
|
||||
};
|
||||
El::new().child(direction)
|
||||
}
|
||||
}
|
40
frontend/src/main.rs
Normal file
|
@ -0,0 +1,40 @@
|
|||
use std::rc::Rc;
|
||||
use zoon::*;
|
||||
|
||||
mod tauri_bridge;
|
||||
|
||||
mod controls_panel;
|
||||
use controls_panel::ControlsPanel;
|
||||
|
||||
mod waveform_panel;
|
||||
use waveform_panel::WaveformPanel;
|
||||
|
||||
type HierarchyAndTimeTable = (Rc<wellen::Hierarchy>, Rc<wellen::TimeTable>);
|
||||
|
||||
// @TODO REMOVE
|
||||
const SIMULATE_CLICKS: bool = false;
|
||||
|
||||
fn main() {
|
||||
start_app("app", root);
|
||||
Task::start(async {
|
||||
// https://github.com/tauri-apps/tauri/issues/5170
|
||||
Timer::sleep(100).await;
|
||||
tauri_bridge::show_window().await;
|
||||
});
|
||||
}
|
||||
|
||||
fn root() -> impl Element {
|
||||
let hierarchy_and_time_table: Mutable<Option<HierarchyAndTimeTable>> = <_>::default();
|
||||
let selected_var_refs: MutableVec<wellen::VarRef> = <_>::default();
|
||||
Row::new()
|
||||
.s(Height::fill())
|
||||
.s(Font::new().color(color!("Lavender")))
|
||||
.item(ControlsPanel::new(
|
||||
hierarchy_and_time_table.clone(),
|
||||
selected_var_refs.clone(),
|
||||
))
|
||||
.item(WaveformPanel::new(
|
||||
hierarchy_and_time_table,
|
||||
selected_var_refs,
|
||||
))
|
||||
}
|
46
frontend/src/tauri_bridge.rs
Normal file
|
@ -0,0 +1,46 @@
|
|||
use zoon::*;
|
||||
|
||||
pub async fn show_window() {
|
||||
tauri_glue::show_window().await
|
||||
}
|
||||
|
||||
pub async fn load_waveform() {
|
||||
tauri_glue::load_waveform().await
|
||||
}
|
||||
|
||||
pub async fn get_hierarchy() -> wellen::Hierarchy {
|
||||
serde_wasm_bindgen::from_value(tauri_glue::get_hierarchy().await).unwrap_throw()
|
||||
}
|
||||
|
||||
pub async fn get_time_table() -> wellen::TimeTable {
|
||||
serde_wasm_bindgen::from_value(tauri_glue::get_time_table().await).unwrap_throw()
|
||||
}
|
||||
|
||||
pub async fn load_and_get_signal(signal_ref: wellen::SignalRef) -> wellen::Signal {
|
||||
serde_wasm_bindgen::from_value(tauri_glue::load_and_get_signal(signal_ref.index()).await)
|
||||
.unwrap_throw()
|
||||
}
|
||||
|
||||
pub async fn unload_signal(signal_ref: wellen::SignalRef) {
|
||||
tauri_glue::unload_signal(signal_ref.index()).await
|
||||
}
|
||||
|
||||
mod tauri_glue {
|
||||
use zoon::*;
|
||||
|
||||
// Note: Add all corresponding methods to `frontend/typescript/tauri_glue/tauri_glue.ts`
|
||||
#[wasm_bindgen(module = "/typescript/bundles/tauri_glue.js")]
|
||||
extern "C" {
|
||||
pub async fn show_window();
|
||||
|
||||
pub async fn load_waveform();
|
||||
|
||||
pub async fn get_hierarchy() -> JsValue;
|
||||
|
||||
pub async fn get_time_table() -> JsValue;
|
||||
|
||||
pub async fn load_and_get_signal(signal_ref_index: usize) -> JsValue;
|
||||
|
||||
pub async fn unload_signal(signal_ref_index: usize);
|
||||
}
|
||||
}
|
141
frontend/src/waveform_panel.rs
Normal file
|
@ -0,0 +1,141 @@
|
|||
use crate::{tauri_bridge, HierarchyAndTimeTable};
|
||||
use wellen::GetItem;
|
||||
use zoon::*;
|
||||
|
||||
mod pixi_canvas;
|
||||
use pixi_canvas::PixiCanvas;
|
||||
|
||||
const ROW_HEIGHT: u32 = 40;
|
||||
const ROW_GAP: u32 = 4;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct WaveformPanel {
|
||||
selected_var_refs: MutableVec<wellen::VarRef>,
|
||||
hierarchy_and_time_table: Mutable<Option<HierarchyAndTimeTable>>,
|
||||
}
|
||||
|
||||
impl WaveformPanel {
|
||||
pub fn new(
|
||||
hierarchy_and_time_table: Mutable<Option<HierarchyAndTimeTable>>,
|
||||
selected_var_refs: MutableVec<wellen::VarRef>,
|
||||
) -> impl Element {
|
||||
Self {
|
||||
selected_var_refs,
|
||||
hierarchy_and_time_table,
|
||||
}
|
||||
.root()
|
||||
}
|
||||
|
||||
fn root(&self) -> impl Element {
|
||||
let selected_vars_panel_height_getter: Mutable<u32> = <_>::default();
|
||||
Row::new()
|
||||
.s(Padding::all(20).left(0))
|
||||
.s(Scrollbars::y_and_clip_x())
|
||||
.s(Width::growable())
|
||||
.s(Height::fill())
|
||||
.item(self.selected_vars_panel(selected_vars_panel_height_getter.clone()))
|
||||
.item(self.canvas(selected_vars_panel_height_getter.read_only()))
|
||||
}
|
||||
|
||||
fn selected_vars_panel(&self, height_getter: Mutable<u32>) -> impl Element {
|
||||
Column::new()
|
||||
.s(Gap::new().y(ROW_GAP))
|
||||
.s(Align::new().top())
|
||||
.on_viewport_size_change(move |_, height| height_getter.set_neq(height))
|
||||
.items_signal_vec(self.selected_var_refs.signal_vec().enumerate().map(
|
||||
clone!((self => s) move |(index, var_ref)| {
|
||||
s.selected_var_panel(index, var_ref)
|
||||
}),
|
||||
))
|
||||
}
|
||||
|
||||
fn canvas(&self, selected_vars_panel_height: ReadOnlyMutable<u32>) -> impl Element {
|
||||
let selected_var_refs = self.selected_var_refs.clone();
|
||||
let hierarchy_and_time_table = self.hierarchy_and_time_table.clone();
|
||||
PixiCanvas::new(ROW_HEIGHT, ROW_GAP)
|
||||
.s(Align::new().top())
|
||||
.s(Width::fill())
|
||||
.s(Height::exact_signal(selected_vars_panel_height.signal()))
|
||||
.s(RoundedCorners::new().right(15))
|
||||
.task_with_controller(move |controller| {
|
||||
selected_var_refs.signal_vec().delay_remove(clone!((hierarchy_and_time_table) move |var_ref| {
|
||||
clone!((var_ref, hierarchy_and_time_table) async move {
|
||||
if let Some(hierarchy_and_time_table) = hierarchy_and_time_table.get_cloned() {
|
||||
tauri_bridge::unload_signal(hierarchy_and_time_table.0.get(var_ref).signal_ref()).await;
|
||||
}
|
||||
})
|
||||
})).for_each(clone!((controller, hierarchy_and_time_table) move |vec_diff| {
|
||||
clone!((controller, hierarchy_and_time_table) async move {
|
||||
match vec_diff {
|
||||
VecDiff::Replace { values: _ } => { todo!("`task_with_controller` + `Replace`") },
|
||||
VecDiff::InsertAt { index: _, value: _ } => { todo!("`task_with_controller` + `InsertAt`") }
|
||||
VecDiff::UpdateAt { index: _, value: _ } => { todo!("`task_with_controller` + `UpdateAt`") }
|
||||
VecDiff::RemoveAt { index } => {
|
||||
if let Some(controller) = controller.lock_ref().as_ref() {
|
||||
controller.remove_var(index);
|
||||
}
|
||||
}
|
||||
VecDiff::Move { old_index: _, new_index: _ } => { todo!("`task_with_controller` + `Move`") }
|
||||
VecDiff::Push { value: var_ref } => {
|
||||
if let Some(controller) = controller.lock_ref().as_ref() {
|
||||
let (hierarchy, time_table) = hierarchy_and_time_table.get_cloned().unwrap();
|
||||
let var = hierarchy.get(var_ref);
|
||||
let signal_ref = var.signal_ref();
|
||||
let signal = tauri_bridge::load_and_get_signal(signal_ref).await;
|
||||
|
||||
let timescale = hierarchy.timescale();
|
||||
zoon::println!("{timescale:?}");
|
||||
|
||||
// Note: Sync `timeline`'s type with the `Timeline` in `frontend/typescript/pixi_canvas/pixi_canvas.ts'
|
||||
let mut timeline: Vec<(wellen::Time, Option<String>)> = time_table.iter().map(|time| (*time, None)).collect();
|
||||
for (time_index, signal_value) in signal.iter_changes() {
|
||||
timeline[time_index as usize].1 = Some(signal_value.to_string());
|
||||
}
|
||||
controller.push_var(serde_wasm_bindgen::to_value(&timeline).unwrap_throw());
|
||||
}
|
||||
}
|
||||
VecDiff::Pop {} => {
|
||||
if let Some(controller) = controller.lock_ref().as_ref() {
|
||||
controller.pop_var();
|
||||
}
|
||||
}
|
||||
VecDiff::Clear {} => {
|
||||
if let Some(controller) = controller.lock_ref().as_ref() {
|
||||
controller.clear_vars();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
fn selected_var_panel(
|
||||
&self,
|
||||
index: ReadOnlyMutable<Option<usize>>,
|
||||
var_ref: wellen::VarRef,
|
||||
) -> Option<impl Element> {
|
||||
let Some((hierarchy, _)) = self.hierarchy_and_time_table.get_cloned() else {
|
||||
None?
|
||||
};
|
||||
let var = hierarchy.get(var_ref);
|
||||
let name: &str = var.name(&hierarchy);
|
||||
let selected_var_refs = self.selected_var_refs.clone();
|
||||
Button::new()
|
||||
.s(Height::exact(ROW_HEIGHT))
|
||||
.s(Background::new().color(color!("SlateBlue", 0.8)))
|
||||
.s(RoundedCorners::new().left(15))
|
||||
.label(
|
||||
El::new()
|
||||
.s(Align::center())
|
||||
.s(Padding::new().left(20).right(17).y(10))
|
||||
.child(name),
|
||||
)
|
||||
.on_press(move || {
|
||||
if let Some(index) = index.get() {
|
||||
selected_var_refs.lock_mut().remove(index);
|
||||
}
|
||||
})
|
||||
.apply(Some)
|
||||
}
|
||||
}
|
121
frontend/src/waveform_panel/pixi_canvas.rs
Normal file
|
@ -0,0 +1,121 @@
|
|||
use zoon::*;
|
||||
|
||||
pub struct PixiCanvas {
|
||||
raw_el: RawHtmlEl<web_sys::HtmlElement>,
|
||||
controller: ReadOnlyMutable<Option<js_bridge::PixiController>>,
|
||||
#[allow(dead_code)]
|
||||
width: ReadOnlyMutable<u32>,
|
||||
#[allow(dead_code)]
|
||||
height: ReadOnlyMutable<u32>,
|
||||
task_with_controller: Mutable<Option<TaskHandle>>,
|
||||
}
|
||||
|
||||
impl Element for PixiCanvas {}
|
||||
|
||||
impl RawElWrapper for PixiCanvas {
|
||||
type RawEl = RawHtmlEl<web_sys::HtmlElement>;
|
||||
fn raw_el_mut(&mut self) -> &mut Self::RawEl {
|
||||
&mut self.raw_el
|
||||
}
|
||||
}
|
||||
|
||||
impl Styleable<'_> for PixiCanvas {}
|
||||
impl KeyboardEventAware for PixiCanvas {}
|
||||
impl MouseEventAware for PixiCanvas {}
|
||||
impl PointerEventAware for PixiCanvas {}
|
||||
impl TouchEventAware for PixiCanvas {}
|
||||
impl AddNearbyElement<'_> for PixiCanvas {}
|
||||
impl HasIds for PixiCanvas {}
|
||||
|
||||
impl PixiCanvas {
|
||||
pub fn new(row_height: u32, row_gap: u32) -> Self {
|
||||
let controller: Mutable<Option<js_bridge::PixiController>> = Mutable::new(None);
|
||||
let width = Mutable::new(0);
|
||||
let height = Mutable::new(0);
|
||||
let resize_task = Task::start_droppable(
|
||||
map_ref! {
|
||||
let _ = width.signal(),
|
||||
let _ = height.signal() => ()
|
||||
}
|
||||
.for_each_sync(clone!((controller) move |_| {
|
||||
if let Some(controller) = controller.lock_ref().as_ref() {
|
||||
controller.queue_resize();
|
||||
}
|
||||
})),
|
||||
);
|
||||
let task_with_controller = Mutable::new(None);
|
||||
Self {
|
||||
controller: controller.read_only(),
|
||||
width: width.read_only(),
|
||||
height: height.read_only(),
|
||||
task_with_controller: task_with_controller.clone(),
|
||||
raw_el: El::new()
|
||||
.s(Clip::both())
|
||||
.on_viewport_size_change(clone!((width, height) move |new_width, new_height| {
|
||||
width.set_neq(new_width);
|
||||
height.set_neq(new_height);
|
||||
}))
|
||||
.after_insert(clone!((controller) move |element| {
|
||||
Task::start(async move {
|
||||
let pixi_controller = js_bridge::PixiController::new(row_height, row_gap);
|
||||
pixi_controller.init(&element).await;
|
||||
controller.set(Some(pixi_controller));
|
||||
});
|
||||
}))
|
||||
.after_remove(move |_| {
|
||||
drop(resize_task);
|
||||
drop(task_with_controller);
|
||||
if let Some(controller) = controller.take() {
|
||||
controller.destroy();
|
||||
}
|
||||
})
|
||||
.into_raw_el(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn task_with_controller<FUT: Future<Output = ()> + 'static>(
|
||||
self,
|
||||
f: impl FnOnce(ReadOnlyMutable<Option<js_bridge::PixiController>>) -> FUT,
|
||||
) -> Self {
|
||||
self.task_with_controller
|
||||
.set(Some(Task::start_droppable(f(self.controller.clone()))));
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
mod js_bridge {
|
||||
use zoon::*;
|
||||
|
||||
// Note: Add all corresponding methods to `frontend/typescript/pixi_canvas/pixi_canvas.ts`
|
||||
#[wasm_bindgen(module = "/typescript/bundles/pixi_canvas.js")]
|
||||
extern "C" {
|
||||
pub type PixiController;
|
||||
|
||||
// @TODO `row_height` and `row_gap` is FastWave-specific
|
||||
#[wasm_bindgen(constructor)]
|
||||
pub fn new(row_height: u32, row_gap: u32) -> PixiController;
|
||||
|
||||
#[wasm_bindgen(method)]
|
||||
pub async fn init(this: &PixiController, parent_element: &JsValue);
|
||||
|
||||
#[wasm_bindgen(method)]
|
||||
pub fn destroy(this: &PixiController);
|
||||
|
||||
#[wasm_bindgen(method)]
|
||||
pub fn queue_resize(this: &PixiController);
|
||||
|
||||
// -- FastWave-specific --
|
||||
|
||||
#[wasm_bindgen(method)]
|
||||
pub fn remove_var(this: &PixiController, index: usize);
|
||||
|
||||
#[wasm_bindgen(method)]
|
||||
pub fn push_var(this: &PixiController, timeline: JsValue);
|
||||
|
||||
#[wasm_bindgen(method)]
|
||||
pub fn pop_var(this: &PixiController);
|
||||
|
||||
#[wasm_bindgen(method)]
|
||||
pub fn clear_vars(this: &PixiController);
|
||||
}
|
||||
}
|
1
frontend/typescript/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
node_modules
|
35262
frontend/typescript/bundles/pixi_canvas.js
Normal file
2539
frontend/typescript/bundles/tauri_glue.js
Normal file
14
frontend/typescript/pixi_canvas/README.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
Init
|
||||
- `npm install`
|
||||
|
||||
Watch & build (without typechecking)
|
||||
- `node_modules/.bin/esbuild pixi_canvas.ts --bundle --outfile=../bundles/pixi_canvas.js --format=esm --watch`
|
||||
|
||||
Watch & typecheck (without building)
|
||||
- `node_modules/.bin/tsc pixi_canvas.ts --watch -noEmit --preserveWatchOutput --target esnext --module esnext --moduleResolution bundler`
|
||||
|
||||
Created with commands:
|
||||
- `npm i -E pixi.js`
|
||||
- `npm i -D esbuild typescript`
|
||||
|
||||
|
499
frontend/typescript/pixi_canvas/package-lock.json
generated
Normal file
|
@ -0,0 +1,499 @@
|
|||
{
|
||||
"name": "pixi_canvas",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"pixi.js": "8.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.21.4",
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.4.tgz",
|
||||
"integrity": "sha512-Zrm+B33R4LWPLjDEVnEqt2+SLTATlru1q/xYKVn8oVTbiRBGmK2VIMoIYGJDGyftnGaC788IuzGFAlb7IQ0Y8A==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"aix"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.4.tgz",
|
||||
"integrity": "sha512-E7H/yTd8kGQfY4z9t3nRPk/hrhaCajfA3YSQSBrst8B+3uTcgsi8N+ZWYCaeIDsiVs6m65JPCaQN/DxBRclF3A==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.4.tgz",
|
||||
"integrity": "sha512-fYFnz+ObClJ3dNiITySBUx+oNalYUT18/AryMxfovLkYWbutXsct3Wz2ZWAcGGppp+RVVX5FiXeLYGi97umisA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-mDqmlge3hFbEPbCWxp4fM6hqq7aZfLEHZAKGP9viq9wMUBVQx202aDIfc3l+d2cKhUJM741VrCXEzRFhPDKH3Q==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-arm64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.4.tgz",
|
||||
"integrity": "sha512-72eaIrDZDSiWqpmCzVaBD58c8ea8cw/U0fq/PPOTqE3c53D0xVMRt2ooIABZ6/wj99Y+h4ksT/+I+srCDLU9TA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-uBsuwRMehGmw1JC7Vecu/upOjTsMhgahmDkWhGLWxIgUn2x/Y4tIwUZngsmVb6XyPSTXJYS4YiASKPcm9Zitag==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-arm64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.4.tgz",
|
||||
"integrity": "sha512-8JfuSC6YMSAEIZIWNL3GtdUT5NhUA/CMUCpZdDRolUXNAXEE/Vbpe6qlGLpfThtY5NwXq8Hi4nJy4YfPh+TwAg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-8d9y9eQhxv4ef7JmXny7591P/PYsDFc4+STaxC1GBv0tMyCdyWfXu2jBuqRsyhY8uL2HU8uPyscgE2KxCY9imQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.4.tgz",
|
||||
"integrity": "sha512-2rqFFefpYmpMs+FWjkzSgXg5vViocqpq5a1PSRgT0AvSgxoXmGF17qfGAzKedg6wAwyM7UltrKVo9kxaJLMF/g==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.4.tgz",
|
||||
"integrity": "sha512-/GLD2orjNU50v9PcxNpYZi+y8dJ7e7/LhQukN3S4jNDXCKkyyiyAz9zDw3siZ7Eh1tRcnCHAo/WcqKMzmi4eMQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ia32": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.4.tgz",
|
||||
"integrity": "sha512-pNftBl7m/tFG3t2m/tSjuYeWIffzwAZT9m08+9DPLizxVOsUl8DdFzn9HvJrTQwe3wvJnwTdl92AonY36w/25g==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-loong64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.4.tgz",
|
||||
"integrity": "sha512-cSD2gzCK5LuVX+hszzXQzlWya6c7hilO71L9h4KHwqI4qeqZ57bAtkgcC2YioXjsbfAv4lPn3qe3b00Zt+jIfQ==",
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-mips64el": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.4.tgz",
|
||||
"integrity": "sha512-qtzAd3BJh7UdbiXCrg6npWLYU0YpufsV9XlufKhMhYMJGJCdfX/G6+PNd0+v877X1JG5VmjBLUiFB0o8EUSicA==",
|
||||
"cpu": [
|
||||
"mips64el"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ppc64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.4.tgz",
|
||||
"integrity": "sha512-yB8AYzOTaL0D5+2a4xEy7OVvbcypvDR05MsB/VVPVA7nL4hc5w5Dyd/ddnayStDgJE59fAgNEOdLhBxjfx5+dg==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-riscv64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.4.tgz",
|
||||
"integrity": "sha512-Y5AgOuVzPjQdgU59ramLoqSSiXddu7F3F+LI5hYy/d1UHN7K5oLzYBDZe23QmQJ9PIVUXwOdKJ/jZahPdxzm9w==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-s390x": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.4.tgz",
|
||||
"integrity": "sha512-Iqc/l/FFwtt8FoTK9riYv9zQNms7B8u+vAI/rxKuN10HgQIXaPzKZc479lZ0x6+vKVQbu55GdpYpeNWzjOhgbA==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-Td9jv782UMAFsuLZINfUpoF5mZIbAj+jv1YVtE58rFtfvoKRiKSkRGQfHTgKamLVT/fO7203bHa3wU122V/Bdg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-Awn38oSXxsPMQxaV0Ipb7W/gxZtk5Tx3+W+rAPdZkyEhQ6968r9NvtkjhnhbEgWXYbgV+JEONJ6PcdBS+nlcpA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-IsUmQeCY0aU374R82fxIPu6vkOybWIMc3hVGZ3ChRwL9hA1TwY+tS0lgFWV5+F1+1ssuvvXt3HFqe8roCip8Hg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/sunos-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-hsKhgZ4teLUaDA6FG/QIu2q0rI6I36tZVfM4DBZv3BG0mkMIdEnMbhc4xwLvLJSS22uWmaVkFkqWgIS0gPIm+A==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"sunos"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-arm64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.4.tgz",
|
||||
"integrity": "sha512-UUfMgMoXPoA/bvGUNfUBFLCh0gt9dxZYIx9W4rfJr7+hKe5jxxHmfOK8YSH4qsHLLN4Ck8JZ+v7Q5fIm1huErg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-ia32": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.4.tgz",
|
||||
"integrity": "sha512-yIxbspZb5kGCAHWm8dexALQ9en1IYDfErzjSEq1KzXFniHv019VT3mNtTK7t8qdy4TwT6QYHI9sEZabONHg+aw==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-sywLRD3UK/qRJt0oBwdpYLBibk7KiRfbswmWRDabuncQYSlf8aLEEUor/oP6KRz8KEG+HoiVLBhPRD5JWjS8Sg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@pixi/colord": {
|
||||
"version": "2.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@pixi/colord/-/colord-2.9.6.tgz",
|
||||
"integrity": "sha512-nezytU2pw587fQstUu1AsJZDVEynjskwOL+kibwcdxsMBFqPsFFNA7xl0ii/gXuDi6M0xj3mfRJj8pBSc2jCfA=="
|
||||
},
|
||||
"node_modules/@types/css-font-loading-module": {
|
||||
"version": "0.0.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/css-font-loading-module/-/css-font-loading-module-0.0.12.tgz",
|
||||
"integrity": "sha512-x2tZZYkSxXqWvTDgveSynfjq/T2HyiZHXb00j/+gy19yp70PHCizM48XFdjBCWH7eHBD0R5i/pw9yMBP/BH5uA=="
|
||||
},
|
||||
"node_modules/@types/earcut": {
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/earcut/-/earcut-2.1.4.tgz",
|
||||
"integrity": "sha512-qp3m9PPz4gULB9MhjGID7wpo3gJ4bTGXm7ltNDsmOvsPduTeHp8wSW9YckBj3mljeOh4F0m2z/0JKAALRKbmLQ=="
|
||||
},
|
||||
"node_modules/@webgpu/types": {
|
||||
"version": "0.1.40",
|
||||
"resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.40.tgz",
|
||||
"integrity": "sha512-/BBkHLS6/eQjyWhY2H7Dx5DHcVrS2ICj9owvSRdgtQT6KcafLZA86tPze0xAOsd4FbsYKCUBUQyNi87q7gV7kw=="
|
||||
},
|
||||
"node_modules/@xmldom/xmldom": {
|
||||
"version": "0.8.10",
|
||||
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz",
|
||||
"integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/earcut": {
|
||||
"version": "2.2.4",
|
||||
"resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz",
|
||||
"integrity": "sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ=="
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.4.tgz",
|
||||
"integrity": "sha512-sFMcNNrj+Q0ZDolrp5pDhH0nRPN9hLIM3fRPwgbLYJeSHHgnXSnbV3xYgSVuOeLWH9c73VwmEverVzupIv5xuA==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.21.4",
|
||||
"@esbuild/android-arm": "0.21.4",
|
||||
"@esbuild/android-arm64": "0.21.4",
|
||||
"@esbuild/android-x64": "0.21.4",
|
||||
"@esbuild/darwin-arm64": "0.21.4",
|
||||
"@esbuild/darwin-x64": "0.21.4",
|
||||
"@esbuild/freebsd-arm64": "0.21.4",
|
||||
"@esbuild/freebsd-x64": "0.21.4",
|
||||
"@esbuild/linux-arm": "0.21.4",
|
||||
"@esbuild/linux-arm64": "0.21.4",
|
||||
"@esbuild/linux-ia32": "0.21.4",
|
||||
"@esbuild/linux-loong64": "0.21.4",
|
||||
"@esbuild/linux-mips64el": "0.21.4",
|
||||
"@esbuild/linux-ppc64": "0.21.4",
|
||||
"@esbuild/linux-riscv64": "0.21.4",
|
||||
"@esbuild/linux-s390x": "0.21.4",
|
||||
"@esbuild/linux-x64": "0.21.4",
|
||||
"@esbuild/netbsd-x64": "0.21.4",
|
||||
"@esbuild/openbsd-x64": "0.21.4",
|
||||
"@esbuild/sunos-x64": "0.21.4",
|
||||
"@esbuild/win32-arm64": "0.21.4",
|
||||
"@esbuild/win32-ia32": "0.21.4",
|
||||
"@esbuild/win32-x64": "0.21.4"
|
||||
}
|
||||
},
|
||||
"node_modules/eventemitter3": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
|
||||
"integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="
|
||||
},
|
||||
"node_modules/ismobilejs": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ismobilejs/-/ismobilejs-1.1.1.tgz",
|
||||
"integrity": "sha512-VaFW53yt8QO61k2WJui0dHf4SlL8lxBofUuUmwBo0ljPk0Drz2TiuDW4jo3wDcv41qy/SxrJ+VAzJ/qYqsmzRw=="
|
||||
},
|
||||
"node_modules/parse-svg-path": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/parse-svg-path/-/parse-svg-path-0.1.2.tgz",
|
||||
"integrity": "sha512-JyPSBnkTJ0AI8GGJLfMXvKq42cj5c006fnLz6fXy6zfoVjJizi8BNTpu8on8ziI1cKy9d9DGNuY17Ce7wuejpQ=="
|
||||
},
|
||||
"node_modules/pixi.js": {
|
||||
"version": "8.1.4",
|
||||
"resolved": "https://registry.npmjs.org/pixi.js/-/pixi.js-8.1.4.tgz",
|
||||
"integrity": "sha512-qX8dbVbos7jPiKn0EQQRiztzMHmBjHgsD5wiGGbqUYRCejuooCkbny4x15Q1oj1PmZ0RbeTw0keHyxRGIDaPKw==",
|
||||
"dependencies": {
|
||||
"@pixi/colord": "^2.9.6",
|
||||
"@types/css-font-loading-module": "^0.0.12",
|
||||
"@types/earcut": "^2.1.4",
|
||||
"@webgpu/types": "^0.1.40",
|
||||
"@xmldom/xmldom": "^0.8.10",
|
||||
"earcut": "^2.2.4",
|
||||
"eventemitter3": "^5.0.1",
|
||||
"ismobilejs": "^1.1.1",
|
||||
"parse-svg-path": "^0.1.2"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.4.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
|
||||
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
9
frontend/typescript/pixi_canvas/package.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"pixi.js": "8.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.21.4",
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
}
|
180
frontend/typescript/pixi_canvas/pixi_canvas.ts
Normal file
|
@ -0,0 +1,180 @@
|
|||
import { Application, Text, Graphics, Container, TextStyle } from "pixi.js";
|
||||
|
||||
type Time = number;
|
||||
type BitString = string;
|
||||
type Timeline = Array<[Time, BitString | undefined]>;
|
||||
|
||||
export class PixiController {
|
||||
app: Application
|
||||
// -- FastWave-specific --
|
||||
var_signal_rows: Array<VarSignalRow> = [];
|
||||
var_signal_rows_container = new Container();
|
||||
row_height: number;
|
||||
row_gap: number;
|
||||
|
||||
constructor(row_height: number, row_gap: number) {
|
||||
this.app = new Application();
|
||||
// -- FastWave-specific --
|
||||
this.row_height = row_height;
|
||||
this.row_gap = row_gap;
|
||||
this.app.stage.addChild(this.var_signal_rows_container);
|
||||
}
|
||||
|
||||
async init(parent_element: HTMLElement) {
|
||||
await this.app.init({ background: 'DarkSlateBlue', antialias: true, resizeTo: parent_element });
|
||||
parent_element.appendChild(this.app.canvas);
|
||||
}
|
||||
|
||||
// Default automatic Pixi resizing is not reliable
|
||||
queue_resize() {
|
||||
this.app.queueResize();
|
||||
}
|
||||
|
||||
destroy() {
|
||||
const rendererDestroyOptions = {
|
||||
removeView: true
|
||||
}
|
||||
const options = {
|
||||
children: true,
|
||||
texture: true,
|
||||
textureSource: true,
|
||||
context: true,
|
||||
}
|
||||
this.app.destroy(rendererDestroyOptions, options);
|
||||
}
|
||||
|
||||
// -- FastWave-specific --
|
||||
|
||||
remove_var(index: number) {
|
||||
this.var_signal_rows[index].destroy();
|
||||
}
|
||||
|
||||
push_var(timeline: Timeline) {
|
||||
new VarSignalRow(
|
||||
timeline,
|
||||
this.app,
|
||||
this.var_signal_rows,
|
||||
this.var_signal_rows_container,
|
||||
this.row_height,
|
||||
this.row_gap,
|
||||
)
|
||||
}
|
||||
|
||||
pop_var() {
|
||||
this.var_signal_rows[this.var_signal_rows.length - 1].destroy();
|
||||
}
|
||||
|
||||
clear_vars() {
|
||||
this.var_signal_rows.slice().reverse().forEach(row => row.destroy());
|
||||
}
|
||||
}
|
||||
|
||||
class VarSignalRow {
|
||||
timeline: Timeline;
|
||||
app: Application;
|
||||
owner: Array<VarSignalRow>;
|
||||
index_in_owner: number;
|
||||
rows_container: Container;
|
||||
row_height: number;
|
||||
row_gap: number;
|
||||
row_height_with_gap: number;
|
||||
renderer_resize_callback = () => this.draw();
|
||||
// -- elements --
|
||||
row_container = new Container();
|
||||
signal_blocks_container = new Container();
|
||||
|
||||
constructor(
|
||||
timeline: Timeline,
|
||||
app: Application,
|
||||
owner: Array<VarSignalRow>,
|
||||
rows_container: Container,
|
||||
row_height: number,
|
||||
row_gap: number,
|
||||
) {
|
||||
console.log("VarSignalRow timeline:", timeline);
|
||||
this.timeline = timeline;
|
||||
|
||||
this.app = app;
|
||||
|
||||
this.row_height = row_height;
|
||||
this.row_gap = row_gap;
|
||||
this.row_height_with_gap = row_height + row_gap;
|
||||
|
||||
this.index_in_owner = owner.length;
|
||||
this.owner = owner;
|
||||
this.owner.push(this);
|
||||
|
||||
this.rows_container = rows_container;
|
||||
this.create_element_tree();
|
||||
|
||||
this.draw();
|
||||
this.app.renderer.on("resize", this.renderer_resize_callback);
|
||||
}
|
||||
|
||||
create_element_tree() {
|
||||
// row_container
|
||||
this.row_container.y = this.index_in_owner * this.row_height_with_gap;
|
||||
this.rows_container.addChild(this.row_container);
|
||||
|
||||
// signal_block_container
|
||||
this.row_container.addChild(this.signal_blocks_container);
|
||||
}
|
||||
|
||||
draw() {
|
||||
if (this.timeline.length > 0) {
|
||||
const last_time = this.timeline[this.timeline.length - 1][0];
|
||||
// @TODO make formatter configurable
|
||||
const formatter: (signal_value: BitString) => string = signal_value => parseInt(signal_value, 2).toString(16);
|
||||
// @TODO optimize - one pass, partly in Rust, partly outside of `draw()`, etc.
|
||||
const timeline: Array<[number, string | undefined]> = this.timeline.map(([time, value]) => {
|
||||
const x = time / last_time * this.app.screen.width;
|
||||
const formatted_value = typeof value === 'string' ? formatter(value) : undefined;
|
||||
return [x, formatted_value]
|
||||
});
|
||||
// @TODO optimize - don't recreate all on every draw
|
||||
this.signal_blocks_container.removeChildren();
|
||||
timeline.forEach(([x, value], index) => {
|
||||
if (typeof value === 'string') {
|
||||
const block_width = timeline[index+1][0] - x;
|
||||
const block_height = this.row_height;
|
||||
|
||||
// signal_block
|
||||
const signal_block = new Container({x});
|
||||
this.signal_blocks_container.addChild(signal_block);
|
||||
|
||||
// background
|
||||
let background = new Graphics()
|
||||
.roundRect(0, 0, block_width, block_height, 15)
|
||||
.fill("SlateBlue");
|
||||
signal_block.addChild(background);
|
||||
|
||||
// label
|
||||
let style = new TextStyle({
|
||||
align: "center",
|
||||
fill: "White",
|
||||
fontSize: 16,
|
||||
fontFamily: 'system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',
|
||||
});
|
||||
// @TODO don't show when the label is wider/higher than the block
|
||||
let label = new Text({ text: value, style });
|
||||
label.x = (block_width - label.width) / 2;
|
||||
label.y = (block_height - label.height) / 2;
|
||||
signal_block.addChild(label);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
decrement_index() {
|
||||
this.index_in_owner--;
|
||||
this.row_container.y -= this.row_height_with_gap;
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.app.renderer.off("resize", this.renderer_resize_callback);
|
||||
this.owner.splice(this.index_in_owner, 1);
|
||||
this.rows_container.removeChildAt(this.index_in_owner);
|
||||
this.row_container.destroy(true);
|
||||
this.owner.slice(this.index_in_owner).forEach(row => row.decrement_index());
|
||||
}
|
||||
}
|
12
frontend/typescript/tauri_glue/README.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
Init
|
||||
- `npm install`
|
||||
|
||||
Watch & build (without typechecking)
|
||||
-`- `node_modules/.bin/esbuild pixi_canvas.ts --bundle --outfile=../bundles/tauri_glue.js --format=esm --watch``
|
||||
|
||||
Watch & typecheck (without building)
|
||||
- `node_modules/.bin/tsc tauri_glue.ts --watch -noEmit --preserveWatchOutput --target esnext --module esnext --moduleResolution bundler`
|
||||
|
||||
Created with commands:
|
||||
- `npm i -E @tauri-apps/api`
|
||||
- `npm i -D esbuild typescript`
|
449
frontend/typescript/tauri_glue/package-lock.json
generated
Normal file
|
@ -0,0 +1,449 @@
|
|||
{
|
||||
"name": "tauri_glue",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-beta.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.21.4",
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.4.tgz",
|
||||
"integrity": "sha512-Zrm+B33R4LWPLjDEVnEqt2+SLTATlru1q/xYKVn8oVTbiRBGmK2VIMoIYGJDGyftnGaC788IuzGFAlb7IQ0Y8A==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"aix"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.4.tgz",
|
||||
"integrity": "sha512-E7H/yTd8kGQfY4z9t3nRPk/hrhaCajfA3YSQSBrst8B+3uTcgsi8N+ZWYCaeIDsiVs6m65JPCaQN/DxBRclF3A==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.4.tgz",
|
||||
"integrity": "sha512-fYFnz+ObClJ3dNiITySBUx+oNalYUT18/AryMxfovLkYWbutXsct3Wz2ZWAcGGppp+RVVX5FiXeLYGi97umisA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-mDqmlge3hFbEPbCWxp4fM6hqq7aZfLEHZAKGP9viq9wMUBVQx202aDIfc3l+d2cKhUJM741VrCXEzRFhPDKH3Q==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-arm64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.4.tgz",
|
||||
"integrity": "sha512-72eaIrDZDSiWqpmCzVaBD58c8ea8cw/U0fq/PPOTqE3c53D0xVMRt2ooIABZ6/wj99Y+h4ksT/+I+srCDLU9TA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-uBsuwRMehGmw1JC7Vecu/upOjTsMhgahmDkWhGLWxIgUn2x/Y4tIwUZngsmVb6XyPSTXJYS4YiASKPcm9Zitag==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-arm64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.4.tgz",
|
||||
"integrity": "sha512-8JfuSC6YMSAEIZIWNL3GtdUT5NhUA/CMUCpZdDRolUXNAXEE/Vbpe6qlGLpfThtY5NwXq8Hi4nJy4YfPh+TwAg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-8d9y9eQhxv4ef7JmXny7591P/PYsDFc4+STaxC1GBv0tMyCdyWfXu2jBuqRsyhY8uL2HU8uPyscgE2KxCY9imQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.4.tgz",
|
||||
"integrity": "sha512-2rqFFefpYmpMs+FWjkzSgXg5vViocqpq5a1PSRgT0AvSgxoXmGF17qfGAzKedg6wAwyM7UltrKVo9kxaJLMF/g==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.4.tgz",
|
||||
"integrity": "sha512-/GLD2orjNU50v9PcxNpYZi+y8dJ7e7/LhQukN3S4jNDXCKkyyiyAz9zDw3siZ7Eh1tRcnCHAo/WcqKMzmi4eMQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ia32": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.4.tgz",
|
||||
"integrity": "sha512-pNftBl7m/tFG3t2m/tSjuYeWIffzwAZT9m08+9DPLizxVOsUl8DdFzn9HvJrTQwe3wvJnwTdl92AonY36w/25g==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-loong64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.4.tgz",
|
||||
"integrity": "sha512-cSD2gzCK5LuVX+hszzXQzlWya6c7hilO71L9h4KHwqI4qeqZ57bAtkgcC2YioXjsbfAv4lPn3qe3b00Zt+jIfQ==",
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-mips64el": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.4.tgz",
|
||||
"integrity": "sha512-qtzAd3BJh7UdbiXCrg6npWLYU0YpufsV9XlufKhMhYMJGJCdfX/G6+PNd0+v877X1JG5VmjBLUiFB0o8EUSicA==",
|
||||
"cpu": [
|
||||
"mips64el"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ppc64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.4.tgz",
|
||||
"integrity": "sha512-yB8AYzOTaL0D5+2a4xEy7OVvbcypvDR05MsB/VVPVA7nL4hc5w5Dyd/ddnayStDgJE59fAgNEOdLhBxjfx5+dg==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-riscv64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.4.tgz",
|
||||
"integrity": "sha512-Y5AgOuVzPjQdgU59ramLoqSSiXddu7F3F+LI5hYy/d1UHN7K5oLzYBDZe23QmQJ9PIVUXwOdKJ/jZahPdxzm9w==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-s390x": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.4.tgz",
|
||||
"integrity": "sha512-Iqc/l/FFwtt8FoTK9riYv9zQNms7B8u+vAI/rxKuN10HgQIXaPzKZc479lZ0x6+vKVQbu55GdpYpeNWzjOhgbA==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-Td9jv782UMAFsuLZINfUpoF5mZIbAj+jv1YVtE58rFtfvoKRiKSkRGQfHTgKamLVT/fO7203bHa3wU122V/Bdg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-Awn38oSXxsPMQxaV0Ipb7W/gxZtk5Tx3+W+rAPdZkyEhQ6968r9NvtkjhnhbEgWXYbgV+JEONJ6PcdBS+nlcpA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-IsUmQeCY0aU374R82fxIPu6vkOybWIMc3hVGZ3ChRwL9hA1TwY+tS0lgFWV5+F1+1ssuvvXt3HFqe8roCip8Hg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/sunos-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-hsKhgZ4teLUaDA6FG/QIu2q0rI6I36tZVfM4DBZv3BG0mkMIdEnMbhc4xwLvLJSS22uWmaVkFkqWgIS0gPIm+A==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"sunos"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-arm64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.4.tgz",
|
||||
"integrity": "sha512-UUfMgMoXPoA/bvGUNfUBFLCh0gt9dxZYIx9W4rfJr7+hKe5jxxHmfOK8YSH4qsHLLN4Ck8JZ+v7Q5fIm1huErg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-ia32": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.4.tgz",
|
||||
"integrity": "sha512-yIxbspZb5kGCAHWm8dexALQ9en1IYDfErzjSEq1KzXFniHv019VT3mNtTK7t8qdy4TwT6QYHI9sEZabONHg+aw==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-x64": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.4.tgz",
|
||||
"integrity": "sha512-sywLRD3UK/qRJt0oBwdpYLBibk7KiRfbswmWRDabuncQYSlf8aLEEUor/oP6KRz8KEG+HoiVLBhPRD5JWjS8Sg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/api": {
|
||||
"version": "2.0.0-beta.11",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.0.0-beta.11.tgz",
|
||||
"integrity": "sha512-wJRY+fBUm3KpqZDHMIz5HRv+1vlnvRJ/dFxiyY3NlINTx2qXqDou5qWYcP1CuZXsd39InWVPV3FAZvno/kGCkA==",
|
||||
"engines": {
|
||||
"node": ">= 18",
|
||||
"npm": ">= 6.6.0",
|
||||
"yarn": ">= 1.19.1"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/tauri"
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.4.tgz",
|
||||
"integrity": "sha512-sFMcNNrj+Q0ZDolrp5pDhH0nRPN9hLIM3fRPwgbLYJeSHHgnXSnbV3xYgSVuOeLWH9c73VwmEverVzupIv5xuA==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.21.4",
|
||||
"@esbuild/android-arm": "0.21.4",
|
||||
"@esbuild/android-arm64": "0.21.4",
|
||||
"@esbuild/android-x64": "0.21.4",
|
||||
"@esbuild/darwin-arm64": "0.21.4",
|
||||
"@esbuild/darwin-x64": "0.21.4",
|
||||
"@esbuild/freebsd-arm64": "0.21.4",
|
||||
"@esbuild/freebsd-x64": "0.21.4",
|
||||
"@esbuild/linux-arm": "0.21.4",
|
||||
"@esbuild/linux-arm64": "0.21.4",
|
||||
"@esbuild/linux-ia32": "0.21.4",
|
||||
"@esbuild/linux-loong64": "0.21.4",
|
||||
"@esbuild/linux-mips64el": "0.21.4",
|
||||
"@esbuild/linux-ppc64": "0.21.4",
|
||||
"@esbuild/linux-riscv64": "0.21.4",
|
||||
"@esbuild/linux-s390x": "0.21.4",
|
||||
"@esbuild/linux-x64": "0.21.4",
|
||||
"@esbuild/netbsd-x64": "0.21.4",
|
||||
"@esbuild/openbsd-x64": "0.21.4",
|
||||
"@esbuild/sunos-x64": "0.21.4",
|
||||
"@esbuild/win32-arm64": "0.21.4",
|
||||
"@esbuild/win32-ia32": "0.21.4",
|
||||
"@esbuild/win32-x64": "0.21.4"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.4.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
|
||||
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
9
frontend/typescript/tauri_glue/package.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "2.0.0-beta.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.21.4",
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
}
|
33
frontend/typescript/tauri_glue/tauri_glue.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
// @TODO use TS and Tauri bindgens to make this code properly typed
|
||||
|
||||
import { core } from '@tauri-apps/api'
|
||||
|
||||
const invoke = core.invoke;
|
||||
|
||||
type WellenHierarchy = unknown;
|
||||
type WellenTimeTable = unknown;
|
||||
type WellenSignal = unknown;
|
||||
|
||||
export async function show_window(): Promise<void> {
|
||||
return await invoke("show_window");
|
||||
}
|
||||
|
||||
export async function load_waveform(): Promise<void> {
|
||||
return await invoke("load_waveform");
|
||||
}
|
||||
|
||||
export async function get_hierarchy(): Promise<WellenHierarchy> {
|
||||
return await invoke("get_hierarchy");
|
||||
}
|
||||
|
||||
export async function get_time_table(): Promise<WellenTimeTable> {
|
||||
return await invoke("get_time_table");
|
||||
}
|
||||
|
||||
export async function load_and_get_signal(signal_ref_index: number): Promise<WellenSignal> {
|
||||
return await invoke("load_and_get_signal", { signal_ref_index });
|
||||
}
|
||||
|
||||
export async function unload_signal(signal_ref_index: number): Promise<void> {
|
||||
return await invoke("unload_signal", { signal_ref_index });
|
||||
}
|
0
public/.gitkeep
Normal file
1996
public/js/pixi_v8.1.4/pixi.min.js
vendored
Normal file
1
public/js/pixi_v8.1.4/pixi.min.js.map
Normal file
8
shared/Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "shared"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
authors.workspace = true
|
||||
readme.workspace = true
|
||||
publish.workspace = true
|
1
shared/src/lib.rs
Normal file
|
@ -0,0 +1 @@
|
|||
|
4
src-tauri/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
/gen/schemas
|
23
src-tauri/Cargo.toml
Normal file
|
@ -0,0 +1,23 @@
|
|||
[package]
|
||||
name = "fastwave"
|
||||
version = "0.1.0"
|
||||
authors = ["FastWave authors"]
|
||||
repository = "https://github.com/JoyOfHardware/FastWave2.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.70"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
name = "app_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "=2.0.0-beta.15", features = [] }
|
||||
|
||||
[dependencies]
|
||||
wellen.workspace = true
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "=2.0.0-beta.19", features = ["macos-private-api", "linux-ipc-protocol"] }
|
||||
tauri-plugin-window-state = "=2.0.0-beta.7"
|
3
src-tauri/build.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
17
src-tauri/capabilities/default.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "enables the default permissions",
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"path:default",
|
||||
"event:default",
|
||||
"window:default",
|
||||
"webview:default",
|
||||
"app:default",
|
||||
"resources:default",
|
||||
"image:default",
|
||||
"menu:default",
|
||||
"tray:default"
|
||||
]
|
||||
}
|
BIN
src-tauri/icons/128x128.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
src-tauri/icons/128x128@2x.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
src-tauri/icons/32x32.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
src-tauri/icons/Square107x107Logo.png
Normal file
After Width: | Height: | Size: 9 KiB |
BIN
src-tauri/icons/Square142x142Logo.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
src-tauri/icons/Square150x150Logo.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
src-tauri/icons/Square284x284Logo.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
src-tauri/icons/Square30x30Logo.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
src-tauri/icons/Square310x310Logo.png
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
src-tauri/icons/Square44x44Logo.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
src-tauri/icons/Square71x71Logo.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
src-tauri/icons/Square89x89Logo.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
src-tauri/icons/StoreLogo.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
src-tauri/icons/icon.icns
Normal file
BIN
src-tauri/icons/icon.ico
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
src-tauri/icons/icon.png
Normal file
After Width: | Height: | Size: 49 KiB |
80
src-tauri/src/lib.rs
Normal file
|
@ -0,0 +1,80 @@
|
|||
use std::sync::Mutex;
|
||||
use wellen::simple::Waveform;
|
||||
|
||||
mod wellen_helpers;
|
||||
|
||||
#[derive(Default)]
|
||||
struct Store {
|
||||
waveform: Mutex<Option<Waveform>>,
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
fn show_window(window: tauri::Window) {
|
||||
window.show().unwrap();
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
fn load_waveform(store: tauri::State<Store>) {
|
||||
let waveform =
|
||||
wellen_helpers::read_from_bytes(include_bytes!("../../test_files/simple.vcd").to_vec());
|
||||
let Ok(waveform) = waveform else {
|
||||
panic!("VCD file reading failed")
|
||||
};
|
||||
*store.waveform.lock().unwrap() = Some(waveform);
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
fn get_hierarchy(store: tauri::State<Store>) -> serde_json::Value {
|
||||
let waveform = store.waveform.lock().unwrap();
|
||||
let hierarchy = waveform.as_ref().unwrap().hierarchy();
|
||||
serde_json::to_value(hierarchy).unwrap()
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
fn get_time_table(store: tauri::State<Store>) -> serde_json::Value {
|
||||
let waveform = store.waveform.lock().unwrap();
|
||||
let time_table = waveform.as_ref().unwrap().time_table();
|
||||
serde_json::to_value(time_table).unwrap()
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
fn load_and_get_signal(signal_ref_index: usize, store: tauri::State<Store>) -> serde_json::Value {
|
||||
let signal_ref = wellen::SignalRef::from_index(signal_ref_index).unwrap();
|
||||
let mut waveform_lock = store.waveform.lock().unwrap();
|
||||
let waveform = waveform_lock.as_mut().unwrap();
|
||||
// @TODO maybe run it in a thread to not block the main one and then
|
||||
// make the command async or return the result through a Tauri channel
|
||||
waveform.load_signals_multi_threaded(&[signal_ref]);
|
||||
let signal = waveform.get_signal(signal_ref).unwrap();
|
||||
serde_json::to_value(signal).unwrap()
|
||||
}
|
||||
|
||||
#[tauri::command(rename_all = "snake_case")]
|
||||
fn unload_signal(signal_ref_index: usize, store: tauri::State<Store>) {
|
||||
let signal_ref = wellen::SignalRef::from_index(signal_ref_index).unwrap();
|
||||
let mut waveform_lock = store.waveform.lock().unwrap();
|
||||
let waveform = waveform_lock.as_mut().unwrap();
|
||||
waveform.unload_signals(&[signal_ref]);
|
||||
}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
// https://github.com/tauri-apps/tauri/issues/8462
|
||||
#[cfg(target_os = "linux")]
|
||||
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
|
||||
|
||||
tauri::Builder::default()
|
||||
.manage(Store::default())
|
||||
.plugin(tauri_plugin_window_state::Builder::default().build())
|
||||
// Npte: Add all handlers to `frontend/src/tauri_bridge.rs`
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
show_window,
|
||||
load_waveform,
|
||||
get_hierarchy,
|
||||
get_time_table,
|
||||
load_and_get_signal,
|
||||
unload_signal,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
6
src-tauri/src/main.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
app_lib::run();
|
||||
}
|
15
src-tauri/src/wellen_helpers.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
use wellen::{simple::Waveform, *};
|
||||
|
||||
pub fn read_from_bytes(bytes: Vec<u8>) -> Result<Waveform> {
|
||||
read_from_bytes_with_options(bytes, &LoadOptions::default())
|
||||
}
|
||||
|
||||
pub fn read_from_bytes_with_options(bytes: Vec<u8>, options: &LoadOptions) -> Result<Waveform> {
|
||||
let header = viewers::read_header_from_bytes(bytes, options)?;
|
||||
let body = viewers::read_body(header.body, &header.hierarchy, None)?;
|
||||
Ok(Waveform::new(
|
||||
header.hierarchy,
|
||||
body.source,
|
||||
body.time_table,
|
||||
))
|
||||
}
|
40
src-tauri/tauri.conf.json
Normal file
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"productName": "FastWave",
|
||||
"version": "0.1.0",
|
||||
"identifier": "com.fastwave",
|
||||
"build": {
|
||||
"frontendDist": "../frontend_dist",
|
||||
"devUrl": "http://localhost:8080",
|
||||
"beforeDevCommand": "makers mzoon start",
|
||||
"beforeBuildCommand": "makers mzoon build -r -f"
|
||||
},
|
||||
"app": {
|
||||
"macOSPrivateApi": true,
|
||||
"withGlobalTauri": true,
|
||||
"windows": [
|
||||
{
|
||||
"title": "FastWave",
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"resizable": true,
|
||||
"fullscreen": false,
|
||||
"center": true,
|
||||
"visible": false
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": null
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
]
|
||||
}
|
||||
}
|
28
test_files/simple.vcd
Normal file
|
@ -0,0 +1,28 @@
|
|||
$date
|
||||
Sat Feb 6 19:39:57 2016
|
||||
$end
|
||||
$version
|
||||
Icarus Verilog
|
||||
$end
|
||||
$timescale
|
||||
1s
|
||||
$end
|
||||
$scope module simple_tb $end
|
||||
$scope module s $end
|
||||
$var wire 4 ! A [3:0] $end
|
||||
$var wire 4 " B [3:0] $end
|
||||
$upscope $end
|
||||
$upscope $end
|
||||
$enddefinitions $end
|
||||
#0
|
||||
$dumpvars
|
||||
b11 "
|
||||
b1010 !
|
||||
$end
|
||||
#50
|
||||
b101 "
|
||||
b1100 !
|
||||
#150
|
||||
b0 "
|
||||
b0 !
|
||||
#250
|