Compare commits
119 commits
milller_co
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6b6af9e826 | ||
|
b97f105408 | ||
|
e4ac219bf9 | ||
|
fbe0a4f554 | ||
|
4fd4b6eb17 | ||
|
e08c673e86 | ||
|
f992a24719 | ||
|
24710414bd | ||
![]() |
4c00a633af | ||
![]() |
6500531270 | ||
![]() |
fdaacaa6f3 | ||
![]() |
ac484fdea8 | ||
![]() |
01a9501f86 | ||
![]() |
1cdb558823 | ||
![]() |
f32b6dc29f | ||
![]() |
d126b88686 | ||
![]() |
04917b5b02 | ||
![]() |
97fbd0d778 | ||
![]() |
f05c489d62 | ||
![]() |
356a59fa22 | ||
![]() |
ae74973b13 | ||
![]() |
bdb37a7357 | ||
![]() |
d7874e728b | ||
![]() |
1d20d3ac56 | ||
![]() |
a99915c8c3 | ||
![]() |
c1b0eb33bf | ||
![]() |
d291e84f61 | ||
![]() |
ad68d2c282 | ||
![]() |
cc6dc79a39 | ||
![]() |
d28dee3d69 | ||
![]() |
9bca370872 | ||
![]() |
39887b3396 | ||
![]() |
a8d2c19ad6 | ||
![]() |
c74ac82b1c | ||
![]() |
f355000abb | ||
![]() |
4f0f129021 | ||
![]() |
617082f68d | ||
![]() |
d33b92e9b7 | ||
![]() |
3aa48b1b78 | ||
![]() |
d1bcb4f9b4 | ||
![]() |
bc0377c499 | ||
![]() |
bd57939ef3 | ||
![]() |
acc1bf8ca3 | ||
![]() |
2962102962 | ||
![]() |
ceaa265c72 | ||
![]() |
6cfcdc6d0b | ||
![]() |
a60f4f9ec4 | ||
![]() |
7015cc9ce6 | ||
![]() |
55f1b42ab0 | ||
![]() |
b32b6e4f87 | ||
![]() |
87e650b3a8 | ||
![]() |
b2055ff22d | ||
![]() |
deef698f8d | ||
![]() |
95450ce52a | ||
![]() |
e01752ecec | ||
![]() |
f0e9a8ca94 | ||
![]() |
3778469de9 | ||
![]() |
ae4c76ed41 | ||
![]() |
2fbb9377f6 | ||
![]() |
714fc0cd00 | ||
![]() |
34a525c38c | ||
![]() |
e10063ac74 | ||
![]() |
e7aa41ce1f | ||
![]() |
54b1d0799e | ||
![]() |
220e6d19bd | ||
![]() |
4a385dbc64 | ||
![]() |
fb64c8b3d1 | ||
![]() |
96a6a68ceb | ||
![]() |
5184eae4f6 | ||
![]() |
4545656c31 | ||
![]() |
fc0dd43464 | ||
![]() |
0cd6dce47c | ||
![]() |
d078f3a470 | ||
![]() |
e59d10d23a | ||
![]() |
5c778b4350 | ||
![]() |
50238c1577 | ||
![]() |
4807b1bde5 | ||
![]() |
a299ae1082 | ||
![]() |
a58ea4fba5 | ||
![]() |
257b83b582 | ||
![]() |
e934ac031d | ||
![]() |
60d4231575 | ||
![]() |
7107f77c82 | ||
![]() |
48dad951a5 | ||
![]() |
1881d62c56 | ||
![]() |
d654714c0d | ||
![]() |
d0188c0ad7 | ||
![]() |
a6da2887c9 | ||
![]() |
fbdf8090a1 | ||
![]() |
3820a64789 | ||
![]() |
4168c645ec | ||
![]() |
bc023d38b8 | ||
![]() |
4906634ffb | ||
![]() |
c2f49901f6 | ||
![]() |
64cc46d4ac | ||
![]() |
c0872b0eba | ||
![]() |
ef74c4d115 | ||
![]() |
3f61f9f3fe | ||
![]() |
d8c1b0abac | ||
![]() |
6e85b7fa35 | ||
![]() |
c0de520811 | ||
![]() |
cbbe157f73 | ||
![]() |
ffbf9a853e | ||
![]() |
302ee56795 | ||
![]() |
e3e3820cc5 | ||
![]() |
ce36cd914f | ||
![]() |
6cdccb72b2 | ||
![]() |
84700cf61b | ||
![]() |
be5d33e5c1 | ||
![]() |
e034a2bb14 | ||
![]() |
ea38f61058 | ||
![]() |
645e03ea86 | ||
![]() |
bb852ceb24 | ||
![]() |
1b9bb6ae9e | ||
![]() |
7da6d26d78 | ||
![]() |
0e91fc2d04 | ||
![]() |
53effc0b30 | ||
![]() |
cdd76109c8 | ||
![]() |
f8e07d213d |
6
.cargo/config.toml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[build]
|
||||||
|
# `target` to to prevent rebuilding from scratch on each change
|
||||||
|
[target.wasm32-unknown-unknown]
|
||||||
|
# https://docs.rs/web-sys/latest/web_sys/struct.Window.html#method.show_open_file_picker
|
||||||
|
# https://github.com/rustwasm/wasm-bindgen/issues/2339#issuecomment-1000651386
|
||||||
|
rustflags = ["--cfg=web_sys_unstable_apis"]
|
1
.gitignore
vendored
|
@ -7,3 +7,4 @@ frontend_dist/_api
|
||||||
frontend_dist/index.html
|
frontend_dist/index.html
|
||||||
mzoon
|
mzoon
|
||||||
tauri
|
tauri
|
||||||
|
!.vscode
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
/*
|
/*
|
||||||
!/src-tauri
|
!/src-tauri
|
||||||
|
!/shared
|
||||||
|
|
12
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"rust-analyzer.cargo.cfgs": {
|
||||||
|
"FASTWAVE_PLATFORM": "TAURI",
|
||||||
|
// "FASTWAVE_PLATFORM": "BROWSER",
|
||||||
|
},
|
||||||
|
// https://github.com/rustwasm/wasm-bindgen/issues/2339#issuecomment-2147636233
|
||||||
|
"rust-analyzer.cargo.extraEnv": {
|
||||||
|
"RUSTFLAGS": "--cfg=web_sys_unstable_apis"
|
||||||
|
},
|
||||||
|
// to prevent rebuilding from scratch on each change
|
||||||
|
"rust-analyzer.cargo.target": "wasm32-unknown-unknown"
|
||||||
|
}
|
3031
Cargo.lock
generated
|
@ -3,7 +3,9 @@ members = [
|
||||||
"frontend",
|
"frontend",
|
||||||
"backend",
|
"backend",
|
||||||
"shared",
|
"shared",
|
||||||
"src-tauri",
|
"src-tauri",
|
||||||
|
"test_files/components/rust_decoder",
|
||||||
|
"test_files/components/rust_diagram_connector",
|
||||||
]
|
]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
|
@ -21,5 +23,7 @@ publish = false
|
||||||
wellen = { git = "https://github.com/MartinKavik/wellen", features = ["serde1"], branch = "new_pub_types" }
|
wellen = { git = "https://github.com/MartinKavik/wellen", features = ["serde1"], branch = "new_pub_types" }
|
||||||
# moon = { path = "../../crates/moon" }
|
# moon = { path = "../../crates/moon" }
|
||||||
# zoon = { path = "../../crates/zoon" }
|
# zoon = { path = "../../crates/zoon" }
|
||||||
|
# moonlight = { path = "../../crates/zoon" }
|
||||||
zoon = { git = "https://github.com/MoonZoon/MoonZoon", rev = "fc73b0d90bf39be72e70fdcab4f319ea5b8e6cfc" }
|
zoon = { git = "https://github.com/MoonZoon/MoonZoon", rev = "fc73b0d90bf39be72e70fdcab4f319ea5b8e6cfc" }
|
||||||
moon = { git = "https://github.com/MoonZoon/MoonZoon", rev = "fc73b0d90bf39be72e70fdcab4f319ea5b8e6cfc" }
|
moon = { git = "https://github.com/MoonZoon/MoonZoon", rev = "fc73b0d90bf39be72e70fdcab4f319ea5b8e6cfc" }
|
||||||
|
moonlight = { git = "https://github.com/MoonZoon/MoonZoon", rev = "fc73b0d90bf39be72e70fdcab4f319ea5b8e6cfc" }
|
||||||
|
|
674
LICENSE
Normal file
|
@ -0,0 +1,674 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
FastWave - Cross-Platform Wave Viewer
|
||||||
|
Copyright (C) 2024 Joy of Hardware
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
FastWave Copyright (C) 2024 Joy of Hardware
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
149
Makefile.toml
|
@ -18,6 +18,7 @@ dependencies = [
|
||||||
"install_mzoon",
|
"install_mzoon",
|
||||||
"init_pixi_canvas",
|
"init_pixi_canvas",
|
||||||
"init_tauri_glue",
|
"init_tauri_glue",
|
||||||
|
"init_excalidraw_canvas",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tasks.start]
|
[tasks.start]
|
||||||
|
@ -27,12 +28,37 @@ run_task = { fork = true, parallel = true, name = [
|
||||||
"tauri_dev_with_cleanup",
|
"tauri_dev_with_cleanup",
|
||||||
"watch_pixi_canvas",
|
"watch_pixi_canvas",
|
||||||
"watch_tauri_glue",
|
"watch_tauri_glue",
|
||||||
|
"watch_excalidraw_canvas",
|
||||||
|
]}
|
||||||
|
|
||||||
|
[tasks.start_browser]
|
||||||
|
description = "Run without Tauri in the browser & watch Typescript and Rust in the debug mode"
|
||||||
|
dependencies = ["store_current_process_id"]
|
||||||
|
run_task = { fork = true, parallel = true, name = [
|
||||||
|
"mzoon_start_with_cleanup",
|
||||||
|
"watch_pixi_canvas",
|
||||||
|
"watch_tauri_glue",
|
||||||
|
"watch_excalidraw_canvas",
|
||||||
|
]}
|
||||||
|
|
||||||
|
[tasks.start_browser_release]
|
||||||
|
description = "Run without Tauri in the browser & watch Typescript and Rust in the release mode"
|
||||||
|
dependencies = ["store_current_process_id"]
|
||||||
|
run_task = { fork = true, parallel = true, name = [
|
||||||
|
"mzoon_start_release_with_cleanup",
|
||||||
|
"watch_pixi_canvas",
|
||||||
|
"watch_tauri_glue",
|
||||||
|
"watch_excalidraw_canvas",
|
||||||
]}
|
]}
|
||||||
|
|
||||||
[tasks.bundle]
|
[tasks.bundle]
|
||||||
description = "Compile in the release mode and create installation packages"
|
description = "Compile in the release mode and create installation packages"
|
||||||
dependencies = ["tauri_build", "show_release_paths"]
|
dependencies = ["tauri_build", "show_release_paths"]
|
||||||
|
|
||||||
|
# @TODO Write task `bundle_browser` once we know whether we need only the frontend
|
||||||
|
# or also the backend side (Moon server).
|
||||||
|
# (Don't forget to add the task to the main README.md)
|
||||||
|
|
||||||
# @TODO: Format also Typescript and CSS
|
# @TODO: Format also Typescript and CSS
|
||||||
[tasks.format]
|
[tasks.format]
|
||||||
description = "Format code"
|
description = "Format code"
|
||||||
|
@ -46,10 +72,15 @@ description = "Run locally installed tauri"
|
||||||
command = "tauri/bin/cargo-tauri"
|
command = "tauri/bin/cargo-tauri"
|
||||||
args = ["${@}"]
|
args = ["${@}"]
|
||||||
|
|
||||||
|
[tasks.mzoon_for_tauri]
|
||||||
|
description = "Run locally installed mzoon with env var FASTWAVE_PLATFORM=TAURI"
|
||||||
|
extend = "mzoon_without_env_var_fastwave_platform"
|
||||||
|
env = { FASTWAVE_PLATFORM = "TAURI" }
|
||||||
|
|
||||||
[tasks.mzoon]
|
[tasks.mzoon]
|
||||||
description = "Run locally installed mzoon"
|
description = "Run locally installed mzoon with env var FASTWAVE_PLATFORM=BROWSER"
|
||||||
command = "mzoon/bin/mzoon"
|
extend = "mzoon_without_env_var_fastwave_platform"
|
||||||
args = ["${@}"]
|
env = { FASTWAVE_PLATFORM = "BROWSER" }
|
||||||
|
|
||||||
# [tasks.mzoon]
|
# [tasks.mzoon]
|
||||||
# description = "Run mzoon from a cloned MoonZoon repo"
|
# description = "Run mzoon from a cloned MoonZoon repo"
|
||||||
|
@ -58,6 +89,11 @@ args = ["${@}"]
|
||||||
|
|
||||||
###### HELPER TASKS ######
|
###### HELPER TASKS ######
|
||||||
|
|
||||||
|
[tasks.mzoon_without_env_var_fastwave_platform]
|
||||||
|
description = "Run locally installed mzoo"
|
||||||
|
command = "mzoon/bin/mzoon"
|
||||||
|
args = ["${@}"]
|
||||||
|
|
||||||
[tasks.store_current_process_id]
|
[tasks.store_current_process_id]
|
||||||
description = ""
|
description = ""
|
||||||
script_runner = "@duckscript"
|
script_runner = "@duckscript"
|
||||||
|
@ -72,11 +108,29 @@ description = "Run `tauri dev`"
|
||||||
extend = "tauri"
|
extend = "tauri"
|
||||||
args = ["dev"]
|
args = ["dev"]
|
||||||
|
|
||||||
|
[tasks.mzoon_start]
|
||||||
|
description = "Run `mzoon start`"
|
||||||
|
extend = "mzoon"
|
||||||
|
args = ["start"]
|
||||||
|
|
||||||
|
[tasks.mzoon_start_release]
|
||||||
|
description = "Run `mzoon start --release`"
|
||||||
|
extend = "mzoon"
|
||||||
|
args = ["start", "--release"]
|
||||||
|
|
||||||
[tasks.tauri_dev_with_cleanup]
|
[tasks.tauri_dev_with_cleanup]
|
||||||
description = "Run forked `tauri dev` with cleanup"
|
description = "Run forked `tauri dev` with cleanup"
|
||||||
run_task = { fork = true, cleanup_task = "cleanup_after_tauri_dev", name = ["tauri_dev"] }
|
run_task = { fork = true, cleanup_task = "kill_watchers", name = ["tauri_dev"] }
|
||||||
|
|
||||||
[tasks.cleanup_after_tauri_dev]
|
[tasks.mzoon_start_with_cleanup]
|
||||||
|
description = "Run forked `mzoon start` with cleanup"
|
||||||
|
run_task = { fork = true, cleanup_task = "kill_watchers", name = ["mzoon_start"] }
|
||||||
|
|
||||||
|
[tasks.mzoon_start_release_with_cleanup]
|
||||||
|
description = "Run forked `mzoon start` with cleanup"
|
||||||
|
run_task = { fork = true, cleanup_task = "kill_watchers", name = ["mzoon_start_release"] }
|
||||||
|
|
||||||
|
[tasks.kill_watchers]
|
||||||
description = "Kill the cargo-make/makers process and all its children / forked processes"
|
description = "Kill the cargo-make/makers process and all its children / forked processes"
|
||||||
script_runner = "@duckscript"
|
script_runner = "@duckscript"
|
||||||
script = '''
|
script = '''
|
||||||
|
@ -111,7 +165,7 @@ description = "Install Tauri CLI (tauri) locally"
|
||||||
command = "cargo"
|
command = "cargo"
|
||||||
args = [
|
args = [
|
||||||
"install",
|
"install",
|
||||||
"tauri-cli@=2.0.0-beta.17",
|
"tauri-cli@=2.1.0",
|
||||||
"--locked",
|
"--locked",
|
||||||
"--root",
|
"--root",
|
||||||
"tauri",
|
"tauri",
|
||||||
|
@ -154,7 +208,14 @@ run_task = { fork = true, parallel = true, name = [
|
||||||
description = "Compile `frontend/typescript/pixi_canvas` on change"
|
description = "Compile `frontend/typescript/pixi_canvas` on change"
|
||||||
cwd = "frontend/typescript/pixi_canvas"
|
cwd = "frontend/typescript/pixi_canvas"
|
||||||
command = "node_modules/.bin/esbuild"
|
command = "node_modules/.bin/esbuild"
|
||||||
args = ["pixi_canvas.ts", "--bundle", "--outfile=../bundles/pixi_canvas.js", "--format=esm", "--watch"]
|
args = [
|
||||||
|
"pixi_canvas.ts",
|
||||||
|
"--bundle",
|
||||||
|
"--outfile=../bundles/pixi_canvas.js",
|
||||||
|
"--format=esm",
|
||||||
|
"--minify",
|
||||||
|
"--watch"
|
||||||
|
]
|
||||||
|
|
||||||
[tasks.watch_build_pixi_canvas.windows]
|
[tasks.watch_build_pixi_canvas.windows]
|
||||||
command = "node_modules/.bin/esbuild.cmd"
|
command = "node_modules/.bin/esbuild.cmd"
|
||||||
|
@ -199,7 +260,14 @@ run_task = { fork = true, parallel = true, name = [
|
||||||
description = "Compile `frontend/typescript/tauri_glue` on change"
|
description = "Compile `frontend/typescript/tauri_glue` on change"
|
||||||
cwd = "frontend/typescript/tauri_glue"
|
cwd = "frontend/typescript/tauri_glue"
|
||||||
command = "node_modules/.bin/esbuild"
|
command = "node_modules/.bin/esbuild"
|
||||||
args = ["tauri_glue.ts", "--bundle", "--outfile=../bundles/tauri_glue.js", "--format=esm", "--watch"]
|
args = [
|
||||||
|
"tauri_glue.ts",
|
||||||
|
"--bundle",
|
||||||
|
"--outfile=../bundles/tauri_glue.js",
|
||||||
|
"--format=esm",
|
||||||
|
"--minify",
|
||||||
|
"--watch"
|
||||||
|
]
|
||||||
|
|
||||||
[tasks.watch_build_tauri_glue.windows]
|
[tasks.watch_build_tauri_glue.windows]
|
||||||
command = "node_modules/.bin/esbuild.cmd"
|
command = "node_modules/.bin/esbuild.cmd"
|
||||||
|
@ -222,3 +290,68 @@ args = [
|
||||||
[tasks.watch_typecheck_tauri_glue.windows]
|
[tasks.watch_typecheck_tauri_glue.windows]
|
||||||
command = "node_modules/.bin/tsc.cmd"
|
command = "node_modules/.bin/tsc.cmd"
|
||||||
|
|
||||||
|
## excalidraw_canvas ##
|
||||||
|
|
||||||
|
[tasks.init_excalidraw_canvas]
|
||||||
|
description = "Initialize `frontend/typescript/excalidraw_canvas`"
|
||||||
|
dependencies = [
|
||||||
|
"init_excalidraw_canvas_npm_install",
|
||||||
|
"init_excalidraw_canvas_en_json",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tasks.init_excalidraw_canvas_npm_install]
|
||||||
|
description = "Partly initialize `frontend/typescript/excalidraw_canvas`"
|
||||||
|
cwd = "frontend/typescript/excalidraw_canvas"
|
||||||
|
command = "npm"
|
||||||
|
args = ["install"]
|
||||||
|
|
||||||
|
[tasks.init_excalidraw_canvas_npm_install.windows]
|
||||||
|
command = "npm.cmd"
|
||||||
|
|
||||||
|
[tasks.init_excalidraw_canvas_en_json]
|
||||||
|
description = "Partly initialize `frontend/typescript/excalidraw_canvas`"
|
||||||
|
cwd = "frontend/typescript/excalidraw_canvas"
|
||||||
|
command = "cp"
|
||||||
|
args = ["-r", "locales", "node_modules/@excalidraw/excalidraw/types/"]
|
||||||
|
|
||||||
|
[tasks.watch_excalidraw_canvas]
|
||||||
|
description = "Build and typescheck Typescript on change"
|
||||||
|
run_task = { fork = true, parallel = true, name = [
|
||||||
|
"watch_build_excalidraw_canvas",
|
||||||
|
"watch_typecheck_excalidraw_canvas",
|
||||||
|
]}
|
||||||
|
|
||||||
|
[tasks.watch_build_excalidraw_canvas]
|
||||||
|
description = "Compile `frontend/typescript/excalidraw_canvas` on change"
|
||||||
|
cwd = "frontend/typescript/excalidraw_canvas"
|
||||||
|
command = "node_modules/.bin/esbuild"
|
||||||
|
args = [
|
||||||
|
"excalidraw_canvas.tsx",
|
||||||
|
"--bundle",
|
||||||
|
"--outfile=../bundles/excalidraw_canvas.js",
|
||||||
|
"--format=esm",
|
||||||
|
"--minify",
|
||||||
|
"--watch",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tasks.watch_build_excalidraw_canvas.windows]
|
||||||
|
command = "node_modules/.bin/esbuild.cmd"
|
||||||
|
|
||||||
|
[tasks.watch_typecheck_excalidraw_canvas]
|
||||||
|
description = "Typecheck `frontend/typescript/excalidraw_canvas` on change"
|
||||||
|
cwd = "frontend/typescript/excalidraw_canvas"
|
||||||
|
command = "node_modules/.bin/tsc"
|
||||||
|
args = [
|
||||||
|
"excalidraw_canvas.tsx",
|
||||||
|
"--jsx", "react",
|
||||||
|
"--watch",
|
||||||
|
"--noEmit",
|
||||||
|
"--preserveWatchOutput",
|
||||||
|
"--strict",
|
||||||
|
"--target", "esnext",
|
||||||
|
"--module", "esnext",
|
||||||
|
"--moduleResolution", "bundler",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tasks.watch_typecheck_excalidraw_canvas.windows]
|
||||||
|
command = "node_modules/.bin/tsc.cmd"
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
port = 8080
|
port = 8080
|
||||||
# port = 8443
|
# port = 8443
|
||||||
https = false
|
https = false
|
||||||
cache_busting = true
|
# @TODO how to import `pkg/frontend.js` with enabled cache busting?
|
||||||
|
# @TODO add a switch to enable Typescript generator in mzoon?
|
||||||
|
cache_busting = false
|
||||||
backend_log_level = "warn" # "error" / "warn" / "info" / "debug" / "trace"
|
backend_log_level = "warn" # "error" / "warn" / "info" / "debug" / "trace"
|
||||||
|
|
||||||
[redirect]
|
[redirect]
|
||||||
|
@ -15,10 +17,15 @@ origins = ["*"]
|
||||||
frontend = [
|
frontend = [
|
||||||
"public",
|
"public",
|
||||||
"frontend/Cargo.toml",
|
"frontend/Cargo.toml",
|
||||||
"frontend/typescript/bundles",
|
|
||||||
"frontend/src",
|
"frontend/src",
|
||||||
|
"frontend/typescript/bundles",
|
||||||
|
"shared/Cargo.toml",
|
||||||
|
"shared/src",
|
||||||
]
|
]
|
||||||
backend = [
|
backend = [
|
||||||
"backend/Cargo.toml",
|
"backend/Cargo.toml",
|
||||||
"backend/src",
|
"backend/src",
|
||||||
|
"backend/globals.js",
|
||||||
|
"backend/index.js",
|
||||||
|
"backend/style.css",
|
||||||
]
|
]
|
||||||
|
|
134
README.md
|
@ -3,18 +3,102 @@
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<p align="center">Default state - Dark (new design)</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img width="800" src="https://github.com/JoyOfHardware/FastWave2.0/assets/18517402/87b7cafb-ccdf-4968-8057-3a19632f227f" alt="fastwave_screenshot" />
|
<img width="800" src="docs/home_dark.png" alt="Fastwave - Default state - Dark (not implemented yet)" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">Loaded files - Dark (new design)</p>
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="docs/loaded_files_dark.png" alt="Fastwave - Loaded files - Dark (not implemented yet)" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">Default state - Light (new design)</p>
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="docs/home_light.png" alt="Fastwave - Default state - Light (not implemented yet)" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">Loaded files - Light (new design)</p>
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="docs/loaded_files_light.png" alt="Fastwave - Loaded files - Light (not implemented yet)" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
### Start:
|
<p align="center">Browser (Firefox)</p>
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="docs/screenshot_firefox.png" alt="Fastwave - Browser (Firefox)" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">Desktop, miller columns and tree</p>
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="docs/video_desktop.gif" alt="Fastwave - Desktop, miller columns and tree" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">Zoom, pan and basic number formats</p>
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="docs/video_zoom_formatting_simple.gif" alt="Fastwave - Zoom, pan and basic number formats" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">Zoom and all formats</p>
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="docs/video_zoom_formatting.gif" alt="Fastwave - Zoom and all formats" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">Javascript commands</p>
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="docs/video_javascript_commands.gif" alt="Fastwave - Javascript commands" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">Load and save selected variables</p>
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="docs/video_load_save_selected_vars.gif" alt="Fastwave - Load and save selected variables" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">Decoders (Plugins) Demo</p>
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="docs/video_decoders.gif" alt="Fastwave - Decoders demo" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">Decoder Interface</p>
|
||||||
|
<p align="center">
|
||||||
|
<img width="500" src="docs/screenshot_world_wit.png" alt="Fastwave - Decoder Interface" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">Diagrams - open, edit, JS API</p>
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="docs/video_diagrams.gif" alt="Fastwave - Diagrams" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">Diagram Connector Demo</p>
|
||||||
|
<p align="center">
|
||||||
|
<img width="800" src="docs/video_diagram_connector.gif" alt="Fastwave - Diagram Connector demo" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">Diagram Connector Code snippet</p>
|
||||||
|
<p align="center">
|
||||||
|
<img width="500" src="docs/screenshot_diagram_connector_rs.png" alt="Fastwave - Diagram Connector Code snippet" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Installation (desktop version):
|
||||||
|
|
||||||
|
Download and install from [Releases](https://github.com/JoyOfHardware/FastWave2.0/releases/latest)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Requirements to build from source:
|
||||||
|
|
||||||
1. Install [Rust](https://www.rust-lang.org/tools/install)
|
1. Install [Rust](https://www.rust-lang.org/tools/install)
|
||||||
2. Install [Node.js](https://nodejs.org/)
|
2. Install [Node.js](https://nodejs.org/)
|
||||||
3. `cargo install cargo-make`
|
3. `cargo install cargo-make`
|
||||||
4. `makers install`
|
4. `makers install`
|
||||||
5. `makers start`
|
|
||||||
|
___
|
||||||
|
|
||||||
|
### Start the desktop version:
|
||||||
|
|
||||||
|
1. `makers start`
|
||||||
|
|
||||||
Troubleshooting:
|
Troubleshooting:
|
||||||
- In case of Tauri compilation errors, install system dependencies: https://beta.tauri.app/guides/prerequisites/
|
- In case of Tauri compilation errors, install system dependencies: https://beta.tauri.app/guides/prerequisites/
|
||||||
|
@ -29,14 +113,50 @@ Troubleshooting:
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Production build of the desktop version:
|
||||||
|
|
||||||
|
1. `makers bundle`
|
||||||
|
2. Runnable executable is in `target/release`
|
||||||
|
3. Installable bundles specific for the platform are in `target/release/bundle`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Start in a browser:
|
||||||
|
|
||||||
|
1. `makers start_browser`
|
||||||
|
2. Ctrl + Click the server URL mentioned in the terminal log
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Start in a browser in the release mode:
|
||||||
|
|
||||||
|
1. `makers start_browser_release`
|
||||||
|
2. Ctrl + Click the server URL mentioned in the terminal log
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### Steps before pushing:
|
### Steps before pushing:
|
||||||
|
|
||||||
1. `makers format`
|
1. `makers format`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Production build:
|
### Rebuild Decoders:
|
||||||
|
|
||||||
1. `makers bundle`
|
See `test_files/components/[language]_decoder/README.md`
|
||||||
2. Runnable executable is in `target/release`
|
|
||||||
3. Installable bundles specific for the platform are in `target/release/bundle`
|
---
|
||||||
|
|
||||||
|
### Test files
|
||||||
|
|
||||||
|
See the folder `test_files`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Sponsors
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://NLnet.nl">
|
||||||
|
<img src="docs/nlnet_logo.png" width="269" alt="Logo NLnet">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
8
backend/favicon.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="/_api/public/favicon/apple-touch-icon.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="/_api/public/favicon/favicon-32x32.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="/_api/public/favicon/favicon-16x16.png">
|
||||||
|
<link rel="manifest" href="/_api/public/favicon/site.webmanifest">
|
||||||
|
<link rel="shortcut icon" href="/_api/public/favicon/favicon.ico">
|
||||||
|
<meta name="msapplication-TileColor" content="#00a300">
|
||||||
|
<meta name="msapplication-config" content="/_api/public/favicon/browserconfig.xml">
|
||||||
|
<meta name="theme-color" content="#ffffff">
|
7
backend/globals.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
// -- Excalidraw settings --
|
||||||
|
// @TODO replace with "true" once Preact is integrated into ExcalidrawCanvas
|
||||||
|
var process = { env: { IS_PREACT: "false" } };
|
||||||
|
// @TODO probably remove or update once Preact is integrated into ExcalidrawCanvas
|
||||||
|
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = { isDisabled: true };
|
||||||
|
window.EXCALIDRAW_ASSET_PATH = "/_api/public/excalidraw/";
|
||||||
|
// -- / --
|
3
backend/index.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import { FW } from '/_api/pkg/frontend.js';
|
||||||
|
window.FW = FW;
|
||||||
|
|
|
@ -1,11 +1,20 @@
|
||||||
use moon::*;
|
use moon::*;
|
||||||
|
|
||||||
async fn frontend() -> Frontend {
|
async fn frontend() -> Frontend {
|
||||||
Frontend::new().title("FastWave").append_to_head(concat!(
|
Frontend::new()
|
||||||
"<style>",
|
.title("FastWave")
|
||||||
include_str!("../style.css"),
|
.append_to_head(include_str!("../favicon.html")) // realfavicongenerator.net
|
||||||
"</style>"
|
.append_to_head(concat!("<style>", include_str!("../style.css"), "</style>"))
|
||||||
))
|
.append_to_head(concat!(
|
||||||
|
"<script>",
|
||||||
|
include_str!("../globals.js"),
|
||||||
|
"</script>"
|
||||||
|
))
|
||||||
|
.append_to_head(concat!(
|
||||||
|
"<script type=\"module\">",
|
||||||
|
include_str!("../index.js"),
|
||||||
|
"</script>"
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn up_msg_handler(_: UpMsgRequest<()>) {}
|
async fn up_msg_handler(_: UpMsgRequest<()>) {}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
html {
|
html {
|
||||||
background-color: DarkSlateBlue;
|
/* background-color: DarkSlateBlue; */
|
||||||
}
|
background-color: oklch(41.43% 0.125 262.26);
|
||||||
|
}
|
||||||
|
|
BIN
docs/fastwave_logo.png
Normal file
After Width: | Height: | Size: 546 KiB |
BIN
docs/fastwave_logo_square.png
Normal file
After Width: | Height: | Size: 378 KiB |
BIN
docs/home_dark.png
Normal file
After Width: | Height: | Size: 94 KiB |
BIN
docs/home_light.png
Normal file
After Width: | Height: | Size: 92 KiB |
BIN
docs/loaded_files_dark.png
Normal file
After Width: | Height: | Size: 168 KiB |
BIN
docs/loaded_files_light.png
Normal file
After Width: | Height: | Size: 166 KiB |
BIN
docs/nlnet_logo.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
docs/screenshot_diagram_connector_rs.png
Normal file
After Width: | Height: | Size: 170 KiB |
BIN
docs/screenshot_firefox.png
Normal file
After Width: | Height: | Size: 148 KiB |
BIN
docs/screenshot_world_wit.png
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
docs/video_decoders.gif
Normal file
After Width: | Height: | Size: 764 KiB |
BIN
docs/video_desktop.gif
Normal file
After Width: | Height: | Size: 434 KiB |
BIN
docs/video_diagram_connector.gif
Normal file
After Width: | Height: | Size: 1.9 MiB |
BIN
docs/video_diagrams.gif
Normal file
After Width: | Height: | Size: 764 KiB |
BIN
docs/video_javascript_commands.gif
Normal file
After Width: | Height: | Size: 593 KiB |
BIN
docs/video_konata.gif
Normal file
After Width: | Height: | Size: 1.8 MiB |
BIN
docs/video_load_save_selected_vars.gif
Normal file
After Width: | Height: | Size: 1.5 MiB |
BIN
docs/video_zoom_formatting.gif
Normal file
After Width: | Height: | Size: 612 KiB |
BIN
docs/video_zoom_formatting_simple.gif
Normal file
After Width: | Height: | Size: 170 KiB |
|
@ -10,7 +10,13 @@ publish.workspace = true
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
wasm-bindgen-test = "0.3.19"
|
wasm-bindgen-test = "0.3.19"
|
||||||
|
|
||||||
|
[lints.rust]
|
||||||
|
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(FASTWAVE_PLATFORM)'] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
unicode-segmentation = "1.10"
|
||||||
zoon.workspace = true
|
zoon.workspace = true
|
||||||
wellen.workspace = true
|
wellen.workspace = true
|
||||||
|
shared = { path = "../shared", features = ["frontend"] }
|
||||||
|
web-sys = { version = "*", features = ["FileSystemFileHandle"] }
|
||||||
|
gloo-file = { version = "0.3.0", features = ["futures"] }
|
||||||
|
|
23
frontend/build.rs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
use std::env;
|
||||||
|
|
||||||
|
// https://doc.rust-lang.org/cargo/reference/build-scripts.html
|
||||||
|
|
||||||
|
macro_rules! instruction {
|
||||||
|
($($arg: tt)*) => {
|
||||||
|
println!($($arg)*)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://github.com/rust-lang/cargo/issues/985
|
||||||
|
// macro_rules! warning {
|
||||||
|
// ($($arg: tt)*) => {
|
||||||
|
// instruction!("cargo:warning={}", format!($($arg)*))
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let default_platform = "TAURI";
|
||||||
|
let platform = env::var("FASTWAVE_PLATFORM").unwrap_or_else(|_| default_platform.to_owned());
|
||||||
|
instruction!("cargo:rustc-cfg=FASTWAVE_PLATFORM=\"{platform}\"");
|
||||||
|
instruction!("cargo:rerun-if-env-changed=FASTWAVE_PLATFORM");
|
||||||
|
}
|
141
frontend/src/command_panel.rs
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
use crate::{script_bridge, theme::*};
|
||||||
|
use zoon::*;
|
||||||
|
|
||||||
|
pub struct CommandPanel {}
|
||||||
|
|
||||||
|
impl CommandPanel {
|
||||||
|
pub fn new() -> impl Element {
|
||||||
|
Self {}.root()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn root(&self) -> impl Element {
|
||||||
|
let command_result: Mutable<Option<Result<JsValue, JsValue>>> = <_>::default();
|
||||||
|
Row::new()
|
||||||
|
.s(Align::new().top())
|
||||||
|
.s(Gap::both(30))
|
||||||
|
.s(Width::fill())
|
||||||
|
.s(Padding::new().x(20).bottom(20))
|
||||||
|
.item(self.command_editor_panel(command_result.clone()))
|
||||||
|
.item(self.command_result_panel(command_result.read_only()))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn command_editor_panel(
|
||||||
|
&self,
|
||||||
|
command_result: Mutable<Option<Result<JsValue, JsValue>>>,
|
||||||
|
) -> impl Element {
|
||||||
|
Column::new()
|
||||||
|
.s(Align::new().top())
|
||||||
|
.s(Gap::new().y(10))
|
||||||
|
.s(Width::growable())
|
||||||
|
.item(
|
||||||
|
Row::new()
|
||||||
|
.s(Gap::new().x(15))
|
||||||
|
.s(Padding::new().x(5))
|
||||||
|
.item(El::new().child("Javascript commands"))
|
||||||
|
.item(El::new().s(Align::new().right()).child("Shift + Enter")),
|
||||||
|
)
|
||||||
|
.item(self.command_editor(command_result))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn command_editor(
|
||||||
|
&self,
|
||||||
|
command_result: Mutable<Option<Result<JsValue, JsValue>>>,
|
||||||
|
) -> impl Element {
|
||||||
|
let (script, script_signal) = Mutable::new_and_signal_cloned(String::new());
|
||||||
|
// @TODO perhaps replace with an element with syntax highlighter like https://github.com/WebCoder49/code-input later
|
||||||
|
TextArea::new()
|
||||||
|
.s(Background::new().color(COLOR_SLATE_BLUE))
|
||||||
|
.s(Padding::new().x(10).y(8))
|
||||||
|
.s(RoundedCorners::all(15))
|
||||||
|
.s(Height::default().min(50))
|
||||||
|
.s(Width::fill().min(300))
|
||||||
|
.s(Font::new()
|
||||||
|
.tracking(1)
|
||||||
|
.weight(FontWeight::Medium)
|
||||||
|
.color(COLOR_WHITE)
|
||||||
|
.family([FontFamily::new("Courier New"), FontFamily::Monospace]))
|
||||||
|
.s(Shadows::new([Shadow::new()
|
||||||
|
.inner()
|
||||||
|
.color(COLOR_DARK_SLATE_BLUE)
|
||||||
|
.blur(4)]))
|
||||||
|
// @TODO `spellcheck` and `resize` to MZ API? (together with autocomplete and others?)
|
||||||
|
.update_raw_el(|raw_el| {
|
||||||
|
raw_el
|
||||||
|
.attr("spellcheck", "false")
|
||||||
|
.style("resize", "vertical")
|
||||||
|
})
|
||||||
|
.placeholder(Placeholder::new("FW.say_hello()").s(Font::new().color(COLOR_LIGHT_BLUE)))
|
||||||
|
.label_hidden("command editor panel")
|
||||||
|
.text_signal(script_signal)
|
||||||
|
.on_change(clone!((script, command_result) move |text| {
|
||||||
|
script.set_neq(text);
|
||||||
|
command_result.set_neq(None);
|
||||||
|
}))
|
||||||
|
.on_key_down_event_with_options(EventOptions::new().preventable(), move |event| {
|
||||||
|
if event.key() == &Key::Enter {
|
||||||
|
let RawKeyboardEvent::KeyDown(raw_event) = event.raw_event.clone();
|
||||||
|
if raw_event.shift_key() {
|
||||||
|
// @TODO move `prevent_default` to MZ API (next to the `pass_to_parent` method?)
|
||||||
|
raw_event.prevent_default();
|
||||||
|
Task::start(clone!((script, command_result) async move {
|
||||||
|
let result = script_bridge::strict_eval(&script.lock_ref()).await;
|
||||||
|
command_result.set(Some(result));
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn command_result_panel(
|
||||||
|
&self,
|
||||||
|
command_result: ReadOnlyMutable<Option<Result<JsValue, JsValue>>>,
|
||||||
|
) -> impl Element {
|
||||||
|
Column::new()
|
||||||
|
.s(Gap::new().y(10))
|
||||||
|
.s(Align::new().top())
|
||||||
|
.s(Scrollbars::both())
|
||||||
|
.s(Padding::new().x(5))
|
||||||
|
.s(Width::growable().max(750))
|
||||||
|
.item(El::new().child("Command result"))
|
||||||
|
.item(self.command_result_el(command_result))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn command_result_el(
|
||||||
|
&self,
|
||||||
|
command_result: ReadOnlyMutable<Option<Result<JsValue, JsValue>>>,
|
||||||
|
) -> impl Element {
|
||||||
|
El::new()
|
||||||
|
.s(Font::new()
|
||||||
|
.tracking(1)
|
||||||
|
.weight(FontWeight::Medium)
|
||||||
|
.color(COLOR_WHITE)
|
||||||
|
.family([FontFamily::new("Courier New"), FontFamily::Monospace]))
|
||||||
|
.s(Scrollbars::both())
|
||||||
|
.s(Height::default().max(100))
|
||||||
|
.child_signal(command_result.signal_ref(|result| {
|
||||||
|
fn format_complex_js_value(js_value: &JsValue) -> String {
|
||||||
|
let value = format!("{js_value:?}");
|
||||||
|
let value = value.strip_prefix("JsValue(").unwrap_throw();
|
||||||
|
let value = value.strip_suffix(')').unwrap_throw();
|
||||||
|
value.to_owned()
|
||||||
|
}
|
||||||
|
match result {
|
||||||
|
Some(Ok(js_value)) => {
|
||||||
|
if let Some(string_value) = js_value.as_string() {
|
||||||
|
string_value
|
||||||
|
} else if let Some(number_value) = js_value.as_f64() {
|
||||||
|
number_value.to_string()
|
||||||
|
} else if let Some(bool_value) = js_value.as_bool() {
|
||||||
|
bool_value.to_string()
|
||||||
|
} else {
|
||||||
|
format_complex_js_value(js_value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Some(Err(js_value)) => {
|
||||||
|
format!("ERROR: {}", format_complex_js_value(js_value))
|
||||||
|
}
|
||||||
|
None => "-".to_owned(),
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,229 +1,416 @@
|
||||||
use crate::tauri_bridge;
|
use crate::{theme::*, Filename, Layout};
|
||||||
use crate::HierarchyAndTimeTable;
|
use std::cell::Cell;
|
||||||
use std::collections::VecDeque;
|
use std::mem;
|
||||||
|
use std::ops::Not;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
use std::sync::Arc;
|
||||||
use wellen::GetItem;
|
use wellen::GetItem;
|
||||||
use zoon::{println, *};
|
use zoon::*;
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
const MILLER_COLUMN_SCOPE_VAR_ROW_MIN_WIDTH: u32 = 480;
|
||||||
struct VarForUI<'a> {
|
const MILLER_COLUMN_MAX_HEIGHT: u32 = 500;
|
||||||
name: &'a str,
|
const TREE_MAX_WIDTH: u32 = 600;
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
struct VarForUI {
|
||||||
|
name: Rc<String>,
|
||||||
var_type: wellen::VarType,
|
var_type: wellen::VarType,
|
||||||
var_direction: wellen::VarDirection,
|
var_direction: wellen::VarDirection,
|
||||||
var_ref: wellen::VarRef,
|
var_ref: wellen::VarRef,
|
||||||
signal_type: wellen::SignalType,
|
signal_type: wellen::SignalType,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone)]
|
||||||
struct ScopeForUI<'a> {
|
struct ScopeForUI {
|
||||||
level: u32,
|
level: usize,
|
||||||
name: &'a str,
|
name: Rc<String>,
|
||||||
scope_ref: wellen::ScopeRef,
|
scope_ref: wellen::ScopeRef,
|
||||||
|
has_children: bool,
|
||||||
|
expanded: Mutable<bool>,
|
||||||
|
parent_expanded: Option<ReadOnlyMutable<bool>>,
|
||||||
|
selected_scope_in_level: Mutable<Option<wellen::ScopeRef>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct ControlsPanel {
|
pub struct ControlsPanel {
|
||||||
selected_scope_ref: Mutable<Option<wellen::ScopeRef>>,
|
selected_scope_ref: Mutable<Option<wellen::ScopeRef>>,
|
||||||
hierarchy_and_time_table: Mutable<Option<HierarchyAndTimeTable>>,
|
hierarchy: Mutable<Option<Arc<wellen::Hierarchy>>>,
|
||||||
selected_var_refs: MutableVec<wellen::VarRef>,
|
selected_var_refs: MutableVec<wellen::VarRef>,
|
||||||
|
layout: Mutable<Layout>,
|
||||||
|
loaded_filename: Mutable<Option<Filename>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ControlsPanel {
|
impl ControlsPanel {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
hierarchy_and_time_table: Mutable<Option<HierarchyAndTimeTable>>,
|
hierarchy: Mutable<Option<Arc<wellen::Hierarchy>>>,
|
||||||
selected_var_refs: MutableVec<wellen::VarRef>,
|
selected_var_refs: MutableVec<wellen::VarRef>,
|
||||||
|
layout: Mutable<Layout>,
|
||||||
|
loaded_filename: Mutable<Option<Filename>>,
|
||||||
) -> impl Element {
|
) -> impl Element {
|
||||||
Self {
|
Self {
|
||||||
selected_scope_ref: <_>::default(),
|
selected_scope_ref: <_>::default(),
|
||||||
hierarchy_and_time_table,
|
hierarchy,
|
||||||
selected_var_refs,
|
selected_var_refs,
|
||||||
|
layout,
|
||||||
|
loaded_filename,
|
||||||
}
|
}
|
||||||
.root()
|
.root()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn triggers(&self) -> Vec<TaskHandle> {
|
fn triggers(&self) -> Vec<TaskHandle> {
|
||||||
vec![Task::start_droppable(
|
vec![Task::start_droppable(clone!((self => s) async move {
|
||||||
self.hierarchy_and_time_table
|
let was_some = Cell::new(false);
|
||||||
.signal_ref(Option::is_none)
|
s.hierarchy
|
||||||
.for_each_sync(clone!((self => s) move |_| {
|
.signal_ref(Option::is_some)
|
||||||
s.selected_scope_ref.set(None);
|
.dedupe()
|
||||||
s.selected_var_refs.lock_mut().clear();
|
.for_each_sync(clone!((s) move |is_some| {
|
||||||
})),
|
if is_some {
|
||||||
)]
|
return was_some.set(true);
|
||||||
|
}
|
||||||
|
if was_some.get() {
|
||||||
|
s.selected_scope_ref.set(None);
|
||||||
|
s.selected_var_refs.lock_mut().clear();
|
||||||
|
s.loaded_filename.set(None);
|
||||||
|
}
|
||||||
|
})).await
|
||||||
|
}))]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn root(&self) -> impl Element {
|
fn root(&self) -> impl Element {
|
||||||
let triggers = self.triggers();
|
let triggers = self.triggers();
|
||||||
|
let layout = self.layout.clone();
|
||||||
|
let layout_and_hierarchy_signal = map_ref! {
|
||||||
|
let layout = layout.signal(),
|
||||||
|
let hierarchy = self.hierarchy.signal_cloned() => {
|
||||||
|
(*layout, hierarchy.clone())
|
||||||
|
}
|
||||||
|
};
|
||||||
Column::new()
|
Column::new()
|
||||||
.after_remove(move |_| drop(triggers))
|
.after_remove(move |_| drop(triggers))
|
||||||
.s(Scrollbars::y_and_clip_x())
|
.s(Width::with_signal_self(
|
||||||
.s(Height::fill())
|
self.layout
|
||||||
|
.signal()
|
||||||
|
.map(|layout| matches!(layout, Layout::Columns))
|
||||||
|
.map_true(|| Width::fill()),
|
||||||
|
))
|
||||||
|
.s(Width::with_signal_self(layout.signal().map(
|
||||||
|
move |layout| match layout {
|
||||||
|
Layout::Tree => Width::growable().max(TREE_MAX_WIDTH),
|
||||||
|
Layout::Columns => Width::fill(),
|
||||||
|
},
|
||||||
|
)))
|
||||||
|
.s(Height::with_signal_self(layout.signal().map(
|
||||||
|
move |layout| match layout {
|
||||||
|
Layout::Tree => Height::fill(),
|
||||||
|
Layout::Columns => Height::fill().max(MILLER_COLUMN_MAX_HEIGHT),
|
||||||
|
},
|
||||||
|
)))
|
||||||
.s(Padding::all(20))
|
.s(Padding::all(20))
|
||||||
.s(Gap::new().y(40))
|
.s(Gap::new().y(40))
|
||||||
.s(Align::new().top())
|
.s(Align::new().top())
|
||||||
.item(self.load_button())
|
|
||||||
.item_signal(
|
.item_signal(
|
||||||
self.hierarchy_and_time_table
|
self.hierarchy
|
||||||
.signal_cloned()
|
.signal_cloned()
|
||||||
.map_some(clone!((self => s) move |(hierarchy, _)| s.scopes_panel(hierarchy))),
|
.map_some(clone!((self => s) move |hierarchy| s.scopes_panel(hierarchy))),
|
||||||
)
|
)
|
||||||
.item_signal(
|
.item_signal(layout_and_hierarchy_signal.map(
|
||||||
self.hierarchy_and_time_table
|
clone!((self => s) move |(layout, hierarchy)| {
|
||||||
.signal_cloned()
|
hierarchy.and_then(clone!((s) move |hierarchy| {
|
||||||
.map_some(clone!((self => s) move |(hierarchy, _)| s.vars_panel(hierarchy))),
|
matches!(layout, Layout::Tree).then(move || 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 {
|
fn scopes_panel(&self, hierarchy: Arc<wellen::Hierarchy>) -> impl Element {
|
||||||
Column::new()
|
Column::new()
|
||||||
|
.s(Height::fill())
|
||||||
|
.s(Scrollbars::y_and_clip_x())
|
||||||
.s(Gap::new().y(20))
|
.s(Gap::new().y(20))
|
||||||
.item(El::new().child("Scopes"))
|
.s(Width::fill())
|
||||||
|
.item_signal(
|
||||||
|
self.layout
|
||||||
|
.signal()
|
||||||
|
.map(|layout| matches!(layout, Layout::Tree))
|
||||||
|
.map_true(|| El::new().child("Scopes")),
|
||||||
|
)
|
||||||
.item(self.scopes_list(hierarchy))
|
.item(self.scopes_list(hierarchy))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scopes_list(&self, hierarchy: Rc<wellen::Hierarchy>) -> impl Element {
|
fn scopes_list(&self, hierarchy: Arc<wellen::Hierarchy>) -> impl Element {
|
||||||
|
let layout = self.layout.clone();
|
||||||
let mut scopes_for_ui = Vec::new();
|
let mut scopes_for_ui = Vec::new();
|
||||||
|
let mut max_level_index: usize = 0;
|
||||||
for scope_ref in hierarchy.scopes() {
|
for scope_ref in hierarchy.scopes() {
|
||||||
let mut scope_refs = VecDeque::new();
|
let mut scope_refs = Vec::new();
|
||||||
scope_refs.push_back((0, scope_ref));
|
scope_refs.push((0, scope_ref, None));
|
||||||
while let Some((level, scope_ref)) = scope_refs.pop_front() {
|
let mut selected_scope_in_levels: Vec<Mutable<Option<wellen::ScopeRef>>> =
|
||||||
|
vec![<_>::default()];
|
||||||
|
while let Some((level, scope_ref, parent_expanded)) = scope_refs.pop() {
|
||||||
let scope = hierarchy.get(scope_ref);
|
let scope = hierarchy.get(scope_ref);
|
||||||
|
let mut children = scope.scopes(&hierarchy).peekable();
|
||||||
|
let has_children = children.peek().is_some();
|
||||||
|
let expanded = Mutable::new(false);
|
||||||
|
if level > max_level_index {
|
||||||
|
max_level_index = level;
|
||||||
|
selected_scope_in_levels.push(<_>::default());
|
||||||
|
}
|
||||||
scopes_for_ui.push(ScopeForUI {
|
scopes_for_ui.push(ScopeForUI {
|
||||||
level,
|
level,
|
||||||
name: scope.name(&hierarchy),
|
name: Rc::new(scope.name(&hierarchy).to_owned()),
|
||||||
scope_ref,
|
scope_ref,
|
||||||
|
has_children,
|
||||||
|
expanded: expanded.clone(),
|
||||||
|
parent_expanded,
|
||||||
|
selected_scope_in_level: selected_scope_in_levels[level].clone(),
|
||||||
});
|
});
|
||||||
for scope_ref in scope.scopes(&hierarchy) {
|
for scope_ref in children {
|
||||||
scope_refs.push_back((level + 1, scope_ref));
|
scope_refs.push((level + 1, scope_ref, Some(expanded.read_only())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Column::new()
|
let scopes_for_ui = Rc::new(scopes_for_ui);
|
||||||
.s(Align::new().left())
|
let s = self.clone();
|
||||||
.s(Gap::new().y(10))
|
El::new()
|
||||||
.items(
|
.s(Height::fill())
|
||||||
scopes_for_ui
|
.s(Scrollbars::y_and_clip_x())
|
||||||
.into_iter()
|
.s(Width::fill())
|
||||||
.map(clone!((self => s) move |scope_for_ui| s.scope_button(scope_for_ui))),
|
.child_signal(layout.signal().map(move |layout| match layout {
|
||||||
)
|
Layout::Tree => {
|
||||||
|
Column::new()
|
||||||
|
.s(Align::new().left())
|
||||||
|
.s(Gap::new().y(10))
|
||||||
|
.s(Height::fill())
|
||||||
|
.s(Scrollbars::y_and_clip_x())
|
||||||
|
.s(Padding::new().right(15))
|
||||||
|
.items(
|
||||||
|
scopes_for_ui
|
||||||
|
.iter()
|
||||||
|
.map(clone!((s) move |scope_for_ui| s.scope_button_row(scope_for_ui.clone()))),
|
||||||
|
).unify()
|
||||||
|
}
|
||||||
|
Layout::Columns => {
|
||||||
|
let mut scopes_for_ui_in_levels: Vec<Vec<ScopeForUI>> = vec![Vec::new(); max_level_index + 1];
|
||||||
|
for scope_for_ui in scopes_for_ui.iter() {
|
||||||
|
scopes_for_ui_in_levels[scope_for_ui.level].push(scope_for_ui.clone());
|
||||||
|
}
|
||||||
|
let viewport_x = Mutable::new(0);
|
||||||
|
El::new()
|
||||||
|
.s(Height::fill())
|
||||||
|
.s(Scrollbars::x_and_clip_y())
|
||||||
|
.s(Padding::new().bottom(15))
|
||||||
|
.s(Width::fill())
|
||||||
|
.viewport_x_signal(viewport_x.signal())
|
||||||
|
.child(
|
||||||
|
Row::new()
|
||||||
|
.s(Height::fill())
|
||||||
|
// @TODO add `width: max-content` to MoonZoon's `Width`?
|
||||||
|
.update_raw_el(|raw_el| raw_el.style("width", "max-content"))
|
||||||
|
.on_viewport_size_change(move |_, _| viewport_x.set(i32::MAX))
|
||||||
|
.items(scopes_for_ui_in_levels.into_iter().map(|scopes_in_level| {
|
||||||
|
Column::new()
|
||||||
|
.s(Height::fill())
|
||||||
|
.s(Scrollbars::y_and_clip_x())
|
||||||
|
// @TODO `Width::default` add the class `exact_width` with `flex-shrink: 0;`
|
||||||
|
// We should make it more explicit / discoverable in MoonZoon
|
||||||
|
.s(Width::default())
|
||||||
|
.s(Gap::new().y(10))
|
||||||
|
.s(Padding::new().x(10))
|
||||||
|
.items(
|
||||||
|
scopes_in_level
|
||||||
|
.into_iter()
|
||||||
|
.map(clone!((s) move |scope_for_ui| s.scope_button_row(scope_for_ui)))
|
||||||
|
)
|
||||||
|
}))
|
||||||
|
.item(s.vars_panel(hierarchy.clone()))
|
||||||
|
).unify()
|
||||||
|
}
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scope_button(&self, scope_for_ui: ScopeForUI) -> impl Element {
|
fn scope_button_row(&self, scope_for_ui: ScopeForUI) -> impl Element {
|
||||||
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
let layout = self.layout.clone();
|
||||||
|
let (button_hovered, button_hovered_signal) = Mutable::new_and_signal(false);
|
||||||
let selected_scope_ref = self.selected_scope_ref.clone();
|
let selected_scope_ref = self.selected_scope_ref.clone();
|
||||||
let is_selected = selected_scope_ref
|
let is_selected = selected_scope_ref
|
||||||
.signal()
|
.signal()
|
||||||
.map(move |selected_scope_ref| selected_scope_ref == Some(scope_for_ui.scope_ref));
|
.map(move |selected_scope_ref| selected_scope_ref == Some(scope_for_ui.scope_ref));
|
||||||
let background_color = map_ref! {
|
let background_color = map_ref! {
|
||||||
let is_selected = is_selected,
|
let is_selected = is_selected,
|
||||||
let is_hovered = hovered_signal => match (*is_selected, *is_hovered) {
|
let is_hovered = button_hovered_signal => match (*is_selected, *is_hovered) {
|
||||||
(true, _) => color!("BlueViolet"),
|
(true, _) => COLOR_BLUE_VIOLET,
|
||||||
(false, true) => color!("MediumSlateBlue"),
|
(false, true) => COLOR_MEDIUM_SLATE_BLUE,
|
||||||
(false, false) => color!("SlateBlue"),
|
(false, false) => COLOR_SLATE_BLUE,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
El::new()
|
let task_collapse_on_parent_collapse = {
|
||||||
// @TODO REMOVE
|
let expanded = scope_for_ui.expanded.clone();
|
||||||
.after_insert(
|
scope_for_ui.parent_expanded.clone().map(|parent_expanded| {
|
||||||
clone!((selected_scope_ref, scope_for_ui.scope_ref => scope_ref) move |_| {
|
Task::start_droppable(parent_expanded.signal().for_each_sync(
|
||||||
if crate::SIMULATE_CLICKS {
|
move |parent_expanded| {
|
||||||
selected_scope_ref.set_neq(Some(scope_ref));
|
if not(parent_expanded) {
|
||||||
|
expanded.set_neq(false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
))
|
||||||
|
})
|
||||||
|
};
|
||||||
|
let task_expand_or_collapse_on_selected_scope_in_level_change = {
|
||||||
|
let expanded = scope_for_ui.expanded.clone();
|
||||||
|
let scope_ref = scope_for_ui.scope_ref;
|
||||||
|
let layout = layout.clone();
|
||||||
|
Task::start_droppable(scope_for_ui.selected_scope_in_level.signal().for_each_sync(
|
||||||
|
move |selected_scope_in_level| {
|
||||||
|
if matches!(layout.get(), Layout::Columns) {
|
||||||
|
if let Some(selected_scope) = selected_scope_in_level {
|
||||||
|
if selected_scope == scope_ref {
|
||||||
|
return expanded.set(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expanded.set(false);
|
||||||
}
|
}
|
||||||
}),
|
},
|
||||||
)
|
))
|
||||||
.s(Padding::new().left(scope_for_ui.level * 30))
|
};
|
||||||
|
let display = signal::option(
|
||||||
|
scope_for_ui
|
||||||
|
.parent_expanded
|
||||||
|
.clone()
|
||||||
|
.map(|parent_expanded| parent_expanded.signal().map_false(|| "none")),
|
||||||
|
)
|
||||||
|
.map(Option::flatten);
|
||||||
|
let level = scope_for_ui.level as u32;
|
||||||
|
El::new()
|
||||||
|
// @TODO Add `Display` Style to MoonZoon? Merge with `Visible` Style?
|
||||||
|
.update_raw_el(|raw_el| raw_el.style_signal("display", display))
|
||||||
|
.s(Padding::new().left_signal(layout.signal().map(move |layout| match layout {
|
||||||
|
Layout::Tree => level * 30,
|
||||||
|
Layout::Columns => 0,
|
||||||
|
})))
|
||||||
|
.after_remove(move |_| {
|
||||||
|
drop(task_collapse_on_parent_collapse);
|
||||||
|
drop(task_expand_or_collapse_on_selected_scope_in_level_change);
|
||||||
|
})
|
||||||
.child(
|
.child(
|
||||||
Button::new()
|
Row::new()
|
||||||
.s(Padding::new().x(15).y(5))
|
|
||||||
.s(Background::new().color_signal(background_color))
|
.s(Background::new().color_signal(background_color))
|
||||||
.s(RoundedCorners::all(15))
|
.s(RoundedCorners::all(15))
|
||||||
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
.s(Clip::both())
|
||||||
.on_press(move || selected_scope_ref.set_neq(Some(scope_for_ui.scope_ref)))
|
.s(Align::new().left())
|
||||||
.label(scope_for_ui.name),
|
.items_signal_vec(layout.signal().map(clone!((self => s, scope_for_ui) move |layout| {
|
||||||
|
let toggle = scope_for_ui.has_children.then(clone!((s, scope_for_ui) move || s.scope_toggle(scope_for_ui)));
|
||||||
|
let button = s.scope_button(scope_for_ui.clone(), button_hovered.clone());
|
||||||
|
match layout {
|
||||||
|
Layout::Tree => element_vec![toggle, button],
|
||||||
|
Layout::Columns => element_vec![button, toggle],
|
||||||
|
}
|
||||||
|
})).to_signal_vec())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn vars_panel(&self, hierarchy: Rc<wellen::Hierarchy>) -> impl Element {
|
fn scope_toggle(&self, scope_for_ui: ScopeForUI) -> impl Element {
|
||||||
|
let layout = self.layout.clone();
|
||||||
|
let expanded = scope_for_ui.expanded.clone();
|
||||||
|
let layout_and_expanded = map_ref! {
|
||||||
|
let layout = layout.signal(),
|
||||||
|
let expanded = expanded.signal() => (*layout, *expanded)
|
||||||
|
};
|
||||||
|
let selected_scope_ref: Mutable<Option<wellen::ScopeRef>> = self.selected_scope_ref.clone();
|
||||||
|
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||||
|
Button::new()
|
||||||
|
.s(Padding::new()
|
||||||
|
.left_signal(
|
||||||
|
self.layout
|
||||||
|
.signal()
|
||||||
|
.map(|layout| matches!(layout, Layout::Tree))
|
||||||
|
.map_true(|| 10),
|
||||||
|
)
|
||||||
|
.right_signal(
|
||||||
|
self.layout
|
||||||
|
.signal()
|
||||||
|
.map(|layout| matches!(layout, Layout::Columns))
|
||||||
|
.map_true(|| 10),
|
||||||
|
))
|
||||||
|
.s(Height::fill())
|
||||||
|
.s(Font::new().color_signal(hovered_signal.map_true(|| COLOR_LIGHT_BLUE)))
|
||||||
|
.label(
|
||||||
|
El::new()
|
||||||
|
.s(Transform::with_signal_self(layout_and_expanded.map(
|
||||||
|
|(layout, expanded)| match layout {
|
||||||
|
Layout::Tree => expanded.not().then(|| Transform::new().rotate(-90)),
|
||||||
|
Layout::Columns => {
|
||||||
|
Some(Transform::new().rotate(if expanded { -90 } else { 90 }))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)))
|
||||||
|
.child("▼"),
|
||||||
|
)
|
||||||
|
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||||
|
.on_press(move || match layout.get() {
|
||||||
|
Layout::Tree => {
|
||||||
|
if scope_for_ui.expanded.get() {
|
||||||
|
scope_for_ui.selected_scope_in_level.set(None);
|
||||||
|
} else {
|
||||||
|
scope_for_ui
|
||||||
|
.selected_scope_in_level
|
||||||
|
.set(Some(scope_for_ui.scope_ref));
|
||||||
|
}
|
||||||
|
scope_for_ui.expanded.update(not)
|
||||||
|
}
|
||||||
|
Layout::Columns => {
|
||||||
|
selected_scope_ref.set_neq(None);
|
||||||
|
if scope_for_ui.expanded.get() {
|
||||||
|
scope_for_ui.selected_scope_in_level.set(None);
|
||||||
|
} else {
|
||||||
|
scope_for_ui
|
||||||
|
.selected_scope_in_level
|
||||||
|
.set(Some(scope_for_ui.scope_ref));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn scope_button(
|
||||||
|
&self,
|
||||||
|
scope_for_ui: ScopeForUI,
|
||||||
|
button_hovered: Mutable<bool>,
|
||||||
|
) -> impl Element {
|
||||||
|
Button::new()
|
||||||
|
.s(Padding::new().x(15).y(5))
|
||||||
|
.on_hovered_change(move |is_hovered| button_hovered.set_neq(is_hovered))
|
||||||
|
.on_press(
|
||||||
|
clone!((self.selected_scope_ref => selected_scope_ref, scope_for_ui) move || {
|
||||||
|
selected_scope_ref.set_neq(Some(scope_for_ui.scope_ref));
|
||||||
|
scope_for_ui.selected_scope_in_level.set_neq(None);
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.label(scope_for_ui.name)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn vars_panel(&self, hierarchy: Arc<wellen::Hierarchy>) -> impl Element {
|
||||||
let selected_scope_ref = self.selected_scope_ref.clone();
|
let selected_scope_ref = self.selected_scope_ref.clone();
|
||||||
Column::new()
|
Column::new()
|
||||||
|
.s(Align::new().top())
|
||||||
.s(Gap::new().y(20))
|
.s(Gap::new().y(20))
|
||||||
.item(El::new().child("Variables"))
|
.s(Height::fill().min(150))
|
||||||
|
.s(Width::fill())
|
||||||
|
.s(Scrollbars::both())
|
||||||
|
.item_signal(
|
||||||
|
self.layout
|
||||||
|
.signal()
|
||||||
|
.map(|layout| matches!(layout, Layout::Tree))
|
||||||
|
.map_true(|| El::new().child("Variables")),
|
||||||
|
)
|
||||||
.item_signal(selected_scope_ref.signal().map_some(
|
.item_signal(selected_scope_ref.signal().map_some(
|
||||||
clone!((self => s) move |scope_ref| s.vars_list(scope_ref, hierarchy.clone())),
|
clone!((self => s) move |scope_ref| s.vars_list(scope_ref, hierarchy.clone())),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @TODO Group variables?
|
||||||
fn vars_list(
|
fn vars_list(
|
||||||
&self,
|
&self,
|
||||||
selected_scope_ref: wellen::ScopeRef,
|
selected_scope_ref: wellen::ScopeRef,
|
||||||
hierarchy: Rc<wellen::Hierarchy>,
|
hierarchy: Arc<wellen::Hierarchy>,
|
||||||
) -> impl Element {
|
) -> impl Element {
|
||||||
let vars_for_ui = hierarchy
|
let vars_for_ui = hierarchy
|
||||||
.get(selected_scope_ref)
|
.get(selected_scope_ref)
|
||||||
|
@ -231,27 +418,67 @@ impl ControlsPanel {
|
||||||
.map(|var_ref| {
|
.map(|var_ref| {
|
||||||
let var = hierarchy.get(var_ref);
|
let var = hierarchy.get(var_ref);
|
||||||
VarForUI {
|
VarForUI {
|
||||||
name: var.name(&hierarchy),
|
name: Rc::new(var.name(&hierarchy).to_owned()),
|
||||||
var_type: var.var_type(),
|
var_type: var.var_type(),
|
||||||
var_direction: var.direction(),
|
var_direction: var.direction(),
|
||||||
var_ref,
|
var_ref,
|
||||||
signal_type: var.signal_tpe(),
|
signal_type: var.signal_tpe(),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Lazy loading to not freeze the main thread
|
||||||
|
// @TODO replace with grouping and/or virtual scroll (https://dev.to/adamklein/build-your-own-virtual-scroll-part-i-11ib)
|
||||||
|
const CHUNK_SIZE: usize = 50;
|
||||||
|
let mut chunked_vars_for_ui: Vec<Vec<VarForUI>> = <_>::default();
|
||||||
|
let mut chunk = Vec::with_capacity(CHUNK_SIZE);
|
||||||
|
for (index, var_for_ui) in vars_for_ui.enumerate() {
|
||||||
|
chunk.push(var_for_ui);
|
||||||
|
if index % CHUNK_SIZE == 0 {
|
||||||
|
chunked_vars_for_ui.push(mem::take(&mut chunk));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if not(chunk.is_empty()) {
|
||||||
|
chunked_vars_for_ui.push(chunk);
|
||||||
|
}
|
||||||
|
let vars_for_ui_mutable_vec = MutableVec::<VarForUI>::new();
|
||||||
|
let append_vars_for_ui_task =
|
||||||
|
Task::start_droppable(clone!((vars_for_ui_mutable_vec) async move {
|
||||||
|
for chunk in chunked_vars_for_ui {
|
||||||
|
Task::next_macro_tick().await;
|
||||||
|
vars_for_ui_mutable_vec.lock_mut().extend(chunk);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
let layout = self.layout.clone();
|
||||||
Column::new()
|
Column::new()
|
||||||
|
.s(Width::with_signal_self(layout.signal().map(
|
||||||
|
move |layout| match layout {
|
||||||
|
Layout::Tree => Width::fill(),
|
||||||
|
Layout::Columns => Width::default().min(MILLER_COLUMN_SCOPE_VAR_ROW_MIN_WIDTH),
|
||||||
|
},
|
||||||
|
)))
|
||||||
.s(Align::new().left())
|
.s(Align::new().left())
|
||||||
.s(Gap::new().y(10))
|
.s(Gap::new().y(10))
|
||||||
.items(vars_for_ui.map(clone!((self => s) move |var_for_ui| s.var_row(var_for_ui))))
|
.s(Height::fill())
|
||||||
|
.s(Scrollbars::both())
|
||||||
|
.items_signal_vec(
|
||||||
|
vars_for_ui_mutable_vec
|
||||||
|
.signal_vec_cloned()
|
||||||
|
.map(clone!((self => s) move |var_for_ui| s.var_row(var_for_ui))),
|
||||||
|
)
|
||||||
|
.after_remove(move |_| drop(append_vars_for_ui_task))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn var_row(&self, var_for_ui: VarForUI) -> impl Element {
|
fn var_row(&self, var_for_ui: VarForUI) -> impl Element {
|
||||||
Row::new()
|
Row::new()
|
||||||
.s(Gap::new().x(10))
|
.s(Gap::new().x(10))
|
||||||
.item(self.var_button(var_for_ui))
|
.item(self.var_button(var_for_ui.clone()))
|
||||||
.item(self.var_tag_type(var_for_ui))
|
.item(self.var_tag_type(var_for_ui.clone()))
|
||||||
.item(self.var_tag_index(var_for_ui))
|
.item(self.var_tag_index(var_for_ui.clone()))
|
||||||
.item(self.var_tag_bit(var_for_ui))
|
.item(self.var_tag_bit(var_for_ui.clone()))
|
||||||
.item(self.var_tag_direction(var_for_ui))
|
.item(self.var_tag_direction(var_for_ui))
|
||||||
|
// Note: Padding or 0 height don't work for some reasons here
|
||||||
|
.item(El::new().s(Width::exact(10)).s(Height::exact(1)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn var_button(&self, var_for_ui: VarForUI) -> impl Element {
|
fn var_button(&self, var_for_ui: VarForUI) -> impl Element {
|
||||||
|
@ -259,17 +486,9 @@ impl ControlsPanel {
|
||||||
let selected_var_ref = self.selected_var_refs.clone();
|
let selected_var_ref = self.selected_var_refs.clone();
|
||||||
El::new().child(
|
El::new().child(
|
||||||
Button::new()
|
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(Padding::new().x(15).y(5))
|
||||||
.s(Background::new().color_signal(
|
.s(Background::new().color_signal(
|
||||||
hovered_signal.map_bool(|| color!("MediumSlateBlue"), || color!("SlateBlue")),
|
hovered_signal.map_bool(|| COLOR_MEDIUM_SLATE_BLUE, || COLOR_SLATE_BLUE),
|
||||||
))
|
))
|
||||||
.s(RoundedCorners::all(15))
|
.s(RoundedCorners::all(15))
|
||||||
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||||
|
|
40
frontend/src/diagram_panel.rs
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
use zoon::*;
|
||||||
|
|
||||||
|
mod excalidraw_canvas;
|
||||||
|
use excalidraw_canvas::ExcalidrawCanvas;
|
||||||
|
pub use excalidraw_canvas::ExcalidrawController;
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct DiagramPanel {
|
||||||
|
canvas_controller: Mutable<Mutable<Option<SendWrapper<ExcalidrawController>>>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DiagramPanel {
|
||||||
|
pub fn new(
|
||||||
|
canvas_controller: Mutable<Mutable<Option<SendWrapper<ExcalidrawController>>>>,
|
||||||
|
) -> impl Element {
|
||||||
|
Self { canvas_controller }.root()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn root(&self) -> impl Element {
|
||||||
|
Column::new()
|
||||||
|
.s(Padding::all(20))
|
||||||
|
.s(Scrollbars::y_and_clip_x())
|
||||||
|
.s(Width::fill())
|
||||||
|
.s(Height::fill())
|
||||||
|
.s(Gap::new().y(20))
|
||||||
|
.item(self.canvas())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn canvas(&self) -> impl Element {
|
||||||
|
let canvas_controller = self.canvas_controller.clone();
|
||||||
|
ExcalidrawCanvas::new()
|
||||||
|
.s(Align::new().top())
|
||||||
|
.s(Width::fill())
|
||||||
|
.s(Height::fill())
|
||||||
|
.task_with_controller(move |controller| {
|
||||||
|
canvas_controller.set(controller.clone());
|
||||||
|
async {}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
90
frontend/src/diagram_panel/excalidraw_canvas.rs
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
pub use js_bridge::ExcalidrawController;
|
||||||
|
use zoon::*;
|
||||||
|
|
||||||
|
pub struct ExcalidrawCanvas {
|
||||||
|
raw_el: RawHtmlEl<web_sys::HtmlElement>,
|
||||||
|
controller: Mutable<Option<SendWrapper<js_bridge::ExcalidrawController>>>,
|
||||||
|
task_with_controller: Mutable<Option<TaskHandle>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Element for ExcalidrawCanvas {}
|
||||||
|
|
||||||
|
impl RawElWrapper for ExcalidrawCanvas {
|
||||||
|
type RawEl = RawHtmlEl<web_sys::HtmlElement>;
|
||||||
|
fn raw_el_mut(&mut self) -> &mut Self::RawEl {
|
||||||
|
&mut self.raw_el
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Styleable<'_> for ExcalidrawCanvas {}
|
||||||
|
impl KeyboardEventAware for ExcalidrawCanvas {}
|
||||||
|
impl MouseEventAware for ExcalidrawCanvas {}
|
||||||
|
impl PointerEventAware for ExcalidrawCanvas {}
|
||||||
|
impl TouchEventAware for ExcalidrawCanvas {}
|
||||||
|
impl AddNearbyElement<'_> for ExcalidrawCanvas {}
|
||||||
|
impl HasIds for ExcalidrawCanvas {}
|
||||||
|
|
||||||
|
impl ExcalidrawCanvas {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let controller: Mutable<Option<SendWrapper<js_bridge::ExcalidrawController>>> =
|
||||||
|
Mutable::new(None);
|
||||||
|
let task_with_controller = Mutable::new(None);
|
||||||
|
Self {
|
||||||
|
controller: controller.clone(),
|
||||||
|
task_with_controller: task_with_controller.clone(),
|
||||||
|
raw_el: El::new()
|
||||||
|
.s(RoundedCorners::all(10))
|
||||||
|
.s(Clip::both())
|
||||||
|
.after_insert(clone!((controller) move |element| {
|
||||||
|
Task::start(async move {
|
||||||
|
let excalidraw_controller = SendWrapper::new(js_bridge::ExcalidrawController::new());
|
||||||
|
excalidraw_controller.init(&element).await;
|
||||||
|
controller.set(Some(excalidraw_controller));
|
||||||
|
});
|
||||||
|
}))
|
||||||
|
.after_remove(move |_| {
|
||||||
|
drop(task_with_controller);
|
||||||
|
})
|
||||||
|
.into_raw_el(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn task_with_controller<FUT: Future<Output = ()> + 'static>(
|
||||||
|
self,
|
||||||
|
f: impl FnOnce(Mutable<Option<SendWrapper<js_bridge::ExcalidrawController>>>) -> 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/excalidraw_canvas/excalidraw_canvas.tsx`
|
||||||
|
#[wasm_bindgen(module = "/typescript/bundles/excalidraw_canvas.js")]
|
||||||
|
extern "C" {
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub type ExcalidrawController;
|
||||||
|
|
||||||
|
#[wasm_bindgen(constructor)]
|
||||||
|
pub fn new() -> ExcalidrawController;
|
||||||
|
|
||||||
|
#[wasm_bindgen(method)]
|
||||||
|
pub async fn init(this: &ExcalidrawController, parent_element: &JsValue);
|
||||||
|
|
||||||
|
#[wasm_bindgen(method)]
|
||||||
|
pub fn draw_diagram_element(this: &ExcalidrawController, excalidraw_element: JsValue);
|
||||||
|
|
||||||
|
#[wasm_bindgen(method)]
|
||||||
|
pub fn listen_for_component_text_changes(
|
||||||
|
this: &ExcalidrawController,
|
||||||
|
component_id: &str,
|
||||||
|
on_change: &Closure<dyn Fn(String)>,
|
||||||
|
);
|
||||||
|
|
||||||
|
#[wasm_bindgen(method)]
|
||||||
|
pub fn set_component_text(this: &ExcalidrawController, component_id: &str, text: &str);
|
||||||
|
}
|
||||||
|
}
|
239
frontend/src/header_panel.rs
Normal file
|
@ -0,0 +1,239 @@
|
||||||
|
use crate::{platform, theme::*, Filename, Layout, Mode};
|
||||||
|
use std::sync::Arc;
|
||||||
|
use zoon::*;
|
||||||
|
use crate::term::TERM_OPEN;
|
||||||
|
|
||||||
|
pub struct HeaderPanel {
|
||||||
|
hierarchy: Mutable<Option<Arc<wellen::Hierarchy>>>,
|
||||||
|
layout: Mutable<Layout>,
|
||||||
|
mode: Mutable<Mode>,
|
||||||
|
loaded_filename: Mutable<Option<Filename>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HeaderPanel {
|
||||||
|
pub fn new(
|
||||||
|
hierarchy: Mutable<Option<Arc<wellen::Hierarchy>>>,
|
||||||
|
layout: Mutable<Layout>,
|
||||||
|
mode: Mutable<Mode>,
|
||||||
|
loaded_filename: Mutable<Option<Filename>>,
|
||||||
|
) -> impl Element {
|
||||||
|
Self {
|
||||||
|
hierarchy,
|
||||||
|
layout,
|
||||||
|
loaded_filename,
|
||||||
|
mode,
|
||||||
|
}
|
||||||
|
.root()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn root(&self) -> impl Element {
|
||||||
|
Row::new()
|
||||||
|
.s(Padding::new().x(20).y(15))
|
||||||
|
.s(Gap::both(40))
|
||||||
|
.item(
|
||||||
|
Row::new()
|
||||||
|
.s(Align::new().top())
|
||||||
|
.s(Padding::new().top(5))
|
||||||
|
.s(Gap::both(15))
|
||||||
|
.item(self.load_button())
|
||||||
|
.item(self.layout_switcher())
|
||||||
|
.item(self.mode_switcher())
|
||||||
|
.item(self.open_terminal())
|
||||||
|
.item(self.open_konata_file()),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(FASTWAVE_PLATFORM = "TAURI")]
|
||||||
|
fn load_button(&self) -> impl Element {
|
||||||
|
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||||
|
let hierarchy = self.hierarchy.clone();
|
||||||
|
let loaded_filename = self.loaded_filename.clone();
|
||||||
|
Button::new()
|
||||||
|
.s(Padding::new().x(20).y(10))
|
||||||
|
.s(Background::new().color_signal(
|
||||||
|
hovered_signal.map_bool(|| COLOR_MEDIUM_SLATE_BLUE, || COLOR_SLATE_BLUE),
|
||||||
|
))
|
||||||
|
.s(Align::new().left())
|
||||||
|
.s(RoundedCorners::all(15))
|
||||||
|
.label(El::new().s(Font::new().no_wrap()).child_signal(
|
||||||
|
loaded_filename.signal_cloned().map_option(
|
||||||
|
|filename| format!("Unload {filename}"),
|
||||||
|
|| format!("Load file.."),
|
||||||
|
),
|
||||||
|
))
|
||||||
|
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||||
|
.on_press(move || {
|
||||||
|
let mut hierarchy_lock = hierarchy.lock_mut();
|
||||||
|
if hierarchy_lock.is_some() {
|
||||||
|
*hierarchy_lock = None;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
drop(hierarchy_lock);
|
||||||
|
let hierarchy = hierarchy.clone();
|
||||||
|
let loaded_filename = loaded_filename.clone();
|
||||||
|
Task::start(async move {
|
||||||
|
if let Some(filename) = platform::pick_and_load_waveform(None).await {
|
||||||
|
loaded_filename.set_neq(Some(filename));
|
||||||
|
hierarchy.set(Some(Arc::new(platform::get_hierarchy().await)))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(FASTWAVE_PLATFORM = "BROWSER")]
|
||||||
|
fn load_button(&self) -> impl Element {
|
||||||
|
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||||
|
let hierarchy = self.hierarchy.clone();
|
||||||
|
let loaded_filename = self.loaded_filename.clone();
|
||||||
|
let file_input_id = "file_input_for_load_waveform_button";
|
||||||
|
Row::new()
|
||||||
|
.item(
|
||||||
|
Label::new()
|
||||||
|
.s(Padding::new().x(20).y(10))
|
||||||
|
.s(Background::new().color_signal(
|
||||||
|
hovered_signal.map_bool(|| COLOR_MEDIUM_SLATE_BLUE, || COLOR_SLATE_BLUE),
|
||||||
|
))
|
||||||
|
.s(Align::new().left())
|
||||||
|
.s(RoundedCorners::all(15))
|
||||||
|
.s(Cursor::new(CursorIcon::Pointer))
|
||||||
|
.label(El::new().s(Font::new().no_wrap()).child_signal(
|
||||||
|
loaded_filename.signal_cloned().map_option(
|
||||||
|
|filename| format!("Unload {filename}"),
|
||||||
|
|| format!("Load file.."),
|
||||||
|
),
|
||||||
|
))
|
||||||
|
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||||
|
.for_input(file_input_id)
|
||||||
|
.on_click_event_with_options(
|
||||||
|
EventOptions::new().preventable(),
|
||||||
|
clone!((hierarchy) move |event| {
|
||||||
|
let mut hierarchy_lock = hierarchy.lock_mut();
|
||||||
|
if hierarchy_lock.is_some() {
|
||||||
|
*hierarchy_lock = None;
|
||||||
|
if let RawMouseEvent::Click(raw_event) = event.raw_event {
|
||||||
|
// @TODO Move to MoonZoon as a new API
|
||||||
|
raw_event.prevent_default();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.item(
|
||||||
|
// @TODO https://github.com/MoonZoon/MoonZoon/issues/39
|
||||||
|
// + https://developer.mozilla.org/en-US/docs/Web/API/File_API/Using_files_from_web_applications#using_hidden_file_input_elements_using_the_click_method
|
||||||
|
TextInput::new().id(file_input_id).update_raw_el(|raw_el| {
|
||||||
|
let dom_element = raw_el.dom_element();
|
||||||
|
raw_el
|
||||||
|
.style("display", "none")
|
||||||
|
.attr("type", "file")
|
||||||
|
.event_handler(move |_: events::Input| {
|
||||||
|
let Some(file_list) =
|
||||||
|
dom_element.files().map(gloo_file::FileList::from)
|
||||||
|
else {
|
||||||
|
zoon::println!("file list is `None`");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let Some(file) = file_list.first().cloned() else {
|
||||||
|
zoon::println!("file list is empty");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let hierarchy = hierarchy.clone();
|
||||||
|
let loaded_filename = loaded_filename.clone();
|
||||||
|
Task::start(async move {
|
||||||
|
if let Some(filename) =
|
||||||
|
platform::pick_and_load_waveform(Some(file)).await
|
||||||
|
{
|
||||||
|
loaded_filename.set_neq(Some(filename));
|
||||||
|
hierarchy.set(Some(Arc::new(platform::get_hierarchy().await)))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn layout_switcher(&self) -> impl Element {
|
||||||
|
let layout = self.layout.clone();
|
||||||
|
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||||
|
Button::new()
|
||||||
|
.s(Padding::new().x(20).y(10))
|
||||||
|
.s(Background::new().color_signal(
|
||||||
|
hovered_signal.map_bool(|| COLOR_MEDIUM_SLATE_BLUE, || COLOR_SLATE_BLUE),
|
||||||
|
))
|
||||||
|
.s(RoundedCorners::all(15))
|
||||||
|
.label_signal(layout.signal().map(|layout| match layout {
|
||||||
|
Layout::Tree => "Columns",
|
||||||
|
Layout::Columns => "Tree",
|
||||||
|
}))
|
||||||
|
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||||
|
.on_press(move || {
|
||||||
|
layout.update(|layout| match layout {
|
||||||
|
Layout::Tree => Layout::Columns,
|
||||||
|
Layout::Columns => Layout::Tree,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mode_switcher(&self) -> impl Element {
|
||||||
|
let mode = self.mode.clone();
|
||||||
|
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||||
|
Button::new()
|
||||||
|
.s(Padding::new().x(20).y(10))
|
||||||
|
.s(Background::new().color_signal(
|
||||||
|
hovered_signal.map_bool(|| COLOR_MEDIUM_SLATE_BLUE, || COLOR_SLATE_BLUE),
|
||||||
|
))
|
||||||
|
.s(RoundedCorners::all(15))
|
||||||
|
.label_signal(mode.signal().map(|mode| match mode {
|
||||||
|
Mode::Waves => "Diagrams",
|
||||||
|
Mode::Diagrams => "Waves",
|
||||||
|
}))
|
||||||
|
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||||
|
.on_press(move || {
|
||||||
|
mode.update(|mode| match mode {
|
||||||
|
Mode::Waves => Mode::Diagrams,
|
||||||
|
Mode::Diagrams => Mode::Waves,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn open_konata_file(&self) -> impl Element {
|
||||||
|
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||||
|
Button::new()
|
||||||
|
.s(Padding::new().x(20).y(10))
|
||||||
|
.s(Background::new().color_signal(
|
||||||
|
hovered_signal.map_bool(|| COLOR_MEDIUM_SLATE_BLUE, || COLOR_SLATE_BLUE),
|
||||||
|
))
|
||||||
|
.s(Align::new().left())
|
||||||
|
.s(RoundedCorners::all(15))
|
||||||
|
.label(
|
||||||
|
El::new()
|
||||||
|
.s(Font::new().no_wrap())
|
||||||
|
.child("Open Konata file.."),
|
||||||
|
)
|
||||||
|
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||||
|
.on_press(move || Task::start(platform::open_konata_file()))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn open_terminal(&self) -> impl Element {
|
||||||
|
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||||
|
Button::new()
|
||||||
|
.s(Padding::new().x(20).y(10))
|
||||||
|
.s(Background::new().color_signal(
|
||||||
|
hovered_signal.map_bool(|| COLOR_MEDIUM_SLATE_BLUE, || COLOR_SLATE_BLUE),
|
||||||
|
))
|
||||||
|
.s(Align::new().left())
|
||||||
|
.s(RoundedCorners::all(15))
|
||||||
|
.label(
|
||||||
|
El::new()
|
||||||
|
.s(Font::new().no_wrap())
|
||||||
|
.child("Open Terminal"),
|
||||||
|
)
|
||||||
|
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||||
|
.on_press(move || {
|
||||||
|
let term_open = TERM_OPEN.get();
|
||||||
|
TERM_OPEN.set(!term_open);
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,40 +1,206 @@
|
||||||
use std::rc::Rc;
|
use shared::DiagramConnectorMessage;
|
||||||
|
use term::TERM_OPEN;
|
||||||
|
use std::{mem, sync::Arc};
|
||||||
use zoon::*;
|
use zoon::*;
|
||||||
|
|
||||||
mod tauri_bridge;
|
mod platform;
|
||||||
|
mod script_bridge;
|
||||||
|
|
||||||
mod controls_panel;
|
mod controls_panel;
|
||||||
use controls_panel::ControlsPanel;
|
use controls_panel::ControlsPanel;
|
||||||
|
|
||||||
|
mod diagram_panel;
|
||||||
|
use diagram_panel::{DiagramPanel, ExcalidrawController};
|
||||||
|
|
||||||
mod waveform_panel;
|
mod waveform_panel;
|
||||||
use waveform_panel::WaveformPanel;
|
use waveform_panel::{PixiController, WaveformPanel};
|
||||||
|
|
||||||
type HierarchyAndTimeTable = (Rc<wellen::Hierarchy>, Rc<wellen::TimeTable>);
|
mod header_panel;
|
||||||
|
use header_panel::HeaderPanel;
|
||||||
|
|
||||||
// @TODO REMOVE
|
mod command_panel;
|
||||||
const SIMULATE_CLICKS: bool = false;
|
use command_panel::CommandPanel;
|
||||||
|
|
||||||
|
pub mod theme;
|
||||||
|
use theme::*;
|
||||||
|
|
||||||
|
pub mod term;
|
||||||
|
use shared::term::{TerminalDownMsg, TerminalScreen};
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Default)]
|
||||||
|
enum Layout {
|
||||||
|
Tree,
|
||||||
|
#[default]
|
||||||
|
Columns,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Default)]
|
||||||
|
enum Mode {
|
||||||
|
// @TODO make default
|
||||||
|
// #[default]
|
||||||
|
Waves,
|
||||||
|
#[default]
|
||||||
|
Diagrams,
|
||||||
|
}
|
||||||
|
|
||||||
|
type Filename = String;
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
struct Store {
|
||||||
|
selected_var_refs: MutableVec<wellen::VarRef>,
|
||||||
|
hierarchy: Mutable<Option<Arc<wellen::Hierarchy>>>,
|
||||||
|
loaded_filename: Mutable<Option<Filename>>,
|
||||||
|
pixi_canvas_controller: Mutable<Mutable<Option<SendWrapper<PixiController>>>>,
|
||||||
|
excalidraw_canvas_controller: Mutable<Mutable<Option<SendWrapper<ExcalidrawController>>>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
static STORE: Lazy<Store> = lazy::default();
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
start_app("app", root);
|
start_app("app", root);
|
||||||
|
|
||||||
Task::start(async {
|
Task::start(async {
|
||||||
// https://github.com/tauri-apps/tauri/issues/5170
|
// https://github.com/tauri-apps/tauri/issues/5170
|
||||||
Timer::sleep(100).await;
|
Timer::sleep(100).await;
|
||||||
tauri_bridge::show_window().await;
|
platform::show_window().await;
|
||||||
|
});
|
||||||
|
|
||||||
|
Task::start(async {
|
||||||
|
platform::listen_diagram_connectors_messages(|message| {
|
||||||
|
match message {
|
||||||
|
DiagramConnectorMessage::ListenForComponentTextChanges {
|
||||||
|
diagram_connector_name,
|
||||||
|
component_id,
|
||||||
|
} => {
|
||||||
|
let closure = Closure::new({
|
||||||
|
// @TODO Rcs/Arcs?
|
||||||
|
let diagram_connector_name = diagram_connector_name.clone();
|
||||||
|
let component_id = component_id.clone();
|
||||||
|
move |text| {
|
||||||
|
Task::start(platform::notify_diagram_connector_text_change(
|
||||||
|
diagram_connector_name.clone(),
|
||||||
|
component_id.clone(),
|
||||||
|
text,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
STORE
|
||||||
|
.excalidraw_canvas_controller
|
||||||
|
.lock_ref()
|
||||||
|
.lock_ref()
|
||||||
|
.as_ref()
|
||||||
|
.unwrap_throw()
|
||||||
|
.listen_for_component_text_changes(&component_id, &closure);
|
||||||
|
// @TODO don't forget
|
||||||
|
mem::forget(closure);
|
||||||
|
}
|
||||||
|
DiagramConnectorMessage::SetComponentText { component_id, text } => STORE
|
||||||
|
.excalidraw_canvas_controller
|
||||||
|
.lock_ref()
|
||||||
|
.lock_ref()
|
||||||
|
.as_ref()
|
||||||
|
.unwrap_throw()
|
||||||
|
.set_component_text(&component_id, &text),
|
||||||
|
}
|
||||||
|
}).await;
|
||||||
|
platform::listen_term_update(|down_msg| {
|
||||||
|
term::TERMINAL_STATE.set(down_msg);
|
||||||
|
}).await;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn root() -> impl Element {
|
fn root() -> impl Element {
|
||||||
let hierarchy_and_time_table: Mutable<Option<HierarchyAndTimeTable>> = <_>::default();
|
let hierarchy = STORE.hierarchy.clone();
|
||||||
let selected_var_refs: MutableVec<wellen::VarRef> = <_>::default();
|
let selected_var_refs = STORE.selected_var_refs.clone();
|
||||||
Row::new()
|
let layout: Mutable<Layout> = <_>::default();
|
||||||
|
let mode: Mutable<Mode> = <_>::default();
|
||||||
|
let loaded_filename = STORE.loaded_filename.clone();
|
||||||
|
let pixi_canvas_controller = STORE.pixi_canvas_controller.clone();
|
||||||
|
let excalidraw_canvas_controller = STORE.excalidraw_canvas_controller.clone();
|
||||||
|
Column::new()
|
||||||
.s(Height::fill())
|
.s(Height::fill())
|
||||||
.s(Font::new().color(color!("Lavender")))
|
.s(Scrollbars::y_and_clip_x())
|
||||||
.item(ControlsPanel::new(
|
.s(Font::new().color(COLOR_LAVENDER))
|
||||||
hierarchy_and_time_table.clone(),
|
.item(HeaderPanel::new(
|
||||||
selected_var_refs.clone(),
|
hierarchy.clone(),
|
||||||
))
|
layout.clone(),
|
||||||
.item(WaveformPanel::new(
|
mode.clone(),
|
||||||
hierarchy_and_time_table,
|
loaded_filename.clone(),
|
||||||
selected_var_refs,
|
|
||||||
))
|
))
|
||||||
|
.item_signal(mode.signal().map(clone!((hierarchy, selected_var_refs, loaded_filename, pixi_canvas_controller) move |mode| match mode {
|
||||||
|
Mode::Waves => {
|
||||||
|
Column::new()
|
||||||
|
.s(Height::fill())
|
||||||
|
.s(Scrollbars::y_and_clip_x())
|
||||||
|
.item(
|
||||||
|
Row::new()
|
||||||
|
.s(Scrollbars::y_and_clip_x())
|
||||||
|
.s(Gap::new().x(15))
|
||||||
|
.s(Height::growable().min(150))
|
||||||
|
.item(ControlsPanel::new(
|
||||||
|
hierarchy.clone(),
|
||||||
|
selected_var_refs.clone(),
|
||||||
|
layout.clone(),
|
||||||
|
loaded_filename.clone(),
|
||||||
|
))
|
||||||
|
.item_signal({
|
||||||
|
let hierarchy = hierarchy.clone();
|
||||||
|
let selected_var_refs = selected_var_refs.clone();
|
||||||
|
let loaded_filename = loaded_filename.clone();
|
||||||
|
let pixi_canvas_controller = pixi_canvas_controller.clone();
|
||||||
|
map_ref!{
|
||||||
|
let layout = layout.signal(),
|
||||||
|
let hierarchy_is_some = hierarchy.signal_ref(Option::is_some) => {
|
||||||
|
(*hierarchy_is_some && matches!(layout, Layout::Tree)).then(clone!((hierarchy, selected_var_refs, loaded_filename, pixi_canvas_controller) move || WaveformPanel::new(
|
||||||
|
hierarchy.clone(),
|
||||||
|
selected_var_refs.clone(),
|
||||||
|
loaded_filename.clone(),
|
||||||
|
pixi_canvas_controller.clone(),
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.item_signal({
|
||||||
|
let hierarchy = hierarchy.clone();
|
||||||
|
let selected_var_refs = selected_var_refs.clone();
|
||||||
|
let loaded_filename = loaded_filename.clone();
|
||||||
|
let pixi_canvas_controller = pixi_canvas_controller.clone();
|
||||||
|
map_ref!{
|
||||||
|
let layout = layout.signal(),
|
||||||
|
let hierarchy_is_some = hierarchy.signal_ref(Option::is_some) => {
|
||||||
|
(*hierarchy_is_some && matches!(layout, Layout::Columns)).then(clone!((hierarchy, selected_var_refs, loaded_filename, pixi_canvas_controller) move || WaveformPanel::new(
|
||||||
|
hierarchy.clone(),
|
||||||
|
selected_var_refs.clone(),
|
||||||
|
loaded_filename.clone(),
|
||||||
|
pixi_canvas_controller.clone(),
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Mode::Diagrams => {
|
||||||
|
Column::new()
|
||||||
|
.s(Height::fill())
|
||||||
|
.s(Scrollbars::y_and_clip_x())
|
||||||
|
.item(DiagramPanel::new(excalidraw_canvas_controller.clone()))
|
||||||
|
}
|
||||||
|
})))
|
||||||
|
.item(CommandPanel::new())
|
||||||
|
.item_signal(
|
||||||
|
TERM_OPEN.signal_cloned().map(
|
||||||
|
|term_open| {
|
||||||
|
match term_open {
|
||||||
|
true =>
|
||||||
|
El::new()
|
||||||
|
.s(Height::fill().max(400).min(400))
|
||||||
|
.s(Padding::all(5))
|
||||||
|
.child(term::root()),
|
||||||
|
false =>
|
||||||
|
El::new()
|
||||||
|
.child("")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
137
frontend/src/platform.rs
Normal file
|
@ -0,0 +1,137 @@
|
||||||
|
// @TODO maybe rewrite `FASTWAVE_PLATFORM` to features once it's possible to set them through env vars:
|
||||||
|
// https://github.com/rust-lang/cargo/issues/4829
|
||||||
|
|
||||||
|
// NOTE: `FASTWAVE_PLATFORM` is set in `Makefile.toml` tasks and then in `build.rs`
|
||||||
|
|
||||||
|
use crate::STORE;
|
||||||
|
use shared::DiagramConnectorMessage;
|
||||||
|
|
||||||
|
#[cfg(FASTWAVE_PLATFORM = "TAURI")]
|
||||||
|
mod tauri;
|
||||||
|
#[cfg(FASTWAVE_PLATFORM = "TAURI")]
|
||||||
|
use tauri as platform;
|
||||||
|
|
||||||
|
#[cfg(FASTWAVE_PLATFORM = "BROWSER")]
|
||||||
|
mod browser;
|
||||||
|
#[cfg(FASTWAVE_PLATFORM = "BROWSER")]
|
||||||
|
use browser as platform;
|
||||||
|
|
||||||
|
type Filename = String;
|
||||||
|
type JavascriptCode = String;
|
||||||
|
|
||||||
|
type AddedDecodersCount = usize;
|
||||||
|
type RemovedDecodersCount = usize;
|
||||||
|
type DecoderPath = String;
|
||||||
|
|
||||||
|
type AddedDiagramConnectorsCount = usize;
|
||||||
|
type RemovedDiagramConnectorsCount = usize;
|
||||||
|
type DiagramConnectorPath = String;
|
||||||
|
type DiagramConnectorName = String;
|
||||||
|
type ComponentId = String;
|
||||||
|
|
||||||
|
use shared::term::{TerminalDownMsg, TerminalScreen};
|
||||||
|
|
||||||
|
pub async fn show_window() {
|
||||||
|
platform::show_window().await
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO allow only supported file types by Wellen
|
||||||
|
// @TODO remove the `file` parameter once we don't have to use FileInput element
|
||||||
|
pub async fn pick_and_load_waveform(file: Option<gloo_file::File>) -> Option<Filename> {
|
||||||
|
platform::pick_and_load_waveform(file).await
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO allow only supported file type (*.fw.js)
|
||||||
|
// @TODO remove the `file` parameter once we don't have to use FileInput element
|
||||||
|
pub async fn load_file_with_selected_vars(file: Option<gloo_file::File>) -> Option<JavascriptCode> {
|
||||||
|
platform::load_file_with_selected_vars(file).await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn get_hierarchy() -> wellen::Hierarchy {
|
||||||
|
platform::get_hierarchy().await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn load_signal_and_get_timeline(
|
||||||
|
signal_ref: wellen::SignalRef,
|
||||||
|
timeline_zoom: f64,
|
||||||
|
timeline_viewport_width: u32,
|
||||||
|
timeline_viewport_x: i32,
|
||||||
|
block_height: u32,
|
||||||
|
var_format: shared::VarFormat,
|
||||||
|
) -> shared::Timeline {
|
||||||
|
platform::load_signal_and_get_timeline(
|
||||||
|
signal_ref,
|
||||||
|
timeline_zoom,
|
||||||
|
timeline_viewport_width,
|
||||||
|
timeline_viewport_x,
|
||||||
|
block_height,
|
||||||
|
var_format,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn unload_signal(signal_ref: wellen::SignalRef) {
|
||||||
|
platform::unload_signal(signal_ref).await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn send_char(c : String) {
|
||||||
|
platform::send_char(c).await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn add_decoders(decoder_paths: Vec<DecoderPath>) -> AddedDecodersCount {
|
||||||
|
let count = platform::add_decoders(decoder_paths).await;
|
||||||
|
if count > 0 {
|
||||||
|
redraw_all_timeline_rows().await;
|
||||||
|
}
|
||||||
|
count
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn remove_all_decoders() -> RemovedDecodersCount {
|
||||||
|
let count = platform::remove_all_decoders().await;
|
||||||
|
if count > 0 {
|
||||||
|
redraw_all_timeline_rows().await;
|
||||||
|
}
|
||||||
|
count
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn redraw_all_timeline_rows() {
|
||||||
|
if let Some(controller) = STORE.pixi_canvas_controller.get_cloned().get_cloned() {
|
||||||
|
controller.redraw_all_rows().await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn add_diagram_connectors(
|
||||||
|
diagram_connector_paths: Vec<DecoderPath>,
|
||||||
|
) -> AddedDecodersCount {
|
||||||
|
let count = platform::add_diagram_connectors(diagram_connector_paths).await;
|
||||||
|
count
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn remove_all_diagram_connectors() -> RemovedDecodersCount {
|
||||||
|
let count = platform::remove_all_diagram_connectors().await;
|
||||||
|
count
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn listen_diagram_connectors_messages(
|
||||||
|
on_message: impl FnMut(DiagramConnectorMessage) + 'static,
|
||||||
|
) {
|
||||||
|
platform::listen_diagram_connectors_messages(on_message).await;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn listen_term_update(
|
||||||
|
on_message: impl FnMut(TerminalDownMsg) + 'static,
|
||||||
|
) {
|
||||||
|
platform::listen_term_update(on_message).await;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn notify_diagram_connector_text_change(
|
||||||
|
diagram_connector: DiagramConnectorName,
|
||||||
|
component_id: ComponentId,
|
||||||
|
text: String,
|
||||||
|
) {
|
||||||
|
platform::notify_diagram_connector_text_change(diagram_connector, component_id, text).await;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn open_konata_file() {
|
||||||
|
platform::open_konata_file().await;
|
||||||
|
}
|
173
frontend/src/platform/browser.rs
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
use shared::wellen_helpers;
|
||||||
|
use std::sync::Mutex;
|
||||||
|
use wellen::simple::Waveform;
|
||||||
|
use zoon::{eprintln, *};
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
struct BrowserPlatformStore {
|
||||||
|
waveform: Mutex<Option<Waveform>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
static BROWSER_PLATFORM_STORE: Lazy<BrowserPlatformStore> = lazy::default();
|
||||||
|
|
||||||
|
pub(super) async fn show_window() {}
|
||||||
|
|
||||||
|
pub(super) async fn pick_and_load_waveform(
|
||||||
|
file: Option<gloo_file::File>,
|
||||||
|
) -> Option<super::Filename> {
|
||||||
|
let file = file.unwrap_throw();
|
||||||
|
|
||||||
|
let content = gloo_file::futures::read_as_bytes(&file)
|
||||||
|
.await
|
||||||
|
.unwrap_throw();
|
||||||
|
|
||||||
|
let waveform = wellen_helpers::read_from_bytes(content);
|
||||||
|
let Ok(waveform) = waveform else {
|
||||||
|
panic!("Waveform file reading failed")
|
||||||
|
};
|
||||||
|
*BROWSER_PLATFORM_STORE.waveform.lock().unwrap_throw() = Some(waveform);
|
||||||
|
Some(file.name())
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO Use this `pick_and_load_waveform` version once `showOpenFilePicker` is supported by Safari and Firefox
|
||||||
|
// https://caniuse.com/mdn-api_window_showopenfilepicker
|
||||||
|
// pub(super) async fn pick_and_load_waveform() -> Option<super::Filename> {
|
||||||
|
// let file_handles_promise = window().show_open_file_picker().expect_throw(
|
||||||
|
// "failed to open file picker (browser has to support `showOpenFilePicker` and use HTTPS",
|
||||||
|
// );
|
||||||
|
// let file_handles = JsFuture::from(file_handles_promise).await;
|
||||||
|
// let file_handles = match file_handles {
|
||||||
|
// Ok(file_handles) => file_handles.dyn_into::<js_sys::Array>().unwrap_throw(),
|
||||||
|
// Err(error) => {
|
||||||
|
// println!("file picker error: {error:?}");
|
||||||
|
// return None;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// let file_handle = file_handles
|
||||||
|
// .at(0)
|
||||||
|
// .dyn_into::<web_sys::FileSystemFileHandle>()
|
||||||
|
// .unwrap_throw();
|
||||||
|
|
||||||
|
// let file = JsFuture::from(file_handle.get_file())
|
||||||
|
// .await
|
||||||
|
// .unwrap_throw()
|
||||||
|
// .dyn_into::<web_sys::File>()
|
||||||
|
// .unwrap_throw();
|
||||||
|
|
||||||
|
// let file = gloo_file::File::from(file);
|
||||||
|
// let content = gloo_file::futures::read_as_bytes(&file)
|
||||||
|
// .await
|
||||||
|
// .unwrap_throw();
|
||||||
|
|
||||||
|
// let waveform = wellen_helpers::read_from_bytes(content);
|
||||||
|
// let Ok(waveform) = waveform else {
|
||||||
|
// panic!("Waveform file reading failed")
|
||||||
|
// };
|
||||||
|
// *BROWSER_PLATFORM_STORE.waveform.lock().unwrap_throw() = Some(waveform);
|
||||||
|
// Some(file.name())
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @TODO allow only supported file type (*.fw.js)
|
||||||
|
// @TODO remove the `file` parameter once we don't have to use FileInput element
|
||||||
|
pub async fn load_file_with_selected_vars(
|
||||||
|
file: Option<gloo_file::File>,
|
||||||
|
) -> Option<super::JavascriptCode> {
|
||||||
|
let file = file.unwrap_throw();
|
||||||
|
|
||||||
|
let javascript_code = gloo_file::futures::read_as_text(&file).await.unwrap_throw();
|
||||||
|
|
||||||
|
Some(javascript_code)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO Use alternative `load_file_with_selected_vars` version once `showOpenFilePicker` is supported by Safari and Firefox
|
||||||
|
// https://caniuse.com/mdn-api_window_showopenfilepicker
|
||||||
|
// (see the `pick_and_load_waveform` method above)
|
||||||
|
|
||||||
|
pub(super) async fn get_hierarchy() -> wellen::Hierarchy {
|
||||||
|
let waveform = BROWSER_PLATFORM_STORE.waveform.lock().unwrap_throw();
|
||||||
|
let hierarchy = waveform.as_ref().unwrap_throw().hierarchy();
|
||||||
|
// @TODO Wrap `hierarchy` in `Waveform` with `Rc/Arc` or add the method `take` / `clone` or refactor?
|
||||||
|
serde_json::from_value(serde_json::to_value(hierarchy).unwrap_throw()).unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn load_signal_and_get_timeline(
|
||||||
|
signal_ref: wellen::SignalRef,
|
||||||
|
timeline_zoom: f64,
|
||||||
|
timeline_viewport_width: u32,
|
||||||
|
timeline_viewport_x: i32,
|
||||||
|
block_height: u32,
|
||||||
|
var_format: shared::VarFormat,
|
||||||
|
) -> shared::Timeline {
|
||||||
|
let mut waveform_lock = BROWSER_PLATFORM_STORE.waveform.lock().unwrap();
|
||||||
|
let waveform = waveform_lock.as_mut().unwrap();
|
||||||
|
waveform.load_signals_multi_threaded(&[signal_ref]);
|
||||||
|
let signal = waveform.get_signal(signal_ref).unwrap();
|
||||||
|
let time_table = waveform.time_table();
|
||||||
|
let timeline = shared::signal_to_timeline(
|
||||||
|
signal,
|
||||||
|
time_table,
|
||||||
|
timeline_zoom,
|
||||||
|
timeline_viewport_width,
|
||||||
|
timeline_viewport_x,
|
||||||
|
block_height,
|
||||||
|
var_format,
|
||||||
|
|value| Box::pin(async { value }),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
timeline
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn unload_signal(signal_ref: wellen::SignalRef) {
|
||||||
|
let mut waveform_lock = BROWSER_PLATFORM_STORE.waveform.lock().unwrap_throw();
|
||||||
|
let waveform = waveform_lock.as_mut().unwrap_throw();
|
||||||
|
waveform.unload_signals(&[signal_ref]);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn add_decoders(
|
||||||
|
_decoder_paths: Vec<super::DecoderPath>,
|
||||||
|
) -> super::AddedDecodersCount {
|
||||||
|
// @TODO error message for user
|
||||||
|
eprintln!("Adding decoders is not supported in the browser.");
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn remove_all_decoders() -> super::RemovedDecodersCount {
|
||||||
|
// @TODO error message for user
|
||||||
|
eprintln!("Removing decoders is not supported in the browser.");
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn add_diagram_connectors(
|
||||||
|
diagram_connector_paths: Vec<super::DecoderPath>,
|
||||||
|
) -> super::AddedDecodersCount {
|
||||||
|
// @TODO error message for user
|
||||||
|
eprintln!("Adding diagram connectors is not supported in the browser.");
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn remove_all_diagram_connectors() -> super::RemovedDiagramConnectorsCount {
|
||||||
|
// @TODO error message for user
|
||||||
|
eprintln!("Removing diagram connectors is not supported in the browser.");
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn listen_diagram_connectors_messages(
|
||||||
|
on_message: impl FnMut(DiagramConnectorMessage) + 'static,
|
||||||
|
) {
|
||||||
|
// @TODO error message for user
|
||||||
|
eprintln!("Removing listen for diagram connectors messages is not supported in the browser.");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn notify_diagram_connector_text_change(
|
||||||
|
diagram_connector: DiagramConnectorName,
|
||||||
|
component_id: ComponentId,
|
||||||
|
text: String,
|
||||||
|
) {
|
||||||
|
// @TODO error message for user
|
||||||
|
eprintln!("Diagram connectors notifications are not supported in the browser.");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn open_konata_file() {
|
||||||
|
// @TODO error message for user
|
||||||
|
eprintln!("Opening Konata files is not supported in the browser.");
|
||||||
|
}
|
192
frontend/src/platform/tauri.rs
Normal file
|
@ -0,0 +1,192 @@
|
||||||
|
use shared::DiagramConnectorMessage;
|
||||||
|
use shared::term::{TerminalDownMsg, TerminalScreen};
|
||||||
|
use zoon::*;
|
||||||
|
|
||||||
|
pub(super) async fn show_window() {
|
||||||
|
tauri_glue::show_window().await.unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn pick_and_load_waveform(
|
||||||
|
_file: Option<gloo_file::File>,
|
||||||
|
) -> Option<super::Filename> {
|
||||||
|
tauri_glue::pick_and_load_waveform()
|
||||||
|
.await
|
||||||
|
.unwrap_throw()
|
||||||
|
.as_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn load_file_with_selected_vars(
|
||||||
|
_file: Option<gloo_file::File>,
|
||||||
|
) -> Option<super::JavascriptCode> {
|
||||||
|
tauri_glue::load_file_with_selected_vars()
|
||||||
|
.await
|
||||||
|
.unwrap_throw()
|
||||||
|
.as_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn get_hierarchy() -> wellen::Hierarchy {
|
||||||
|
serde_wasm_bindgen::from_value(tauri_glue::get_hierarchy().await.unwrap_throw()).unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn load_signal_and_get_timeline(
|
||||||
|
signal_ref: wellen::SignalRef,
|
||||||
|
timeline_zoom: f64,
|
||||||
|
timeline_viewport_width: u32,
|
||||||
|
timeline_viewport_x: i32,
|
||||||
|
block_height: u32,
|
||||||
|
var_format: shared::VarFormat,
|
||||||
|
) -> shared::Timeline {
|
||||||
|
let var_format = serde_wasm_bindgen::to_value(&var_format).unwrap_throw();
|
||||||
|
serde_wasm_bindgen::from_value(
|
||||||
|
tauri_glue::load_signal_and_get_timeline(
|
||||||
|
signal_ref.index(),
|
||||||
|
timeline_zoom,
|
||||||
|
timeline_viewport_width,
|
||||||
|
timeline_viewport_x,
|
||||||
|
block_height,
|
||||||
|
var_format,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.unwrap_throw(),
|
||||||
|
)
|
||||||
|
.unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn unload_signal(signal_ref: wellen::SignalRef) {
|
||||||
|
tauri_glue::unload_signal(signal_ref.index())
|
||||||
|
.await
|
||||||
|
.unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn send_char(c : String) {
|
||||||
|
tauri_glue::send_char(c)
|
||||||
|
.await
|
||||||
|
.unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn add_decoders(
|
||||||
|
decoder_paths: Vec<super::DecoderPath>,
|
||||||
|
) -> super::AddedDecodersCount {
|
||||||
|
serde_wasm_bindgen::from_value(tauri_glue::add_decoders(decoder_paths).await.unwrap_throw())
|
||||||
|
.unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn remove_all_decoders() -> super::RemovedDecodersCount {
|
||||||
|
serde_wasm_bindgen::from_value(tauri_glue::remove_all_decoders().await.unwrap_throw())
|
||||||
|
.unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn add_diagram_connectors(
|
||||||
|
diagram_connector_paths: Vec<super::DecoderPath>,
|
||||||
|
) -> super::AddedDiagramConnectorsCount {
|
||||||
|
serde_wasm_bindgen::from_value(
|
||||||
|
tauri_glue::add_diagram_connectors(diagram_connector_paths)
|
||||||
|
.await
|
||||||
|
.unwrap_throw(),
|
||||||
|
)
|
||||||
|
.unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn remove_all_diagram_connectors() -> super::RemovedDiagramConnectorsCount {
|
||||||
|
serde_wasm_bindgen::from_value(
|
||||||
|
tauri_glue::remove_all_diagram_connectors()
|
||||||
|
.await
|
||||||
|
.unwrap_throw(),
|
||||||
|
)
|
||||||
|
.unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn listen_diagram_connectors_messages(
|
||||||
|
mut on_message: impl FnMut(DiagramConnectorMessage) + 'static,
|
||||||
|
) {
|
||||||
|
let on_message =
|
||||||
|
move |message: JsValue| on_message(serde_wasm_bindgen::from_value(message).unwrap_throw());
|
||||||
|
tauri_glue::listen_diagram_connectors_messages(Closure::new(on_message).into_js_value()).await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn listen_term_update(
|
||||||
|
mut on_message: impl FnMut(TerminalDownMsg) + 'static,
|
||||||
|
) {
|
||||||
|
let on_message =
|
||||||
|
move |message: JsValue| on_message(serde_wasm_bindgen::from_value(message).unwrap_throw());
|
||||||
|
tauri_glue::listen_term_update(Closure::new(on_message).into_js_value()).await
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn notify_diagram_connector_text_change(
|
||||||
|
diagram_connector: super::DiagramConnectorName,
|
||||||
|
component_id: super::ComponentId,
|
||||||
|
text: String,
|
||||||
|
) {
|
||||||
|
tauri_glue::notify_diagram_connector_text_change(diagram_connector, component_id, text)
|
||||||
|
.await
|
||||||
|
.unwrap_throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) async fn open_konata_file() {
|
||||||
|
tauri_glue::open_konata_file().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" {
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn show_window() -> Result<(), JsValue>;
|
||||||
|
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn pick_and_load_waveform() -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn load_file_with_selected_vars() -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn get_hierarchy() -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn load_signal_and_get_timeline(
|
||||||
|
signal_ref_index: usize,
|
||||||
|
timeline_zoom: f64,
|
||||||
|
timeline_viewport_width: u32,
|
||||||
|
timeline_viewport_x: i32,
|
||||||
|
block_height: u32,
|
||||||
|
var_format: JsValue,
|
||||||
|
) -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn unload_signal(signal_ref_index: usize) -> Result<(), JsValue>;
|
||||||
|
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn send_char(c : String) -> Result<(), JsValue>;
|
||||||
|
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn add_decoders(
|
||||||
|
decoder_paths: Vec<super::super::DecoderPath>,
|
||||||
|
) -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn remove_all_decoders() -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn add_diagram_connectors(
|
||||||
|
diagram_connector_paths: Vec<super::super::DiagramConnectorPath>,
|
||||||
|
) -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn remove_all_diagram_connectors() -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
|
pub async fn listen_diagram_connectors_messages(on_event: JsValue);
|
||||||
|
|
||||||
|
pub async fn listen_term_update(on_event: JsValue);
|
||||||
|
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn notify_diagram_connector_text_change(
|
||||||
|
diagram_connector: super::super::DiagramConnectorName,
|
||||||
|
component_id: super::super::ComponentId,
|
||||||
|
text: String,
|
||||||
|
) -> Result<(), JsValue>;
|
||||||
|
|
||||||
|
pub async fn open_konata_file();
|
||||||
|
}
|
||||||
|
}
|
111
frontend/src/script_bridge.rs
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
use crate::{platform, STORE};
|
||||||
|
use wellen::GetItem;
|
||||||
|
use zoon::*;
|
||||||
|
|
||||||
|
type FullVarName = String;
|
||||||
|
|
||||||
|
type AddedDecodersCount = usize;
|
||||||
|
type RemovedDecodersCount = usize;
|
||||||
|
type DecoderPath = String;
|
||||||
|
|
||||||
|
type AddedDiagramConnectorsCount = usize;
|
||||||
|
type RemovedDiagramConnectorsCount = usize;
|
||||||
|
type DiagramConnectorPath = String;
|
||||||
|
|
||||||
|
#[wasm_bindgen(module = "/typescript/bundles/strict_eval.js")]
|
||||||
|
extern "C" {
|
||||||
|
#[wasm_bindgen(catch)]
|
||||||
|
pub async fn strict_eval(code: &str) -> Result<JsValue, JsValue>;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub struct FW;
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
impl FW {
|
||||||
|
/// JS: `FW.say_hello()` -> `Hello!`
|
||||||
|
pub fn say_hello() -> String {
|
||||||
|
"Hello!".to_owned()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// JS: `FW.clear_selected_vars()` -> `4`
|
||||||
|
pub fn clear_selected_vars() -> usize {
|
||||||
|
let mut vars = STORE.selected_var_refs.lock_mut();
|
||||||
|
let var_count = vars.len();
|
||||||
|
vars.clear();
|
||||||
|
var_count
|
||||||
|
}
|
||||||
|
|
||||||
|
/// JS: `FW.select_vars(["simple_tb.s.A", "simple_tb.s.B"])` -> `2`
|
||||||
|
pub fn select_vars(full_var_names: Vec<FullVarName>) -> usize {
|
||||||
|
if let Some(hierarchy) = STORE.hierarchy.get_cloned() {
|
||||||
|
let mut new_var_refs = Vec::new();
|
||||||
|
for full_var_name in full_var_names {
|
||||||
|
let path_with_name = full_var_name.split_terminator('.').collect::<Vec<_>>();
|
||||||
|
if let Some((name, path)) = path_with_name.split_last() {
|
||||||
|
if let Some(var_ref) = hierarchy.lookup_var(path, name) {
|
||||||
|
new_var_refs.push(var_ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let var_ref_count = new_var_refs.len();
|
||||||
|
STORE.selected_var_refs.lock_mut().replace(new_var_refs);
|
||||||
|
return var_ref_count;
|
||||||
|
}
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
/// JS: `FW.loaded_filename()` -> `simple.vcd`
|
||||||
|
pub fn loaded_filename() -> Option<String> {
|
||||||
|
STORE.loaded_filename.get_cloned()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// JS: `FW.selected_vars()` -> `["simple_tb.s.A", "simple_tb.s.B"]`
|
||||||
|
pub fn selected_vars() -> Vec<FullVarName> {
|
||||||
|
if let Some(hierarchy) = STORE.hierarchy.get_cloned() {
|
||||||
|
let mut full_var_names = Vec::new();
|
||||||
|
for var_ref in STORE.selected_var_refs.lock_ref().as_slice() {
|
||||||
|
let var = hierarchy.get(*var_ref);
|
||||||
|
let var_name = var.full_name(&hierarchy);
|
||||||
|
full_var_names.push(var_name);
|
||||||
|
}
|
||||||
|
return full_var_names;
|
||||||
|
}
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// JS: `FW.add_decoders(["../test_files/components/rust_decoder/rust_decoder.wasm"])` -> `1`
|
||||||
|
pub async fn add_decoders(decoder_paths: Vec<DecoderPath>) -> AddedDecodersCount {
|
||||||
|
platform::add_decoders(decoder_paths).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// JS: `FW.remove_all_decoders()` -> `5`
|
||||||
|
pub async fn remove_all_decoders() -> RemovedDecodersCount {
|
||||||
|
platform::remove_all_decoders().await
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO replace argument once Excalidraw's `convertToExcalidrawElements` works: {type: "rectangle", x: 100, y: 250}
|
||||||
|
/// JS: `FW.draw_diagram_element({id: 'my_rectangle', type: 'rectangle', x: 500, y: 250, strokeColor: 'black', backgroundColor: 'lightblue', fillStyle: 'solid', strokeWidth: 5, strokeStyle: 'solid', roundness: null, roughness: 0, opacity: 100, width: 100, height: 50, angle: 0, seed: 0, version: 0, versionNonce: 0, isDeleted: false, groupIds: [], frameId: null, boundElements: null, updated: 0, link: null, locked: false, customData: {}})`
|
||||||
|
pub async fn draw_diagram_element(excalidraw_element: JsValue) {
|
||||||
|
if let Some(controller) = STORE
|
||||||
|
.excalidraw_canvas_controller
|
||||||
|
.lock_ref()
|
||||||
|
.lock_ref()
|
||||||
|
.as_ref()
|
||||||
|
{
|
||||||
|
controller.draw_diagram_element(excalidraw_element)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// JS: `FW.add_diagram_connectors(["../test_files/components/rust_diagram_connector/rust_diagram_connector.wasm"])` -> `1`
|
||||||
|
pub async fn add_diagram_connectors(
|
||||||
|
connector_paths: Vec<DiagramConnectorPath>,
|
||||||
|
) -> AddedDiagramConnectorsCount {
|
||||||
|
platform::add_diagram_connectors(connector_paths).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// JS: `FW.remove_all_diagram_connectors()` -> `5`
|
||||||
|
pub async fn remove_all_diagram_connectors() -> RemovedDiagramConnectorsCount {
|
||||||
|
platform::remove_all_diagram_connectors().await
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,46 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
142
frontend/src/term.rs
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
use std::ops::Index;
|
||||||
|
|
||||||
|
use chrono::format;
|
||||||
|
use zoon::*;
|
||||||
|
use zoon::{println, eprintln, *};
|
||||||
|
use shared::term::{TerminalDownMsg, TerminalScreen, TerminalUpMsg};
|
||||||
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
|
|
||||||
|
// use tokio::time::timeout;
|
||||||
|
pub static TERM_OPEN: Lazy<Mutable<bool>> = Lazy::new(|| {false.into()});
|
||||||
|
|
||||||
|
pub const TERMINAL_COLOR: Oklch = color!("oklch(20% 0.125 262.26)");
|
||||||
|
|
||||||
|
pub static TERMINAL_STATE: Lazy<Mutable<TerminalDownMsg>> =
|
||||||
|
Lazy::new(|| {
|
||||||
|
Mutable::new(TerminalDownMsg::TermNotStarted)
|
||||||
|
});
|
||||||
|
|
||||||
|
pub fn root() -> impl Element {
|
||||||
|
let terminal =
|
||||||
|
El::new()
|
||||||
|
.s(Width::fill())
|
||||||
|
.s(Height::fill())
|
||||||
|
.s(Background::new().color(TERMINAL_COLOR))
|
||||||
|
.s(RoundedCorners::all(7))
|
||||||
|
.s(Font::new().family([
|
||||||
|
FontFamily::new("Lucida Console"),
|
||||||
|
FontFamily::new("Courier"),
|
||||||
|
FontFamily::new("monospace")
|
||||||
|
]))
|
||||||
|
.update_raw_el(|raw_el| {
|
||||||
|
raw_el.global_event_handler(|event: events::KeyDown| {
|
||||||
|
send_char(
|
||||||
|
(&event).key().as_str(),
|
||||||
|
(&event).ctrl_key(),
|
||||||
|
);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.child_signal(TERMINAL_STATE.signal_cloned().map(
|
||||||
|
|down_msg| {
|
||||||
|
match down_msg {
|
||||||
|
TerminalDownMsg::FullTermUpdate(term) => {
|
||||||
|
make_grid_with_newlines(&term)
|
||||||
|
},
|
||||||
|
TerminalDownMsg::TermNotStarted => {
|
||||||
|
"Term not yet started!".to_string()
|
||||||
|
},
|
||||||
|
TerminalDownMsg::BackendTermStartFailure(msg) => {
|
||||||
|
format!("Error: BackendTermStartFailure: {}", msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
;
|
||||||
|
let root = Column::new()
|
||||||
|
.s(Width::fill())
|
||||||
|
.s(Height::fill())
|
||||||
|
.s(Align::new().top())
|
||||||
|
.item(terminal);
|
||||||
|
root
|
||||||
|
}
|
||||||
|
|
||||||
|
fn send_char(
|
||||||
|
s : &str,
|
||||||
|
has_control : bool,
|
||||||
|
) {
|
||||||
|
match process_str(s, has_control) {
|
||||||
|
Some(c) => {
|
||||||
|
let send_c = c.clone();
|
||||||
|
Task::start(async move {
|
||||||
|
crate::platform::send_char(send_c.to_string()).await;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
None => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn make_grid_with_newlines(term: &TerminalScreen) -> String {
|
||||||
|
let mut formatted = String::with_capacity(term.content.len() + (term.content.len() / term.cols as usize));
|
||||||
|
|
||||||
|
term.content.chars().enumerate().for_each(|(i, c)| {
|
||||||
|
formatted.push(c);
|
||||||
|
if (i + 1) as u16 % term.cols == 0 {
|
||||||
|
formatted.push('\n');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
formatted
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn process_str(s: &str, has_ctrl: bool) -> Option<char> {
|
||||||
|
match s {
|
||||||
|
"Enter" => {return Some('\n');}
|
||||||
|
"Escape" => {return Some('\x1B');}
|
||||||
|
"Backspace" => {return Some('\x08');}
|
||||||
|
"ArrowUp" => {return Some('\x10');}
|
||||||
|
"ArrowDown" => {return Some('\x0E');}
|
||||||
|
"ArrowLeft" => {return Some('\x02');}
|
||||||
|
"ArrowRight" => {return Some('\x06');}
|
||||||
|
"Control" => {return None;}
|
||||||
|
"Shift" => {return None;}
|
||||||
|
"Meta" => {return None;}
|
||||||
|
"Alt" => {return None;}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut graphemes = s.graphemes(true);
|
||||||
|
let first = graphemes.next();
|
||||||
|
|
||||||
|
if let Some(g) = first {
|
||||||
|
if g.len() == 1 {
|
||||||
|
if let Some(c) = g.chars().next() {
|
||||||
|
let c = process_for_ctrl_char(c, has_ctrl);
|
||||||
|
return Some(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper function to process control characters
|
||||||
|
|
||||||
|
fn is_lowercase_alpha(c: char) -> bool {
|
||||||
|
char_is_between_inclusive(c, 'a', 'z')
|
||||||
|
}
|
||||||
|
|
||||||
|
fn process_for_ctrl_char(c: char, has_ctrl: bool) -> char {
|
||||||
|
if has_ctrl {
|
||||||
|
(c as u8 & 0x1F) as char
|
||||||
|
} else {
|
||||||
|
c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn char_is_between_inclusive(c : char, lo_char : char, hi_char : char) -> bool {
|
||||||
|
c >= lo_char && c <= hi_char
|
||||||
|
}
|
27
frontend/src/theme.rs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
use zoon::*;
|
||||||
|
|
||||||
|
// https://oklch.com/
|
||||||
|
|
||||||
|
// pub const COLOR_BLUE_VIOLET: Rgba = color!("BlueViolet"); // oklch(53.38% 0.25 301.37)
|
||||||
|
pub const COLOR_BLUE_VIOLET: Oklch = color!("oklch(53.38% 0.25 262.59)");
|
||||||
|
|
||||||
|
// pub const COLOR_MEDIUM_SLATE_BLUE: Rgba = color!("MediumSlateBlue"); // oklch(60.45% 0.194 285.5)
|
||||||
|
pub const COLOR_MEDIUM_SLATE_BLUE: Oklch = color!("oklch(60.45% 0.194 262.26)");
|
||||||
|
|
||||||
|
// pub const COLOR_SLATE_BLUE_WITH_ALPHA: Rgba = color!("SlateBlue", 0.8); // oklch(54.36% 0.171 285.54)
|
||||||
|
pub const COLOR_SLATE_BLUE_WITH_ALPHA: Oklch = color!("oklch(54.36% 0.171 262.26)", 0.8);
|
||||||
|
|
||||||
|
// pub const COLOR_SLATE_BLUE: Rgba = color!("SlateBlue"); // oklch(54.36% 0.171 285.54)
|
||||||
|
pub const COLOR_SLATE_BLUE: Oklch = color!("oklch(54.36% 0.171 262.26)");
|
||||||
|
|
||||||
|
// pub const COLOR_LIGHT_BLUE: Rgba = color!("LightBlue"); // oklch(85.62% 0.049 219.65)
|
||||||
|
pub const COLOR_LIGHT_BLUE: Oklch = color!("oklch(85.62% 0.049 262.26)");
|
||||||
|
|
||||||
|
// pub const COLOR_WHITE: Rgba = color!("White"); // oklch(100% 3.5594404384177905e-8 106.37411429114086)
|
||||||
|
pub const COLOR_WHITE: Oklch = color!("oklch(100% 3.5594404384177905e-8 105.88)");
|
||||||
|
|
||||||
|
// pub const COLOR_DARK_SLATE_BLUE: Rgba = color!("DarkSlateBlue"); // oklch(41.43% 0.125 286.04)
|
||||||
|
pub const COLOR_DARK_SLATE_BLUE: Oklch = color!("oklch(41.43% 0.125 262.26)");
|
||||||
|
|
||||||
|
// pub const COLOR_LAVENDER: Rgba = color!("Lavender"); // oklch(93.09% 0.027 285.86)
|
||||||
|
pub const COLOR_LAVENDER: Oklch = color!("oklch(93.09% 0.027 262.26)");
|
|
@ -1,9 +1,11 @@
|
||||||
use crate::{tauri_bridge, HierarchyAndTimeTable};
|
use crate::{platform, script_bridge, theme::*, Filename};
|
||||||
|
use std::sync::Arc;
|
||||||
use wellen::GetItem;
|
use wellen::GetItem;
|
||||||
use zoon::*;
|
use zoon::*;
|
||||||
|
|
||||||
mod pixi_canvas;
|
mod pixi_canvas;
|
||||||
use pixi_canvas::PixiCanvas;
|
use pixi_canvas::PixiCanvas;
|
||||||
|
pub use pixi_canvas::PixiController;
|
||||||
|
|
||||||
const ROW_HEIGHT: u32 = 40;
|
const ROW_HEIGHT: u32 = 40;
|
||||||
const ROW_GAP: u32 = 4;
|
const ROW_GAP: u32 = 4;
|
||||||
|
@ -11,25 +13,209 @@ const ROW_GAP: u32 = 4;
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct WaveformPanel {
|
pub struct WaveformPanel {
|
||||||
selected_var_refs: MutableVec<wellen::VarRef>,
|
selected_var_refs: MutableVec<wellen::VarRef>,
|
||||||
hierarchy_and_time_table: Mutable<Option<HierarchyAndTimeTable>>,
|
hierarchy: Mutable<Option<Arc<wellen::Hierarchy>>>,
|
||||||
|
loaded_filename: Mutable<Option<Filename>>,
|
||||||
|
canvas_controller: Mutable<Mutable<Option<SendWrapper<PixiController>>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WaveformPanel {
|
impl WaveformPanel {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
hierarchy_and_time_table: Mutable<Option<HierarchyAndTimeTable>>,
|
hierarchy: Mutable<Option<Arc<wellen::Hierarchy>>>,
|
||||||
selected_var_refs: MutableVec<wellen::VarRef>,
|
selected_var_refs: MutableVec<wellen::VarRef>,
|
||||||
|
loaded_filename: Mutable<Option<Filename>>,
|
||||||
|
canvas_controller: Mutable<Mutable<Option<SendWrapper<PixiController>>>>,
|
||||||
) -> impl Element {
|
) -> impl Element {
|
||||||
Self {
|
Self {
|
||||||
selected_var_refs,
|
selected_var_refs,
|
||||||
hierarchy_and_time_table,
|
hierarchy,
|
||||||
|
loaded_filename,
|
||||||
|
canvas_controller,
|
||||||
}
|
}
|
||||||
.root()
|
.root()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn root(&self) -> impl Element {
|
fn root(&self) -> impl Element {
|
||||||
|
Column::new()
|
||||||
|
.s(Padding::all(20))
|
||||||
|
.s(Scrollbars::y_and_clip_x())
|
||||||
|
.s(Width::fill())
|
||||||
|
.s(Height::fill())
|
||||||
|
.s(Gap::new().y(20))
|
||||||
|
.item(self.selected_vars_controls())
|
||||||
|
.item(self.vars_and_timelines_panel())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn selected_vars_controls(&self) -> impl Element {
|
||||||
|
Row::new()
|
||||||
|
.s(Align::center())
|
||||||
|
.s(Gap::new().x(20))
|
||||||
|
.s(Width::fill())
|
||||||
|
.item(Spacer::fill())
|
||||||
|
.item(self.load_save_selected_vars_buttons())
|
||||||
|
.item(self.keys_info())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn keys_info(&self) -> impl Element {
|
||||||
|
El::new().s(Width::fill()).child(
|
||||||
|
Row::new()
|
||||||
|
.s(Align::new().center_x())
|
||||||
|
.s(Gap::new().x(15))
|
||||||
|
.item(El::new().s(Font::new().no_wrap()).child("Zoom: Wheel"))
|
||||||
|
.item(
|
||||||
|
El::new()
|
||||||
|
.s(Font::new().no_wrap())
|
||||||
|
.child("Pan: Shift + Wheel"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn load_save_selected_vars_buttons(&self) -> impl Element {
|
||||||
|
Row::new()
|
||||||
|
.s(Gap::new().x(20))
|
||||||
|
.item(self.load_selected_vars_button())
|
||||||
|
.item(
|
||||||
|
El::new()
|
||||||
|
.s(Font::new().no_wrap())
|
||||||
|
.child("Selected Variables"),
|
||||||
|
)
|
||||||
|
.item(self.save_selected_vars_button())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(FASTWAVE_PLATFORM = "TAURI")]
|
||||||
|
fn load_selected_vars_button(&self) -> impl Element {
|
||||||
|
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||||
|
Button::new()
|
||||||
|
.s(Padding::new().x(20).y(10))
|
||||||
|
.s(Background::new().color_signal(
|
||||||
|
hovered_signal.map_bool(|| COLOR_MEDIUM_SLATE_BLUE, || COLOR_SLATE_BLUE),
|
||||||
|
))
|
||||||
|
.s(Align::new().left())
|
||||||
|
.s(RoundedCorners::all(15))
|
||||||
|
.label("Load")
|
||||||
|
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||||
|
.on_press(|| {
|
||||||
|
Task::start(async move {
|
||||||
|
if let Some(javascript_code) =
|
||||||
|
platform::load_file_with_selected_vars(None).await
|
||||||
|
{
|
||||||
|
match script_bridge::strict_eval(&javascript_code).await {
|
||||||
|
Ok(js_value) => {
|
||||||
|
zoon::println!("File with selected vars loaded: {js_value:?}")
|
||||||
|
}
|
||||||
|
Err(js_value) => {
|
||||||
|
zoon::eprintln!(
|
||||||
|
"Failed to load file with selected vars: {js_value:?}"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(FASTWAVE_PLATFORM = "BROWSER")]
|
||||||
|
fn load_selected_vars_button(&self) -> impl Element {
|
||||||
|
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||||
|
let file_input_id = "file_input_for_load_selected_vars_button";
|
||||||
|
Row::new()
|
||||||
|
.item(
|
||||||
|
Label::new()
|
||||||
|
.s(Padding::new().x(20).y(10))
|
||||||
|
.s(Background::new().color_signal(
|
||||||
|
hovered_signal.map_bool(|| COLOR_MEDIUM_SLATE_BLUE, || COLOR_SLATE_BLUE),
|
||||||
|
))
|
||||||
|
.s(Align::new().left())
|
||||||
|
.s(RoundedCorners::all(15))
|
||||||
|
.s(Cursor::new(CursorIcon::Pointer))
|
||||||
|
.label("Load")
|
||||||
|
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||||
|
.for_input(file_input_id),
|
||||||
|
)
|
||||||
|
.item(
|
||||||
|
// @TODO https://github.com/MoonZoon/MoonZoon/issues/39
|
||||||
|
// + https://developer.mozilla.org/en-US/docs/Web/API/File_API/Using_files_from_web_applications#using_hidden_file_input_elements_using_the_click_method
|
||||||
|
TextInput::new().id(file_input_id).update_raw_el(|raw_el| {
|
||||||
|
let dom_element = raw_el.dom_element();
|
||||||
|
raw_el
|
||||||
|
.style("display", "none")
|
||||||
|
.attr("type", "file")
|
||||||
|
.event_handler(move |_: events::Input| {
|
||||||
|
let Some(file_list) =
|
||||||
|
dom_element.files().map(gloo_file::FileList::from)
|
||||||
|
else {
|
||||||
|
zoon::println!("file list is `None`");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let Some(file) = file_list.first().cloned() else {
|
||||||
|
zoon::println!("file list is empty");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
Task::start(async move {
|
||||||
|
if let Some(javascript_code) =
|
||||||
|
platform::load_file_with_selected_vars(Some(file)).await
|
||||||
|
{
|
||||||
|
match script_bridge::strict_eval(&javascript_code).await {
|
||||||
|
Ok(js_value) => zoon::println!(
|
||||||
|
"File with selected vars loaded: {js_value:?}"
|
||||||
|
),
|
||||||
|
Err(js_value) => zoon::eprintln!(
|
||||||
|
"Failed to load file with selected vars: {js_value:?}"
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn save_selected_vars_button(&self) -> impl Element {
|
||||||
|
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||||
|
let loaded_filename = self.loaded_filename.clone();
|
||||||
|
let selected_var_refs = self.selected_var_refs.clone();
|
||||||
|
let hierarchy = self.hierarchy.clone();
|
||||||
|
Button::new()
|
||||||
|
.s(Padding::new().x(20).y(10))
|
||||||
|
.s(Background::new().color_signal(
|
||||||
|
hovered_signal.map_bool(|| COLOR_MEDIUM_SLATE_BLUE, || COLOR_SLATE_BLUE),
|
||||||
|
))
|
||||||
|
.s(RoundedCorners::all(15))
|
||||||
|
.label("Save")
|
||||||
|
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||||
|
.on_press(move || {
|
||||||
|
let loaded_filename = loaded_filename.get_cloned().unwrap_throw();
|
||||||
|
let file_name = format!("{}_vars.fw.js", loaded_filename.replace('.', "_"));
|
||||||
|
|
||||||
|
let hierarchy = hierarchy.get_cloned().unwrap_throw();
|
||||||
|
let mut full_var_names = Vec::new();
|
||||||
|
for var_ref in selected_var_refs.lock_ref().as_slice() {
|
||||||
|
let var = hierarchy.get(*var_ref);
|
||||||
|
let var_name = var.full_name(&hierarchy);
|
||||||
|
full_var_names.push(format!("\"{var_name}\""));
|
||||||
|
}
|
||||||
|
let full_var_names_string = full_var_names.join(",\n\t\t");
|
||||||
|
let file_content = include_str!("waveform_panel/template_vars.px.js")
|
||||||
|
.replacen("{LOADED_FILENAME}", &loaded_filename, 1)
|
||||||
|
.replacen("{FULL_VAR_NAMES}", &full_var_names_string, 1);
|
||||||
|
|
||||||
|
// @TODO we need to use ugly code with temp anchor element until (if ever)
|
||||||
|
// `showSaveFilePicker` is supported in Safari and Firefox (https://caniuse.com/?search=showSaveFilePicker)
|
||||||
|
let file = gloo_file::File::new(&file_name, file_content.as_str());
|
||||||
|
let file_object_url = gloo_file::ObjectUrl::from(file);
|
||||||
|
let a = document().create_element("a").unwrap_throw();
|
||||||
|
a.set_attribute("href", &file_object_url).unwrap_throw();
|
||||||
|
a.set_attribute("download", &file_name).unwrap_throw();
|
||||||
|
a.set_attribute("style", "display: none;").unwrap_throw();
|
||||||
|
dom::body().append_child(&a).unwrap_throw();
|
||||||
|
a.unchecked_ref::<web_sys::HtmlElement>().click();
|
||||||
|
a.remove();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO autoscroll down
|
||||||
|
fn vars_and_timelines_panel(&self) -> impl Element {
|
||||||
let selected_vars_panel_height_getter: Mutable<u32> = <_>::default();
|
let selected_vars_panel_height_getter: Mutable<u32> = <_>::default();
|
||||||
Row::new()
|
Row::new()
|
||||||
.s(Padding::all(20).left(0))
|
|
||||||
.s(Scrollbars::y_and_clip_x())
|
.s(Scrollbars::y_and_clip_x())
|
||||||
.s(Width::growable())
|
.s(Width::growable())
|
||||||
.s(Height::fill())
|
.s(Height::fill())
|
||||||
|
@ -51,23 +237,31 @@ impl WaveformPanel {
|
||||||
|
|
||||||
fn canvas(&self, selected_vars_panel_height: ReadOnlyMutable<u32>) -> impl Element {
|
fn canvas(&self, selected_vars_panel_height: ReadOnlyMutable<u32>) -> impl Element {
|
||||||
let selected_var_refs = self.selected_var_refs.clone();
|
let selected_var_refs = self.selected_var_refs.clone();
|
||||||
let hierarchy_and_time_table = self.hierarchy_and_time_table.clone();
|
let hierarchy = self.hierarchy.clone();
|
||||||
|
let canvas_controller = self.canvas_controller.clone();
|
||||||
PixiCanvas::new(ROW_HEIGHT, ROW_GAP)
|
PixiCanvas::new(ROW_HEIGHT, ROW_GAP)
|
||||||
.s(Align::new().top())
|
.s(Align::new().top())
|
||||||
.s(Width::fill())
|
.s(Width::fill())
|
||||||
.s(Height::exact_signal(selected_vars_panel_height.signal()))
|
.s(Height::exact_signal(selected_vars_panel_height.signal()))
|
||||||
.s(RoundedCorners::new().right(15))
|
|
||||||
.task_with_controller(move |controller| {
|
.task_with_controller(move |controller| {
|
||||||
selected_var_refs.signal_vec().delay_remove(clone!((hierarchy_and_time_table) move |var_ref| {
|
canvas_controller.set(controller.clone());
|
||||||
clone!((var_ref, hierarchy_and_time_table) async move {
|
selected_var_refs.signal_vec().delay_remove(clone!((hierarchy) move |var_ref| {
|
||||||
if let Some(hierarchy_and_time_table) = hierarchy_and_time_table.get_cloned() {
|
clone!((var_ref, hierarchy) async move {
|
||||||
tauri_bridge::unload_signal(hierarchy_and_time_table.0.get(var_ref).signal_ref()).await;
|
if let Some(hierarchy) = hierarchy.get_cloned() {
|
||||||
|
// @TODO unload only when no other selected variable use it?
|
||||||
|
platform::unload_signal(hierarchy.get(var_ref).signal_ref()).await;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})).for_each(clone!((controller, hierarchy_and_time_table) move |vec_diff| {
|
})).for_each(clone!((controller, hierarchy) move |vec_diff| {
|
||||||
clone!((controller, hierarchy_and_time_table) async move {
|
clone!((controller, hierarchy) async move {
|
||||||
match vec_diff {
|
match vec_diff {
|
||||||
VecDiff::Replace { values: _ } => { todo!("`task_with_controller` + `Replace`") },
|
VecDiff::Replace { values } => {
|
||||||
|
let controller = controller.wait_for_some_cloned().await;
|
||||||
|
controller.clear_vars();
|
||||||
|
for var_ref in values {
|
||||||
|
Self::push_var(&controller, &hierarchy, var_ref).await;
|
||||||
|
}
|
||||||
|
},
|
||||||
VecDiff::InsertAt { index: _, value: _ } => { todo!("`task_with_controller` + `InsertAt`") }
|
VecDiff::InsertAt { index: _, value: _ } => { todo!("`task_with_controller` + `InsertAt`") }
|
||||||
VecDiff::UpdateAt { index: _, value: _ } => { todo!("`task_with_controller` + `UpdateAt`") }
|
VecDiff::UpdateAt { index: _, value: _ } => { todo!("`task_with_controller` + `UpdateAt`") }
|
||||||
VecDiff::RemoveAt { index } => {
|
VecDiff::RemoveAt { index } => {
|
||||||
|
@ -78,20 +272,7 @@ impl WaveformPanel {
|
||||||
VecDiff::Move { old_index: _, new_index: _ } => { todo!("`task_with_controller` + `Move`") }
|
VecDiff::Move { old_index: _, new_index: _ } => { todo!("`task_with_controller` + `Move`") }
|
||||||
VecDiff::Push { value: var_ref } => {
|
VecDiff::Push { value: var_ref } => {
|
||||||
if let Some(controller) = controller.lock_ref().as_ref() {
|
if let Some(controller) = controller.lock_ref().as_ref() {
|
||||||
let (hierarchy, time_table) = hierarchy_and_time_table.get_cloned().unwrap();
|
Self::push_var(controller, &hierarchy, var_ref).await;
|
||||||
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 {} => {
|
VecDiff::Pop {} => {
|
||||||
|
@ -110,32 +291,120 @@ impl WaveformPanel {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn push_var(
|
||||||
|
controller: &PixiController,
|
||||||
|
hierarchy: &Mutable<Option<Arc<wellen::Hierarchy>>>,
|
||||||
|
var_ref: wellen::VarRef,
|
||||||
|
) {
|
||||||
|
let hierarchy = hierarchy.get_cloned().unwrap();
|
||||||
|
|
||||||
|
let var_format = shared::VarFormat::default();
|
||||||
|
|
||||||
|
let var = hierarchy.get(var_ref);
|
||||||
|
let signal_ref = var.signal_ref();
|
||||||
|
let timeline = platform::load_signal_and_get_timeline(
|
||||||
|
signal_ref,
|
||||||
|
controller.get_timeline_zoom(),
|
||||||
|
controller.get_timeline_viewport_width(),
|
||||||
|
controller.get_timeline_viewport_x(),
|
||||||
|
ROW_HEIGHT,
|
||||||
|
var_format,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
// @TODO render timeline with time units
|
||||||
|
// let timescale = hierarchy.timescale();
|
||||||
|
|
||||||
|
// Note: Sync `timeline`'s type with the `Timeline` in `frontend/typescript/pixi_canvas/pixi_canvas.ts'
|
||||||
|
let timeline = serde_wasm_bindgen::to_value(&timeline).unwrap_throw();
|
||||||
|
let signal_ref_index = signal_ref.index();
|
||||||
|
let var_format = serde_wasm_bindgen::to_value(&var_format).unwrap_throw();
|
||||||
|
controller.push_var(signal_ref_index, timeline, var_format);
|
||||||
|
}
|
||||||
|
|
||||||
fn selected_var_panel(
|
fn selected_var_panel(
|
||||||
&self,
|
&self,
|
||||||
index: ReadOnlyMutable<Option<usize>>,
|
index: ReadOnlyMutable<Option<usize>>,
|
||||||
var_ref: wellen::VarRef,
|
var_ref: wellen::VarRef,
|
||||||
) -> Option<impl Element> {
|
) -> Option<impl Element> {
|
||||||
let Some((hierarchy, _)) = self.hierarchy_and_time_table.get_cloned() else {
|
let Some(hierarchy) = self.hierarchy.get_cloned() else {
|
||||||
None?
|
None?
|
||||||
};
|
};
|
||||||
let var = hierarchy.get(var_ref);
|
let var = hierarchy.get(var_ref);
|
||||||
let name: &str = var.name(&hierarchy);
|
Row::new()
|
||||||
|
.item(self.selected_var_name_button(var.name(&hierarchy), index.clone()))
|
||||||
|
.item(self.selected_var_format_button(index))
|
||||||
|
.apply(Some)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn selected_var_name_button(
|
||||||
|
&self,
|
||||||
|
name: &str,
|
||||||
|
index: ReadOnlyMutable<Option<usize>>,
|
||||||
|
) -> impl Element {
|
||||||
let selected_var_refs = self.selected_var_refs.clone();
|
let selected_var_refs = self.selected_var_refs.clone();
|
||||||
|
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||||
Button::new()
|
Button::new()
|
||||||
.s(Height::exact(ROW_HEIGHT))
|
.s(Height::exact(ROW_HEIGHT))
|
||||||
.s(Background::new().color(color!("SlateBlue", 0.8)))
|
.s(Width::growable())
|
||||||
.s(RoundedCorners::new().left(15))
|
.s(Background::new().color_signal(
|
||||||
|
hovered_signal.map_bool(|| COLOR_SLATE_BLUE, || COLOR_SLATE_BLUE_WITH_ALPHA),
|
||||||
|
))
|
||||||
|
.s(RoundedCorners::new().left(15).right(5))
|
||||||
.label(
|
.label(
|
||||||
El::new()
|
El::new()
|
||||||
.s(Align::center())
|
.update_raw_el(|raw_el| {
|
||||||
|
raw_el
|
||||||
|
// @TODO move `title` to MZ API? (as `native_tooltip`?)
|
||||||
|
.attr("title", name)
|
||||||
|
// Note: `text-overflow` / ellipsis` doesn't work with flex and dynamic sizes
|
||||||
|
.style("text-overflow", "ellipsis")
|
||||||
|
.style("display", "inline-block")
|
||||||
|
})
|
||||||
|
.s(Scrollbars::both().visible(false))
|
||||||
|
.s(Width::default().max(400))
|
||||||
|
.s(Align::new().left())
|
||||||
.s(Padding::new().left(20).right(17).y(10))
|
.s(Padding::new().left(20).right(17).y(10))
|
||||||
.child(name),
|
.child(name),
|
||||||
)
|
)
|
||||||
|
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||||
.on_press(move || {
|
.on_press(move || {
|
||||||
if let Some(index) = index.get() {
|
if let Some(index) = index.get() {
|
||||||
selected_var_refs.lock_mut().remove(index);
|
selected_var_refs.lock_mut().remove(index);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.apply(Some)
|
}
|
||||||
|
|
||||||
|
fn selected_var_format_button(&self, index: ReadOnlyMutable<Option<usize>>) -> impl Element {
|
||||||
|
let var_format = Mutable::new(shared::VarFormat::default());
|
||||||
|
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||||
|
let canvas_controller = self.canvas_controller.clone();
|
||||||
|
Button::new()
|
||||||
|
.s(Height::exact(ROW_HEIGHT))
|
||||||
|
.s(Width::exact(70))
|
||||||
|
.s(Background::new().color_signal(
|
||||||
|
hovered_signal.map_bool(|| COLOR_SLATE_BLUE, || COLOR_SLATE_BLUE_WITH_ALPHA),
|
||||||
|
))
|
||||||
|
.s(RoundedCorners::new().left(5))
|
||||||
|
.label(
|
||||||
|
El::new()
|
||||||
|
.s(Align::center())
|
||||||
|
.s(Padding::new().left(20).right(17).y(10))
|
||||||
|
.child_signal(var_format.signal().map(|format| format.as_static_str())),
|
||||||
|
)
|
||||||
|
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||||
|
.on_press(move || {
|
||||||
|
let next_format = var_format.get().next();
|
||||||
|
var_format.set(next_format);
|
||||||
|
if let Some(canvas_controller) = canvas_controller.get_cloned().lock_ref().as_ref()
|
||||||
|
{
|
||||||
|
if let Some(index) = index.get() {
|
||||||
|
canvas_controller.set_var_format(
|
||||||
|
index,
|
||||||
|
serde_wasm_bindgen::to_value(&next_format).unwrap_throw(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
|
use crate::platform;
|
||||||
|
pub use js_bridge::PixiController;
|
||||||
|
use std::rc::Rc;
|
||||||
use zoon::*;
|
use zoon::*;
|
||||||
|
|
||||||
pub struct PixiCanvas {
|
pub struct PixiCanvas {
|
||||||
raw_el: RawHtmlEl<web_sys::HtmlElement>,
|
raw_el: RawHtmlEl<web_sys::HtmlElement>,
|
||||||
controller: ReadOnlyMutable<Option<js_bridge::PixiController>>,
|
controller: Mutable<Option<SendWrapper<js_bridge::PixiController>>>,
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
width: ReadOnlyMutable<u32>,
|
width: ReadOnlyMutable<u32>,
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
@ -29,23 +32,53 @@ impl HasIds for PixiCanvas {}
|
||||||
|
|
||||||
impl PixiCanvas {
|
impl PixiCanvas {
|
||||||
pub fn new(row_height: u32, row_gap: u32) -> Self {
|
pub fn new(row_height: u32, row_gap: u32) -> Self {
|
||||||
let controller: Mutable<Option<js_bridge::PixiController>> = Mutable::new(None);
|
let controller: Mutable<Option<SendWrapper<js_bridge::PixiController>>> =
|
||||||
|
Mutable::new(None);
|
||||||
let width = Mutable::new(0);
|
let width = Mutable::new(0);
|
||||||
let height = Mutable::new(0);
|
let height = Mutable::new(0);
|
||||||
let resize_task = Task::start_droppable(
|
let resize_task = Task::start_droppable(
|
||||||
map_ref! {
|
map_ref! {
|
||||||
let _ = width.signal(),
|
let width = width.signal(),
|
||||||
let _ = height.signal() => ()
|
let height = height.signal() => (*width, *height)
|
||||||
}
|
}
|
||||||
.for_each_sync(clone!((controller) move |_| {
|
.dedupe()
|
||||||
if let Some(controller) = controller.lock_ref().as_ref() {
|
.throttle(|| Timer::sleep(50))
|
||||||
controller.queue_resize();
|
.for_each(
|
||||||
}
|
clone!((controller) move |(width, height)| clone!((controller) async move {
|
||||||
})),
|
if let Some(controller) = controller.lock_ref().as_ref() {
|
||||||
|
controller.resize(width, height).await
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
let task_with_controller = Mutable::new(None);
|
let task_with_controller = Mutable::new(None);
|
||||||
|
// -- FastWave-specific --
|
||||||
|
let timeline_getter = Rc::new(Closure::new(
|
||||||
|
|signal_ref_index,
|
||||||
|
timeline_zoom,
|
||||||
|
timeline_viewport_width,
|
||||||
|
timeline_viewport_x,
|
||||||
|
row_height,
|
||||||
|
var_format| {
|
||||||
|
future_to_promise(async move {
|
||||||
|
let signal_ref = wellen::SignalRef::from_index(signal_ref_index).unwrap_throw();
|
||||||
|
let timeline = platform::load_signal_and_get_timeline(
|
||||||
|
signal_ref,
|
||||||
|
timeline_zoom,
|
||||||
|
timeline_viewport_width,
|
||||||
|
timeline_viewport_x,
|
||||||
|
row_height,
|
||||||
|
serde_wasm_bindgen::from_value(var_format).unwrap_throw(),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
let timeline = serde_wasm_bindgen::to_value(&timeline).unwrap_throw();
|
||||||
|
Ok(timeline)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
));
|
||||||
|
// -- // --
|
||||||
Self {
|
Self {
|
||||||
controller: controller.read_only(),
|
controller: controller.clone(),
|
||||||
width: width.read_only(),
|
width: width.read_only(),
|
||||||
height: height.read_only(),
|
height: height.read_only(),
|
||||||
task_with_controller: task_with_controller.clone(),
|
task_with_controller: task_with_controller.clone(),
|
||||||
|
@ -55,14 +88,38 @@ impl PixiCanvas {
|
||||||
width.set_neq(new_width);
|
width.set_neq(new_width);
|
||||||
height.set_neq(new_height);
|
height.set_neq(new_height);
|
||||||
}))
|
}))
|
||||||
.after_insert(clone!((controller) move |element| {
|
.update_raw_el(|raw_el| {
|
||||||
|
// @TODO rewrite to a native Zoon API
|
||||||
|
raw_el.event_handler_with_options(
|
||||||
|
EventOptions::new().preventable(),
|
||||||
|
clone!((controller) move |event: events_extra::WheelEvent| {
|
||||||
|
event.prevent_default();
|
||||||
|
if let Some(controller) = controller.lock_ref().as_ref() {
|
||||||
|
controller.zoom_or_pan(
|
||||||
|
event.delta_y(),
|
||||||
|
event.shift_key(),
|
||||||
|
event.offset_x() as u32,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.after_insert(clone!((controller, timeline_getter) move |element| {
|
||||||
Task::start(async move {
|
Task::start(async move {
|
||||||
let pixi_controller = js_bridge::PixiController::new(row_height, row_gap);
|
let pixi_controller = SendWrapper::new(js_bridge::PixiController::new(
|
||||||
|
1.,
|
||||||
|
width.get(),
|
||||||
|
0,
|
||||||
|
row_height,
|
||||||
|
row_gap,
|
||||||
|
&timeline_getter
|
||||||
|
));
|
||||||
pixi_controller.init(&element).await;
|
pixi_controller.init(&element).await;
|
||||||
controller.set(Some(pixi_controller));
|
controller.set(Some(pixi_controller));
|
||||||
});
|
});
|
||||||
}))
|
}))
|
||||||
.after_remove(move |_| {
|
.after_remove(move |_| {
|
||||||
|
drop(timeline_getter);
|
||||||
drop(resize_task);
|
drop(resize_task);
|
||||||
drop(task_with_controller);
|
drop(task_with_controller);
|
||||||
if let Some(controller) = controller.take() {
|
if let Some(controller) = controller.take() {
|
||||||
|
@ -75,7 +132,7 @@ impl PixiCanvas {
|
||||||
|
|
||||||
pub fn task_with_controller<FUT: Future<Output = ()> + 'static>(
|
pub fn task_with_controller<FUT: Future<Output = ()> + 'static>(
|
||||||
self,
|
self,
|
||||||
f: impl FnOnce(ReadOnlyMutable<Option<js_bridge::PixiController>>) -> FUT,
|
f: impl FnOnce(Mutable<Option<SendWrapper<js_bridge::PixiController>>>) -> FUT,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
self.task_with_controller
|
self.task_with_controller
|
||||||
.set(Some(Task::start_droppable(f(self.controller.clone()))));
|
.set(Some(Task::start_droppable(f(self.controller.clone()))));
|
||||||
|
@ -86,36 +143,90 @@ impl PixiCanvas {
|
||||||
mod js_bridge {
|
mod js_bridge {
|
||||||
use zoon::*;
|
use zoon::*;
|
||||||
|
|
||||||
|
type TimelinePromise = js_sys::Promise;
|
||||||
|
type SignalRefIndex = usize;
|
||||||
|
type TimelineZoom = f64;
|
||||||
|
type TimelineViewportWidth = u32;
|
||||||
|
type TimelineViewportX = i32;
|
||||||
|
type RowHeight = u32;
|
||||||
|
type VarFormatJs = JsValue;
|
||||||
|
type TimelineGetter = Closure<
|
||||||
|
dyn FnMut(
|
||||||
|
SignalRefIndex,
|
||||||
|
TimelineZoom,
|
||||||
|
TimelineViewportWidth,
|
||||||
|
TimelineViewportX,
|
||||||
|
RowHeight,
|
||||||
|
VarFormatJs,
|
||||||
|
) -> TimelinePromise,
|
||||||
|
>;
|
||||||
|
|
||||||
// Note: Add all corresponding methods to `frontend/typescript/pixi_canvas/pixi_canvas.ts`
|
// Note: Add all corresponding methods to `frontend/typescript/pixi_canvas/pixi_canvas.ts`
|
||||||
#[wasm_bindgen(module = "/typescript/bundles/pixi_canvas.js")]
|
#[wasm_bindgen(module = "/typescript/bundles/pixi_canvas.js")]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#[derive(Clone)]
|
||||||
pub type PixiController;
|
pub type PixiController;
|
||||||
|
|
||||||
// @TODO `row_height` and `row_gap` is FastWave-specific
|
// @TODO `row_height` and `row_gap` is FastWave-specific
|
||||||
#[wasm_bindgen(constructor)]
|
#[wasm_bindgen(constructor)]
|
||||||
pub fn new(row_height: u32, row_gap: u32) -> PixiController;
|
pub fn new(
|
||||||
|
timeline_zoom: f64,
|
||||||
|
timeline_viewport_width: u32,
|
||||||
|
timeline_viewport_x: i32,
|
||||||
|
row_height: u32,
|
||||||
|
row_gap: u32,
|
||||||
|
timeline_getter: &TimelineGetter,
|
||||||
|
) -> PixiController;
|
||||||
|
|
||||||
#[wasm_bindgen(method)]
|
#[wasm_bindgen(method)]
|
||||||
pub async fn init(this: &PixiController, parent_element: &JsValue);
|
pub async fn init(this: &PixiController, parent_element: &JsValue);
|
||||||
|
|
||||||
#[wasm_bindgen(method)]
|
#[wasm_bindgen(method)]
|
||||||
pub fn destroy(this: &PixiController);
|
pub async fn resize(this: &PixiController, width: u32, height: u32);
|
||||||
|
|
||||||
#[wasm_bindgen(method)]
|
#[wasm_bindgen(method)]
|
||||||
pub fn queue_resize(this: &PixiController);
|
pub fn destroy(this: &PixiController);
|
||||||
|
|
||||||
// -- FastWave-specific --
|
// -- FastWave-specific --
|
||||||
|
|
||||||
|
#[wasm_bindgen(method)]
|
||||||
|
pub fn get_timeline_zoom(this: &PixiController) -> f64;
|
||||||
|
|
||||||
|
#[wasm_bindgen(method)]
|
||||||
|
pub fn get_timeline_viewport_width(this: &PixiController) -> u32;
|
||||||
|
|
||||||
|
#[wasm_bindgen(method)]
|
||||||
|
pub fn get_timeline_viewport_x(this: &PixiController) -> i32;
|
||||||
|
|
||||||
|
#[wasm_bindgen(method)]
|
||||||
|
pub fn set_var_format(this: &PixiController, index: usize, var_format: JsValue);
|
||||||
|
|
||||||
|
#[wasm_bindgen(method)]
|
||||||
|
pub fn zoom_or_pan(
|
||||||
|
this: &PixiController,
|
||||||
|
wheel_delta_y: f64,
|
||||||
|
shift_key: bool,
|
||||||
|
offset_x: u32,
|
||||||
|
);
|
||||||
|
|
||||||
#[wasm_bindgen(method)]
|
#[wasm_bindgen(method)]
|
||||||
pub fn remove_var(this: &PixiController, index: usize);
|
pub fn remove_var(this: &PixiController, index: usize);
|
||||||
|
|
||||||
#[wasm_bindgen(method)]
|
#[wasm_bindgen(method)]
|
||||||
pub fn push_var(this: &PixiController, timeline: JsValue);
|
pub fn push_var(
|
||||||
|
this: &PixiController,
|
||||||
|
signal_ref_index: usize,
|
||||||
|
timeline: JsValue,
|
||||||
|
var_format: JsValue,
|
||||||
|
);
|
||||||
|
|
||||||
#[wasm_bindgen(method)]
|
#[wasm_bindgen(method)]
|
||||||
pub fn pop_var(this: &PixiController);
|
pub fn pop_var(this: &PixiController);
|
||||||
|
|
||||||
#[wasm_bindgen(method)]
|
#[wasm_bindgen(method)]
|
||||||
pub fn clear_vars(this: &PixiController);
|
pub fn clear_vars(this: &PixiController);
|
||||||
|
|
||||||
|
#[wasm_bindgen(method)]
|
||||||
|
pub async fn redraw_all_rows(this: &PixiController);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
5
frontend/src/waveform_panel/template_vars.px.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
if (FW.loaded_filename() === "{LOADED_FILENAME}") {
|
||||||
|
FW.select_vars([
|
||||||
|
{FULL_VAR_NAMES}
|
||||||
|
])
|
||||||
|
}
|
352
frontend/typescript/bundles/excalidraw_canvas.js
Normal file
5
frontend/typescript/bundles/strict_eval.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
export async function strict_eval(code) {
|
||||||
|
return await eval(code)
|
||||||
|
}
|
25
frontend/typescript/excalidraw_canvas/README.md
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
Init
|
||||||
|
- `npm install && cp -r locales node_modules/@excalidraw/excalidraw/types/`
|
||||||
|
|
||||||
|
Watch & build (without typechecking)
|
||||||
|
- `node_modules/.bin/esbuild excalidraw_canvas.ts --bundle --minify --outfile=../bundles/excalidraw_canvas.js --format=esm --watch`
|
||||||
|
|
||||||
|
Watch & typecheck (without building)
|
||||||
|
- `node_modules/.bin/tsc excalidraw_canvas.ts --watch -noEmit --preserveWatchOutput --target esnext --module esnext --moduleResolution bundler`
|
||||||
|
|
||||||
|
Created with commands:
|
||||||
|
- `npm i -E react react-dom @excalidraw/excalidraw`
|
||||||
|
- `npm i -E @types/react @types/react-dom`
|
||||||
|
- `npm i -E roughjs @excalidraw/laser-pointer jotai browser-fs-access`
|
||||||
|
- `npm i -D esbuild typescript`
|
||||||
|
- `locales/en.json` downloaded from `https://raw.githubusercontent.com/excalidraw/excalidraw/refs/tags/v0.17.6/src/locales/en.json`
|
||||||
|
- `excalidraw-assets-dev` and `excalidraw-assets` from `FastWave2.0\frontend\typescript\excalidraw_canvas\node_modules\@excalidraw\excalidraw\dist` copied into `FastWave2.0\public\excalidraw`
|
||||||
|
- Lines added to `FastWave2.0\backend\globals.js`:
|
||||||
|
```js
|
||||||
|
// -- Excalidraw settings --
|
||||||
|
// @TODO replace with "true" once Preact is integrated into ExcalidrawCanvas
|
||||||
|
var process = { env: { IS_PREACT: "false" } };
|
||||||
|
// @TODO probably remove or update once Preact is integrated into ExcalidrawCanvas
|
||||||
|
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = { isDisabled: true };
|
||||||
|
window.EXCALIDRAW_ASSET_PATH = "/_api/public/excalidraw/";
|
||||||
|
```
|
107
frontend/typescript/excalidraw_canvas/excalidraw_canvas.tsx
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
import { Excalidraw, MainMenu } from '@excalidraw/excalidraw'
|
||||||
|
import { ExcalidrawImperativeAPI } from '@excalidraw/excalidraw/types/types'
|
||||||
|
import { ExcalidrawElement } from '@excalidraw/excalidraw/types/element/types'
|
||||||
|
// @TODO doesn't work with Excalidraw 0.17.6
|
||||||
|
// import { ExcalidrawElementSkeleton, convertToExcalidrawElements } from '@excalidraw/excalidraw/types/data/transform'
|
||||||
|
import * as React from 'react'
|
||||||
|
import * as ReactDOM from 'react-dom/client'
|
||||||
|
|
||||||
|
export class ExcalidrawController {
|
||||||
|
api: Promise<ExcalidrawImperativeAPI>
|
||||||
|
resolve_api: (api: ExcalidrawImperativeAPI) => void
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.resolve_api = (api) => {};
|
||||||
|
this.api = new Promise(resolve => {
|
||||||
|
this.resolve_api = (api) => resolve(api)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_diagram_element(excalidraw_element: ExcalidrawElement) {
|
||||||
|
this.api.then(api => {
|
||||||
|
const elements = api.getSceneElements()
|
||||||
|
api.updateScene({
|
||||||
|
elements: elements.concat(excalidraw_element)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
listen_for_component_text_changes(id: string, on_change: (text: string) => void) {
|
||||||
|
this.api.then(api => {
|
||||||
|
let old_text: string | null = null;
|
||||||
|
api.onChange((elements: readonly ExcalidrawElement[]) => {
|
||||||
|
const element = elements.find(element => element.id === id);
|
||||||
|
if (typeof element !== 'undefined') {
|
||||||
|
if (element.type === 'text') {
|
||||||
|
if (old_text === null) {
|
||||||
|
old_text = element.text;
|
||||||
|
on_change(old_text);
|
||||||
|
} else {
|
||||||
|
if (old_text !== element.text) {
|
||||||
|
old_text = element.text;
|
||||||
|
on_change(old_text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
set_component_text(id: string, text: string) {
|
||||||
|
this.api.then(api => {
|
||||||
|
let element_found = false;
|
||||||
|
const elements = api.getSceneElements().map(element => {
|
||||||
|
if (element.id === id) {
|
||||||
|
element_found = true;
|
||||||
|
return { ...element, text: text, originalText: text }
|
||||||
|
} else {
|
||||||
|
return element
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (element_found) {
|
||||||
|
api.updateScene({
|
||||||
|
elements
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async init(parent_element: HTMLElement) {
|
||||||
|
const App = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div style={{ height: "100%" }}>
|
||||||
|
<Excalidraw
|
||||||
|
theme='dark'
|
||||||
|
gridModeEnabled={true}
|
||||||
|
UIOptions={{canvasActions: {toggleTheme: true}}}
|
||||||
|
initialData={{appState: {
|
||||||
|
// Canvas background: 3. default, blue
|
||||||
|
viewBackgroundColor: "#f5faff",
|
||||||
|
// Sloppiness: Artist
|
||||||
|
currentItemRoughness: 0,
|
||||||
|
// Font family: Code
|
||||||
|
currentItemFontFamily: 3,
|
||||||
|
}}}
|
||||||
|
excalidrawAPI={(api) => this.resolve_api(api)}
|
||||||
|
>
|
||||||
|
<MainMenu>
|
||||||
|
<MainMenu.DefaultItems.LoadScene />
|
||||||
|
<MainMenu.DefaultItems.SaveToActiveFile />
|
||||||
|
<MainMenu.DefaultItems.Export />
|
||||||
|
<MainMenu.DefaultItems.SaveAsImage />
|
||||||
|
<MainMenu.DefaultItems.ClearCanvas />
|
||||||
|
<MainMenu.DefaultItems.ToggleTheme />
|
||||||
|
<MainMenu.DefaultItems.ChangeCanvasBackground />
|
||||||
|
</MainMenu>
|
||||||
|
</Excalidraw>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const root = ReactDOM.createRoot(parent_element);
|
||||||
|
root.render(React.createElement(App));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
612
frontend/typescript/excalidraw_canvas/locales/en.json
Normal file
|
@ -0,0 +1,612 @@
|
||||||
|
{
|
||||||
|
"labels": {
|
||||||
|
"paste": "Paste",
|
||||||
|
"pasteAsPlaintext": "Paste as plaintext",
|
||||||
|
"pasteCharts": "Paste charts",
|
||||||
|
"selectAll": "Select all",
|
||||||
|
"multiSelect": "Add element to selection",
|
||||||
|
"moveCanvas": "Move canvas",
|
||||||
|
"cut": "Cut",
|
||||||
|
"copy": "Copy",
|
||||||
|
"copyAsPng": "Copy to clipboard as PNG",
|
||||||
|
"copyAsSvg": "Copy to clipboard as SVG",
|
||||||
|
"copyText": "Copy to clipboard as text",
|
||||||
|
"copySource": "Copy source to clipboard",
|
||||||
|
"convertToCode": "Convert to code",
|
||||||
|
"bringForward": "Bring forward",
|
||||||
|
"sendToBack": "Send to back",
|
||||||
|
"bringToFront": "Bring to front",
|
||||||
|
"sendBackward": "Send backward",
|
||||||
|
"delete": "Delete",
|
||||||
|
"copyStyles": "Copy styles",
|
||||||
|
"pasteStyles": "Paste styles",
|
||||||
|
"stroke": "Stroke",
|
||||||
|
"changeStroke": "Change stroke color",
|
||||||
|
"background": "Background",
|
||||||
|
"changeBackground": "Change background color",
|
||||||
|
"fill": "Fill",
|
||||||
|
"strokeWidth": "Stroke width",
|
||||||
|
"strokeStyle": "Stroke style",
|
||||||
|
"strokeStyle_solid": "Solid",
|
||||||
|
"strokeStyle_dashed": "Dashed",
|
||||||
|
"strokeStyle_dotted": "Dotted",
|
||||||
|
"sloppiness": "Sloppiness",
|
||||||
|
"opacity": "Opacity",
|
||||||
|
"textAlign": "Text align",
|
||||||
|
"edges": "Edges",
|
||||||
|
"sharp": "Sharp",
|
||||||
|
"round": "Round",
|
||||||
|
"arrowheads": "Arrowheads",
|
||||||
|
"arrowhead_none": "None",
|
||||||
|
"arrowhead_arrow": "Arrow",
|
||||||
|
"arrowhead_bar": "Bar",
|
||||||
|
"arrowhead_circle": "Circle",
|
||||||
|
"arrowhead_circle_outline": "Circle (outline)",
|
||||||
|
"arrowhead_triangle": "Triangle",
|
||||||
|
"arrowhead_triangle_outline": "Triangle (outline)",
|
||||||
|
"arrowhead_diamond": "Diamond",
|
||||||
|
"arrowhead_diamond_outline": "Diamond (outline)",
|
||||||
|
"arrowtypes": "Arrow type",
|
||||||
|
"arrowtype_sharp": "Sharp arrow",
|
||||||
|
"arrowtype_round": "Curved arrow",
|
||||||
|
"arrowtype_elbowed": "Elbow arrow",
|
||||||
|
"fontSize": "Font size",
|
||||||
|
"fontFamily": "Font family",
|
||||||
|
"addWatermark": "Add \"Made with Excalidraw\"",
|
||||||
|
"handDrawn": "Hand-drawn",
|
||||||
|
"normal": "Normal",
|
||||||
|
"code": "Code",
|
||||||
|
"small": "Small",
|
||||||
|
"medium": "Medium",
|
||||||
|
"large": "Large",
|
||||||
|
"veryLarge": "Very large",
|
||||||
|
"solid": "Solid",
|
||||||
|
"hachure": "Hachure",
|
||||||
|
"zigzag": "Zigzag",
|
||||||
|
"crossHatch": "Cross-hatch",
|
||||||
|
"thin": "Thin",
|
||||||
|
"bold": "Bold",
|
||||||
|
"left": "Left",
|
||||||
|
"center": "Center",
|
||||||
|
"right": "Right",
|
||||||
|
"extraBold": "Extra bold",
|
||||||
|
"architect": "Architect",
|
||||||
|
"artist": "Artist",
|
||||||
|
"cartoonist": "Cartoonist",
|
||||||
|
"fileTitle": "File name",
|
||||||
|
"colorPicker": "Color picker",
|
||||||
|
"canvasColors": "Used on canvas",
|
||||||
|
"canvasBackground": "Canvas background",
|
||||||
|
"drawingCanvas": "Drawing canvas",
|
||||||
|
"clearCanvas": "Clear canvas",
|
||||||
|
"layers": "Layers",
|
||||||
|
"actions": "Actions",
|
||||||
|
"language": "Language",
|
||||||
|
"liveCollaboration": "Live collaboration...",
|
||||||
|
"duplicateSelection": "Duplicate",
|
||||||
|
"untitled": "Untitled",
|
||||||
|
"name": "Name",
|
||||||
|
"yourName": "Your name",
|
||||||
|
"madeWithExcalidraw": "Made with Excalidraw",
|
||||||
|
"group": "Group selection",
|
||||||
|
"ungroup": "Ungroup selection",
|
||||||
|
"collaborators": "Collaborators",
|
||||||
|
"toggleGrid": "Toggle grid",
|
||||||
|
"addToLibrary": "Add to library",
|
||||||
|
"removeFromLibrary": "Remove from library",
|
||||||
|
"libraryLoadingMessage": "Loading library…",
|
||||||
|
"libraries": "Browse libraries",
|
||||||
|
"loadingScene": "Loading scene…",
|
||||||
|
"loadScene": "Load scene from file",
|
||||||
|
"align": "Align",
|
||||||
|
"alignTop": "Align top",
|
||||||
|
"alignBottom": "Align bottom",
|
||||||
|
"alignLeft": "Align left",
|
||||||
|
"alignRight": "Align right",
|
||||||
|
"centerVertically": "Center vertically",
|
||||||
|
"centerHorizontally": "Center horizontally",
|
||||||
|
"distributeHorizontally": "Distribute horizontally",
|
||||||
|
"distributeVertically": "Distribute vertically",
|
||||||
|
"flipHorizontal": "Flip horizontal",
|
||||||
|
"flipVertical": "Flip vertical",
|
||||||
|
"viewMode": "View mode",
|
||||||
|
"share": "Share",
|
||||||
|
"showStroke": "Show stroke color picker",
|
||||||
|
"showBackground": "Show background color picker",
|
||||||
|
"showFonts": "Show font picker",
|
||||||
|
"toggleTheme": "Toggle light/dark theme",
|
||||||
|
"theme": "Theme",
|
||||||
|
"personalLib": "Personal Library",
|
||||||
|
"excalidrawLib": "Excalidraw Library",
|
||||||
|
"decreaseFontSize": "Decrease font size",
|
||||||
|
"increaseFontSize": "Increase font size",
|
||||||
|
"unbindText": "Unbind text",
|
||||||
|
"bindText": "Bind text to the container",
|
||||||
|
"createContainerFromText": "Wrap text in a container",
|
||||||
|
"link": {
|
||||||
|
"edit": "Edit link",
|
||||||
|
"editEmbed": "Edit link & embed",
|
||||||
|
"create": "Create link",
|
||||||
|
"createEmbed": "Create link & embed",
|
||||||
|
"label": "Link",
|
||||||
|
"labelEmbed": "Link & embed",
|
||||||
|
"empty": "No link is set"
|
||||||
|
},
|
||||||
|
"lineEditor": {
|
||||||
|
"edit": "Edit line",
|
||||||
|
"editArrow": "Edit arrow"
|
||||||
|
},
|
||||||
|
"elementLock": {
|
||||||
|
"lock": "Lock",
|
||||||
|
"unlock": "Unlock",
|
||||||
|
"lockAll": "Lock all",
|
||||||
|
"unlockAll": "Unlock all"
|
||||||
|
},
|
||||||
|
"statusPublished": "Published",
|
||||||
|
"sidebarLock": "Keep sidebar open",
|
||||||
|
"selectAllElementsInFrame": "Select all elements in frame",
|
||||||
|
"removeAllElementsFromFrame": "Remove all elements from frame",
|
||||||
|
"eyeDropper": "Pick color from canvas",
|
||||||
|
"textToDiagram": "Text to diagram",
|
||||||
|
"prompt": "Prompt",
|
||||||
|
"followUs": "Follow us",
|
||||||
|
"discordChat": "Discord chat",
|
||||||
|
"zoomToFitViewport": "Zoom to fit in viewport",
|
||||||
|
"zoomToFitSelection": "Zoom to fit selection",
|
||||||
|
"zoomToFit": "Zoom to fit all elements",
|
||||||
|
"installPWA": "Install Excalidraw locally (PWA)",
|
||||||
|
"autoResize": "Enable text auto-resizing"
|
||||||
|
},
|
||||||
|
"library": {
|
||||||
|
"noItems": "No items added yet...",
|
||||||
|
"hint_emptyLibrary": "Select an item on canvas to add it here, or install a library from the public repository, below.",
|
||||||
|
"hint_emptyPrivateLibrary": "Select an item on canvas to add it here."
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"title": "Find on canvas",
|
||||||
|
"noMatch": "No matches found...",
|
||||||
|
"singleResult": "result",
|
||||||
|
"multipleResults": "results",
|
||||||
|
"placeholder": "Find text on canvas..."
|
||||||
|
},
|
||||||
|
"buttons": {
|
||||||
|
"clearReset": "Reset the canvas",
|
||||||
|
"exportJSON": "Export to file",
|
||||||
|
"exportImage": "Export image...",
|
||||||
|
"export": "Save to...",
|
||||||
|
"copyToClipboard": "Copy to clipboard",
|
||||||
|
"copyLink": "Copy link",
|
||||||
|
"save": "Save to current file",
|
||||||
|
"saveAs": "Save as",
|
||||||
|
"load": "Open",
|
||||||
|
"getShareableLink": "Get shareable link",
|
||||||
|
"close": "Close",
|
||||||
|
"selectLanguage": "Select language",
|
||||||
|
"scrollBackToContent": "Scroll back to content",
|
||||||
|
"zoomIn": "Zoom in",
|
||||||
|
"zoomOut": "Zoom out",
|
||||||
|
"resetZoom": "Reset zoom",
|
||||||
|
"menu": "Menu",
|
||||||
|
"done": "Done",
|
||||||
|
"edit": "Edit",
|
||||||
|
"undo": "Undo",
|
||||||
|
"redo": "Redo",
|
||||||
|
"resetLibrary": "Reset library",
|
||||||
|
"createNewRoom": "Create new room",
|
||||||
|
"fullScreen": "Full screen",
|
||||||
|
"darkMode": "Dark mode",
|
||||||
|
"lightMode": "Light mode",
|
||||||
|
"systemMode": "System mode",
|
||||||
|
"zenMode": "Zen mode",
|
||||||
|
"objectsSnapMode": "Snap to objects",
|
||||||
|
"exitZenMode": "Exit zen mode",
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"clear": "Clear",
|
||||||
|
"remove": "Remove",
|
||||||
|
"embed": "Toggle embedding",
|
||||||
|
"publishLibrary": "Publish",
|
||||||
|
"submit": "Submit",
|
||||||
|
"confirm": "Confirm",
|
||||||
|
"embeddableInteractionButton": "Click to interact"
|
||||||
|
},
|
||||||
|
"alerts": {
|
||||||
|
"clearReset": "This will clear the whole canvas. Are you sure?",
|
||||||
|
"couldNotCreateShareableLink": "Couldn't create shareable link.",
|
||||||
|
"couldNotCreateShareableLinkTooBig": "Couldn't create shareable link: the scene is too big",
|
||||||
|
"couldNotLoadInvalidFile": "Couldn't load invalid file",
|
||||||
|
"importBackendFailed": "Importing from backend failed.",
|
||||||
|
"cannotExportEmptyCanvas": "Cannot export empty canvas.",
|
||||||
|
"couldNotCopyToClipboard": "Couldn't copy to clipboard.",
|
||||||
|
"decryptFailed": "Couldn't decrypt data.",
|
||||||
|
"uploadedSecurly": "The upload has been secured with end-to-end encryption, which means that Excalidraw server and third parties can't read the content.",
|
||||||
|
"loadSceneOverridePrompt": "Loading external drawing will replace your existing content. Do you wish to continue?",
|
||||||
|
"collabStopOverridePrompt": "Stopping the session will overwrite your previous, locally stored drawing. Are you sure?\n\n(If you want to keep your local drawing, simply close the browser tab instead.)",
|
||||||
|
"errorAddingToLibrary": "Couldn't add item to the library",
|
||||||
|
"errorRemovingFromLibrary": "Couldn't remove item from the library",
|
||||||
|
"confirmAddLibrary": "This will add {{numShapes}} shape(s) to your library. Are you sure?",
|
||||||
|
"imageDoesNotContainScene": "This image does not seem to contain any scene data. Have you enabled scene embedding during export?",
|
||||||
|
"cannotRestoreFromImage": "Scene couldn't be restored from this image file",
|
||||||
|
"invalidSceneUrl": "Couldn't import scene from the supplied URL. It's either malformed, or doesn't contain valid Excalidraw JSON data.",
|
||||||
|
"resetLibrary": "This will clear your library. Are you sure?",
|
||||||
|
"removeItemsFromsLibrary": "Delete {{count}} item(s) from library?",
|
||||||
|
"invalidEncryptionKey": "Encryption key must be of 22 characters. Live collaboration is disabled.",
|
||||||
|
"collabOfflineWarning": "No internet connection available.\nYour changes will not be saved!"
|
||||||
|
},
|
||||||
|
"errors": {
|
||||||
|
"unsupportedFileType": "Unsupported file type.",
|
||||||
|
"imageInsertError": "Couldn't insert image. Try again later...",
|
||||||
|
"fileTooBig": "File is too big. Maximum allowed size is {{maxSize}}.",
|
||||||
|
"svgImageInsertError": "Couldn't insert SVG image. The SVG markup looks invalid.",
|
||||||
|
"failedToFetchImage": "Failed to fetch image.",
|
||||||
|
"cannotResolveCollabServer": "Couldn't connect to the collab server. Please reload the page and try again.",
|
||||||
|
"importLibraryError": "Couldn't load library",
|
||||||
|
"saveLibraryError": "Couldn't save library to storage. Please save your library to a file locally to make sure you don't lose changes.",
|
||||||
|
"collabSaveFailed": "Couldn't save to the backend database. If problems persist, you should save your file locally to ensure you don't lose your work.",
|
||||||
|
"collabSaveFailed_sizeExceeded": "Couldn't save to the backend database, the canvas seems to be too big. You should save the file locally to ensure you don't lose your work.",
|
||||||
|
"imageToolNotSupported": "Images are disabled.",
|
||||||
|
"brave_measure_text_error": {
|
||||||
|
"line1": "Looks like you are using Brave browser with the <bold>Aggressively Block Fingerprinting</bold> setting enabled.",
|
||||||
|
"line2": "This could result in breaking the <bold>Text Elements</bold> in your drawings.",
|
||||||
|
"line3": "We strongly recommend disabling this setting. You can follow <link>these steps</link> on how to do so.",
|
||||||
|
"line4": "If disabling this setting doesn't fix the display of text elements, please open an <issueLink>issue</issueLink> on our GitHub, or write us on <discordLink>Discord</discordLink>"
|
||||||
|
},
|
||||||
|
"libraryElementTypeError": {
|
||||||
|
"embeddable": "Embeddable elements cannot be added to the library.",
|
||||||
|
"iframe": "IFrame elements cannot be added to the library.",
|
||||||
|
"image": "Support for adding images to the library coming soon!"
|
||||||
|
},
|
||||||
|
"asyncPasteFailedOnRead": "Couldn't paste (couldn't read from system clipboard).",
|
||||||
|
"asyncPasteFailedOnParse": "Couldn't paste.",
|
||||||
|
"copyToSystemClipboardFailed": "Couldn't copy to clipboard."
|
||||||
|
},
|
||||||
|
"toolBar": {
|
||||||
|
"selection": "Selection",
|
||||||
|
"image": "Insert image",
|
||||||
|
"rectangle": "Rectangle",
|
||||||
|
"diamond": "Diamond",
|
||||||
|
"ellipse": "Ellipse",
|
||||||
|
"arrow": "Arrow",
|
||||||
|
"line": "Line",
|
||||||
|
"freedraw": "Draw",
|
||||||
|
"text": "Text",
|
||||||
|
"library": "Library",
|
||||||
|
"lock": "Keep selected tool active after drawing",
|
||||||
|
"penMode": "Pen mode - prevent touch",
|
||||||
|
"link": "Add / Update link for a selected shape",
|
||||||
|
"eraser": "Eraser",
|
||||||
|
"frame": "Frame tool",
|
||||||
|
"magicframe": "Wireframe to code",
|
||||||
|
"embeddable": "Web Embed",
|
||||||
|
"laser": "Laser pointer",
|
||||||
|
"hand": "Hand (panning tool)",
|
||||||
|
"extraTools": "More tools",
|
||||||
|
"mermaidToExcalidraw": "Mermaid to Excalidraw"
|
||||||
|
},
|
||||||
|
"element": {
|
||||||
|
"rectangle": "Rectangle",
|
||||||
|
"diamond": "Diamond",
|
||||||
|
"ellipse": "Ellipse",
|
||||||
|
"arrow": "Arrow",
|
||||||
|
"line": "Line",
|
||||||
|
"freedraw": "Freedraw",
|
||||||
|
"text": "Text",
|
||||||
|
"image": "Image",
|
||||||
|
"group": "Group",
|
||||||
|
"frame": "Frame",
|
||||||
|
"magicframe": "Wireframe to code",
|
||||||
|
"embeddable": "Web Embed",
|
||||||
|
"selection": "Selection",
|
||||||
|
"iframe": "IFrame"
|
||||||
|
},
|
||||||
|
"headings": {
|
||||||
|
"canvasActions": "Canvas actions",
|
||||||
|
"selectedShapeActions": "Selected shape actions",
|
||||||
|
"shapes": "Shapes"
|
||||||
|
},
|
||||||
|
"hints": {
|
||||||
|
"dismissSearch": "Escape to dismiss search",
|
||||||
|
"canvasPanning": "To move canvas, hold mouse wheel or spacebar while dragging, or use the hand tool",
|
||||||
|
"linearElement": "Click to start multiple points, drag for single line",
|
||||||
|
"arrowTool": "Click to start multiple points, drag for single line. Press {{arrowShortcut}} again to change arrow type.",
|
||||||
|
"freeDraw": "Click and drag, release when you're finished",
|
||||||
|
"text": "Tip: you can also add text by double-clicking anywhere with the selection tool",
|
||||||
|
"embeddable": "Click-drag to create a website embed",
|
||||||
|
"text_selected": "Double-click or press ENTER to edit text",
|
||||||
|
"text_editing": "Press Escape or CtrlOrCmd+ENTER to finish editing",
|
||||||
|
"linearElementMulti": "Click on last point or press Escape or Enter to finish",
|
||||||
|
"lockAngle": "You can constrain angle by holding SHIFT",
|
||||||
|
"resize": "You can constrain proportions by holding SHIFT while resizing,\nhold ALT to resize from the center",
|
||||||
|
"resizeImage": "You can resize freely by holding SHIFT,\nhold ALT to resize from the center",
|
||||||
|
"rotate": "You can constrain angles by holding SHIFT while rotating",
|
||||||
|
"lineEditor_info": "Hold CtrlOrCmd and Double-click or press CtrlOrCmd + Enter to edit points",
|
||||||
|
"lineEditor_pointSelected": "Press Delete to remove point(s),\nCtrlOrCmd+D to duplicate, or drag to move",
|
||||||
|
"lineEditor_nothingSelected": "Select a point to edit (hold SHIFT to select multiple),\nor hold Alt and click to add new points",
|
||||||
|
"placeImage": "Click to place the image, or click and drag to set its size manually",
|
||||||
|
"publishLibrary": "Publish your own library",
|
||||||
|
"bindTextToElement": "Press enter to add text",
|
||||||
|
"createFlowchart": "Hold CtrlOrCmd and Arrow key to create a flowchart",
|
||||||
|
"deepBoxSelect": "Hold CtrlOrCmd to deep select, and to prevent dragging",
|
||||||
|
"eraserRevert": "Hold Alt to revert the elements marked for deletion",
|
||||||
|
"firefox_clipboard_write": "This feature can likely be enabled by setting the \"dom.events.asyncClipboard.clipboardItem\" flag to \"true\". To change the browser flags in Firefox, visit the \"about:config\" page.",
|
||||||
|
"disableSnapping": "Hold CtrlOrCmd to disable snapping"
|
||||||
|
},
|
||||||
|
"canvasError": {
|
||||||
|
"cannotShowPreview": "Cannot show preview",
|
||||||
|
"canvasTooBig": "The canvas may be too big.",
|
||||||
|
"canvasTooBigTip": "Tip: try moving the farthest elements a bit closer together."
|
||||||
|
},
|
||||||
|
"errorSplash": {
|
||||||
|
"headingMain": "Encountered an error. Try <button>reloading the page</button>.",
|
||||||
|
"clearCanvasMessage": "If reloading doesn't work, try <button>clearing the canvas</button>.",
|
||||||
|
"clearCanvasCaveat": " This will result in loss of work ",
|
||||||
|
"trackedToSentry": "The error with identifier {{eventId}} was tracked on our system.",
|
||||||
|
"openIssueMessage": "We were very cautious not to include your scene information on the error. If your scene is not private, please consider following up on our <button>bug tracker</button>. Please include information below by copying and pasting into the GitHub issue.",
|
||||||
|
"sceneContent": "Scene content:"
|
||||||
|
},
|
||||||
|
"shareDialog": {
|
||||||
|
"or": "Or"
|
||||||
|
},
|
||||||
|
"roomDialog": {
|
||||||
|
"desc_intro": "Invite people to collaborate on your drawing.",
|
||||||
|
"desc_privacy": "Don't worry, the session is end-to-end encrypted, and fully private. Not even our server can see what you draw.",
|
||||||
|
"button_startSession": "Start session",
|
||||||
|
"button_stopSession": "Stop session",
|
||||||
|
"desc_inProgressIntro": "Live-collaboration session is now in progress.",
|
||||||
|
"desc_shareLink": "Share this link with anyone you want to collaborate with:",
|
||||||
|
"desc_exitSession": "Stopping the session will disconnect you from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version.",
|
||||||
|
"shareTitle": "Join a live collaboration session on Excalidraw"
|
||||||
|
},
|
||||||
|
"errorDialog": {
|
||||||
|
"title": "Error"
|
||||||
|
},
|
||||||
|
"exportDialog": {
|
||||||
|
"disk_title": "Save to disk",
|
||||||
|
"disk_details": "Export the scene data to a file from which you can import later.",
|
||||||
|
"disk_button": "Save to file",
|
||||||
|
"link_title": "Shareable link",
|
||||||
|
"link_details": "Export as a read-only link.",
|
||||||
|
"link_button": "Export to Link",
|
||||||
|
"excalidrawplus_description": "Save the scene to your Excalidraw+ workspace.",
|
||||||
|
"excalidrawplus_button": "Export",
|
||||||
|
"excalidrawplus_exportError": "Couldn't export to Excalidraw+ at this moment..."
|
||||||
|
},
|
||||||
|
"helpDialog": {
|
||||||
|
"blog": "Read our blog",
|
||||||
|
"click": "click",
|
||||||
|
"deepSelect": "Deep select",
|
||||||
|
"deepBoxSelect": "Deep select within box, and prevent dragging",
|
||||||
|
"createFlowchart": "Create a flowchart from a generic element",
|
||||||
|
"navigateFlowchart": "Navigate a flowchart",
|
||||||
|
"curvedArrow": "Curved arrow",
|
||||||
|
"curvedLine": "Curved line",
|
||||||
|
"documentation": "Documentation",
|
||||||
|
"doubleClick": "double-click",
|
||||||
|
"drag": "drag",
|
||||||
|
"editor": "Editor",
|
||||||
|
"editLineArrowPoints": "Edit line/arrow points",
|
||||||
|
"editText": "Edit text / add label",
|
||||||
|
"github": "Found an issue? Submit",
|
||||||
|
"howto": "Follow our guides",
|
||||||
|
"or": "or",
|
||||||
|
"preventBinding": "Prevent arrow binding",
|
||||||
|
"tools": "Tools",
|
||||||
|
"shortcuts": "Keyboard shortcuts",
|
||||||
|
"textFinish": "Finish editing (text editor)",
|
||||||
|
"textNewLine": "Add new line (text editor)",
|
||||||
|
"title": "Help",
|
||||||
|
"view": "View",
|
||||||
|
"zoomToFit": "Zoom to fit all elements",
|
||||||
|
"zoomToSelection": "Zoom to selection",
|
||||||
|
"toggleElementLock": "Lock/unlock selection",
|
||||||
|
"movePageUpDown": "Move page up/down",
|
||||||
|
"movePageLeftRight": "Move page left/right"
|
||||||
|
},
|
||||||
|
"clearCanvasDialog": {
|
||||||
|
"title": "Clear canvas"
|
||||||
|
},
|
||||||
|
"publishDialog": {
|
||||||
|
"title": "Publish library",
|
||||||
|
"itemName": "Item name",
|
||||||
|
"authorName": "Author name",
|
||||||
|
"githubUsername": "GitHub username",
|
||||||
|
"twitterUsername": "Twitter username",
|
||||||
|
"libraryName": "Library name",
|
||||||
|
"libraryDesc": "Library description",
|
||||||
|
"website": "Website",
|
||||||
|
"placeholder": {
|
||||||
|
"authorName": "Your name or username",
|
||||||
|
"libraryName": "Name of your library",
|
||||||
|
"libraryDesc": "Description of your library to help people understand its usage",
|
||||||
|
"githubHandle": "GitHub handle (optional), so you can edit the library once submitted for review",
|
||||||
|
"twitterHandle": "Twitter username (optional), so we know who to credit when promoting over Twitter",
|
||||||
|
"website": "Link to your personal website or elsewhere (optional)"
|
||||||
|
},
|
||||||
|
"errors": {
|
||||||
|
"required": "Required",
|
||||||
|
"website": "Enter a valid URL"
|
||||||
|
},
|
||||||
|
"noteDescription": "Submit your library to be included in the <link>public library repository</link> for other people to use in their drawings.",
|
||||||
|
"noteGuidelines": "The library needs to be manually approved first. Please read the <link>guidelines</link> before submitting. You will need a GitHub account to communicate and make changes if requested, but it is not strictly required.",
|
||||||
|
"noteLicense": "By submitting, you agree the library will be published under the <link>MIT License</link>, which in short means anyone can use them without restrictions.",
|
||||||
|
"noteItems": "Each library item must have its own name so it's filterable. The following library items will be included:",
|
||||||
|
"atleastOneLibItem": "Please select at least one library item to get started",
|
||||||
|
"republishWarning": "Note: some of the selected items are marked as already published/submitted. You should only resubmit items when updating an existing library or submission."
|
||||||
|
},
|
||||||
|
"publishSuccessDialog": {
|
||||||
|
"title": "Library submitted",
|
||||||
|
"content": "Thank you {{authorName}}. Your library has been submitted for review. You can track the status <link>here</link>"
|
||||||
|
},
|
||||||
|
"confirmDialog": {
|
||||||
|
"resetLibrary": "Reset library",
|
||||||
|
"removeItemsFromLib": "Remove selected items from library"
|
||||||
|
},
|
||||||
|
"imageExportDialog": {
|
||||||
|
"header": "Export image",
|
||||||
|
"label": {
|
||||||
|
"withBackground": "Background",
|
||||||
|
"onlySelected": "Only selected",
|
||||||
|
"darkMode": "Dark mode",
|
||||||
|
"embedScene": "Embed scene",
|
||||||
|
"scale": "Scale",
|
||||||
|
"padding": "Padding"
|
||||||
|
},
|
||||||
|
"tooltip": {
|
||||||
|
"embedScene": "Scene data will be saved into the exported PNG/SVG file so that the scene can be restored from it.\nWill increase exported file size."
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"exportToPng": "Export to PNG",
|
||||||
|
"exportToSvg": "Export to SVG",
|
||||||
|
"copyPngToClipboard": "Copy PNG to clipboard"
|
||||||
|
},
|
||||||
|
"button": {
|
||||||
|
"exportToPng": "PNG",
|
||||||
|
"exportToSvg": "SVG",
|
||||||
|
"copyPngToClipboard": "Copy to clipboard"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"encrypted": {
|
||||||
|
"tooltip": "Your drawings are end-to-end encrypted so Excalidraw's servers will never see them.",
|
||||||
|
"link": "Blog post on end-to-end encryption in Excalidraw"
|
||||||
|
},
|
||||||
|
"stats": {
|
||||||
|
"angle": "Angle",
|
||||||
|
"shapes": "Shapes",
|
||||||
|
"height": "Height",
|
||||||
|
"scene": "Scene",
|
||||||
|
"selected": "Selected",
|
||||||
|
"storage": "Storage",
|
||||||
|
"fullTitle": "Canvas & Shape properties",
|
||||||
|
"title": "Properties",
|
||||||
|
"generalStats": "General",
|
||||||
|
"elementProperties": "Shape properties",
|
||||||
|
"total": "Total",
|
||||||
|
"version": "Version",
|
||||||
|
"versionCopy": "Click to copy",
|
||||||
|
"versionNotAvailable": "Version not available",
|
||||||
|
"width": "Width"
|
||||||
|
},
|
||||||
|
"toast": {
|
||||||
|
"addedToLibrary": "Added to library",
|
||||||
|
"copyStyles": "Copied styles.",
|
||||||
|
"copyToClipboard": "Copied to clipboard.",
|
||||||
|
"copyToClipboardAsPng": "Copied {{exportSelection}} to clipboard as PNG\n({{exportColorScheme}})",
|
||||||
|
"fileSaved": "File saved.",
|
||||||
|
"fileSavedToFilename": "Saved to {filename}",
|
||||||
|
"canvas": "canvas",
|
||||||
|
"selection": "selection",
|
||||||
|
"pasteAsSingleElement": "Use {{shortcut}} to paste as a single element,\nor paste into an existing text editor",
|
||||||
|
"unableToEmbed": "Embedding this url is currently not allowed. Raise an issue on GitHub to request the url whitelisted",
|
||||||
|
"unrecognizedLinkFormat": "The link you embedded does not match the expected format. Please try to paste the 'embed' string provided by the source site"
|
||||||
|
},
|
||||||
|
"colors": {
|
||||||
|
"transparent": "Transparent",
|
||||||
|
"black": "Black",
|
||||||
|
"white": "White",
|
||||||
|
"red": "Red",
|
||||||
|
"pink": "Pink",
|
||||||
|
"grape": "Grape",
|
||||||
|
"violet": "Violet",
|
||||||
|
"gray": "Gray",
|
||||||
|
"blue": "Blue",
|
||||||
|
"cyan": "Cyan",
|
||||||
|
"teal": "Teal",
|
||||||
|
"green": "Green",
|
||||||
|
"yellow": "Yellow",
|
||||||
|
"orange": "Orange",
|
||||||
|
"bronze": "Bronze"
|
||||||
|
},
|
||||||
|
"welcomeScreen": {
|
||||||
|
"app": {
|
||||||
|
"center_heading": "All your data is saved locally in your browser.",
|
||||||
|
"center_heading_plus": "Did you want to go to the Excalidraw+ instead?",
|
||||||
|
"menuHint": "Export, preferences, languages, ..."
|
||||||
|
},
|
||||||
|
"defaults": {
|
||||||
|
"menuHint": "Export, preferences, and more...",
|
||||||
|
"center_heading": "Diagrams. Made. Simple.",
|
||||||
|
"toolbarHint": "Pick a tool & Start drawing!",
|
||||||
|
"helpHint": "Shortcuts & help"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"colorPicker": {
|
||||||
|
"mostUsedCustomColors": "Most used custom colors",
|
||||||
|
"colors": "Colors",
|
||||||
|
"shades": "Shades",
|
||||||
|
"hexCode": "Hex code",
|
||||||
|
"noShades": "No shades available for this color"
|
||||||
|
},
|
||||||
|
"overwriteConfirm": {
|
||||||
|
"action": {
|
||||||
|
"exportToImage": {
|
||||||
|
"title": "Export as image",
|
||||||
|
"button": "Export as image",
|
||||||
|
"description": "Export the scene data as an image from which you can import later."
|
||||||
|
},
|
||||||
|
"saveToDisk": {
|
||||||
|
"title": "Save to disk",
|
||||||
|
"button": "Save to disk",
|
||||||
|
"description": "Export the scene data to a file from which you can import later."
|
||||||
|
},
|
||||||
|
"excalidrawPlus": {
|
||||||
|
"title": "Excalidraw+",
|
||||||
|
"button": "Export to Excalidraw+",
|
||||||
|
"description": "Save the scene to your Excalidraw+ workspace."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"modal": {
|
||||||
|
"loadFromFile": {
|
||||||
|
"title": "Load from file",
|
||||||
|
"button": "Load from file",
|
||||||
|
"description": "Loading from a file will <bold>replace your existing content</bold>.<br></br>You can back up your drawing first using one of the options below."
|
||||||
|
},
|
||||||
|
"shareableLink": {
|
||||||
|
"title": "Load from link",
|
||||||
|
"button": "Replace my content",
|
||||||
|
"description": "Loading external drawing will <bold>replace your existing content</bold>.<br></br>You can back up your drawing first by using one of the options below."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mermaid": {
|
||||||
|
"title": "Mermaid to Excalidraw",
|
||||||
|
"button": "Insert",
|
||||||
|
"description": "Currently only <flowchartLink>Flowchart</flowchartLink>,<sequenceLink> Sequence, </sequenceLink> and <classLink>Class </classLink>Diagrams are supported. The other types will be rendered as image in Excalidraw.",
|
||||||
|
"syntax": "Mermaid Syntax",
|
||||||
|
"preview": "Preview"
|
||||||
|
},
|
||||||
|
"quickSearch": {
|
||||||
|
"placeholder": "Quick search"
|
||||||
|
},
|
||||||
|
"fontList": {
|
||||||
|
"badge": {
|
||||||
|
"old": "old"
|
||||||
|
},
|
||||||
|
"sceneFonts": "In this scene",
|
||||||
|
"availableFonts": "Available fonts",
|
||||||
|
"empty": "No fonts found"
|
||||||
|
},
|
||||||
|
"userList": {
|
||||||
|
"empty": "No users found",
|
||||||
|
"hint": {
|
||||||
|
"text": "Click on user to follow",
|
||||||
|
"followStatus": "You're currently following this user",
|
||||||
|
"inCall": "User is in a voice call",
|
||||||
|
"micMuted": "User's microphone is muted",
|
||||||
|
"isSpeaking": "User is speaking"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"commandPalette": {
|
||||||
|
"title": "Command palette",
|
||||||
|
"shortcuts": {
|
||||||
|
"select": "Select",
|
||||||
|
"confirm": "Confirm",
|
||||||
|
"close": "Close"
|
||||||
|
},
|
||||||
|
"recents": "Recently used",
|
||||||
|
"search": {
|
||||||
|
"placeholder": "Search menus, commands, and discover hidden gems",
|
||||||
|
"noMatch": "No matching commands..."
|
||||||
|
},
|
||||||
|
"itemNotAvailable": "Command is not available...",
|
||||||
|
"shortcutHint": "For Command palette, use {{shortcut}}"
|
||||||
|
}
|
||||||
|
}
|
608
frontend/typescript/excalidraw_canvas/package-lock.json
generated
Normal file
|
@ -0,0 +1,608 @@
|
||||||
|
{
|
||||||
|
"name": "excalidraw_canvas",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"dependencies": {
|
||||||
|
"@excalidraw/excalidraw": "0.17.6",
|
||||||
|
"@excalidraw/laser-pointer": "1.3.1",
|
||||||
|
"@types/react": "18.3.11",
|
||||||
|
"@types/react-dom": "18.3.0",
|
||||||
|
"browser-fs-access": "0.35.0",
|
||||||
|
"jotai": "2.10.0",
|
||||||
|
"react": "18.3.1",
|
||||||
|
"react-dom": "18.3.1",
|
||||||
|
"roughjs": "4.6.6"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"esbuild": "^0.24.0",
|
||||||
|
"typescript": "^5.6.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/aix-ppc64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw==",
|
||||||
|
"cpu": [
|
||||||
|
"ppc64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"aix"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/android-arm": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew==",
|
||||||
|
"cpu": [
|
||||||
|
"arm"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"android"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/android-arm64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"android"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/android-x64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"android"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/darwin-arm64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/darwin-x64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/freebsd-arm64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"freebsd"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/freebsd-x64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"freebsd"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/linux-arm": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw==",
|
||||||
|
"cpu": [
|
||||||
|
"arm"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/linux-arm64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/linux-ia32": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA==",
|
||||||
|
"cpu": [
|
||||||
|
"ia32"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/linux-loong64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g==",
|
||||||
|
"cpu": [
|
||||||
|
"loong64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/linux-mips64el": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA==",
|
||||||
|
"cpu": [
|
||||||
|
"mips64el"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/linux-ppc64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ==",
|
||||||
|
"cpu": [
|
||||||
|
"ppc64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/linux-riscv64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw==",
|
||||||
|
"cpu": [
|
||||||
|
"riscv64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/linux-s390x": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g==",
|
||||||
|
"cpu": [
|
||||||
|
"s390x"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/linux-x64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/netbsd-x64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"netbsd"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/openbsd-arm64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"openbsd"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/openbsd-x64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"openbsd"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/sunos-x64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"sunos"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/win32-arm64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/win32-ia32": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw==",
|
||||||
|
"cpu": [
|
||||||
|
"ia32"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/win32-x64": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@excalidraw/excalidraw": {
|
||||||
|
"version": "0.17.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/@excalidraw/excalidraw/-/excalidraw-0.17.6.tgz",
|
||||||
|
"integrity": "sha512-fyCl+zG/Z5yhHDh5Fq2ZGmphcrALmuOdtITm8gN4d8w4ntnaopTXcTfnAAaU3VleDC6LhTkoLOTG6P5kgREiIg==",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^17.0.2 || ^18.2.0",
|
||||||
|
"react-dom": "^17.0.2 || ^18.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@excalidraw/laser-pointer": {
|
||||||
|
"version": "1.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@excalidraw/laser-pointer/-/laser-pointer-1.3.1.tgz",
|
||||||
|
"integrity": "sha512-psA1z1N2qeAfsORdXc9JmD2y4CmDwmuMRxnNdJHZexIcPwaNEyIpNcelw+QkL9rz9tosaN9krXuKaRqYpRAR6g=="
|
||||||
|
},
|
||||||
|
"node_modules/@types/prop-types": {
|
||||||
|
"version": "15.7.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.13.tgz",
|
||||||
|
"integrity": "sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA=="
|
||||||
|
},
|
||||||
|
"node_modules/@types/react": {
|
||||||
|
"version": "18.3.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.11.tgz",
|
||||||
|
"integrity": "sha512-r6QZ069rFTjrEYgFdOck1gK7FLVsgJE7tTz0pQBczlBNUhBNk0MQH4UbnFSwjpQLMkLzgqvBBa+qGpLje16eTQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/prop-types": "*",
|
||||||
|
"csstype": "^3.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/react-dom": {
|
||||||
|
"version": "18.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.0.tgz",
|
||||||
|
"integrity": "sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/react": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/browser-fs-access": {
|
||||||
|
"version": "0.35.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/browser-fs-access/-/browser-fs-access-0.35.0.tgz",
|
||||||
|
"integrity": "sha512-sLoadumpRfsjprP8XzVjpQc0jK8yqHBx0PtUTGYj2fftT+P/t+uyDAQdMgGAPKD011in/O+YYGh7fIs0oG/viw=="
|
||||||
|
},
|
||||||
|
"node_modules/csstype": {
|
||||||
|
"version": "3.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
|
||||||
|
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="
|
||||||
|
},
|
||||||
|
"node_modules/esbuild": {
|
||||||
|
"version": "0.24.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.0.tgz",
|
||||||
|
"integrity": "sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==",
|
||||||
|
"dev": true,
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"bin": {
|
||||||
|
"esbuild": "bin/esbuild"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@esbuild/aix-ppc64": "0.24.0",
|
||||||
|
"@esbuild/android-arm": "0.24.0",
|
||||||
|
"@esbuild/android-arm64": "0.24.0",
|
||||||
|
"@esbuild/android-x64": "0.24.0",
|
||||||
|
"@esbuild/darwin-arm64": "0.24.0",
|
||||||
|
"@esbuild/darwin-x64": "0.24.0",
|
||||||
|
"@esbuild/freebsd-arm64": "0.24.0",
|
||||||
|
"@esbuild/freebsd-x64": "0.24.0",
|
||||||
|
"@esbuild/linux-arm": "0.24.0",
|
||||||
|
"@esbuild/linux-arm64": "0.24.0",
|
||||||
|
"@esbuild/linux-ia32": "0.24.0",
|
||||||
|
"@esbuild/linux-loong64": "0.24.0",
|
||||||
|
"@esbuild/linux-mips64el": "0.24.0",
|
||||||
|
"@esbuild/linux-ppc64": "0.24.0",
|
||||||
|
"@esbuild/linux-riscv64": "0.24.0",
|
||||||
|
"@esbuild/linux-s390x": "0.24.0",
|
||||||
|
"@esbuild/linux-x64": "0.24.0",
|
||||||
|
"@esbuild/netbsd-x64": "0.24.0",
|
||||||
|
"@esbuild/openbsd-arm64": "0.24.0",
|
||||||
|
"@esbuild/openbsd-x64": "0.24.0",
|
||||||
|
"@esbuild/sunos-x64": "0.24.0",
|
||||||
|
"@esbuild/win32-arm64": "0.24.0",
|
||||||
|
"@esbuild/win32-ia32": "0.24.0",
|
||||||
|
"@esbuild/win32-x64": "0.24.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/hachure-fill": {
|
||||||
|
"version": "0.5.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/hachure-fill/-/hachure-fill-0.5.2.tgz",
|
||||||
|
"integrity": "sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg=="
|
||||||
|
},
|
||||||
|
"node_modules/jotai": {
|
||||||
|
"version": "2.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/jotai/-/jotai-2.10.0.tgz",
|
||||||
|
"integrity": "sha512-8W4u0aRlOIwGlLQ0sqfl/c6+eExl5D8lZgAUolirZLktyaj4WnxO/8a0HEPmtriQAB6X5LMhXzZVmw02X0P0qQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.20.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@types/react": ">=17.0.0",
|
||||||
|
"react": ">=17.0.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@types/react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/js-tokens": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="
|
||||||
|
},
|
||||||
|
"node_modules/loose-envify": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
|
||||||
|
"dependencies": {
|
||||||
|
"js-tokens": "^3.0.0 || ^4.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"loose-envify": "cli.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/path-data-parser": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-data-parser/-/path-data-parser-0.1.0.tgz",
|
||||||
|
"integrity": "sha512-NOnmBpt5Y2RWbuv0LMzsayp3lVylAHLPUTut412ZA3l+C4uw4ZVkQbjShYCQ8TCpUMdPapr4YjUqLYD6v68j+w=="
|
||||||
|
},
|
||||||
|
"node_modules/points-on-curve": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/points-on-curve/-/points-on-curve-0.2.0.tgz",
|
||||||
|
"integrity": "sha512-0mYKnYYe9ZcqMCWhUjItv/oHjvgEsfKvnUTg8sAtnHr3GVy7rGkXCb6d5cSyqrWqL4k81b9CPg3urd+T7aop3A=="
|
||||||
|
},
|
||||||
|
"node_modules/points-on-path": {
|
||||||
|
"version": "0.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/points-on-path/-/points-on-path-0.2.1.tgz",
|
||||||
|
"integrity": "sha512-25ClnWWuw7JbWZcgqY/gJ4FQWadKxGWk+3kR/7kD0tCaDtPPMj7oHu2ToLaVhfpnHrZzYby2w6tUA0eOIuUg8g==",
|
||||||
|
"dependencies": {
|
||||||
|
"path-data-parser": "0.1.0",
|
||||||
|
"points-on-curve": "0.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/react": {
|
||||||
|
"version": "18.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
|
||||||
|
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"loose-envify": "^1.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/react-dom": {
|
||||||
|
"version": "18.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
|
||||||
|
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
|
||||||
|
"dependencies": {
|
||||||
|
"loose-envify": "^1.1.0",
|
||||||
|
"scheduler": "^0.23.2"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^18.3.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/roughjs": {
|
||||||
|
"version": "4.6.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/roughjs/-/roughjs-4.6.6.tgz",
|
||||||
|
"integrity": "sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"hachure-fill": "^0.5.2",
|
||||||
|
"path-data-parser": "^0.1.0",
|
||||||
|
"points-on-curve": "^0.2.0",
|
||||||
|
"points-on-path": "^0.2.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/scheduler": {
|
||||||
|
"version": "0.23.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz",
|
||||||
|
"integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"loose-envify": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/typescript": {
|
||||||
|
"version": "5.6.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
|
||||||
|
"integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.17"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
frontend/typescript/excalidraw_canvas/package.json
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"@excalidraw/excalidraw": "0.17.6",
|
||||||
|
"@excalidraw/laser-pointer": "1.3.1",
|
||||||
|
"@types/react": "18.3.11",
|
||||||
|
"@types/react-dom": "18.3.0",
|
||||||
|
"browser-fs-access": "0.35.0",
|
||||||
|
"jotai": "2.10.0",
|
||||||
|
"react": "18.3.1",
|
||||||
|
"react-dom": "18.3.1",
|
||||||
|
"roughjs": "4.6.6"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"esbuild": "^0.24.0",
|
||||||
|
"typescript": "^5.6.3"
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,7 @@ Init
|
||||||
- `npm install`
|
- `npm install`
|
||||||
|
|
||||||
Watch & build (without typechecking)
|
Watch & build (without typechecking)
|
||||||
- `node_modules/.bin/esbuild pixi_canvas.ts --bundle --outfile=../bundles/pixi_canvas.js --format=esm --watch`
|
- `node_modules/.bin/esbuild pixi_canvas.ts --bundle --minify --outfile=../bundles/pixi_canvas.js --format=esm --watch`
|
||||||
|
|
||||||
Watch & typecheck (without building)
|
Watch & typecheck (without building)
|
||||||
- `node_modules/.bin/tsc pixi_canvas.ts --watch -noEmit --preserveWatchOutput --target esnext --module esnext --moduleResolution bundler`
|
- `node_modules/.bin/tsc pixi_canvas.ts --watch -noEmit --preserveWatchOutput --target esnext --module esnext --moduleResolution bundler`
|
||||||
|
|
|
@ -1,32 +1,97 @@
|
||||||
import { Application, Text, Graphics, Container, TextStyle } from "pixi.js";
|
import { Application, Text, Graphics, Container, TextStyle, Sprite, Texture } from "pixi.js";
|
||||||
|
|
||||||
type Time = number;
|
// const color_dark_slate_blue = 'DarkSlateBlue'
|
||||||
type BitString = string;
|
const color_dark_slate_blue = '#24478e' // oklch(41.43% 0.125 262.26)'
|
||||||
type Timeline = Array<[Time, BitString | undefined]>;
|
|
||||||
|
// const color_white = 'White'
|
||||||
|
const color_white = '#ffffff' // oklch(100% 3.5594404384177905e-8 105.88)
|
||||||
|
|
||||||
|
// const color_slate_blue = 'SlateBlue'
|
||||||
|
const color_slate_blue = '#3d7af3' // oklch(60.45% 0.194 262.26)
|
||||||
|
|
||||||
|
// const color_dark_violet_with_x = '0x550099' // oklch(37.6% 0.201 299.56)
|
||||||
|
const color_dark_violet_with_x = '0x002ca9' // oklch(37.6% 0.201 263.53)
|
||||||
|
|
||||||
|
// @TODO sync with Rust and `tauri_glue.ts`
|
||||||
|
type Timeline = {
|
||||||
|
blocks: Array<TimelineBlock>
|
||||||
|
}
|
||||||
|
type TimelineBlock = {
|
||||||
|
x: number,
|
||||||
|
width: number,
|
||||||
|
height: number,
|
||||||
|
label: TimeLineBlockLabel | undefined,
|
||||||
|
}
|
||||||
|
type TimeLineBlockLabel = {
|
||||||
|
text: string,
|
||||||
|
x: number,
|
||||||
|
y: number,
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO sync with Rust
|
||||||
|
enum VarFormat {
|
||||||
|
ASCII,
|
||||||
|
Binary,
|
||||||
|
BinaryWithGroups,
|
||||||
|
Hexadecimal,
|
||||||
|
Octal,
|
||||||
|
Signed,
|
||||||
|
Unsigned,
|
||||||
|
}
|
||||||
|
|
||||||
|
type TimelineGetter = (
|
||||||
|
signal_ref_index: number,
|
||||||
|
timeline_zoom: number,
|
||||||
|
timeline_viewport_width: number,
|
||||||
|
timeline_viewport_x: number,
|
||||||
|
row_height: number,
|
||||||
|
var_format: VarFormat
|
||||||
|
) => Promise<Timeline>;
|
||||||
|
|
||||||
export class PixiController {
|
export class PixiController {
|
||||||
app: Application
|
app: Application
|
||||||
// -- FastWave-specific --
|
// -- FastWave-specific --
|
||||||
var_signal_rows: Array<VarSignalRow> = [];
|
var_signal_rows: Array<VarSignalRow> = [];
|
||||||
var_signal_rows_container = new Container();
|
var_signal_rows_container = new Container();
|
||||||
|
// @TODO reset `timeline_*` on file unload?
|
||||||
|
timeline_zoom: number;
|
||||||
|
timeline_viewport_width: number;
|
||||||
|
timeline_viewport_x: number;
|
||||||
row_height: number;
|
row_height: number;
|
||||||
row_gap: number;
|
row_gap: number;
|
||||||
|
timeline_getter: TimelineGetter;
|
||||||
|
|
||||||
constructor(row_height: number, row_gap: number) {
|
constructor(
|
||||||
|
timeline_zoom: number,
|
||||||
|
timeline_viewport_width: number,
|
||||||
|
timeline_viewport_x: number,
|
||||||
|
row_height: number,
|
||||||
|
row_gap: number,
|
||||||
|
timeline_getter: TimelineGetter
|
||||||
|
) {
|
||||||
this.app = new Application();
|
this.app = new Application();
|
||||||
// -- FastWave-specific --
|
// -- FastWave-specific --
|
||||||
|
this.timeline_zoom = timeline_zoom;
|
||||||
|
this.timeline_viewport_width = timeline_viewport_width;
|
||||||
|
this.timeline_viewport_x = timeline_viewport_x;
|
||||||
this.row_height = row_height;
|
this.row_height = row_height;
|
||||||
this.row_gap = row_gap;
|
this.row_gap = row_gap;
|
||||||
this.app.stage.addChild(this.var_signal_rows_container);
|
this.app.stage.addChild(this.var_signal_rows_container);
|
||||||
|
this.timeline_getter = timeline_getter;
|
||||||
}
|
}
|
||||||
|
|
||||||
async init(parent_element: HTMLElement) {
|
async init(parent_element: HTMLElement) {
|
||||||
await this.app.init({ background: 'DarkSlateBlue', antialias: true, resizeTo: parent_element });
|
await this.app.init({ background: color_dark_slate_blue, antialias: true, resizeTo: parent_element });
|
||||||
parent_element.appendChild(this.app.canvas);
|
parent_element.appendChild(this.app.canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default automatic Pixi resizing is not reliable
|
// Default automatic Pixi resizing according to the parent is not reliable
|
||||||
queue_resize() {
|
// and the `app.renderer`'s `resize` event is fired on every browser window size change
|
||||||
|
async resize(width: number, _height: number) {
|
||||||
|
// -- FastWave-specific --
|
||||||
|
this.timeline_viewport_width = width;
|
||||||
|
await this.redraw_all_rows();
|
||||||
|
// -- // --
|
||||||
this.app.queueResize();
|
this.app.queueResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,14 +108,93 @@ export class PixiController {
|
||||||
this.app.destroy(rendererDestroyOptions, options);
|
this.app.destroy(rendererDestroyOptions, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- FastWave-specific --
|
get_timeline_zoom() {
|
||||||
|
return this.timeline_zoom;
|
||||||
remove_var(index: number) {
|
|
||||||
this.var_signal_rows[index].destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
push_var(timeline: Timeline) {
|
get_timeline_viewport_width() {
|
||||||
|
return this.timeline_viewport_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
get_timeline_viewport_x() {
|
||||||
|
return this.timeline_viewport_x;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -- FastWave-specific --
|
||||||
|
|
||||||
|
async redraw_all_rows() {
|
||||||
|
await Promise.all(this.var_signal_rows.map(async row => {
|
||||||
|
const timeline = await this.timeline_getter(
|
||||||
|
row.signal_ref_index,
|
||||||
|
this.timeline_zoom,
|
||||||
|
this.timeline_viewport_width,
|
||||||
|
this.timeline_viewport_x,
|
||||||
|
this.row_height,
|
||||||
|
row.var_format
|
||||||
|
);
|
||||||
|
row.redraw(timeline);
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
async redraw_row(index: number) {
|
||||||
|
const row = this.var_signal_rows[index];
|
||||||
|
if (typeof row !== 'undefined') {
|
||||||
|
const timeline = await this.timeline_getter(
|
||||||
|
row.signal_ref_index,
|
||||||
|
this.timeline_zoom,
|
||||||
|
this.timeline_viewport_width,
|
||||||
|
this.timeline_viewport_x,
|
||||||
|
this.row_height,
|
||||||
|
row.var_format
|
||||||
|
);
|
||||||
|
row.redraw(timeline);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async set_var_format(index: number, var_format: VarFormat) {
|
||||||
|
const row = this.var_signal_rows[index];
|
||||||
|
if (typeof row !== 'undefined') {
|
||||||
|
row.set_var_format(var_format);
|
||||||
|
this.redraw_row(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async zoom_or_pan(wheel_delta_y: number, shift_key: boolean, offset_x: number) {
|
||||||
|
if (shift_key) {
|
||||||
|
this.timeline_viewport_x += Math.sign(wheel_delta_y) * 20;
|
||||||
|
} else {
|
||||||
|
const offset_x_ratio = offset_x / this.timeline_viewport_width;
|
||||||
|
const old_timeline_width = this.timeline_viewport_width * this.timeline_zoom;
|
||||||
|
const new_zoom = this.timeline_zoom - Math.sign(wheel_delta_y) * this.timeline_zoom * 0.5;
|
||||||
|
const new_timeline_width = this.timeline_viewport_width * new_zoom;
|
||||||
|
if (new_timeline_width < this.timeline_viewport_width) {
|
||||||
|
this.timeline_zoom = 1;
|
||||||
|
this.timeline_viewport_x = 0;
|
||||||
|
} else {
|
||||||
|
const timeline_width_difference = new_timeline_width - old_timeline_width;
|
||||||
|
this.timeline_viewport_x += timeline_width_difference * offset_x_ratio;
|
||||||
|
this.timeline_zoom = new_zoom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const timeline_width = this.timeline_viewport_width * this.timeline_zoom;
|
||||||
|
if (this.timeline_viewport_x < 0) {
|
||||||
|
this.timeline_viewport_x = 0;
|
||||||
|
} else if (this.timeline_viewport_x + this.timeline_viewport_width > timeline_width) {
|
||||||
|
this.timeline_viewport_x = timeline_width - this.timeline_viewport_width;
|
||||||
|
}
|
||||||
|
this.redraw_all_rows();
|
||||||
|
}
|
||||||
|
|
||||||
|
remove_var(index: number) {
|
||||||
|
if (typeof this.var_signal_rows[index] !== 'undefined') {
|
||||||
|
this.var_signal_rows[index].destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
push_var(signal_ref_index: number, timeline: Timeline, var_format: VarFormat) {
|
||||||
new VarSignalRow(
|
new VarSignalRow(
|
||||||
|
signal_ref_index,
|
||||||
|
var_format,
|
||||||
timeline,
|
timeline,
|
||||||
this.app,
|
this.app,
|
||||||
this.var_signal_rows,
|
this.var_signal_rows,
|
||||||
|
@ -61,15 +205,21 @@ export class PixiController {
|
||||||
}
|
}
|
||||||
|
|
||||||
pop_var() {
|
pop_var() {
|
||||||
this.var_signal_rows[this.var_signal_rows.length - 1].destroy();
|
this.remove_var(this.var_signal_rows.length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
clear_vars() {
|
clear_vars() {
|
||||||
this.var_signal_rows.slice().reverse().forEach(row => row.destroy());
|
this.var_signal_rows.slice().reverse().forEach(row => row.destroy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
request_timeline_redraw() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class VarSignalRow {
|
class VarSignalRow {
|
||||||
|
signal_ref_index: number;
|
||||||
|
var_format: VarFormat;
|
||||||
timeline: Timeline;
|
timeline: Timeline;
|
||||||
app: Application;
|
app: Application;
|
||||||
owner: Array<VarSignalRow>;
|
owner: Array<VarSignalRow>;
|
||||||
|
@ -78,12 +228,19 @@ class VarSignalRow {
|
||||||
row_height: number;
|
row_height: number;
|
||||||
row_gap: number;
|
row_gap: number;
|
||||||
row_height_with_gap: number;
|
row_height_with_gap: number;
|
||||||
renderer_resize_callback = () => this.draw();
|
|
||||||
// -- elements --
|
|
||||||
row_container = new Container();
|
row_container = new Container();
|
||||||
|
row_container_background: Sprite;
|
||||||
signal_blocks_container = new Container();
|
signal_blocks_container = new Container();
|
||||||
|
label_style = new TextStyle({
|
||||||
|
align: "center",
|
||||||
|
fill: color_white,
|
||||||
|
fontSize: 16,
|
||||||
|
fontFamily: '"Courier New", monospace',
|
||||||
|
});
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
signal_ref_index: number,
|
||||||
|
var_format: VarFormat,
|
||||||
timeline: Timeline,
|
timeline: Timeline,
|
||||||
app: Application,
|
app: Application,
|
||||||
owner: Array<VarSignalRow>,
|
owner: Array<VarSignalRow>,
|
||||||
|
@ -91,9 +248,9 @@ class VarSignalRow {
|
||||||
row_height: number,
|
row_height: number,
|
||||||
row_gap: number,
|
row_gap: number,
|
||||||
) {
|
) {
|
||||||
console.log("VarSignalRow timeline:", timeline);
|
this.signal_ref_index = signal_ref_index;
|
||||||
|
this.var_format = var_format;
|
||||||
this.timeline = timeline;
|
this.timeline = timeline;
|
||||||
|
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
this.row_height = row_height;
|
this.row_height = row_height;
|
||||||
|
@ -105,64 +262,69 @@ class VarSignalRow {
|
||||||
this.owner.push(this);
|
this.owner.push(this);
|
||||||
|
|
||||||
this.rows_container = rows_container;
|
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
|
// row_container
|
||||||
this.row_container.y = this.index_in_owner * this.row_height_with_gap;
|
this.row_container.y = this.index_in_owner * this.row_height_with_gap;
|
||||||
this.rows_container.addChild(this.row_container);
|
this.rows_container.addChild(this.row_container);
|
||||||
|
|
||||||
// signal_block_container
|
// row background
|
||||||
|
this.row_container_background = new Sprite();
|
||||||
|
this.row_container_background.texture = Texture.WHITE;
|
||||||
|
this.row_container_background.tint = color_dark_violet_with_x;
|
||||||
|
this.row_container_background.height = this.row_height;
|
||||||
|
this.row_container.addChild(this.row_container_background);
|
||||||
|
|
||||||
|
// signal_blocks_container
|
||||||
this.row_container.addChild(this.signal_blocks_container);
|
this.row_container.addChild(this.signal_blocks_container);
|
||||||
|
|
||||||
|
this.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
set_var_format(var_format: VarFormat) {
|
||||||
|
this.var_format = var_format;
|
||||||
|
}
|
||||||
|
|
||||||
|
redraw(timeline: Timeline) {
|
||||||
|
this.timeline = timeline;
|
||||||
|
this.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
draw() {
|
draw() {
|
||||||
if (this.timeline.length > 0) {
|
// Screen can be null when we are, for instance, switching between miller columns and tree layout
|
||||||
const last_time = this.timeline[this.timeline.length - 1][0];
|
// and then the canvas has to be recreated.
|
||||||
// @TODO make formatter configurable
|
if (this?.app?.screen?.width === undefined) {
|
||||||
const formatter: (signal_value: BitString) => string = signal_value => parseInt(signal_value, 2).toString(16);
|
return;
|
||||||
// @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);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
// Workaround for "TypeError: Cannot read properties of null (reading 'orig')"
|
||||||
|
if (this?.row_container_background?._texture?.orig?.width !== undefined) {
|
||||||
|
this.row_container_background.width = this.app.screen.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO optimize by reusing a pool of blocks instead or removing all children on every redraw?
|
||||||
|
this.signal_blocks_container.removeChildren();
|
||||||
|
this.timeline.blocks.forEach(timeline_block => {
|
||||||
|
// signal_block
|
||||||
|
const signal_block = new Container();
|
||||||
|
signal_block.x = timeline_block.x;
|
||||||
|
this.signal_blocks_container.addChild(signal_block);
|
||||||
|
|
||||||
|
// background
|
||||||
|
const gap_between_blocks = 2;
|
||||||
|
const background = new Graphics()
|
||||||
|
.rect(gap_between_blocks / 2, 0, timeline_block.width - gap_between_blocks, timeline_block.height)
|
||||||
|
.fill(color_slate_blue);
|
||||||
|
signal_block.addChild(background);
|
||||||
|
|
||||||
|
// label
|
||||||
|
if (timeline_block.label !== undefined) {
|
||||||
|
const label = new Text();
|
||||||
|
label.text = timeline_block.label.text;
|
||||||
|
label.style = this.label_style;
|
||||||
|
label.x = timeline_block.label.x;
|
||||||
|
label.y = timeline_block.label.y;
|
||||||
|
signal_block.addChild(label);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
decrement_index() {
|
decrement_index() {
|
||||||
|
@ -171,7 +333,6 @@ class VarSignalRow {
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
this.app.renderer.off("resize", this.renderer_resize_callback);
|
|
||||||
this.owner.splice(this.index_in_owner, 1);
|
this.owner.splice(this.index_in_owner, 1);
|
||||||
this.rows_container.removeChildAt(this.index_in_owner);
|
this.rows_container.removeChildAt(this.index_in_owner);
|
||||||
this.row_container.destroy(true);
|
this.row_container.destroy(true);
|
||||||
|
|
|
@ -2,7 +2,7 @@ Init
|
||||||
- `npm install`
|
- `npm install`
|
||||||
|
|
||||||
Watch & build (without typechecking)
|
Watch & build (without typechecking)
|
||||||
-`- `node_modules/.bin/esbuild pixi_canvas.ts --bundle --outfile=../bundles/tauri_glue.js --format=esm --watch``
|
- `node_modules/.bin/esbuild tauri_glue.ts --bundle --minify --outfile=../bundles/tauri_glue.js --format=esm --watch`
|
||||||
|
|
||||||
Watch & typecheck (without building)
|
Watch & typecheck (without building)
|
||||||
- `node_modules/.bin/tsc tauri_glue.ts --watch -noEmit --preserveWatchOutput --target esnext --module esnext --moduleResolution bundler`
|
- `node_modules/.bin/tsc tauri_glue.ts --watch -noEmit --preserveWatchOutput --target esnext --module esnext --moduleResolution bundler`
|
||||||
|
|
|
@ -1,33 +1,96 @@
|
||||||
// @TODO use TS and Tauri bindgens to make this code properly typed
|
// @TODO use TS and Tauri bindgens to make this code properly typed
|
||||||
|
|
||||||
import { core } from '@tauri-apps/api'
|
import { core, event } from '@tauri-apps/api'
|
||||||
|
|
||||||
const invoke = core.invoke;
|
const invoke = core.invoke;
|
||||||
|
const listen = event.listen;
|
||||||
|
|
||||||
|
type Filename = string;
|
||||||
|
type JavascriptCode = string;
|
||||||
type WellenHierarchy = unknown;
|
type WellenHierarchy = unknown;
|
||||||
type WellenTimeTable = unknown;
|
type Timeline = unknown;
|
||||||
type WellenSignal = unknown;
|
type VarFormat = unknown;
|
||||||
|
|
||||||
|
type AddedDecodersCount = number;
|
||||||
|
type RemovedDecodersCount = number;
|
||||||
|
type DecoderPath = string;
|
||||||
|
|
||||||
|
type AddedDiagramConnectorsCount = number;
|
||||||
|
type RemovedDiagramConnectorsCount = number;
|
||||||
|
type DiagramConnectorPath = string;
|
||||||
|
type DiagramConnectorName = string;
|
||||||
|
type ComponentId = string;
|
||||||
|
|
||||||
export async function show_window(): Promise<void> {
|
export async function show_window(): Promise<void> {
|
||||||
return await invoke("show_window");
|
return await invoke("show_window");
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function load_waveform(): Promise<void> {
|
export async function pick_and_load_waveform(): Promise<Filename | undefined> {
|
||||||
return await invoke("load_waveform");
|
return await invoke("pick_and_load_waveform");
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function load_file_with_selected_vars(): Promise<JavascriptCode | undefined> {
|
||||||
|
return await invoke("load_file_with_selected_vars");
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function get_hierarchy(): Promise<WellenHierarchy> {
|
export async function get_hierarchy(): Promise<WellenHierarchy> {
|
||||||
return await invoke("get_hierarchy");
|
return await invoke("get_hierarchy");
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function get_time_table(): Promise<WellenTimeTable> {
|
export async function load_signal_and_get_timeline(
|
||||||
return await invoke("get_time_table");
|
signal_ref_index: number,
|
||||||
}
|
timeline_zoom: number,
|
||||||
|
timeline_viewport_width: number,
|
||||||
export async function load_and_get_signal(signal_ref_index: number): Promise<WellenSignal> {
|
timeline_viewport_x: number,
|
||||||
return await invoke("load_and_get_signal", { signal_ref_index });
|
block_height: number,
|
||||||
|
var_format: VarFormat,
|
||||||
|
): Promise<Timeline> {
|
||||||
|
return await invoke("load_signal_and_get_timeline", {
|
||||||
|
signal_ref_index,
|
||||||
|
timeline_zoom,
|
||||||
|
timeline_viewport_width,
|
||||||
|
timeline_viewport_x,
|
||||||
|
block_height,
|
||||||
|
var_format
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function unload_signal(signal_ref_index: number): Promise<void> {
|
export async function unload_signal(signal_ref_index: number): Promise<void> {
|
||||||
return await invoke("unload_signal", { signal_ref_index });
|
return await invoke("unload_signal", { signal_ref_index });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function send_char(c : string): Promise<void> {
|
||||||
|
return await invoke("send_char", { c });
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function add_decoders(decoder_paths: Array<DecoderPath>): Promise<AddedDecodersCount> {
|
||||||
|
return await invoke("add_decoders", { decoder_paths });
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function remove_all_decoders(): Promise<RemovedDecodersCount> {
|
||||||
|
return await invoke("remove_all_decoders");
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function add_diagram_connectors(diagram_connector_paths: Array<DiagramConnectorPath>): Promise<AddedDiagramConnectorsCount> {
|
||||||
|
return await invoke("add_diagram_connectors", { diagram_connector_paths });
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function remove_all_diagram_connectors(): Promise<RemovedDiagramConnectorsCount> {
|
||||||
|
return await invoke("remove_all_diagram_connectors");
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function listen_diagram_connectors_messages(on_message: (message: any) => void) {
|
||||||
|
return await listen("diagram_connector_message", (message) => on_message(message.payload));
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function listen_term_update(on_message: (message: any) => void) {
|
||||||
|
return await listen("term_content", (message) => on_message(message.payload));
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function notify_diagram_connector_text_change(diagram_connector: DiagramConnectorName, component_id: ComponentId, text: string): Promise<void> {
|
||||||
|
return await invoke("notify_diagram_connector_text_change", { diagram_connector, component_id, text });
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function open_konata_file() {
|
||||||
|
return await invoke("open_konata_file");
|
||||||
|
}
|
||||||
|
|