Compare commits
No commits in common. "b080ff00ecf848d73d9ad4530cc89bf5a52f9cde" and "c3086592c7f6a95f5cb80b77e77c6126d512c040" have entirely different histories.
b080ff00ec
...
c3086592c7
13 changed files with 13 additions and 2186 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -45,6 +45,3 @@ next-env.d.ts
|
||||||
|
|
||||||
# clerk configuration (can include secrets)
|
# clerk configuration (can include secrets)
|
||||||
/.clerk/
|
/.clerk/
|
||||||
|
|
||||||
# local design critique notes (generated by impeccable)
|
|
||||||
/.impeccable/
|
|
||||||
|
|
|
||||||
673
LICENSE
673
LICENSE
|
|
@ -1,673 +0,0 @@
|
||||||
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.
|
|
||||||
|
|
||||||
Copyright (C) 2026 The Helium Authors
|
|
||||||
|
|
||||||
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>.
|
|
||||||
3
bun.lock
3
bun.lock
|
|
@ -22,7 +22,6 @@
|
||||||
"motion": "^12.43.0",
|
"motion": "^12.43.0",
|
||||||
"next": "16.0.10",
|
"next": "16.0.10",
|
||||||
"next-themes": "^0.4.6",
|
"next-themes": "^0.4.6",
|
||||||
"ogl": "^1.0.11",
|
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
"radix-ui": "^1.6.7",
|
"radix-ui": "^1.6.7",
|
||||||
"react": "19.2.1",
|
"react": "19.2.1",
|
||||||
|
|
@ -1230,8 +1229,6 @@
|
||||||
|
|
||||||
"object.values": ["object.values@1.2.1", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.3", "define-properties": "^1.2.1", "es-object-atoms": "^1.0.0" } }, "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA=="],
|
"object.values": ["object.values@1.2.1", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.3", "define-properties": "^1.2.1", "es-object-atoms": "^1.0.0" } }, "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA=="],
|
||||||
|
|
||||||
"ogl": ["ogl@1.0.11", "", {}, "sha512-kUpC154AFfxi16pmZUK4jk3J+8zxwTWGPo03EoYA8QPbzikHoaC82n6pNTbd+oEaJonaE8aPWBlX7ad9zrqLsA=="],
|
|
||||||
|
|
||||||
"on-finished": ["on-finished@2.4.1", "", { "dependencies": { "ee-first": "1.1.1" } }, "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg=="],
|
"on-finished": ["on-finished@2.4.1", "", { "dependencies": { "ee-first": "1.1.1" } }, "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg=="],
|
||||||
|
|
||||||
"once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
|
"once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
"name": "web",
|
"name": "web",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "GPL-3.0",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"prebuild": "node scripts/update-last-modified.js",
|
"prebuild": "node scripts/update-last-modified.js",
|
||||||
|
|
@ -31,7 +30,6 @@
|
||||||
"motion": "^12.43.0",
|
"motion": "^12.43.0",
|
||||||
"next": "16.0.10",
|
"next": "16.0.10",
|
||||||
"next-themes": "^0.4.6",
|
"next-themes": "^0.4.6",
|
||||||
"ogl": "^1.0.11",
|
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
"radix-ui": "^1.6.7",
|
"radix-ui": "^1.6.7",
|
||||||
"react": "19.2.1",
|
"react": "19.2.1",
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
import { getJavaServerStatus } from "@/lib/server-status";
|
|
||||||
|
|
||||||
export async function GET() {
|
|
||||||
const status = await getJavaServerStatus();
|
|
||||||
return Response.json(status, {
|
|
||||||
headers: { "Cache-Control": "public, max-age=30, s-maxage=60" },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
@ -123,21 +123,11 @@
|
||||||
--sidebar-ring: oklch(0.552 0.016 285.938);
|
--sidebar-ring: oklch(0.552 0.016 285.938);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Inside @layer base so utilities like [corner-shape:round] can override it.
|
@supports (corner-shape: squircle) {
|
||||||
Unlayered rules beat every layer, which would make overrides a no-op. */
|
* {
|
||||||
@layer base {
|
corner-shape: superellipse(2);
|
||||||
@supports (corner-shape: squircle) {
|
--radius:1.5rem;
|
||||||
* {
|
}
|
||||||
corner-shape: superellipse(2);
|
|
||||||
--radius:1.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Capsule/circle radii stay round: a superellipse corner on a full radius
|
|
||||||
distorts the pill/circle shape. Merges with Tailwind's built-in rounded-full. */
|
|
||||||
@utility rounded-full {
|
|
||||||
corner-shape: round;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@layer base {
|
@layer base {
|
||||||
|
|
@ -149,48 +139,3 @@
|
||||||
@apply bg-background text-foreground;
|
@apply bg-background text-foreground;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GradientShimmer (src/components/gradient-shimmer.tsx). Colors must be hex:
|
|
||||||
the renderer parses them through a 2D canvas context. */
|
|
||||||
.gradient-shimmer {
|
|
||||||
--shimmer-alpha: 0.35;
|
|
||||||
--shimmer-grain-alpha: 0.4;
|
|
||||||
--shimmer-grain-luminance: 144;
|
|
||||||
--shimmer-grain-contrast: 96;
|
|
||||||
--shimmer-grain-saturation: 32;
|
|
||||||
--shimmer-intro-alpha: 0.6;
|
|
||||||
--shimmer-speed-up-shine-boost: 0.15;
|
|
||||||
--shimmer-start: #131316;
|
|
||||||
--shimmer-highlight: #5d8a2e;
|
|
||||||
|
|
||||||
display: block;
|
|
||||||
z-index: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
image-rendering: pixelated;
|
|
||||||
transition: opacity 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.gradient-shimmer.visible {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.gradient-shimmer.fallback {
|
|
||||||
background: var(--shimmer-start);
|
|
||||||
}
|
|
||||||
|
|
||||||
.gradient-shimmer.background {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100vw;
|
|
||||||
height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-reduced-motion: reduce) {
|
|
||||||
.gradient-shimmer {
|
|
||||||
transition-duration: 1ms;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,25 @@
|
||||||
"use client";
|
"use client";
|
||||||
import localFont from "next/font/local";
|
import localFont from "next/font/local";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRef, useState } from "react";
|
import { useState } from "react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { TopBar } from "@/components/top-bar";
|
import { TopBar } from "@/components/top-bar";
|
||||||
import { PlayDialog } from "@/components/play-dialog";
|
import { PlayDialog } from "@/components/play-dialog";
|
||||||
import { ServerStatusChip } from "@/components/server-status-chip";
|
|
||||||
import { GradientShimmer, type GradientShimmerHandle } from "@/components/gradient-shimmer";
|
|
||||||
|
|
||||||
const makeSans = localFont({ src: "../../public/font/makesans.ttf" });
|
const makeSans = localFont({ src: "../../public/font/makesans.ttf" });
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
const [playOpen, setPlayOpen] = useState(false);
|
const [playOpen, setPlayOpen] = useState(false);
|
||||||
const shimmerRef = useRef<GradientShimmerHandle>(null);
|
|
||||||
return (
|
return (
|
||||||
<main className="min-h-screen bg-background text-foreground flex flex-col font-mona">
|
<main className="min-h-screen bg-background text-foreground flex flex-col font-mona">
|
||||||
<TopBar />
|
<TopBar />
|
||||||
<div className="relative flex-1 flex items-center justify-center overflow-hidden px-6 py-16">
|
<div className="flex-1 flex items-center justify-center px-6 py-16">
|
||||||
<GradientShimmer ref={shimmerRef} className="absolute inset-0 [mask-image:radial-gradient(ellipse_at_center,black_20%,transparent_75%)]" />
|
<div className="text-center space-y-4 max-w-lg">
|
||||||
<div className="relative text-center space-y-4 max-w-lg">
|
|
||||||
<div className="flex justify-center">
|
|
||||||
<ServerStatusChip />
|
|
||||||
</div>
|
|
||||||
<h1 className={`${makeSans.className} text-4xl md:text-5xl font-extrabold lowercase text-primary tracking-tight leading-none`}>FRG Network</h1>
|
<h1 className={`${makeSans.className} text-4xl md:text-5xl font-extrabold lowercase text-primary tracking-tight leading-none`}>FRG Network</h1>
|
||||||
<p className="text-sm leading-relaxed text-muted-foreground max-w-md mx-auto">A small and fun Minecraft server and surrounding community.</p>
|
<p className="text-sm leading-relaxed text-muted-foreground max-w-md mx-auto">A small and fun Minecraft server and surrounding community.</p>
|
||||||
<div className="pt-1 flex justify-center gap-3">
|
<div className="pt-1 flex justify-center gap-3">
|
||||||
<Button
|
<Button size="lg" onClick={() => setPlayOpen(true)}>Play</Button>
|
||||||
size="lg"
|
<Button size="lg" variant="outline" asChild><Link href="/donate">Support</Link></Button>
|
||||||
onClick={() => setPlayOpen(true)}
|
|
||||||
onMouseEnter={() => shimmerRef.current?.emphasize()}
|
|
||||||
>
|
|
||||||
Play
|
|
||||||
</Button>
|
|
||||||
<Button size="lg" variant="outline" asChild><Link href="/donate">Donate</Link></Button>
|
|
||||||
</div>
|
</div>
|
||||||
<p className="text-xs text-muted-foreground/70">Java & Bedrock · frg.network</p>
|
<p className="text-xs text-muted-foreground/70">Java & Bedrock · frg.network</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,276 +0,0 @@
|
||||||
"use client";
|
|
||||||
|
|
||||||
// React port of GradientShimmer.svelte from helium-prism (https://github.com/imputnet/helium-prism),
|
|
||||||
// licensed under GPL-3.0. This file is part of the FRG web app and is licensed under GPL-3.0 (see LICENSE).
|
|
||||||
|
|
||||||
import { useEffect, useImperativeHandle, useRef, useState, type Ref } from "react";
|
|
||||||
import * as Shimmer from "@/lib/gradient-shimmer";
|
|
||||||
import { cn } from "@/lib/utils";
|
|
||||||
|
|
||||||
export type GradientShimmerHandle = {
|
|
||||||
intro: () => void;
|
|
||||||
emphasize: () => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
type GradientShimmerProps = {
|
|
||||||
intro?: boolean;
|
|
||||||
background?: boolean;
|
|
||||||
className?: string;
|
|
||||||
ref?: Ref<GradientShimmerHandle>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function GradientShimmer({
|
|
||||||
intro: shouldIntro,
|
|
||||||
background,
|
|
||||||
className,
|
|
||||||
ref,
|
|
||||||
}: GradientShimmerProps) {
|
|
||||||
const canvasRef = useRef<HTMLCanvasElement>(null);
|
|
||||||
const controllerRef = useRef<Shimmer.GradientShimmerControls | null>(null);
|
|
||||||
const [hasStaticFallback, setHasStaticFallback] = useState(false);
|
|
||||||
const [visible, setVisible] = useState(false);
|
|
||||||
|
|
||||||
useImperativeHandle(ref, () => ({
|
|
||||||
intro: () => controllerRef.current?.intro(),
|
|
||||||
emphasize: () => controllerRef.current?.emphasize(),
|
|
||||||
}), []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const canvas = canvasRef.current;
|
|
||||||
|
|
||||||
if (!canvas) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const renderer = Shimmer.createGradientShimmerRenderer(canvas);
|
|
||||||
|
|
||||||
if (!renderer) {
|
|
||||||
// One-off sync from a failed WebGL probe; there is no later render to wait for.
|
|
||||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
||||||
setHasStaticFallback(true);
|
|
||||||
setVisible(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const colorSchemeQuery = window.matchMedia(
|
|
||||||
"(prefers-color-scheme: dark)",
|
|
||||||
);
|
|
||||||
const reducedMotionQuery = window.matchMedia(
|
|
||||||
"(prefers-reduced-motion: reduce)",
|
|
||||||
);
|
|
||||||
|
|
||||||
let animationFrame: number | null = null;
|
|
||||||
let resizeFrame: number | null = null;
|
|
||||||
let introAnimation: Shimmer.IntroAnimation | null = null;
|
|
||||||
let speedUpAnimation: Shimmer.WaveSpeedUpAnimation | null = null;
|
|
||||||
let wavePhase = Shimmer.getRandomWavePhase();
|
|
||||||
let secondaryWavePhase = -wavePhase * 0.7;
|
|
||||||
let lastFrameTime: number | null = null;
|
|
||||||
let onScreen = true;
|
|
||||||
|
|
||||||
const cancelResizeFrame = () => {
|
|
||||||
if (resizeFrame === null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cancelAnimationFrame(resizeFrame);
|
|
||||||
resizeFrame = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const cancelAnimation = () => {
|
|
||||||
if (animationFrame === null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cancelAnimationFrame(animationFrame);
|
|
||||||
animationFrame = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const drawFrame = (time: number) => {
|
|
||||||
const reducedMotion = reducedMotionQuery.matches;
|
|
||||||
const deltaSeconds = reducedMotion || lastFrameTime === null
|
|
||||||
? 0
|
|
||||||
: Math.min((time - lastFrameTime) / 1000, 0.064);
|
|
||||||
const speedUpState = Shimmer.updateSpeedUpAnimation(
|
|
||||||
time,
|
|
||||||
speedUpAnimation,
|
|
||||||
);
|
|
||||||
const activeIntroAnimation = reducedMotion ? null : introAnimation;
|
|
||||||
|
|
||||||
lastFrameTime = reducedMotion ? null : time;
|
|
||||||
speedUpAnimation = reducedMotion ? null : speedUpState.animation;
|
|
||||||
|
|
||||||
if (!reducedMotion) {
|
|
||||||
wavePhase += Shimmer.IDLE_WAVE.speed
|
|
||||||
* speedUpState.multiplier
|
|
||||||
* deltaSeconds;
|
|
||||||
secondaryWavePhase += Shimmer.IDLE_WAVE.secondarySpeed
|
|
||||||
* speedUpState.multiplier
|
|
||||||
* deltaSeconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderer.render({
|
|
||||||
time,
|
|
||||||
wavePhase,
|
|
||||||
secondaryWavePhase,
|
|
||||||
introStartedAt: activeIntroAnimation?.startedAt ?? null,
|
|
||||||
shineProgress: reducedMotion ? 0 : speedUpState.shineProgress,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (
|
|
||||||
Shimmer.isIntroComplete(
|
|
||||||
time,
|
|
||||||
introAnimation,
|
|
||||||
renderer.getStripeCount(),
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
introAnimation = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const startIntro = () => {
|
|
||||||
if (reducedMotionQuery.matches) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
introAnimation = { startedAt: performance.now() };
|
|
||||||
};
|
|
||||||
|
|
||||||
const startWaveSpeedUp = () => {
|
|
||||||
if (reducedMotionQuery.matches) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const time = performance.now();
|
|
||||||
|
|
||||||
speedUpAnimation = Shimmer.triggerSpeedUpAnimation(
|
|
||||||
time,
|
|
||||||
speedUpAnimation,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const controller: Shimmer.GradientShimmerControls = {
|
|
||||||
intro: startIntro,
|
|
||||||
emphasize: startWaveSpeedUp,
|
|
||||||
};
|
|
||||||
|
|
||||||
const applyResize = () => {
|
|
||||||
renderer.resize();
|
|
||||||
renderer.readColors();
|
|
||||||
};
|
|
||||||
|
|
||||||
const scheduleResize = () => {
|
|
||||||
cancelResizeFrame();
|
|
||||||
resizeFrame = requestAnimationFrame((time) => {
|
|
||||||
applyResize();
|
|
||||||
drawFrame(time);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const draw = (time: number) => {
|
|
||||||
animationFrame = null;
|
|
||||||
drawFrame(time);
|
|
||||||
requestAnimation();
|
|
||||||
};
|
|
||||||
|
|
||||||
const requestAnimation = () => {
|
|
||||||
if (animationFrame !== null || reducedMotionQuery.matches ||
|
|
||||||
!onScreen) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
animationFrame = requestAnimationFrame(draw);
|
|
||||||
};
|
|
||||||
|
|
||||||
const resumeAnimation = () => {
|
|
||||||
lastFrameTime = null;
|
|
||||||
requestAnimation();
|
|
||||||
};
|
|
||||||
|
|
||||||
applyResize();
|
|
||||||
|
|
||||||
if (shouldIntro !== false) {
|
|
||||||
startIntro();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delay the reveal until after the first WebGL frame has been painted.
|
|
||||||
drawFrame(performance.now());
|
|
||||||
requestAnimationFrame(() => {
|
|
||||||
setVisible(true);
|
|
||||||
});
|
|
||||||
controllerRef.current = controller;
|
|
||||||
|
|
||||||
const resizeObserver = new ResizeObserver(scheduleResize);
|
|
||||||
resizeObserver.observe(canvas);
|
|
||||||
|
|
||||||
const scheduleColorRead = () => {
|
|
||||||
cancelResizeFrame();
|
|
||||||
resizeFrame = requestAnimationFrame((time) => {
|
|
||||||
renderer.readColors();
|
|
||||||
drawFrame(time);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const intersectionObserver = new IntersectionObserver(([entry]) => {
|
|
||||||
onScreen = entry?.isIntersecting ?? true;
|
|
||||||
|
|
||||||
if (!onScreen) {
|
|
||||||
cancelAnimation();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
resumeAnimation();
|
|
||||||
});
|
|
||||||
intersectionObserver.observe(canvas);
|
|
||||||
|
|
||||||
const themeObserver = new MutationObserver(scheduleColorRead);
|
|
||||||
themeObserver.observe(document.documentElement, { attributes: true });
|
|
||||||
|
|
||||||
const updateMotionPreference = () => {
|
|
||||||
if (reducedMotionQuery.matches) {
|
|
||||||
introAnimation = null;
|
|
||||||
speedUpAnimation = null;
|
|
||||||
cancelAnimation();
|
|
||||||
drawFrame(performance.now());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
resumeAnimation();
|
|
||||||
};
|
|
||||||
|
|
||||||
colorSchemeQuery.addEventListener("change", scheduleColorRead);
|
|
||||||
reducedMotionQuery.addEventListener("change", updateMotionPreference);
|
|
||||||
|
|
||||||
updateMotionPreference();
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
if (controllerRef.current === controller) {
|
|
||||||
controllerRef.current = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
setVisible(false);
|
|
||||||
cancelAnimation();
|
|
||||||
cancelResizeFrame();
|
|
||||||
resizeObserver.disconnect();
|
|
||||||
intersectionObserver.disconnect();
|
|
||||||
themeObserver.disconnect();
|
|
||||||
colorSchemeQuery.removeEventListener("change", scheduleColorRead);
|
|
||||||
reducedMotionQuery.removeEventListener("change", updateMotionPreference);
|
|
||||||
renderer.dispose();
|
|
||||||
};
|
|
||||||
}, [shouldIntro]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<canvas
|
|
||||||
ref={canvasRef}
|
|
||||||
aria-hidden="true"
|
|
||||||
className={cn(
|
|
||||||
"gradient-shimmer",
|
|
||||||
background && "background",
|
|
||||||
hasStaticFallback && "fallback",
|
|
||||||
visible && "visible",
|
|
||||||
className,
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
||||||
"use client";
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
import type { ServerStatus } from "@/lib/server-status";
|
|
||||||
|
|
||||||
const REFRESH_MS = 60_000;
|
|
||||||
|
|
||||||
const DOT = {
|
|
||||||
online: "bg-green-400",
|
|
||||||
offline: "bg-red-400",
|
|
||||||
unknown: "bg-muted-foreground/60",
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
const TEXT = {
|
|
||||||
online: "Online",
|
|
||||||
offline: "Offline",
|
|
||||||
unknown: "Status unknown",
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export function ServerStatusChip() {
|
|
||||||
const [status, setStatus] = useState<ServerStatus | null>(null);
|
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
let cancelled = false;
|
|
||||||
const load = async () => {
|
|
||||||
try {
|
|
||||||
const res = await fetch("/api/server-status");
|
|
||||||
const data = (await res.json()) as ServerStatus;
|
|
||||||
if (!cancelled) setStatus(data);
|
|
||||||
} catch {
|
|
||||||
if (!cancelled) setStatus(null);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
load();
|
|
||||||
const id = setInterval(load, REFRESH_MS);
|
|
||||||
return () => {
|
|
||||||
cancelled = true;
|
|
||||||
clearInterval(id);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const state = status?.state ?? "unknown";
|
|
||||||
const lastChecked = status
|
|
||||||
? new Date(status.checkedAt).toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit", timeZone: "UTC" })
|
|
||||||
: null;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="inline-flex flex-col items-center">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => setOpen((v) => !v)}
|
|
||||||
aria-expanded={open}
|
|
||||||
aria-controls="server-status-panel"
|
|
||||||
className="inline-flex items-center gap-2 rounded-full border border-border bg-background/60 backdrop-blur-sm px-3 py-1 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors"
|
|
||||||
>
|
|
||||||
<span className={`inline-flex h-2 w-2 rounded-full ${DOT[state]}`} />
|
|
||||||
<span>{status ? TEXT[state] : "Checking…"}</span>
|
|
||||||
{state === "online" && status?.players && (
|
|
||||||
<span className="text-muted-foreground/70">· {status.players.online} online</span>
|
|
||||||
)}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
{open && (
|
|
||||||
<div
|
|
||||||
id="server-status-panel"
|
|
||||||
className="mt-2 w-72 rounded-xl border border-border bg-background/80 backdrop-blur-md p-4 text-left text-sm shadow-xl shadow-black/30"
|
|
||||||
>
|
|
||||||
{status ? (
|
|
||||||
<dl className="grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-xs">
|
|
||||||
<dt className="text-muted-foreground">Address</dt>
|
|
||||||
<dd className="font-mono text-foreground">{status.host}</dd>
|
|
||||||
<dt className="text-muted-foreground">Players</dt>
|
|
||||||
<dd className="text-foreground">
|
|
||||||
{state === "online" && status.players ? `${status.players.online} / ${status.players.max}` : "—"}
|
|
||||||
</dd>
|
|
||||||
<dt className="text-muted-foreground">Version</dt>
|
|
||||||
<dd className="text-foreground">{state === "online" && status.version ? status.version : "—"}</dd>
|
|
||||||
{state === "online" && status.motd && (
|
|
||||||
<>
|
|
||||||
<dt className="text-muted-foreground">Message</dt>
|
|
||||||
<dd className="text-foreground">{status.motd}</dd>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</dl>
|
|
||||||
) : (
|
|
||||||
<p className="text-xs text-muted-foreground">Fetching server status…</p>
|
|
||||||
)}
|
|
||||||
<p className="mt-3 text-[11px] text-muted-foreground/70">
|
|
||||||
{state === "unknown" && status
|
|
||||||
? "We couldn't reach the status service. Try again shortly."
|
|
||||||
: lastChecked
|
|
||||||
? `Last checked ${lastChecked} UTC · refreshes every minute`
|
|
||||||
: null}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -7,8 +7,8 @@ const makeSans = localFont({ src: "../../public/font/makesans.ttf" });
|
||||||
|
|
||||||
export function TopBar() {
|
export function TopBar() {
|
||||||
return (
|
return (
|
||||||
<header className="sticky top-0 z-10 w-full px-4 pt-3">
|
<header className="sticky top-0 z-10 w-full backdrop-blur supports-backdrop-filter:bg-background/80 bg-background/80 border-b border-border">
|
||||||
<div className="mx-auto max-w-5xl flex items-center justify-between rounded-full border border-border bg-background/70 backdrop-blur-md supports-backdrop-filter:bg-background/60 shadow-xl shadow-black/30 pl-5 pr-2 py-2 text-sm">
|
<div className="mx-auto max-w-5xl flex items-center justify-between px-4 py-2.5 text-sm">
|
||||||
<Link href="/" className={`${makeSans.className} font-extrabold lowercase text-primary text-base tracking-tight`}>FRG Network</Link>
|
<Link href="/" className={`${makeSans.className} font-extrabold lowercase text-primary text-base tracking-tight`}>FRG Network</Link>
|
||||||
<nav className="flex items-center gap-4">
|
<nav className="flex items-center gap-4">
|
||||||
<Link href="/donate" className="text-sm font-medium text-muted-foreground hover:text-foreground transition-colors">Donate</Link>
|
<Link href="/donate" className="text-sm font-medium text-muted-foreground hover:text-foreground transition-colors">Donate</Link>
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ function QuestionnaireChoice({
|
||||||
<span
|
<span
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
data-slot="questionnaire-choice-indicator"
|
data-slot="questionnaire-choice-indicator"
|
||||||
className="pointer-events-none relative flex size-4 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-[4px] border border-input group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5 group-data-[type=checkbox]/questionnaire-choice:[corner-shape:round] group-data-[type=radio]/questionnaire-choice:rounded-full group-data-checked/questionnaire-choice:border-primary group-data-checked/questionnaire-choice:bg-primary group-data-checked/questionnaire-choice:text-primary-foreground dark:bg-input/30 dark:group-data-checked/questionnaire-choice:bg-primary"
|
className="pointer-events-none relative flex size-4 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-[4px] border border-input group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5 group-data-[type=radio]/questionnaire-choice:rounded-full group-data-checked/questionnaire-choice:border-primary group-data-checked/questionnaire-choice:bg-primary group-data-checked/questionnaire-choice:text-primary-foreground dark:bg-input/30 dark:group-data-checked/questionnaire-choice:bg-primary"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
data-slot="questionnaire-choice-indicator-dot"
|
data-slot="questionnaire-choice-indicator-dot"
|
||||||
|
|
|
||||||
|
|
@ -1,993 +0,0 @@
|
||||||
// Adapted from helium-prism (https://github.com/imputnet/helium-prism),
|
|
||||||
// src/lib/gradient-shimmer.ts, licensed under GPL-3.0. Shader sources are inlined.
|
|
||||||
// Modification: GLSL is inlined as strings instead of loaded with Vite-style ?raw imports.
|
|
||||||
// This file is part of the FRG web app and is licensed under GPL-3.0 (see LICENSE).
|
|
||||||
|
|
||||||
import { Geometry, Mesh, Program, Renderer, Texture } from "ogl";
|
|
||||||
|
|
||||||
const FRAGMENT_SHADER_SOURCE = `#version 300 es
|
|
||||||
|
|
||||||
precision highp float;
|
|
||||||
|
|
||||||
uniform vec2 u_size;
|
|
||||||
uniform float u_inverse_dpr;
|
|
||||||
uniform float u_stripe_width;
|
|
||||||
uniform float u_gradient_top;
|
|
||||||
uniform float u_gradient_vertical_span;
|
|
||||||
uniform float u_inverse_gradient_denominator;
|
|
||||||
|
|
||||||
uniform vec3 u_start_color;
|
|
||||||
uniform vec3 u_highlight_delta;
|
|
||||||
uniform float u_grain_alpha;
|
|
||||||
uniform float u_grain_luminance;
|
|
||||||
uniform float u_grain_contrast;
|
|
||||||
uniform float u_grain_saturation;
|
|
||||||
uniform sampler2D u_grain_noise;
|
|
||||||
|
|
||||||
flat in float v_stripe_start;
|
|
||||||
flat in vec3 v_band;
|
|
||||||
flat in vec3 v_band_inverse;
|
|
||||||
flat in float v_out_alpha;
|
|
||||||
flat in float v_highlight_strength;
|
|
||||||
|
|
||||||
const float GRAIN_SIZE = 180.0;
|
|
||||||
|
|
||||||
out vec4 fragment_color;
|
|
||||||
|
|
||||||
float clamp01(float value) {
|
|
||||||
return clamp(value, 0.0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 overlayBlend(vec3 base, vec3 blend) {
|
|
||||||
vec3 low = 2.0 * base * blend;
|
|
||||||
vec3 high = 1.0 - 2.0 * (1.0 - base) * (1.0 - blend);
|
|
||||||
|
|
||||||
return mix(low, high, step(vec3(0.5), base));
|
|
||||||
}
|
|
||||||
|
|
||||||
float gradientHighlightAmount(float position) {
|
|
||||||
if (position < v_band.x) {
|
|
||||||
return 1.0 - clamp01(position * v_band_inverse.x);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position < v_band.y) {
|
|
||||||
return clamp01((position - v_band.x) * v_band_inverse.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position < v_band.z) {
|
|
||||||
return 1.0 - clamp01((position - v_band.y) * v_band_inverse.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
vec2 css_position = vec2(
|
|
||||||
gl_FragCoord.x * u_inverse_dpr,
|
|
||||||
u_size.y - gl_FragCoord.y * u_inverse_dpr
|
|
||||||
);
|
|
||||||
vec2 gradient_offset = vec2(
|
|
||||||
css_position.x - v_stripe_start,
|
|
||||||
css_position.y - u_gradient_top
|
|
||||||
);
|
|
||||||
vec2 gradient_axis = vec2(
|
|
||||||
u_stripe_width,
|
|
||||||
u_gradient_vertical_span
|
|
||||||
);
|
|
||||||
float gradient_position = clamp01(
|
|
||||||
dot(gradient_offset, gradient_axis) * u_inverse_gradient_denominator
|
|
||||||
);
|
|
||||||
vec3 color = u_start_color + u_highlight_delta * (
|
|
||||||
gradientHighlightAmount(gradient_position) * v_highlight_strength
|
|
||||||
);
|
|
||||||
|
|
||||||
ivec2 grain_position = min(
|
|
||||||
ivec2(mod(css_position, GRAIN_SIZE)),
|
|
||||||
ivec2(GRAIN_SIZE - 1.0)
|
|
||||||
);
|
|
||||||
vec4 noise = texelFetch(u_grain_noise, grain_position, 0) - 0.5;
|
|
||||||
float luminance = u_grain_luminance + noise.r * u_grain_contrast;
|
|
||||||
vec3 color_shift = noise.gba * u_grain_saturation;
|
|
||||||
vec3 grain = clamp((vec3(luminance) + color_shift) / 255.0, 0.0, 1.0);
|
|
||||||
|
|
||||||
color = mix(color, overlayBlend(color, grain), u_grain_alpha);
|
|
||||||
|
|
||||||
fragment_color = vec4(color * v_out_alpha, v_out_alpha);
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const VERTEX_SHADER_SOURCE = `#version 300 es
|
|
||||||
|
|
||||||
precision highp float;
|
|
||||||
|
|
||||||
// X is 0 at the stripe's left edge and 1 at its right edge, Y is in clip space.
|
|
||||||
in vec2 position;
|
|
||||||
|
|
||||||
uniform vec2 u_size;
|
|
||||||
uniform float u_stripe_max_index;
|
|
||||||
uniform float u_stripe_width;
|
|
||||||
uniform float u_wave_phase;
|
|
||||||
uniform float u_secondary_wave_phase;
|
|
||||||
uniform float u_intro_active;
|
|
||||||
uniform float u_intro_elapsed;
|
|
||||||
uniform float u_shine_progress;
|
|
||||||
|
|
||||||
uniform float u_alpha;
|
|
||||||
uniform float u_intro_alpha;
|
|
||||||
uniform float u_speed_up_shine_boost;
|
|
||||||
|
|
||||||
uniform float u_gradient_band_width;
|
|
||||||
uniform float u_gradient_min_stop;
|
|
||||||
uniform float u_gradient_max_stop;
|
|
||||||
uniform float u_intro_reveal_duration;
|
|
||||||
uniform float u_intro_reveal_duration_inverse;
|
|
||||||
uniform float u_intro_idle_blend_duration_inverse;
|
|
||||||
uniform float u_intro_stagger;
|
|
||||||
uniform float u_intro_center_index;
|
|
||||||
uniform float u_intro_center_distance;
|
|
||||||
uniform float u_intro_start_center;
|
|
||||||
uniform float u_intro_idle_center;
|
|
||||||
uniform float u_idle_stripe_phase;
|
|
||||||
uniform float u_idle_secondary_stripe_phase;
|
|
||||||
uniform float u_idle_primary_amplitude;
|
|
||||||
uniform float u_idle_secondary_amplitude;
|
|
||||||
|
|
||||||
// Everything below is constant across a stripe, so it's computed per stripe
|
|
||||||
// instead of per pixel.
|
|
||||||
flat out float v_stripe_start;
|
|
||||||
// Band start, center and band end.
|
|
||||||
flat out vec3 v_band;
|
|
||||||
// Inverse lengths of the three gradient segments.
|
|
||||||
flat out vec3 v_band_inverse;
|
|
||||||
flat out float v_out_alpha;
|
|
||||||
flat out float v_highlight_strength;
|
|
||||||
|
|
||||||
const float EPSILON = 0.0001;
|
|
||||||
|
|
||||||
float clamp01(float value) {
|
|
||||||
return clamp(value, 0.0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
float easeOutCubic(float value) {
|
|
||||||
float inverse = 1.0 - value;
|
|
||||||
return 1.0 - inverse * inverse * inverse;
|
|
||||||
}
|
|
||||||
|
|
||||||
float introRevealProgress(float delayed_elapsed) {
|
|
||||||
if (u_intro_active < 0.5) {
|
|
||||||
return 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return easeOutCubic(
|
|
||||||
clamp01(delayed_elapsed * u_intro_reveal_duration_inverse)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
float introIdleProgress(float delayed_elapsed) {
|
|
||||||
if (u_intro_active < 0.5) {
|
|
||||||
return 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return easeOutCubic(
|
|
||||||
clamp01(
|
|
||||||
(delayed_elapsed - u_intro_reveal_duration) *
|
|
||||||
u_intro_idle_blend_duration_inverse
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
float stripe_index = float(gl_InstanceID);
|
|
||||||
float stripe_start = stripe_index * u_stripe_width;
|
|
||||||
float edge_x = (stripe_index + position.x) * u_stripe_width;
|
|
||||||
|
|
||||||
// Avoid a gap at the right edge from float error.
|
|
||||||
if (stripe_index == u_stripe_max_index && position.x > 0.5) {
|
|
||||||
edge_x = u_size.x;
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_Position = vec4(edge_x / u_size.x * 2.0 - 1.0, position.y, 0.0, 1.0);
|
|
||||||
|
|
||||||
float reveal_delay = max(
|
|
||||||
0.0,
|
|
||||||
abs(stripe_index - u_intro_center_index) - u_intro_center_distance
|
|
||||||
) * u_intro_stagger;
|
|
||||||
float delayed_intro_elapsed = u_intro_elapsed - reveal_delay;
|
|
||||||
float reveal_progress = introRevealProgress(delayed_intro_elapsed);
|
|
||||||
float idle_progress = introIdleProgress(delayed_intro_elapsed);
|
|
||||||
float alpha = u_intro_alpha + (u_alpha - u_intro_alpha) * idle_progress;
|
|
||||||
float stripe_phase = stripe_index * u_idle_stripe_phase;
|
|
||||||
float secondary_stripe_phase = stripe_index * u_idle_secondary_stripe_phase;
|
|
||||||
float primary_wave = sin(u_wave_phase - stripe_phase);
|
|
||||||
float secondary_wave = sin(
|
|
||||||
u_secondary_wave_phase + secondary_stripe_phase
|
|
||||||
);
|
|
||||||
float idle_center = 0.5 +
|
|
||||||
primary_wave * u_idle_primary_amplitude +
|
|
||||||
secondary_wave * u_idle_secondary_amplitude;
|
|
||||||
float intro_center = mix(
|
|
||||||
u_intro_start_center,
|
|
||||||
u_intro_idle_center,
|
|
||||||
reveal_progress
|
|
||||||
);
|
|
||||||
float center = mix(intro_center, idle_center, idle_progress);
|
|
||||||
float band_start = clamp(
|
|
||||||
center - u_gradient_band_width,
|
|
||||||
u_gradient_min_stop,
|
|
||||||
u_gradient_max_stop
|
|
||||||
);
|
|
||||||
float band_end = clamp(
|
|
||||||
center + u_gradient_band_width,
|
|
||||||
u_gradient_min_stop,
|
|
||||||
u_gradient_max_stop
|
|
||||||
);
|
|
||||||
float gradient_alpha = clamp01(
|
|
||||||
alpha * (1.0 + u_shine_progress * u_speed_up_shine_boost)
|
|
||||||
) * reveal_progress;
|
|
||||||
float out_alpha = gradient_alpha + alpha * (1.0 - gradient_alpha);
|
|
||||||
|
|
||||||
v_stripe_start = stripe_start;
|
|
||||||
v_band = vec3(band_start, center, band_end);
|
|
||||||
v_band_inverse = 1.0 / max(
|
|
||||||
vec3(band_start, center - band_start, band_end - center),
|
|
||||||
EPSILON
|
|
||||||
);
|
|
||||||
v_out_alpha = out_alpha;
|
|
||||||
// Compositing the gradient over the start color reduces to
|
|
||||||
// start + delta * amount * gradient_alpha / out_alpha.
|
|
||||||
v_highlight_strength = gradient_alpha / max(out_alpha, EPSILON);
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const STRIPE_WIDTH = {
|
|
||||||
min: 64,
|
|
||||||
target: 110,
|
|
||||||
max: 120,
|
|
||||||
};
|
|
||||||
|
|
||||||
const GRADIENT = {
|
|
||||||
bandWidth: 0.48,
|
|
||||||
minStop: 0.14,
|
|
||||||
maxStop: 0.96,
|
|
||||||
};
|
|
||||||
|
|
||||||
const INTRO = {
|
|
||||||
delay: 700,
|
|
||||||
revealDuration: 840,
|
|
||||||
idleBlendDuration: 500,
|
|
||||||
stagger: 45,
|
|
||||||
startCenter: 0.96,
|
|
||||||
idleCenter: 0.5,
|
|
||||||
};
|
|
||||||
|
|
||||||
const WAVE_SPEED_UP = {
|
|
||||||
multiplier: 2.15,
|
|
||||||
rampUpDuration: 140,
|
|
||||||
waveDuration: 320,
|
|
||||||
rampDownDuration: 480,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const IDLE_WAVE = {
|
|
||||||
speed: 0.42,
|
|
||||||
stripePhase: 0.74,
|
|
||||||
secondarySpeed: 0.26,
|
|
||||||
secondaryStripePhase: 1.28,
|
|
||||||
primaryAmplitude: 0.19,
|
|
||||||
secondaryAmplitude: 0.055,
|
|
||||||
};
|
|
||||||
|
|
||||||
const FULL_CIRCLE = Math.PI * 2;
|
|
||||||
|
|
||||||
const GRAIN = {
|
|
||||||
size: 180,
|
|
||||||
hashScale: [127.1, 311.7],
|
|
||||||
hashOffset: 43758.5,
|
|
||||||
// Luminance, then the red, green and blue color shifts.
|
|
||||||
channelOffsets: [[0, 0], [17, 3], [7, 29], [31, 11]],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export type IntroAnimation = {
|
|
||||||
startedAt: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
type WaveSpeedUpValues = {
|
|
||||||
multiplier: number;
|
|
||||||
shineProgress: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type WaveSpeedUpAnimation = {
|
|
||||||
phase: "ramp-up";
|
|
||||||
startedAt: number;
|
|
||||||
duration: number;
|
|
||||||
from: WaveSpeedUpValues;
|
|
||||||
} | {
|
|
||||||
phase: "hold";
|
|
||||||
startedAt: number;
|
|
||||||
} | {
|
|
||||||
phase: "ramp-down";
|
|
||||||
startedAt: number;
|
|
||||||
from: WaveSpeedUpValues;
|
|
||||||
};
|
|
||||||
|
|
||||||
type Size = {
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
dpr: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type GradientShimmerControls = {
|
|
||||||
intro: () => void;
|
|
||||||
emphasize: () => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
type WaveSpeedUpAnimationState = WaveSpeedUpValues & {
|
|
||||||
animation: WaveSpeedUpAnimation | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
type Color = [number, number, number];
|
|
||||||
|
|
||||||
type ShaderColors = {
|
|
||||||
alpha: number;
|
|
||||||
grainAlpha: number;
|
|
||||||
grainLuminance: number;
|
|
||||||
grainContrast: number;
|
|
||||||
grainSaturation: number;
|
|
||||||
introAlpha: number;
|
|
||||||
start: Color;
|
|
||||||
highlightDelta: Color;
|
|
||||||
speedUpShineBoost: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
type StripeMetrics = {
|
|
||||||
count: number;
|
|
||||||
width: number;
|
|
||||||
maxIndex: number;
|
|
||||||
introCenterIndex: number;
|
|
||||||
introCenterDistance: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
type RenderMetrics = {
|
|
||||||
inverseDpr: number;
|
|
||||||
gradientTop: number;
|
|
||||||
gradientVerticalSpan: number;
|
|
||||||
inverseGradientDenominator: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Grain is static, so it's hashed once here instead of per pixel every frame.
|
|
||||||
const createGrainNoise = () => {
|
|
||||||
const { size, hashScale, hashOffset, channelOffsets } = GRAIN;
|
|
||||||
const data = new Uint8Array(size * size * channelOffsets.length);
|
|
||||||
let index = 0;
|
|
||||||
|
|
||||||
for (let y = 0; y < size; y++) {
|
|
||||||
for (let x = 0; x < size; x++) {
|
|
||||||
for (const [offsetX, offsetY] of channelOffsets) {
|
|
||||||
const hash = Math.sin(
|
|
||||||
(x + offsetX) * hashScale[0] + (y + offsetY) * hashScale[1],
|
|
||||||
) * hashOffset;
|
|
||||||
|
|
||||||
data[index++] = Math.round((hash - Math.floor(hash)) * 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
// One instanced quad per stripe. The vertex shader takes the stripe index
|
|
||||||
// from gl_InstanceID, so no per-instance attribute is needed.
|
|
||||||
const createStripeGeometry = (gl: Renderer["gl"]) => {
|
|
||||||
const geometry = new Geometry(gl, {
|
|
||||||
position: {
|
|
||||||
size: 2,
|
|
||||||
data: new Float32Array([
|
|
||||||
0, -1,
|
|
||||||
1, -1,
|
|
||||||
0, 1,
|
|
||||||
0, 1,
|
|
||||||
1, -1,
|
|
||||||
1, 1,
|
|
||||||
]),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
geometry.isInstanced = true;
|
|
||||||
|
|
||||||
return geometry;
|
|
||||||
};
|
|
||||||
|
|
||||||
type GradientShimmerRenderer = {
|
|
||||||
resize: () => void;
|
|
||||||
readColors: () => void;
|
|
||||||
render: (frame: {
|
|
||||||
time: number;
|
|
||||||
wavePhase: number;
|
|
||||||
secondaryWavePhase: number;
|
|
||||||
introStartedAt: number | null;
|
|
||||||
shineProgress: number;
|
|
||||||
}) => void;
|
|
||||||
dispose: () => void;
|
|
||||||
getStripeCount: () => number;
|
|
||||||
};
|
|
||||||
|
|
||||||
const clamp = (value: number, min = 0, max = 1) => Math.max(min, Math.min(max, value));
|
|
||||||
const lerp = (start: number, end: number, progress: number) => start + (end - start) * progress;
|
|
||||||
const easeOutCubic = (value: number) => 1 - Math.pow(1 - value, 3);
|
|
||||||
const easeInOutCubic = (value: number) => (
|
|
||||||
value < 0.5 ? 4 * value * value * value : 1 - Math.pow(-2 * value + 2, 3) / 2
|
|
||||||
);
|
|
||||||
|
|
||||||
export const getRandomWavePhase = () => Math.random() * FULL_CIRCLE;
|
|
||||||
|
|
||||||
const readCssNumber = (
|
|
||||||
styles: CSSStyleDeclaration,
|
|
||||||
name: string,
|
|
||||||
) => {
|
|
||||||
const rawValue = styles.getPropertyValue(name).trim();
|
|
||||||
const value = Number(rawValue);
|
|
||||||
|
|
||||||
if (!rawValue || !Number.isFinite(value)) {
|
|
||||||
throw new Error(`Missing or invalid CSS number: ${name}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
};
|
|
||||||
|
|
||||||
const readCssString = (
|
|
||||||
styles: CSSStyleDeclaration,
|
|
||||||
name: string,
|
|
||||||
) => {
|
|
||||||
const value = styles.getPropertyValue(name).trim();
|
|
||||||
|
|
||||||
if (!value) {
|
|
||||||
throw new Error(`Missing CSS value: ${name}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getStripeCount = (canvasWidth: number) => {
|
|
||||||
const minCount = Math.max(1, Math.ceil(canvasWidth / STRIPE_WIDTH.max));
|
|
||||||
const maxCount = Math.max(1, Math.floor(canvasWidth / STRIPE_WIDTH.min));
|
|
||||||
const targetCount = Math.max(
|
|
||||||
1,
|
|
||||||
Math.round(canvasWidth / STRIPE_WIDTH.target),
|
|
||||||
);
|
|
||||||
|
|
||||||
return Math.max(minCount, Math.min(maxCount, targetCount));
|
|
||||||
};
|
|
||||||
|
|
||||||
const getStripeMetrics = (width: number): StripeMetrics => {
|
|
||||||
const count = getStripeCount(width);
|
|
||||||
const stripeWidth = width / count;
|
|
||||||
const maxIndex = count - 1;
|
|
||||||
|
|
||||||
return {
|
|
||||||
count,
|
|
||||||
width: stripeWidth,
|
|
||||||
maxIndex,
|
|
||||||
introCenterIndex: maxIndex / 2,
|
|
||||||
introCenterDistance: count % 2 === 0 ? 0.5 : 0,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const getRenderMetrics = (
|
|
||||||
size: Size,
|
|
||||||
stripes: StripeMetrics,
|
|
||||||
): RenderMetrics => {
|
|
||||||
const gradientVerticalSpan = size.height * 1.7;
|
|
||||||
|
|
||||||
return {
|
|
||||||
inverseDpr: 1 / size.dpr,
|
|
||||||
gradientTop: size.height * -0.35,
|
|
||||||
gradientVerticalSpan,
|
|
||||||
inverseGradientDenominator: 1 / (
|
|
||||||
stripes.width * stripes.width
|
|
||||||
+ gradientVerticalSpan * gradientVerticalSpan
|
|
||||||
),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const getRevealDelay = (
|
|
||||||
index: number,
|
|
||||||
stripeCount: number,
|
|
||||||
stagger = INTRO.stagger,
|
|
||||||
) => {
|
|
||||||
const centerIndex = (stripeCount - 1) / 2;
|
|
||||||
const centerDistance = stripeCount % 2 === 0 ? 0.5 : 0;
|
|
||||||
const distanceFromCenter = Math.abs(index - centerIndex) - centerDistance;
|
|
||||||
|
|
||||||
return Math.max(0, distanceFromCenter) * stagger;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getMaxRevealDelay = (stripeCount: number, stagger = INTRO.stagger) => {
|
|
||||||
if (stripeCount <= 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Math.max(
|
|
||||||
getRevealDelay(0, stripeCount, stagger),
|
|
||||||
getRevealDelay(stripeCount - 1, stripeCount, stagger),
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const isIntroComplete = (
|
|
||||||
time: number,
|
|
||||||
introAnimation: IntroAnimation | null,
|
|
||||||
stripeCount: number,
|
|
||||||
) => {
|
|
||||||
if (!introAnimation) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const completeAt = introAnimation.startedAt
|
|
||||||
+ INTRO.delay
|
|
||||||
+ getMaxRevealDelay(stripeCount)
|
|
||||||
+ INTRO.revealDuration
|
|
||||||
+ INTRO.idleBlendDuration;
|
|
||||||
|
|
||||||
return time >= completeAt;
|
|
||||||
};
|
|
||||||
|
|
||||||
const createShaderUniforms = (grainNoise: Texture) => ({
|
|
||||||
u_size: { value: [1, 1] },
|
|
||||||
u_inverse_dpr: { value: 1 },
|
|
||||||
u_stripe_max_index: { value: 0 },
|
|
||||||
u_stripe_width: { value: 1 },
|
|
||||||
u_gradient_top: { value: 0 },
|
|
||||||
u_gradient_vertical_span: { value: 1 },
|
|
||||||
u_inverse_gradient_denominator: { value: 1 },
|
|
||||||
u_wave_phase: { value: 0 },
|
|
||||||
u_secondary_wave_phase: { value: 0 },
|
|
||||||
u_intro_active: { value: 0 },
|
|
||||||
u_intro_elapsed: { value: 0 },
|
|
||||||
u_shine_progress: { value: 0 },
|
|
||||||
u_start_color: { value: [0, 0, 0] },
|
|
||||||
u_highlight_delta: { value: [0, 0, 0] },
|
|
||||||
u_alpha: { value: 1 },
|
|
||||||
u_intro_alpha: { value: 1 },
|
|
||||||
u_speed_up_shine_boost: { value: 0 },
|
|
||||||
u_grain_alpha: { value: 0 },
|
|
||||||
u_grain_luminance: { value: 0 },
|
|
||||||
u_grain_contrast: { value: 0 },
|
|
||||||
u_grain_saturation: { value: 0 },
|
|
||||||
u_grain_noise: { value: grainNoise },
|
|
||||||
u_intro_center_index: { value: 0 },
|
|
||||||
u_intro_center_distance: { value: 0 },
|
|
||||||
u_gradient_band_width: { value: GRADIENT.bandWidth },
|
|
||||||
u_gradient_min_stop: { value: GRADIENT.minStop },
|
|
||||||
u_gradient_max_stop: { value: GRADIENT.maxStop },
|
|
||||||
u_intro_reveal_duration: { value: INTRO.revealDuration },
|
|
||||||
u_intro_reveal_duration_inverse: { value: 1 / INTRO.revealDuration },
|
|
||||||
u_intro_idle_blend_duration_inverse: { value: 1 / INTRO.idleBlendDuration },
|
|
||||||
u_intro_stagger: { value: INTRO.stagger },
|
|
||||||
u_intro_start_center: { value: INTRO.startCenter },
|
|
||||||
u_intro_idle_center: { value: INTRO.idleCenter },
|
|
||||||
u_idle_stripe_phase: { value: IDLE_WAVE.stripePhase },
|
|
||||||
u_idle_secondary_stripe_phase: { value: IDLE_WAVE.secondaryStripePhase },
|
|
||||||
u_idle_primary_amplitude: { value: IDLE_WAVE.primaryAmplitude },
|
|
||||||
u_idle_secondary_amplitude: { value: IDLE_WAVE.secondaryAmplitude },
|
|
||||||
});
|
|
||||||
|
|
||||||
const parseColorChannel = (channel: string) => {
|
|
||||||
if (channel.endsWith("%")) {
|
|
||||||
return clamp(Number.parseFloat(channel) / 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
return clamp(Number.parseFloat(channel) / 255);
|
|
||||||
};
|
|
||||||
|
|
||||||
const parseCssColorValue = (value: string): Color => {
|
|
||||||
const color = value.trim().toLowerCase();
|
|
||||||
|
|
||||||
if (color.startsWith("#")) {
|
|
||||||
const hex = color.slice(1);
|
|
||||||
const normalized = hex.length === 3
|
|
||||||
? hex.split("").map((part) => part + part).join("")
|
|
||||||
: hex;
|
|
||||||
|
|
||||||
if (normalized.length === 6) {
|
|
||||||
return [
|
|
||||||
Number.parseInt(normalized.slice(0, 2), 16) / 255,
|
|
||||||
Number.parseInt(normalized.slice(2, 4), 16) / 255,
|
|
||||||
Number.parseInt(normalized.slice(4, 6), 16) / 255,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const channels = color.match(/-?\d*\.?\d+(?:e[+-]?\d+)?%?/g) ?? [];
|
|
||||||
|
|
||||||
if (color.startsWith("color(") && channels.length >= 3) {
|
|
||||||
const [red, green, blue] = channels as [string, string, string];
|
|
||||||
|
|
||||||
return [
|
|
||||||
clamp(Number.parseFloat(red)),
|
|
||||||
clamp(Number.parseFloat(green)),
|
|
||||||
clamp(Number.parseFloat(blue)),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (channels.length >= 3) {
|
|
||||||
const [red, green, blue] = channels as [string, string, string];
|
|
||||||
|
|
||||||
return [
|
|
||||||
parseColorChannel(red),
|
|
||||||
parseColorChannel(green),
|
|
||||||
parseColorChannel(blue),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error(`Unsupported CSS color: ${value}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
const readCssColor = (
|
|
||||||
styles: CSSStyleDeclaration,
|
|
||||||
name: string,
|
|
||||||
context: CanvasRenderingContext2D,
|
|
||||||
) => {
|
|
||||||
const rawValue = readCssString(styles, name);
|
|
||||||
|
|
||||||
context.fillStyle = "#000000";
|
|
||||||
context.fillStyle = rawValue;
|
|
||||||
|
|
||||||
return parseCssColorValue(context.fillStyle);
|
|
||||||
};
|
|
||||||
|
|
||||||
const readShaderColors = (
|
|
||||||
canvas: HTMLCanvasElement,
|
|
||||||
colorContext: CanvasRenderingContext2D,
|
|
||||||
): ShaderColors => {
|
|
||||||
const styles = getComputedStyle(canvas);
|
|
||||||
const start = readCssColor(styles, "--shimmer-start", colorContext);
|
|
||||||
const highlight = readCssColor(styles, "--shimmer-highlight", colorContext);
|
|
||||||
|
|
||||||
return {
|
|
||||||
alpha: readCssNumber(styles, "--shimmer-alpha"),
|
|
||||||
grainAlpha: readCssNumber(styles, "--shimmer-grain-alpha"),
|
|
||||||
grainLuminance: readCssNumber(styles, "--shimmer-grain-luminance"),
|
|
||||||
grainContrast: readCssNumber(styles, "--shimmer-grain-contrast"),
|
|
||||||
grainSaturation: readCssNumber(styles, "--shimmer-grain-saturation"),
|
|
||||||
introAlpha: readCssNumber(styles, "--shimmer-intro-alpha"),
|
|
||||||
start,
|
|
||||||
highlightDelta: [
|
|
||||||
highlight[0] - start[0],
|
|
||||||
highlight[1] - start[1],
|
|
||||||
highlight[2] - start[2],
|
|
||||||
],
|
|
||||||
speedUpShineBoost: readCssNumber(
|
|
||||||
styles,
|
|
||||||
"--shimmer-speed-up-shine-boost",
|
|
||||||
),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const getCanvasSize = (canvas: HTMLCanvasElement): Size => {
|
|
||||||
const { width, height } = canvas.getBoundingClientRect();
|
|
||||||
// Grain cells are CSS pixels and the gradient is smooth, so rendering
|
|
||||||
// above CSS resolution adds nothing. The canvas is upscaled pixelated.
|
|
||||||
const dpr = Math.min(globalThis.devicePixelRatio || 1, 1);
|
|
||||||
const cssWidth = Math.max(1, width);
|
|
||||||
const cssHeight = Math.max(1, height);
|
|
||||||
|
|
||||||
return { width: cssWidth, height: cssHeight, dpr };
|
|
||||||
};
|
|
||||||
|
|
||||||
const resizeOglCanvas = (
|
|
||||||
canvas: HTMLCanvasElement,
|
|
||||||
renderer: Renderer,
|
|
||||||
): Size => {
|
|
||||||
const size = getCanvasSize(canvas);
|
|
||||||
|
|
||||||
renderer.dpr = size.dpr;
|
|
||||||
renderer.setSize(size.width, size.height);
|
|
||||||
canvas.style.width = "";
|
|
||||||
canvas.style.height = "";
|
|
||||||
|
|
||||||
return size;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const createGradientShimmerRenderer = (
|
|
||||||
canvas: HTMLCanvasElement,
|
|
||||||
): GradientShimmerRenderer | null => {
|
|
||||||
const initialSize = getCanvasSize(canvas);
|
|
||||||
let renderer: Renderer;
|
|
||||||
|
|
||||||
try {
|
|
||||||
renderer = new Renderer({
|
|
||||||
canvas,
|
|
||||||
width: initialSize.width,
|
|
||||||
height: initialSize.height,
|
|
||||||
dpr: initialSize.dpr,
|
|
||||||
alpha: true,
|
|
||||||
antialias: false,
|
|
||||||
autoClear: false,
|
|
||||||
depth: false,
|
|
||||||
premultipliedAlpha: true,
|
|
||||||
preserveDrawingBuffer: false,
|
|
||||||
stencil: false,
|
|
||||||
webgl: 2,
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { gl } = renderer;
|
|
||||||
|
|
||||||
if (!gl || !renderer.isWebgl2) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
canvas.style.width = "";
|
|
||||||
canvas.style.height = "";
|
|
||||||
gl.clearColor(0, 0, 0, 0);
|
|
||||||
|
|
||||||
const colorCanvas = document.createElement("canvas");
|
|
||||||
const colorContext = colorCanvas.getContext("2d");
|
|
||||||
|
|
||||||
if (!colorContext) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const grainNoise = new Texture(gl, {
|
|
||||||
image: createGrainNoise(),
|
|
||||||
width: GRAIN.size,
|
|
||||||
height: GRAIN.size,
|
|
||||||
generateMipmaps: false,
|
|
||||||
minFilter: gl.NEAREST,
|
|
||||||
magFilter: gl.NEAREST,
|
|
||||||
flipY: false,
|
|
||||||
});
|
|
||||||
const uniforms = createShaderUniforms(grainNoise);
|
|
||||||
let program: Program | null = null;
|
|
||||||
let geometry: Geometry | null = null;
|
|
||||||
let mesh: Mesh | null = null;
|
|
||||||
let initialColors: ShaderColors | null = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
program = new Program(gl, {
|
|
||||||
vertex: VERTEX_SHADER_SOURCE,
|
|
||||||
fragment: FRAGMENT_SHADER_SOURCE,
|
|
||||||
uniforms,
|
|
||||||
cullFace: false,
|
|
||||||
depthTest: false,
|
|
||||||
depthWrite: false,
|
|
||||||
transparent: false,
|
|
||||||
});
|
|
||||||
geometry = createStripeGeometry(gl);
|
|
||||||
mesh = new Mesh(gl, {
|
|
||||||
geometry,
|
|
||||||
program,
|
|
||||||
frustumCulled: false,
|
|
||||||
});
|
|
||||||
initialColors = readShaderColors(canvas, colorContext);
|
|
||||||
} catch {
|
|
||||||
geometry?.remove();
|
|
||||||
program?.remove();
|
|
||||||
gl.deleteTexture(grainNoise.texture);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!program || !geometry || !mesh || !initialColors) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
let stripes = getStripeMetrics(initialSize.width);
|
|
||||||
|
|
||||||
const applySize = (size: Size) => {
|
|
||||||
stripes = getStripeMetrics(size.width);
|
|
||||||
const renderMetrics = getRenderMetrics(size, stripes);
|
|
||||||
|
|
||||||
geometry.setInstancedCount(stripes.count);
|
|
||||||
uniforms.u_size.value = [size.width, size.height];
|
|
||||||
uniforms.u_inverse_dpr.value = renderMetrics.inverseDpr;
|
|
||||||
uniforms.u_stripe_max_index.value = stripes.maxIndex;
|
|
||||||
uniforms.u_stripe_width.value = stripes.width;
|
|
||||||
uniforms.u_gradient_top.value = renderMetrics.gradientTop;
|
|
||||||
uniforms.u_gradient_vertical_span.value = renderMetrics.gradientVerticalSpan;
|
|
||||||
uniforms.u_inverse_gradient_denominator.value =
|
|
||||||
renderMetrics.inverseGradientDenominator;
|
|
||||||
uniforms.u_intro_center_index.value = stripes.introCenterIndex;
|
|
||||||
uniforms.u_intro_center_distance.value = stripes.introCenterDistance;
|
|
||||||
};
|
|
||||||
|
|
||||||
const applyColors = (colors: ShaderColors) => {
|
|
||||||
uniforms.u_start_color.value = colors.start;
|
|
||||||
uniforms.u_highlight_delta.value = colors.highlightDelta;
|
|
||||||
uniforms.u_alpha.value = colors.alpha;
|
|
||||||
uniforms.u_intro_alpha.value = colors.introAlpha;
|
|
||||||
uniforms.u_speed_up_shine_boost.value = colors.speedUpShineBoost;
|
|
||||||
uniforms.u_grain_alpha.value = colors.grainAlpha;
|
|
||||||
uniforms.u_grain_luminance.value = colors.grainLuminance;
|
|
||||||
uniforms.u_grain_contrast.value = colors.grainContrast;
|
|
||||||
uniforms.u_grain_saturation.value = colors.grainSaturation;
|
|
||||||
};
|
|
||||||
|
|
||||||
applySize(initialSize);
|
|
||||||
applyColors(initialColors);
|
|
||||||
|
|
||||||
const resize = () => {
|
|
||||||
applySize(resizeOglCanvas(canvas, renderer));
|
|
||||||
};
|
|
||||||
|
|
||||||
const readColors = () => {
|
|
||||||
applyColors(readShaderColors(canvas, colorContext));
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
|
||||||
resize,
|
|
||||||
readColors,
|
|
||||||
render: ({
|
|
||||||
time,
|
|
||||||
wavePhase,
|
|
||||||
secondaryWavePhase,
|
|
||||||
introStartedAt,
|
|
||||||
shineProgress,
|
|
||||||
}) => {
|
|
||||||
uniforms.u_wave_phase.value = wavePhase;
|
|
||||||
uniforms.u_secondary_wave_phase.value = secondaryWavePhase;
|
|
||||||
uniforms.u_intro_active.value = introStartedAt === null ? 0 : 1;
|
|
||||||
uniforms.u_intro_elapsed.value = introStartedAt === null
|
|
||||||
? 0
|
|
||||||
: time - introStartedAt - INTRO.delay;
|
|
||||||
uniforms.u_shine_progress.value = shineProgress;
|
|
||||||
|
|
||||||
renderer.render({
|
|
||||||
scene: mesh,
|
|
||||||
clear: true,
|
|
||||||
frustumCull: false,
|
|
||||||
sort: false,
|
|
||||||
update: false,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
dispose: () => {
|
|
||||||
geometry.remove();
|
|
||||||
program.remove();
|
|
||||||
gl.deleteTexture(grainNoise.texture);
|
|
||||||
},
|
|
||||||
getStripeCount: () => stripes.count,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const IDLE_SPEED_UP: WaveSpeedUpValues = {
|
|
||||||
multiplier: 1,
|
|
||||||
shineProgress: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
const PEAK_SPEED_UP: WaveSpeedUpValues = {
|
|
||||||
multiplier: WAVE_SPEED_UP.multiplier,
|
|
||||||
shineProgress: 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
const lerpSpeedUpValues = (
|
|
||||||
from: WaveSpeedUpValues,
|
|
||||||
to: WaveSpeedUpValues,
|
|
||||||
progress: number,
|
|
||||||
): WaveSpeedUpValues => ({
|
|
||||||
multiplier: lerp(from.multiplier, to.multiplier, progress),
|
|
||||||
shineProgress: lerp(from.shineProgress, to.shineProgress, progress),
|
|
||||||
});
|
|
||||||
|
|
||||||
const getProgress = (time: number, startedAt: number, duration: number) =>
|
|
||||||
clamp((time - startedAt) / duration);
|
|
||||||
|
|
||||||
const getSpeedUpRampUpDuration = (from: WaveSpeedUpValues) => {
|
|
||||||
const multiplierRemaining = clamp(
|
|
||||||
(WAVE_SPEED_UP.multiplier - from.multiplier)
|
|
||||||
/ (WAVE_SPEED_UP.multiplier - 1),
|
|
||||||
);
|
|
||||||
const shineRemaining = 1 - from.shineProgress;
|
|
||||||
|
|
||||||
return Math.max(
|
|
||||||
1,
|
|
||||||
WAVE_SPEED_UP.rampUpDuration
|
|
||||||
* Math.max(multiplierRemaining, shineRemaining),
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const isSpeedUpAtPeak = ({ multiplier, shineProgress }: WaveSpeedUpValues) =>
|
|
||||||
multiplier >= WAVE_SPEED_UP.multiplier && shineProgress >= 1;
|
|
||||||
|
|
||||||
export const triggerSpeedUpAnimation = (
|
|
||||||
time: number,
|
|
||||||
speedUpAnimation: WaveSpeedUpAnimation | null,
|
|
||||||
): WaveSpeedUpAnimation => {
|
|
||||||
const { multiplier, shineProgress } = updateSpeedUpAnimation(
|
|
||||||
time,
|
|
||||||
speedUpAnimation,
|
|
||||||
);
|
|
||||||
const from = { multiplier, shineProgress };
|
|
||||||
|
|
||||||
if (isSpeedUpAtPeak(from)) {
|
|
||||||
return {
|
|
||||||
phase: "hold",
|
|
||||||
startedAt: time,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
phase: "ramp-up",
|
|
||||||
startedAt: time,
|
|
||||||
duration: getSpeedUpRampUpDuration(from),
|
|
||||||
from,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const updateSpeedUpAnimation = (
|
|
||||||
time: number,
|
|
||||||
speedUpAnimation: WaveSpeedUpAnimation | null,
|
|
||||||
): WaveSpeedUpAnimationState => {
|
|
||||||
if (!speedUpAnimation) {
|
|
||||||
return {
|
|
||||||
animation: null,
|
|
||||||
...IDLE_SPEED_UP,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (speedUpAnimation.phase === "ramp-up") {
|
|
||||||
const progress = getProgress(
|
|
||||||
time,
|
|
||||||
speedUpAnimation.startedAt,
|
|
||||||
speedUpAnimation.duration,
|
|
||||||
);
|
|
||||||
const values = lerpSpeedUpValues(
|
|
||||||
speedUpAnimation.from,
|
|
||||||
PEAK_SPEED_UP,
|
|
||||||
easeOutCubic(progress),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (progress >= 1) {
|
|
||||||
return {
|
|
||||||
animation: {
|
|
||||||
phase: "hold",
|
|
||||||
startedAt: time,
|
|
||||||
},
|
|
||||||
...values,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
animation: speedUpAnimation,
|
|
||||||
...values,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (speedUpAnimation.phase === "hold") {
|
|
||||||
const progress = getProgress(
|
|
||||||
time,
|
|
||||||
speedUpAnimation.startedAt,
|
|
||||||
WAVE_SPEED_UP.waveDuration,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (progress >= 1) {
|
|
||||||
return {
|
|
||||||
animation: {
|
|
||||||
phase: "ramp-down",
|
|
||||||
startedAt: time,
|
|
||||||
from: PEAK_SPEED_UP,
|
|
||||||
},
|
|
||||||
...PEAK_SPEED_UP,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
animation: speedUpAnimation,
|
|
||||||
...PEAK_SPEED_UP,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const progress = getProgress(
|
|
||||||
time,
|
|
||||||
speedUpAnimation.startedAt,
|
|
||||||
WAVE_SPEED_UP.rampDownDuration,
|
|
||||||
);
|
|
||||||
const values = lerpSpeedUpValues(
|
|
||||||
speedUpAnimation.from,
|
|
||||||
IDLE_SPEED_UP,
|
|
||||||
easeInOutCubic(progress),
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
animation: progress >= 1 ? null : speedUpAnimation,
|
|
||||||
...values,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
import { cfg } from "./cfg";
|
|
||||||
|
|
||||||
type McStatusJava = {
|
|
||||||
online: boolean;
|
|
||||||
host: string;
|
|
||||||
port: number;
|
|
||||||
ip_address: string | null;
|
|
||||||
version: { name_clean: string } | null;
|
|
||||||
players: { online: number; max: number } | null;
|
|
||||||
motd: { clean: string } | null;
|
|
||||||
retrieved_at: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ServerStatus = {
|
|
||||||
state: "online" | "offline" | "unknown";
|
|
||||||
host: string;
|
|
||||||
version: string | null;
|
|
||||||
players: { online: number; max: number } | null;
|
|
||||||
motd: string | null;
|
|
||||||
checkedAt: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
const STATUS_URL = "https://api.mcstatus.io/v2/status/java";
|
|
||||||
|
|
||||||
export async function getJavaServerStatus(): Promise<ServerStatus> {
|
|
||||||
const host = cfg.server.javaIp || "frg.network";
|
|
||||||
const unknown: ServerStatus = { state: "unknown", host, version: null, players: null, motd: null, checkedAt: Date.now() };
|
|
||||||
|
|
||||||
try {
|
|
||||||
const res = await fetch(`${STATUS_URL}/${encodeURIComponent(host)}`, {
|
|
||||||
next: { revalidate: 60 },
|
|
||||||
});
|
|
||||||
if (!res.ok) return unknown;
|
|
||||||
|
|
||||||
const data = (await res.json()) as McStatusJava;
|
|
||||||
return {
|
|
||||||
state: data.online ? "online" : "offline",
|
|
||||||
host,
|
|
||||||
version: data.version?.name_clean ?? null,
|
|
||||||
players: data.online && data.players ? { online: data.players.online, max: data.players.max } : null,
|
|
||||||
motd: data.motd?.clean ?? null,
|
|
||||||
checkedAt: data.retrieved_at ?? Date.now(),
|
|
||||||
};
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Server status lookup failed:", error);
|
|
||||||
return unknown;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue