Add Iris Studio app
- Add the Electron studio (electron-vite, React, three) - Ignore node_modules and build output under studio/
No files matched your search
@@ -0,0 +1,4 @@
|
||||
node_modules/
|
||||
out/
|
||||
dist/
|
||||
*.log
|
||||
@@ -0,0 +1,518 @@
|
||||
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.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
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>.
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"$schema": "https://ui.shadcn.com/schema.json",
|
||||
"style": "new-york",
|
||||
"rsc": false,
|
||||
"tsx": true,
|
||||
"tailwind": {
|
||||
"config": "",
|
||||
"css": "src/renderer/src/styles.css",
|
||||
"baseColor": "neutral",
|
||||
"cssVariables": true,
|
||||
"prefix": ""
|
||||
},
|
||||
"aliases": {
|
||||
"components": "@/components",
|
||||
"utils": "@/lib/utils",
|
||||
"ui": "@/components/ui",
|
||||
"lib": "@/lib",
|
||||
"hooks": "@/hooks"
|
||||
},
|
||||
"iconLibrary": "lucide"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { resolve } from 'node:path'
|
||||
import { defineConfig } from 'electron-vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
|
||||
export default defineConfig({
|
||||
main: {},
|
||||
preload: {
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: { format: 'cjs', entryFileNames: '[name].cjs' }
|
||||
}
|
||||
}
|
||||
},
|
||||
renderer: {
|
||||
resolve: {
|
||||
alias: { '@': resolve(import.meta.dirname, 'src/renderer/src') }
|
||||
},
|
||||
plugins: [react(), tailwindcss()]
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "iris-studio",
|
||||
"productName": "Iris Studio",
|
||||
"version": "0.1.0",
|
||||
"description": "The studio app for Iris worlds: maps, objects and editors, connected to a running server",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "out/main/index.js",
|
||||
"scripts": {
|
||||
"dev": "electron-vite dev",
|
||||
"build": "electron-vite build",
|
||||
"start": "electron-vite preview",
|
||||
"typecheck": "tsc --noEmit -p tsconfig.json",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/vite": "^4.3.4",
|
||||
"@types/node": "^26.6.6",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"@types/three": "^0.187.0",
|
||||
"@vitejs/plugin-react": "^6.2.1",
|
||||
"electron": "^45.2.3",
|
||||
"electron-vite": "^6.0.0",
|
||||
"tailwindcss": "^4.3.4",
|
||||
"typescript": "^7.0.2",
|
||||
"vite": "^8.3.6",
|
||||
"vitest": "^5.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"cn": "^0.5.2",
|
||||
"radix-ui": "^1.8.1",
|
||||
"react": "^19.3.1",
|
||||
"react-dom": "^19.3.1",
|
||||
"tailwind-merge": "^3.7.0",
|
||||
"three": "^0.187.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
import { existsSync, readdirSync, readFileSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
|
||||
const NVIDIA_VENDOR_ID = '0x10de'
|
||||
const DRM_FOLDER = '/sys/class/drm'
|
||||
const RENDER_NODE_PREFIX = 'renderD'
|
||||
// Where the Vulkan loader looks for drivers, NixOS's first.
|
||||
const VULKAN_DRIVER_FOLDERS = ['/run/opengl-driver/share/vulkan/icd.d', '/usr/share/vulkan/icd.d', '/etc/vulkan/icd.d']
|
||||
const NVIDIA_VULKAN_DRIVER_PREFIX = 'nvidia_icd'
|
||||
const VULKAN_DRIVER_VARIABLES = ['VK_DRIVER_FILES', 'VK_ICD_FILENAMES']
|
||||
|
||||
/**
|
||||
* Chromium on Wayland hands the desktop buffers made on the GPU it draws with, and a desktop that composites on the
|
||||
* integrated GPU cannot show buffers of an NVIDIA GPU: the window stays empty. Through XWayland with Chromium drawing
|
||||
* on Vulkan, NVIDIA's Vulkan driver copies each frame to the integrated GPU itself, as it does for games.
|
||||
*/
|
||||
export const DEDICATED_GPU_SWITCHES = ['--ozone-platform=x11', '--use-angle=vulkan', '--enable-features=Vulkan,VulkanFromANGLE,DefaultANGLEVulkan']
|
||||
|
||||
/** NVIDIA's Vulkan driver file on a Linux machine with an NVIDIA GPU; null where there is no such GPU or driver. */
|
||||
export function dedicatedGpuDriver(): string | null {
|
||||
if (process.platform !== 'linux' || !hasNvidiaGpu()) {
|
||||
return null
|
||||
}
|
||||
for (const folder of VULKAN_DRIVER_FOLDERS) {
|
||||
const driver = driverIn(folder)
|
||||
if (driver !== null) {
|
||||
return driver
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/** Shows Chromium only the given Vulkan driver, so it draws on that driver's GPU. */
|
||||
export function showOnlyVulkanDriver(env: NodeJS.ProcessEnv, driver: string): void {
|
||||
for (const variable of VULKAN_DRIVER_VARIABLES) {
|
||||
env[variable] = driver
|
||||
}
|
||||
}
|
||||
|
||||
export function showEveryVulkanDriver(env: NodeJS.ProcessEnv): void {
|
||||
for (const variable of VULKAN_DRIVER_VARIABLES) {
|
||||
delete env[variable]
|
||||
}
|
||||
}
|
||||
|
||||
export function runsOnDedicatedGpu(argv: string[]): boolean {
|
||||
return DEDICATED_GPU_SWITCHES.every((option) => argv.includes(option))
|
||||
}
|
||||
|
||||
/** The arguments with the dedicated GPU's switches in place of any the studio was started with under the same names. */
|
||||
export function withDedicatedGpuSwitches(argv: string[]): string[] {
|
||||
const names = DEDICATED_GPU_SWITCHES.map(switchName)
|
||||
return [...argv.filter((option) => !names.includes(switchName(option))), ...DEDICATED_GPU_SWITCHES]
|
||||
}
|
||||
|
||||
export function withoutDedicatedGpuSwitches(argv: string[]): string[] {
|
||||
return argv.filter((option) => !DEDICATED_GPU_SWITCHES.includes(option))
|
||||
}
|
||||
|
||||
function switchName(option: string): string {
|
||||
return option.split('=')[0]
|
||||
}
|
||||
|
||||
function hasNvidiaGpu(): boolean {
|
||||
try {
|
||||
return readdirSync(DRM_FOLDER)
|
||||
.filter((name) => name.startsWith(RENDER_NODE_PREFIX))
|
||||
.some((name) => readFileSync(join(DRM_FOLDER, name, 'device', 'vendor'), 'utf8').trim() === NVIDIA_VENDOR_ID)
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function driverIn(folder: string): string | null {
|
||||
if (!existsSync(folder)) {
|
||||
return null
|
||||
}
|
||||
const file = readdirSync(folder).find((name) => name.startsWith(NVIDIA_VULKAN_DRIVER_PREFIX))
|
||||
return file === undefined ? null : join(folder, file)
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
import { app, BrowserWindow, clipboard, ipcMain, nativeTheme, shell } from 'electron'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { mkdir, readdir, readFile, writeFile } from 'node:fs/promises'
|
||||
import { homedir } from 'node:os'
|
||||
import { dirname, join } from 'node:path'
|
||||
import type { BridgeConnection, GraphicsInfo, StoredShortcuts, ThemeChoice } from '../shared/bridge'
|
||||
import {
|
||||
dedicatedGpuDriver,
|
||||
runsOnDedicatedGpu,
|
||||
showEveryVulkanDriver,
|
||||
showOnlyVulkanDriver,
|
||||
withDedicatedGpuSwitches,
|
||||
withoutDedicatedGpuSwitches
|
||||
} from './dedicatedGpu'
|
||||
|
||||
const CONNECTION_FOLDER = join(homedir(), '.iris', 'studio', 'bridges')
|
||||
const SETTINGS_FILE = 'studio.json'
|
||||
const SHORTCUTS_KEY = 'shortcuts'
|
||||
const DEDICATED_GPU_KEY = 'dedicatedGpu'
|
||||
const SETTINGS_INDENT = 2
|
||||
const LINK_PREFIX = 'iris-studio://'
|
||||
const DARK_BACKGROUND = '#1e1f22'
|
||||
const WINDOW_SIZE = { width: 1440, height: 880, minWidth: 820, minHeight: 520 }
|
||||
|
||||
let window: BrowserWindow | null = null
|
||||
let pendingLink: string | null = findLink(process.argv)
|
||||
const dedicatedGpu = dedicatedGpuDriver()
|
||||
|
||||
function findLink(argv: string[]): string | null {
|
||||
return argv.find((argument) => argument.startsWith(LINK_PREFIX)) ?? null
|
||||
}
|
||||
|
||||
function isRunning(pid: unknown): boolean {
|
||||
if (typeof pid !== 'number') {
|
||||
return true
|
||||
}
|
||||
try {
|
||||
process.kill(pid, 0)
|
||||
return true
|
||||
} catch (error) {
|
||||
return (error as NodeJS.ErrnoException).code === 'EPERM'
|
||||
}
|
||||
}
|
||||
|
||||
/** The bridges announced on this machine whose server still runs, newest first. */
|
||||
async function listBridges(): Promise<BridgeConnection[]> {
|
||||
let files: string[]
|
||||
try {
|
||||
files = (await readdir(CONNECTION_FOLDER)).filter((name) => name.endsWith('.json'))
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
const bridges = await Promise.all(files.map(readConnection))
|
||||
return bridges
|
||||
.filter((bridge): bridge is BridgeConnection => bridge !== null)
|
||||
.sort((first, second) => (second.startedMillis ?? 0) - (first.startedMillis ?? 0))
|
||||
}
|
||||
|
||||
async function readConnection(name: string): Promise<BridgeConnection | null> {
|
||||
try {
|
||||
const file = JSON.parse(await readFile(join(CONNECTION_FOLDER, name), 'utf8'))
|
||||
if (!isRunning(file.pid) || typeof file.port !== 'number' || typeof file.token !== 'string') {
|
||||
return null
|
||||
}
|
||||
return { world: String(file.world ?? ''), port: file.port, token: file.token, startedMillis: file.startedMillis }
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
function settingsPath(): string {
|
||||
return join(app.getPath('userData'), SETTINGS_FILE)
|
||||
}
|
||||
|
||||
async function readSettings(): Promise<Record<string, unknown>> {
|
||||
try {
|
||||
const settings: unknown = JSON.parse(await readFile(settingsPath(), 'utf8'))
|
||||
return typeof settings === 'object' && settings !== null && !Array.isArray(settings) ? (settings as Record<string, unknown>) : {}
|
||||
} catch {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
async function saveSetting(key: string, value: unknown): Promise<void> {
|
||||
try {
|
||||
const settings = { ...(await readSettings()), [key]: value }
|
||||
await mkdir(dirname(settingsPath()), { recursive: true })
|
||||
await writeFile(settingsPath(), JSON.stringify(settings, null, SETTINGS_INDENT))
|
||||
} catch (failure) {
|
||||
console.error(`Could not save the studio setting ${key} to ${settingsPath()}`, failure)
|
||||
}
|
||||
}
|
||||
|
||||
/** Read before the app is ready, as the GPU the studio draws on is chosen by how it was started. */
|
||||
function choosesDedicatedGpu(): boolean {
|
||||
try {
|
||||
const settings: unknown = JSON.parse(readFileSync(settingsPath(), 'utf8'))
|
||||
return typeof settings === 'object' && settings !== null && (settings as Record<string, unknown>)[DEDICATED_GPU_KEY] === true
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function restartOnGpu(dedicated: boolean): void {
|
||||
const args = process.argv.slice(1)
|
||||
if (dedicated && dedicatedGpu !== null) {
|
||||
showOnlyVulkanDriver(process.env, dedicatedGpu)
|
||||
app.relaunch({ args: withDedicatedGpuSwitches(args) })
|
||||
} else {
|
||||
showEveryVulkanDriver(process.env)
|
||||
app.relaunch({ args: withoutDedicatedGpuSwitches(args) })
|
||||
}
|
||||
app.exit(0)
|
||||
}
|
||||
|
||||
async function useDedicatedGpu(dedicated: boolean): Promise<void> {
|
||||
await saveSetting(DEDICATED_GPU_KEY, dedicated)
|
||||
restartOnGpu(dedicated)
|
||||
}
|
||||
|
||||
function graphicsInfo(): GraphicsInfo {
|
||||
return { canUseDedicatedGpu: dedicatedGpu !== null, usesDedicatedGpu: runsOnDedicatedGpu(process.argv) }
|
||||
}
|
||||
|
||||
function createWindow(): void {
|
||||
window = new BrowserWindow({
|
||||
...WINDOW_SIZE,
|
||||
title: 'Iris Studio',
|
||||
backgroundColor: DARK_BACKGROUND,
|
||||
autoHideMenuBar: true,
|
||||
show: false,
|
||||
webPreferences: {
|
||||
preload: join(import.meta.dirname, '../preload/index.cjs'),
|
||||
sandbox: true,
|
||||
contextIsolation: true
|
||||
}
|
||||
})
|
||||
window.once('ready-to-show', () => window?.show())
|
||||
window.webContents.setWindowOpenHandler(({ url }) => {
|
||||
void shell.openExternal(url)
|
||||
return { action: 'deny' }
|
||||
})
|
||||
if (process.env.ELECTRON_RENDERER_URL) {
|
||||
void window.loadURL(process.env.ELECTRON_RENDERER_URL)
|
||||
} else {
|
||||
void window.loadFile(join(import.meta.dirname, '../renderer/index.html'))
|
||||
}
|
||||
}
|
||||
|
||||
function deliverLink(link: string): void {
|
||||
if (window === null) {
|
||||
pendingLink = link
|
||||
return
|
||||
}
|
||||
window.webContents.send('studio:link', link)
|
||||
if (window.isMinimized()) {
|
||||
window.restore()
|
||||
}
|
||||
window.focus()
|
||||
}
|
||||
|
||||
if (dedicatedGpu !== null && choosesDedicatedGpu() && !runsOnDedicatedGpu(process.argv)) {
|
||||
restartOnGpu(true)
|
||||
} else if (!app.requestSingleInstanceLock()) {
|
||||
app.quit()
|
||||
} else {
|
||||
app.setAsDefaultProtocolClient('iris-studio')
|
||||
app.on('second-instance', (_event, argv) => {
|
||||
const link = findLink(argv)
|
||||
if (link !== null) {
|
||||
deliverLink(link)
|
||||
} else {
|
||||
window?.focus()
|
||||
}
|
||||
})
|
||||
app.on('open-url', (event, url) => {
|
||||
event.preventDefault()
|
||||
deliverLink(url)
|
||||
})
|
||||
|
||||
ipcMain.handle('studio:list-bridges', listBridges)
|
||||
ipcMain.handle('studio:initial-link', () => {
|
||||
const link = pendingLink
|
||||
pendingLink = null
|
||||
return link
|
||||
})
|
||||
ipcMain.on('studio:set-theme', (_event, theme: ThemeChoice) => {
|
||||
nativeTheme.themeSource = theme
|
||||
})
|
||||
ipcMain.handle('studio:load-shortcuts', async () => (await readSettings())[SHORTCUTS_KEY] ?? {})
|
||||
ipcMain.on('studio:save-shortcuts', (_event, shortcuts: StoredShortcuts) => void saveSetting(SHORTCUTS_KEY, shortcuts))
|
||||
ipcMain.handle('studio:graphics', graphicsInfo)
|
||||
ipcMain.on('studio:use-dedicated-gpu', (_event, dedicated: boolean) => void useDedicatedGpu(dedicated))
|
||||
ipcMain.on('studio:copy-text', (_event, text: string) => clipboard.writeText(text))
|
||||
|
||||
void app.whenReady().then(createWindow)
|
||||
app.on('window-all-closed', () => app.quit())
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { contextBridge, ipcRenderer, type IpcRendererEvent } from 'electron'
|
||||
import type { StoredShortcuts, StudioHost, ThemeChoice } from '../shared/bridge'
|
||||
|
||||
const host: StudioHost = {
|
||||
listBridges: () => ipcRenderer.invoke('studio:list-bridges'),
|
||||
initialLink: () => ipcRenderer.invoke('studio:initial-link'),
|
||||
onLink: (listener) => {
|
||||
const forward = (_event: IpcRendererEvent, link: string): void => listener(link)
|
||||
ipcRenderer.on('studio:link', forward)
|
||||
return () => ipcRenderer.removeListener('studio:link', forward)
|
||||
},
|
||||
setTheme: (theme: ThemeChoice) => ipcRenderer.send('studio:set-theme', theme),
|
||||
copyText: (text: string) => ipcRenderer.send('studio:copy-text', text),
|
||||
loadShortcuts: () => ipcRenderer.invoke('studio:load-shortcuts'),
|
||||
saveShortcuts: (shortcuts: StoredShortcuts) => ipcRenderer.send('studio:save-shortcuts', shortcuts),
|
||||
graphics: () => ipcRenderer.invoke('studio:graphics'),
|
||||
useDedicatedGpu: (dedicated: boolean) => ipcRenderer.send('studio:use-dedicated-gpu', dedicated)
|
||||
}
|
||||
|
||||
contextBridge.exposeInMainWorld('studio', host)
|
||||
@@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; connect-src 'self' http://127.0.0.1:* ws://localhost:*; img-src 'self' data: blob:; style-src 'self' 'unsafe-inline'"
|
||||
/>
|
||||
<title>Iris Studio</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,68 @@
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { parseStudioLink, type BridgeConnection } from '../../shared/bridge'
|
||||
import { BridgeClient } from './bridge/BridgeClient'
|
||||
import type { WorldInfo } from './bridge/types'
|
||||
import { ConnectScreen } from './studio/ConnectScreen'
|
||||
import { MapStudio } from './studio/MapStudio'
|
||||
import { useTheme } from './studio/theme'
|
||||
import { shortcutStore } from './studio/useBindings'
|
||||
|
||||
interface Session {
|
||||
client: BridgeClient
|
||||
world: WorldInfo
|
||||
}
|
||||
|
||||
/** The studio: a connect screen until a bridge answers, then the map of its world. */
|
||||
export function App(): React.JSX.Element {
|
||||
const theme = useTheme()
|
||||
const [session, setSession] = useState<Session | null>(null)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [connecting, setConnecting] = useState(false)
|
||||
|
||||
const connect = useCallback(async (connection: BridgeConnection) => {
|
||||
setConnecting(true)
|
||||
setError(null)
|
||||
const client = new BridgeClient(connection)
|
||||
try {
|
||||
setSession({ client, world: await client.world() })
|
||||
} catch (failure) {
|
||||
setError(failure instanceof Error ? failure.message : String(failure))
|
||||
} finally {
|
||||
setConnecting(false)
|
||||
}
|
||||
}, [])
|
||||
|
||||
const connectLink = useCallback(
|
||||
(link: string) => {
|
||||
const connection = parseStudioLink(link)
|
||||
if (connection === null) {
|
||||
setError('That is not a studio link')
|
||||
return
|
||||
}
|
||||
void connect(connection)
|
||||
},
|
||||
[connect]
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
void shortcutStore.load()
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
void window.studio.initialLink().then((link) => link !== null && connectLink(link))
|
||||
return window.studio.onLink(connectLink)
|
||||
}, [connectLink])
|
||||
|
||||
if (session === null) {
|
||||
return <ConnectScreen connecting={connecting} error={error} onConnect={connect} onLink={connectLink} />
|
||||
}
|
||||
return (
|
||||
<MapStudio
|
||||
key={`${session.client.connection.port}`}
|
||||
client={session.client}
|
||||
world={session.world}
|
||||
theme={theme}
|
||||
onDisconnect={() => setSession(null)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,391 @@
|
||||
import type { BridgeConnection } from '../../../shared/bridge'
|
||||
import { decodeScene, type BlockScene } from '../scene/sceneDecoding'
|
||||
import { decodePattern } from './patternDecoding'
|
||||
import { decodeSavedTile } from './savedTileDecoding'
|
||||
import { decodeTile } from './tileDecoding'
|
||||
import type {
|
||||
BakeRun,
|
||||
BlockSource,
|
||||
EditorState,
|
||||
GraphEdit,
|
||||
MapHover,
|
||||
MapLabel,
|
||||
MapTile,
|
||||
Marker,
|
||||
ModuleViewInfo,
|
||||
NoiseSource,
|
||||
NoiseTile,
|
||||
PatternEntry,
|
||||
PatternTile,
|
||||
PickInspection,
|
||||
SavedStart,
|
||||
SavedTile,
|
||||
SavedWorldInfo,
|
||||
SceneEntry,
|
||||
SceneViewInfo,
|
||||
ServerUsage,
|
||||
WorldInfo
|
||||
} from './types'
|
||||
|
||||
export const STATUS_NOT_FOUND = 404
|
||||
export const STATUS_CONFLICT = 409
|
||||
export const STATUS_UNAVAILABLE = 503
|
||||
|
||||
export class BridgeError extends Error {
|
||||
constructor(
|
||||
readonly status: number,
|
||||
message: string
|
||||
) {
|
||||
super(message)
|
||||
}
|
||||
}
|
||||
|
||||
/** Which scene of a scene view: an entry's variant, at one of the view's sizes or null when it has none. */
|
||||
export interface ScenePlace {
|
||||
key: string
|
||||
variant: number
|
||||
size: number | null
|
||||
}
|
||||
|
||||
export interface TileRequest {
|
||||
view: string
|
||||
/** The region the region view previews everywhere, or null for the world as it is. */
|
||||
preview: string | null
|
||||
tileX: number
|
||||
tileZ: number
|
||||
blocksPerPixel: number
|
||||
size: number
|
||||
heights: boolean
|
||||
pickNoise: boolean
|
||||
/** Where the tile's blocks come from, or null for a tile without them. */
|
||||
blocks: BlockSource | null
|
||||
/**
|
||||
* Whether a tile with blocks also carries the ground's shape in 3D: every block seen from the open air at a block a
|
||||
* pixel, the runs of solid blocks of each cell's area when coarser.
|
||||
*/
|
||||
shape?: boolean
|
||||
}
|
||||
|
||||
/** One tile of a pattern: tile (x, z) covers columns × blocksPerColumn blocks from x × that, z × that. */
|
||||
export interface PatternRequest {
|
||||
viewId: string
|
||||
key: string
|
||||
depth: number
|
||||
tileX: number
|
||||
tileZ: number
|
||||
blocksPerColumn: number
|
||||
columns: number
|
||||
}
|
||||
|
||||
/** What a map spot or area is asked about: a view, and the region it previews. */
|
||||
export interface MapLayerQuery {
|
||||
view: string
|
||||
preview: string | null
|
||||
}
|
||||
|
||||
export interface WorldRect {
|
||||
minX: number
|
||||
minZ: number
|
||||
maxX: number
|
||||
maxZ: number
|
||||
}
|
||||
|
||||
export interface BridgeEvents {
|
||||
onWorld(running: boolean): void
|
||||
onPlayers(players: Marker[]): void
|
||||
onUsage(usage: ServerUsage): void
|
||||
onClosed(): void
|
||||
}
|
||||
|
||||
const EVENT_SEPARATOR = '\n\n'
|
||||
|
||||
/** One connection to a world's bridge, over HTTP on the loopback interface. */
|
||||
export class BridgeClient {
|
||||
private readonly base: string
|
||||
private readonly authorization: string
|
||||
|
||||
constructor(readonly connection: BridgeConnection) {
|
||||
this.base = `http://127.0.0.1:${connection.port}/v1/`
|
||||
this.authorization = `Bearer ${connection.token}`
|
||||
}
|
||||
|
||||
world(): Promise<WorldInfo> {
|
||||
return this.json('world')
|
||||
}
|
||||
|
||||
hover(layer: MapLayerQuery, worldX: number, worldZ: number, signal?: AbortSignal): Promise<MapHover> {
|
||||
return this.json(`hover?${layerQuery(layer, { x: String(worldX), z: String(worldZ) })}`, { signal })
|
||||
}
|
||||
|
||||
/** How the noise picks what the layer shows across {@code area}. */
|
||||
picks(layer: MapLayerQuery, area: WorldRect, signal?: AbortSignal): Promise<PickInspection> {
|
||||
const corners = { minX: String(area.minX), minZ: String(area.minZ), maxX: String(area.maxX), maxZ: String(area.maxZ) }
|
||||
return this.json(`picks?${layerQuery(layer, corners)}`, { signal })
|
||||
}
|
||||
|
||||
/** The regions the world picks biomes for, which the region view can preview. */
|
||||
regions(): Promise<MapLabel[]> {
|
||||
return this.json('regions')
|
||||
}
|
||||
|
||||
entities(): Promise<Marker[]> {
|
||||
return this.json('entities')
|
||||
}
|
||||
|
||||
async teleport(worldX: number, worldZ: number): Promise<void> {
|
||||
await this.json(`teleport?x=${worldX}&z=${worldZ}`, { method: 'POST' })
|
||||
}
|
||||
|
||||
/** Opens the file of the biome or region at a spot on the server's machine; the server's answer, if any. */
|
||||
async openInEditor(worldX: number, worldZ: number, view: string): Promise<string | null> {
|
||||
const answer = await this.json<{ message: string | null }>(`open?x=${worldX}&z=${worldZ}&view=${view}`, { method: 'POST' })
|
||||
return answer.message
|
||||
}
|
||||
|
||||
async tile(request: TileRequest, signal: AbortSignal): Promise<MapTile> {
|
||||
const query = layerQuery(request, {
|
||||
x: String(request.tileX),
|
||||
z: String(request.tileZ),
|
||||
scale: String(request.blocksPerPixel),
|
||||
size: String(request.size),
|
||||
heights: request.heights ? '1' : '0',
|
||||
noise: request.pickNoise ? '1' : '0'
|
||||
})
|
||||
if (request.blocks !== null) {
|
||||
query.set('blocks', request.blocks)
|
||||
if (request.shape === true) {
|
||||
query.set('shape', '1')
|
||||
}
|
||||
this.cancelOnAbort(query, signal)
|
||||
}
|
||||
const response = await this.fetch(`tile?${query}`, { signal })
|
||||
return decodeTile(await response.arrayBuffer())
|
||||
}
|
||||
|
||||
// A tile with blocks can keep the server generating chunks for a minute; dropping the request alone would not stop it.
|
||||
private cancelOnAbort(query: URLSearchParams, signal: AbortSignal): void {
|
||||
const request = crypto.randomUUID()
|
||||
query.set('request', request)
|
||||
signal.addEventListener('abort', () => void this.fetch(`tile-cancel?${new URLSearchParams({ request })}`, { method: 'POST' }).catch(() => {}), { once: true })
|
||||
}
|
||||
|
||||
/** The scene views the pack's modules show, such as its objects. */
|
||||
sceneViews(): Promise<SceneViewInfo[]> {
|
||||
return this.json('scenes')
|
||||
}
|
||||
|
||||
/** An editable entry's file, as nodes. */
|
||||
sceneFile(viewId: string, key: string, signal?: AbortSignal): Promise<EditorState> {
|
||||
return this.json(`scene-file?${new URLSearchParams({ view: viewId, key })}`, { signal })
|
||||
}
|
||||
|
||||
/** Makes {@code edit} on the file as it was at {@code revision} and saves it; refused with STATUS_CONFLICT when it changed since. */
|
||||
sceneEdit(viewId: string, key: string, revision: string, edit: GraphEdit): Promise<EditorState> {
|
||||
return this.json(`scene-edit?${new URLSearchParams({ view: viewId, key })}`, { method: 'POST', body: JSON.stringify({ revision, edit }) })
|
||||
}
|
||||
|
||||
/** Replaces the whole file, as undoing does; refused with STATUS_CONFLICT when it changed since {@code revision}. */
|
||||
sceneWrite(viewId: string, key: string, revision: string, text: string): Promise<EditorState> {
|
||||
return this.json(`scene-write?${new URLSearchParams({ view: viewId, key })}`, { method: 'POST', body: JSON.stringify({ revision, text }) })
|
||||
}
|
||||
|
||||
/** Writes a new entry from its view's starter; it is listed once the pack has reloaded. Refused when the key can't name a new one. */
|
||||
async sceneCreate(viewId: string, key: string): Promise<void> {
|
||||
await this.json(`scene-create?${new URLSearchParams({ view: viewId, key })}`, { method: 'POST' })
|
||||
}
|
||||
|
||||
/** The pack files that still name the entry, such as the biomes that place it. */
|
||||
async sceneUses(viewId: string, key: string): Promise<string[]> {
|
||||
const uses = await this.json<{ files: string[] }>(`scene-uses?${new URLSearchParams({ view: viewId, key })}`)
|
||||
return uses.files
|
||||
}
|
||||
|
||||
/** Moves the entry's file to the trash; says where it went. */
|
||||
async sceneDelete(viewId: string, key: string): Promise<string> {
|
||||
const trashed = await this.json<{ to: string }>(`scene-delete?${new URLSearchParams({ view: viewId, key })}`, { method: 'POST' })
|
||||
return trashed.to
|
||||
}
|
||||
|
||||
/** What a setting naming an entry of a platform registry (reference) or a resource of the pack (resource) may be typed as, sorted. */
|
||||
suggestions(of: { reference: string } | { resource: string }): Promise<string[]> {
|
||||
return this.json(`suggestions?${new URLSearchParams(of)}`)
|
||||
}
|
||||
|
||||
sceneEntries(viewId: string): Promise<SceneEntry[]> {
|
||||
return this.json(`scene-entries?${new URLSearchParams({ view: viewId })}`)
|
||||
}
|
||||
|
||||
/** Bakes the entry once more and times each step; one run of the median the studio shows. */
|
||||
sceneBake(viewId: string, key: string, signal?: AbortSignal): Promise<BakeRun> {
|
||||
return this.json(`scene-bake?${new URLSearchParams({ view: viewId, key })}`, { signal })
|
||||
}
|
||||
|
||||
async scene(viewId: string, place: ScenePlace, signal?: AbortSignal): Promise<BlockScene> {
|
||||
const response = await this.fetch(`scene?${sceneQuery(viewId, place)}`, { signal })
|
||||
return decodeScene(await response.arrayBuffer())
|
||||
}
|
||||
|
||||
/** The part that placed each block of {@link scene}, in the same order, or NO_PART; baked again on the server to find out. */
|
||||
async sceneParts(viewId: string, place: ScenePlace, signal?: AbortSignal): Promise<Int32Array> {
|
||||
const response = await this.fetch(`scene-parts?${sceneQuery(viewId, place)}`, { signal })
|
||||
return new Int32Array(await response.arrayBuffer())
|
||||
}
|
||||
|
||||
/**
|
||||
* The caves of the world's generated chunks over a square {@code size} blocks across around a spot: every air block
|
||||
* under the terrain, drawn as blocks coloured by height. Every chunk of the square is generated, which takes seconds.
|
||||
*/
|
||||
async caves(centerX: number, centerZ: number, size: number, signal: AbortSignal): Promise<BlockScene> {
|
||||
const query = new URLSearchParams({ x: String(Math.round(centerX)), z: String(Math.round(centerZ)), size: String(size) })
|
||||
this.cancelOnAbort(query, signal)
|
||||
const response = await this.fetch(`caves?${query}`, { signal })
|
||||
return decodeScene(await response.arrayBuffer())
|
||||
}
|
||||
|
||||
/** The pattern views the pack's modules show, such as its palettes. */
|
||||
patternViews(): Promise<ModuleViewInfo[]> {
|
||||
return this.json('patterns')
|
||||
}
|
||||
|
||||
patternEntries(viewId: string): Promise<PatternEntry[]> {
|
||||
return this.json(`pattern-entries?${new URLSearchParams({ view: viewId })}`)
|
||||
}
|
||||
|
||||
/** What an entry places at {@code depth} below the top across one tile, a column every {@code blocksPerColumn} blocks. */
|
||||
async pattern(request: PatternRequest, signal: AbortSignal): Promise<PatternTile> {
|
||||
const query = new URLSearchParams({
|
||||
view: request.viewId,
|
||||
key: request.key,
|
||||
depth: String(request.depth),
|
||||
x: String(request.tileX),
|
||||
z: String(request.tileZ),
|
||||
scale: String(request.blocksPerColumn),
|
||||
size: String(request.columns)
|
||||
})
|
||||
const response = await this.fetch(`pattern?${query}`, { signal })
|
||||
return decodePattern(await response.arrayBuffer())
|
||||
}
|
||||
|
||||
/** The worlds saved on the server's disk. */
|
||||
savedWorlds(): Promise<SavedWorldInfo[]> {
|
||||
return this.json('saved-worlds')
|
||||
}
|
||||
|
||||
/** Where a saved world's view opens; reads the region nearest the origin whole, so it can take a second or two. */
|
||||
savedStart(worldId: string, signal?: AbortSignal): Promise<SavedStart> {
|
||||
return this.json(`saved-start?${new URLSearchParams({ world: worldId })}`, { signal })
|
||||
}
|
||||
|
||||
async savedTile(worldId: string, tileX: number, tileZ: number, blocksPerPixel: number, size: number, signal: AbortSignal): Promise<SavedTile> {
|
||||
const query = new URLSearchParams({ world: worldId, x: String(tileX), z: String(tileZ), scale: String(blocksPerPixel), size: String(size) })
|
||||
const response = await this.fetch(`saved-tile?${query}`, { signal })
|
||||
return decodeSavedTile(await response.arrayBuffer())
|
||||
}
|
||||
|
||||
/** The pack's generators and expressions, the dimension's overlay noise, and the built-in noise styles. */
|
||||
noiseSources(): Promise<NoiseSource[]> {
|
||||
return this.json('noise-sources')
|
||||
}
|
||||
|
||||
async noiseTile(sourceId: string, seed: string, tileX: number, tileZ: number, blocksPerPixel: number, size: number, signal: AbortSignal): Promise<NoiseTile> {
|
||||
const query = new URLSearchParams({ source: sourceId, seed, x: String(tileX), z: String(tileZ), scale: String(blocksPerPixel), size: String(size) })
|
||||
const response = await this.fetch(`noise-tile?${query}`, { signal })
|
||||
return { size, values: new Float32Array(await response.arrayBuffer()) }
|
||||
}
|
||||
|
||||
/** A file of the Minecraft client's assets, such as {@code minecraft/blockstates/stone.json}; null when there is none. */
|
||||
async asset(path: string): Promise<Response | null> {
|
||||
try {
|
||||
return await this.fetch(`assets/${path}`, {})
|
||||
} catch (error) {
|
||||
if (error instanceof BridgeError && error.status === STATUS_NOT_FOUND) {
|
||||
return null
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
/** Streams the bridge's events until {@code signal} aborts or the bridge goes away. */
|
||||
async listen(events: BridgeEvents, signal: AbortSignal): Promise<void> {
|
||||
try {
|
||||
const response = await this.fetch('events', { signal })
|
||||
const reader = response.body!.pipeThrough(new TextDecoderStream()).getReader()
|
||||
let pending = ''
|
||||
for (;;) {
|
||||
const { value, done } = await reader.read()
|
||||
if (done) {
|
||||
break
|
||||
}
|
||||
pending += value
|
||||
let end: number
|
||||
while ((end = pending.indexOf(EVENT_SEPARATOR)) >= 0) {
|
||||
dispatch(pending.slice(0, end), events)
|
||||
pending = pending.slice(end + EVENT_SEPARATOR.length)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (signal.aborted) {
|
||||
return
|
||||
}
|
||||
console.warn('Studio events stopped', error)
|
||||
}
|
||||
if (!signal.aborted) {
|
||||
events.onClosed()
|
||||
}
|
||||
}
|
||||
|
||||
private async json<T>(endpoint: string, init: RequestInit = {}): Promise<T> {
|
||||
const response = await this.fetch(endpoint, init)
|
||||
return (await response.json()) as T
|
||||
}
|
||||
|
||||
private async fetch(endpoint: string, init: RequestInit): Promise<Response> {
|
||||
const response = await fetch(this.base + endpoint, {
|
||||
...init,
|
||||
headers: { Authorization: this.authorization }
|
||||
})
|
||||
if (!response.ok) {
|
||||
const body = await response.json().catch(() => ({ error: response.statusText }))
|
||||
throw new BridgeError(response.status, String(body.error ?? response.statusText))
|
||||
}
|
||||
return response
|
||||
}
|
||||
}
|
||||
|
||||
function sceneQuery(viewId: string, place: ScenePlace): URLSearchParams {
|
||||
const query = new URLSearchParams({ view: viewId, key: place.key, variant: String(place.variant) })
|
||||
if (place.size !== null) {
|
||||
query.set('size', String(place.size))
|
||||
}
|
||||
return query
|
||||
}
|
||||
|
||||
function layerQuery(layer: MapLayerQuery, rest: Record<string, string>): URLSearchParams {
|
||||
const query = new URLSearchParams({ view: layer.view, ...rest })
|
||||
if (layer.preview !== null) {
|
||||
query.set('preview', layer.preview)
|
||||
}
|
||||
return query
|
||||
}
|
||||
|
||||
function dispatch(block: string, events: BridgeEvents): void {
|
||||
let name = 'message'
|
||||
let data = ''
|
||||
for (const line of block.split('\n')) {
|
||||
if (line.startsWith('event: ')) {
|
||||
name = line.slice('event: '.length)
|
||||
} else if (line.startsWith('data: ')) {
|
||||
data += line.slice('data: '.length)
|
||||
}
|
||||
}
|
||||
if (data === '') {
|
||||
return
|
||||
}
|
||||
if (name === 'world') {
|
||||
events.onWorld((JSON.parse(data) as { running: boolean }).running)
|
||||
} else if (name === 'players') {
|
||||
events.onPlayers(JSON.parse(data) as Marker[])
|
||||
} else if (name === 'usage') {
|
||||
events.onUsage(JSON.parse(data) as ServerUsage)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { decodePattern } from './patternDecoding'
|
||||
import { NO_PATTERN_BLOCK } from './types'
|
||||
|
||||
function encodedPattern(header: object, picks: number[]): ArrayBuffer {
|
||||
const headerBytes = new TextEncoder().encode(JSON.stringify(header))
|
||||
const picksAt = Math.ceil((4 + headerBytes.length) / 4) * 4
|
||||
const buffer = new ArrayBuffer(picksAt + picks.length * 2)
|
||||
const view = new DataView(buffer)
|
||||
view.setUint32(0, headerBytes.length, true)
|
||||
new Uint8Array(buffer, 4).set(headerBytes)
|
||||
picks.forEach((pick, index) => view.setInt16(picksAt + index * 2, pick, true))
|
||||
return buffer
|
||||
}
|
||||
|
||||
describe('decodePattern', () => {
|
||||
it('reads the picks after the padded header, row by row, with no block as -1', () => {
|
||||
const header = {
|
||||
columns: 2,
|
||||
blocksPerColumn: 4,
|
||||
blocks: ['minecraft:grass_block[snowy=false]', 'etopia:grass_block'],
|
||||
drawnAs: ['minecraft:grass_block[snowy=false]', 'minecraft:note_block[note=7]'],
|
||||
noBlock: -1
|
||||
}
|
||||
const pattern = decodePattern(encodedPattern(header, [0, -1, 1, 0]))
|
||||
expect(pattern.columns).toBe(2)
|
||||
expect(pattern.blocksPerColumn).toBe(4)
|
||||
expect(pattern.blocks).toEqual(header.blocks)
|
||||
expect(pattern.drawnAs).toEqual(header.drawnAs)
|
||||
expect([...pattern.picks]).toEqual([0, NO_PATTERN_BLOCK, 1, 0])
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,27 @@
|
||||
import type { PatternTile } from './types'
|
||||
|
||||
const ALIGNMENT_BYTES = 4
|
||||
|
||||
interface PatternHeader {
|
||||
columns: number
|
||||
blocksPerColumn: number
|
||||
blocks: string[]
|
||||
drawnAs: string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a pattern as the bridge writes it (PatternEncoding): a u32 header length, the JSON header, then from the next
|
||||
* multiple of 4 bytes an i16 pick per column, row by row. The picks are a view into the buffer, not a copy.
|
||||
*/
|
||||
export function decodePattern(buffer: ArrayBuffer): PatternTile {
|
||||
const headerLength = new DataView(buffer).getUint32(0, true)
|
||||
const header = JSON.parse(new TextDecoder().decode(new Uint8Array(buffer, 4, headerLength))) as PatternHeader
|
||||
const picksAt = Math.ceil((4 + headerLength) / ALIGNMENT_BYTES) * ALIGNMENT_BYTES
|
||||
return {
|
||||
columns: header.columns,
|
||||
blocksPerColumn: header.blocksPerColumn,
|
||||
blocks: header.blocks,
|
||||
drawnAs: header.drawnAs,
|
||||
picks: new Int16Array(buffer, picksAt, header.columns * header.columns)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import type { MapLabel, SavedTile } from './types'
|
||||
|
||||
const ALIGNMENT_BYTES = 4
|
||||
|
||||
interface SavedTileHeader {
|
||||
size: number
|
||||
blocksPerPixel: number
|
||||
blocks: { name: string; drawnAs: string }[]
|
||||
biomes: MapLabel[]
|
||||
noGround: number
|
||||
noWater: number
|
||||
}
|
||||
|
||||
function aligned(bytes: number): number {
|
||||
return Math.ceil(bytes / ALIGNMENT_BYTES) * ALIGNMENT_BYTES
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a saved tile as the bridge writes it (SavedTileEncoding): a u32 header length, the JSON header, then the ground,
|
||||
* water, block and biome grids, each starting on a multiple of 4 bytes. The grids are views into the buffer.
|
||||
*/
|
||||
export function decodeSavedTile(buffer: ArrayBuffer): SavedTile {
|
||||
const headerLength = new DataView(buffer).getUint32(0, true)
|
||||
const header = JSON.parse(new TextDecoder().decode(new Uint8Array(buffer, 4, headerLength))) as SavedTileHeader
|
||||
const pixels = header.size * header.size
|
||||
const gridBytes = aligned(pixels * Int16Array.BYTES_PER_ELEMENT)
|
||||
const gridAt = (index: number): Int16Array => new Int16Array(buffer, aligned(4 + headerLength) + index * gridBytes, pixels)
|
||||
return {
|
||||
size: header.size,
|
||||
blocksPerPixel: header.blocksPerPixel,
|
||||
groundY: gridAt(0),
|
||||
waterSurfaceY: gridAt(1),
|
||||
blocks: gridAt(2),
|
||||
biomes: gridAt(3),
|
||||
blockNames: header.blocks.map((block) => block.name),
|
||||
blocksDrawnAs: header.blocks.map((block) => block.drawnAs),
|
||||
biomeLabels: header.biomes,
|
||||
noGround: header.noGround,
|
||||
noWater: header.noWater
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
import type { LabelKind, MapLabel, MapTile, TileBlocks, TileRuns, TileVoxels } from './types'
|
||||
|
||||
const ALIGNMENT_BYTES = 4
|
||||
|
||||
interface TileHeader {
|
||||
size: number
|
||||
blocksPerPixel: number
|
||||
subjectKind: LabelKind
|
||||
labels: MapLabel[]
|
||||
heights: boolean
|
||||
pickNoise: boolean
|
||||
/** The blocks the ground and cover grids index; absent or null on a tile without them. */
|
||||
blocks?: string[] | null
|
||||
/** How many blocks are raised over the ground of all cells together. */
|
||||
raised?: number
|
||||
/** How many blocks can be seen from the open air, or -1 on a tile without them. */
|
||||
voxels?: number
|
||||
/** How many runs of solid blocks the cells have together, or -1 on a tile without them. */
|
||||
runs?: number
|
||||
}
|
||||
|
||||
const NONE = -1
|
||||
|
||||
function aligned(bytes: number): number {
|
||||
return Math.ceil(bytes / ALIGNMENT_BYTES) * ALIGNMENT_BYTES
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a tile as the bridge writes it (MapTileEncoding): a u32 header length, the JSON header, then the subject,
|
||||
* region, height, pick noise, ground, cover and raised block grids, each starting on a multiple of 4 bytes. The grids
|
||||
* are views into the buffer, not copies.
|
||||
*/
|
||||
export function decodeTile(buffer: ArrayBuffer): MapTile {
|
||||
const view = new DataView(buffer)
|
||||
const headerLength = view.getUint32(0, true)
|
||||
const header = JSON.parse(new TextDecoder().decode(new Uint8Array(buffer, 4, headerLength))) as TileHeader
|
||||
const gridSize = header.size + 2
|
||||
const cells = gridSize * gridSize
|
||||
const subjectsAt = aligned(4 + headerLength)
|
||||
const regionsAt = aligned(subjectsAt + cells * Int16Array.BYTES_PER_ELEMENT)
|
||||
const heightsAt = aligned(regionsAt + cells * Int16Array.BYTES_PER_ELEMENT)
|
||||
const pickNoiseAt = heightsAt + (header.heights ? cells * Float32Array.BYTES_PER_ELEMENT : 0)
|
||||
const groundAt = pickNoiseAt + (header.pickNoise ? cells * Float32Array.BYTES_PER_ELEMENT : 0)
|
||||
return {
|
||||
size: header.size,
|
||||
blocksPerPixel: header.blocksPerPixel,
|
||||
subjectKind: header.subjectKind,
|
||||
labels: header.labels,
|
||||
subjects: new Int16Array(buffer, subjectsAt, cells),
|
||||
regions: new Int16Array(buffer, regionsAt, cells),
|
||||
heights: header.heights ? new Float32Array(buffer, heightsAt, cells) : null,
|
||||
pickNoise: header.pickNoise ? new Float32Array(buffer, pickNoiseAt, cells) : null,
|
||||
blocks: header.blocks == null ? null : decodeBlocks(buffer, groundAt, cells, header.blocks, header.raised ?? 0, header.voxels ?? NONE, header.runs ?? NONE)
|
||||
}
|
||||
}
|
||||
|
||||
function decodeBlocks(buffer: ArrayBuffer, groundAt: number, cells: number, names: string[], raisedCount: number, voxelCount: number, runCount: number): TileBlocks {
|
||||
const gridBytes = aligned(cells * Int16Array.BYTES_PER_ELEMENT)
|
||||
const coverAt = groundAt + gridBytes
|
||||
const raisedCountsAt = coverAt + gridBytes
|
||||
const raisedYAt = raisedCountsAt + gridBytes
|
||||
const raisedAt = aligned(raisedYAt + raisedCount * Int16Array.BYTES_PER_ELEMENT)
|
||||
const voxelsAt = aligned(raisedAt + raisedCount * Int16Array.BYTES_PER_ELEMENT)
|
||||
const runsAt = voxelsAt + (voxelCount === NONE ? 0 : voxelBytes(voxelCount))
|
||||
return {
|
||||
names,
|
||||
ground: new Int16Array(buffer, groundAt, cells),
|
||||
cover: new Int16Array(buffer, coverAt, cells),
|
||||
raisedStart: startsOf(new Int16Array(buffer, raisedCountsAt, cells)),
|
||||
raisedY: new Int16Array(buffer, raisedYAt, raisedCount),
|
||||
raised: new Int16Array(buffer, raisedAt, raisedCount),
|
||||
voxels: voxelCount === NONE ? null : decodeVoxels(buffer, voxelsAt, voxelCount),
|
||||
runs: runCount === NONE ? null : decodeRuns(buffer, runsAt, cells, runCount),
|
||||
colors: [],
|
||||
looks: [],
|
||||
covers: [],
|
||||
models: []
|
||||
}
|
||||
}
|
||||
|
||||
function voxelBytes(count: number): number {
|
||||
return aligned(count) * 3 + aligned(count * Int16Array.BYTES_PER_ELEMENT) * 2
|
||||
}
|
||||
|
||||
function decodeRuns(buffer: ArrayBuffer, countsAt: number, cells: number, count: number): TileRuns {
|
||||
const bottomsAt = countsAt + aligned(cells * Int16Array.BYTES_PER_ELEMENT)
|
||||
const topsAt = bottomsAt + aligned(count * Int16Array.BYTES_PER_ELEMENT)
|
||||
const blocksAt = topsAt + aligned(count * Int16Array.BYTES_PER_ELEMENT)
|
||||
const coversAt = blocksAt + aligned(count * Int16Array.BYTES_PER_ELEMENT)
|
||||
const coverSharesAt = coversAt + aligned(count * Int16Array.BYTES_PER_ELEMENT)
|
||||
const lightsAt = coverSharesAt + aligned(count)
|
||||
const occlusionsAt = lightsAt + aligned(count)
|
||||
return {
|
||||
starts: startsOf(new Int16Array(buffer, countsAt, cells)),
|
||||
bottoms: new Int16Array(buffer, bottomsAt, count),
|
||||
tops: new Int16Array(buffer, topsAt, count),
|
||||
blocks: new Int16Array(buffer, blocksAt, count),
|
||||
covers: new Int16Array(buffer, coversAt, count),
|
||||
coverShares: new Uint8Array(buffer, coverSharesAt, count),
|
||||
lights: new Uint8Array(buffer, lightsAt, count),
|
||||
occlusions: new Uint8Array(buffer, occlusionsAt, count)
|
||||
}
|
||||
}
|
||||
|
||||
function decodeVoxels(buffer: ArrayBuffer, xAt: number, count: number): TileVoxels {
|
||||
const zAt = xAt + aligned(count)
|
||||
const yAt = zAt + aligned(count)
|
||||
const blocksAt = yAt + aligned(count * Int16Array.BYTES_PER_ELEMENT)
|
||||
const facesAt = blocksAt + aligned(count * Int16Array.BYTES_PER_ELEMENT)
|
||||
const lightsAt = facesAt + aligned(count)
|
||||
const shadesAt = lightsAt + aligned(count)
|
||||
const faces = new Uint8Array(buffer, facesAt, count)
|
||||
return {
|
||||
x: new Uint8Array(buffer, xAt, count),
|
||||
z: new Uint8Array(buffer, zAt, count),
|
||||
y: new Int16Array(buffer, yAt, count),
|
||||
blocks: new Int16Array(buffer, blocksAt, count),
|
||||
faces,
|
||||
lights: new Uint8Array(buffer, lightsAt, count),
|
||||
shades: new Uint16Array(buffer, shadesAt, facesShown(faces))
|
||||
}
|
||||
}
|
||||
|
||||
function facesShown(faces: Uint8Array): number {
|
||||
let shown = 0
|
||||
for (const sides of faces) {
|
||||
for (let rest = sides; rest !== 0; rest &= rest - 1) {
|
||||
shown++
|
||||
}
|
||||
}
|
||||
return shown
|
||||
}
|
||||
|
||||
function startsOf(counts: Int16Array): Int32Array {
|
||||
const starts = new Int32Array(counts.length + 1)
|
||||
for (let cell = 0; cell < counts.length; cell++) {
|
||||
starts[cell + 1] = starts[cell] + counts[cell]
|
||||
}
|
||||
return starts
|
||||
}
|
||||
|
||||
/** The grid index of a pixel; pixel coordinates run from -1 to size, the ring being the neighbours'. */
|
||||
export function gridIndex(tile: MapTile, pixelX: number, pixelZ: number): number {
|
||||
return (pixelZ + 1) * (tile.size + 2) + pixelX + 1
|
||||
}
|
||||
@@ -0,0 +1,436 @@
|
||||
/** The shapes the Iris bridge answers with (Iris core, art.arcane.iris.core.studio). */
|
||||
|
||||
import type { BlockLook } from '../scene/blockLooks'
|
||||
import type { CoverLook } from '../scene/coverLooks'
|
||||
|
||||
export type LabelKind = 'BIOME' | 'REGION'
|
||||
|
||||
export interface MapLabel {
|
||||
kind: LabelKind
|
||||
key: string
|
||||
name: string
|
||||
/** 0xRRGGBB */
|
||||
color: number
|
||||
}
|
||||
|
||||
export interface ViewInfo {
|
||||
id: string
|
||||
label: string
|
||||
description: string
|
||||
group: string
|
||||
groupLabel: string
|
||||
}
|
||||
|
||||
/** A studio view a module of the pack shows (IrisApi StudioView): block scenes such as its objects, or patterns such as its palettes. */
|
||||
export interface ModuleViewInfo {
|
||||
id: string
|
||||
label: string
|
||||
description: string
|
||||
}
|
||||
|
||||
export interface SceneEntry {
|
||||
key: string
|
||||
name: string
|
||||
/** The folder it is listed under; empty for none. */
|
||||
group: string
|
||||
variants: number
|
||||
}
|
||||
|
||||
/** A scene view as the server lists it; `editable` when its entries can be edited as nodes, `creatable` when they can also be created and deleted, `baked` when their bake can be timed, `parts` when a block can be traced to the part that placed it. */
|
||||
export interface SceneViewInfo extends ModuleViewInfo {
|
||||
editable: boolean
|
||||
creatable: boolean
|
||||
baked: boolean
|
||||
parts: boolean
|
||||
/** The sizes the scenes can be built at, or null when each entry has its own. */
|
||||
sizes: SceneSizes | null
|
||||
}
|
||||
|
||||
/** The sizes a scene view builds its scenes at, as blocks across, smallest first, and the one shown first (IrisApi SceneSizes). */
|
||||
export interface SceneSizes {
|
||||
blocksAcross: number[]
|
||||
opening: number
|
||||
}
|
||||
|
||||
/** One timed bake of a scene entry (IrisApi BakeRun): a time per step, added up over every variant. */
|
||||
export interface BakeRun {
|
||||
variantCount: number
|
||||
stages: { label: string; nanos: number }[]
|
||||
}
|
||||
|
||||
/** Where a value sits in a JSON file: member names and element indices from the root. */
|
||||
export type JsonPath = (string | number)[]
|
||||
|
||||
/** An entry's file as the node editor shows it (StudioEditors.EditorState). */
|
||||
export interface EditorState {
|
||||
/** Where it is below the pack folder. */
|
||||
file: string
|
||||
/** Tells this text from any other; an edit sent with an older one is refused. */
|
||||
revision: string
|
||||
text: string
|
||||
/** The file as nodes, or null when it can't be read as nodes and `problem` says why. */
|
||||
roots: GraphNode[] | null
|
||||
problem: string | null
|
||||
/** Why the file can't be edited here, such as outside a studio world; null when it can. */
|
||||
locked: string | null
|
||||
types: Record<string, SettingsType>
|
||||
}
|
||||
|
||||
export interface GraphNode {
|
||||
kind: string
|
||||
title: string
|
||||
path: JsonPath
|
||||
/** The scene part it draws, or NO_PART. */
|
||||
partId: number
|
||||
roles: string[]
|
||||
settings: NodeSettings[]
|
||||
children: { wire: string; node: GraphNode }[]
|
||||
/** The array a node moved under this one joins; null when nothing can move here. */
|
||||
childList: JsonPath | null
|
||||
movable: boolean
|
||||
duplicable: boolean
|
||||
additions: { label: string; list: JsonPath; literal: string }[]
|
||||
}
|
||||
|
||||
export const NO_PART = -1
|
||||
|
||||
/** The settings of the object at `path`, of schema type `type`, without the members shown as nodes. */
|
||||
export interface NodeSettings {
|
||||
title: string
|
||||
path: JsonPath
|
||||
type: string
|
||||
shownAsNodes: string[]
|
||||
}
|
||||
|
||||
/** A settings type of the pack's schema (SchemaTypes.TypeWire). */
|
||||
export interface SettingsType {
|
||||
description: string
|
||||
options: SettingOption[]
|
||||
}
|
||||
|
||||
export interface SettingOption {
|
||||
name: string
|
||||
description: string
|
||||
required: boolean
|
||||
minimum: number | null
|
||||
maximum: number | null
|
||||
minItems: number | null
|
||||
defaultValue: unknown
|
||||
kind: ValueKind
|
||||
}
|
||||
|
||||
export type ValueKind =
|
||||
| { kind: 'boolean' }
|
||||
| { kind: 'integer' }
|
||||
| { kind: 'decimal' }
|
||||
| { kind: 'text'; format: string }
|
||||
| { kind: 'reference'; reference: string; format: string }
|
||||
| { kind: 'resource'; resource: string }
|
||||
| { kind: 'enum'; constants: { name: string; description: string }[] }
|
||||
| { kind: 'list'; element: ValueKind; unique: boolean }
|
||||
| { kind: 'map'; value: ValueKind }
|
||||
| { kind: 'object'; type: string }
|
||||
| { kind: 'host'; type: string }
|
||||
| { kind: 'any' }
|
||||
|
||||
/** One change the node editor makes (GraphEditRequest). */
|
||||
export type GraphEdit =
|
||||
| { op: 'set'; object: JsonPath; key: string; literal: string }
|
||||
| { op: 'unset'; object: JsonPath; key: string }
|
||||
| { op: 'append'; list: JsonPath; literal: string }
|
||||
| { op: 'addItem'; list: JsonPath }
|
||||
| { op: 'delete'; path: JsonPath }
|
||||
| { op: 'duplicate'; path: JsonPath }
|
||||
| { op: 'move'; path: JsonPath; toList: JsonPath }
|
||||
|
||||
/** Something a pattern view lays out, such as one of a biome's palettes (IrisApi PatternEntry). */
|
||||
export interface PatternEntry {
|
||||
key: string
|
||||
name: string
|
||||
/** The heading it is listed under, such as its biome. */
|
||||
group: string
|
||||
/** How many depths below the top it has a pick for; at least 1. */
|
||||
depths: number
|
||||
/** Short lines about it, such as its blocks and noise. */
|
||||
facts: string[]
|
||||
}
|
||||
|
||||
/** What a pattern entry places across a square of columns, row by row from the north west. */
|
||||
export interface PatternTile {
|
||||
columns: number
|
||||
blocksPerColumn: number
|
||||
/** The block states the picks index, as BlockState keys; a plugin's block by the name the pack gives it. */
|
||||
blocks: string[]
|
||||
/** Per block, the state players see and the studio draws: the block itself, or the vanilla state a plugin block borrows. */
|
||||
drawnAs: string[]
|
||||
/** Each column's block, or NO_PATTERN_BLOCK where the pattern places none. */
|
||||
picks: Int16Array
|
||||
}
|
||||
|
||||
export const NO_PATTERN_BLOCK = -1
|
||||
|
||||
/** A world saved on the server's disk, a dimension folder of region files. */
|
||||
export interface SavedWorldInfo {
|
||||
/** Its folder below the server's level folder. */
|
||||
id: string
|
||||
name: string
|
||||
/** Who added the dimension, such as minecraft or iris. */
|
||||
namespace: string
|
||||
}
|
||||
|
||||
/** One noise the noise view can show. */
|
||||
export interface NoiseSource {
|
||||
id: string
|
||||
name: string
|
||||
category: string
|
||||
/** Whether the view's seed changes it; the dimension's overlay keeps the world's. */
|
||||
usesSeed: boolean
|
||||
/** What the noise spans where it is measured in blocks above the fluid; null for noise of 0 to 1. */
|
||||
blockRange: { lowest: number; highest: number } | null
|
||||
}
|
||||
|
||||
/** A square of noise values, a pixel's value taken at its north west corner, row by row from the north west. */
|
||||
export interface NoiseTile {
|
||||
size: number
|
||||
values: Float32Array
|
||||
}
|
||||
|
||||
/** Where a saved world's view opens: the middle of the region nearest the origin, and how its ground lies there. */
|
||||
export interface SavedStart {
|
||||
centerX: number
|
||||
centerZ: number
|
||||
minY: number
|
||||
lowestGround: number
|
||||
highestGround: number
|
||||
/** The water surface most water lies at, or null where the region holds none. */
|
||||
seaLevel: number | null
|
||||
}
|
||||
|
||||
/** A square of a saved world, one column per pixel, row by row from the north west. */
|
||||
export interface SavedTile {
|
||||
size: number
|
||||
blocksPerPixel: number
|
||||
/** The top block of the ground under any water; {@link noGround} where nothing finished is saved. */
|
||||
groundY: Int16Array
|
||||
/** The top water block over the ground; {@link noWater} where it is dry. */
|
||||
waterSurfaceY: Int16Array
|
||||
/** Indices into {@link blockNames}, {@link blocksDrawnAs} and {@link biomeLabels}. */
|
||||
blocks: Int16Array
|
||||
biomes: Int16Array
|
||||
/** Each block without its properties; a plugin's block by the name its plugin gives it. */
|
||||
blockNames: string[]
|
||||
/** Per block, the state it was saved as, which players see and the studio draws; a plugin block's is the vanilla state it borrows. */
|
||||
blocksDrawnAs: string[]
|
||||
biomeLabels: MapLabel[]
|
||||
noGround: number
|
||||
noWater: number
|
||||
}
|
||||
|
||||
export interface WorldInfo {
|
||||
world: string
|
||||
dimension: string
|
||||
dimensionName: string
|
||||
seed: string
|
||||
minY: number
|
||||
height: number
|
||||
fluidHeight: number
|
||||
tileSize: number
|
||||
hasPlayers: boolean
|
||||
views: ViewInfo[]
|
||||
}
|
||||
|
||||
export interface MapHover {
|
||||
worldX: number
|
||||
worldZ: number
|
||||
biome: MapLabel | null
|
||||
caveBiome: MapLabel | null
|
||||
region: MapLabel | null
|
||||
vanillaBiome: string | null
|
||||
height: number
|
||||
fluidHeight: number
|
||||
slopeDegrees: number
|
||||
biomeFile: string | null
|
||||
regionFile: string | null
|
||||
/** How the spot got its region and the biome the view shows, region first. */
|
||||
pickPath: PickStep[]
|
||||
}
|
||||
|
||||
/** REGION, BIOME and CHILD were picked by noise; IMAGE_MAP, FOCUS and PREVIEW were set without a pick. */
|
||||
export type PickKind = 'REGION' | 'BIOME' | 'CHILD' | 'IMAGE_MAP' | 'FOCUS' | 'PREVIEW'
|
||||
|
||||
export interface PickStep {
|
||||
kind: PickKind
|
||||
picked: MapLabel
|
||||
/** The biome list a BIOME step picked from, such as "land". */
|
||||
list: string | null
|
||||
/** The parent name a CHILD step replaced; null when the parent kept the spot. */
|
||||
replaced: string | null
|
||||
/** 0 to 1; null when nothing was picked. */
|
||||
noise: number | null
|
||||
bands: PickBand[]
|
||||
}
|
||||
|
||||
/** One option's share of a pick noise: picked from `from` up to `to`. */
|
||||
export interface PickBand {
|
||||
option: MapLabel
|
||||
from: number
|
||||
to: number
|
||||
}
|
||||
|
||||
/** How the noise picks what an area of the map shows (MapPickInspection). */
|
||||
export interface PickInspection {
|
||||
detail: string
|
||||
sections: PickSection[]
|
||||
}
|
||||
|
||||
/** The picks on one region's ground; `region` is null in the region view, where the regions themselves are picked. */
|
||||
export interface PickSection {
|
||||
region: MapLabel | null
|
||||
/** How much of the area's picked ground the region holds. */
|
||||
share: number
|
||||
biomeCount: number
|
||||
spreads: PickSpread[]
|
||||
}
|
||||
|
||||
/** One noise in the area: its values in 50 equal steps from 0 to 1, and each option's share of it. */
|
||||
export interface PickSpread {
|
||||
title: string
|
||||
bands: PickBand[]
|
||||
histogram: number[]
|
||||
samples: number
|
||||
rows: PickShare[]
|
||||
}
|
||||
|
||||
/** `weight`: how much of the noise picks the option; `inView`: how much of the area's values do. */
|
||||
export interface PickShare {
|
||||
option: MapLabel
|
||||
weight: number
|
||||
inView: number
|
||||
}
|
||||
|
||||
/** How the region and biome views draw their picks: the labels, the noise that picked them, or the labels by noise. */
|
||||
export type PickDisplay = 'picks' | 'noise' | 'both'
|
||||
|
||||
export interface Marker {
|
||||
label: string
|
||||
worldX: number
|
||||
worldY: number
|
||||
worldZ: number
|
||||
/** The way it faces, in Minecraft's degrees: 0 is south, 90 is west; 0 for entities. */
|
||||
yaw: number
|
||||
health: number
|
||||
maxHealth: number
|
||||
}
|
||||
|
||||
/** What the server asks of its machine, as it sends it every second. */
|
||||
export interface ServerUsage {
|
||||
/** The server's CPU use with 100 per busy thread, or null when the JVM cannot tell. */
|
||||
cpuPercent: number | null
|
||||
/** The threads the server's CPU has, so the CPU can reach 100 times this. */
|
||||
threads: number
|
||||
heapUsedBytes: number
|
||||
heapMaxBytes: number
|
||||
}
|
||||
|
||||
/**
|
||||
* A decoded map tile. Grids hold (size + 2)² cells, the tile's pixels inside a ring of its neighbours' edge pixels.
|
||||
*/
|
||||
export interface MapTile {
|
||||
size: number
|
||||
blocksPerPixel: number
|
||||
subjectKind: LabelKind
|
||||
labels: MapLabel[]
|
||||
subjects: Int16Array
|
||||
regions: Int16Array
|
||||
heights: Float32Array | null
|
||||
/** The noise value that settled each cell's pick, 0 to 1 and NaN where nothing picked it; null unless asked for. */
|
||||
pickNoise: Float32Array | null
|
||||
/** The block on top of each cell's column; null unless asked for. */
|
||||
blocks: TileBlocks | null
|
||||
}
|
||||
|
||||
/** Where a tile's blocks come from: the chunks the server generates in memory. */
|
||||
export type BlockSource = 'generated'
|
||||
|
||||
/**
|
||||
* The top of each cell's column: its ground block, the terrain's top; the block standing on it, such as grass; and the
|
||||
* solid blocks raised above it, such as a tree's wood and leaves.
|
||||
*/
|
||||
export interface TileBlocks {
|
||||
/** The block states the grids index, as BlockState keys. */
|
||||
names: string[]
|
||||
/** {@link NO_BLOCK} where the column holds no ground. */
|
||||
ground: Int16Array
|
||||
/** {@link NO_BLOCK} where nothing stands on the ground. */
|
||||
cover: Int16Array
|
||||
/** Where each cell's raised blocks start in {@link raisedY} and {@link raised}, with one more entry for where the last cell's end. */
|
||||
raisedStart: Int32Array
|
||||
/** The Y of each raised block, cell after cell and each cell's highest first. */
|
||||
raisedY: Int16Array
|
||||
/** Each raised block, in the order of {@link raisedY}. */
|
||||
raised: Int16Array
|
||||
/** The blocks seen from the open air, where the tile is a block a column and they were asked for; else null. */
|
||||
voxels: TileVoxels | null
|
||||
/** The runs of solid blocks of the area each cell stands for, where the tile is coarser and they were asked for; else null. */
|
||||
runs: TileRuns | null
|
||||
/** Each named block's model with its pictures placed, for the blocks {@link voxels} names; the tile source fills it in. */
|
||||
models: (CoverLook | null)[]
|
||||
/** The colour of each named block from above, as 0xRRGGBB; the tile source fills it in. */
|
||||
colors: number[]
|
||||
/** What each named block looks like on a column, where the tile is fine enough to show textures; else empty. */
|
||||
looks: (BlockLook | null)[]
|
||||
/** What each named block looks like standing on the ground, for the blocks {@link cover} names, on a tile that shows textures; else empty. */
|
||||
covers: (CoverLook | null)[]
|
||||
}
|
||||
|
||||
/**
|
||||
* The blocks of a tile that can be seen from the open air, as the server found them in the chunks it generated, with
|
||||
* the sides of each that face that air.
|
||||
*/
|
||||
export interface TileVoxels {
|
||||
/** Each block's column from the tile's west edge. */
|
||||
x: Uint8Array
|
||||
/** Each block's column from the tile's north edge. */
|
||||
z: Uint8Array
|
||||
y: Int16Array
|
||||
/** Each block's index in the tile's block names. */
|
||||
blocks: Int16Array
|
||||
/** The sides of each block that face the open air, a bit each in {@link VOXEL_SIDES}' order. */
|
||||
faces: Uint8Array
|
||||
/** The sky's light each block shows on faces that stand inside it, such as a plant's, 0 to 15. */
|
||||
lights: Uint8Array
|
||||
/** The shade of each face {@link faces} names, block after block and side after side, as skyLight reads it. */
|
||||
shades: Uint16Array
|
||||
}
|
||||
|
||||
/**
|
||||
* The ground of a coarser tile in 3D, as Distant Horizons draws far terrain: for each cell, the runs of solid blocks of
|
||||
* the area it stands for, highest first. The last run of a cell is its ground, which reaches down out of sight.
|
||||
*/
|
||||
export interface TileRuns {
|
||||
/** Where each cell's runs start in the arrays below, with one more entry for where the last cell's end. */
|
||||
starts: Int32Array
|
||||
bottoms: Int16Array
|
||||
tops: Int16Array
|
||||
/** The index in the tile's block names of the block most of each run's top shows. */
|
||||
blocks: Int16Array
|
||||
/** The index of the plant most often standing on each run's top, or {@link NO_BLOCK}. */
|
||||
covers: Int16Array
|
||||
/** How much of each run's top plants stand on, 0 to 255 for all of it. */
|
||||
coverShares: Uint8Array
|
||||
/** The sky's light on each run's top, the mean of its blocks' tops, in sixteenths of a level. */
|
||||
lights: Uint8Array
|
||||
/** How many opaque cells stand around each corner of each run's top, the mean of its blocks' tops, in sixty-fourths. */
|
||||
occlusions: Uint8Array
|
||||
}
|
||||
|
||||
/** {@link TileRuns.lights} to a light level. */
|
||||
export const RUN_LIGHT_STEPS = 16
|
||||
/** {@link TileRuns.occlusions} to a count of opaque cells. */
|
||||
export const RUN_OCCLUSION_STEPS = 64
|
||||
|
||||
/** The order of the sides in {@link TileVoxels.faces}. */
|
||||
export const VOXEL_SIDES = ['down', 'up', 'north', 'south', 'west', 'east'] as const
|
||||
|
||||
export const NO_BLOCK = -1
|
||||
export const NO_LABEL = -1
|
||||
@@ -0,0 +1,64 @@
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
// IntelliJ's expui icons and the studio's own drawn to match (see icons/NOTICE.txt): each has a light file and a "_dark" twin in its own colours.
|
||||
const ICON_URLS = import.meta.glob<string>('../icons/**/*.svg', { eager: true, query: '?url', import: 'default' })
|
||||
const DARK_SUFFIX = '_dark'
|
||||
|
||||
export type IdeIconName =
|
||||
| 'actualZoom'
|
||||
| 'add'
|
||||
| 'blocks'
|
||||
| 'borders'
|
||||
| 'checked'
|
||||
| 'closeSmall'
|
||||
| 'chevronLeft'
|
||||
| 'chevronRight'
|
||||
| 'decoration'
|
||||
| 'delete'
|
||||
| 'exit'
|
||||
| 'grid'
|
||||
| 'groups'
|
||||
| 'help'
|
||||
| 'lightning'
|
||||
| 'locate'
|
||||
| 'locked'
|
||||
| 'memory'
|
||||
| 'mob'
|
||||
| 'redo'
|
||||
| 'refresh'
|
||||
| 'reset'
|
||||
| 'search'
|
||||
| 'settings'
|
||||
| 'shading'
|
||||
| 'stopWatch'
|
||||
| 'symlink'
|
||||
| 'theme'
|
||||
| 'undo'
|
||||
| 'web'
|
||||
| 'views/biomes'
|
||||
| 'views/noise'
|
||||
| 'views/objects'
|
||||
| 'views/palettes'
|
||||
| 'views/procedural'
|
||||
| 'views/regions'
|
||||
| 'views/saved-world'
|
||||
| 'views/world-3d'
|
||||
|
||||
function iconUrl(name: string): string {
|
||||
const url = ICON_URLS[`../icons/${name}.svg`]
|
||||
if (url === undefined) {
|
||||
throw new Error(`No icon named ${name}`)
|
||||
}
|
||||
return url
|
||||
}
|
||||
|
||||
/** An IntelliJ icon, 16 px unless sized, in the light or dark colours the window shows. */
|
||||
export function IdeIcon({ name, className }: { name: IdeIconName; className?: string }): React.JSX.Element {
|
||||
const size = cn('size-4 shrink-0', className)
|
||||
return (
|
||||
<>
|
||||
<img src={iconUrl(name)} alt="" draggable={false} className={cn(size, 'dark:hidden')} />
|
||||
<img src={iconUrl(name + DARK_SUFFIX)} alt="" draggable={false} className={cn(size, 'hidden dark:block')} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import * as React from "react"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Slot } from "radix-ui"
|
||||
|
||||
const buttonVariants = cva(
|
||||
"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
||||
destructive:
|
||||
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
|
||||
outline:
|
||||
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
||||
secondary:
|
||||
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
||||
ghost:
|
||||
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
||||
link: "text-primary underline-offset-4 hover:underline",
|
||||
},
|
||||
size: {
|
||||
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
||||
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
|
||||
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
||||
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
||||
icon: "size-9",
|
||||
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
||||
"icon-sm": "size-8",
|
||||
"icon-lg": "size-10",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
size: "default",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
function Button({
|
||||
className,
|
||||
variant = "default",
|
||||
size = "default",
|
||||
asChild = false,
|
||||
...props
|
||||
}: React.ComponentProps<"button"> &
|
||||
VariantProps<typeof buttonVariants> & {
|
||||
asChild?: boolean
|
||||
}) {
|
||||
const Comp = asChild ? Slot.Root : "button"
|
||||
|
||||
return (
|
||||
<Comp
|
||||
data-slot="button"
|
||||
data-variant={variant}
|
||||
data-size={size}
|
||||
className={cn(buttonVariants({ variant, size, className }))}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Button, buttonVariants }
|
||||
@@ -0,0 +1,254 @@
|
||||
import * as React from "react"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { IdeIcon } from "@/components/IdeIcon"
|
||||
import { ContextMenu as ContextMenuPrimitive } from "radix-ui"
|
||||
|
||||
function ContextMenu({
|
||||
...props
|
||||
}: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
|
||||
return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />
|
||||
}
|
||||
|
||||
function ContextMenuTrigger({
|
||||
...props
|
||||
}: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
|
||||
return (
|
||||
<ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />
|
||||
)
|
||||
}
|
||||
|
||||
function ContextMenuGroup({
|
||||
...props
|
||||
}: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
|
||||
return (
|
||||
<ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
|
||||
)
|
||||
}
|
||||
|
||||
function ContextMenuPortal({
|
||||
...props
|
||||
}: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
|
||||
return (
|
||||
<ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
|
||||
)
|
||||
}
|
||||
|
||||
function ContextMenuSub({
|
||||
...props
|
||||
}: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
|
||||
return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />
|
||||
}
|
||||
|
||||
function ContextMenuRadioGroup({
|
||||
...props
|
||||
}: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
|
||||
return (
|
||||
<ContextMenuPrimitive.RadioGroup
|
||||
data-slot="context-menu-radio-group"
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function ContextMenuSubTrigger({
|
||||
className,
|
||||
inset,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
|
||||
inset?: boolean
|
||||
}) {
|
||||
return (
|
||||
<ContextMenuPrimitive.SubTrigger
|
||||
data-slot="context-menu-sub-trigger"
|
||||
data-inset={inset}
|
||||
className={cn(
|
||||
"flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
<span className="ml-auto">
|
||||
<IdeIcon name="chevronRight" />
|
||||
</span>
|
||||
</ContextMenuPrimitive.SubTrigger>
|
||||
)
|
||||
}
|
||||
|
||||
function ContextMenuSubContent({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
|
||||
// Portalled like the menu itself: inside it, the menu's blur and scrolling would clip the submenu away.
|
||||
return (
|
||||
<ContextMenuPrimitive.Portal>
|
||||
<ContextMenuPrimitive.SubContent
|
||||
data-slot="context-menu-sub-content"
|
||||
className={cn(
|
||||
"z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 backdrop-blur-sm text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
</ContextMenuPrimitive.Portal>
|
||||
)
|
||||
}
|
||||
|
||||
function ContextMenuContent({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
|
||||
return (
|
||||
<ContextMenuPrimitive.Portal>
|
||||
<ContextMenuPrimitive.Content
|
||||
data-slot="context-menu-content"
|
||||
className={cn(
|
||||
"z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground backdrop-blur-sm shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
</ContextMenuPrimitive.Portal>
|
||||
)
|
||||
}
|
||||
|
||||
function ContextMenuItem({
|
||||
className,
|
||||
inset,
|
||||
variant = "default",
|
||||
...props
|
||||
}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
|
||||
inset?: boolean
|
||||
variant?: "default" | "destructive"
|
||||
}) {
|
||||
return (
|
||||
<ContextMenuPrimitive.Item
|
||||
data-slot="context-menu-item"
|
||||
data-inset={inset}
|
||||
data-variant={variant}
|
||||
className={cn(
|
||||
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function ContextMenuCheckboxItem({
|
||||
className,
|
||||
children,
|
||||
checked,
|
||||
...props
|
||||
}: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
|
||||
return (
|
||||
<ContextMenuPrimitive.CheckboxItem
|
||||
data-slot="context-menu-checkbox-item"
|
||||
className={cn(
|
||||
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||
className
|
||||
)}
|
||||
checked={checked}
|
||||
{...props}
|
||||
>
|
||||
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
||||
<ContextMenuPrimitive.ItemIndicator>
|
||||
<IdeIcon name="checked" />
|
||||
</ContextMenuPrimitive.ItemIndicator>
|
||||
</span>
|
||||
{children}
|
||||
</ContextMenuPrimitive.CheckboxItem>
|
||||
)
|
||||
}
|
||||
|
||||
function ContextMenuRadioItem({
|
||||
className,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
|
||||
return (
|
||||
<ContextMenuPrimitive.RadioItem
|
||||
data-slot="context-menu-radio-item"
|
||||
className={cn(
|
||||
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
||||
<ContextMenuPrimitive.ItemIndicator>
|
||||
<span className="size-1.5 rounded-full bg-current" />
|
||||
</ContextMenuPrimitive.ItemIndicator>
|
||||
</span>
|
||||
{children}
|
||||
</ContextMenuPrimitive.RadioItem>
|
||||
)
|
||||
}
|
||||
|
||||
function ContextMenuLabel({
|
||||
className,
|
||||
inset,
|
||||
...props
|
||||
}: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
|
||||
inset?: boolean
|
||||
}) {
|
||||
return (
|
||||
<ContextMenuPrimitive.Label
|
||||
data-slot="context-menu-label"
|
||||
data-inset={inset}
|
||||
className={cn(
|
||||
"px-2 py-1.5 text-sm font-medium text-foreground data-[inset]:pl-8",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function ContextMenuSeparator({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
|
||||
return (
|
||||
<ContextMenuPrimitive.Separator
|
||||
data-slot="context-menu-separator"
|
||||
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function ContextMenuShortcut({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<"span">) {
|
||||
return (
|
||||
<span
|
||||
data-slot="context-menu-shortcut"
|
||||
className={cn(
|
||||
"ml-auto text-xs tracking-widest text-muted-foreground",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
ContextMenu,
|
||||
ContextMenuTrigger,
|
||||
ContextMenuContent,
|
||||
ContextMenuItem,
|
||||
ContextMenuCheckboxItem,
|
||||
ContextMenuRadioItem,
|
||||
ContextMenuLabel,
|
||||
ContextMenuSeparator,
|
||||
ContextMenuShortcut,
|
||||
ContextMenuGroup,
|
||||
ContextMenuPortal,
|
||||
ContextMenuSub,
|
||||
ContextMenuSubContent,
|
||||
ContextMenuSubTrigger,
|
||||
ContextMenuRadioGroup,
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { IdeIcon } from "@/components/IdeIcon"
|
||||
import { Dialog as DialogPrimitive } from "radix-ui"
|
||||
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
function Dialog({
|
||||
...props
|
||||
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
||||
return <DialogPrimitive.Root data-slot="dialog" {...props} />
|
||||
}
|
||||
|
||||
function DialogTrigger({
|
||||
...props
|
||||
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
|
||||
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
|
||||
}
|
||||
|
||||
function DialogPortal({
|
||||
...props
|
||||
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
|
||||
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
|
||||
}
|
||||
|
||||
function DialogClose({
|
||||
...props
|
||||
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
|
||||
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
|
||||
}
|
||||
|
||||
function DialogOverlay({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
|
||||
return (
|
||||
<DialogPrimitive.Overlay
|
||||
data-slot="dialog-overlay"
|
||||
className={cn(
|
||||
"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function DialogContent({
|
||||
className,
|
||||
children,
|
||||
showCloseButton = true,
|
||||
...props
|
||||
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
||||
showCloseButton?: boolean
|
||||
}) {
|
||||
return (
|
||||
<DialogPortal data-slot="dialog-portal">
|
||||
<DialogOverlay />
|
||||
<DialogPrimitive.Content
|
||||
data-slot="dialog-content"
|
||||
className={cn(
|
||||
"fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
{showCloseButton && (
|
||||
<DialogPrimitive.Close
|
||||
data-slot="dialog-close"
|
||||
className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
||||
>
|
||||
<IdeIcon name="closeSmall" />
|
||||
<span className="sr-only">Close</span>
|
||||
</DialogPrimitive.Close>
|
||||
)}
|
||||
</DialogPrimitive.Content>
|
||||
</DialogPortal>
|
||||
)
|
||||
}
|
||||
|
||||
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="dialog-header"
|
||||
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function DialogFooter({
|
||||
className,
|
||||
showCloseButton = false,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<"div"> & {
|
||||
showCloseButton?: boolean
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
data-slot="dialog-footer"
|
||||
className={cn(
|
||||
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
{showCloseButton && (
|
||||
<DialogPrimitive.Close asChild>
|
||||
<Button variant="outline">Close</Button>
|
||||
</DialogPrimitive.Close>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function DialogTitle({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
|
||||
return (
|
||||
<DialogPrimitive.Title
|
||||
data-slot="dialog-title"
|
||||
className={cn("text-lg leading-none font-semibold", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function DialogDescription({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
|
||||
return (
|
||||
<DialogPrimitive.Description
|
||||
data-slot="dialog-description"
|
||||
className={cn("text-sm text-muted-foreground", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
Dialog,
|
||||
DialogClose,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogOverlay,
|
||||
DialogPortal,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import * as React from "react"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
||||
return (
|
||||
<input
|
||||
type={type}
|
||||
data-slot="input"
|
||||
className={cn(
|
||||
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
|
||||
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
||||
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Input }
|
||||
@@ -0,0 +1,28 @@
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
|
||||
return (
|
||||
<kbd
|
||||
data-slot="kbd"
|
||||
className={cn(
|
||||
"pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none",
|
||||
"[&_svg:not([class*='size-'])]:size-3",
|
||||
"[[data-slot=tooltip-content]_&]:bg-secondary [[data-slot=tooltip-content]_&]:text-secondary-text",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<kbd
|
||||
data-slot="kbd-group"
|
||||
className={cn("inline-flex items-center gap-1", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Kbd, KbdGroup }
|
||||
@@ -0,0 +1,57 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { ScrollArea as ScrollAreaPrimitive } from "radix-ui"
|
||||
|
||||
function ScrollArea({
|
||||
className,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
|
||||
return (
|
||||
<ScrollAreaPrimitive.Root
|
||||
data-slot="scroll-area"
|
||||
className={cn("relative", className)}
|
||||
{...props}
|
||||
>
|
||||
<ScrollAreaPrimitive.Viewport
|
||||
data-slot="scroll-area-viewport"
|
||||
className="size-full rounded-[inherit] [&>div]:block! transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
|
||||
>
|
||||
{children}
|
||||
</ScrollAreaPrimitive.Viewport>
|
||||
<ScrollBar />
|
||||
<ScrollAreaPrimitive.Corner />
|
||||
</ScrollAreaPrimitive.Root>
|
||||
)
|
||||
}
|
||||
|
||||
function ScrollBar({
|
||||
className,
|
||||
orientation = "vertical",
|
||||
...props
|
||||
}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
|
||||
return (
|
||||
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
||||
data-slot="scroll-area-scrollbar"
|
||||
orientation={orientation}
|
||||
className={cn(
|
||||
"flex touch-none p-px transition-colors select-none",
|
||||
orientation === "vertical" &&
|
||||
"h-full w-2.5 border-l border-l-transparent",
|
||||
orientation === "horizontal" &&
|
||||
"h-2.5 flex-col border-t border-t-transparent",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<ScrollAreaPrimitive.ScrollAreaThumb
|
||||
data-slot="scroll-area-thumb"
|
||||
className="relative flex-1 rounded-full bg-border"
|
||||
/>
|
||||
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
||||
)
|
||||
}
|
||||
|
||||
export { ScrollArea, ScrollBar }
|
||||
@@ -0,0 +1,25 @@
|
||||
import * as React from "react"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Separator as SeparatorPrimitive } from "radix-ui"
|
||||
|
||||
function Separator({
|
||||
className,
|
||||
orientation = "horizontal",
|
||||
decorative = true,
|
||||
...props
|
||||
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
||||
return (
|
||||
<SeparatorPrimitive.Root
|
||||
data-slot="separator"
|
||||
decorative={decorative}
|
||||
orientation={orientation}
|
||||
className={cn(
|
||||
"shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Separator }
|
||||
@@ -0,0 +1,69 @@
|
||||
import * as React from "react"
|
||||
import { type VariantProps } from "class-variance-authority"
|
||||
import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { toggleVariants } from "@/components/ui/toggle"
|
||||
|
||||
const ToggleGroupContext = React.createContext<VariantProps<typeof toggleVariants>>({
|
||||
size: "default",
|
||||
variant: "default",
|
||||
})
|
||||
|
||||
function ToggleGroup({
|
||||
className,
|
||||
variant,
|
||||
size,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &
|
||||
VariantProps<typeof toggleVariants>) {
|
||||
return (
|
||||
<ToggleGroupPrimitive.Root
|
||||
data-slot="toggle-group"
|
||||
data-variant={variant}
|
||||
data-size={size}
|
||||
className={cn(
|
||||
"group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<ToggleGroupContext.Provider value={{ variant, size }}>
|
||||
{children}
|
||||
</ToggleGroupContext.Provider>
|
||||
</ToggleGroupPrimitive.Root>
|
||||
)
|
||||
}
|
||||
|
||||
function ToggleGroupItem({
|
||||
className,
|
||||
children,
|
||||
variant,
|
||||
size,
|
||||
...props
|
||||
}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &
|
||||
VariantProps<typeof toggleVariants>) {
|
||||
const context = React.useContext(ToggleGroupContext)
|
||||
|
||||
return (
|
||||
<ToggleGroupPrimitive.Item
|
||||
data-slot="toggle-group-item"
|
||||
data-variant={context.variant || variant}
|
||||
data-size={context.size || size}
|
||||
className={cn(
|
||||
toggleVariants({
|
||||
variant: context.variant || variant,
|
||||
size: context.size || size,
|
||||
}),
|
||||
"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</ToggleGroupPrimitive.Item>
|
||||
)
|
||||
}
|
||||
|
||||
export { ToggleGroup, ToggleGroupItem }
|
||||
@@ -0,0 +1,44 @@
|
||||
import * as React from "react"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Toggle as TogglePrimitive } from "radix-ui"
|
||||
|
||||
const toggleVariants = cva(
|
||||
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-transparent",
|
||||
outline:
|
||||
"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground",
|
||||
},
|
||||
size: {
|
||||
default: "h-9 min-w-9 px-2",
|
||||
sm: "h-8 min-w-8 px-1.5",
|
||||
lg: "h-10 min-w-10 px-2.5",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
size: "default",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
function Toggle({
|
||||
className,
|
||||
variant,
|
||||
size,
|
||||
...props
|
||||
}: React.ComponentProps<typeof TogglePrimitive.Root> &
|
||||
VariantProps<typeof toggleVariants>) {
|
||||
return (
|
||||
<TogglePrimitive.Root
|
||||
data-slot="toggle"
|
||||
className={cn(toggleVariants({ variant, size, className }))}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Toggle, toggleVariants }
|
||||
@@ -0,0 +1,55 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Tooltip as TooltipPrimitive } from "radix-ui"
|
||||
|
||||
function TooltipProvider({
|
||||
delayDuration = 0,
|
||||
...props
|
||||
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
||||
return (
|
||||
<TooltipPrimitive.Provider
|
||||
data-slot="tooltip-provider"
|
||||
delayDuration={delayDuration}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function Tooltip({
|
||||
...props
|
||||
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
||||
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
||||
}
|
||||
|
||||
function TooltipTrigger({
|
||||
...props
|
||||
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
||||
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
||||
}
|
||||
|
||||
function TooltipContent({
|
||||
className,
|
||||
sideOffset = 6,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
||||
return (
|
||||
<TooltipPrimitive.Portal>
|
||||
<TooltipPrimitive.Content
|
||||
data-slot="tooltip-content"
|
||||
sideOffset={sideOffset}
|
||||
className={cn(
|
||||
"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md border border-overlay-border bg-popover px-2.5 py-1.5 text-xs text-balance text-popover-foreground shadow-md fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</TooltipPrimitive.Content>
|
||||
</TooltipPrimitive.Portal>
|
||||
)
|
||||
}
|
||||
|
||||
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
||||
@@ -0,0 +1 @@
|
||||
declare module '*.css'
|
||||
@@ -0,0 +1,35 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { EditHistory } from './EditHistory'
|
||||
|
||||
describe('EditHistory', () => {
|
||||
it('undoes back to the text before an edit and redoes forward again', () => {
|
||||
const history = new EditHistory()
|
||||
history.edited('a')
|
||||
|
||||
expect(history.nextUndo()).toBe('a')
|
||||
history.undone('b')
|
||||
expect(history.canUndo).toBe(false)
|
||||
expect(history.nextRedo()).toBe('b')
|
||||
history.redone('a')
|
||||
expect(history.nextUndo()).toBe('a')
|
||||
})
|
||||
|
||||
it('forgets what could be redone once a new edit is made', () => {
|
||||
const history = new EditHistory()
|
||||
history.edited('a')
|
||||
history.undone('b')
|
||||
|
||||
history.edited('a')
|
||||
|
||||
expect(history.canRedo).toBe(false)
|
||||
})
|
||||
|
||||
it('keeps the history as it was when an undo is never written', () => {
|
||||
const history = new EditHistory()
|
||||
history.edited('a')
|
||||
|
||||
history.nextUndo()
|
||||
|
||||
expect(history.canUndo).toBe(true)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,45 @@
|
||||
const KEPT_STEPS = 100
|
||||
|
||||
/**
|
||||
* The texts a file had before each edit, so undoing writes an earlier text back whole. A step is only taken once its
|
||||
* write succeeded, so a refused undo leaves the history as it was.
|
||||
*/
|
||||
export class EditHistory {
|
||||
private readonly undos: string[] = []
|
||||
private readonly redos: string[] = []
|
||||
|
||||
get canUndo(): boolean {
|
||||
return this.undos.length > 0
|
||||
}
|
||||
|
||||
get canRedo(): boolean {
|
||||
return this.redos.length > 0
|
||||
}
|
||||
|
||||
edited(before: string): void {
|
||||
this.undos.push(before)
|
||||
if (this.undos.length > KEPT_STEPS) {
|
||||
this.undos.shift()
|
||||
}
|
||||
this.redos.length = 0
|
||||
}
|
||||
|
||||
/** The text undoing writes, if there is one. */
|
||||
nextUndo(): string | undefined {
|
||||
return this.undos.at(-1)
|
||||
}
|
||||
|
||||
undone(before: string): void {
|
||||
this.undos.pop()
|
||||
this.redos.push(before)
|
||||
}
|
||||
|
||||
nextRedo(): string | undefined {
|
||||
return this.redos.at(-1)
|
||||
}
|
||||
|
||||
redone(before: string): void {
|
||||
this.redos.pop()
|
||||
this.undos.push(before)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { canBecomeCurve, curveAt, curveFrom, isCurve, keyframesFrom, samplesOf, shapeFrom, withAddedKeyframe, withKeyframe, withoutKeyframe, withSetting, withShape } from './curves'
|
||||
|
||||
describe('isCurve', () => {
|
||||
it('holds only for keyframes and named shapes', () => {
|
||||
expect(isCurve([[0, 1.3], [1, 0.2]])).toBe(true)
|
||||
expect(isCurve({ shape: 'power', exponent: 3 })).toBe(true)
|
||||
expect(isCurve([15, 20])).toBe(false)
|
||||
expect(isCurve(4)).toBe(false)
|
||||
expect(isCurve({ min: 3, max: 8 })).toBe(false)
|
||||
expect(isCurve({ shape: 'zigzag' })).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('samplesOf', () => {
|
||||
it('runs from the start of the curve to its end', () => {
|
||||
expect(samplesOf([[0, 1.3], [1, 0.2]], 3)).toEqual([1.3, 0.75, 0.2].map((expected) => expect.closeTo(expected, 9)))
|
||||
})
|
||||
|
||||
it('has none for a value that is no curve', () => {
|
||||
expect(samplesOf(4, 3)).toBeNull()
|
||||
})
|
||||
|
||||
it('follows a named curve between its from and to', () => {
|
||||
expect(curveAt({ shape: 'power', exponent: 2, from: 10, to: 20 }, 0.5)).toBeCloseTo(12.5, 9)
|
||||
expect(curveAt({ shape: 'linear' }, 0.25)).toBeCloseTo(0.25, 9)
|
||||
})
|
||||
|
||||
it('holds the first and last values beyond the keyframes', () => {
|
||||
expect(curveAt([[0.2, 5], [0.8, 9]], 0)).toBe(5)
|
||||
expect(curveAt([[0.2, 5], [0.8, 9]], 1)).toBe(9)
|
||||
})
|
||||
})
|
||||
|
||||
describe('curveFrom', () => {
|
||||
it('makes a number a flat curve and a range a rising one', () => {
|
||||
expect(curveFrom(4)).toEqual([[0, 4], [1, 4]])
|
||||
expect(curveFrom([15, 20])).toEqual([[0, 15], [1, 20]])
|
||||
expect(curveFrom({ min: 3, max: 8 })).toEqual([[0, 3], [1, 8]])
|
||||
})
|
||||
|
||||
it('leaves what is not a number or range alone', () => {
|
||||
expect(curveFrom('wood')).toBeNull()
|
||||
expect(canBecomeCurve([[0, 1], [1, 2]])).toBe(false)
|
||||
expect(canBecomeCurve(4)).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('changing how a curve is written', () => {
|
||||
it('turns keyframes into a linear shape between their ends, and back into sampled keyframes', () => {
|
||||
const shape = shapeFrom([[1, 8], [0, 2]])
|
||||
|
||||
expect(shape).toEqual({ shape: 'linear', from: 2, to: 8 })
|
||||
expect(keyframesFrom(shape).map(([t, value]) => [t, value])).toEqual([[0, 2], [0.25, 3.5], [0.5, 5], [0.75, 6.5], [1, 8]])
|
||||
})
|
||||
|
||||
it('sets a shape setting, or leaves it out so the default applies', () => {
|
||||
expect(withSetting({ shape: 'power', exponent: 3 }, 'exponent', 4)).toEqual({ shape: 'power', exponent: 4 })
|
||||
expect(withSetting({ shape: 'power', exponent: 3 }, 'exponent', undefined)).toEqual({ shape: 'power' })
|
||||
})
|
||||
|
||||
it('keeps from and to when the shape changes, but not the old shape settings', () => {
|
||||
expect(withShape({ shape: 'power', exponent: 3, from: 1, to: 4 }, 'sine')).toEqual({ shape: 'sine', from: 1, to: 4 })
|
||||
})
|
||||
})
|
||||
|
||||
describe('editing keyframes', () => {
|
||||
const keys: [number, number][] = [[0, 1], [1, 3]]
|
||||
|
||||
it('adds a keyframe halfway across the widest gap, on the curve', () => {
|
||||
expect(withAddedKeyframe(keys)).toEqual([[0, 1], [0.5, 2], [1, 3]])
|
||||
expect(withAddedKeyframe([[0, 1], [0.25, 1], [1, 3]])[2]).toEqual([0.625, expect.closeTo(1 + (2 * 0.375) / 0.75, 9)])
|
||||
})
|
||||
|
||||
it('gives a lone keyframe a partner at the other end', () => {
|
||||
expect(withAddedKeyframe([[0, 4]])).toEqual([[0, 4], [1, 4]])
|
||||
})
|
||||
|
||||
it('sets and removes a keyframe but never removes the last one', () => {
|
||||
expect(withKeyframe(keys, 1, [0.9, 5])).toEqual([[0, 1], [0.9, 5]])
|
||||
expect(withoutKeyframe(keys, 0)).toEqual([[1, 3]])
|
||||
expect(withoutKeyframe([[1, 3]], 0)).toEqual([[1, 3]])
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,217 @@
|
||||
/** One keyframe of a curve: where it is from 0 to 1, and the value there. */
|
||||
export type Keyframe = [number, number]
|
||||
|
||||
export interface ShapeParameter {
|
||||
name: string
|
||||
fallback: number
|
||||
}
|
||||
|
||||
/** A named curve (ProceduralValue.CurveShape): from 0 at t = 0 toward 1, stretched between a value's from and to. */
|
||||
export interface CurveShape {
|
||||
key: string
|
||||
parameters: ShapeParameter[]
|
||||
at(t: number, parameter: (name: string) => number): number
|
||||
}
|
||||
|
||||
const DEFAULT_FROM = 0
|
||||
const DEFAULT_TO = 1
|
||||
const KEYFRAME_SIZE = 2
|
||||
const RANGE_SIZE = 2
|
||||
const NARROWEST_BELL = 1e-6
|
||||
const SHAPE_STOPS = 5
|
||||
const FIRST_STOP = 0
|
||||
const LAST_STOP = 1
|
||||
|
||||
export const CURVE_SHAPES: CurveShape[] = [
|
||||
{ key: 'linear', parameters: [], at: (t) => t },
|
||||
{ key: 'smooth', parameters: [], at: (t) => t * t * (3 - 2 * t) },
|
||||
{ key: 'power', parameters: [{ name: 'exponent', fallback: 2 }], at: (t, p) => Math.pow(t, p('exponent')) },
|
||||
{
|
||||
key: 'sigmoid',
|
||||
parameters: [
|
||||
{ name: 'steepness', fallback: 10 },
|
||||
{ name: 'mid', fallback: 0.5 }
|
||||
],
|
||||
at: (t, p) => 1 / (1 + Math.exp(-p('steepness') * (t - p('mid'))))
|
||||
},
|
||||
{
|
||||
key: 'bell',
|
||||
parameters: [
|
||||
{ name: 'mid', fallback: 0.5 },
|
||||
{ name: 'width', fallback: 0.15 }
|
||||
],
|
||||
at: (t, p) => Math.exp(-0.5 * Math.pow((t - p('mid')) / Math.max(NARROWEST_BELL, p('width')), 2))
|
||||
},
|
||||
{
|
||||
key: 'periodic',
|
||||
parameters: [
|
||||
{ name: 'periods', fallback: 4 },
|
||||
{ name: 'sharpness', fallback: 8 }
|
||||
],
|
||||
at: (t, p) => Math.pow(Math.max(0, Math.sin(2 * Math.PI * t * p('periods'))), p('sharpness'))
|
||||
},
|
||||
{ key: 'sine', parameters: [{ name: 'periods', fallback: 1 }], at: (t, p) => 0.5 + 0.5 * Math.sin(2 * Math.PI * t * p('periods')) }
|
||||
]
|
||||
|
||||
export function shapeNamed(key: unknown): CurveShape | undefined {
|
||||
return typeof key === 'string' ? CURVE_SHAPES.find((shape) => shape.key === key.toLowerCase()) : undefined
|
||||
}
|
||||
|
||||
function isObject(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
||||
}
|
||||
|
||||
function isKeyframe(value: unknown): value is Keyframe {
|
||||
return Array.isArray(value) && value.length === KEYFRAME_SIZE && value.every((part) => typeof part === 'number')
|
||||
}
|
||||
|
||||
/** Whether {@code value} is keyframes [[t, value], ...], which a range [min, max] and a number are not. */
|
||||
export function isKeyframes(value: unknown): value is Keyframe[] {
|
||||
return Array.isArray(value) && value.length > 0 && value.every(isKeyframe)
|
||||
}
|
||||
|
||||
/** Whether {@code value} is a named curve {"shape": ...} the studio knows. */
|
||||
export function isShape(value: unknown): value is Record<string, unknown> {
|
||||
return isObject(value) && shapeNamed(value.shape) !== undefined
|
||||
}
|
||||
|
||||
/** Whether {@code value} is a curve, as opposed to a number or a [min, max] range. */
|
||||
export function isCurve(value: unknown): boolean {
|
||||
return isKeyframes(value) || isShape(value)
|
||||
}
|
||||
|
||||
/** Whether {@code value} is a number or a range, which {@link curveFrom} makes a curve. */
|
||||
export function canBecomeCurve(value: unknown): boolean {
|
||||
return typeof value === 'number' || rangeOf(value) !== null
|
||||
}
|
||||
|
||||
function rangeOf(value: unknown): [number, number] | null {
|
||||
if (Array.isArray(value) && value.length === RANGE_SIZE && value.every((part) => typeof part === 'number')) {
|
||||
return [value[0], value[1]]
|
||||
}
|
||||
if (isObject(value) && typeof value.min === 'number' && typeof value.max === 'number') {
|
||||
return [value.min, value.max]
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/** A number as a curve that stays at it, a range as a curve rising from its low end to its high end; null for anything else. */
|
||||
export function curveFrom(value: unknown): Keyframe[] | null {
|
||||
if (typeof value === 'number') {
|
||||
return [
|
||||
[0, value],
|
||||
[1, value]
|
||||
]
|
||||
}
|
||||
const range = rangeOf(value)
|
||||
return range === null
|
||||
? null
|
||||
: [
|
||||
[0, range[0]],
|
||||
[1, range[1]]
|
||||
]
|
||||
}
|
||||
|
||||
function numberOf(written: unknown, fallback: number): number {
|
||||
return typeof written === 'number' ? written : fallback
|
||||
}
|
||||
|
||||
/** The value of a curve at {@code t}, from 0 to 1; NaN for a value that is no curve. */
|
||||
export function curveAt(value: unknown, t: number): number {
|
||||
if (isKeyframes(value)) {
|
||||
return keyframesAt(sortedKeyframes(value), t)
|
||||
}
|
||||
if (!isShape(value)) {
|
||||
return Number.NaN
|
||||
}
|
||||
const shape = shapeNamed(value.shape)!
|
||||
const from = numberOf(value.from, DEFAULT_FROM)
|
||||
const to = numberOf(value.to, DEFAULT_TO)
|
||||
const parameter = (name: string): number => numberOf(value[name], shape.parameters.find((candidate) => candidate.name === name)!.fallback)
|
||||
return from + (to - from) * shape.at(Math.max(0, Math.min(1, t)), parameter)
|
||||
}
|
||||
|
||||
export function sortedKeyframes(keys: Keyframe[]): Keyframe[] {
|
||||
return [...keys].sort((a, b) => a[0] - b[0])
|
||||
}
|
||||
|
||||
function keyframesAt(keys: Keyframe[], t: number): number {
|
||||
if (t <= keys[0][0]) {
|
||||
return keys[0][1]
|
||||
}
|
||||
for (let index = 1; index < keys.length; index++) {
|
||||
if (t <= keys[index][0]) {
|
||||
const span = keys[index][0] - keys[index - 1][0]
|
||||
const blend = span <= 0 ? 1 : (t - keys[index - 1][0]) / span
|
||||
return keys[index - 1][1] + (keys[index][1] - keys[index - 1][1]) * blend
|
||||
}
|
||||
}
|
||||
return keys[keys.length - 1][1]
|
||||
}
|
||||
|
||||
/** {@code count} values of the curve, from its start to its end; null for a value that is no curve. */
|
||||
export function samplesOf(value: unknown, count: number): number[] | null {
|
||||
if (!isCurve(value)) {
|
||||
return null
|
||||
}
|
||||
return Array.from({ length: count }, (_, index) => curveAt(value, count === 1 ? 0 : index / (count - 1)))
|
||||
}
|
||||
|
||||
/** The curve as keyframes, such as to move a named curve's shape by hand: its values at evenly spaced points. */
|
||||
export function keyframesFrom(value: unknown): Keyframe[] {
|
||||
if (isKeyframes(value)) {
|
||||
return value
|
||||
}
|
||||
const stops = Array.from({ length: SHAPE_STOPS }, (_, index) => FIRST_STOP + ((LAST_STOP - FIRST_STOP) * index) / (SHAPE_STOPS - 1))
|
||||
return stops.map((t): Keyframe => [t, curveAt(value, t)])
|
||||
}
|
||||
|
||||
/** A linear named curve between the first and last keyframes' values, or the shape itself. */
|
||||
export function shapeFrom(value: unknown): Record<string, unknown> {
|
||||
if (isShape(value)) {
|
||||
return value
|
||||
}
|
||||
const keys = isKeyframes(value) ? sortedKeyframes(value) : []
|
||||
return { shape: 'linear', from: keys.length > 0 ? keys[0][1] : DEFAULT_FROM, to: keys.length > 0 ? keys[keys.length - 1][1] : DEFAULT_TO }
|
||||
}
|
||||
|
||||
/** The shape with {@code key}, keeping its from and to; the other settings of the old shape do not carry over. */
|
||||
export function withShape(shape: Record<string, unknown>, key: string): Record<string, unknown> {
|
||||
return { shape: key, from: numberOf(shape.from, DEFAULT_FROM), to: numberOf(shape.to, DEFAULT_TO) }
|
||||
}
|
||||
|
||||
/** The shape with {@code name} set to {@code number}, or left out when it is undefined so the shape's own default applies. */
|
||||
export function withSetting(shape: Record<string, unknown>, name: string, number: number | undefined): Record<string, unknown> {
|
||||
const { [name]: _replaced, ...others } = shape
|
||||
return number === undefined ? others : { ...others, [name]: number }
|
||||
}
|
||||
|
||||
/** The keyframes with the one at {@code index} (as listed) set to {@code keyframe}. */
|
||||
export function withKeyframe(keys: Keyframe[], index: number, keyframe: Keyframe): Keyframe[] {
|
||||
return keys.map((existing, position) => (position === index ? keyframe : existing))
|
||||
}
|
||||
|
||||
/** The keyframes without the one at {@code index}; the last one stays, since a curve needs a keyframe. */
|
||||
export function withoutKeyframe(keys: Keyframe[], index: number): Keyframe[] {
|
||||
return keys.length <= 1 ? keys : keys.filter((_, position) => position !== index)
|
||||
}
|
||||
|
||||
/** The keyframes with one more halfway across the widest gap, on the curve as it is; a lone keyframe gets one at the other end. */
|
||||
export function withAddedKeyframe(keys: Keyframe[]): Keyframe[] {
|
||||
const sorted = sortedKeyframes(keys)
|
||||
if (sorted.length === 1) {
|
||||
const t = sorted[0][0] === LAST_STOP ? FIRST_STOP : LAST_STOP
|
||||
return sortedKeyframes([...sorted, [t, sorted[0][1]]])
|
||||
}
|
||||
let widest = 0
|
||||
let before = 0
|
||||
for (let index = 1; index < sorted.length; index++) {
|
||||
const gap = sorted[index][0] - sorted[index - 1][0]
|
||||
if (gap > widest) {
|
||||
widest = gap
|
||||
before = index - 1
|
||||
}
|
||||
}
|
||||
const t = sorted[before][0] + widest / 2
|
||||
return sortedKeyframes([...sorted, [t, keyframesAt(sorted, t)]])
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { folderPrefixOf, refusalOfNewKey } from './entryKeys'
|
||||
|
||||
describe('refusalOfNewKey', () => {
|
||||
it('accepts a free, plain key', () => {
|
||||
expect(refusalOfNewKey('trees/oak-2', ['trees/oak'])).toBeNull()
|
||||
})
|
||||
|
||||
it('refuses a key that is taken', () => {
|
||||
expect(refusalOfNewKey('trees/oak', ['trees/oak'])).toBe('trees/oak already exists')
|
||||
})
|
||||
|
||||
it('refuses a blank name', () => {
|
||||
expect(refusalOfNewKey(' ', [])).toBe('Give it a name')
|
||||
})
|
||||
|
||||
it('refuses keys that could leave the folder or are not plain', () => {
|
||||
for (const key of ['Trees/Oak', 'trees//oak', '/oak', 'oak/', '../oak', 'trees/../oak', 'oak.json', 'trees\\oak']) {
|
||||
expect(refusalOfNewKey(key, []), key).toMatch(/^Use lower case/)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('folderPrefixOf', () => {
|
||||
it('keeps the folders of a key with their closing slash', () => {
|
||||
expect(folderPrefixOf('trees/oak/tall')).toBe('trees/oak/')
|
||||
})
|
||||
|
||||
it('is empty for a key in no folder', () => {
|
||||
expect(folderPrefixOf('oak')).toBe('')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,18 @@
|
||||
const FOLDER_SEPARATOR = '/'
|
||||
const KEY = /^[a-z0-9_-]+(\/[a-z0-9_-]+)*$/
|
||||
|
||||
/** Why `key` can't name a new entry beside the `existing` ones, or null when it can; the server checks the same. */
|
||||
export function refusalOfNewKey(key: string, existing: readonly string[]): string | null {
|
||||
if (key.trim() === '') {
|
||||
return 'Give it a name'
|
||||
}
|
||||
if (!KEY.test(key)) {
|
||||
return 'Use lower case letters, digits, - and _, with / between folders'
|
||||
}
|
||||
return existing.includes(key) ? `${key} already exists` : null
|
||||
}
|
||||
|
||||
/** The folder of `key` as a start for naming a new entry in it, such as `trees/`; empty for an entry in no folder. */
|
||||
export function folderPrefixOf(key: string): string {
|
||||
return key.slice(0, key.lastIndexOf(FOLDER_SEPARATOR) + 1)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import type { JsonPath } from '../bridge/types'
|
||||
|
||||
/** The value at {@code path} in a parsed file; undefined where nothing is written. */
|
||||
export function valueAt(root: unknown, path: JsonPath): unknown {
|
||||
let current = root
|
||||
for (const step of path) {
|
||||
if (current === null || typeof current !== 'object') {
|
||||
return undefined
|
||||
}
|
||||
current = (current as Record<string | number, unknown>)[step]
|
||||
}
|
||||
return current
|
||||
}
|
||||
|
||||
/** The file parsed, or undefined when it is not JSON (the editor then shows why instead). */
|
||||
export function parsedText(text: string): unknown {
|
||||
try {
|
||||
return JSON.parse(text)
|
||||
} catch {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { GraphNode, JsonPath } from '../bridge/types'
|
||||
import { NO_PART } from '../bridge/types'
|
||||
import { isWithin, layoutNodes, nodeDrawingPart, NODE_WIDTH } from './nodeLayout'
|
||||
|
||||
function node(path: JsonPath, children: GraphNode[] = []): GraphNode {
|
||||
return {
|
||||
kind: 'Stem',
|
||||
title: 'Stem',
|
||||
path,
|
||||
partId: NO_PART,
|
||||
roles: [],
|
||||
settings: [],
|
||||
children: children.map((child) => ({ wire: '', node: child })),
|
||||
childList: null,
|
||||
movable: true,
|
||||
duplicable: true,
|
||||
additions: []
|
||||
}
|
||||
}
|
||||
|
||||
describe('layoutNodes', () => {
|
||||
it('sets a parent level with the middle of its children, a column to their left', () => {
|
||||
const layout = layoutNodes([node([], [node(['parts', 0]), node(['parts', 1]), node(['parts', 2])])])
|
||||
const [first, , last, parent] = layout.nodes
|
||||
|
||||
expect(parent.y).toBe((first.y + last.y) / 2)
|
||||
expect(first.x - parent.x).toBeGreaterThan(NODE_WIDTH)
|
||||
expect(layout.wires).toHaveLength(3)
|
||||
})
|
||||
|
||||
it('lays the next root out under the tree before it', () => {
|
||||
const layout = layoutNodes([node([], [node(['parts', 0])]), node(['materials', 0])])
|
||||
const material = layout.nodes.find((placed) => placed.id === JSON.stringify(['materials', 0]))!
|
||||
|
||||
expect(material.x).toBe(0)
|
||||
expect(material.y).toBeGreaterThan(Math.max(...layout.nodes.filter((placed) => placed !== material).map((placed) => placed.y)))
|
||||
})
|
||||
})
|
||||
|
||||
describe('nodeDrawingPart', () => {
|
||||
const drawing = (path: JsonPath, partId: number, children: GraphNode[] = []): GraphNode => ({ ...node(path, children), partId })
|
||||
|
||||
it('finds the node that draws the part, whichever tree and depth it is in', () => {
|
||||
const roots = [drawing([], 0, [drawing(['parts', 0], 1)]), drawing(['materials', 0], NO_PART, [drawing(['materials', 0, 'parts', 0], 2)])]
|
||||
|
||||
expect(nodeDrawingPart(roots, 1)?.path).toEqual(['parts', 0])
|
||||
expect(nodeDrawingPart(roots, 2)?.path).toEqual(['materials', 0, 'parts', 0])
|
||||
})
|
||||
|
||||
it('takes the outer node when a node and the one it copies draw the same part', () => {
|
||||
const roots = [drawing([], 3, [drawing(['branches', 'part'], 3)])]
|
||||
|
||||
expect(nodeDrawingPart(roots, 3)?.path).toEqual([])
|
||||
})
|
||||
|
||||
it('finds none for a part no node draws', () => {
|
||||
expect(nodeDrawingPart([drawing([], 0)], 5)).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('isWithin', () => {
|
||||
it('holds for the path itself and what sits inside it, not for a sibling', () => {
|
||||
expect(isWithin(['parts', 0, 'children', 1], ['parts', 0])).toBe(true)
|
||||
expect(isWithin(['parts', 0], ['parts', 0])).toBe(true)
|
||||
expect(isWithin(['parts', 1], ['parts', 0])).toBe(false)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,108 @@
|
||||
import type { GraphNode, JsonPath } from '../bridge/types'
|
||||
|
||||
export const NODE_WIDTH = 168
|
||||
export const NODE_HEIGHT = 46
|
||||
const COLUMN_GAP = 64
|
||||
const ROW_GAP = 10
|
||||
const TREE_GAP = 26
|
||||
|
||||
/** A node where the canvas draws it, by its top left corner; `id` tells it from every other node of the file. */
|
||||
export interface PlacedNode {
|
||||
id: string
|
||||
node: GraphNode
|
||||
x: number
|
||||
y: number
|
||||
}
|
||||
|
||||
export interface PlacedWire {
|
||||
from: PlacedNode
|
||||
to: PlacedNode
|
||||
label: string
|
||||
}
|
||||
|
||||
export interface NodeLayout {
|
||||
nodes: PlacedNode[]
|
||||
wires: PlacedWire[]
|
||||
width: number
|
||||
height: number
|
||||
}
|
||||
|
||||
export function idOf(path: JsonPath): string {
|
||||
return JSON.stringify(path)
|
||||
}
|
||||
|
||||
/** The node at {@code path} among the trees of {@code roots}, or null when there is none, such as after it was deleted. */
|
||||
export function nodeWithPath(roots: GraphNode[], path: JsonPath): GraphNode | null {
|
||||
const id = idOf(path)
|
||||
for (const root of roots) {
|
||||
if (idOf(root.path) === id) {
|
||||
return root
|
||||
}
|
||||
const found = nodeWithPath(
|
||||
root.children.map((link) => link.node),
|
||||
path
|
||||
)
|
||||
if (found !== null) {
|
||||
return found
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/** The first node, going down each tree in turn, that draws {@code part}, or null when none does. */
|
||||
export function nodeDrawingPart(roots: GraphNode[], part: number): GraphNode | null {
|
||||
for (const root of roots) {
|
||||
if (root.partId === part) {
|
||||
return root
|
||||
}
|
||||
const found = nodeDrawingPart(
|
||||
root.children.map((link) => link.node),
|
||||
part
|
||||
)
|
||||
if (found !== null) {
|
||||
return found
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
/** Whether {@code path} is {@code ancestor} or sits inside it. */
|
||||
export function isWithin(path: JsonPath, ancestor: JsonPath): boolean {
|
||||
return ancestor.length <= path.length && ancestor.every((step, index) => path[index] === step)
|
||||
}
|
||||
|
||||
/**
|
||||
* Lays each root's tree out from left to right, a column per generation, one tree under the other. Leaves take a row
|
||||
* each and a parent sits level with the middle of its children, so wires never cross.
|
||||
*/
|
||||
export function layoutNodes(roots: GraphNode[]): NodeLayout {
|
||||
const nodes: PlacedNode[] = []
|
||||
const wires: PlacedWire[] = []
|
||||
let nextTop = 0
|
||||
let width = 0
|
||||
|
||||
const place = (node: GraphNode, depth: number): PlacedNode => {
|
||||
const x = depth * (NODE_WIDTH + COLUMN_GAP)
|
||||
width = Math.max(width, x + NODE_WIDTH)
|
||||
const children = node.children.map((link) => ({ label: link.wire, placed: place(link.node, depth + 1) }))
|
||||
const y = children.length === 0 ? takeRow() : (children[0].placed.y + children[children.length - 1].placed.y) / 2
|
||||
const placed: PlacedNode = { id: idOf(node.path), node, x, y }
|
||||
nodes.push(placed)
|
||||
for (const child of children) {
|
||||
wires.push({ from: placed, to: child.placed, label: child.label })
|
||||
}
|
||||
return placed
|
||||
}
|
||||
|
||||
const takeRow = (): number => {
|
||||
const top = nextTop
|
||||
nextTop += NODE_HEIGHT + ROW_GAP
|
||||
return top
|
||||
}
|
||||
|
||||
for (const root of roots) {
|
||||
place(root, 0)
|
||||
nextTop += TREE_GAP
|
||||
}
|
||||
return { nodes, wires, width, height: Math.max(0, nextTop - ROW_GAP - TREE_GAP) }
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { NodeSettings, SettingOption, SettingsType, ValueKind } from '../bridge/types'
|
||||
import { foldedSections, idOfFold, visibleFolds } from './settingFolds'
|
||||
|
||||
function option(name: string, kind: ValueKind): SettingOption {
|
||||
return { name, description: '', required: false, minimum: null, maximum: null, minItems: null, defaultValue: null, kind }
|
||||
}
|
||||
|
||||
const text: ValueKind = { kind: 'text', format: 'PLAIN' }
|
||||
const any: ValueKind = { kind: 'any' }
|
||||
|
||||
const types: Record<string, SettingsType> = {
|
||||
Material: {
|
||||
description: '',
|
||||
options: [
|
||||
option('role', text),
|
||||
option('block', { kind: 'reference', reference: 'BLOCK', format: 'BLOCK_ID' }),
|
||||
option('offset', { kind: 'object', type: 'Offset' }),
|
||||
option('rules', { kind: 'list', element: { kind: 'object', type: 'Rule' }, unique: false }),
|
||||
option('parts', { kind: 'list', element: { kind: 'object', type: 'Rule' }, unique: false })
|
||||
]
|
||||
},
|
||||
Offset: { description: '', options: [option('x', any), option('y', any)] },
|
||||
Rule: { description: '', options: [option('chance', any), option('face', text)] }
|
||||
}
|
||||
|
||||
const material: NodeSettings = { title: 'Material', path: ['materials', 0], type: 'Material', shownAsNodes: ['parts'] }
|
||||
const file = {
|
||||
materials: [
|
||||
{
|
||||
role: 'wood',
|
||||
block: 'minecraft:birch_wood',
|
||||
offset: { x: 2, y: [[0, 1], [1, 0]] },
|
||||
rules: [{ chance: 0.5 }, { face: 'top' }]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
describe('foldedSections', () => {
|
||||
it('folds an object setting into a section, and a list of objects into a section of items', () => {
|
||||
const folds = foldedSections(material, types, file)
|
||||
|
||||
expect(folds.map((fold) => fold.title)).toEqual(['Material', 'offset', 'rules', '1', '2'])
|
||||
expect(folds.map((fold) => fold.kind)).toEqual(['own', 'group', 'list', 'item', 'item'])
|
||||
expect(folds.map((fold) => fold.depth)).toEqual([0, 1, 1, 2, 2])
|
||||
expect(folds[4].path).toEqual(['materials', 0, 'rules', 1])
|
||||
expect(folds[2].holder).toEqual({ object: ['materials', 0], key: 'rules' })
|
||||
})
|
||||
|
||||
it('leaves the folded settings and the ones shown as nodes out of the fields of the section that holds them', () => {
|
||||
const [own] = foldedSections(material, types, file)
|
||||
|
||||
expect(own.options.map((setting) => setting.name)).toEqual(['role', 'block'])
|
||||
})
|
||||
|
||||
it('sums a section up by what it holds, a curve as curve and the default namespace left off', () => {
|
||||
const folds = foldedSections(material, types, file)
|
||||
|
||||
expect(folds[0].summary).toBe('role wood · block birch_wood · rules 2')
|
||||
expect(folds[1].summary).toBe('x 2 · y curve')
|
||||
expect(folds[2].summary).toBe('2 items')
|
||||
})
|
||||
|
||||
it('keeps a setting that is not written as an object a field', () => {
|
||||
const [own, ...inside] = foldedSections(material, types, { materials: [{ role: 'wood' }] })
|
||||
|
||||
expect(inside).toEqual([])
|
||||
expect(own.options.map((setting) => setting.name)).toEqual(['role', 'block', 'offset', 'rules'])
|
||||
})
|
||||
})
|
||||
|
||||
describe('visibleFolds', () => {
|
||||
it('hides what is inside a fold that is folded', () => {
|
||||
const folds = foldedSections(material, types, file)
|
||||
|
||||
expect(visibleFolds(folds, new Set()).map((fold) => fold.title)).toEqual(['Material', 'offset', 'rules'])
|
||||
expect(visibleFolds(folds, new Set([idOfFold(folds[2])])).map((fold) => fold.title)).toEqual(['Material', 'offset', 'rules', '1', '2'])
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,128 @@
|
||||
import type { JsonPath, NodeSettings, SettingOption, SettingsType } from '../bridge/types'
|
||||
import { isCurve } from './curves'
|
||||
import { isWithin } from './nodeLayout'
|
||||
import { textOf } from './settingText'
|
||||
import { valueAt } from './jsonValues'
|
||||
|
||||
const SUMMARY_SETTINGS = 3
|
||||
const SUMMARY_SEPARATOR = ' · '
|
||||
const DEFAULT_NAMESPACE = 'minecraft:'
|
||||
|
||||
/**
|
||||
* What a section is: a node's own settings, a setting written as an object, a setting written as a list of objects, or
|
||||
* one element of such a list. All but the first fold.
|
||||
*/
|
||||
export type FoldKind = 'own' | 'group' | 'list' | 'item'
|
||||
|
||||
/** One object of the file whose settings the inspector shows, below the ones that hold it. */
|
||||
export interface SettingsFold {
|
||||
title: string
|
||||
path: JsonPath
|
||||
type: string
|
||||
kind: FoldKind
|
||||
/** 0 for a node's own sections, one more for each object it is inside. */
|
||||
depth: number
|
||||
/** A short reading of what it holds, shown while it is folded. */
|
||||
summary: string
|
||||
/** The object and member that hold a group or list, to unset it; null for the rest. */
|
||||
holder: { object: JsonPath; key: string } | null
|
||||
/** The settings written plainly in it, as fields; those that are folds of their own are not among them. */
|
||||
options: SettingOption[]
|
||||
}
|
||||
|
||||
function isObject(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
||||
}
|
||||
|
||||
function isObjects(value: unknown): value is Record<string, unknown>[] {
|
||||
return Array.isArray(value) && value.every(isObject)
|
||||
}
|
||||
|
||||
export function idOfFold(fold: SettingsFold): string {
|
||||
return JSON.stringify(fold.path)
|
||||
}
|
||||
|
||||
/**
|
||||
* The sections of one object of a node and the objects inside it, in file order, each followed by those inside it. A
|
||||
* setting that is itself an object whose type the schema describes is a section of its own one level deeper, and so is
|
||||
* each element of a list of objects; one that is not written stays a field.
|
||||
*/
|
||||
export function foldedSections(section: NodeSettings, types: Record<string, SettingsType>, values: unknown): SettingsFold[] {
|
||||
const folds: SettingsFold[] = []
|
||||
addFold(folds, types, values, { title: section.title, path: section.path, type: section.type, kind: 'own', depth: 0, holder: null }, new Set(section.shownAsNodes))
|
||||
return folds
|
||||
}
|
||||
|
||||
type FoldHead = Pick<SettingsFold, 'title' | 'path' | 'type' | 'kind' | 'depth' | 'holder'>
|
||||
|
||||
function addFold(into: SettingsFold[], types: Record<string, SettingsType>, values: unknown, head: FoldHead, shownAsNodes: Set<string>): void {
|
||||
const options: SettingOption[] = []
|
||||
const inside: SettingsFold[] = []
|
||||
const summary: string[] = []
|
||||
for (const option of types[head.type]?.options ?? []) {
|
||||
if (shownAsNodes.has(option.name)) {
|
||||
continue
|
||||
}
|
||||
const path = [...head.path, option.name]
|
||||
const value = valueAt(values, path)
|
||||
const holder = { object: head.path, key: option.name }
|
||||
const objectType = option.kind.kind === 'object' ? option.kind.type : null
|
||||
const itemType = option.kind.kind === 'list' && option.kind.element.kind === 'object' ? option.kind.element.type : null
|
||||
if (objectType !== null && isObject(value) && types[objectType] !== undefined) {
|
||||
addFold(inside, types, values, { title: option.name, path, type: objectType, kind: 'group', depth: head.depth + 1, holder }, new Set())
|
||||
continue
|
||||
}
|
||||
if (itemType !== null && isObjects(value) && types[itemType] !== undefined) {
|
||||
addList(inside, types, values, { option, path, itemType, count: value.length, depth: head.depth + 1, holder })
|
||||
summary.push(`${option.name} ${value.length}`)
|
||||
continue
|
||||
}
|
||||
options.push(option)
|
||||
if (value !== undefined) {
|
||||
summary.push(`${option.name} ${shortText(option, value)}`)
|
||||
}
|
||||
}
|
||||
into.push({ ...head, summary: summary.slice(0, SUMMARY_SETTINGS).join(SUMMARY_SEPARATOR), options })
|
||||
into.push(...inside)
|
||||
}
|
||||
|
||||
interface ListFold {
|
||||
option: SettingOption
|
||||
path: JsonPath
|
||||
itemType: string
|
||||
count: number
|
||||
depth: number
|
||||
holder: { object: JsonPath; key: string }
|
||||
}
|
||||
|
||||
function addList(into: SettingsFold[], types: Record<string, SettingsType>, values: unknown, list: ListFold): void {
|
||||
into.push({
|
||||
title: list.option.name,
|
||||
path: list.path,
|
||||
type: list.itemType,
|
||||
kind: 'list',
|
||||
depth: list.depth,
|
||||
summary: `${list.count} ${list.count === 1 ? 'item' : 'items'}`,
|
||||
holder: list.holder,
|
||||
options: []
|
||||
})
|
||||
for (let index = 0; index < list.count; index++) {
|
||||
addFold(
|
||||
into,
|
||||
types,
|
||||
values,
|
||||
{ title: String(index + 1), path: [...list.path, index], type: list.itemType, kind: 'item', depth: list.depth + 1, holder: null },
|
||||
new Set()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function shortText(option: SettingOption, value: unknown): string {
|
||||
return isCurve(value) ? 'curve' : textOf(option.kind, value).replaceAll(DEFAULT_NAMESPACE, '')
|
||||
}
|
||||
|
||||
/** The folds shown while the ones in {@code open} are unfolded: a fold inside another that is folded is hidden. */
|
||||
export function visibleFolds(folds: SettingsFold[], open: ReadonlySet<string>): SettingsFold[] {
|
||||
const foldable = folds.filter((fold) => fold.kind !== 'own')
|
||||
return folds.filter((fold) => !foldable.some((outer) => outer !== fold && !open.has(idOfFold(outer)) && outer.path.length < fold.path.length && isWithin(fold.path, outer.path)))
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { ValueKind } from '../bridge/types'
|
||||
import { literalOf, textOf } from './settingText'
|
||||
|
||||
const roles: ValueKind = { kind: 'list', element: { kind: 'text', format: 'PLAIN' }, unique: false }
|
||||
|
||||
describe('string lists', () => {
|
||||
it('read as commas and are written back quoted', () => {
|
||||
expect(textOf(roles, ['wood', 'leaves'])).toBe('wood, leaves')
|
||||
expect(literalOf(roles, 'wood, leaves, ')).toBe('["wood","leaves"]')
|
||||
expect(literalOf(roles, ',')).toBe('[]')
|
||||
})
|
||||
|
||||
it('keep a list typed as JSON, and show a list of anything else as JSON', () => {
|
||||
expect(literalOf(roles, '["a", "b"]')).toBe('["a", "b"]')
|
||||
expect(textOf(roles, [1, 2])).toBe('[1,2]')
|
||||
})
|
||||
})
|
||||
|
||||
describe('text', () => {
|
||||
it('shows a string as it is and writes it quoted', () => {
|
||||
const text: ValueKind = { kind: 'text', format: 'PLAIN' }
|
||||
|
||||
expect(textOf(text, 'wood')).toBe('wood')
|
||||
expect(literalOf(text, 'wood "a"')).toBe('"wood \\"a\\""')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,48 @@
|
||||
import type { ValueKind } from '../bridge/types'
|
||||
|
||||
export const NOT_SET = ''
|
||||
export const LIST_SEPARATOR = ', '
|
||||
|
||||
/** Whether {@code kind} is a string naming something, typed as text. */
|
||||
export function isText(kind: ValueKind): boolean {
|
||||
return kind.kind === 'text' || kind.kind === 'reference' || kind.kind === 'resource'
|
||||
}
|
||||
|
||||
/** Whether {@code kind} is a list of strings, such as the roles a decoration goes on, which is typed as {@code a, b}. */
|
||||
export function isStringList(kind: ValueKind): boolean {
|
||||
return kind.kind === 'list' && isText(kind.element)
|
||||
}
|
||||
|
||||
function isStrings(value: unknown): value is string[] {
|
||||
return Array.isArray(value) && value.every((element) => typeof element === 'string')
|
||||
}
|
||||
|
||||
/** What the field shows for the value the file holds. */
|
||||
export function textOf(kind: ValueKind, value: unknown): string {
|
||||
if (value === undefined) {
|
||||
return NOT_SET
|
||||
}
|
||||
if (isText(kind) && typeof value === 'string') {
|
||||
return value
|
||||
}
|
||||
return isStringList(kind) && isStrings(value) ? value.join(LIST_SEPARATOR) : JSON.stringify(value)
|
||||
}
|
||||
|
||||
/** The strings a list is typed as, each trimmed, and none left empty. */
|
||||
export function itemsOf(draft: string): string[] {
|
||||
return draft
|
||||
.split(',')
|
||||
.map((item) => item.trim())
|
||||
.filter((item) => item !== '')
|
||||
}
|
||||
|
||||
/** What the field holds as JSON to write; a list typed as {@code a, b} is written as an array unless it already is one. */
|
||||
export function literalOf(kind: ValueKind, draft: string): string {
|
||||
if (isText(kind)) {
|
||||
return JSON.stringify(draft)
|
||||
}
|
||||
if (isStringList(kind) && !draft.trim().startsWith('[')) {
|
||||
return JSON.stringify(itemsOf(draft))
|
||||
}
|
||||
return draft.trim()
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { SuggestionStore } from './suggestionStore'
|
||||
|
||||
describe('SuggestionStore', () => {
|
||||
it('asks once for a list however often it is read', async () => {
|
||||
const fetch = vi.fn().mockResolvedValue(['minecraft:stone'])
|
||||
const store = new SuggestionStore(fetch)
|
||||
|
||||
await store.load({ from: 'reference', reference: 'BLOCK' })
|
||||
const again = await store.load({ from: 'reference', reference: 'BLOCK' })
|
||||
|
||||
expect(again).toEqual(['minecraft:stone'])
|
||||
expect(fetch).toHaveBeenCalledTimes(1)
|
||||
expect(fetch).toHaveBeenCalledWith({ reference: 'BLOCK' })
|
||||
})
|
||||
|
||||
it('asks again after a list could not be read', async () => {
|
||||
const fetch = vi.fn().mockRejectedValueOnce(new Error('down')).mockResolvedValue(['birch'])
|
||||
const store = new SuggestionStore(fetch)
|
||||
|
||||
await expect(store.load({ from: 'resource', resource: 'iris:object' })).rejects.toThrow('down')
|
||||
await expect(store.load({ from: 'resource', resource: 'iris:object' })).resolves.toEqual(['birch'])
|
||||
expect(fetch).toHaveBeenLastCalledWith({ resource: 'iris:object' })
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,23 @@
|
||||
import { sourceKey, type ListedSource } from './suggestions'
|
||||
|
||||
/** What the server lists for the suggestions of a source that names platform or pack entries. */
|
||||
export type SuggestionFetch = (of: { reference: string } | { resource: string }) => Promise<string[]>
|
||||
|
||||
/** The suggestion lists, each asked for once; a list that could not be read is asked for again next time. */
|
||||
export class SuggestionStore {
|
||||
private readonly lists = new Map<string, Promise<string[]>>()
|
||||
|
||||
constructor(private readonly fetch: SuggestionFetch) {}
|
||||
|
||||
load(source: ListedSource): Promise<string[]> {
|
||||
const key = sourceKey(source)
|
||||
const known = this.lists.get(key)
|
||||
if (known !== undefined) {
|
||||
return known
|
||||
}
|
||||
const asked = this.fetch(source.from === 'reference' ? { reference: source.reference } : { resource: source.resource })
|
||||
this.lists.set(key, asked)
|
||||
asked.catch(() => this.lists.delete(key))
|
||||
return asked
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { GraphNode, SettingOption } from '../bridge/types'
|
||||
import { NO_PART } from '../bridge/types'
|
||||
import { completed, matching, rolesOf, suggestionSourceOf, wordBeingTyped } from './suggestions'
|
||||
|
||||
function option(name: string, kind: SettingOption['kind']): SettingOption {
|
||||
return { name, description: '', required: false, minimum: null, maximum: null, minItems: null, defaultValue: null, kind }
|
||||
}
|
||||
|
||||
function node(roles: string[], children: GraphNode[] = []): GraphNode {
|
||||
return {
|
||||
kind: 'Stem',
|
||||
title: 'Stem',
|
||||
path: [],
|
||||
partId: NO_PART,
|
||||
roles,
|
||||
settings: [],
|
||||
children: children.map((child) => ({ wire: '', node: child })),
|
||||
childList: null,
|
||||
movable: false,
|
||||
duplicable: false,
|
||||
additions: []
|
||||
}
|
||||
}
|
||||
|
||||
describe('suggestionSourceOf', () => {
|
||||
it('names the registry of a reference, the kind of a resource and the roles of the object', () => {
|
||||
expect(suggestionSourceOf('Material', option('block', { kind: 'reference', reference: 'BLOCK', format: 'BLOCK_ID' }))).toEqual({ from: 'reference', reference: 'BLOCK' })
|
||||
expect(suggestionSourceOf('Part', option('skin', { kind: 'resource', resource: 'iris:object' }))).toEqual({ from: 'resource', resource: 'iris:object' })
|
||||
})
|
||||
|
||||
it('takes the roles for the settings that name one', () => {
|
||||
const on = option('on', { kind: 'list', element: { kind: 'text', format: 'PLAIN' }, unique: false })
|
||||
|
||||
expect(suggestionSourceOf('art.arcane.iris.engine.procedural.part.ProceduralDecoration', on)).toEqual({ from: 'roles' })
|
||||
expect(suggestionSourceOf('art.arcane.iris.engine.procedural.part.ProceduralDecoration', option('at', { kind: 'text', format: 'PLAIN' }))).toBeNull()
|
||||
})
|
||||
|
||||
it('takes the elements of a list of references, and nothing for free text', () => {
|
||||
expect(suggestionSourceOf('Rule', option('blocks', { kind: 'list', element: { kind: 'reference', reference: 'BLOCK', format: 'BLOCK_ID' }, unique: false }))).toEqual({ from: 'reference', reference: 'BLOCK' })
|
||||
expect(suggestionSourceOf('Rule', option('note', { kind: 'text', format: 'PLAIN' }))).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('rolesOf', () => {
|
||||
it('lists each role of the whole tree once, sorted', () => {
|
||||
expect(rolesOf([node(['wood', 'leaves'], [node(['wood', 'bark'])]), node(['moss'])])).toEqual(['bark', 'leaves', 'moss', 'wood'])
|
||||
})
|
||||
})
|
||||
|
||||
describe('matching', () => {
|
||||
const blocks = ['minecraft:oak_log', 'minecraft:birch_log', 'minecraft:oak_leaves', 'minecraft:stone']
|
||||
|
||||
it('puts what starts with the typed text before what holds it', () => {
|
||||
expect(matching(blocks, 'minecraft:oak')).toEqual(['minecraft:oak_log', 'minecraft:oak_leaves'])
|
||||
expect(matching(blocks, 'oak')).toEqual(['minecraft:oak_log', 'minecraft:oak_leaves'])
|
||||
expect(matching(['a_log', 'log'], 'log')).toEqual([])
|
||||
expect(matching(['a_log', 'logs'], 'log')).toEqual(['logs', 'a_log'])
|
||||
})
|
||||
|
||||
it('suggests nothing for nothing typed or a choice that is already typed out', () => {
|
||||
expect(matching(blocks, '')).toEqual([])
|
||||
expect(matching(blocks, 'MINECRAFT:STONE')).toEqual([])
|
||||
})
|
||||
|
||||
it('shows only the first few', () => {
|
||||
expect(matching(Array.from({ length: 30 }, (_, index) => `block_${index}`), 'block')).toHaveLength(8)
|
||||
})
|
||||
})
|
||||
|
||||
describe('the word being typed', () => {
|
||||
it('is the whole text, or for a list the item after the last comma', () => {
|
||||
expect(wordBeingTyped('oak', false)).toEqual({ start: 0, typed: 'oak' })
|
||||
expect(wordBeingTyped('wood, lea', true)).toEqual({ start: 6, typed: 'lea' })
|
||||
expect(wordBeingTyped('wood, ', true)).toEqual({ start: 6, typed: '' })
|
||||
})
|
||||
|
||||
it('is replaced by the choice, a list ready for its next item', () => {
|
||||
expect(completed('minecraft:oa', 'minecraft:oak_log', false)).toBe('minecraft:oak_log')
|
||||
expect(completed('wood, lea', 'leaves', true)).toBe('wood, leaves, ')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,79 @@
|
||||
import type { GraphNode, SettingOption, ValueKind } from '../bridge/types'
|
||||
import { LIST_SEPARATOR } from './settingText'
|
||||
|
||||
/** What an option may be typed as: the entries of a platform registry, the keys of the pack's resources of a kind, or the roles of the object. */
|
||||
export type SuggestionSource = { from: 'reference'; reference: string } | { from: 'resource'; resource: string } | { from: 'roles' }
|
||||
|
||||
/** Settings that name a role of the object being edited, by the schema type and option (ProceduralPart, ProceduralMaterial and ProceduralDecoration). */
|
||||
const ROLE_OPTIONS: ReadonlySet<string> = new Set([
|
||||
'art.arcane.iris.engine.procedural.part.ProceduralPart.role',
|
||||
'art.arcane.iris.engine.procedural.part.ProceduralMaterial.role',
|
||||
'art.arcane.iris.engine.procedural.part.ProceduralDecoration.on'
|
||||
])
|
||||
|
||||
/** A source the server lists, as opposed to the roles, which the studio reads from the nodes. */
|
||||
export type ListedSource = Exclude<SuggestionSource, { from: 'roles' }>
|
||||
|
||||
const MOST_SHOWN = 8
|
||||
|
||||
/** Where the suggestions for {@code option} of the schema type {@code type} come from; null when it is typed freely. */
|
||||
export function suggestionSourceOf(type: string, option: SettingOption): SuggestionSource | null {
|
||||
if (ROLE_OPTIONS.has(`${type}.${option.name}`)) {
|
||||
return { from: 'roles' }
|
||||
}
|
||||
const kind: ValueKind = option.kind.kind === 'list' ? option.kind.element : option.kind
|
||||
if (kind.kind === 'reference') {
|
||||
return { from: 'reference', reference: kind.reference }
|
||||
}
|
||||
return kind.kind === 'resource' ? { from: 'resource', resource: kind.resource } : null
|
||||
}
|
||||
|
||||
export function sourceKey(source: ListedSource): string {
|
||||
return source.from === 'reference' ? `reference:${source.reference}` : `resource:${source.resource}`
|
||||
}
|
||||
|
||||
/** Every role the nodes place or decorate, once each and sorted. */
|
||||
export function rolesOf(roots: GraphNode[]): string[] {
|
||||
const roles = new Set<string>()
|
||||
const visit = (node: GraphNode): void => {
|
||||
node.roles.forEach((role) => roles.add(role))
|
||||
node.children.forEach((link) => visit(link.node))
|
||||
}
|
||||
roots.forEach(visit)
|
||||
return [...roles].sort()
|
||||
}
|
||||
|
||||
/** The word being typed: from where it starts in {@code draft}, with what is typed of it. For a list that is the item after the last comma. */
|
||||
export function wordBeingTyped(draft: string, isList: boolean): { start: number; typed: string } {
|
||||
const start = isList ? draft.lastIndexOf(',') + 1 : 0
|
||||
const typed = draft.slice(start)
|
||||
return { start: start + (typed.length - typed.trimStart().length), typed: typed.trim() }
|
||||
}
|
||||
|
||||
/** The choices that hold what is typed, those that start with it first; none while nothing is typed or it is already a choice. */
|
||||
export function matching(choices: readonly string[], typed: string): string[] {
|
||||
const wanted = typed.toLowerCase()
|
||||
if (wanted === '') {
|
||||
return []
|
||||
}
|
||||
const starting: string[] = []
|
||||
const containing: string[] = []
|
||||
for (const choice of choices) {
|
||||
const lower = choice.toLowerCase()
|
||||
if (lower === wanted) {
|
||||
return []
|
||||
}
|
||||
if (lower.startsWith(wanted)) {
|
||||
starting.push(choice)
|
||||
} else if (lower.includes(wanted)) {
|
||||
containing.push(choice)
|
||||
}
|
||||
}
|
||||
return [...starting, ...containing].slice(0, MOST_SHOWN)
|
||||
}
|
||||
|
||||
/** The draft with the word being typed replaced by {@code choice}; a list gets its separator ready for the next item. */
|
||||
export function completed(draft: string, choice: string, isList: boolean): string {
|
||||
const { start } = wordBeingTyped(draft, isList)
|
||||
return draft.slice(0, start) + choice + (isList ? LIST_SEPARATOR : '')
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { BridgeError, STATUS_CONFLICT, type BridgeClient } from '../bridge/BridgeClient'
|
||||
import type { EditorState, GraphEdit } from '../bridge/types'
|
||||
import { EditHistory } from './EditHistory'
|
||||
|
||||
export interface NodeEditor {
|
||||
/** The entry's file as it is now; null while it is read. */
|
||||
state: EditorState | null
|
||||
saving: boolean
|
||||
canUndo: boolean
|
||||
canRedo: boolean
|
||||
edit(edit: GraphEdit): void
|
||||
undo(): void
|
||||
redo(): void
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads an entry's file as nodes and edits it. Edits are sent one after another, each on the text the one before left,
|
||||
* so quick edits never refuse each other; one refused because the file changed elsewhere reads the file again.
|
||||
*/
|
||||
export function useNodeEditor(client: BridgeClient, viewId: string, key: string | null, packRevision: number, tell: (message: string) => void): NodeEditor {
|
||||
const [state, setState] = useState<EditorState | null>(null)
|
||||
const [saving, setSaving] = useState(false)
|
||||
const [, setHistoryChanges] = useState(0)
|
||||
const history = useRef(new EditHistory())
|
||||
const shown = useRef<EditorState | null>(null)
|
||||
const queue = useRef<Promise<void>>(Promise.resolve())
|
||||
const entry = useRef({ viewId, key })
|
||||
|
||||
const run = useCallback(
|
||||
(task: (current: EditorState | null) => Promise<EditorState | null>): void => {
|
||||
const asked = entry.current
|
||||
queue.current = queue.current.then(async () => {
|
||||
if (entry.current !== asked) {
|
||||
return
|
||||
}
|
||||
setSaving(true)
|
||||
try {
|
||||
const next = await task(shown.current)
|
||||
if (entry.current === asked && next !== null) {
|
||||
shown.current = next
|
||||
setState(next)
|
||||
}
|
||||
} catch (failure) {
|
||||
if (entry.current !== asked) {
|
||||
return
|
||||
}
|
||||
tell((failure as Error).message)
|
||||
if (failure instanceof BridgeError && failure.status === STATUS_CONFLICT && asked.key !== null) {
|
||||
const reread = await client.sceneFile(asked.viewId, asked.key).catch(() => null)
|
||||
if (reread !== null && entry.current === asked) {
|
||||
shown.current = reread
|
||||
setState(reread)
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
setSaving(false)
|
||||
setHistoryChanges((changes) => changes + 1)
|
||||
}
|
||||
})
|
||||
},
|
||||
[client, tell]
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
entry.current = { viewId, key }
|
||||
history.current = new EditHistory()
|
||||
shown.current = null
|
||||
setState(null)
|
||||
}, [viewId, key])
|
||||
|
||||
useEffect(() => {
|
||||
if (key !== null) {
|
||||
run(() => client.sceneFile(viewId, key))
|
||||
}
|
||||
}, [client, viewId, key, packRevision, run])
|
||||
|
||||
const edit = useCallback(
|
||||
(change: GraphEdit) =>
|
||||
run(async (current) => {
|
||||
if (current === null || key === null) {
|
||||
return null
|
||||
}
|
||||
const next = await client.sceneEdit(viewId, key, current.revision, change)
|
||||
if (next.text !== current.text) {
|
||||
history.current.edited(current.text)
|
||||
}
|
||||
return next
|
||||
}),
|
||||
[client, viewId, key, run]
|
||||
)
|
||||
|
||||
const undo = useCallback(
|
||||
() =>
|
||||
run(async (current) => {
|
||||
const earlier = history.current.nextUndo()
|
||||
if (current === null || key === null || earlier === undefined) {
|
||||
return null
|
||||
}
|
||||
const next = await client.sceneWrite(viewId, key, current.revision, earlier)
|
||||
history.current.undone(current.text)
|
||||
return next
|
||||
}),
|
||||
[client, viewId, key, run]
|
||||
)
|
||||
|
||||
const redo = useCallback(
|
||||
() =>
|
||||
run(async (current) => {
|
||||
const later = history.current.nextRedo()
|
||||
if (current === null || key === null || later === undefined) {
|
||||
return null
|
||||
}
|
||||
const next = await client.sceneWrite(viewId, key, current.revision, later)
|
||||
history.current.redone(current.text)
|
||||
return next
|
||||
}),
|
||||
[client, viewId, key, run]
|
||||
)
|
||||
|
||||
return { state, saving, canUndo: history.current.canUndo, canRedo: history.current.canRedo, edit, undo, redo }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference types="vite/client" />
|
||||
import type { StudioHost } from '../../shared/bridge'
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
studio: StudioHost
|
||||
}
|
||||
}
|
||||
|
||||
export {}
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,6 @@
|
||||
The icons in this folder and its subfolders come from the IntelliJ Platform (https://github.com/JetBrains/intellij-community),
|
||||
platform/icons/src/expui, Copyright 2000-2023 JetBrains s.r.o. and contributors,
|
||||
used under the Apache License 2.0 (LICENSE-APACHE-2.0.txt).
|
||||
memory.svg is profileMemory.svg with its profiling badge removed.
|
||||
theme.svg, blocks.svg, borders.svg, shading.svg, mob.svg, actualZoom.svg, decoration.svg, and in views/ biomes.svg, regions.svg,
|
||||
world-3d.svg, saved-world.svg, noise.svg and objects.svg are the studio's own, drawn to match.
|
||||
@@ -0,0 +1,5 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.5 5.5L4.5 4V12M10.5 5.5L12.5 4V12" stroke="#6C707E" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<circle cx="7.75" cy="6.5" r="0.75" fill="#6C707E"/>
|
||||
<circle cx="7.75" cy="10.5" r="0.75" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 323 B |
@@ -0,0 +1,5 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.5 5.5L4.5 4V12M10.5 5.5L12.5 4V12" stroke="#CED0D6" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<circle cx="7.75" cy="6.5" r="0.75" fill="#CED0D6"/>
|
||||
<circle cx="7.75" cy="10.5" r="0.75" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 323 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 1C7.77614 1 8 1.22386 8 1.5V7H13.5C13.7761 7 14 7.22386 14 7.5C14 7.77614 13.7761 8 13.5 8H8V13.5C8 13.7761 7.77614 14 7.5 14C7.22386 14 7 13.7761 7 13.5V8H1.5C1.22386 8 1 7.77614 1 7.5C1 7.22386 1.22386 7 1.5 7H7V1.5C7 1.22386 7.22386 1 7.5 1Z" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 547 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 1C7.77614 1 8 1.22386 8 1.5V7H13.5C13.7761 7 14 7.22386 14 7.5C14 7.77614 13.7761 8 13.5 8H8V13.5C8 13.7761 7.77614 14 7.5 14C7.22386 14 7 13.7761 7 13.5V8H1.5C1.22386 8 1 7.77614 1 7.5C1 7.22386 1.22386 7 1.5 7H7V1.5C7 1.22386 7.22386 1 7.5 1Z" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 547 B |
@@ -0,0 +1,4 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8 1.5L13.5 4.5V11.5L8 14.5L2.5 11.5V4.5L8 1.5Z" stroke="#6C707E" stroke-linejoin="round"/>
|
||||
<path d="M2.5 4.5L8 7.5L13.5 4.5M8 7.5V14.5" stroke="#6C707E" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 292 B |
@@ -0,0 +1,4 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8 1.5L13.5 4.5V11.5L8 14.5L2.5 11.5V4.5L8 1.5Z" stroke="#CED0D6" stroke-linejoin="round"/>
|
||||
<path d="M2.5 4.5L8 7.5L13.5 4.5M8 7.5V14.5" stroke="#CED0D6" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 292 B |
@@ -0,0 +1,3 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.5 5V3.5C2.5 2.95 2.95 2.5 3.5 2.5H5M7 2.5H9M11 2.5H12.5C13.05 2.5 13.5 2.95 13.5 3.5V5M13.5 7V9M13.5 11V12.5C13.5 13.05 13.05 13.5 12.5 13.5H11M9 13.5H7M5 13.5H3.5C2.95 13.5 2.5 13.05 2.5 12.5V11M2.5 9V7" stroke="#6C707E" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 362 B |
@@ -0,0 +1,3 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.5 5V3.5C2.5 2.95 2.95 2.5 3.5 2.5H5M7 2.5H9M11 2.5H12.5C13.05 2.5 13.5 2.95 13.5 3.5V5M13.5 7V9M13.5 11V12.5C13.5 13.05 13.05 13.5 12.5 13.5H11M9 13.5H7M5 13.5H3.5C2.95 13.5 2.5 13.05 2.5 12.5V11M2.5 9V7" stroke="#CED0D6" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 362 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.5 8.25L6 11.75L13.5 4.25" stroke="#6C707E" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 353 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.5 8.25L6 11.75L13.5 4.25" stroke="#CED0D6" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 353 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M9.5 11.5L6 8L9.5 4.5" stroke="#969AAB" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 342 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M9.5 11.5L6 8L9.5 4.5" stroke="#B4B8BF" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 304 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6 11.5L9.5 8L6 4.5" stroke="#818594" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 302 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6 11.5L9.5 8L6 4.5" stroke="#B4B8BF" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 302 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.4939 4.48784C11.3002 4.28007 10.9724 4.27548 10.7729 4.47775L8.00074 7.28849L5.22871 4.47788C5.02922 4.27561 4.70143 4.2802 4.50768 4.48797C4.32506 4.68382 4.32933 4.98882 4.51736 5.17947L7.29908 7.99991L4.51756 10.8201C4.32953 11.0108 4.32526 11.3158 4.50788 11.5116C4.70163 11.7194 5.02942 11.724 5.22892 11.5217L8.00074 8.71133L10.7727 11.5219C10.9722 11.7241 11.3 11.7196 11.4937 11.5118C11.6764 11.3159 11.6721 11.0109 11.484 10.8203L8.7024 7.99991L11.4843 5.17934C11.6723 4.98869 11.6766 4.68368 11.4939 4.48784Z" fill="#A8ADBD"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 820 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.4939 4.48784C11.3002 4.28007 10.9724 4.27548 10.7729 4.47775L8.00074 7.28849L5.22871 4.47788C5.02922 4.27561 4.70143 4.2802 4.50768 4.48797C4.32506 4.68382 4.32933 4.98882 4.51736 5.17947L7.29908 7.99991L4.51756 10.8201C4.32953 11.0108 4.32526 11.3158 4.50788 11.5116C4.70163 11.7194 5.02942 11.724 5.22892 11.5217L8.00074 8.71133L10.7727 11.5219C10.9722 11.7241 11.3 11.7196 11.4937 11.5118C11.6764 11.3159 11.6721 11.0109 11.484 10.8203L8.7024 7.99991L11.4843 5.17934C11.6723 4.98869 11.6766 4.68368 11.4939 4.48784Z" fill="#6F737A"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 820 B |
@@ -0,0 +1,5 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8 14.5V8" stroke="#6C707E" stroke-linecap="round"/>
|
||||
<path d="M8 10C8 7.5 6 6 3 6C3 8.5 5 10 8 10Z" stroke="#6C707E" stroke-linejoin="round"/>
|
||||
<path d="M8 8C8 5 10 3 13 3C13 6 11 8 8 8Z" stroke="#6C707E" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 342 B |
@@ -0,0 +1,5 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8 14.5V8" stroke="#CED0D6" stroke-linecap="round"/>
|
||||
<path d="M8 10C8 7.5 6 6 3 6C3 8.5 5 10 8 10Z" stroke="#CED0D6" stroke-linejoin="round"/>
|
||||
<path d="M8 8C8 5 10 3 13 3C13 6 11 8 8 8Z" stroke="#CED0D6" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 342 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 2H9C9.55228 2 10 2.44772 10 3H6C6 2.44772 6.44772 2 7 2ZM5 3C5 1.89543 5.89543 1 7 1H9C10.1046 1 11 1.89543 11 3H13C13.5523 3 14 3.44772 14 4V5V6H13V13C13 14.1046 12.1046 15 11 15H5C3.89543 15 3 14.1046 3 13V6H2V5V4C2 3.44772 2.44772 3 3 3H5ZM11 4H10H6H5H3V5H4H12H13V4H11ZM4 6H12V13C12 13.5523 11.5523 14 11 14H5C4.44772 14 4 13.5523 4 13V6ZM6.5 7C6.22386 7 6 7.22386 6 7.5V11.5C6 11.7761 6.22386 12 6.5 12C6.77614 12 7 11.7761 7 11.5V7.5C7 7.22386 6.77614 7 6.5 7ZM9 7.5C9 7.22386 9.22386 7 9.5 7C9.77614 7 10 7.22386 10 7.5V11.5C10 11.7761 9.77614 12 9.5 12C9.22386 12 9 11.7761 9 11.5V7.5Z" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 893 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 2H9C9.55228 2 10 2.44772 10 3H6C6 2.44772 6.44772 2 7 2ZM5 3C5 1.89543 5.89543 1 7 1H9C10.1046 1 11 1.89543 11 3H13C13.5523 3 14 3.44772 14 4V5V6H13V13C13 14.1046 12.1046 15 11 15H5C3.89543 15 3 14.1046 3 13V6H2V5V4C2 3.44772 2.44772 3 3 3H5ZM11 4H10H6H5H3V5H4H12H13V4H11ZM4 6H12V13C12 13.5523 11.5523 14 11 14H5C4.44772 14 4 13.5523 4 13V6ZM6.5 7C6.22386 7 6 7.22386 6 7.5V11.5C6 11.7761 6.22386 12 6.5 12C6.77614 12 7 11.7761 7 11.5V7.5C7 7.22386 6.77614 7 6.5 7ZM9 7.5C9 7.22386 9.22386 7 9.5 7C9.77614 7 10 7.22386 10 7.5V11.5C10 11.7761 9.77614 12 9.5 12C9.22386 12 9 11.7761 9 11.5V7.5Z" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 893 B |
@@ -0,0 +1,5 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 2H13C13.5523 2 14 2.44772 14 3V13C14 13.5523 13.5523 14 13 14H6C5.44772 14 5 13.5523 5 13V10H4V13C4 14.1046 4.89543 15 6 15H13C14.1046 15 15 14.1046 15 13V3C15 1.89543 14.1046 1 13 1H6C4.89543 1 4 1.89543 4 3V6H5V3C5 2.44772 5.44772 2 6 2Z" fill="#6C707E"/>
|
||||
<path d="M2.5 8H11M11 8L8.5 5.5M11 8L8.5 10.5" stroke="#DB3B4B" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 653 B |
@@ -0,0 +1,12 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_2414_33890)">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 2H13C13.5523 2 14 2.44772 14 3V13C14 13.5523 13.5523 14 13 14H6C5.44772 14 5 13.5523 5 13V10H4V13C4 14.1046 4.89543 15 6 15H13C14.1046 15 15 14.1046 15 13V3C15 1.89543 14.1046 1 13 1H6C4.89543 1 4 1.89543 4 3V6H5V3C5 2.44772 5.44772 2 6 2Z" fill="#CED0D6"/>
|
||||
<path d="M2.5 8H11M11 8L8.5 5.5M11 8L8.5 10.5" stroke="#DB5C5C" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_2414_33890">
|
||||
<rect width="16" height="16" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 801 B |
@@ -0,0 +1,7 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="11" y="2" width="1" height="12" rx="0.5" fill="#6C707E"/>
|
||||
<rect x="14" y="11" width="1" height="12" rx="0.5" transform="rotate(90 14 11)" fill="#6C707E"/>
|
||||
<rect x="4" y="2" width="1" height="12" rx="0.5" fill="#6C707E"/>
|
||||
<rect x="14" y="4" width="1" height="12" rx="0.5" transform="rotate(90 14 4)" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 555 B |
@@ -0,0 +1,7 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="11" y="2" width="1" height="12" rx="0.5" fill="#CED0D6"/>
|
||||
<rect x="14" y="11" width="1" height="12" rx="0.5" transform="rotate(90 14 11)" fill="#CED0D6"/>
|
||||
<rect x="4" y="2" width="1" height="12" rx="0.5" fill="#CED0D6"/>
|
||||
<rect x="14" y="4" width="1" height="12" rx="0.5" transform="rotate(90 14 4)" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 555 B |
@@ -0,0 +1,7 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="1.5" y="1.5" width="5" height="5" rx="0.5" stroke="#6C707E"/>
|
||||
<rect x="1.5" y="8.5" width="5" height="5" rx="0.5" stroke="#6C707E"/>
|
||||
<rect x="8.5" y="8.5" width="5" height="5" rx="0.5" stroke="#6C707E"/>
|
||||
<rect x="8.5" y="1.5" width="5" height="5" rx="0.5" stroke="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 514 B |
@@ -0,0 +1,7 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="1.5" y="1.5" width="5" height="5" rx="0.5" stroke="#CED0D6"/>
|
||||
<rect x="1.5" y="8.5" width="5" height="5" rx="0.5" stroke="#CED0D6"/>
|
||||
<rect x="8.5" y="8.5" width="5" height="5" rx="0.5" stroke="#CED0D6"/>
|
||||
<rect x="8.5" y="1.5" width="5" height="5" rx="0.5" stroke="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 514 B |
@@ -0,0 +1,5 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="7.79995" cy="14.15" r="0.85" fill="#6C707E"/>
|
||||
<path d="M7.97962 8.25128C8.20415 8.01392 8.49793 7.73622 8.8602 7.41844C9.23243 7.09036 9.52729 6.80791 9.74572 6.57075L9.74668 6.56973C9.96622 6.33799 10.1503 6.0594 10.2982 5.73275L10.2988 5.73133C10.45 5.4108 10.5268 5.0457 10.5268 4.634C10.5268 4.13537 10.4222 3.69607 10.2158 3.31349C10.0093 2.93099 9.71876 2.63442 9.34261 2.42208L9.34155 2.42149C8.96585 2.20334 8.53389 2.093 8.04277 2.093C7.53263 2.093 7.08144 2.20651 6.68653 2.43124C6.29797 2.65595 5.9944 2.97134 5.77499 3.3796C5.67273 3.57247 5.59473 3.77918 5.54126 4C5.51644 4.10252 5.49691 4.20808 5.48269 4.31671C5.44318 4.61868 5.20739 4.867 4.90285 4.867H4.77896C4.47828 4.867 4.23781 4.61717 4.24929 4.31671C4.25956 4.2093 4.27359 4.10373 4.2914 4C4.36501 3.57119 4.50313 3.17391 4.7064 2.80885C5.03226 2.23534 5.4864 1.7906 6.06642 1.47769C6.64663 1.15834 7.30949 1 8.05227 1C8.77568 1 9.4194 1.15185 9.98062 1.45842C10.5475 1.75827 10.9888 2.17975 11.3023 2.72194C11.6162 3.26467 11.7718 3.88719 11.7718 4.5865C11.7718 5.13576 11.6813 5.62465 11.4976 6.05106C11.3166 6.47121 11.0924 6.82638 10.8239 7.11469C10.567 7.39722 10.2283 7.71973 9.80882 8.08202C9.47419 8.37245 9.2138 8.61414 9.02667 8.8075C8.85057 8.98968 8.70116 9.20284 8.57871 9.44772L8.57826 9.44864C8.4595 9.6802 8.39927 9.93983 8.39927 10.2295C8.39927 10.4946 8.18437 10.7095 7.91927 10.7095H7.71977C7.42844 10.7095 7.19227 10.4733 7.19227 10.182C7.19227 9.77678 7.26749 9.41044 7.42025 9.08501C7.57001 8.76595 7.75635 8.48769 7.97962 8.25128Z" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,5 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="7.79995" cy="14.15" r="0.85" fill="#CED0D6"/>
|
||||
<path d="M7.97962 8.25128C8.20415 8.01392 8.49793 7.73622 8.8602 7.41844C9.23243 7.09036 9.52729 6.80791 9.74572 6.57075L9.74668 6.56973C9.96622 6.33799 10.1503 6.0594 10.2982 5.73275L10.2988 5.73133C10.45 5.4108 10.5268 5.0457 10.5268 4.634C10.5268 4.13537 10.4222 3.69607 10.2158 3.31349C10.0093 2.93099 9.71876 2.63442 9.34261 2.42208L9.34155 2.42149C8.96585 2.20334 8.53389 2.093 8.04277 2.093C7.53263 2.093 7.08144 2.20651 6.68653 2.43124C6.29797 2.65595 5.9944 2.97134 5.77499 3.3796C5.67273 3.57247 5.59473 3.77918 5.54126 4C5.51644 4.10252 5.49691 4.20808 5.48269 4.31671C5.44318 4.61868 5.20739 4.867 4.90285 4.867H4.77896C4.47828 4.867 4.23781 4.61717 4.24929 4.31671C4.25956 4.2093 4.27359 4.10373 4.2914 4C4.36501 3.57119 4.50313 3.17391 4.7064 2.80885C5.03226 2.23534 5.4864 1.7906 6.06642 1.47769C6.64663 1.15834 7.30949 1 8.05227 1C8.77568 1 9.4194 1.15185 9.98062 1.45842C10.5475 1.75827 10.9888 2.17975 11.3023 2.72194C11.6162 3.26467 11.7718 3.88719 11.7718 4.5865C11.7718 5.13576 11.6813 5.62465 11.4976 6.05106C11.3166 6.47121 11.0924 6.82638 10.8239 7.11469C10.567 7.39722 10.2283 7.71973 9.80882 8.08202C9.47419 8.37245 9.2138 8.61414 9.02667 8.8075C8.85057 8.98968 8.70116 9.20284 8.57871 9.44772L8.57826 9.44864C8.4595 9.6802 8.39927 9.93983 8.39927 10.2295C8.39927 10.4946 8.18437 10.7095 7.91927 10.7095H7.71977C7.42844 10.7095 7.19227 10.4733 7.19227 10.182C7.19227 9.77678 7.26749 9.41044 7.42025 9.08501C7.57001 8.76595 7.75635 8.48769 7.97962 8.25128Z" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.24408 6.65516C8.05415 6.43616 7.96859 6.14552 8.00959 5.85854L8.50238 2.40901L3.10978 8.99996H6.99954C7.28943 8.99996 7.56505 9.12576 7.75499 9.34476C7.94493 9.56376 8.03048 9.85441 7.98949 10.1414L7.4967 13.5909L12.8893 6.99996H8.99954C8.70965 6.99996 8.43402 6.87416 8.24408 6.65516ZM9.74593 0.775195C9.81752 0.274069 9.18453 -0.00392066 8.86398 0.387867L1.66768 9.18334C1.40057 9.50981 1.63285 9.99996 2.05466 9.99996H6.99954L6.25314 15.2247C6.18155 15.7259 6.81454 16.0038 7.1351 15.6121L14.3314 6.81658C14.5985 6.49012 14.3662 5.99996 13.9444 5.99996H8.99954L9.74593 0.775195Z" fill="#E66D17"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 882 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.24408 6.65516C8.05415 6.43616 7.96859 6.14552 8.00959 5.85854L8.50238 2.40901L3.10978 8.99996H6.99954C7.28943 8.99996 7.56505 9.12576 7.75499 9.34476C7.94493 9.56376 8.03048 9.85441 7.98949 10.1414L7.4967 13.5909L12.8893 6.99996H8.99954C8.70965 6.99996 8.43402 6.87416 8.24408 6.65516ZM9.74593 0.775195C9.81752 0.274069 9.18453 -0.00392066 8.86398 0.387867L1.66768 9.18334C1.40057 9.50981 1.63285 9.99996 2.05466 9.99996H6.99954L6.25314 15.2247C6.18155 15.7259 6.81454 16.0038 7.1351 15.6121L14.3314 6.81658C14.5985 6.49012 14.3662 5.99996 13.9444 5.99996H8.99954L9.74593 0.775195Z" fill="#C77D55"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 882 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.5 5V2.02054C11.4149 2.26101 13.739 4.5851 13.9795 7.5H11C10.7239 7.5 10.5 7.72386 10.5 8C10.5 8.27614 10.7239 8.5 11 8.5H13.9795C13.739 11.4149 11.4149 13.739 8.5 13.9795V11C8.5 10.7239 8.27614 10.5 8 10.5C7.72386 10.5 7.5 10.7239 7.5 11V13.9795C4.5851 13.739 2.26101 11.4149 2.02054 8.5H5C5.27614 8.5 5.5 8.27614 5.5 8C5.5 7.72386 5.27614 7.5 5 7.5H2.02054C2.26101 4.5851 4.5851 2.26101 7.5 2.02054V5C7.5 5.27614 7.72386 5.5 8 5.5C8.27614 5.5 8.5 5.27614 8.5 5ZM1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8Z" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 866 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.5 5V2.02054C11.4149 2.26101 13.739 4.5851 13.9795 7.5H11C10.7239 7.5 10.5 7.72386 10.5 8C10.5 8.27614 10.7239 8.5 11 8.5H13.9795C13.739 11.4149 11.4149 13.739 8.5 13.9795V11C8.5 10.7239 8.27614 10.5 8 10.5C7.72386 10.5 7.5 10.7239 7.5 11V13.9795C4.5851 13.739 2.26101 11.4149 2.02054 8.5H5C5.27614 8.5 5.5 8.27614 5.5 8C5.5 7.72386 5.27614 7.5 5 7.5H2.02054C2.26101 4.5851 4.5851 2.26101 7.5 2.02054V5C7.5 5.27614 7.72386 5.5 8 5.5C8.27614 5.5 8.5 5.27614 8.5 5ZM1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8Z" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 866 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 5C5 3.34315 6.34315 2 8 2C9.65685 2 11 3.34315 11 5V6C12.1046 6 13 6.89543 13 8V12C13 13.1046 12.1046 14 11 14H5C3.89543 14 3 13.1046 3 12V8C3 6.89543 3.89543 6 5 6V5ZM10 5V6H6V5C6 3.89543 6.89543 3 8 3C9.10457 3 10 3.89543 10 5ZM5 7C4.44772 7 4 7.44772 4 8V12C4 12.5523 4.44772 13 5 13H11C11.5523 13 12 12.5523 12 12V8C12 7.44772 11.5523 7 11 7H5ZM8 8.5C7.72386 8.5 7.5 8.72386 7.5 9V11C7.5 11.2761 7.72386 11.5 8 11.5C8.27614 11.5 8.5 11.2761 8.5 11V9C8.5 8.72386 8.27614 8.5 8 8.5Z" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 785 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 5C5 3.34315 6.34315 2 8 2C9.65685 2 11 3.34315 11 5V6C12.1046 6 13 6.89543 13 8V12C13 13.1046 12.1046 14 11 14H5C3.89543 14 3 13.1046 3 12V8C3 6.89543 3.89543 6 5 6V5ZM10 5V6H6V5C6 3.89543 6.89543 3 8 3C9.10457 3 10 3.89543 10 5ZM5 7C4.44772 7 4 7.44772 4 8V12C4 12.5523 4.44772 13 5 13H11C11.5523 13 12 12.5523 12 12V8C12 7.44772 11.5523 7 11 7H5ZM8 8.5C7.72386 8.5 7.5 8.72386 7.5 9V11C7.5 11.2761 7.72386 11.5 8 11.5C8.27614 11.5 8.5 11.2761 8.5 11V9C8.5 8.72386 8.27614 8.5 8 8.5Z" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 785 B |
@@ -0,0 +1,7 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<!-- expui/actions/profileMemory.svg without its profiling badge, its pins mirrored onto the side the badge covered. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 2C4.89543 2 4 2.89543 4 4V12C4 13.1046 4.89543 14 6 14H10C11.1046 14 12 13.1046 12 12V4C12 2.89543 11.1046 2 10 2H6ZM6 3C5.44772 3 5 3.44772 5 4V12C5 12.5523 5.44772 13 6 13H10C10.5523 13 11 12.5523 11 12V4C11 3.44772 10.5523 3 10 3H6Z" fill="#6C707E"/>
|
||||
<path d="M1.5 4C1.22386 4 1 4.22386 1 4.5C1 4.77614 1.22386 5 1.5 5H4V4H1.5ZM1.5 7.5C1.22386 7.5 1 7.72386 1 8C1 8.27614 1.22386 8.5 1.5 8.5H4V7.5H1.5ZM1.5 11C1.22386 11 1 11.2239 1 11.5C1 11.7761 1.22386 12 1.5 12H4V11H1.5Z" fill="#6C707E"/>
|
||||
<path d="M14.5 4C14.7761 4 15 4.22386 15 4.5C15 4.77614 14.7761 5 14.5 5H12V4H14.5ZM14.5 7.5C14.7761 7.5 15 7.72386 15 8C15 8.27614 14.7761 8.5 14.5 8.5H12V7.5H14.5ZM14.5 11C14.7761 11 15 11.2239 15 11.5C15 11.7761 14.7761 12 14.5 12H12V11H14.5Z" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,7 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<!-- memory.svg in expui's dark colour. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 2C4.89543 2 4 2.89543 4 4V12C4 13.1046 4.89543 14 6 14H10C11.1046 14 12 13.1046 12 12V4C12 2.89543 11.1046 2 10 2H6ZM6 3C5.44772 3 5 3.44772 5 4V12C5 12.5523 5.44772 13 6 13H10C10.5523 13 11 12.5523 11 12V4C11 3.44772 10.5523 3 10 3H6Z" fill="#CED0D6"/>
|
||||
<path d="M1.5 4C1.22386 4 1 4.22386 1 4.5C1 4.77614 1.22386 5 1.5 5H4V4H1.5ZM1.5 7.5C1.22386 7.5 1 7.72386 1 8C1 8.27614 1.22386 8.5 1.5 8.5H4V7.5H1.5ZM1.5 11C1.22386 11 1 11.2239 1 11.5C1 11.7761 1.22386 12 1.5 12H4V11H1.5Z" fill="#CED0D6"/>
|
||||
<path d="M14.5 4C14.7761 4 15 4.22386 15 4.5C15 4.77614 14.7761 5 14.5 5H12V4H14.5ZM14.5 7.5C14.7761 7.5 15 7.72386 15 8C15 8.27614 14.7761 8.5 14.5 8.5H12V7.5H14.5ZM14.5 11C14.7761 11 15 11.2239 15 11.5C15 11.7761 14.7761 12 14.5 12H12V11H14.5Z" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="2.5" y="2.5" width="11" height="11" rx="1.5" stroke="#6C707E"/>
|
||||
<rect x="5" y="6" width="2" height="2" fill="#6C707E"/>
|
||||
<rect x="9" y="6" width="2" height="2" fill="#6C707E"/>
|
||||
<rect x="6" y="10" width="4" height="1" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 345 B |
@@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="2.5" y="2.5" width="11" height="11" rx="1.5" stroke="#CED0D6"/>
|
||||
<rect x="5" y="6" width="2" height="2" fill="#CED0D6"/>
|
||||
<rect x="9" y="6" width="2" height="2" fill="#CED0D6"/>
|
||||
<rect x="6" y="10" width="4" height="1" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 345 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M1 10.5C1 10.7761 1.22386 11 1.5 11C1.77614 11 2 10.7761 2 10.5H1ZM13.6263 10.3322C13.8098 10.5386 14.1258 10.5572 14.3322 10.3737C14.5386 10.1902 14.5572 9.87421 14.3737 9.66782L13.6263 10.3322ZM11.5 9.99999C11.2239 9.99999 11 10.2238 11 10.5C11 10.7761 11.2239 11 11.5 11V9.99999ZM14.5 10.5V11H15V10.5H14.5ZM15 7.49999C15 7.22385 14.7761 6.99999 14.5 6.99999C14.2239 6.99999 14 7.22385 14 7.49999H15ZM1.5 10.5C2 10.5 2 10.5002 2 10.5004C2 10.5005 2 10.5007 2 10.5008C2 10.5009 2 10.501 2 10.5011C2 10.5011 2 10.5009 2 10.5003C2.00001 10.4993 2.00003 10.4971 2.00009 10.4937C2.0002 10.487 2.00043 10.4759 2.00094 10.4605C2.00197 10.4298 2.00409 10.3824 2.00849 10.3208C2.01731 10.1974 2.03519 10.0178 2.07132 9.80095C2.14399 9.36495 2.28839 8.79125 2.57221 8.22361C2.85506 7.65792 3.27147 7.10745 3.88673 6.69728C4.49885 6.28919 5.33749 6 6.5 6V5C5.16251 5 4.12615 5.33581 3.33203 5.86522C2.54103 6.39255 2.01994 7.09208 1.67779 7.77639C1.33661 8.45875 1.16851 9.13505 1.08493 9.63655C1.04294 9.88848 1.02175 10.0995 1.01104 10.2495C1.00567 10.3246 1.00292 10.3847 1.0015 10.4272C1.00079 10.4485 1.00041 10.4654 1.00022 10.4776C1.00012 10.4837 1.00006 10.4887 1.00003 10.4924C1.00002 10.4943 1.00001 10.4959 1.00001 10.4971C1 10.4978 1 10.4983 1 10.4988C1 10.499 1 10.4993 1 10.4995C1 10.4997 1 10.5 1.5 10.5ZM6.5 6C8.06824 6 9.82619 7.02606 11.2543 8.14375C11.9546 8.69176 12.5497 9.24102 12.97 9.65366C13.1799 9.85969 13.3454 10.0309 13.4578 10.15C13.514 10.2094 13.5568 10.2558 13.5853 10.287C13.5995 10.3025 13.6102 10.3142 13.617 10.3219C13.6205 10.3257 13.623 10.3285 13.6245 10.3302C13.6253 10.3311 13.6258 10.3317 13.6261 10.332C13.6263 10.3322 13.6264 10.3323 13.6264 10.3323C13.6264 10.3323 13.6264 10.3323 13.6264 10.3323C13.6264 10.3322 13.6263 10.3322 14 10C14.3737 9.66782 14.3736 9.66772 14.3735 9.66761C14.3735 9.66755 14.3733 9.66742 14.3732 9.66729C14.373 9.66705 14.3727 9.66674 14.3724 9.66636C14.3717 9.6656 14.3708 9.66457 14.3696 9.66327C14.3673 9.66068 14.364 9.65701 14.3598 9.65231C14.3513 9.64292 14.3391 9.62938 14.3231 9.61197C14.2913 9.57717 14.2448 9.52688 14.1848 9.46333C14.0648 9.33626 13.8904 9.15594 13.6706 8.94009C13.2315 8.50898 12.6079 7.93324 11.8707 7.35625C10.4238 6.22394 8.43176 5 6.5 5V6ZM11.5 11H14.5V9.99999H11.5V11ZM15 10.5V7.49999H14V10.5H15Z" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M1 10.5C1 10.7761 1.22386 11 1.5 11C1.77614 11 2 10.7761 2 10.5H1ZM13.6263 10.3322C13.8098 10.5386 14.1258 10.5572 14.3322 10.3737C14.5386 10.1902 14.5572 9.87421 14.3737 9.66782L13.6263 10.3322ZM11.5 9.99999C11.2239 9.99999 11 10.2238 11 10.5C11 10.7761 11.2239 11 11.5 11V9.99999ZM14.5 10.5V11H15V10.5H14.5ZM15 7.49999C15 7.22385 14.7761 6.99999 14.5 6.99999C14.2239 6.99999 14 7.22385 14 7.49999H15ZM1.5 10.5C2 10.5 2 10.5002 2 10.5004C2 10.5005 2 10.5007 2 10.5008C2 10.5009 2 10.501 2 10.5011C2 10.5011 2 10.5009 2 10.5003C2.00001 10.4993 2.00003 10.4971 2.00009 10.4937C2.0002 10.487 2.00043 10.4759 2.00094 10.4605C2.00197 10.4298 2.00409 10.3824 2.00849 10.3208C2.01731 10.1974 2.03519 10.0178 2.07132 9.80095C2.14399 9.36495 2.28839 8.79125 2.57221 8.22361C2.85506 7.65792 3.27147 7.10745 3.88673 6.69728C4.49885 6.28919 5.33749 6 6.5 6V5C5.16251 5 4.12615 5.33581 3.33203 5.86522C2.54103 6.39255 2.01994 7.09208 1.67779 7.77639C1.33661 8.45875 1.16851 9.13505 1.08493 9.63655C1.04294 9.88848 1.02175 10.0995 1.01104 10.2495C1.00567 10.3246 1.00292 10.3847 1.0015 10.4272C1.00079 10.4485 1.00041 10.4654 1.00022 10.4776C1.00012 10.4837 1.00006 10.4887 1.00003 10.4924C1.00002 10.4943 1.00001 10.4959 1.00001 10.4971C1 10.4978 1 10.4983 1 10.4988C1 10.499 1 10.4993 1 10.4995C1 10.4997 1 10.5 1.5 10.5ZM6.5 6C8.06824 6 9.82619 7.02606 11.2543 8.14375C11.9546 8.69176 12.5497 9.24102 12.97 9.65366C13.1799 9.85969 13.3454 10.0309 13.4578 10.15C13.514 10.2094 13.5568 10.2558 13.5853 10.287C13.5995 10.3025 13.6102 10.3142 13.617 10.3219C13.6205 10.3257 13.623 10.3285 13.6245 10.3302C13.6253 10.3311 13.6258 10.3317 13.6261 10.332C13.6263 10.3322 13.6264 10.3323 13.6264 10.3323C13.6264 10.3323 13.6264 10.3323 13.6264 10.3323C13.6264 10.3322 13.6263 10.3322 14 10C14.3737 9.66782 14.3736 9.66772 14.3735 9.66761C14.3735 9.66755 14.3733 9.66742 14.3732 9.66729C14.373 9.66705 14.3727 9.66674 14.3724 9.66636C14.3717 9.6656 14.3708 9.66457 14.3696 9.66327C14.3673 9.66068 14.364 9.65701 14.3598 9.65231C14.3513 9.64292 14.3391 9.62938 14.3231 9.61197C14.2913 9.57717 14.2448 9.52688 14.1848 9.46333C14.0648 9.33626 13.8904 9.15594 13.6706 8.94009C13.2315 8.50898 12.6079 7.93324 11.8707 7.35625C10.4238 6.22394 8.43176 5 6.5 5V6ZM11.5 11H14.5V9.99999H11.5V11ZM15 10.5V7.49999H14V10.5H15Z" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
@@ -0,0 +1,7 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.5 9V8C2.5 4.96243 4.96243 2.5 8 2.5C9.10679 2.5 10.1372 2.82692 11 3.38947" stroke="#6C707E" stroke-linecap="round"/>
|
||||
<path d="M5 12.6105C5.86278 13.1731 6.89321 13.5 8 13.5C11.0376 13.5 13.5 11.0376 13.5 8V7" stroke="#6C707E" stroke-linecap="round"/>
|
||||
<path d="M0.49997 7.50027L2.5 9.5L4.49998 7.50023" stroke="#6C707E" stroke-linecap="round"/>
|
||||
<path d="M11.5 8.49982L13.5 6.5L15.5 8.49982" stroke="#6C707E" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 675 B |
@@ -0,0 +1,7 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.5 9V8C2.5 4.96243 4.96243 2.5 8 2.5C9.10679 2.5 10.1372 2.82692 11 3.38947" stroke="#CED0D6" stroke-linecap="round"/>
|
||||
<path d="M5 12.6105C5.86278 13.1731 6.89321 13.5 8 13.5C11.0376 13.5 13.5 11.0376 13.5 8V7" stroke="#CED0D6" stroke-linecap="round"/>
|
||||
<path d="M0.49997 7.50027L2.5 9.5L4.49998 7.50023" stroke="#CED0D6" stroke-linecap="round"/>
|
||||
<path d="M11.5 8.49982L13.5 6.5L15.5 8.49982" stroke="#CED0D6" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 675 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.85363 2.35355C6.04889 2.15829 6.04889 1.84171 5.85363 1.64645C5.65837 1.45118 5.34178 1.45118 5.14652 1.64645L1.64652 5.14645L1.29297 5.5L1.64652 5.85355L5.14652 9.35355C5.34178 9.54882 5.65837 9.54882 5.85363 9.35355C6.04889 9.15829 6.04889 8.84171 5.85363 8.64645L3.20718 6H10.5001C12.4331 6 14.0001 7.567 14.0001 9.5C14.0001 11.433 12.4331 13 10.5001 13H5.50008C5.22393 13 5.00008 13.2239 5.00008 13.5C5.00008 13.7761 5.22393 14 5.50008 14H10.5001C12.9854 14 15.0001 11.9853 15.0001 9.5C15.0001 7.01472 12.9854 5 10.5001 5H3.20718L5.85363 2.35355Z" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 851 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.85363 2.35355C6.04889 2.15829 6.04889 1.84171 5.85363 1.64645C5.65837 1.45118 5.34178 1.45118 5.14652 1.64645L1.64652 5.14645L1.29297 5.5L1.64652 5.85355L5.14652 9.35355C5.34178 9.54882 5.65837 9.54882 5.85363 9.35355C6.04889 9.15829 6.04889 8.84171 5.85363 8.64645L3.20718 6H10.5001C12.4331 6 14.0001 7.567 14.0001 9.5C14.0001 11.433 12.4331 13 10.5001 13H5.50008C5.22393 13 5.00008 13.2239 5.00008 13.5C5.00008 13.7761 5.22393 14 5.50008 14H10.5001C12.9854 14 15.0001 11.9853 15.0001 9.5C15.0001 7.01472 12.9854 5 10.5001 5H3.20718L5.85363 2.35355Z" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 851 B |
@@ -0,0 +1,5 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="7" cy="7" r="4.5" stroke="#6C707E"/>
|
||||
<path d="M10.1992 10.2002L13.4992 13.4961" stroke="#6C707E" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 364 B |
@@ -0,0 +1,5 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="7" cy="7" r="4.5" stroke="#CED0D6"/>
|
||||
<path d="M10.1992 10.2002L13.4992 13.4961" stroke="#CED0D6" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 364 B |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.22655 4.36961C2.92233 4.76924 2.66735 5.20781 2.47037 5.67626L3.30992 7.0943C3.6406 7.65283 3.6406 8.34718 3.30992 8.9057L2.47037 10.3237C2.66736 10.7922 2.92233 11.2308 3.22656 11.6304L4.87261 11.6124C5.52165 11.6053 6.12297 11.9524 6.44133 12.5181L7.24899 13.953C7.49593 13.984 7.74792 14 8.00408 14C8.2602 14 8.51214 13.984 8.75904 13.9531L9.56671 12.5181C9.88507 11.9524 10.4864 11.6053 11.1354 11.6124L12.7816 11.6304C13.0858 11.2308 13.3408 10.7923 13.5377 10.3239L12.6981 8.9057C12.3674 8.34718 12.3674 7.65283 12.6981 7.0943L13.5377 5.67613C13.3408 5.20773 13.0858 4.76921 12.7816 4.36961L11.1354 4.38764C10.4864 4.39475 9.88507 4.04758 9.56671 3.48194L8.75904 2.04693C8.51214 2.01599 8.2602 2 8.00408 2C7.74792 2 7.49594 2.016 7.24899 2.04695L6.44133 3.48194C6.12297 4.04758 5.52165 4.39475 4.87261 4.38764L3.22655 4.36961ZM10.655 8.00001C10.655 9.46412 9.46811 10.651 8.004 10.651C6.5399 10.651 5.353 9.46412 5.353 8.00001C5.353 6.53591 6.5399 5.34902 8.004 5.34902C9.46811 5.34902 10.655 6.53591 10.655 8.00001ZM4.88356 3.3877C5.16752 3.39081 5.4306 3.23892 5.56988 2.99146L6.43817 1.44875C6.54914 1.25159 6.7401 1.1101 6.96387 1.07676C7.30327 1.0262 7.65062 1 8.00408 1C8.3575 1 8.7048 1.02619 9.04414 1.07674C9.26792 1.11007 9.45889 1.25157 9.56986 1.44873L10.4382 2.99146C10.5774 3.23892 10.8405 3.39081 11.1245 3.3877L12.8938 3.36832C13.1196 3.36585 13.3372 3.46012 13.4781 3.63661C13.9099 4.17766 14.2632 4.78416 14.5207 5.43884C14.6034 5.6491 14.5763 5.88489 14.4612 6.07931L13.5586 7.60376C13.4139 7.84811 13.4139 8.15189 13.5586 8.39625L14.4612 9.92069C14.5763 10.1151 14.6034 10.3509 14.5207 10.5612C14.2632 11.2158 13.9099 11.8223 13.4781 12.3634C13.3372 12.5399 13.1196 12.6342 12.8938 12.6317L11.1245 12.6123C10.8405 12.6092 10.5774 12.7611 10.4382 13.0085L9.56986 14.5513C9.45889 14.7484 9.26792 14.8899 9.04414 14.9233C8.7048 14.9738 8.3575 15 8.00408 15C7.65062 15 7.30327 14.9738 6.96387 14.9232C6.7401 14.8899 6.54914 14.7484 6.43817 14.5512L5.56988 13.0085C5.4306 12.7611 5.16752 12.6092 4.88356 12.6123L3.1144 12.6317C2.8886 12.6342 2.67096 12.5399 2.5301 12.3634C2.09822 11.8223 1.74489 11.2158 1.48738 10.561C1.40469 10.3508 1.43184 10.115 1.54695 9.92057L2.44942 8.39625C2.5941 8.15189 2.5941 7.84811 2.44942 7.60376L1.54695 6.07944C1.43184 5.88502 1.40469 5.64924 1.48738 5.43898C1.74489 4.78425 2.09822 4.1777 2.53009 3.63661C2.67096 3.46012 2.8886 3.36585 3.1144 3.36832L4.88356 3.3877ZM9.655 8.00001C9.655 8.91183 8.91582 9.65101 8.004 9.65101C7.09218 9.65101 6.353 8.91183 6.353 8.00001C6.353 7.08819 7.09218 6.34902 8.004 6.34902C8.91582 6.34902 9.655 7.08819 9.655 8.00001Z" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
@@ -0,0 +1,4 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.22655 4.36961C2.92233 4.76924 2.66735 5.20781 2.47037 5.67626L3.30992 7.0943C3.6406 7.65283 3.6406 8.34718 3.30992 8.9057L2.47037 10.3237C2.66736 10.7922 2.92233 11.2308 3.22656 11.6304L4.87261 11.6124C5.52165 11.6053 6.12297 11.9524 6.44133 12.5181L7.24899 13.953C7.49593 13.984 7.74792 14 8.00408 14C8.2602 14 8.51214 13.984 8.75904 13.9531L9.56671 12.5181C9.88507 11.9524 10.4864 11.6053 11.1354 11.6124L12.7816 11.6304C13.0858 11.2308 13.3408 10.7923 13.5377 10.3239L12.6981 8.9057C12.3674 8.34718 12.3674 7.65283 12.6981 7.0943L13.5377 5.67613C13.3408 5.20773 13.0858 4.76921 12.7816 4.36961L11.1354 4.38764C10.4864 4.39475 9.88507 4.04758 9.56671 3.48194L8.75904 2.04693C8.51214 2.01599 8.2602 2 8.00408 2C7.74792 2 7.49594 2.016 7.24899 2.04695L6.44133 3.48194C6.12297 4.04758 5.52165 4.39475 4.87261 4.38764L3.22655 4.36961ZM10.655 8.00001C10.655 9.46412 9.46811 10.651 8.004 10.651C6.5399 10.651 5.353 9.46412 5.353 8.00001C5.353 6.53591 6.5399 5.34902 8.004 5.34902C9.46811 5.34902 10.655 6.53591 10.655 8.00001ZM4.88356 3.3877C5.16752 3.39081 5.4306 3.23892 5.56988 2.99146L6.43817 1.44875C6.54914 1.25159 6.7401 1.1101 6.96387 1.07676C7.30327 1.0262 7.65062 1 8.00408 1C8.3575 1 8.7048 1.02619 9.04414 1.07674C9.26792 1.11007 9.45889 1.25157 9.56986 1.44873L10.4382 2.99146C10.5774 3.23892 10.8405 3.39081 11.1245 3.3877L12.8938 3.36832C13.1196 3.36585 13.3372 3.46012 13.4781 3.63661C13.9099 4.17766 14.2632 4.78416 14.5207 5.43884C14.6034 5.6491 14.5763 5.88489 14.4612 6.07931L13.5586 7.60376C13.4139 7.84811 13.4139 8.15189 13.5586 8.39625L14.4612 9.92069C14.5763 10.1151 14.6034 10.3509 14.5207 10.5612C14.2632 11.2158 13.9099 11.8223 13.4781 12.3634C13.3372 12.5399 13.1196 12.6342 12.8938 12.6317L11.1245 12.6123C10.8405 12.6092 10.5774 12.7611 10.4382 13.0085L9.56986 14.5513C9.45889 14.7484 9.26792 14.8899 9.04414 14.9233C8.7048 14.9738 8.3575 15 8.00408 15C7.65062 15 7.30327 14.9738 6.96387 14.9232C6.7401 14.8899 6.54914 14.7484 6.43817 14.5512L5.56988 13.0085C5.4306 12.7611 5.16752 12.6092 4.88356 12.6123L3.1144 12.6317C2.8886 12.6342 2.67096 12.5399 2.5301 12.3634C2.09822 11.8223 1.74489 11.2158 1.48738 10.561C1.40469 10.3508 1.43184 10.115 1.54695 9.92057L2.44942 8.39625C2.5941 8.15189 2.5941 7.84811 2.44942 7.60376L1.54695 6.07944C1.43184 5.88502 1.40469 5.64924 1.48738 5.43898C1.74489 4.78425 2.09822 4.1777 2.53009 3.63661C2.67096 3.46012 2.8886 3.36585 3.1144 3.36832L4.88356 3.3877ZM9.655 8.00001C9.655 8.91183 8.91582 9.65101 8.004 9.65101C7.09218 9.65101 6.353 8.91183 6.353 8.00001C6.353 7.08819 7.09218 6.34902 8.004 6.34902C8.91582 6.34902 9.655 7.08819 9.655 8.00001Z" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
@@ -0,0 +1,4 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8 3L14.5 13.5H8V3Z" fill="#6C707E"/>
|
||||
<path d="M8 3L1.5 13.5H14.5L8 3Z" stroke="#6C707E" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 227 B |
@@ -0,0 +1,4 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8 3L14.5 13.5H8V3Z" fill="#CED0D6"/>
|
||||
<path d="M8 3L1.5 13.5H14.5L8 3Z" stroke="#CED0D6" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 227 B |