Compare commits
No files matched your search
@@ -275,7 +275,7 @@ version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -286,7 +286,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"once_cell_polyfill",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1751,7 +1751,7 @@ dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users 0.5.3",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1923,7 +1923,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "ely-gpui-component"
|
||||
version = "0.1.1"
|
||||
source = "git+https://git.zacharyzhang.com/ZacharyZhang-NY/Ely-GPUI-Components?rev=2b8bd9fcf3ab94a3399ca70bfaf0a6764291f5ec#2b8bd9fcf3ab94a3399ca70bfaf0a6764291f5ec"
|
||||
source = "git+https://git.zacharyzhang.com/ZacharyZhang-NY/Ely-GPUI-Components?rev=90bd37b5504809eed42f0a0a1e3f7e20ac6973ff#90bd37b5504809eed42f0a0a1e3f7e20ac6973ff"
|
||||
dependencies = [
|
||||
"alacritty_terminal",
|
||||
"anyhow",
|
||||
@@ -2337,7 +2337,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4505,7 +4505,7 @@ version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "536bfad37a309d62069485248eeaba1e8d9853aaf951caaeaed0585a95346f08"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4670,7 +4670,7 @@ version = "0.50.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6422,7 +6422,7 @@ dependencies = [
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7010,7 +7010,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"psm",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7350,7 +7350,7 @@ dependencies = [
|
||||
"getrandom 0.4.3",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7700,7 +7700,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"
|
||||
dependencies = [
|
||||
"memoffset",
|
||||
"tempfile",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.60.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -8499,7 +8499,7 @@ version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -8,7 +8,7 @@ exclude = ["engines", "reference"]
|
||||
version = "0.1.5"
|
||||
edition = "2024"
|
||||
rust-version = "1.95"
|
||||
license = "AGPL-3.0-or-later"
|
||||
license = "MIT"
|
||||
publish = false
|
||||
|
||||
[workspace.dependencies]
|
||||
@@ -19,7 +19,7 @@ jiff = "0.2"
|
||||
anyhow = "1"
|
||||
directories = "6"
|
||||
dunce = "1"
|
||||
ely-gpui-component = { git = "https://git.zacharyzhang.com/ZacharyZhang-NY/Ely-GPUI-Components", rev = "2b8bd9fcf3ab94a3399ca70bfaf0a6764291f5ec" }
|
||||
ely-gpui-component = { git = "https://git.zacharyzhang.com/ZacharyZhang-NY/Ely-GPUI-Components", rev = "90bd37b5504809eed42f0a0a1e3f7e20ac6973ff" }
|
||||
env_logger = "0.11"
|
||||
gpui = { package = "gpui-pre", version = "=0.3.8", default-features = false, features = ["stacker"] }
|
||||
gpui_platform = { package = "gpui-pre-platform", version = "=0.3.8", features = ["font-kit", "wayland", "x11"] }
|
||||
|
||||
@@ -1,661 +1,21 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are 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.
|
||||
|
||||
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.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
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 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 work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero 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 Affero 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 Affero 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 Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
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 AGPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Yang Zhang
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -756,7 +756,7 @@ Doc、Table、Show 的 PDF 输出由 LOK 完成,不要求安装 ElyPDF。ElyMa
|
||||
|
||||
### 21.1 自有代码默认许可
|
||||
|
||||
本 PRD 对新增应用代码采用 AGPL-3.0-or-later 作为发行默认,便于与 MuPDF 的开源使用路线保持一致。Ely GPUI Components 继续保留现有 MIT/Apache-2.0 许可,不因被应用使用而改写其许可证。[S1]
|
||||
本 PRD 对新增应用代码采用 MIT 作为发行默认(用户 2026-10-19 定,原为 AGPL-3.0-or-later)。MIT 只管 Ely 的自有代码:链接 MuPDF 的 ElyPDF 发行包整体仍须按 MuPDF 的 AGPL 条款提供对应源码。Ely GPUI Components 继续保留现有 MIT/Apache-2.0 许可,不因被应用使用而改写其许可证。[S1]
|
||||
|
||||
第三方代码保持原许可证。不得把 LibreOffice、Git 或其他依赖的版权声明统一替换成 Ely 的声明。最终发行须按实际链接、进程调用、修改和打包方式审查,进程隔离不作为免除许可义务的依据。
|
||||
|
||||
|
||||
@@ -43,4 +43,4 @@ Packages: `packaging/macos/release.sh` writes each app's `.app` and `.dmg`, the
|
||||
|
||||
## Licence
|
||||
|
||||
AGPL-3.0-or-later (`LICENSE`). Third-party components keep their own licences; see `docs/licenses.md`.
|
||||
MIT (`LICENSE`). Third-party components keep their own licences; see `docs/licenses.md`.
|
||||
@@ -40,7 +40,7 @@ site/ 官网(Vite 8、pnpm、TypeScript,无框架;等轴 SVG 积木
|
||||
|
||||
## 组件映射
|
||||
|
||||
依赖 `ely-gpui-component`(pin 2b8bd9f,gpui 为 crates.io 的 `gpui-pre` =0.3.8)。名字取自 `reference/Ely-GPUI-Components/src`。gpui 用法规则见该仓库 `AGENTS.md`。`tests/scripts/agents_md.py` 核对下表每个名字都是组件库公开项。
|
||||
依赖 `ely-gpui-component`(pin 90bd37b,gpui 为 crates.io 的 `gpui-pre` =0.3.8)。名字取自 `reference/Ely-GPUI-Components/src`。gpui 用法规则见该仓库 `AGENTS.md`。`tests/scripts/agents_md.py` 核对下表每个名字都是组件库公开项。
|
||||
|
||||
| 需要 | 用 |
|
||||
| --- | --- |
|
||||
@@ -170,6 +170,8 @@ tests/scripts/pdf-recovery.sh 真窗口 ElyPDF:加锁文件的封存恢复点
|
||||
tests/scripts/autosave.sh 真窗口 ElyDoc:自动保存开关、停手即写、外部改动不覆盖(需辅助功能权限)
|
||||
tests/scripts/print.sh 真窗口 ElyDoc:打印用文档自己的纸张,取消不动文档(需辅助功能权限)
|
||||
tests/scripts/show-fullscreen.sh 真窗口 ElyShow:F5 放映的窗口盖住整块屏幕(菜单栏与程序坞之上,需辅助功能权限)
|
||||
tests/scripts/dock-macos.sh dist 里 ElyDoc、ElyTable、ElyShow 与包外的 target/debug/ely-doc 各启动数次:LOK worker 从未登记为程序坞应用,图块照出
|
||||
tests/scripts/windows-installer.sh 假应用的安装程序:所选目录原有的文件经两次安装与卸载都在,旧版按注册表清理,文件被占用或程序在运行时什么也不改,写不进时放回旧版(缺 makensis 时 SKIP)
|
||||
tests/scripts/types.sh packaging/types.tsv 的文件类型在 Linux 桌面项、Windows 安装程序与 macOS 文档类型里一致,从不设为默认
|
||||
tests/scripts/layout.sh 真窗口:六个应用在 640、800、1100 宽下无元素越出窗口左右,留截图(需辅助功能与屏幕录制权限)
|
||||
tests/scripts/ooxml.py <用例> <文件> 不经 LibreOffice 读 DOCX、XLSX、PPTX 并按自算的预期核对(往返用例调用)
|
||||
@@ -225,7 +227,7 @@ cargo run -p ely-doc 启动一个应用(ElyDoc 先 cargo build -p ely
|
||||
- 2026-10-07:ElyTree 恢复与清理、外部工具、操作规则(C13.6,TREE-13、14,§13.3,QA-19、20)。仓库页第二行:在终端中打开(macOS `open -a Terminal`,其他平台报未构建)、在访达中显示(`reveal_path`)、清理未跟踪的文件…;页底“引用日志”列出 HEAD 最近 200 次移动(`reflog show -z`,位置、Git 写的原因、时间),选中即中间显示该提交(同提交详情,`Whose::Reflog`),上方“在此新建分支…”(找回删掉的分支)与“把当前分支移到此…”:有已暂存的改动即拒绝(`reset --keep` 会丢掉它们,请先提交或取消暂存);否则在后台算出离开该分支的提交,对话框写明分支、从哪到哪、离开的提交(引用日志仍可找回)与“工作区改动保留”,确认后 `reset --keep`(Git 在改动冲突时拒绝;没有任何按钮做硬重置),执行前在写队列里核对 HEAD 仍在预览时的分支(完整引用名,或仍游离)与提交、仍无暂存,任一变了即什么也不做。引用日志的时间是该次移动的时间(`--date=unix` 下的 `%gd`),不是提交时间;选中按事件本身(提交、原因、时间与它在全部引用日志中自最早起的序号,后者新移动不改,同一秒同原因的两次也分得开),同一提交的多条不会一起选中;之后有新的移动时该事件的位置后移,选中与详情跟着它,事件已不在引用日志里即不显示。清理:对话框先由 `git clean -n -d`(勾“包括被忽略的文件”另加 `-x`)得出 Git 会删除的路径(`core.quotePath=false`,其余 C 引号照 Git 规则还原),其中的文件夹当场展开为其中的文件(`ls-files --others`,同一忽略规则,另一仓库不入),对话框逐个列出文件与文件夹;确认后先逐段查每个所列路径:仍在仓库里、途中没有符号链接、文件仍是文件、文件夹仍是文件夹(任一变了即整体拒绝,什么也不删),再以 `git clean -f [-x] -- 所列文件` 删去(只给文件,Git 不递归;此后被跟踪了的文件 Git 留下,也不穿过链接),最后自深而浅删去所列文件夹中已空的(预览后在其中新出现的文件不动,文件夹随之留下),每次都问。文件标题栏多出“在编辑器中打开”(用户在“仓库›选择编辑器…”选的程序,存在数据目录 `tools.json`,字段类型不对与读不出同样报错且不覆盖;macOS 的 .app 经 `open -a`,在后台等它结束,失败即显示其原话;未选时先问)与 Markdown 的“在 ElyMark 中打开”(`ely_platform::apps::open`:按安装布局找同级的应用,macOS 的 `名称.app/Contents/MacOS`,Windows 的 `Ely Office\名称`,开发构建的同一目录;找不到即报错)。锁(§13.3):任何写操作因 Git 的锁文件失败(`….lock': File exists`,或配置文件的 `could not lock config file …: File exists`)时,对话框说明另一个 Git 正在工作、Ely 从不删除锁文件,“重试”把同一写操作重新排队。QA-19:测试都以独立的 Git 命令核对索引、提交、引用与工作区。QA-20:冲突、钩子失败、凭据被拒(本机 401 服务器,显示 Git 的 “terminal prompts disabled” 原话)、锁、变基中断后中止、取消(停止取回)都有窗口测试,结束时仓库状态以 Git 读回核对。切换到系统 Git 目前经 `ELY_GIT`(设置页随 C18.1)。真窗口(macOS):仓库页工具行、清理预览对话框、文件标题栏的编辑器与 ElyMark 按钮,按下后同级的 ely-mark 以该文件启动。未验证:Windows 与 Linux 的终端;ElyMark 打开文件的内容(C14)。
|
||||
- 2026-10-07:ElyTree 储藏、远程、工作树、子模块、LFS(C13.5,TREE-10 至 12,§13.3)。左栏第四页“仓库”:上方取回(`fetch --progress --all`)、拉取(`pull --progress`,照用户的 pull 设置)、推送、强制推送…;储藏(`stash list -z`,新的在前;“储藏改动…”问说明与是否包括未跟踪的文件,`stash push`),远程(名称与地址,`remote` 加 `config --get-regexp` 读出取回与推送地址),工作树(`worktree list --porcelain -z`,行名为文件夹名,有失效的可“清理”即 `worktree prune`),子模块(索引里的 gitlink 与文件夹自身 `.git` 的 HEAD:未检出、在记录的提交上、在别的提交上、冲突),LFS 文件(`git lfs ls-files --long --json`:工作树里是内容、对象在本机而工作树是指针、只有指针而对象不在本机);没有子模块或 LFS 文件时不列。各列表分别读出,一个读不出只在该处显示 Git 原话;切到此页时读,此后每次状态重读时重读,只取最新一次。选中一项,中间显示:储藏为提交详情的同一套(`hist::Picked`,历史与储藏共用读取与面板):改动的文件(对第一个父提交)与储藏的未跟踪文件(第三个父提交,各自对空树),选文件看差异,上方应用、弹出、删除…;远程为地址与推送地址,取回、修改…(改名 `remote rename`、改地址 `remote set-url`)、移除…(先问);工作树为路径与分支或提交、锁定与失效原因,打开(作为标签)、移除…(先问,主工作树与当前的不给);子模块为记录的与检出的提交,“检出记录的提交”(`submodule update --init`,经远程运行)与打开。用户输入的名称、地址、路径前一律加 `--`(推送的远程名同样)。表单与选择对话框(新建分支、标签、改名、身份、储藏、远程、工作树、选远程与上游)记下打开时的仓库,提交时写进那个仓库,不随当前标签变;储藏列表按每条三个字段读(说明可为空)。储藏的应用、弹出、删除按 `stash@{n}` 执行,执行前在写队列里核对它仍是所见的那个储藏(另有储藏插入即拒绝,什么也不做);弹出遇冲突时 Git 保留储藏,对话框显示 Git 原话。删除储藏、移除远程与工作树每次都问。分支页的本地分支多出“设置上游…”(列出远程分支,`branch --set-upstream-to=refs/remotes/名`)与“取消上游”。推送:有上游即 `push --progress`;没有上游时后台读出远程,问推到哪个远程(`push --set-upstream -- 远程 refs/heads/分支:refs/heads/分支`),没有远程或 HEAD 游离即说明。强制推送(§13.3):后台读出当前分支、上游的远程与远端分支、上次取回时远端的提交(租约)、此刻 HEAD 的提交(源)与远端有而源没有的提交,对话框写明远程、分支与将被覆盖的提交(或写明没有),确认后推送的就是所示的源提交(`push --force-with-lease=远端分支:租约提交 -- 远程 源提交:远端分支`),确认前本地分支再动也不改变推送内容;远端自上次取回后变了即被拒绝;没有上游或游离即说明不能。远程命令(取回、拉取、推送、子模块更新)是写队列里的一种(`Write::Remote`),经 `running::Running` 运行:Git 在自己的会话里(`setsid`,SSH 找不到终端,不会挂在终端提示上;凭据照用 credential helper 与 ssh-agent),进度逐行显示在中间上方的提示条,可停止(向整个进程组发 SIGTERM,Git 自行清理;已结束的不再发);用户停止时提示“已停止”、清掉其后的排队写,不当作失败;失败时对话框显示 Git 的 stdout 与 stderr(以回车结尾的进度行被下一行改写,只留最后一次;以换行结尾的行全部保留,钩子的每一行都在);拉取遇冲突照合并类命令判定为停下。关窗与退出时停下所有远程命令与克隆。克隆改用同一运行器。真窗口(macOS):仓库页五类列表、储藏详情与文件、工作树详情、分支行。未验证:Windows 与 Linux(停止远程命令在非 Unix 上报未构建);真实网络与 HTTPS、SSH 凭据;LFS 对象的下载(只显示状态)。
|
||||
- 2026-10-07(用户定):跟随组件库最新的 main。组件库 K01 把 gpui 从 zed 仓库的提交换成 crates.io 的 `gpui-pre` =0.3.8(`gpui-pre-platform` 同版本),K02 让 Tab 绑在 FocusScope 的 ElyFocus 上下文下、更深的上下文先得;本项目工作区的 `gpui`、`gpui_platform` 随之改为这两个包(以 `package =` 保留原名,源码不变),组件库 pin 到 dabc1eb(其上加本项目一个提交:树与树行的无障碍角色)。升级后全工作区编译无改动。
|
||||
- 2026-10-08:首版打包(R1.1)。图标(用户定:logo-design 技能出方案,选 C“实心几何”;macOS 标准 squircle,Linux 与 Windows 无底形,八个同一套设计):母版在 `assets/icons`(我按圆角矩形、圆与 30°/45° 斜线在 256 网格上画;每个颜色对白与 `#1E1E1E` 都不低于 3:1,ElyMark 原定的石板灰在深色上 1.75:1,改为琥珀 `#B87A00`;ElyTable 在 48 像素以下用简化的一版),`packaging/icons/build.sh` 以 AppKit 渲染出 icns(macOS)、512 像素 png(Linux 的 AppImage 与桌面文件)、16 至 256 像素 ico(Windows 安装程序、开始菜单快捷方式与卸载项);生成物入库,Linux 与 Windows 构建不需要 macOS。系统交给应用的文件:`ely_ui::run` 收下启动参数与 `on_open_urls`(访达的打开请求,启动前到达的也在内),应用先取 `launch_files`(有则不开空白文档;ElyMark 有则不恢复上次的标签),再以 `on_open` 处理运行中的请求;六个应用都走这一条(ElyDoc、ElyTable、ElyShow 原先不收启动参数)。macOS 包:LOK 应用只带内核,按 LibreOffice 自己的布局并入本应用:内核的库进 `Contents/Frameworks`(合并库构建留下的“invalid - merged lib”占位文件不拷,其余非代码文件即报错),内核的资料进 `Contents/Resources`,另有 `MacOS/ely-lok-worker`;`install_dir` 先找包内(`Frameworks/libmergedlo.dylib`)。不带 `LibreOffice.app` 本身:原先整份嵌入时,其快速查看与聚焦插件、`soffice` 等启动程序与文档类型被系统登记,系统设置里出现“LibreOffice 扩展”(用户发现;已注销本机七处登记);测试也不再运行 LibreOffice 应用(样本改为 `tests/fixtures/office` 的固定文件,运行开发构建的 `soffice` 会让系统重新登记它)。ElyPDF 带 `MacOS/ely-pdf-worker` 与 `Resources/tessdata`(三种语言),OCR 数据先找应用旁再找包内;ElyTree 带 `Resources/git`,其中每个 Mach-O 先签(Git 以 `INSTALL_SYMLINKS` 构建,内建命令是指向同一程序的相对链接;原先是硬链接,拷进包后变成约 150 份副本、689 MB;以 `MACOSX_DEPLOYMENT_TARGET=14.0` 构建,原先随本机 SDK 要求 macOS 27);ElyMark 用同级 ElyTree 包里的 Git。文档类型(`packaging/macos/documents.sh`)一律 `Alternate`,不抢系统默认:Doc 为 docx、odt、doc、rtf;Table 为 xlsx、ods、xls、csv、tsv;Show 为 pptx、odp、ppt;PDF;Markdown;Tree 为文件夹(查看者)。worker、内核、OCR 数据的所在路径都写日志,`tests/scripts/release-macos.sh` 据此核对都在包内。许可(§21.2、§21.3):每个包的 `Resources/Licenses` 有 Ely 的 AGPL 全文(仓库根 `LICENSE`)、`rust-crates.txt`(`packaging/crates.py`:本机目标下链进各二进制的全部 crate 与其许可文件,无许可文件的取 `packaging/licenses` 里该表达式的标准文本并写明作者,都没有即失败)与所带引擎的许可:LibreOffice 的 LICENSE、NOTICE、CREDITS;MuPDF 的 COPYING 与其编进去的每个第三方及每组内嵌字体(按构建实际嵌入的)的许可、OpenSSL、tessdata(Apache-2.0,按提交与散列取)、Great Vibes 的 OFL;Git 的 COPYING 与 LGPL-2.1、git-lfs 的 LICENSE.md(发布包里没有,按标签与散列取);ElyMark 带 RaTeX 嵌入的 KaTeX 字体的 OFL 与说明;缺任何一份即打包失败(`packaging/licenses.sh`)。`release.sh` 另出 `ElyOffice-<版本>-source.tar.gz`:自有源码、锁文件、上游补丁与构建脚本(上游各自钉在提交,取得方式即其中的 fetch 脚本)。ElyTable 同时收到多个文本文件(访达一次交来多份 CSV)时,读完的导入排队,没有对话框开着才逐个询问(原先后到的一份替换前一份,前一份静默丢失)。`packaging/macos/release.sh` 按 `apps.tsv` 的批次出各应用的 dmg;本机只有 Apple Development 证书,无 Developer ID,未公证。未验证:Intel 包(只建了 arm64)、公证、Linux 与 Windows 的包(本机不能建)。
|
||||
- 2026-10-08:首版打包(R1.1)。图标(用户定:logo-design 技能出方案,选 C“实心几何”;macOS 标准 squircle,Linux 与 Windows 无底形,八个同一套设计):母版在 `assets/icons`(我按圆角矩形、圆与 30°/45° 斜线在 256 网格上画;每个颜色对白与 `#1E1E1E` 都不低于 3:1,ElyMark 原定的石板灰在深色上 1.75:1,改为琥珀 `#B87A00`;ElyTable 在 48 像素以下用简化的一版),`packaging/icons/build.sh` 以 AppKit 渲染出 icns(macOS)、512 像素 png(Linux 的 AppImage 与桌面文件)、16 至 256 像素 ico(Windows 安装程序、开始菜单快捷方式与卸载项);生成物入库,Linux 与 Windows 构建不需要 macOS。系统交给应用的文件:`ely_ui::run` 收下启动参数与 `on_open_urls`(访达的打开请求,启动前到达的也在内),应用先取 `launch_files`(有则不开空白文档;ElyMark 有则不恢复上次的标签),再以 `on_open` 处理运行中的请求;六个应用都走这一条(ElyDoc、ElyTable、ElyShow 原先不收启动参数)。macOS 包:LOK 应用只带内核,按 LibreOffice 自己的布局并入本应用:内核的库进 `Contents/Frameworks`(合并库构建留下的“invalid - merged lib”占位文件不拷,其余非代码文件即报错),内核的资料进 `Contents/Resources`,另有 `MacOS/ely-lok-worker`;`install_dir` 先找包内(`Frameworks/libmergedlo.dylib`)。不带 `LibreOffice.app` 本身:原先整份嵌入时,其快速查看与聚焦插件、`soffice` 等启动程序与文档类型被系统登记,系统设置里出现“LibreOffice 扩展”(用户发现;已注销本机七处登记);测试也不再运行 LibreOffice 应用(样本改为 `tests/fixtures/office` 的固定文件,运行开发构建的 `soffice` 会让系统重新登记它)。ElyPDF 带 `MacOS/ely-pdf-worker` 与 `Resources/tessdata`(三种语言),OCR 数据先找应用旁再找包内;ElyTree 带 `Resources/git`,其中每个 Mach-O 先签(Git 以 `INSTALL_SYMLINKS` 构建,内建命令是指向同一程序的相对链接;原先是硬链接,拷进包后变成约 150 份副本、689 MB;以 `MACOSX_DEPLOYMENT_TARGET=14.0` 构建,原先随本机 SDK 要求 macOS 27);ElyMark 用同级 ElyTree 包里的 Git(2026-10-15 起 Windows 同此:`git::own` 先找本应用旁的,再按 `apps` 的同级查找与 macOS 的登记找 ElyTree 旁的,都没有即 `git::NoGit`,ElyMark 的 Git 项写明要装 ElyTree;Windows 的 ElyMark 原随带一份,用户问起后去掉。Linux 的 ElyMark 照带:AppImage 自成一体,找不到别的映像里的 Git,deb、rpm、Arch 包与它同一 AppDir,R6.6)。Windows 安装程序只动自己装下的:装好后写下所装的每个文件与文件夹(`.ely-installed`,由 `packaging/windows/files.sh` 按分装目录生成),升级与卸载只移去其中的文件,文件夹空了才删;清单之前的版本只在注册表记下的安装目录里按旧的通配名与其文件夹里的全部文件移去;先查每个文件能否写(运行中或被占用即不能,文件夹里的也查),再逐个挪进 `.ely-old`(按清单次序编号,备份路径不随原路径变长,近 260 字的路径照样升级与卸载),任一项挪不动即放回、什么也不改、退出码 2;卸载时清单本身也先查、删不掉即放回全部;新文件的位置已有不属于本应用的文件即拒绝、什么也不改、退出码 2;写到一半失败即删去本次写下的、放回旧版;升级后不留旧的 `git` 与 CEF 文件(R6.11,`tests/scripts/windows-installer.sh`)。文档类型(`packaging/macos/documents.sh`)一律 `Alternate`,不抢系统默认:Doc 为 docx、odt、doc、rtf;Table 为 xlsx、ods、xls、csv、tsv;Show 为 pptx、odp、ppt;PDF;Markdown;Tree 为文件夹(查看者)。worker、内核、OCR 数据的所在路径都写日志,`tests/scripts/release-macos.sh` 据此核对都在包内。许可(§21.2、§21.3):每个包的 `Resources/Licenses` 有 Ely 的 AGPL 全文(仓库根 `LICENSE`)、`rust-crates.txt`(`packaging/crates.py`:本机目标下链进各二进制的全部 crate 与其许可文件,无许可文件的取 `packaging/licenses` 里该表达式的标准文本并写明作者,都没有即失败)与所带引擎的许可:LibreOffice 的 LICENSE、NOTICE、CREDITS;MuPDF 的 COPYING 与其编进去的每个第三方及每组内嵌字体(按构建实际嵌入的)的许可、OpenSSL、tessdata(Apache-2.0,按提交与散列取)、Great Vibes 的 OFL;Git 的 COPYING 与 LGPL-2.1、git-lfs 的 LICENSE.md(发布包里没有,按标签与散列取);ElyMark 带 RaTeX 嵌入的 KaTeX 字体的 OFL 与说明;缺任何一份即打包失败(`packaging/licenses.sh`)。`release.sh` 另出 `ElyOffice-<版本>-source.tar.gz`:自有源码、锁文件、Line truncated
|
||||
- 2026-10-08(用户定):深色主题不用纯黑或近黑,底色取柔和的灰 `#252525`。组件库 fd0efc7:深色色板 bg `#252525`、surface `#2c2c2c`、sunken `#202020`、overlay `#323232`、hover `#383838`、active 与 border `#3f3f3f`、border_strong `#555555`;为让说明文字在较亮的 hover 与 active 上仍有 4.5:1,muted 提到 `#c4c2c0`、subtle 与代码注释提到 `#acaaa8`;色盲友好图表的紫与橙改为 `#9d8dec`、`#ffd93d`(3:1 且各色两两分得开)。`ely.xcd` 的深色方案随之:页面 `#2c2c2c`、页外 `#252525`、边界与网格 `#555555`、域底纹 `#3f3f3f`。跨应用同步外观、设置里的浅色/深色/跟随系统、Omarchy 下随 Omarchy 主题,本来已有(共用 `settings.json` 加文件监视;`settings.sh` 核对 ElyPDF 选深色后 ElyTree 即刻变深);Omarchy 的读法与 OmaPhoto 相同(`~/.local/state/omarchy/current/theme/colors.toml`、`mode` 与具名颜色)。
|
||||
- 2026-10-08:图像的显存与内存(C20.2 长时测试查出)。GPUI 把每张画过的 `RenderImage` 留在窗口的图集里,直到调 `window.drop_image`;LOK 的图块、PDF 的图块与缩略图、演示的缩略图、动画预览与放映图层原先都不释放,ElyDoc 编辑保存 60 轮后应用进程涨到约 2 GB(内核不涨)。组件库 `primitives::Retired`:不再画的图先交给它,下一次绘制时释放(`release` 只放别处已不持有的,`release_all` 给自知不再画的属主,`append` 接过关闭者的);LokView、PdfView 在替换、挤出、清空图块时交出旧图,绘制前释放;ElyShow 每个标签一份,关闭的标签与结束的预览交给 Deck;放映按窗口各一份(观众屏、演讲者视图),离场中的幻灯片还在画时其图层等它结束。修后同样 100 轮在 340 至 440 MB 之间起落。
|
||||
- 2026-10-08:性能基准(C20.1,§20.1)。`tests/perf/bench.py` 在发行构建上测 PERF-01 至 08(每项 30 次,P50、P95,含全部子进程的内存),样本由 `tests/perf/samples.py` 按固定种子生成到 `engines/bench`,记录写到 `docs/perf/<日期>-<机型>.md`(格式见其 README);`ELY_STALLS=1` 开主线程忙碌记录(只供测量,空闲的应用照样不做事)。实测改动:Doc、Table、Show 原先要等内核启动完(约 2.5 至 3.9 秒)才开窗口,ElyDoc 日常启动 P95 3.9 秒不达标;现 `Worker::launch` 只起进程,内核的版本与图块核对在第一个请求前做(`Worker::ready`,任何请求都先过它,未核对的 worker 收不到请求),`ely_office::start` 在后台核对并设作者名,失败即 `startup::fail`;窗口约 0.15 秒可操作,空白文档在内核首次载入后出现(中位约 2.7 秒,其中约 2.2 秒是内核首次载入文档)。启动参数改为按当前目录取绝对路径(原相对路径成了 `file://相对` 而打不开)。补丁 `0039-skia-macos-no-unused-font-manager.patch`:macOS Skia 首次画字时以全部系统字体再建一个无人使用的 `SkFontMgr`(约 370 个字体枚举加排序,主线程约 175 毫秒),新文档的第一个字与打开文档的首块带字图块因此迟到;去掉后 PERF-03 的 10 次对比 P95 由 2.6 秒降到 1.5 秒。PERF-02 的计时原以输入落地时的代际为基准,内核的作废事件先于落地回报到达时,该次编辑的图块不计,钟一直走到下一次按键(记下的是按键间隔约 250 毫秒);现按编辑的修订认定(`view/clock.rs`:修订不低于该编辑的批次所升的代际,其图块即为所求),实测中位 2 毫秒、P95 5 毫秒。PERF-08:关闭的标签原把其图块留在 GPUI 的图集里(每个文档约 20 MB 显存,40 次新建关闭后应用涨约 250 MB);`Engine::retire` 交出关闭视图的全部图像(LOK 图块、PDF 图块与缩略图、ElyMark 页面的画面),外壳在窗口的下一帧释放,修后 40 次在 454 至 462 MB 之间。历史首屏改为从按下“历史”计(原从进程启动计,含打开仓库)。R1 后基准更严:PERF-03、04 到视图收下的第一块图块(`lok: tile (x, y) shown`),其间有图块画失败即整次作废;DOCX 样本原以单独一段的分页符分页,内核只排出 60 余页(`Heading1` 段上的 `pageBreakBefore` 同样丢页),改为分页符放在标题段内,PERF-03 之前先核对恰为 100 页(视图记录页数);PERF-02 每键须有自己的计时,缺即失败;PERF-08 循环前记基线,记内核中的文档数(worker 每次载入关闭写 `N documents open`),文档数须回到基线,文件数自第一次之后不变(第一次打开模板对话框时进程一次性载入两个系统字体与两个 AppKit 本地化表)。worker 的启动核对失败后保持失败,此后一切请求被拒(原核对失败的状态与成功相同,第二次即放行)。空白文档就绪由约 2.5 秒降到约 1.0 秒,发生在本次重建内核之后,与 0039 无关(对比实测),原因未查明。
|
||||
@@ -283,7 +285,7 @@ cargo run -p ely-doc 启动一个应用(ElyDoc 先 cargo build -p ely
|
||||
- 2026-10-11:Linux 包的实测(L1.6)。本机(Omarchy,Hyprland 0.56)装上六个 Arch 包与六个 AppImage,`linux-installed.sh` 两种都过;deb、rpm、Arch 包在 Ubuntu 26.04、Fedora 44、Arch 容器里装上、全部 ELF 找得到库;deb 与 rpm 的六个应用在各自容器的 Xvfb 下画出窗口(`linux-distros.sh`)。截图按窗口(`grim -T` 加 Hyprland 的 `stableId`):按区域截时用户切换工作区或别的窗口盖住即截错。ElyMark 的文件监视略去读取后不会自激:重读前先比指纹(长度与修改时间),不打开文件。
|
||||
- 2026-10-11(用户定:替换 v0.1.3 的 Linux 包):v0.1.3 发布里原有的六个 AppImage(无头,打不开窗口)已删去,换成本机容器里建出的六个应用各四种包(共 24 个),出自 L1.7 的提交(晚于该标签);上传后逐个核对大小,ElyTree 的 AppImage 下载回来散列相同。`package.sh` 把每个 RUNPATH 按所在 ELF 解析(`$ORIGIN` 或 `${ORIGIN}` 开头,规范化后须在 AppDir 内),否则拒绝(如未修正的 cairo):CI 用的是别处建好的引擎,旧构建会在这里报错而不是带进包里。替换的 Linux 包对应的源码随之上传到同一发布(`source.sh`,文件名带构建提交号),发布说明写明 Linux 包出自哪个提交。
|
||||
- 2026-10-11:`ci.sh` 用 `ELY_SHARE` 时,CI 克隆里的 `engines`、`reference` 须是指向共享克隆的链接(Windows 为目录联接,不查);是本克隆自建的目录或指向别处即报错,不混用。`.gitignore` 的 `/engines`、`/reference` 不带斜杠,链接也被忽略(`source.sh` 要求工作区干净)。
|
||||
- 2026-10-11(用户定:ElyMark 不用 CEF,不用 Electron):ElyMark 改为原生。界面用组件库的 Markdown 组件(`documents::MarkdownEditor` 一族,缺的在组件库补并推到 Gitea),解析用 markdown-rs(`markdown` 1.0.0),公式用 RaTeX,Mermaid 用 mermaid-rs-renderer,PDF 用 MuPDF Story;CEF 随之删去,ElyMail 的正文也不用 CEF 与 Electron。进度在 `tasks/TASKS.md` 的 C14。组件库 fcad0ff 与 508cc55:`MarkdownRenderer`、`MarkdownEditor`、Markdown 着色、块范围与链接查找改读 markdown-rs 的语法树(GitHub 风格加公式),引用式链接与图片按定义解析,图片把所在段落分开,单行 `$$…$$` 为块公式,软换行(LF、CRLF、CR)读作空格,嵌套在引用与列表里的定义同样解析,强调与链接里的图片仍是图片(链接里的图片可按);`BlockEditor` 的导入导出不属 ElyMark,仍用 pulldown-cmark。markdown-rs 读嵌套图片时只留外层的说明。组件库 d5ecc5a:块公式经 `typography::Latex` 由 RaTeX 排出(字形为轮廓,按窗口缩放画),```` ```mermaid ```` 块经 `documents::Diagram` 由 mermaid-rs-renderer 画出(Mermaid 自己的深浅主题,底色与字色取 Ely 色板),都作为 gpui 资源在后台排版,RaTeX 或 Mermaid 对已解析的输入 panic 时显示为错误;`MarkdownRenderer::base` 给出文档所在文件夹,相对与 file 地址的图片从中读取并按自身大小、不超过栏宽显示,`data:` 地址解码,网络图片不载入(写明)。组件库 ab9a14c:每个公式、图与图片元素经 `primitives::held` 持有其资源,按资源计数持有者(8b9820b;画出的图存在共享的记录里,9036c92 起由最后离开的持有者释放,哪怕它自己还没收到图),最后一个持有者换了内容或离开窗口才从 gpui 资源缓存移除、在本帧之后从图集释放,共用同一内容的元素(含 gpui 缓存的视图)不受影响;公式按字形实际范围取画框,字形不被裁;公式失败显示原因、RaTeX 给的位置与原文,日志不含公式;`file:` 地址去掉查询与片段,`localhost` 为本机,Windows 上别的主机为共享路径,他处拒绝;Mermaid 的节点与饼图文字取 Ely 的前景色。组件库 2b6f551:`documents::MarkdownDocument` 是文件级的 Markdown 文档:全文与撤销在一个 `CodeEditor` 里(`CodeEditor::highlighter` 以 `markdown_highlights` 着色,无行号);可视以 gpui `list` 逐块画出文件的顶层块(链接定义、HTML、front matter 照原文显示,每个字节都在块里或块间),按下的块开成源码(`TextInput`),其键入即刻算作文档的文字,写回为一步撤销,上下键越过块边进入相邻块,Esc 写回;Cmd(他处 Ctrl)按下交给链接;预览只读;源码为编辑器本身;128 KiB 以内当场解析,更长的在后台解析,解析中按下块不打开(日志);新解析保留两端相同的块,滚动不跳。`CodeEditor` 的撤销历史最多留 64 MiB 文字,超出先丢最旧的步;`CodeEditor::reset` 换文字且撤销重新开始;`MarkdownMode` 加 `Preview`。组件库 fc181b4:一个插入点通用于各模式(编辑器的选区,写回的块移动它);`set_caret` 与 `set_top_line` 分别设插入点与视图,换模式保持顶行;按下的块在前一块写回后仍是所按的块(按偏移换算,结构变了即不开并记日志);块是 Tab 停靠点,Enter 或空格打开;预览不收按下、撤销与重做;撤销与重做每次记录、输入法组字、撤销、重做后都限在 64 MiB 内(先丢最旧的撤销,再丢最远的重做)。组件库 433c38f:只有对当下文字的解析才能打开块(解析的文字与编辑器相同),否则拒绝;要求的顶行在其文字解析后才落定:先到所在块,下一帧按块高的比例到块内位置,再有新的要求即接着放下一个;源码与列表之间切换保持顶行,可视与预览共用一个列表,切换不动滚动。组件库 abac8b4:顶行的要求带编号,迟到的帧回调只完成自己的那个;文字一换即按新文字重新放,放时按当下文字的行数夹住;`reveal` 是同样的要求(插入点设在该行,该行放到顶上),新文字解析后才落定。组件库 f59c9f7:文字超过读取上限(2 MiB)即丢掉旧的读取,大纲与块为空。ElyMark(C14.4):视图即一个 `MarkdownDocument`,文本即文件原文(BOM 与 CRLF 照 `text.rs` 存回),新建、打开、保存、另存、重命名经外壳照旧;视图在建成后的下一轮更新向外壳报一次载入(文档在 `new` 里当场解析,外壳此时还未订阅);文字超过 2 MiB 即只用源码并转去源码(随当前文字,不只看打开时);网页实现的查找替换、表格、附件、书写视图的应用、导出与打印Line truncated
|
||||
- 2026-10-11(用户定:ElyMark 不用 CEF,不用 Electron):ElyMark 改为原生。界面用组件库的 Markdown 组件(`documents::MarkdownEditor` 一族,缺的在组件库补并推到 Gitea),解析用 markdown-rs(`markdown` 1.0.0),公式用 RaTeX,Mermaid 用 mermaid-rs-renderer,PDF 用 MuPDF Story;CEF 随之删去,ElyMail 的正文也不用 CEF 与 Electron。进度在 `tasks/TASKS.md` 的 C14。组件库 fcad0ff 与 508cc55:`MarkdownRenderer`、`MarkdownEditor`、Markdown 着色、块范围与链接查找改读 markdown-rs 的语法树(GitHub 风格加公式),引用式链接与图片按定义解析,图片把所在段落分开,单行 `$$…$$` 为块公式,软换行(LF、CRLF、CR)读作空格(2026-10-15 起屏上读作换行,见下),嵌套在引用与列表里的定义同样解析,强调与链接里的图片仍是图片(链接里的图片可按);`BlockEditor` 的导入导出不属 ElyMark,仍用 pulldown-cmark。markdown-rs 读嵌套图片时只留外层的说明。组件库 d5ecc5a:块公式经 `typography::Latex` 由 RaTeX 排出(字形为轮廓,按窗口缩放画),```` ```mermaid ```` 块经 `documents::Diagram` 由 mermaid-rs-renderer 画出(Mermaid 自己的深浅主题,底色与字色取 Ely 色板),都作为 gpui 资源在后台排版,RaTeX 或 Mermaid 对已解析的输入 panic 时显示为错误;`MarkdownRenderer::base` 给出文档所在文件夹,相对与 file 地址的图片从中读取并按自身大小、不超过栏宽显示,`data:` 地址解码,网络图片不载入(写明)。组件库 ab9a14c:每个公式、图与图片元素经 `primitives::held` 持有其资源,按资源计数持有者(8b9820b;画出的图存在共享的记录里,9036c92 起由最后离开的持有者释放,哪怕它自己还没收到图),最后一个持有者换了内容或离开窗口才从 gpui 资源缓存移除、在本帧之后从图集释放,共用同一内容的元素(含 gpui 缓存的视图)不受影响;公式按字形实际范围取画框,字形不被裁;公式失败显示原因、RaTeX 给的位置与原文,日志不含公式;`file:` 地址去掉查询与片段,`localhost` 为本机,Windows 上别的主机为共享路径,他处拒绝;Mermaid 的节点与饼图文字取 Ely 的前景色。组件库 2b6f551:`documents::MarkdownDocument` 是文件级的 Markdown 文档:全文与撤销在一个 `CodeEditor` 里(`CodeEditor::highlighter` 以 `markdown_highlights` 着色,无行号);可视以 gpui `list` 逐块画出文件的顶层块(链接定义、HTML、front matter 照原文显示,每个字节都在块里或块间),按下的块开成源码(`TextInput`),其键入即刻算作文档的文字,写回为一步撤销,上下键越过块边进入相邻块,Esc 写回;Cmd(他处 Ctrl)按下交给链接;预览只读;源码为编辑器本身;128 KiB 以内当场解析,更长的在后台解析,解析中按下块不打开(日志);新解析保留两端相同的块,滚动不跳。`CodeEditor` 的撤销历史最多留 64 MiB 文字,超出先丢最旧的步;`CodeEditor::reset` 换文字且撤销重新开始;`MarkdownMode` 加 `Preview`。组件库 fc181b4:一个插入点通用于各模式(编辑器的选区,写回的块移动它);`set_caret` 与 `set_top_line` 分别设插入点与视图,换模式保持顶行;按下的块在前一块写回后仍是所按的块(按偏移换算,结构变了即不开并记日志);块是 Tab 停靠点,Enter 或空格打开;预览不收按下、撤销与重做;撤销与重做每次记录、输入法组字、撤销、重做后都限在 64 MiB 内(先丢最旧的撤销,再丢最远的重做)。组件库 433c38f:只有对当下文字的解析才能打开块(解析的文字与编辑器相同),否则拒绝;要求的顶行在其文字解析后才落定:先到所在块,下一帧按块高的比例到块内位置,再有新的要求即接着放下一个;源码与列表之间切换保持顶行,可视与预览共用一个列表,切换不动滚动。组件库 abac8b4:顶行的要求带编号,迟到的帧回调只完成自己的那个;文字一换即按新文字重新放,放时按当下文字的行数夹住;`reveal` 是同样的要求(插入点设在该行,该行放到顶上),新文字解析后才落定。组件库 f59c9f7:文字超过读取上限(2 MiB)即丢掉旧的读取,大纲与块为空。ElyMark(C14.4):视图即一个 `MarkdownDocument`,文本即文件原文(BOM 与 CRLF 照 `text.rs` 存回),新建、打开、保存、另存、重命名经外壳照旧;视图在建成后的下一轮更新向外壳报一次载入(文档在 `new` 里当场解析,外壳此时还未订阅);文字超过 2 MiB 即只用源码并转去源码(随当前文字,不只看打开时);网页实现的查找替换、表格、Line truncated
|
||||
- 2026-10-12(用户报:Windows 上 ElyMark 的最近列表显示 `\\?\C:\…`):凡取真实路径一律 `dunce::canonicalize`(ely-files 的会话登记、ely-lok 的内核目录与配置目录、ElyMark 的文件夹、最近列表、会话与标签比对;ElyTree 原已如此):Windows 上能写成普通路径即普通路径,他处同 `std::fs::canonicalize`。只供读写的路径照旧保留 `\\?\`(`ely_files::save` 的落盘与同文件判定:在 250 字的文件夹里,普通写法的暂存文件名越过 260 而写不进),保存后交给会话与 `Saved` 的路径以 `dunce::simplified` 整体判定后为普通写法;ely-office 另存的目标先以完整路径求出,再以 `dunce::simplified` 整体判定能否写成普通路径(先简化文件夹再接文件名时,结尾带空格的名字会被 Windows 削成另一个已打开的文件)。`ely_files::recent` 读入时以 `dunce::simplified` 去掉旧版写下的 `\\?\` 并去重,下次写入即为普通路径。
|
||||
- 2026-10-12(用户报:ElyTable 的网格上一直是文字指针):`LokView` 原把指针写死为文字指针。现不按键的鼠标移动也交内核(悬停,不算编辑、不加修订),内核以 `LOK_CALLBACK_MOUSE_POINTER` 回报 CSS 指针名(`vcl` 的 `gaLOKPointerMap`),随事件批次到视图,换成 gpui 的指针:单元格上为箭头,编辑单元格或文字时为文字指针,链接为手;未知的名字记警告并用箭头。
|
||||
- 2026-10-13(用户定):ElyMark 以 Typora 1.14.10 为对照(R4;安装包与解包放在 `TyporaRef`,不入库):可视模式仍是按下的块以原文编辑;语法照 Typora 默认(`:表情:`、行内与块级 HTML 的常用标签、GitHub 提示块、`[toc]`、front matter 框;`==`、`^`、单个 `~` 照 GFM);快捷键照 Typora(Ctrl+1–6 标题、Ctrl+0 段落、Ctrl+/ 源码、Ctrl+Shift+=/-/0 字号、F8 专注、F9 打字机);右键菜单照 Typora 的布局,剪贴板与格式为图标行(组件库 `Menu` 新增)。Typora 与 GitHub 读同一份文件不同时随 GitHub(GFM,§14.3):表情名取 GitHub 现行的 gemoji(`emojis` 库,`:cricket:` 为蟋蟀),转义与字符引用之后照样是表情,自动链接与 `<code>` 里不是,同一 DOM 文字节点里第一个 `:名:` 前为空白或空格才全部转、否则全不转(`x:smile: :smile:` 原样,过滤标签不分节点),HTML 标签与强调交叉时照浏览器修复 CommonMark 输出,`</br>` 照 HTML5 也是换行,GFM 标签过滤的九种(`script`、`style` 等)照原文显示,提示块的标记读解析后的纯文字;Typora 只决定哪些扩展显示。导出、纯文本与富文本复制经组件 `MarkdownReader` 照可视读每个段落、标题、单元格与 HTML 块(各自一套新栈,块尾关闭未闭合的标签):脚注在原处、写作 `[号]`,链接不带标题(可视不显示),取代 C14.14 的页末脚注与 HTML 一律转义。审查改用 gpt-6-astra,effort max,fast。
|
||||
@@ -295,4 +297,12 @@ cargo run -p ely-doc 启动一个应用(ElyDoc 先 cargo build -p ely
|
||||
- 2026-10-14:ElyMark 的菜单与快捷键(R4.9,MARK-15)。项与键取自 Typora 1.14.10 主进程字节码的字符串表(`.work/typora-main-menus.txt`)与其 `zh-Hans.lproj/Menu.json`;实际大小在字节码里有 Ctrl+Shift+9 与 Ctrl+Shift+0 两串,照用户所定用 Ctrl+Shift+0;R4.11 真窗口查出 Windows 的中文输入法把 Ctrl+Shift+0 留作热键(注册表 `HKCU\Control Panel\Input Method\Hot Keys\00000104`),应用收不到,Windows 另绑 Ctrl+Shift+9(菜单显示它)。表格是“段落”的子菜单(照 Typora),顶层不再有“表格”。原 Ctrl+1/2/3 切模式、Ctrl+=/-/0 字号、Ctrl+Shift+F 专注让给 Typora 的键;可视、源码、预览留在“视图”菜单,无键。Ctrl+/ 另绑在 `ElyEditor` 上(gpui 同深度后绑者胜),盖过代码编辑器的 `//` 注释切换(Markdown 没有这种注释);`MarkdownDocument` 的键上下文只在可视模式有。带 Shift 的标点与数字一律写所出的字符(`secondary-{`、`secondary-+`、`alt-%`):三端的 gpui 都把 Shift 加该键报成字符并去掉 Shift(Windows 见 `gpui-pre-windows` 的 `get_keystroke_key`);R4.9 原在 Windows 写键名,真键盘按不出(R4.11 真窗口查出)。Ctrl+Enter 在打开的块里原是输入框的 Submit(文档不处理),改绑为下方插入行。拒绝一律成信息提示:当场的由 `Desk::edit` 说,后台读出的经 `DocumentEvent::EditRefused`、`view::Refused` 到宿主。菜单打开时,打开的块把焦点借给菜单,块与选区都留着,菜单命令照样作用于所选(组件 6d90351)。复制为 Markdown 与粘贴为纯文本只作用于文档:焦点在文档外的输入框(查找框、对话框)时交给该框自己的复制、粘贴。表格子菜单末项为删除表格(组件 `TableEdit::Delete`,一步撤销,插入点不在表格里即拒绝;在打开的块里删除后焦点回到文档,撤销键照用,组件 6c2d28c)。Typora 有而组件库暂缺的不进菜单:行内公式、上下标、注释、提示块子菜单、任务状态、列表缩进 Ctrl+[/]、代码工具。
|
||||
- 2026-10-14:ElyMark 的右键菜单(R4.10)。项、次序与显隐规则取自 Typora 1.14.10 的 `resources/window.html`(`#context-menu` 与其子菜单)与 `frame.js` 的显隐函数,记在 `.work/R4.10/typora-context-menu.txt`。菜单在 `view/menu.rs`,`MarkView` 自持(`ely_office::menu::Offer` 与 `ContextMenu::manual`):可视模式由组件的 `DocumentEvent::Pointed` 开在指针处,源码与预览由视图自己的右键开。剪切、复制、粘贴、删除所选范围为图标行,按下即把其键交回菜单打开前的焦点(`dispatch_keystroke`),与键盘同一路径;无选区时剪切、复制、删除灰显。其余项经各自的动作,显示所绑的键。组件 013f142、1b5fb07:文本框与代码编辑器右键落在选区里时保留选区,否则把插入点移到所点处;可视模式打开的块右键不写回、不关闭,目标在后台按全文读出(块外的引用定义照样解析);`MarkdownDocument::delete_image`(删除图片,一步撤销,无图片即 `EditRefusal::NoImage`);可视无块时 Ctrl+V 粘贴文字(原只收图片,文字被丢弃)。复制为 HTML 代码的图片照原地址(`Pictures::Written`,同 Typora),复制为富文本照旧内嵌。“编辑”菜单的复制项照 Typora 次序:纯文本、Markdown、HTML 代码、富文本。Typora 有而不做的:缩进与减少缩进行(可视只在打开的块里有)、复制表格、代码自动缩进、图片上传、缩放、移动与语法切换、拼写、表情复制、检查元素。gpui 的测试只发按下,菜单在 Enter 松开时选中,测试另发松开(`blocks/context.rs` 的 `choose`)。第 1 轮后:右键的目标按所点的字节读(组件 79e94f7),保留的选区只供剪贴板,删除图片删所点的那张;三种“复制为”在后台转换,界面线程只写剪贴板,新的复制取代未完成的旧复制(`Desk::copying`);`ely_office::menu::Offer` 只在首次绘制时把请求交给宿主(宿主按元素存的“已开”记录随标签切走而丢,切回会重开),ElyDoc、ElyTable、ElyShow 同受其益。第 2 轮后:转换完成时剪贴板已不是开始时的内容(此后有任何复制,含编辑器自己的 Ctrl+C)即丢弃这次结果,同内容的再次写入分不出;打开的块里只认最后一次右键(组件 2b8bd9f),所点字节对回所画字节的读法逐段只对齐一次(原逐字重读,8000 字的段落要近 2 秒)。第 3 轮后:剪贴板的比对另含其 HTML(gpui 读剪贴板不含 HTML,纯文字相同而富文本不同的后来复制原被盖掉;`ely_platform::clipboard::html`);组件的计时测试改用 `web_time::Instant`(组件 e07fd34)。
|
||||
- 2026-10-14(用户报:整个软件中文显示问题很多):中文显示(R4.13)。Windows 上 gpui 以用户区域(本机为 en-US)排版全部文字,DirectWrite 按日文为汉字选回退字体,日文字体缺的简体字再落到另一字体,同一个词里字形与粗细不一(ElyTree 的“打开仓库”:“打开”粗、“仓库”细)。`vendor/gpui-pre-windows` 的 `text_locale`:用户区域不是中日韩时,改用 Windows 语言列表(WinRT `GlobalizationPreferences::Languages`,Win32 的界面语言只给 en-US)里第一个中日韩语言排版(日志 `text: laid out as …`);在 Windows 上打中文须把中文加进该列表,所以它就是用户读的汉字。只换排版的区域,字体族名与字体列表仍按用户区域。读不出语言列表即记警告、照用户区域。Ely 的界面语言是中文时(设置或 `ELY_LOCALE`),`ely_ui::i18n::install_as` 经 `gpui_windows::set_text_language` 让排版随它,不论 Windows 区域(日文区域下“打开仓库”原为 Yu Gothic UI 600 与 Microsoft JhengHei UI 700 两种字);语言下次启动生效,故启动时设一次。组件库 6df9ab0:Ely 用到的组件里写死的英文(下拉的“Choose…”、清除、关闭、移除、取消固定的提示,公式补全的“No suggestions”,设置里字号的重置提示与示例句)改走内建中英目录。a4bf696:查找框(计数、三个选项与上下一处的提示、替换与全部替换)、排序与筛选(添加规则、满足全部或任一、条件、升降序、添加排序)、密码框的显示与隐藏提示同此;筛选条件以目录键为值(`Test::key`);ElyMark 的删除图片按右键所点的字节(`delete_image(at)`)。仍为英文的是内核的文字(LibreOffice 界面语言固定英文:幻灯片占位“Click to add Title”、母版“Default”、配色名、数字格式代码“General”、函数名),以及启动失败对话框(出现在读入语言之前,中英并列)。
|
||||
- 2026-10-14(用户定:dmg 不再显示未公证):macOS 发布以 Developer ID Application 证书签名、经 `notarytool` 公证并钉票。证书与公证凭据(`xcrun notarytool store-credentials`,App 专用密码只在钥匙串里)装在构建用的 Mac 上;发布流程的 macOS 任务从仓库变量 `ELY_SIGN_IDENTITY`(证书全名)与 `ELY_NOTARY_PROFILE`(凭据名)取得,`ci.sh` 在 macOS 上缺任一即失败,不出未公证的包。本机手动出包同样设这两个变量再跑 `packaging/macos/release.sh`。
|
||||
- 2026-10-14(用户定:dmg 不再显示未公证):macOS 发布以 Developer ID Application 证书签名、经 `notarytool` 公证并钉票。证书与公证凭据(`xcrun notarytool store-credentials`,App 专用密码只在钥匙串里)装在构建用的 Mac 上;发布流程的 macOS 任务从仓库变量 `ELY_SIGN_IDENTITY`(证书全名)与 `ELY_NOTARY_PROFILE`(凭据名)取得,`ci.sh` 在 macOS 上缺任一即失败,不出未公证的包。本机手动出包同样设这两个变量再跑 `packaging/macos/release.sh`。强化运行时下 LibreOffice 的 UNO 桥以 `MAP_JIT` 映射虚表,`ely-lok-worker` 须带 `com.apple.security.cs.allow-jit`(`packaging/macos/lok-worker.entitlements`,同 LibreOffice 自己的 `hardened_runtime.xcent`;其余几项不需要,实测);0.1.5 首发的三个 LOK 应用缺它,worker 在首个请求时中止(R6.5)。
|
||||
- 2026-10-15(用户报:ElyMark 点表格整个表格变成源码,应在格内编辑;用户定:格内显示该格原文):表格单元格编辑(R6.1)。组件库 2594b3f:可视模式按下表格只打开所按的那一格,在格内原位以单行输入框显示该格的 Markdown 原文(`**粗体**` 带记号),表格其余照常画出;按在格内文字上即落在所按的字,按在格内空白落在格末;以表格边缘、键盘或上下键从邻块进入的表格块打开其首格或末格;Tab、Shift+Tab 到下一格、上一格(跨行),上下键到上下一格,越出表格即到邻块;回车与 Esc 写回,写回为一步撤销;格内键入的 `|` 写回时转义为 `\|`(表格编辑读到的也是转义后的文字);格开着时做表格编辑(插删行列、整理等)先写回该格再执行,格随之关闭。列表、引用里的表格同此。表格绘制移入组件 `render/table.rs`,按格的空白处也带出所按的格(`Place::Cell`)。第 1 轮后(组件库 6a3f348):开着的格里的按下只给其输入框,插入点落在所按处、仍是一步撤销;格末单数的反斜杠写回时补成一对,不吞下一格的竖线;查找在可视模式里打开匹配所在的格并选中,跨格的匹配转到其行;格开着时右键所按的字节随格内键入的竖线换算;在未开的格的空白处右键,目标为该格末尾。第 2 轮后(组件库 2b6bd1d):格末的反斜杠只在紧接竖线时补成一对(`| a\ |` 的反斜杠后是空格,原样写回,只打开不键入不改一个字节);改首格后仍认得所在表格(无外侧竖线的表格首格始于块首,原被当作写掉了块),Tab 与按邻格照常;开着的格的空白处左键把插入点移到格末、右键以格末为目标,都不写回,仍是一步撤销。第 3 轮后(组件库 f1771b3,最后一轮,修完不再审查):无外侧竖线的行里清空首格或末格时写回一个竖线(`| | beta`、`alpha | |`),列数不变;插入点照写回的转义文字报出(键入竖线后不再落在多字节字中间);改过一格后右键邻格照常给出目标;长文(后台解析)里改格后 Tab 等到解析完成再打开下一格。
|
||||
- 2026-10-15(用户报:二级菜单选不到,往子菜单移动时经过下面的项会弹出它们的子菜单,七个应用都如此;用户定照桌面系统的悬停意图做:安全三角加打开与关闭的延时):级联菜单(R6.2,组件库 d4fdb69,`ContextMenu`、`DropdownMenu`、`MenuBar` 共用的面板)。菜单面板挡住其下的元素(原先子菜单被挤回、盖在父菜单上时,被盖住的父菜单行照收悬停);子菜单右侧放不下且左侧放得下即开在所在行的左侧,从右滑入,不盖父菜单的行(两侧都放不下时贴窗口边,仍被面板挡住);指针停在有子菜单的行上 150 毫秒才打开;子菜单开着时,指针落在“上一位置与子菜单近侧上下两角”构成的三角形里的另一行,等 300 毫秒,指针仍在该行才切换,其间到达子菜单即作废;三角形外的行即刻标记。键盘与按下照旧即刻打开。实现在组件 `menus::aim`。第 1 轮后(组件库 5a53c08):指针离开一行(到边距、分隔线、禁用的行或菜单外)即作废其延时,回到该行重新计时;菜单在别处重开即忘掉旧的悬停;图标按钮行同样受三角形保护。
|
||||
- 2026-10-15(用户报:ElyMark 的最近列表清不掉):侧栏“清除最近文件”(R6.3,98692cb)写空 `recent.json`(`ely_files::recent::clear`),失败即提示。会话恢复的标签不把文件加回列表(`Desk::remembered` 预先记下),清空在重启后照旧;显式打开照样加入,已开着的文件(按文件身份,含硬链接,`Sessions::is_open`)只切到该标签,也加入列表。
|
||||
- 2026-10-15(用户报:ElyMark 代码块后的“你好↵测试”离开输入框后成了“你好 测试”):单个换行照 Typora 的默认(编辑时保留,导出与打印不保留):组件库 93efa7f 起 `MarkdownReader::new`(屏上:可视、预览、右键与命令的读法)把软换行读作换行,`MarkdownReader::joined`(输出)照 GFM 读作空格;标题的大纲与目录文字照旧一行。ElyMark 的 HTML、PDF、富文本复制与纯文本导出用 `joined`(R6.7)。组件库 c31d092 与 26af4be:画出成一个换行的 CRLF 对回其起点(原先按在 CRLF 行末键入落在 CR 与 LF 之间),行内代码照留两字则逐字对回。
|
||||
- 2026-10-15(用户报:ElyMark 源码模式“测”后的插入点画在“测”的中间):组件库 `CodeEditor` 原按“列 × m 的宽”放插入点、选区、按下处与输入法框,中日韩字与表情约宽两格。组件库 9fb607b 起按 gpui 排好的这一行定位(`editor::measure`,含着色带来的字重),块状与下划线插入点取所在字的宽;标尺与缩进参考线仍按列(R6.8)。上下移动仍按字数记目标列。cd61653:按下处取最近的字首或行末(gpui 的 `closest_index_for_x` 越过末字字首即给行末);上次绘制得出的括号与配对位置只属当时的文字(`Buffer` 每次改动换一个戳),输入法改字后、下次绘制前的测量不用它们(原先把新字切进不同字体段,DirectWrite 崩溃)。
|
||||
- 2026-10-15(用户报:ElyMark 三、四级标题不显眼):组件库 5954132 起标题字号随正文按 Typora 的倍数(一至六级 2.25、1.75、1.5、1.25、1、1),一律加粗,六级为次要色,行高为字号的 1.3 倍(原为固定的 24、20、16、14 像素,正文 13,三、四级只是中等字重)(R6.9)。90bd37b:粗体与标题同一字重(原粗体为半粗,标题里的粗体反而更细,正文粗体随之由半粗改为粗,同 Typora);标题行高按自身字号取 1.3 倍。Windows 真窗口核对(`.work/r69`):可视模式各级标题分明、“你好↵测试”两行,源码模式“测”后的插入点落在两字之间。
|
||||
- 2026-10-15(用户报:macOS 打开一个文档,程序坞里有两个同样的图标):LOK worker 在应用包的 `Contents/MacOS` 里启动 AppKit,系统按包的 Info.plist 把它也登记为常规应用(`lsappinfo` 里应用与 worker 都是 Foreground),程序坞多一个图标;内核自己从不设激活策略。worker 在内核启动 AppKit 之前(`Lok::hook` 打开内核之后、调钩子之前)把本进程主包信息里的 `LSUIElement` 设为真,AppKit 登记时即为辅助应用(无程序坞图标、无菜单栏,仍可建屏外窗口);钩子之后核对激活策略是辅助,不是即报错、不启动(`ffi/accessory.rs`);包外的 worker(`cargo run`、单测)无包可登记,策略为禁止,此时改设辅助(R6.12 第 2 轮)。原先在登记之后才改策略,审查实测 15 次启动有 11 次先登记为 Foreground 约 30 毫秒(R6.12 第 1 轮)。`tests/scripts/dock-macos.sh` 连续启动三个应用与包外的开发构建,从 worker 启动起采样其类型到首块图块,见 Foreground 即失败(R6.12)。
|
||||
- 2026-10-15(用户报:ElyShow 编辑区滚轮与上下键不换页,三端):内核在未选中对象时把上下键当作滚动窗口(`fupoor.cxx`),Ely 的画布整页适合、无处可滚,滚轮同样。`LokView::turn_parts`(ElyShow 首次适合时调用)之后:整页可见时滚轮换页(`view/turn.rs`):滚轮的行按本平台每格的行数(`ely_lok::notch`:macOS 1,Windows 取系统设置,X11 与 Wayland 为 3)折成格,整格的行每格一页(快速连滚与一次多格都照格数);一串行里出现不足一格的(X11、Windows 的触控板)即为平滑滚动,此后到停顿前不再换页,像素(macOS、Wayland 的触控板)同按手势:一次手势换一页(满一格或 50 像素),惯性不算;有起止的手势(macOS)只到结束才算完,没有起止的停 200 毫秒即为下一次。X11 的滚轮与触控板同为行、gpui 不分,以整格开头的触控板滑动在出现小数之前会按格换页(已知限制)。未选中对象、未编辑文字时上下键换页。换页一律经有序输入队列交 worker(`TURN`):worker 按之前各输入回报后的状态判定,有选区、选中对象或插入点即把方向键照常交内核,否则当场切页(到首末页即停,同缩略图条的 `setPart`),视图在落地时换上 worker 所示的页,其后排队的键与点按都落在新页上(Tab 后紧接的 Down 移动所选对象;Down、Tab、Down 是换页后在新页上选中并移动);ElyShow 后台读回的当前页只在视图已无待落地输入时采用(R6.13)。
|
||||
@@ -227,7 +227,12 @@ pub(crate) fn open_in(
|
||||
// Launch files stand alone; unsaved text still returns.
|
||||
if asked.is_empty() {
|
||||
for path in kept {
|
||||
// A restored tab does not rejoin the recent list.
|
||||
let (id, real) = (desk.core.next, dunce::canonicalize(&path).ok());
|
||||
desk.open_path(path, cx);
|
||||
if let Some(real) = real.filter(|_| desk.core.next > id) {
|
||||
desk.remembered.insert(id, real);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (at, name) in desk.keeping.untitled() {
|
||||
|
||||
@@ -82,6 +82,26 @@ fn a_file_opens_with_its_outline_and_joins_the_recent_list(cx: &mut TestAppConte
|
||||
assert!(!kept.contains(r"\\\\?\\"), "plain paths only: {kept}");
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn the_recent_list_clears_from_its_button(cx: &mut TestAppContext) {
|
||||
let (data, files) = (
|
||||
tempfile::tempdir().expect("data"),
|
||||
tempfile::tempdir().expect("files"),
|
||||
);
|
||||
let path = files.path().join("a.md");
|
||||
std::fs::write(&path, "Text.\n").expect("a file");
|
||||
let (desk, cx) = start(cx, data.path());
|
||||
open(&desk, &path, cx);
|
||||
assert!(desk.read_with(cx, |desk, _| !desk.recent.is_empty()));
|
||||
let button = cx.debug_bounds("mark-clear-recent").expect("the button");
|
||||
cx.simulate_click(button.center(), gpui::Modifiers::none());
|
||||
cx.run_until_parked();
|
||||
assert!(desk.read_with(cx, |desk, _| desk.recent.is_empty()));
|
||||
let kept = std::fs::read_to_string(data.path().join("recent.json")).expect("the list");
|
||||
assert_eq!(kept, "[]");
|
||||
assert!(cx.debug_bounds("mark-clear-recent").is_none(), "nothing left to clear");
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn the_outline_follows_typing(cx: &mut TestAppContext) {
|
||||
let (data, files) = (
|
||||
|
||||
@@ -28,7 +28,7 @@ pub(super) fn write(
|
||||
placed,
|
||||
page,
|
||||
source,
|
||||
reader: MarkdownReader::new(source, tree),
|
||||
reader: MarkdownReader::joined(source, tree),
|
||||
anchored: HashSet::new(),
|
||||
};
|
||||
writer.root(tree)
|
||||
|
||||
@@ -11,7 +11,7 @@ use markdown::mdast::Node;
|
||||
pub fn plain(text: &str) -> io::Result<String> {
|
||||
let tree = markdown::to_mdast(text, &markdown_options())
|
||||
.map_err(|error| io::Error::other(error.to_string()))?;
|
||||
let reader = MarkdownReader::new(text, &tree);
|
||||
let reader = MarkdownReader::joined(text, &tree);
|
||||
let mut blocks = Vec::new();
|
||||
// Alerts and `[toc]` live only at the root.
|
||||
for child in tree.children().into_iter().flatten() {
|
||||
|
||||
@@ -230,3 +230,10 @@ fn a_copied_fragment_carries_its_look() {
|
||||
"the look needs no page style: {page}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_soft_break_joins_in_exports_as_typora_exports_it() {
|
||||
let page = html("你好\n测试 \nend\n");
|
||||
assert!(page.contains("<p>你好 测试<br>end</p>"), "{page}");
|
||||
assert_eq!(text("你好\n测试\n"), "你好 测试\n");
|
||||
}
|
||||
@@ -13,9 +13,14 @@ use crate::folder::{Folder, markdown_under};
|
||||
impl Desk {
|
||||
/// A folder lists beside; a file opens in a tab.
|
||||
pub fn open_path(&mut self, path: PathBuf, cx: &mut Context<Self>) {
|
||||
match path.is_dir() {
|
||||
true => self.open_folder(path, cx),
|
||||
false => self.open_file(path, cx),
|
||||
if path.is_dir() {
|
||||
return self.open_folder(path, cx);
|
||||
}
|
||||
// A shown file only takes focus; the list still learns.
|
||||
let shown = self.core.sessions.is_open(&path).unwrap_or(false);
|
||||
self.open_file(path.clone(), cx);
|
||||
if shown {
|
||||
self.remember(&path, cx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,6 +113,22 @@ impl Desk {
|
||||
}
|
||||
}
|
||||
|
||||
/// Empties the recent list.
|
||||
pub fn clear_recent(&mut self, cx: &mut Context<Self>) {
|
||||
match ely_files::recent::clear(&self.recent_file) {
|
||||
Ok(()) => {
|
||||
log::info!("mark: the recent list is cleared");
|
||||
self.recent.clear();
|
||||
cx.notify();
|
||||
}
|
||||
Err(error) => {
|
||||
log::error!("mark: the recent list did not clear: {error}");
|
||||
let said = text(cx, "office.error.engine", &[("error", &error.to_string())]);
|
||||
self.toast(said, Severity::Danger, cx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Line and column `at` in a tab or file.
|
||||
pub fn open_at(
|
||||
&mut self,
|
||||
|
||||
@@ -441,4 +441,50 @@ mod window {
|
||||
"the session"
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn a_cleared_recent_list_stays_cleared_with_tabs_restored(
|
||||
first: &mut TestAppContext,
|
||||
second: &mut TestAppContext,
|
||||
) {
|
||||
let (data, files) = (
|
||||
tempfile::tempdir().expect("data"),
|
||||
tempfile::tempdir().expect("files"),
|
||||
);
|
||||
let (a, b) = (files.path().join("a.md"), files.path().join("b.md"));
|
||||
std::fs::write(&a, "A
|
||||
").expect("a");
|
||||
std::fs::write(&b, "B
|
||||
").expect("b");
|
||||
let (desk, cx) = start(first, data.path());
|
||||
open(&desk, &a, cx);
|
||||
let button = cx.debug_bounds("mark-clear-recent").expect("the button");
|
||||
cx.simulate_click(button.center(), gpui::Modifiers::none());
|
||||
cx.run_until_parked();
|
||||
desk.update(cx, |desk, cx| {
|
||||
desk.leave(cx);
|
||||
desk.keeping.close();
|
||||
});
|
||||
cx.run_until_parked();
|
||||
|
||||
let (desk, cx) = start(second, data.path());
|
||||
assert_eq!(names(&desk, cx), ["a.md"]);
|
||||
assert!(desk.read_with(cx, |desk, _| desk.recent.is_empty()));
|
||||
let list = data.path().join("recent.json");
|
||||
assert_eq!(std::fs::read_to_string(&list).expect("the list"), "[]");
|
||||
// Explicit opens still join it: the restored file, a link.
|
||||
let alias = files.path().join("alias.md");
|
||||
std::fs::hard_link(&a, &alias).expect("a hard link");
|
||||
open(&desk, &a, cx);
|
||||
open(&desk, &alias, cx);
|
||||
open(&desk, &b, cx);
|
||||
assert_eq!(names(&desk, cx), ["a.md", "b.md"]);
|
||||
let real = |path: &std::path::Path| dunce::canonicalize(path).expect("real");
|
||||
let want = [real(&b), real(&alias), real(&a)];
|
||||
assert_eq!(desk.read_with(cx, |desk, _| desk.recent.clone()), want);
|
||||
let kept: Vec<std::path::PathBuf> =
|
||||
serde_json::from_str(&std::fs::read_to_string(&list).expect("the list"))
|
||||
.expect("a list");
|
||||
assert_eq!(kept, want);
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,7 @@ impl Side {
|
||||
.action(open)
|
||||
.into_any_element();
|
||||
}
|
||||
let opener = desk.downgrade();
|
||||
let (opener, clearer) = (desk.downgrade(), desk.downgrade());
|
||||
let rows = read.recent.iter().map(|path| {
|
||||
let name = path
|
||||
.file_name()
|
||||
@@ -214,15 +214,32 @@ impl Side {
|
||||
);
|
||||
(key, item)
|
||||
});
|
||||
rows.fold(
|
||||
SelectableList::new("mark-recent").label(text(cx, "mark.recent", &[])),
|
||||
|list, (key, item)| list.row(key, item),
|
||||
)
|
||||
.on_activate(move |key, _, cx| {
|
||||
let path = PathBuf::from(key.as_ref());
|
||||
opener.update(cx, |desk, cx| desk.open_path(path, cx)).ok();
|
||||
})
|
||||
.into_any_element()
|
||||
let list = rows
|
||||
.fold(
|
||||
SelectableList::new("mark-recent").label(text(cx, "mark.recent", &[])),
|
||||
|list, (key, item)| list.row(key, item),
|
||||
)
|
||||
.on_activate(move |key, _, cx| {
|
||||
let path = PathBuf::from(key.as_ref());
|
||||
opener.update(cx, |desk, cx| desk.open_path(path, cx)).ok();
|
||||
});
|
||||
let clear = Button::new("mark-clear-recent", text(cx, "mark.recent.clear", &[]))
|
||||
.size(ControlSize::Sm)
|
||||
.on_click(move |_, _, cx| {
|
||||
clearer.update(cx, |desk, cx| desk.clear_recent(cx)).ok();
|
||||
});
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap_2()
|
||||
.size_full()
|
||||
.child(div().flex_1().min_h_0().child(list))
|
||||
.child(
|
||||
div()
|
||||
.debug_selector(|| "mark-clear-recent".into())
|
||||
.child(clear),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
fn outline(&self, desk: &Entity<Desk>, cx: &mut Context<Self>) -> AnyElement {
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::{io, path::Path};
|
||||
|
||||
use ely_gpui_component::{primitives::Severity, shell::StatusBarItem};
|
||||
use ely_office::prelude::*;
|
||||
use ely_platform::AppId;
|
||||
use ely_platform::{AppId, git::NoGit};
|
||||
use ely_ui::i18n::text;
|
||||
use gpui::Context;
|
||||
|
||||
@@ -20,15 +20,22 @@ pub enum Tracked {
|
||||
Untracked,
|
||||
Ignored,
|
||||
Conflicted,
|
||||
/// Ely's Git sits beside ElyTree, which is not installed.
|
||||
NoGit,
|
||||
/// Git could not answer; why.
|
||||
Unknown(String),
|
||||
}
|
||||
|
||||
/// Git's word on `file`: in a repository, then its status.
|
||||
pub fn ask(file: &Path) -> Tracked {
|
||||
match status(file) {
|
||||
Ok(tracked) => tracked,
|
||||
Err(error) => Tracked::Unknown(error.to_string()),
|
||||
status(file).unwrap_or_else(failed)
|
||||
}
|
||||
|
||||
/// A failure: no Git at all, else why.
|
||||
fn failed(error: io::Error) -> Tracked {
|
||||
match error.get_ref().is_some_and(|inner| inner.is::<NoGit>()) {
|
||||
true => Tracked::NoGit,
|
||||
false => Tracked::Unknown(error.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +126,16 @@ impl Desk {
|
||||
Tracked::Untracked => "mark.git.untracked",
|
||||
Tracked::Ignored => "mark.git.ignored",
|
||||
Tracked::Conflicted => "mark.git.conflicted",
|
||||
Tracked::NoGit => {
|
||||
let this = cx.entity();
|
||||
let item = StatusBarItem::new("mark-git")
|
||||
.label(text(cx, "mark.git.none", &[]))
|
||||
.tooltip(text(cx, "mark.git.needs", &[]));
|
||||
return Some(item.on_click(move |_, _, cx| {
|
||||
let said = text(cx, "mark.git.needs", &[]);
|
||||
this.update(cx, |desk, cx| desk.toast(said, Severity::Warning, cx));
|
||||
}));
|
||||
}
|
||||
Tracked::Unknown(why) => {
|
||||
let label = text(cx, "mark.git.unknown", &[]);
|
||||
return Some(
|
||||
@@ -172,6 +189,14 @@ mod tests {
|
||||
assert!(done.expect("git runs").status.success(), "git {args:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_git_asks_for_elytree_and_other_failures_say_why() {
|
||||
let missing = io::Error::new(io::ErrorKind::NotFound, NoGit);
|
||||
assert_eq!(failed(missing), Tracked::NoGit);
|
||||
let other = io::Error::new(io::ErrorKind::NotFound, "gone");
|
||||
assert_eq!(failed(other), Tracked::Unknown("gone".into()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn spaces_stay_and_broken_repositories_say_why() {
|
||||
let dir = tempfile::tempdir().expect("a temp dir");
|
||||
|
||||
@@ -95,7 +95,10 @@ impl Host for Deck {
|
||||
&& !tab.extra.fitted
|
||||
{
|
||||
tab.extra.fitted = true;
|
||||
view.update(cx, |view, cx| view.fit_page(cx));
|
||||
view.update(cx, |view, cx| {
|
||||
view.fit_page(cx);
|
||||
view.turn_parts();
|
||||
});
|
||||
}
|
||||
// Pictures follow the kernel's light or dark scheme.
|
||||
let dark = view.read(cx).dark();
|
||||
@@ -263,7 +266,12 @@ impl Deck {
|
||||
Ok(((slides, at), (design, objects, notes, remarks, (motion, media)), size, history)) => {
|
||||
tab.extra.read_at = Some(at);
|
||||
log::info!("show: tab {id} has {} parts", slides.list.len());
|
||||
view.update(cx, |view, _| view.set_part(slides.current));
|
||||
// A queued turn or part outranks an earlier read.
|
||||
view.update(cx, |view, _| {
|
||||
if view.settled() {
|
||||
view.set_part(slides.current)
|
||||
}
|
||||
});
|
||||
let names: HashSet<&String> =
|
||||
slides.list.iter().map(|slide| &slide.name).collect();
|
||||
tab.extra.keep_pictures(&names);
|
||||
|
||||
@@ -19,6 +19,7 @@ mod play_time;
|
||||
mod review;
|
||||
mod slides;
|
||||
mod strip;
|
||||
mod turn;
|
||||
|
||||
/// An unrendered Deck over a fresh worker, if LOK exists.
|
||||
pub(super) fn deck(cx: &mut TestAppContext, dir: &Path) -> Option<Entity<Deck>> {
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
use ely_lok::LokView;
|
||||
use ely_office::prelude::*;
|
||||
use gpui::{Entity, ScrollDelta, ScrollWheelEvent, TestAppContext, VisualTestContext, point};
|
||||
|
||||
use super::objects::{blank, selection};
|
||||
use super::{counts, quiet, settle, update};
|
||||
use crate::deck::Deck;
|
||||
|
||||
/// The slide canvas alone in a window.
|
||||
struct Host(Entity<LokView>);
|
||||
|
||||
impl gpui::Render for Host {
|
||||
fn render(&mut self, _: &mut gpui::Window, _: &mut gpui::Context<Self>) -> impl gpui::IntoElement {
|
||||
use gpui::{ParentElement as _, Styled as _};
|
||||
gpui::div().size_full().child(self.0.clone())
|
||||
}
|
||||
}
|
||||
|
||||
/// The current slide once every turn landed.
|
||||
fn current(shown: &mut VisualTestContext, deck: &Entity<Deck>) -> usize {
|
||||
quiet(shown, deck);
|
||||
shown.update(|_, app| deck.read(app).active_tab().map(|tab| tab.extra.slides.current).expect("a tab"))
|
||||
}
|
||||
|
||||
/// Whole notches, in this platform's lines.
|
||||
fn wheel(shown: &mut VisualTestContext, notches: f32) {
|
||||
let middle = shown.update(|window, _| window.viewport_size()).center();
|
||||
let delta = ScrollDelta::Lines(point(0.0, notches * ely_lok::notch()));
|
||||
shown.simulate_event(ScrollWheelEvent { position: middle.into(), delta, ..Default::default() });
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_wheel_and_up_down_turn_slides() {
|
||||
let dir = tempfile::tempdir().expect("a temp dir");
|
||||
let mut cx = TestAppContext::single();
|
||||
let Some(deck) = blank(&mut cx, dir.path()) else {
|
||||
return eprintln!("SKIP: no LOK build");
|
||||
};
|
||||
for n in 2..=3 {
|
||||
update(&mut cx, &deck, |deck, cx| deck.object_command("slide.insert", &[], cx));
|
||||
settle(&cx, |app| counts(app, &deck).0 == n);
|
||||
}
|
||||
let view = cx.update(|app| deck.read(app).active_tab().expect("a tab").view.clone());
|
||||
cx.update(|app| view.update(app, |view, _| view.show_part(0)));
|
||||
let window = cx.add_window(|_, _| Host(view.clone()));
|
||||
let mut shown = VisualTestContext::from_window(window.into(), &cx);
|
||||
shown.run_until_parked();
|
||||
assert_eq!(current(&mut shown, &deck), 0);
|
||||
wheel(&mut shown, -2.0);
|
||||
assert_eq!(current(&mut shown, &deck), 2, "two notches in one event turn two");
|
||||
wheel(&mut shown, 1.0);
|
||||
wheel(&mut shown, 1.0);
|
||||
assert_eq!(current(&mut shown, &deck), 0, "rapid notches each turn");
|
||||
wheel(&mut shown, -1.0);
|
||||
assert_eq!(current(&mut shown, &deck), 1, "the wheel turns down");
|
||||
shown.update(|window, app| {
|
||||
let focus = view.read(app).focus_handle().clone();
|
||||
window.focus(&focus, app)
|
||||
});
|
||||
shown.simulate_keystrokes("down");
|
||||
assert_eq!(current(&mut shown, &deck), 2, "Down turns");
|
||||
shown.simulate_keystrokes("down");
|
||||
assert_eq!(current(&mut shown, &deck), 2, "the last slide stays");
|
||||
shown.simulate_keystrokes("up");
|
||||
assert_eq!(current(&mut shown, &deck), 1, "Up turns back");
|
||||
wheel(&mut shown, 1.0);
|
||||
assert_eq!(current(&mut shown, &deck), 0, "the wheel turns up");
|
||||
// Down queued behind Tab moves the object Tab picks.
|
||||
shown.simulate_keystrokes("tab down");
|
||||
assert_eq!(current(&mut shown, &deck), 0, "Down after Tab moves, not turns");
|
||||
assert!(shown.update(|_, app| selection(app, &deck)).is_some(), "Tab picked an object");
|
||||
// A turn lands before the keys queued after it.
|
||||
shown.simulate_keystrokes("escape down tab down");
|
||||
assert_eq!(current(&mut shown, &deck), 1, "Down turns, then moves");
|
||||
assert!(shown.update(|_, app| selection(app, &deck)).is_some(), "Tab picked on the new slide");
|
||||
}
|
||||
@@ -39,6 +39,14 @@ pub fn forget(file: &Path, root: &Path) -> io::Result<()> {
|
||||
.map(drop)
|
||||
}
|
||||
|
||||
/// Empties the list.
|
||||
pub fn clear(file: &Path) -> io::Result<()> {
|
||||
if let Some(dir) = file.parent() {
|
||||
std::fs::create_dir_all(dir)?;
|
||||
}
|
||||
crate::save_atomic(file, b"[]", 0).map(drop)
|
||||
}
|
||||
|
||||
/// Puts `root` first in the list and writes it.
|
||||
pub fn remember(file: &Path, root: &Path) -> io::Result<Vec<PathBuf>> {
|
||||
let mut list = recent(file)?;
|
||||
@@ -60,7 +68,7 @@ pub fn remember(file: &Path, root: &Path) -> io::Result<Vec<PathBuf>> {
|
||||
mod tests {
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use super::{forget, recent, remember};
|
||||
use super::{clear, forget, recent, remember};
|
||||
|
||||
#[test]
|
||||
fn the_list_puts_the_newest_first_and_keeps_twenty() {
|
||||
@@ -82,6 +90,8 @@ mod tests {
|
||||
let plain = [PathBuf::from(r"C:\r\old"), PathBuf::from(r"C:\r\new")];
|
||||
assert_eq!(recent(&file).expect("reads"), plain);
|
||||
}
|
||||
clear(&file).expect("clears");
|
||||
assert!(recent(&file).expect("reads").is_empty());
|
||||
std::fs::write(&file, "not json").expect("writes");
|
||||
assert!(
|
||||
remember(&file, Path::new("/r/1")).is_err(),
|
||||
|
||||
@@ -237,6 +237,15 @@ impl Worker {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Turns `step` parts, or posts `key` if something is picked.
|
||||
pub fn turn(&mut self, doc: &Doc, step: i32, key: Option<(u32, i32)>) -> io::Result<Option<usize>> {
|
||||
let (char_code, key_code) = key.unwrap_or_default();
|
||||
let doc_id = self.doc_id(doc)?;
|
||||
let payload = Pack::new().u64(doc_id).i64(step.into()).i64(char_code.into()).i64(key_code.into()).bytes();
|
||||
let shown = Unpack::new(&self.request(tag::TURN, &payload)?).i64()?;
|
||||
Ok(usize::try_from(shown).ok())
|
||||
}
|
||||
|
||||
/// Drags a selected object's handle, start then end.
|
||||
pub fn drag_graphic(&mut self, doc: &Doc, from: (i32, i32), to: (i32, i32)) -> io::Result<()> {
|
||||
for (kind, (x, y)) in [(0, from), (1, to)] {
|
||||
|
||||
@@ -362,11 +362,14 @@ pub fn stop_all(docs: &HashMap<u64, Document>) {
|
||||
|
||||
/// The current generation of `id`.
|
||||
pub fn generation(id: u64) -> u64 {
|
||||
slots()
|
||||
.lock()
|
||||
.expect("the events lock")
|
||||
.get(&id)
|
||||
.map_or(0, |slot| slot.batch.generation)
|
||||
slots().lock().expect("the events lock").get(&id).map_or(0, |slot| slot.batch.generation)
|
||||
}
|
||||
|
||||
/// Whether `id` shows a selection, object or caret.
|
||||
pub fn picked(id: u64) -> bool {
|
||||
let slots = slots().lock().expect("the events lock");
|
||||
let Some(batch) = slots.get(&id).map(|slot| &slot.batch) else { return false };
|
||||
batch.graphic.is_some() || !batch.selection.is_empty() || batch.cursor_visible && batch.cursor.is_some()
|
||||
}
|
||||
|
||||
/// Blocks until documents have unpushed events.
|
||||
@@ -399,12 +402,7 @@ pub fn clear_result(id: u64) {
|
||||
|
||||
/// The completion the last dispatch reported.
|
||||
pub fn take_result(id: u64) -> Option<(String, bool)> {
|
||||
slots()
|
||||
.lock()
|
||||
.expect("the events lock")
|
||||
.get_mut(&id)?
|
||||
.result
|
||||
.take()
|
||||
slots().lock().expect("the events lock").get_mut(&id)?.result.take()
|
||||
}
|
||||
|
||||
/// The bridged a11y text now.
|
||||
|
||||
@@ -60,6 +60,8 @@ macro_rules! call {
|
||||
}};
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
mod accessory;
|
||||
mod document;
|
||||
mod slideshow;
|
||||
pub use document::{Raw, close_window};
|
||||
@@ -80,6 +82,9 @@ impl Lok {
|
||||
let install_c = cstring(&install_str)?;
|
||||
let profile_c = cstring(profile_url)?;
|
||||
let lib = Library::open(install)?;
|
||||
// Before the kit starts, so no Dock icon shows.
|
||||
#[cfg(target_os = "macos")]
|
||||
accessory::hide()?;
|
||||
let hook: Hook2 = unsafe {
|
||||
lib.symbol(b"libreofficekit_hook_2\0")
|
||||
.or_else(|_| lib.symbol(b"libreofficekit_hook\0"))
|
||||
@@ -97,6 +102,8 @@ impl Lok {
|
||||
"lok hook failed for {install_str}"
|
||||
)));
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
accessory::check()?;
|
||||
log::info!("lok: hooked {}", install_str);
|
||||
Ok(Self { kit, _lib: lib })
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
//! The worker stays out of the Dock (macOS).
|
||||
|
||||
use std::ffi::{c_char, c_void};
|
||||
use std::io;
|
||||
|
||||
#[link(name = "Foundation", kind = "framework")]
|
||||
#[link(name = "objc")]
|
||||
unsafe extern "C" {
|
||||
fn objc_getClass(name: *const c_char) -> *mut c_void;
|
||||
fn sel_registerName(name: *const c_char) -> *mut c_void;
|
||||
fn objc_msgSend();
|
||||
}
|
||||
|
||||
/// NSApplicationActivationPolicyAccessory: no Dock icon, no menu bar.
|
||||
const ACCESSORY: isize = 1;
|
||||
/// NSApplicationActivationPolicyProhibited: an unbundled worker starts so.
|
||||
const PROHIBITED: isize = 2;
|
||||
|
||||
type Id = *mut c_void;
|
||||
|
||||
fn send() -> unsafe extern "C" fn() {
|
||||
objc_msgSend as unsafe extern "C" fn()
|
||||
}
|
||||
|
||||
fn class(name: &std::ffi::CStr) -> io::Result<Id> {
|
||||
let class = unsafe { objc_getClass(name.as_ptr()) };
|
||||
if class.is_null() {
|
||||
return Err(io::Error::other(format!("no {} class", name.to_string_lossy())));
|
||||
}
|
||||
Ok(class)
|
||||
}
|
||||
|
||||
fn get(object: Id, selector: &std::ffi::CStr) -> io::Result<Id> {
|
||||
type F = unsafe extern "C" fn(Id, Id) -> Id;
|
||||
let f: F = unsafe { std::mem::transmute(send()) };
|
||||
let result = unsafe { f(object, sel_registerName(selector.as_ptr())) };
|
||||
if result.is_null() {
|
||||
return Err(io::Error::other(format!("{} gave nothing", selector.to_string_lossy())));
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// Marks the process a UI element before registration.
|
||||
pub fn hide() -> io::Result<()> {
|
||||
// The kit reads the bundle's LSUIElement when it registers.
|
||||
let info = get(get(class(c"NSBundle")?, c"mainBundle")?, c"infoDictionary")?;
|
||||
type Text = unsafe extern "C" fn(Id, Id, *const c_char) -> Id;
|
||||
type Flag = unsafe extern "C" fn(Id, Id, i8) -> Id;
|
||||
type Set = unsafe extern "C" fn(Id, Id, Id, Id);
|
||||
let text: Text = unsafe { std::mem::transmute(send()) };
|
||||
let flag: Flag = unsafe { std::mem::transmute(send()) };
|
||||
let set: Set = unsafe { std::mem::transmute(send()) };
|
||||
unsafe {
|
||||
let key = text(class(c"NSString")?, sel_registerName(c"stringWithUTF8String:".as_ptr()), c"LSUIElement".as_ptr());
|
||||
let yes = flag(class(c"NSNumber")?, sel_registerName(c"numberWithBool:".as_ptr()), 1);
|
||||
set(info, sel_registerName(c"setObject:forKey:".as_ptr()), yes, key);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Fails unless the kernel's application came up an accessory.
|
||||
pub fn check() -> io::Result<()> {
|
||||
type Policy = unsafe extern "C" fn(Id, Id) -> isize;
|
||||
type SetPolicy = unsafe extern "C" fn(Id, Id, isize) -> i8;
|
||||
let policy: Policy = unsafe { std::mem::transmute(send()) };
|
||||
let set: SetPolicy = unsafe { std::mem::transmute(send()) };
|
||||
let app = get(class(c"NSApplication")?, c"sharedApplication")?;
|
||||
let read = || unsafe { policy(app, sel_registerName(c"activationPolicy".as_ptr())) };
|
||||
let mut found = read();
|
||||
if found == PROHIBITED {
|
||||
// Outside a bundle nothing registers; accessory lets it draw.
|
||||
let done = unsafe { set(app, sel_registerName(c"setActivationPolicy:".as_ptr()), ACCESSORY) };
|
||||
found = read();
|
||||
log::info!("lok: the unbundled worker asked for accessory ({done})");
|
||||
}
|
||||
if found != ACCESSORY {
|
||||
return Err(io::Error::other(format!("the worker's activation policy is {found}, not accessory")));
|
||||
}
|
||||
log::info!("lok: the worker is an accessory app");
|
||||
Ok(())
|
||||
}
|
||||
@@ -88,6 +88,8 @@ pub mod tag {
|
||||
pub const REVISION: u8 = 34;
|
||||
/// One layer's pixels from the last `SLIDE_LAYERS`.
|
||||
pub const SLIDE_LAYER: u8 = 35;
|
||||
/// Turns parts; an arrow with something picked goes in.
|
||||
pub const TURN: u8 = 36;
|
||||
pub const OK: u8 = 100;
|
||||
pub const ERR: u8 = 101;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ pub use client::{
|
||||
};
|
||||
#[cfg(feature = "view")]
|
||||
pub use view::{
|
||||
CONTEXT, Copy, Cut, Geom, Layout, LokError, LokView, Paste, Reported, ZOOM_STEPS,
|
||||
CONTEXT, Copy, Cut, Geom, Layout, LokError, LokView, Paste, Reported, ZOOM_STEPS, notch,
|
||||
Zoomed, init, layout, paper, read_off, scheme,
|
||||
};
|
||||
#[cfg(feature = "view")]
|
||||
|
||||
@@ -32,7 +32,9 @@ mod scroll;
|
||||
mod sheet;
|
||||
pub use input::{CONTEXT, Copy, Cut, Paste, init};
|
||||
pub use off::read_off;
|
||||
pub use render::scheme;
|
||||
pub use render::{paper, scheme};
|
||||
mod turn;
|
||||
pub use turn::notch;
|
||||
|
||||
pub(crate) use crate::{TILE_TWIPS, TWIPS_PER_PIXEL};
|
||||
|
||||
@@ -125,6 +127,8 @@ pub struct LokView {
|
||||
dark: Option<bool>,
|
||||
/// The zoom follows the viewport so a page fits.
|
||||
fit: bool,
|
||||
/// Set when the wheel and Up, Down turn parts.
|
||||
turning: Option<turn::Turning>,
|
||||
/// The sheet shown, and the offered function chosen.
|
||||
part: usize,
|
||||
picked: usize,
|
||||
@@ -150,17 +154,6 @@ pub type Layout = ((i64, i64), Vec<Rect>);
|
||||
|
||||
use sheet::{Measured, measure};
|
||||
|
||||
/// A page's colour; the kernel's Ely schemes share it.
|
||||
pub fn paper(cx: &gpui::App) -> gpui::Hsla {
|
||||
use ely_gpui_component::theme::ActiveTheme as _;
|
||||
let theme = cx.theme();
|
||||
if theme.is_dark() {
|
||||
theme.colors.surface
|
||||
} else {
|
||||
theme.colors.paper
|
||||
}
|
||||
}
|
||||
|
||||
/// Reads `doc`'s size and page frames.
|
||||
pub fn layout(worker: &mut Worker, doc: &Doc) -> io::Result<Layout> {
|
||||
Ok((doc.size(worker)?, doc.pages(worker)?))
|
||||
@@ -227,6 +220,7 @@ impl LokView {
|
||||
cell: crate::Cell::default(),
|
||||
dark: None,
|
||||
fit: false,
|
||||
turning: None,
|
||||
part: 0,
|
||||
picked: 0,
|
||||
marked: None,
|
||||
|
||||
@@ -64,6 +64,14 @@ pub(super) enum Input {
|
||||
Visible(Rect, (u32, i32)),
|
||||
/// Shows sheet or slide `part`, from 0.
|
||||
Part(usize),
|
||||
/// Turns `step` parts; a picked object takes the arrow `key`.
|
||||
Turn { step: i32, key: Option<(u32, i32)> },
|
||||
}
|
||||
|
||||
/// What an input gives back.
|
||||
pub(super) enum Back {
|
||||
Copied(String),
|
||||
Shown(usize),
|
||||
}
|
||||
|
||||
impl Input {
|
||||
@@ -73,6 +81,7 @@ impl Input {
|
||||
// Arrows, Home, End, Page keys, Escape.
|
||||
Input::Key { key_code, .. } => !matches!(key_code & 0x0FFF, 1024..=1031 | 1281),
|
||||
Input::Mouse(_)
|
||||
| Input::Turn { .. }
|
||||
| Input::Copy { cut: false }
|
||||
| Input::Visible(..)
|
||||
| Input::Part(_)
|
||||
@@ -169,7 +178,7 @@ fn lok_button(button: MouseButton) -> Option<i32> {
|
||||
}
|
||||
|
||||
/// Runs one input; gives a copy's mark and the revision.
|
||||
pub(super) fn run(worker: &Mutex<Worker>, doc: &Doc, input: Input) -> (io::Result<Option<String>>, Option<u64>) {
|
||||
pub(super) fn run(worker: &Mutex<Worker>, doc: &Doc, input: Input) -> (io::Result<Option<Back>>, Option<u64>) {
|
||||
let mut worker = worker.lock().expect("the worker lock");
|
||||
let counts = !matches!(input, Input::Visible(..));
|
||||
let copied = apply(&mut worker, doc, input);
|
||||
@@ -181,12 +190,13 @@ pub(super) fn run(worker: &Mutex<Worker>, doc: &Doc, input: Input) -> (io::Resul
|
||||
(copied, now)
|
||||
}
|
||||
|
||||
fn apply(worker: &mut Worker, doc: &Doc, input: Input) -> io::Result<Option<String>> {
|
||||
fn apply(worker: &mut Worker, doc: &Doc, input: Input) -> io::Result<Option<Back>> {
|
||||
let done = match input {
|
||||
Input::Key {
|
||||
char_code,
|
||||
key_code,
|
||||
} => worker.post_key(doc, char_code, key_code),
|
||||
Input::Turn { step, key } => return Ok(worker.turn(doc, step, key)?.map(Back::Shown)),
|
||||
Input::Mouse(event) => worker.post_mouse(doc, event),
|
||||
Input::Drag { from, to } => worker.drag_graphic(doc, from, to),
|
||||
Input::Visible(area, scale) => doc.visible_area(worker, area, scale),
|
||||
@@ -195,9 +205,8 @@ fn apply(worker: &mut Worker, doc: &Doc, input: Input) -> io::Result<Option<Stri
|
||||
Input::Theme(scheme) => worker.run(doc, "view.theme", &[scheme]),
|
||||
Input::Text { commit, text } => worker.post_text(doc, commit, &text),
|
||||
Input::Copy { cut } => {
|
||||
return clip::copy_out(worker, doc, cut, |clip| {
|
||||
clipboard::write(clip).map_err(io::Error::other)
|
||||
});
|
||||
let copied = clip::copy_out(worker, doc, cut, |clip| clipboard::write(clip).map_err(io::Error::other));
|
||||
return copied.map(|copied| copied.map(Back::Copied));
|
||||
}
|
||||
Input::Run { commands, at } => {
|
||||
let values: Vec<Vec<&str>> =
|
||||
@@ -298,7 +307,10 @@ impl LokView {
|
||||
_: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
if self.walk(&event.keystroke, cx) || self.key_down(&event.keystroke) {
|
||||
if self.walk(&event.keystroke, cx)
|
||||
|| self.turn_key(&event.keystroke)
|
||||
|| self.key_down(&event.keystroke)
|
||||
{
|
||||
cx.stop_propagation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ use std::{
|
||||
use futures::{StreamExt, channel::mpsc, select_biased};
|
||||
use gpui::Context;
|
||||
|
||||
use super::{Geom, LokError, LokView, Reported, TILE_TWIPS, input::Input};
|
||||
use super::input::{Back, Input};
|
||||
use super::{Geom, LokError, LokView, Reported, TILE_TWIPS};
|
||||
use crate::{Doc, Tile, Worker};
|
||||
|
||||
/// An input slower than this is logged as a warning.
|
||||
@@ -24,7 +25,7 @@ pub(super) struct Job {
|
||||
/// What came back from the lane.
|
||||
enum Landed {
|
||||
/// Sequence, whether it edits, whether it switched part, outcome.
|
||||
Input(u64, bool, bool, (io::Result<Option<String>>, Option<u64>)),
|
||||
Input(u64, bool, bool, (io::Result<Option<Back>>, Option<u64>)),
|
||||
Tile(Job, io::Result<Tile>),
|
||||
}
|
||||
|
||||
@@ -111,7 +112,13 @@ impl LokView {
|
||||
}
|
||||
self.seen_revision(now.unwrap_or(0));
|
||||
match outcome {
|
||||
Ok(Some(copied)) => self.copied = Some(copied),
|
||||
Ok(Some(Back::Copied(copied))) => self.copied = Some(copied),
|
||||
Ok(Some(Back::Shown(part))) if part != self.part => {
|
||||
// The worker turned in order.
|
||||
self.part = part;
|
||||
self.invalidate(cx);
|
||||
}
|
||||
Ok(Some(Back::Shown(_))) => {}
|
||||
Ok(None) => {}
|
||||
Err(error) => {
|
||||
log::error!("lok: input failed ({:?})", error.kind());
|
||||
|
||||
@@ -24,6 +24,16 @@ pub fn scheme(dark: bool) -> &'static str {
|
||||
if dark { DARK } else { LIGHT }
|
||||
}
|
||||
|
||||
/// A page's colour; the kernel's Ely schemes share it.
|
||||
pub fn paper(cx: &gpui::App) -> gpui::Hsla {
|
||||
let theme = cx.theme();
|
||||
if theme.is_dark() {
|
||||
theme.colors.surface
|
||||
} else {
|
||||
theme.colors.paper
|
||||
}
|
||||
}
|
||||
|
||||
impl LokView {
|
||||
/// Paints with the app's light or dark scheme.
|
||||
pub(super) fn follow_theme(&mut self, dark: bool) {
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
//! The wheel and Up, Down turn slides (SHOW-01).
|
||||
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use gpui::{Keystroke, Modifiers, ScrollDelta, ScrollWheelEvent, TouchPhase};
|
||||
|
||||
use super::LokView;
|
||||
use super::input::{Input, vcl_key};
|
||||
|
||||
/// Trackpad pixels one turn takes.
|
||||
const SWIPE: f32 = 50.0;
|
||||
/// A pause this long ends a gesture without phases.
|
||||
const PAUSE: Duration = Duration::from_millis(200);
|
||||
|
||||
/// Lines one wheel notch scrolls on this platform.
|
||||
pub fn notch() -> f32 {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use windows_sys::Win32::UI::WindowsAndMessaging::{SPI_GETWHEELSCROLLLINES, SystemParametersInfoW};
|
||||
let mut lines = 3u32;
|
||||
// Same setting gpui scales the wheel by.
|
||||
unsafe { SystemParametersInfoW(SPI_GETWHEELSCROLLLINES, 0, (&raw mut lines).cast(), 0) };
|
||||
lines as f32
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
1.0
|
||||
}
|
||||
// gpui's X11 and Wayland scroll three lines a notch.
|
||||
#[cfg(not(any(windows, target_os = "macos")))]
|
||||
{
|
||||
3.0
|
||||
}
|
||||
}
|
||||
|
||||
/// The wheel's progress towards a turn.
|
||||
#[derive(Default)]
|
||||
pub(super) struct Turning {
|
||||
/// This gesture's travel, in turns.
|
||||
travel: f32,
|
||||
/// This gesture already turned.
|
||||
spent: bool,
|
||||
/// The platform began a gesture it has not ended.
|
||||
held: bool,
|
||||
/// Fractional lines in this run: a touchpad, not a wheel.
|
||||
smooth: bool,
|
||||
last: Option<Instant>,
|
||||
}
|
||||
|
||||
impl Turning {
|
||||
/// The turn a wheel event makes; 0 for none.
|
||||
pub(super) fn wheel(&mut self, delta: ScrollDelta, phase: TouchPhase, now: Instant, notch: f32) -> i32 {
|
||||
let paused = self.last.is_none_or(|last| now.duration_since(last) >= PAUSE);
|
||||
self.last = Some(now);
|
||||
// X11 lines mix wheels and touchpads; they carry no phase.
|
||||
let (travel, phase) = match delta {
|
||||
ScrollDelta::Lines(_) if notch <= 0.0 => return 0,
|
||||
ScrollDelta::Lines(lines) => (lines.y / notch, None),
|
||||
ScrollDelta::Pixels(pixels) => (f32::from(pixels.y) / SWIPE, Some(phase)),
|
||||
};
|
||||
// Phases bound a gesture; without them, a pause does.
|
||||
if phase == Some(TouchPhase::Started) || paused && !self.held {
|
||||
(self.travel, self.spent, self.smooth) = (0.0, false, false);
|
||||
}
|
||||
let whole = travel.round();
|
||||
if phase.is_none() && (whole == 0.0 || (travel - whole).abs() >= 1e-3) {
|
||||
self.smooth = true;
|
||||
}
|
||||
// Whole wheel notches each turn, until fractions show a touchpad.
|
||||
if phase.is_none() && !self.smooth {
|
||||
(self.travel, self.spent, self.held) = (0.0, true, false);
|
||||
return -(whole as i32);
|
||||
}
|
||||
self.held = match phase {
|
||||
Some(TouchPhase::Started) => true,
|
||||
Some(TouchPhase::Moved) => self.held,
|
||||
Some(TouchPhase::Ended | TouchPhase::Cancelled) | None => false,
|
||||
};
|
||||
// One gesture turns once, momentum included.
|
||||
if self.spent {
|
||||
return 0;
|
||||
}
|
||||
self.travel += travel;
|
||||
if self.travel.abs() < 1.0 - 1e-3 {
|
||||
return 0;
|
||||
}
|
||||
self.spent = true;
|
||||
// Content moving down shows the part before.
|
||||
-(self.travel.signum() as i32)
|
||||
}
|
||||
}
|
||||
|
||||
impl LokView {
|
||||
/// The wheel and Up, Down turn parts from now on.
|
||||
pub fn turn_parts(&mut self) {
|
||||
self.turning.get_or_insert_default();
|
||||
}
|
||||
|
||||
/// Queues Up, Down; the worker turns if nothing is picked.
|
||||
pub(super) fn turn_key(&mut self, keystroke: &Keystroke) -> bool {
|
||||
if self.turning.is_none() || keystroke.modifiers != Modifiers::none() {
|
||||
return false;
|
||||
}
|
||||
let step = match keystroke.key.as_str() {
|
||||
"down" => 1,
|
||||
"up" => -1,
|
||||
_ => return false,
|
||||
};
|
||||
let Some(key) = vcl_key(keystroke) else {
|
||||
return false;
|
||||
};
|
||||
self.send(Input::Turn { step, key: Some(key) });
|
||||
true
|
||||
}
|
||||
|
||||
/// The wheel turns while the whole page shows.
|
||||
pub(super) fn turn_wheel(&mut self, event: &ScrollWheelEvent) -> bool {
|
||||
let (width, height) = self.extent();
|
||||
// A pixel of slack for rounding.
|
||||
let whole = self.geom.px_of(width) <= self.viewport.0 + 1.0
|
||||
&& self.geom.px_of(height) <= self.viewport.1 + 1.0;
|
||||
let Some(turning) = self.turning.as_mut().filter(|_| whole) else {
|
||||
return false;
|
||||
};
|
||||
let step = turning.wheel(event.delta, event.touch_phase, Instant::now(), notch());
|
||||
if step != 0 {
|
||||
// In order with the input around it.
|
||||
self.send(Input::Turn { step, key: None });
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use gpui::{ScrollDelta, TouchPhase, point, px};
|
||||
|
||||
use super::{PAUSE, Turning};
|
||||
|
||||
const NOTCH: f32 = 3.0;
|
||||
|
||||
fn lines(y: f32) -> ScrollDelta {
|
||||
ScrollDelta::Lines(point(0.0, y))
|
||||
}
|
||||
|
||||
fn pixels(y: f32) -> ScrollDelta {
|
||||
ScrollDelta::Pixels(point(px(0.0), px(y)))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_notch_with_a_pause_turns_once() {
|
||||
let (mut turning, now) = (Turning::default(), std::time::Instant::now());
|
||||
let mut wheel = |y, at| turning.wheel(lines(y), TouchPhase::Moved, at, NOTCH);
|
||||
assert_eq!(wheel(-3.0, now), 1, "Windows and Linux scroll three lines a notch");
|
||||
assert_eq!(wheel(-3.0, now + PAUSE), 1);
|
||||
assert_eq!(wheel(3.0, now + PAUSE * 2), -1);
|
||||
assert_eq!(wheel(-6.0, now + PAUSE * 3), 2, "two notches in one event");
|
||||
assert_eq!(wheel(-3.0, now + PAUSE * 3), 1, "rapid notches each turn");
|
||||
assert_eq!(wheel(-3.0, now + PAUSE * 3), 1);
|
||||
assert_eq!(wheel(-1.0, now + PAUSE * 4), 0, "a third of a notch");
|
||||
let mut mac = Turning::default();
|
||||
assert_eq!(mac.wheel(lines(-1.0), TouchPhase::Moved, now, 1.0), 1, "macOS scrolls a line a notch");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_stream_of_lines_turns_once() {
|
||||
let (mut turning, now) = (Turning::default(), std::time::Instant::now());
|
||||
// A whole step, then fractions: no more turns once smooth.
|
||||
let stream = [-3.0, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -3.0];
|
||||
let turned: i32 = stream.iter().map(|&y| turning.wheel(lines(y), TouchPhase::Moved, now, NOTCH)).sum();
|
||||
assert_eq!(turned, 1, "one swipe turns once");
|
||||
let mut turning = Turning::default();
|
||||
let turned: i32 = (0..30).map(|_| turning.wheel(lines(-0.4), TouchPhase::Moved, now, NOTCH)).sum();
|
||||
assert_eq!(turned, 1, "fractions add up once");
|
||||
assert_eq!(turning.wheel(lines(-3.0), TouchPhase::Moved, now + PAUSE, NOTCH), 1, "a pause ends it");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_swipe_turns_once_until_the_next() {
|
||||
let (mut turning, now) = (Turning::default(), std::time::Instant::now());
|
||||
let mut swipe = |y, phase, at| turning.wheel(pixels(y), phase, at, NOTCH);
|
||||
assert_eq!(swipe(-30.0, TouchPhase::Started, now), 0);
|
||||
assert_eq!(swipe(-30.0, TouchPhase::Moved, now), 1);
|
||||
// A pause with fingers down is the same gesture.
|
||||
assert_eq!(swipe(-60.0, TouchPhase::Moved, now + PAUSE * 2), 0);
|
||||
assert_eq!(swipe(0.0, TouchPhase::Ended, now + PAUSE * 2), 0);
|
||||
// Momentum after the turn turns nothing more.
|
||||
for _ in 0..20 {
|
||||
assert_eq!(swipe(-80.0, TouchPhase::Moved, now + PAUSE * 2), 0);
|
||||
}
|
||||
assert_eq!(swipe(60.0, TouchPhase::Started, now + PAUSE * 2), -1);
|
||||
assert_eq!(swipe(0.0, TouchPhase::Ended, now + PAUSE * 2), 0);
|
||||
// Without phases a pause ends a gesture (Wayland).
|
||||
let later = now + PAUSE * 4;
|
||||
assert_eq!(swipe(60.0, TouchPhase::Moved, later), -1);
|
||||
assert_eq!(swipe(60.0, TouchPhase::Moved, later), 0);
|
||||
assert_eq!(swipe(60.0, TouchPhase::Moved, later + PAUSE), -1);
|
||||
}
|
||||
}
|
||||
@@ -65,9 +65,9 @@ impl LokView {
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
/// Ctrl (macOS: Cmd) and the wheel zoom; else scroll.
|
||||
/// Ctrl (macOS: Cmd) wheel zooms; else it turns or scrolls.
|
||||
pub(super) fn on_wheel(&mut self, event: &ScrollWheelEvent, window: &mut Window, cx: &mut Context<Self>) {
|
||||
if !self.wheel_zoom(event, cx) {
|
||||
if !self.wheel_zoom(event, cx) && !self.turn_wheel(event) {
|
||||
self.on_scroll(event, window, cx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +218,7 @@ fn answer(lok: &Lok, tag: u8, id: u64, payload: &[u8]) {
|
||||
}
|
||||
}),
|
||||
tag::POST_KEY => input::key(unpack),
|
||||
tag::TURN => input::turn(unpack),
|
||||
tag::POST_MOUSE => input::mouse(unpack),
|
||||
tag::GRAPHIC => input::graphic(unpack),
|
||||
tag::POST_TEXT => input::text(unpack),
|
||||
|
||||
@@ -99,6 +99,28 @@ pub(super) fn key(unpack: &mut Unpack) -> io::Result<Vec<u8>> {
|
||||
Ok(Vec::new())
|
||||
}
|
||||
|
||||
/// Turns `step` parts in order, or posts the arrow (-1).
|
||||
pub(super) fn turn(unpack: &mut Unpack) -> io::Result<Vec<u8>> {
|
||||
let (id, step, char_code, key_code) = (unpack.u64()?, unpack.i64()?, unpack.i64()?, unpack.i64()?);
|
||||
// Earlier input's callbacks already landed here.
|
||||
if key_code != 0 && crate::events::picked(id) {
|
||||
with_doc(id, |doc| {
|
||||
doc.post_key(0, char_code as i32, key_code as i32);
|
||||
doc.post_key(1, char_code as i32, key_code as i32);
|
||||
})?;
|
||||
return Ok(Pack::new().i64(-1).bytes());
|
||||
}
|
||||
let shown = with_doc(id, |doc| {
|
||||
let (part, last) = (i64::from(doc.part()), i64::from(doc.parts()) - 1);
|
||||
let next = (part + step).clamp(0, last.max(0));
|
||||
if next != part {
|
||||
doc.set_part(next as i32);
|
||||
}
|
||||
next
|
||||
})?;
|
||||
Ok(Pack::new().i64(shown).bytes())
|
||||
}
|
||||
|
||||
/// One mouse event: kind, x, y, count, buttons, modifiers.
|
||||
pub(super) fn mouse(unpack: &mut Unpack) -> io::Result<Vec<u8>> {
|
||||
let id = unpack.u64()?;
|
||||
|
||||
@@ -51,7 +51,7 @@ pub fn expect(unpack: &mut Unpack) -> io::Result<Vec<u8>> {
|
||||
pub fn bump(request: u8, payload: &[u8]) {
|
||||
let changes = matches!(
|
||||
request,
|
||||
tag::POST_KEY | tag::POST_MOUSE | tag::GRAPHIC | tag::POST_TEXT | tag::POST_UNO | tag::PASTE | tag::CUT | tag::COMPLETE_FUNCTION
|
||||
tag::POST_KEY | tag::TURN | tag::POST_MOUSE | tag::GRAPHIC | tag::POST_TEXT | tag::POST_UNO | tag::PASTE | tag::CUT | tag::COMPLETE_FUNCTION
|
||||
);
|
||||
let mut unpack = Unpack::new(payload);
|
||||
let Ok(id) = unpack.u64() else {
|
||||
|
||||
@@ -9,7 +9,7 @@ use std::{
|
||||
use crate::AppId;
|
||||
|
||||
/// Where `app` sits for an install laid out like `exe`'s.
|
||||
fn beside(exe: &Path, app: AppId) -> Vec<PathBuf> {
|
||||
pub(crate) fn beside(exe: &Path, app: AppId) -> Vec<PathBuf> {
|
||||
let file = format!("{}{}", app.slug(), std::env::consts::EXE_SUFFIX);
|
||||
let Some(dir) = exe.parent() else {
|
||||
return Vec::new();
|
||||
@@ -40,7 +40,7 @@ fn find(app: AppId) -> io::Result<Option<PathBuf>> {
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn registered(app: AppId) -> Option<PathBuf> {
|
||||
pub(crate) fn registered(app: AppId) -> Option<PathBuf> {
|
||||
use objc2_app_kit::NSWorkspace;
|
||||
use objc2_foundation::NSString;
|
||||
let id = NSString::from_str(&app.bundle_id());
|
||||
@@ -51,7 +51,7 @@ fn registered(app: AppId) -> Option<PathBuf> {
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
fn registered(_: AppId) -> Option<PathBuf> {
|
||||
pub(crate) fn registered(_: AppId) -> Option<PathBuf> {
|
||||
None
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,7 @@ pub fn locate() -> io::Result<(PathBuf, bool)> {
|
||||
Some(serde_json::Value::String(path)) => return Ok((PathBuf::from(path), false)),
|
||||
Some(other) => return Err(io::Error::new(io::ErrorKind::InvalidData, format!("settings: git cannot be {other}"))),
|
||||
}
|
||||
let exe = std::env::current_exe()?;
|
||||
Ok((own(exe.parent().unwrap_or(Path::new("."))), true))
|
||||
Ok((own(&std::env::current_exe()?)?, true))
|
||||
}
|
||||
|
||||
/// `git version 2.56.0…` as (2, 56); None for anything else.
|
||||
@@ -65,19 +64,36 @@ pub fn system_version(path: &Path) -> io::Result<String> {
|
||||
Ok(version)
|
||||
}
|
||||
|
||||
/// Beside `dir`, in its bundle, in ElyTree's, or built.
|
||||
fn own(dir: &Path) -> PathBuf {
|
||||
/// No Git beside the app nor beside ElyTree.
|
||||
#[derive(Debug)]
|
||||
pub struct NoGit;
|
||||
|
||||
impl std::fmt::Display for NoGit {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
f.write_str("Ely's Git is missing: ElyTree carries it")
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for NoGit {}
|
||||
|
||||
/// The app at `exe`'s own Git, else ElyTree's, else built.
|
||||
fn own(exe: &Path) -> io::Result<PathBuf> {
|
||||
// ElyTree carries Git; the other apps use its copy.
|
||||
let tree = format!("../../../{}.app/Contents/Resources/git", AppId::Tree.name());
|
||||
let trees = crate::apps::beside(exe, AppId::Tree).into_iter().chain(crate::apps::registered(AppId::Tree));
|
||||
let built = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../engines/git").join(GIT);
|
||||
[
|
||||
dir.join("git").join(GIT),
|
||||
dir.join("../Resources/git").join(GIT),
|
||||
dir.join(tree).join(GIT),
|
||||
]
|
||||
.into_iter()
|
||||
.find(|path| path.is_file())
|
||||
.unwrap_or(built)
|
||||
find(exe, trees, built)
|
||||
}
|
||||
|
||||
/// The first Git beside `exe`, beside a tree, or built.
|
||||
fn find(exe: &Path, trees: impl IntoIterator<Item = PathBuf>, built: PathBuf) -> io::Result<PathBuf> {
|
||||
exe.parent()
|
||||
.map(Path::to_path_buf)
|
||||
.into_iter()
|
||||
.chain(trees.into_iter().filter_map(|tree| tree.parent().map(Path::to_path_buf)))
|
||||
.flat_map(|dir| [dir.join("git").join(GIT), dir.join("../Resources/git").join(GIT)])
|
||||
.chain([built])
|
||||
.find(|path| path.is_file())
|
||||
.ok_or_else(|| io::Error::new(io::ErrorKind::NotFound, NoGit))
|
||||
}
|
||||
|
||||
/// Git at `git` in `dir`, as Ely runs it.
|
||||
@@ -119,7 +135,18 @@ mod tests {
|
||||
assert_eq!(super::parse_version("hello"), None);
|
||||
}
|
||||
|
||||
use super::{GIT, own};
|
||||
use super::{GIT, NoGit, find};
|
||||
use crate::{AppId, apps::beside};
|
||||
use std::path::Path;
|
||||
|
||||
/// `find` with only temp folders: no installed or built Git.
|
||||
fn found(exe: &Path, root: &Path) -> std::io::Result<std::path::PathBuf> {
|
||||
find(exe, beside(exe, AppId::Tree), root.join("built").join(GIT))
|
||||
}
|
||||
|
||||
fn same(found: std::path::PathBuf, git: &Path) {
|
||||
assert_eq!(std::fs::canonicalize(found).expect("found"), std::fs::canonicalize(git).expect("git"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn apps_beside_elytree_use_its_git() {
|
||||
@@ -127,9 +154,34 @@ mod tests {
|
||||
let mark = apps.path().join("ElyMark.app/Contents/MacOS");
|
||||
let git = apps.path().join("ElyTree.app/Contents/Resources/git").join(GIT);
|
||||
std::fs::create_dir_all(&mark).expect("ElyMark");
|
||||
assert!(own(&mark).ends_with(std::path::Path::new("engines/git").join(GIT)));
|
||||
std::fs::create_dir_all(apps.path().join("ElyTree.app/Contents/MacOS")).expect("ElyTree");
|
||||
let exe = mark.join("ely-mark");
|
||||
let missing = found(&exe, apps.path()).expect_err("no Git yet");
|
||||
assert!(missing.get_ref().is_some_and(|error| error.is::<NoGit>()), "{missing}");
|
||||
std::fs::create_dir_all(git.parent().expect("a folder")).expect("ElyTree's Git");
|
||||
std::fs::write(&git, "").expect("git");
|
||||
assert_eq!(own(&mark), mark.join("../../../ElyTree.app/Contents/Resources/git").join(GIT));
|
||||
same(found(&exe, apps.path()).expect("ElyTree's Git"), &git);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_windows_install_uses_elytrees_git() {
|
||||
let root = tempfile::tempdir().expect("a temp dir");
|
||||
let exe = root.path().join("Ely Office/ElyMark/ely-mark");
|
||||
let git = root.path().join("Ely Office/ElyTree/git").join(GIT);
|
||||
std::fs::create_dir_all(exe.parent().expect("a folder")).expect("ElyMark");
|
||||
assert!(found(&exe, root.path()).is_err(), "no Git yet");
|
||||
std::fs::create_dir_all(git.parent().expect("a folder")).expect("ElyTree's Git");
|
||||
std::fs::write(&git, "").expect("git");
|
||||
same(found(&exe, root.path()).expect("ElyTree's Git"), &git);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_built_git_comes_last() {
|
||||
let root = tempfile::tempdir().expect("a temp dir");
|
||||
let exe = root.path().join("app/ely-mark");
|
||||
let built = root.path().join("built").join(GIT);
|
||||
std::fs::create_dir_all(built.parent().expect("a folder")).expect("built");
|
||||
std::fs::write(&built, "").expect("git");
|
||||
same(found(&exe, root.path()).expect("the built Git"), &built);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ pub(super) const EN: &[(&str, &str)] = &[
|
||||
("mark.pane.search", "Search"),
|
||||
("mark.recent", "Recent"),
|
||||
("mark.recent.none", "Nothing opened yet"),
|
||||
("mark.recent.clear", "Clear Recent Files"),
|
||||
("mark.outline.none", "No headings"),
|
||||
("mark.search", "Results"),
|
||||
("mark.search.file", "This file"),
|
||||
@@ -82,6 +83,8 @@ pub(super) const EN: &[(&str, &str)] = &[
|
||||
("mark.git.ignored", "Git: ignored"),
|
||||
("mark.git.conflicted", "Git: conflicted"),
|
||||
("mark.git.unknown", "Git: unknown"),
|
||||
("mark.git.none", "Git: needs ElyTree"),
|
||||
("mark.git.needs", "Ely's Git comes with ElyTree. Install ElyTree from the Ely Office release to see this file's Git status."),
|
||||
("mark.git.open", "Show this file's history in ElyTree"),
|
||||
("mark.git.missing", "ElyTree is not installed. Install ElyTree from the Ely Office release to see this file's history."),
|
||||
("mark.git.failed", "ElyTree did not open: {error}"),
|
||||
@@ -106,6 +109,7 @@ pub(super) const ZH_CN: &[(&str, &str)] = &[
|
||||
("mark.pane.search", "搜索"),
|
||||
("mark.recent", "最近"),
|
||||
("mark.recent.none", "还没有打开过文件"),
|
||||
("mark.recent.clear", "清除最近文件"),
|
||||
("mark.outline.none", "没有标题"),
|
||||
("mark.search", "结果"),
|
||||
("mark.search.file", "本文件"),
|
||||
@@ -182,6 +186,8 @@ pub(super) const ZH_CN: &[(&str, &str)] = &[
|
||||
("mark.git.ignored", "Git:已忽略"),
|
||||
("mark.git.conflicted", "Git:有冲突"),
|
||||
("mark.git.unknown", "Git:未知"),
|
||||
("mark.git.none", "Git:需要 ElyTree"),
|
||||
("mark.git.needs", "Ely 的 Git 随 ElyTree 安装。请从 Ely Office 发行包安装 ElyTree 后查看此文件的 Git 状态。"),
|
||||
("mark.git.open", "在 ElyTree 中查看此文件的历史"),
|
||||
("mark.git.missing", "未安装 ElyTree。请从 Ely Office 发行包安装 ElyTree 后查看此文件的历史。"),
|
||||
("mark.git.failed", "ElyTree 没能打开:{error}"),
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
## 自有代码
|
||||
|
||||
Ely Office 的自有代码以 AGPL-3.0-or-later 发布,全文在仓库根的 `LICENSE`,并随每个应用包放在 `Resources/Licenses/LICENSE`。组件库 Ely-GPUI-Components 保留其 MIT/Apache-2.0。
|
||||
Ely Office 的自有代码以 MIT 发布,全文在仓库根的 `LICENSE`,并随每个应用包放在 `Resources/Licenses/LICENSE`。随包的引擎不随之改许可:ElyPDF 链接的 MuPDF 是 AGPL-3.0,ElyPDF 的发行包整体须按 AGPL 履行(对应源码见上游源码包);ElyDoc、ElyTable、ElyShow 的 LibreOffice 仍为 MPL-2.0 等;ElyTree 带的 Git 仍为 GPL-2.0。组件库 Ely-GPUI-Components 保留其 MIT/Apache-2.0。
|
||||
|
||||
## 每个发行版附带
|
||||
|
||||
@@ -12,7 +12,7 @@ Ely Office 的自有代码以 AGPL-3.0-or-later 发布,全文在仓库根的 `
|
||||
| --- | --- | --- |
|
||||
| `ElyOffice-<版本>-source.tar.gz` | 自有源码、`Cargo.lock`、`rust-toolchain.toml`、上游补丁(`patches/libreoffice`、`patches/mupdf`)、构建与取上游的脚本(各上游钉在提交,脚本里写明地址与散列)、测试、文档 | `packaging/macos/release.sh` |
|
||||
| `ElyOffice-<版本>-upstream-source.tar.gz` | 实际编译的 MuPDF 源码(钉住的提交加我们的补丁,AGPL)与随包 Git 的源码(v2.56.0,GPLv2) | 同上;`tests/scripts/release-macos.sh` 核对其中是打过补丁的 MuPDF |
|
||||
| 各应用包 `Resources/Licenses/` | Ely 的 AGPL 全文;`rust-crates.txt`(链进该应用各二进制的全部 crate 与其许可文件,无许可文件的取标准文本并写明作者);所带引擎的许可与通知(见下) | `packaging/licenses.sh`,缺任何一份即打包失败 |
|
||||
| 各应用包 `Resources/Licenses/` | Ely 的 MIT 全文;`rust-crates.txt`(链进该应用各二进制的全部 crate 与其许可文件,无许可文件的取标准文本并写明作者);所带引擎的许可与通知(见下) | `packaging/licenses.sh`,缺任何一份即打包失败 |
|
||||
|
||||
## 第三方,按应用
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@ case $slug in
|
||||
put KaTeX "$katex/fonts/OFL.txt" "$katex/fonts/FONT_NOTICE.txt"
|
||||
;;
|
||||
esac
|
||||
# ElyTree carries Git; on Windows and Linux ElyMark does too.
|
||||
if [ "$slug" = ely-tree ] || { [ "$slug" = ely-mark ] && [ "$(uname)" != Darwin ]; }; then
|
||||
# ElyTree carries Git; on Linux ElyMark does too.
|
||||
if [ "$slug" = ely-tree ] || { [ "$slug" = ely-mark ] && [ "$(uname)" = Linux ]; }; then
|
||||
case $(uname) in
|
||||
MINGW* | MSYS*) put Git "$root/engines/git/LICENSE.txt" ;;
|
||||
*) put Git "$root/engines/git-src/COPYING" "$root/engines/git-src/LGPL-2.1" ;;
|
||||
|
||||
@@ -18,6 +18,13 @@ row=$(awk -F'\t' -v slug="$slug" '$1 == slug { print $2 "\t" $3 }' "$root/packag
|
||||
}
|
||||
name=${row%%$'\t'*}
|
||||
categories=${row##*$'\t'}
|
||||
# Ely is MIT; bundled engines keep their licences.
|
||||
case $slug in
|
||||
ely-doc | ely-table | ely-show) license="MIT AND MPL-2.0" ;;
|
||||
ely-pdf) license="MIT AND AGPL-3.0-or-later" ;;
|
||||
ely-tree) license="MIT AND GPL-2.0-only" ;;
|
||||
*) license=MIT ;;
|
||||
esac
|
||||
# The types it opens, from packaging/types.tsv; none drops the line.
|
||||
mimes=$(awk -F'\t' -v slug="$slug" '$1 == slug && !seen[$3]++ { printf "%s;", $3 }' "$root/packaging/types.tsv")
|
||||
desktop_entry() {
|
||||
@@ -193,7 +200,7 @@ maintainer: ZacharyZhang
|
||||
vendor: ZacharyZhang
|
||||
description: $name, part of Ely Office
|
||||
homepage: https://git.zacharyzhang.com/ZacharyZhang-NY/ElyOffice
|
||||
license: AGPL-3.0-or-later
|
||||
license: $license
|
||||
contents:
|
||||
- src: $appdir/usr
|
||||
dst: /opt/ely-office/$slug
|
||||
|
||||
@@ -112,6 +112,9 @@ PLIST
|
||||
for target in ${inner[@]+"${inner[@]}"} "$app"; do
|
||||
if [ "$identity" = - ]; then
|
||||
codesign --force --sign - "$target"
|
||||
elif [ "$(basename "$target")" = ely-lok-worker ]; then
|
||||
# UNO's bridge maps its vtables with MAP_JIT.
|
||||
codesign --force --options runtime --timestamp --entitlements "$root/packaging/macos/lok-worker.entitlements" --sign "$identity" "$target"
|
||||
else
|
||||
codesign --force --options runtime --timestamp --sign "$identity" "$target"
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.allow-jit</key><true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -64,7 +64,8 @@ if [ "$slug" = ely-pdf ]; then
|
||||
mkdir "$out/tessdata"
|
||||
cp "$tessdata"/{eng,chi_sim,chi_tra}.traineddata "$out/tessdata/"
|
||||
fi
|
||||
if [ "$slug" = ely-tree ] || [ "$slug" = ely-mark ]; then
|
||||
# ElyTree carries Git; so does Linux ElyMark's standalone AppImage.
|
||||
if [ "$slug" = ely-tree ] || { [ "$slug" = ely-mark ] && [ "$(uname)" = Linux ]; }; then
|
||||
need "$root/engines/git" "scripts/build-git.sh and scripts/fetch-git-lfs.sh"
|
||||
cp -R "$root/engines/git" "$out/git"
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
# Prints what an install owns: files.sh <stage> <slug>
|
||||
set -euo pipefail
|
||||
|
||||
stage=${1:?staged folder from packaging/stage.sh}
|
||||
slug=${2:?app slug, such as ely-doc}
|
||||
cd "$stage"
|
||||
[ -z "$(find . -type l)" ] || {
|
||||
echo "files.sh: links in $stage" >&2
|
||||
exit 1
|
||||
}
|
||||
# Folders first, parents before children; then files.
|
||||
{
|
||||
find . -mindepth 1 -type d | sort | sed 's|$|/|'
|
||||
{ find . -type f; echo "./$slug.ico"; echo ./uninstall.exe; } | sort -u
|
||||
} | sed 's|^\./||' | while IFS= read -r path; do
|
||||
case $path in *\\* | *[[:cntrl:]]*)
|
||||
echo "files.sh: unsafe name $path" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
printf '%s\r\n' "${path//\//\\}"
|
||||
done
|
||||
@@ -1,4 +1,4 @@
|
||||
; Per-user installer; pass APP_NAME, APP_SLUG, VERSION, STAGE, ICON, TYPES.
|
||||
; Per-user installer; pass each define the checks below name.
|
||||
Unicode true
|
||||
!include "MUI2.nsh"
|
||||
|
||||
@@ -21,6 +21,9 @@ Unicode true
|
||||
!error "pass -DTYPES, from packaging/windows/types.sh"
|
||||
!endif
|
||||
!include "${TYPES}"
|
||||
!ifndef LIST
|
||||
!error "pass -DLIST, from packaging/windows/files.sh"
|
||||
!endif
|
||||
!ifndef OUTFILE
|
||||
!define OUTFILE "${APP_SLUG}-${VERSION}-setup.exe"
|
||||
!endif
|
||||
@@ -34,6 +37,7 @@ RequestExecutionLevel user
|
||||
InstallDir "$LOCALAPPDATA\Programs\Ely Office\${APP_NAME}"
|
||||
InstallDirRegKey HKCU "Software\Ely Office\${APP_NAME}" "InstallDir"
|
||||
SetCompressor /SOLID lzma
|
||||
AllowSkipFiles off
|
||||
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
@@ -45,11 +49,302 @@ SetCompressor /SOLID lzma
|
||||
LangString DeleteData ${LANG_SIMPCHINESE} "同时删除 ${APP_NAME} 的缓存、账号与本地历史吗?你的文档不受影响。"
|
||||
LangString DeleteData ${LANG_ENGLISH} "Also delete the cache, accounts and local history of ${APP_NAME}? Your documents stay."
|
||||
|
||||
LangString Busy ${LANG_SIMPCHINESE} "${APP_NAME} 的文件正被占用,未作任何改动。请关闭 ${APP_NAME} 后重试:"
|
||||
LangString Busy ${LANG_ENGLISH} "A file of ${APP_NAME} is in use; nothing was changed. Close ${APP_NAME} and try again:"
|
||||
LangString Stuck ${LANG_SIMPCHINESE} "旧版的文件放回原处失败,留在:"
|
||||
LangString Stuck ${LANG_ENGLISH} "Could not put the old files back; they are in:"
|
||||
LangString Left ${LANG_SIMPCHINESE} "新版已装好,旧版的文件删不掉,留在:"
|
||||
LangString Left ${LANG_ENGLISH} "The new version is installed; the old files could not be deleted from:"
|
||||
LangString NoList ${LANG_SIMPCHINESE} "找不到安装清单,未删除任何文件:"
|
||||
LangString NoList ${LANG_ENGLISH} "No install list found; nothing was deleted:"
|
||||
|
||||
LangString Taken ${LANG_SIMPCHINESE} "安装位置已有不属于 ${APP_NAME} 的文件,未作任何改动:"
|
||||
LangString Taken ${LANG_ENGLISH} "A file ${APP_NAME} did not install is in the way; nothing was changed:"
|
||||
|
||||
; Lists a legacy folder's files and folders to $R2.
|
||||
Function ElyWalk
|
||||
Push "|"
|
||||
Push $R1
|
||||
walk:
|
||||
Pop $R1
|
||||
StrCmp $R1 "|" done
|
||||
FileWrite $R2 "$R1\$\r$\n"
|
||||
FindFirst $R3 $R4 "$INSTDIR\$R1\*"
|
||||
entry:
|
||||
StrCmp $R4 "" closed
|
||||
StrCmp $R4 "." skip
|
||||
StrCmp $R4 ".." skip
|
||||
IfFileExists "$INSTDIR\$R1\$R4\*.*" 0 file
|
||||
Push "$R1\$R4"
|
||||
Goto skip
|
||||
file:
|
||||
FileWrite $R2 "$R1\$R4$\r$\n"
|
||||
skip:
|
||||
FindNext $R3 $R4
|
||||
Goto entry
|
||||
closed:
|
||||
FindClose $R3
|
||||
Goto walk
|
||||
done:
|
||||
FunctionEnd
|
||||
|
||||
!macro ElyLegacyDir NAME
|
||||
IfFileExists "$INSTDIR\${NAME}\*.*" 0 +3
|
||||
StrCpy $R1 "${NAME}"
|
||||
Call ElyWalk
|
||||
!macroend
|
||||
|
||||
!macro ElyLegacy ID PATTERN
|
||||
FindFirst $R3 $R4 "$INSTDIR\${PATTERN}"
|
||||
ely_legacy_${ID}:
|
||||
StrCmp $R4 "" ely_legacy_end_${ID}
|
||||
FileWrite $R2 "$R4$\r$\n"
|
||||
FindNext $R3 $R4
|
||||
Goto ely_legacy_${ID}
|
||||
ely_legacy_end_${ID}:
|
||||
FindClose $R3
|
||||
!macroend
|
||||
|
||||
; Sets $R0 to the list an earlier install owns.
|
||||
Function ElyOwned
|
||||
StrCpy $R0 ""
|
||||
StrCpy $R7 ""
|
||||
; A copy, as this install rewrites the list.
|
||||
IfFileExists "$INSTDIR\.ely-installed" 0 unlisted
|
||||
StrCpy $R0 "$PLUGINSDIR\owned.txt"
|
||||
StrCpy $R7 "listed"
|
||||
CopyFiles /SILENT "$INSTDIR\.ely-installed" "$R0"
|
||||
Goto done
|
||||
unlisted:
|
||||
; Older releases: only the folder our key names.
|
||||
ReadRegStr $R1 HKCU "Software\Ely Office\${APP_NAME}" "InstallDir"
|
||||
StrCmp $R1 "$INSTDIR" 0 done
|
||||
IfFileExists "$INSTDIR\${APP_SLUG}.exe" 0 done
|
||||
StrCpy $R0 "$PLUGINSDIR\legacy.txt"
|
||||
FileOpen $R2 "$R0" w
|
||||
!insertmacro ElyLegacyDir libreoffice
|
||||
!insertmacro ElyLegacyDir tessdata
|
||||
!insertmacro ElyLegacyDir git
|
||||
!insertmacro ElyLegacyDir content
|
||||
!insertmacro ElyLegacyDir locales
|
||||
!insertmacro ElyLegacyDir licenses
|
||||
FileWrite $R2 "${APP_SLUG}.ico$\r$\n"
|
||||
!insertmacro ElyLegacy exe "*.exe"
|
||||
!insertmacro ElyLegacy dll "*.dll"
|
||||
!insertmacro ElyLegacy pak "*.pak"
|
||||
!insertmacro ElyLegacy bin "*.bin"
|
||||
!insertmacro ElyLegacy dat "*.dat"
|
||||
!insertmacro ElyLegacy json "*.json"
|
||||
FileClose $R2
|
||||
done:
|
||||
FunctionEnd
|
||||
|
||||
!macro ElyAside UN
|
||||
; Next line of $R2: path $R3, kind $R6.
|
||||
Function ${UN}ElyNext
|
||||
next:
|
||||
ClearErrors
|
||||
FileRead $R2 $R3
|
||||
IfErrors 0 trim
|
||||
StrCpy $R6 ""
|
||||
Return
|
||||
trim:
|
||||
StrCpy $R6 "$R3" 1 -1
|
||||
StrCmp $R6 "$\r" cut
|
||||
StrCmp $R6 "$\n" cut
|
||||
StrCmp $R3 "" next
|
||||
StrCmp $R6 "\" 0 +4
|
||||
StrCpy $R3 "$R3" -1
|
||||
StrCpy $R6 "d"
|
||||
Return
|
||||
StrCpy $R6 "f"
|
||||
Return
|
||||
cut:
|
||||
StrCpy $R3 "$R3" -1
|
||||
Goto trim
|
||||
FunctionEnd
|
||||
|
||||
; Removes the empty folders $R0 lists under $R1.
|
||||
Function ${UN}ElyPrune
|
||||
pass:
|
||||
StrCpy $8 ""
|
||||
FileOpen $R2 "$R0" r
|
||||
next:
|
||||
Call ${UN}ElyNext
|
||||
StrCmp $R6 "" passed
|
||||
StrCmp $R6 "f" next
|
||||
IfFileExists "$R1\$R3\*.*" 0 next
|
||||
ClearErrors
|
||||
RMDir "$R1\$R3"
|
||||
IfErrors next
|
||||
StrCpy $8 "again"
|
||||
Goto next
|
||||
passed:
|
||||
FileClose $R2
|
||||
StrCmp $8 "again" pass
|
||||
FunctionEnd
|
||||
|
||||
; Moves $R0's files to numbered .ely-old entries; $R5: blocker.
|
||||
Function ${UN}ElyAside
|
||||
StrCpy $R5 ""
|
||||
StrCpy $R9 "$INSTDIR\.ely-old"
|
||||
RMDir /r "$R9"
|
||||
IfFileExists "$R9" 0 +3
|
||||
StrCpy $R5 "$R9"
|
||||
Return
|
||||
ClearErrors
|
||||
FileOpen $R2 "$R0" r
|
||||
IfErrors 0 check
|
||||
StrCpy $R5 "$R0"
|
||||
Return
|
||||
check:
|
||||
; Every file first: running or locked ones refuse writing.
|
||||
Call ${UN}ElyNext
|
||||
StrCmp $R6 "" checked
|
||||
StrCmp $R6 "d" check
|
||||
IfFileExists "$INSTDIR\$R3\*.*" check
|
||||
IfFileExists "$INSTDIR\$R3" 0 check
|
||||
ClearErrors
|
||||
FileOpen $R4 "$INSTDIR\$R3" a
|
||||
IfErrors refused
|
||||
FileClose $R4
|
||||
Goto check
|
||||
checked:
|
||||
CreateDirectory "$R9"
|
||||
FileSeek $R2 0 SET
|
||||
; Numbered names keep backup paths short.
|
||||
StrCpy $9 0
|
||||
move:
|
||||
Call ${UN}ElyNext
|
||||
StrCmp $R6 "" moved
|
||||
StrCmp $R6 "d" move
|
||||
IntOp $9 $9 + 1
|
||||
IfFileExists "$INSTDIR\$R3\*.*" move
|
||||
IfFileExists "$INSTDIR\$R3" 0 move
|
||||
ClearErrors
|
||||
Rename "$INSTDIR\$R3" "$R9\$9"
|
||||
IfErrors 0 move
|
||||
StrCpy $R5 "$INSTDIR\$R3"
|
||||
FileClose $R2
|
||||
Call ${UN}ElyBack
|
||||
Return
|
||||
moved:
|
||||
FileClose $R2
|
||||
Return
|
||||
refused:
|
||||
StrCpy $R5 "$INSTDIR\$R3"
|
||||
FileClose $R2
|
||||
FunctionEnd
|
||||
|
||||
; Puts $R0's files back from .ely-old.
|
||||
Function ${UN}ElyBack
|
||||
FileOpen $R2 "$R0" r
|
||||
StrCpy $9 0
|
||||
back:
|
||||
Call ${UN}ElyNext
|
||||
StrCmp $R6 "" done
|
||||
StrCmp $R6 "d" back
|
||||
IntOp $9 $9 + 1
|
||||
IfFileExists "$R9\$9" 0 back
|
||||
Rename "$R9\$9" "$INSTDIR\$R3"
|
||||
Goto back
|
||||
done:
|
||||
FileClose $R2
|
||||
RMDir "$R9"
|
||||
IfFileExists "$R9" 0 +2
|
||||
MessageBox MB_ICONSTOP "$(Stuck)$\r$\n$R9" /SD IDOK
|
||||
FunctionEnd
|
||||
!macroend
|
||||
!insertmacro ElyAside ""
|
||||
!insertmacro ElyAside "un."
|
||||
|
||||
; Sets $R5 to a path in the way.
|
||||
Function ElyClear
|
||||
StrCpy $R5 ""
|
||||
FileOpen $R2 "$PLUGINSDIR\new.txt" r
|
||||
FileOpen $7 "$PLUGINSDIR\made.txt" w
|
||||
next:
|
||||
Call ElyNext
|
||||
StrCmp $R6 "" done
|
||||
StrCmp $R6 "d" folder
|
||||
IfFileExists "$INSTDIR\$R3" taken next
|
||||
folder:
|
||||
IfFileExists "$INSTDIR\$R3\*.*" next
|
||||
IfFileExists "$INSTDIR\$R3" taken
|
||||
FileWrite $7 "$R3\$\r$\n"
|
||||
Goto next
|
||||
taken:
|
||||
StrCpy $R5 "$INSTDIR\$R3"
|
||||
done:
|
||||
FileClose $7
|
||||
FileClose $R2
|
||||
FunctionEnd
|
||||
|
||||
; Removes what this install wrote, then restores the old.
|
||||
Function .onInstFailed
|
||||
StrCmp $R8 "copying" 0 done
|
||||
FileOpen $R2 "$PLUGINSDIR\new.txt" r
|
||||
drop:
|
||||
Call ElyNext
|
||||
StrCmp $R6 "" dropped
|
||||
StrCmp $R6 "d" drop
|
||||
Delete "$INSTDIR\$R3"
|
||||
Goto drop
|
||||
dropped:
|
||||
FileClose $R2
|
||||
Delete "$INSTDIR\.ely-installed"
|
||||
Push $R0
|
||||
StrCpy $R0 "$PLUGINSDIR\made.txt"
|
||||
StrCpy $R1 "$INSTDIR"
|
||||
Call ElyPrune
|
||||
Pop $R0
|
||||
StrCmp $R0 "" done
|
||||
Call ElyBack
|
||||
StrCmp $R7 "listed" 0 done
|
||||
CopyFiles /SILENT "$R0" "$INSTDIR\.ely-installed"
|
||||
done:
|
||||
FunctionEnd
|
||||
|
||||
Section "Install"
|
||||
InitPluginsDir
|
||||
SetOutPath "$PLUGINSDIR"
|
||||
File "/oname=new.txt" "${LIST}"
|
||||
; An earlier install moves aside whole, or nothing changes.
|
||||
Call ElyOwned
|
||||
StrCmp $R0 "" clear
|
||||
Call ElyAside
|
||||
StrCmp $R5 "" clear
|
||||
MessageBox MB_ICONSTOP "$(Busy)$\r$\n$R5" /SD IDOK
|
||||
SetErrorLevel 2
|
||||
Quit
|
||||
clear:
|
||||
; Never write over a file this app did not install.
|
||||
Call ElyClear
|
||||
StrCmp $R5 "" copy
|
||||
StrCmp $R0 "" +2
|
||||
Call ElyBack
|
||||
MessageBox MB_ICONSTOP "$(Taken)$\r$\n$R5" /SD IDOK
|
||||
SetErrorLevel 2
|
||||
Quit
|
||||
copy:
|
||||
StrCpy $R8 "copying"
|
||||
; A file that cannot be written fails the install.
|
||||
ClearErrors
|
||||
SetOutPath "$INSTDIR"
|
||||
File /r "${STAGE}\*.*"
|
||||
File "/oname=${APP_SLUG}.ico" "${ICON}"
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
CopyFiles /SILENT "$PLUGINSDIR\new.txt" "$INSTDIR\.ely-installed"
|
||||
IfErrors 0 +2
|
||||
Abort
|
||||
StrCpy $R8 ""
|
||||
; Old folders the new release leaves empty.
|
||||
StrCmp $R0 "" +3
|
||||
StrCpy $R1 "$INSTDIR"
|
||||
Call ElyPrune
|
||||
RMDir /r "$INSTDIR\.ely-old"
|
||||
IfFileExists "$INSTDIR\.ely-old" 0 +2
|
||||
MessageBox MB_ICONEXCLAMATION "$(Left)$\r$\n$INSTDIR\.ely-old" /SD IDOK
|
||||
CreateShortcut "$SMPROGRAMS\${APP_NAME}.lnk" "$INSTDIR\${APP_SLUG}.exe" "" "$INSTDIR\${APP_SLUG}.ico"
|
||||
WriteRegStr HKCU "Software\Ely Office\${APP_NAME}" "InstallDir" "$INSTDIR"
|
||||
WriteRegStr HKCU "${UNINSTALL_KEY}" "DisplayName" "${APP_NAME}"
|
||||
@@ -63,26 +358,42 @@ Section "Install"
|
||||
SectionEnd
|
||||
|
||||
Section "Uninstall"
|
||||
; What stage.sh lays out, and nothing else.
|
||||
RMDir /r "$INSTDIR\libreoffice"
|
||||
RMDir /r "$INSTDIR\tessdata"
|
||||
RMDir /r "$INSTDIR\git"
|
||||
RMDir /r "$INSTDIR\content"
|
||||
RMDir /r "$INSTDIR\locales"
|
||||
RMDir /r "$INSTDIR\licenses"
|
||||
Delete "$INSTDIR\*.exe"
|
||||
Delete "$INSTDIR\*.dll"
|
||||
Delete "$INSTDIR\*.pak"
|
||||
Delete "$INSTDIR\*.bin"
|
||||
Delete "$INSTDIR\*.dat"
|
||||
Delete "$INSTDIR\*.json"
|
||||
Delete "$INSTDIR\${APP_SLUG}.ico"
|
||||
StrCpy $R5 "$INSTDIR\.ely-installed"
|
||||
IfFileExists "$R5" listed
|
||||
MessageBox MB_ICONSTOP "$(NoList)$\r$\n$INSTDIR" /SD IDOK
|
||||
SetErrorLevel 2
|
||||
Quit
|
||||
listed:
|
||||
; The list is checked too, before anything moves.
|
||||
ClearErrors
|
||||
FileOpen $R4 "$R5" a
|
||||
IfErrors busy
|
||||
FileClose $R4
|
||||
InitPluginsDir
|
||||
StrCpy $R0 "$PLUGINSDIR\owned.txt"
|
||||
CopyFiles /SILENT "$R5" "$R0"
|
||||
Call un.ElyAside
|
||||
StrCmp $R5 "" gone busy
|
||||
gone:
|
||||
ClearErrors
|
||||
Delete "$INSTDIR\.ely-installed"
|
||||
IfErrors 0 deleted
|
||||
Call un.ElyBack
|
||||
StrCpy $R5 "$INSTDIR\.ely-installed"
|
||||
busy:
|
||||
MessageBox MB_ICONSTOP "$(Busy)$\r$\n$R5" /SD IDOK
|
||||
SetErrorLevel 2
|
||||
Quit
|
||||
deleted:
|
||||
RMDir /r "$INSTDIR\.ely-old"
|
||||
StrCpy $R1 "$INSTDIR"
|
||||
Call un.ElyPrune
|
||||
RMDir "$INSTDIR"
|
||||
Delete "$SMPROGRAMS\${APP_NAME}.lnk"
|
||||
DeleteRegKey HKCU "Software\Ely Office\${APP_NAME}"
|
||||
DeleteRegKey HKCU "${UNINSTALL_KEY}"
|
||||
!insertmacro ElyTypesUninstall
|
||||
MessageBox MB_YESNO|MB_DEFBUTTON2 "$(DeleteData)" IDNO done
|
||||
MessageBox MB_YESNO|MB_DEFBUTTON2 "$(DeleteData)" /SD IDNO IDNO done
|
||||
RMDir /r "$LOCALAPPDATA\ElyOffice\${APP_SLUG}"
|
||||
done:
|
||||
SectionEnd
|
||||
@@ -20,10 +20,12 @@ stage=$root/target/stage/$slug
|
||||
"$root/packaging/stage.sh" "$slug" "$stage"
|
||||
types=$root/target/stage/$slug-types.nsh
|
||||
"$root/packaging/windows/types.sh" "$slug" >"$types"
|
||||
list=$root/target/stage/$slug-files.txt
|
||||
"$root/packaging/windows/files.sh" "$stage" "$slug" >"$list"
|
||||
mkdir -p "$dist"
|
||||
out=$dist/$name-$version-windows-x86_64-setup.exe
|
||||
"$makensis" -V2 -INPUTCHARSET UTF8 -DAPP_NAME="$name" -DAPP_SLUG="$slug" -DVERSION="$version" \
|
||||
-DSTAGE="$(cygpath -w "$stage")" -DICON="$(cygpath -w "$root/assets/icons/$slug.ico")" \
|
||||
-DTYPES="$(cygpath -w "$types")" -DOUTFILE="$(cygpath -w "$out")" \
|
||||
-DTYPES="$(cygpath -w "$types")" -DLIST="$(cygpath -w "$list")" -DOUTFILE="$(cygpath -w "$out")" \
|
||||
"$(cygpath -w "$root/packaging/windows/installer.nsi")"
|
||||
echo "$out"
|
||||
@@ -36,7 +36,7 @@ fetch() { # name url rev [sparse paths...]
|
||||
echo "fetch $name $rev"
|
||||
}
|
||||
|
||||
fetch Ely-GPUI-Components https://git.zacharyzhang.com/ZacharyZhang-NY/Ely-GPUI-Components.git 2b8bd9fcf3ab94a3399ca70bfaf0a6764291f5ec
|
||||
fetch Ely-GPUI-Components https://git.zacharyzhang.com/ZacharyZhang-NY/Ely-GPUI-Components.git 5a53c08c844210ea80c6a92aec708e2de8ffa721
|
||||
fetch zed https://github.com/zed-industries/zed.git 1a28cff4b409169bac058bca40dfbfeb7621d19b
|
||||
fetch libreoffice-core https://github.com/LibreOffice/core.git 8221e31b3ac356a1623c672912a3d2b492f7e3d1 \
|
||||
include/LibreOfficeKit libreofficekit desktop/source/lib desktop/inc \
|
||||
|
||||
@@ -10,7 +10,7 @@ const en = {
|
||||
ElyTree: "Stage lines, commit, read the graph. Git without a terminal.",
|
||||
ElyMark: "Markdown as you read it. Math and diagrams in place.",
|
||||
offline: "Works with the network off.",
|
||||
open: "Open source, under the AGPL.",
|
||||
open: "Open source, under the MIT licence.",
|
||||
local: "Your files stay in your folders.",
|
||||
download: "Download",
|
||||
platforms: "Out now for macOS, Windows and Linux.",
|
||||
@@ -48,7 +48,7 @@ const zh: typeof en = {
|
||||
ElyTree: "按行暂存、提交、看提交图。不用终端的 Git。",
|
||||
ElyMark: "写的就是看到的 Markdown。公式与图表就地显示。",
|
||||
offline: "断网照常工作。",
|
||||
open: "开源,AGPL 许可。",
|
||||
open: "开源,MIT 许可。",
|
||||
local: "文件留在你自己的文件夹里。",
|
||||
download: "下载",
|
||||
platforms: "macOS、Windows 与 Linux 版已发布。",
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
node_modules
|
||||
out
|
||||
public/footage
|
||||
public/fonts/*.ttf
|
||||
public/fonts/*.otf
|
||||
node_modules
|
||||
public/audio
|
||||
__pycache__
|
||||
@@ -0,0 +1,26 @@
|
||||
# Ely Office 0.1.5 更新日志
|
||||
|
||||
## 全部应用
|
||||
- 二级菜单更好选:鼠标斜着移向子菜单时,路过的项不再抢先弹出;子菜单右侧放不下时改在左侧打开。
|
||||
- 应用已开着时再打开文件,直接在原窗口开成新标签,不再提示“已在运行”。
|
||||
- 中文显示统一:Windows 上同一个词不再一半粗一半细;界面里残留的英文改为中文。
|
||||
- macOS 安装包已签名并经 Apple 公证,打开时不再提示“无法验证开发者”。
|
||||
|
||||
## ElyMark
|
||||
- 表格可以在格内直接编辑:点哪格开哪格,Tab 与方向键在格间移动,回车或 Esc 写回。
|
||||
- 右键菜单随所点的内容变化:剪贴板、复制为 Markdown / HTML / 纯文本、格式、段落、表格、图片。
|
||||
- “段落”“格式”菜单与快捷键和 Typora 一致(如 Ctrl+1–6 设标题)。
|
||||
- 支持 `:表情:`、GitHub 提示块、`[toc]` 目录、front matter 与常用行内 HTML。
|
||||
- 侧栏可清除最近文件,重启后仍保持清空。
|
||||
|
||||
## ElyDoc
|
||||
- 右键菜单照 Word:正文、表格、图片各有对应的菜单。
|
||||
- 拖动表格边线即可调整列宽与行高。
|
||||
- 光标在表格里时,属性栏把表格设置排在最前。
|
||||
|
||||
## ElyTable
|
||||
- 右键菜单照 Excel:单元格、行列表头、图形各有对应的菜单。
|
||||
|
||||
## ElyShow
|
||||
- 右键菜单照 PowerPoint;表格边线可以拖动。
|
||||
- 左侧幻灯片缩略图条可以用滚轮滚动(修复 Linux Wayland 上的问题)。
|
||||
@@ -0,0 +1,50 @@
|
||||
# Ely Office 0.1.5 更新视频:规格
|
||||
|
||||
60.000 秒,1920×1080,60 fps,3600 帧。96 BPM,4/4:一拍 0.625 秒(37.5 帧),一小节 2.5 秒(150 帧),共 24 小节。段落切换都落在小节强拍上。
|
||||
|
||||
画面以**真实操作录屏**为主(已安装的 0.1.5,Windows,深色主题,中文界面)。录屏放在居中的“舞台”里,镜头在舞台内跟随指针平滑推近(像 Screen Studio)。段落之间用形变(shape morph)过渡:舞台收拢、变形成下一个应用的图标轮廓,再展开成下一个舞台。节奏从容,不快闪:任何画面至少停留一拍,形变用 0.6–1 秒。
|
||||
|
||||
## 时间表
|
||||
|
||||
| 小节 | 帧 | 段落 | 内容 |
|
||||
| --- | --- | --- | --- |
|
||||
| 1–2 | 0–300 | 开场 | 一个点在拍上呼吸,形变成六个应用图标的轮廓依次(每个至少一拍),最后化为“Ely Office 0.1.5”与“更顺手的一次更新”;第 3 小节强拍展开成第一个舞台 |
|
||||
| 3–6 | 300–900 | 菜单 | ElyMark 右键 → 表格 ▸,指针斜穿“插入”行进入子菜单,子菜单不被抢走;安全三角叠在录屏上 |
|
||||
| 7–10 | 900–1500 | 表格格内编辑 | ElyMark 点格即在格内编辑原文,Tab 到下一格,回车写回 |
|
||||
| 11–16 | 1500–2400 | 右键照 Word / Excel / PowerPoint | ElyDoc(表格右键、插入行、拖边线)、ElyTable(表头右键)、ElyShow(缩略图滚轮、表格右键) |
|
||||
| 17–21 | 2400–3150 | 还有 | 再开文件进同一窗口、清除最近文件、中文字形统一、macOS 已公证 |
|
||||
| 22–24 | 3150–3600 | 结尾 | 舞台收拢成点,再展开成六个图标与“Ely Office 0.1.5”、平台与下载地址;第 24 小节末结束 |
|
||||
|
||||
音乐的能量:开场渐起(无鼓),第 3 小节进入律动,第 11 小节加厚,第 17 小节最高,第 22 小节强拍落定后渐弱到 60 秒收尾。每个段落切换前有半小节的上扬(riser),强拍上有柔和的冲击(impact)。
|
||||
|
||||
## 视觉
|
||||
|
||||
- 底色 `#1c1c1e` 到 `#252525` 的极轻径向渐变,细微颗粒;舞台外不放杂物。
|
||||
- 强调色 `#3D7FE5`(ElyDoc 蓝);各应用色:Doc `#3D7FE5`,Table `#2E9E5B`,Show `#F07B2A`,PDF `#E0344F`,Tree `#7E57C2`,Mark `#3E4A5C`(点缀 `#F2A900`)。
|
||||
- 字体:中文 Noto Sans SC(`public/fonts/NotoSansSC.ttf`,可变字重),西文 Inter,等宽 JetBrains Mono。
|
||||
- 舞台:`STAGE = { x: 120, y: 118, w: 1680, h: 945 }`,圆角 18,1px `rgba(255,255,255,0.08)` 描边,柔和的大投影。录屏 2048×1152,按舞台宽缩放(0.8203)。
|
||||
- 段落标题在舞台上方左侧(y 30–100):中文大字 + 一行小字说明。
|
||||
- 动效:缓动用 `Easing.bezier(0.22, 1, 0.36, 1)`(出)与 `(0.65, 0, 0.35, 1)`(进出);弹簧 `damping 200`;无闪烁,无高频抖动。
|
||||
|
||||
## 代码结构(Remotion)
|
||||
|
||||
```text
|
||||
src/index.ts registerRoot
|
||||
src/Root.tsx <Composition id="Update" …>
|
||||
src/Video.tsx 各段 <Sequence>,音乐与音效
|
||||
src/theme.ts 帧、节拍、颜色、STAGE、字体
|
||||
src/design/ 共用:Stage、Heading、Caption、KeyCap、Morph、背景、字体加载
|
||||
src/scenes/Intro.tsx 开场
|
||||
src/scenes/Outro.tsx 结尾
|
||||
src/scenes/Menus.tsx … 录屏段落(由主导者写)
|
||||
src/footage/ 录屏的镜头跟随、事件读入
|
||||
public/footage/ 录屏与事件日志(不入库)
|
||||
public/audio/ music.wav 与音效
|
||||
```
|
||||
|
||||
`Stage` 负责舞台的外框、裁切与进出形变:`<Stage enter={{ from: 'ely-mark' }} exit={{ to: 'ely-doc' }}>{录屏}</Stage>`;进场时从图标轮廓(flubber 插值)展开成圆角矩形,出场时收拢成下一个图标的轮廓。裁切用 CSS `clip-path: path(...)`,录屏画在其中。
|
||||
|
||||
## 音频
|
||||
|
||||
- `public/audio/music.wav`:48 kHz 立体声,恰 60.000 秒,响度约 −16 LUFS,峰值 ≤ −1 dBTP,原创合成,无版权素材。
|
||||
- `public/audio/sfx/`:`click.wav`(轻点击)、`menu.wav`(菜单弹出的轻“嗒”)、`key.wav`(键入)、`whoosh.wav`(形变)、`impact.wav`(强拍落定)、`tick.wav`(细小提示)。都短、干净、不刺耳。
|
||||
@@ -0,0 +1,3 @@
|
||||
# Audio
|
||||
|
||||
`build.py` (score in `compose.py`, UI sounds in `sfx.py`) writes `public/audio/music.wav` (48 kHz, 24-bit stereo, 2,880,000 samples, 96 BPM, 24 bars of 2.5 s in F major) and the six UI sounds in `public/audio/sfx/`; it is deterministic (fixed seeds) and needs numpy, scipy, pedalboard (GPL-3.0, used only as a tool, its output is unencumbered) and pyloudnorm (MIT). Structure: bars 1–2 a rising felt-piano line over a Bb–Csus pad swell, no drums; bar 3 the groove enters (half-time kick, brushed snare on 2 and 4, eighth hats, sub bass, eighth-note pluck arpeggio, piano motif over F–Dm–Bb–C); bar 7 a lift (shaker, busier bass, motif answered higher, FM bell counter-line); bar 11 thicker (sixteenth arpeggio, octave strings, ghost snares, motif B through Gm–Csus); bar 17 the peak (four-on-the-floor, open hats, melody in octaves over Bb–C–Am–Dm–Gm–C); bar 22 a resolving Fadd9 hit with the drums gone, then piano echoes decaying to silence by 59.4 s. A half-bar riser (swept noise plus a reversed swell of the next chord) precedes the downbeats of bars 3, 7, 11, 17 and 22, each carrying a soft sub impact; drums stop in the half-bar before each for space (snare rolls before 17 and 22). Every sound is synthesized here (additive felt piano, polyBLEP saw pads, additive plucks, FM bells, synthesized drums, convolution reverb from a generated impulse); no samples, soundfonts or existing melodies are used. Mix: kick-keyed ducking on pads, bass, arp and reverb, a 2.6 kHz dip so UI sounds sit on top, section gain rides, bus compression, soft saturation and a 4×-oversampled look-ahead limiter; the result is normalized to −16 LUFS.
|
||||
@@ -0,0 +1,19 @@
|
||||
import numpy as np
|
||||
|
||||
from compose import OUT, SR, Mix, master, score, true_peak, write
|
||||
from sfx import sfx
|
||||
|
||||
|
||||
def main():
|
||||
mix = Mix()
|
||||
kicks = score(mix)
|
||||
x, lufs, stems = master(mix, kicks)
|
||||
write(OUT / "music.wav", x)
|
||||
print(f"music: {len(x) / SR:.3f} s, {lufs:.2f} LUFS, true peak {20 * np.log10(true_peak(x)):.2f} dBTP")
|
||||
print("stems (dB RMS):", {k: round(v, 1) for k, v in stems.items()})
|
||||
# Shares compose's generator, so runs after the music.
|
||||
sfx()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,496 @@
|
||||
# Usage: .work/video015/venv/Scripts/python.exe site/video/update-0.1.5/audio/compose.py
|
||||
"""Music bed (96 BPM, 24 bars, 60 s) and UI sounds for the 0.1.5 update video."""
|
||||
import wave
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
import pedalboard as pb
|
||||
import pyloudnorm as pyln
|
||||
from scipy import signal
|
||||
from scipy.ndimage import minimum_filter1d, uniform_filter1d
|
||||
|
||||
SR = 48000
|
||||
BEAT = 30000
|
||||
BAR = 4 * BEAT
|
||||
N = 24 * BAR
|
||||
TAIL = 8 * SR
|
||||
OUT = Path(__file__).resolve().parent.parent / "public" / "audio"
|
||||
TARGET_LUFS = -16.0
|
||||
CEILING_DB = -1.4
|
||||
LIFTS = (3, 7, 11, 17, 22)
|
||||
BREAKS = (6, 10, 16, 21)
|
||||
GAINS = {"piano": 0.86, "pad": 0.245, "strings": 0.13, "arp": 0.14, "bell": 0.12,
|
||||
"bass": 0.16, "kick": 0.52, "snare": 0.64, "hats": 0.17, "fx": 0.37}
|
||||
rng = np.random.default_rng(105)
|
||||
|
||||
# chord: bass root, pad voicing, arp tones, piano left hand
|
||||
CHORDS = {
|
||||
"Bb": (34, [50, 57, 60, 62, 65], [62, 65, 69, 74], [46, 53, 62]),
|
||||
"Csus": (36, [55, 60, 65, 67, 72], [65, 67, 72, 74], [48, 55, 65]),
|
||||
"C": (36, [55, 60, 62, 64, 69], [64, 67, 72, 74], [48, 55, 64]),
|
||||
"F": (41, [53, 60, 64, 67, 69], [65, 69, 72, 76], [41, 48, 57]),
|
||||
"Dm": (38, [50, 57, 60, 65, 69], [62, 65, 69, 72], [50, 57, 65]),
|
||||
"Gm": (31, [53, 57, 58, 62, 65], [62, 65, 70, 74], [43, 50, 58]),
|
||||
"Am": (33, [52, 55, 60, 64, 67], [64, 67, 69, 72], [45, 52, 60]),
|
||||
"Fend": (29, [53, 60, 65, 67, 69, 72], [], [41, 48, 57, 65]),
|
||||
}
|
||||
CHANGES = [(0, "Bb"), (4, "Csus"), (8, "F"), (12, "Dm"), (16, "Bb"), (20, "C"),
|
||||
(24, "F"), (28, "Dm"), (32, "Bb"), (36, "C"), (40, "F"), (44, "Dm"),
|
||||
(48, "Bb"), (52, "C"), (56, "Gm"), (60, "Csus"), (62, "C"), (64, "Bb"),
|
||||
(68, "C"), (72, "Am"), (76, "Dm"), (80, "Gm"), (82, "Csus"), (84, "Fend")]
|
||||
|
||||
MEL_A = [(0, 72, 1.5, .62), (1.5, 77, .5, .5), (2, 76, 1, .55), (3, 72, 1, .46),
|
||||
(4, 74, 1.5, .6), (5.5, 69, .5, .46), (6, 72, 2, .55)]
|
||||
MEL_A1 = MEL_A + [(8, 74, 1.5, .6), (9.5, 77, .5, .5), (10, 76, 1, .55), (11, 72, 1, .46),
|
||||
(12, 67, 1.5, .55), (13.5, 72, .5, .46), (14, 74, 1, .5), (15, 76, 1, .48)]
|
||||
MEL_A2 = MEL_A + [(8, 74, 1.5, .62), (9.5, 77, .5, .52), (10, 81, 1, .6), (11, 79, 1, .52),
|
||||
(12, 76, 1.5, .58), (13.5, 74, .5, .48), (14, 72, 2, .55)]
|
||||
MEL_B = [(0, 77, 1, .66), (1, 76, .5, .5), (1.5, 72, 1, .55), (2.5, 69, .5, .48),
|
||||
(3, 72, 1, .52), (4, 74, 1, .62), (5, 72, .5, .5), (5.5, 69, 1, .52),
|
||||
(6.5, 65, .5, .45), (7, 69, 1, .5), (8, 74, 1, .62), (9, 77, .5, .52),
|
||||
(9.5, 81, 1.5, .62), (11, 79, 1, .52), (12, 76, 1.5, .6), (13.5, 74, .5, .5),
|
||||
(14, 72, 1, .52), (15, 74, 1, .5), (16, 77, 1.5, .62), (17.5, 74, .5, .5),
|
||||
(18, 70, 1, .52), (19, 72, 1, .5), (20, 74, 2, .58), (22, 76, 1, .6), (23, 79, 1, .66)]
|
||||
MEL_D = [(0, 81, 1.5, .72), (1.5, 79, .5, .56), (2, 77, 1, .62), (3, 74, 1, .56),
|
||||
(4, 76, 1.5, .68), (5.5, 72, .5, .52), (6, 79, 2, .64), (8, 76, 1.5, .68),
|
||||
(9.5, 72, .5, .52), (10, 74, 1, .58), (11, 76, 1, .56), (12, 77, 1.5, .68),
|
||||
(13.5, 76, .5, .54), (14, 74, 1, .58), (15, 72, 1, .54), (16, 74, 1.5, .64),
|
||||
(17.5, 77, .5, .56), (18, 76, 2, .62)]
|
||||
INTRO = [(0, 65, .3), (1, 69, .33), (2, 72, .36), (3, 74, .4),
|
||||
(4, 67, .42), (5, 72, .46), (6, 74, .5), (7, 77, .54)]
|
||||
BELLS = [(26.5, 81), (30.5, 79), (34.5, 81), (66.5, 84), (70.5, 84), (74.5, 81), (78.5, 81)]
|
||||
|
||||
|
||||
def hz(m):
|
||||
return 440.0 * 2 ** ((m - 69) / 12)
|
||||
|
||||
|
||||
def sample(beat):
|
||||
return int(round(beat * BEAT))
|
||||
|
||||
|
||||
def secs(n):
|
||||
return np.arange(n) / SR
|
||||
|
||||
|
||||
def filt(x, kind, f, order=2):
|
||||
return signal.sosfilt(signal.butter(order, f, kind, fs=SR, output="sos"), x, axis=0)
|
||||
|
||||
|
||||
def peaking(x, f0, gain_db, q):
|
||||
a, w = 10 ** (gain_db / 40), 2 * np.pi * f0 / SR
|
||||
alpha = np.sin(w) / (2 * q)
|
||||
b = [1 + alpha * a, -2 * np.cos(w), 1 - alpha * a]
|
||||
d = [1 + alpha / a, -2 * np.cos(w), 1 - alpha / a]
|
||||
return signal.lfilter(np.array(b) / d[0], np.array(d) / d[0], x, axis=0)
|
||||
|
||||
|
||||
def sweep(x, cutoff, kind, order=2, block=512):
|
||||
"""Filter whose corner follows cutoff(seconds); state carries across blocks."""
|
||||
y, zi = np.empty_like(x), None
|
||||
for s in range(0, len(x), block):
|
||||
e = min(s + block, len(x))
|
||||
sos = signal.butter(order, cutoff((s + e) / 2 / SR), kind, fs=SR, output="sos")
|
||||
if zi is None:
|
||||
zi = np.zeros((sos.shape[0], 2) + x.shape[1:])
|
||||
y[s:e], zi = signal.sosfilt(sos, x[s:e], axis=0, zi=zi)
|
||||
return y
|
||||
|
||||
|
||||
def curve(points, log=False):
|
||||
ts, vs = np.array(points).T
|
||||
vs = np.log(vs) if log else vs
|
||||
return lambda t: np.exp(np.interp(t, ts, vs)) if log else np.interp(t, ts, vs)
|
||||
|
||||
|
||||
def edges(x, a=0.003, r=0.02):
|
||||
x = x.copy()
|
||||
ai, ri = max(2, int(a * SR)), max(2, int(r * SR))
|
||||
up, down = np.linspace(0, 1, ai), np.linspace(1, 0, ri)
|
||||
if x.ndim == 2:
|
||||
up, down = up[:, None], down[:, None]
|
||||
x[:ai] *= up
|
||||
x[-ri:] *= down
|
||||
return x
|
||||
|
||||
|
||||
def place(x, pan):
|
||||
th = (pan + 1) * np.pi / 4
|
||||
return np.stack([x * np.cos(th), x * np.sin(th)], 1) * np.sqrt(2)
|
||||
|
||||
|
||||
def noise(n, ch=1):
|
||||
return rng.standard_normal((n, ch) if ch > 1 else n)
|
||||
|
||||
|
||||
class Mix:
|
||||
def __init__(self):
|
||||
self.stems, self.sends = {}, {k: self.blank() for k in ("hall", "room", "echo")}
|
||||
|
||||
@staticmethod
|
||||
def blank():
|
||||
return np.zeros((N + TAIL, 2))
|
||||
|
||||
def add(self, stem, sig, beat, gain=1.0, pan=0.0, **sends):
|
||||
sig = place(sig, pan) if sig.ndim == 1 else sig
|
||||
i = sample(beat)
|
||||
bus = self.stems.setdefault(stem, self.blank())
|
||||
n = min(len(sig), len(bus) - i)
|
||||
bus[i:i + n] += sig[:n] * gain
|
||||
for name, amount in sends.items():
|
||||
self.sends[name][i:i + n] += sig[:n] * gain * amount
|
||||
|
||||
|
||||
def piano(m, dur, vel):
|
||||
f0 = hz(m)
|
||||
n = int((dur + 0.5) * SR)
|
||||
t = secs(n)
|
||||
tau = np.clip(3.2 * (262 / f0) ** 0.7, 0.6, 7.0)
|
||||
bright = 800 + 2400 * vel
|
||||
y = np.zeros(n)
|
||||
for k in range(1, 16):
|
||||
fk = k * f0 * np.sqrt(1 + 0.0004 * k * k)
|
||||
if fk > 7000:
|
||||
break
|
||||
amp = k ** -1.2 / (1 + (fk / bright) ** 3)
|
||||
tk = tau / (1 + 0.45 * (k - 1))
|
||||
env = 0.6 * np.exp(-t / (0.3 * tk)) + 0.4 * np.exp(-t / tk)
|
||||
for cents in (-0.9, 0.2, 1.1):
|
||||
y += amp * env * np.sin(2 * np.pi * fk * 2 ** (cents / 1200) * t + rng.uniform(0, 6.28))
|
||||
off = int(dur * SR)
|
||||
y[off:] *= np.exp(-secs(n - off) / 0.14)
|
||||
k = int(0.012 * SR)
|
||||
y[:k] += filt(noise(k), "low", 900) * np.exp(-secs(k) / 0.003) * 0.12
|
||||
return edges(y, 0.006, 0.02) * vel ** 1.6 / 3
|
||||
|
||||
|
||||
def saw(f, n, phase):
|
||||
dt = f / SR
|
||||
p = (phase + dt * np.arange(n)) % 1.0
|
||||
y = 2 * p - 1
|
||||
lo = p < dt
|
||||
x = p[lo] / dt
|
||||
y[lo] -= 2 * x - x * x - 1
|
||||
hi = p > 1 - dt
|
||||
x = (p[hi] - 1) / dt
|
||||
y[hi] -= x * x + 2 * x + 1
|
||||
return y
|
||||
|
||||
|
||||
def pad(notes, dur, attack, release, octave=0, bright=1.0):
|
||||
n = int((dur + release) * SR)
|
||||
out = np.zeros((n, 2))
|
||||
for m in notes:
|
||||
f = hz(m + octave)
|
||||
for cents, side in ((-11, 0), (-4, 1), (4, 0), (11, 1)):
|
||||
v = saw(f * 2 ** (cents / 1200), n, rng.uniform())
|
||||
out[:, side] += 0.75 * v * bright
|
||||
out[:, 1 - side] += 0.25 * v * bright
|
||||
out += np.sin(2 * np.pi * f * secs(n))[:, None] * 0.6
|
||||
t = secs(n)
|
||||
env = np.minimum(1, t / attack) ** 2
|
||||
rel = np.clip((t - dur) / release, 0, 1)
|
||||
env *= np.cos(rel * np.pi / 2) ** 2
|
||||
return out * env[:, None] / len(notes)
|
||||
|
||||
|
||||
def pluck(m, vel):
|
||||
f0, n = hz(m), int(0.9 * SR)
|
||||
t = secs(n)
|
||||
y = np.zeros(n)
|
||||
for k in range(1, 25):
|
||||
if k * f0 > 7500:
|
||||
break
|
||||
y += k ** -1.3 * np.exp(-t / (0.5 / (1 + 0.7 * (k - 1)))) * np.sin(2 * np.pi * k * f0 * t + rng.uniform(0, 6.28))
|
||||
return edges(y, 0.0015, 0.05) * vel
|
||||
|
||||
|
||||
def bell(m, vel, dur=3.0):
|
||||
f, n = hz(m), int(dur * SR)
|
||||
t = secs(n)
|
||||
index = 1.6 * np.exp(-t / 0.35)
|
||||
y = np.sin(2 * np.pi * f * t + index * np.sin(2 * np.pi * 3.5 * f * t)) * np.exp(-t / 1.1)
|
||||
y += 0.3 * np.sin(2 * np.pi * 2 * f * t) * np.exp(-t / 0.5)
|
||||
return edges(y, 0.002, 0.1) * vel
|
||||
|
||||
|
||||
def bass(m, dur, vel, decay=None):
|
||||
f, n = hz(m), int((dur + 0.08) * SR)
|
||||
t = secs(n)
|
||||
y = np.sin(2 * np.pi * f * t) + 0.22 * np.sin(4 * np.pi * f * t) + 0.07 * np.sin(6 * np.pi * f * t)
|
||||
y = np.tanh(1.4 * y) / np.tanh(1.4)
|
||||
env = np.minimum(1, t / 0.008) * np.clip((dur + 0.06 - t) / 0.06, 0, 1)
|
||||
if decay:
|
||||
env *= np.exp(-t / decay)
|
||||
return y * env * vel
|
||||
|
||||
|
||||
def kick(vel):
|
||||
n = int(0.5 * SR)
|
||||
t = secs(n)
|
||||
f = 47 + 75 * np.exp(-t / 0.035)
|
||||
y = np.tanh(1.5 * np.sin(2 * np.pi * np.cumsum(f) / SR) * np.exp(-t / 0.26))
|
||||
k = int(0.004 * SR)
|
||||
y[:k] += filt(noise(k), "low", 2200) * 0.2
|
||||
return edges(y, 0.001, 0.04) * vel
|
||||
|
||||
|
||||
def snare(vel):
|
||||
n = int(0.35 * SR)
|
||||
t = secs(n)
|
||||
env = 0.55 * np.exp(-t / 0.13)
|
||||
for d in (0.0, 0.009, 0.019):
|
||||
env += np.where(t >= d, np.exp(-(t - d) / 0.006), 0) * 0.6
|
||||
y = filt(noise(n), "band", [1200, 7500]) * env * np.minimum(1, t / 0.002)
|
||||
y += np.sin(2 * np.pi * 185 * t) * np.exp(-t / 0.045) * 0.35
|
||||
return edges(peaking(y, 2600, -5, 1.0), 0.001, 0.03) * vel
|
||||
|
||||
|
||||
def hat(vel, open_=False):
|
||||
n = int((0.3 if open_ else 0.08) * SR)
|
||||
t = secs(n)
|
||||
y = filt(noise(n), "band", [7000, 12500], 3) * np.exp(-t / (0.2 if open_ else 0.03))
|
||||
return edges(y, 0.001, 0.02) * vel
|
||||
|
||||
|
||||
def shaker(vel):
|
||||
n = int(0.09 * SR)
|
||||
t = secs(n)
|
||||
y = filt(noise(n), "band", [4800, 10000]) * np.minimum(1, t / 0.007) * np.exp(-t / 0.035)
|
||||
return edges(y, 0.001, 0.02) * vel
|
||||
|
||||
|
||||
def riser(strength, notes):
|
||||
n = int(1.25 * SR)
|
||||
t = secs(n)
|
||||
u = t / t[-1]
|
||||
swish = sweep(noise(n, 2), lambda s: [r := 300 * (16 ** ((s / 1.25) ** 1.4)), min(r * 2.4, 9000)], "band", 1)
|
||||
y = filt(swish, "low", 8000) * (u ** 2.4)[:, None] * 0.9
|
||||
swell = sum(np.sin(2 * np.pi * hz(m + 12) * t) for m in notes) / len(notes)
|
||||
y += place(swell * np.exp(5 * (u - 1)) * u * 0.6, 0)
|
||||
y[-int(0.02 * SR):] *= np.linspace(1, 0, int(0.02 * SR))[:, None]
|
||||
return y * strength
|
||||
|
||||
|
||||
def impact(strength, tail=2.4):
|
||||
n = int(tail * SR)
|
||||
t = secs(n)
|
||||
f = 38 + 32 * np.exp(-t / 0.12)
|
||||
boom = np.tanh(1.3 * np.sin(2 * np.pi * np.cumsum(f) / SR) * np.exp(-t / 0.65))
|
||||
thump = filt(noise(n), "low", 220) * np.exp(-t / 0.05) * 0.8
|
||||
air = filt(noise(n, 2), "band", [250, 2200]) * np.exp(-t / 0.45)[:, None] * 0.07
|
||||
return edges(place(boom + thump, 0) + air, 0.001, 0.2) * strength
|
||||
|
||||
|
||||
def impulse(seconds, t60, seed):
|
||||
"""Stereo reverb impulse: decorrelated noise with per-band decay (low, mid, high)."""
|
||||
g = np.random.default_rng(seed)
|
||||
n = int(seconds * SR)
|
||||
t = secs(n)
|
||||
ir = np.zeros((n, 2))
|
||||
for ch in range(2):
|
||||
w = g.standard_normal(n)
|
||||
lo, hi = filt(w, "low", 500), filt(w, "high", 4000)
|
||||
bands = (lo, w - lo - hi, hi)
|
||||
ir[:, ch] = sum(b * 10 ** (-3 * t / T) for b, T in zip(bands, t60))
|
||||
ir = filt(ir, "low", 7000) * np.minimum(1, t / 0.02)[:, None]
|
||||
ir = np.concatenate([np.zeros((int(0.022 * SR), 2)), edges(ir, 0.001, seconds * 0.15)])
|
||||
return ir / np.sqrt((ir ** 2).sum(0))
|
||||
|
||||
|
||||
def reverb(x, ir):
|
||||
return np.stack([signal.fftconvolve(x[:, c], ir[:, c])[:len(x)] for c in range(2)], 1)
|
||||
|
||||
|
||||
def pingpong(x, beats=0.75, fb=0.4, taps=7):
|
||||
d, y, out = sample(beats), x.mean(1), np.zeros_like(x)
|
||||
for k in range(1, taps + 1):
|
||||
y = filt(filt(y, "low", 3200, 1), "high", 250, 1)
|
||||
out[k * d:, k % 2] += y[:len(x) - k * d] * fb ** (k - 1)
|
||||
return out
|
||||
|
||||
|
||||
def chord_at(beat):
|
||||
return CHORDS[[c for b, c in CHANGES if b <= beat][-1]]
|
||||
|
||||
|
||||
def drops(bar, beat):
|
||||
return bar in BREAKS and beat >= 2
|
||||
|
||||
|
||||
def score(mix):
|
||||
for i, (b, name) in enumerate(CHANGES):
|
||||
end = CHANGES[i + 1][0] if i + 1 < len(CHANGES) else 96
|
||||
notes = CHORDS[name][1]
|
||||
first, final = b == 0, name == "Fend"
|
||||
sig = pad(notes, (end - b) * 0.625, 2.6 if first else 0.25, 3.0 if final else 0.9)
|
||||
mix.add("pad", sig, b, hall=0.5)
|
||||
if 40 <= b < 84:
|
||||
mix.add("strings", pad(notes[-3:], (end - b) * 0.625, 0.4, 0.9, 12, 0.5), b, hall=0.6)
|
||||
|
||||
for x, m, v in INTRO:
|
||||
mix.add("piano", piano(m, 2.4, v), x, pan=(m - 70) / 30, hall=0.35)
|
||||
for x, name in ((0, "Bb"), (4, "Csus")):
|
||||
for m in CHORDS[name][3]:
|
||||
mix.add("piano", piano(m, 3.8, 0.3), x, pan=-0.2, hall=0.3)
|
||||
|
||||
for start, line, low in ((8, MEL_A1, 0), (24, MEL_A2, 0), (40, MEL_B, 0), (64, MEL_D, 1)):
|
||||
for x, m, d, v in line:
|
||||
mix.add("piano", piano(m, d * 0.625 + 0.15, v), start + x, pan=0.08, hall=0.28)
|
||||
if low:
|
||||
mix.add("piano", piano(m - 12, d * 0.625 + 0.15, v * 0.55), start + x, pan=-0.1, hall=0.28)
|
||||
for x, m, d, v in ((84, 77, 4.5, .66), (88, 84, 1.5, .32), (89.5, 81, .5, .27), (90, 77, 3.0, .26)):
|
||||
mix.add("piano", piano(m, d * 0.625, v), x, pan=0.1, hall=0.45)
|
||||
for m in CHORDS["Fend"][3]:
|
||||
mix.add("piano", piano(m, 4.0, 0.38), 84, pan=-0.15, hall=0.45)
|
||||
for x, m in BELLS + [(84, 89)]:
|
||||
mix.add("bell", bell(m, 0.5 if x < 84 else 0.35), x, pan=0.35, hall=0.7, echo=0.35)
|
||||
|
||||
kicks = []
|
||||
for bar in range(3, 22):
|
||||
base = (bar - 1) * 4
|
||||
section = 0 if bar < 7 else 1 if bar < 11 else 2 if bar < 17 else 3
|
||||
lh_vel = (0.3, 0.33, 0.37, 0.4)[section]
|
||||
for x in ((0,) if section < 2 else (0, 2)):
|
||||
for m in chord_at(base + x)[3]:
|
||||
mix.add("piano", piano(m, 1.8, lh_vel), base + x, pan=-0.2, hall=0.3)
|
||||
|
||||
pattern = ([0, 2], [0, 2, 2.5], [0, 0.75, 2, 2.5], [0, 1, 2, 3])[section]
|
||||
for x in pattern:
|
||||
if not drops(bar, x):
|
||||
kicks.append(base + x)
|
||||
mix.add("kick", kick(0.9 if x in (0, 2) else 0.7), base + x, room=0.05)
|
||||
for x in (1, 3):
|
||||
if not drops(bar, x):
|
||||
mix.add("snare", snare(0.55 + 0.1 * (section > 1)), base + x, pan=0.05, room=0.35, hall=0.12)
|
||||
if section > 1:
|
||||
for x in ((3.75,) if section == 2 else (1.75, 3.75)):
|
||||
if not drops(bar, x):
|
||||
mix.add("snare", snare(0.14), base + x, pan=0.1, room=0.3)
|
||||
if bar in (16, 21):
|
||||
for j in range(8):
|
||||
mix.add("snare", snare(0.12 + 0.05 * j), base + 2 + j * 0.25, pan=0.1, room=0.3, hall=0.1)
|
||||
for j in range(8):
|
||||
x = j * 0.5
|
||||
if drops(bar, x) and bar in (6, 10):
|
||||
continue
|
||||
jitter = rng.normal(0, 0.004)
|
||||
if section == 3 and j % 2:
|
||||
mix.add("hats", hat(0.32, True), base + x + jitter, pan=0.3, room=0.15)
|
||||
elif section == 2 and j == 7:
|
||||
mix.add("hats", hat(0.3, True), base + x + jitter, pan=0.3, room=0.15)
|
||||
else:
|
||||
mix.add("hats", hat(0.5 if j % 2 else 0.28), base + x + jitter, pan=0.3, room=0.1)
|
||||
if section > 0:
|
||||
for j in range(16):
|
||||
vel = (0.5, 0.22, 0.34, 0.22)[j % 4] * (1 + 0.3 * (section == 3))
|
||||
mix.add("hats", shaker(vel), base + j * 0.25 + rng.normal(0, 0.004), pan=-0.35, room=0.1)
|
||||
|
||||
step = 0.5 if section < 2 else 0.25
|
||||
for j in range(int(4 / step)):
|
||||
x = j * step
|
||||
tones = chord_at(base + x)[2]
|
||||
idx = ([0, 1, 2, 3, 2, 1, 2, 3] if section < 2 else [0, 1, 2, 3, 1, 2, 3, 2])[j % 8]
|
||||
m = tones[idx] + (12 if section == 3 and j % 8 in (3, 6) else 0)
|
||||
vel = (0.7 if j % 2 == 0 else 0.5) * (0.8 if step < 0.5 else 1.0)
|
||||
mix.add("arp", pluck(m, vel), base + x, pan=0.4 * np.sin(j * 0.9), hall=0.2, echo=0.32)
|
||||
|
||||
rhythm = ([(0, 1.8, 0), (2, 1.3, 0), (3.5, 0.4, 0)],
|
||||
[(0, 1.3, 0), (1.5, 0.4, 0), (2, 1.3, 0), (3.5, 0.4, 12)],
|
||||
[(0, .9, 0), (1, .4, 0), (1.5, .4, 12), (2, .9, 0), (3, .4, 0), (3.5, .4, 12)],
|
||||
[(0, .9, 0), (1, .4, 0), (1.5, .4, 12), (2, .9, 0), (3, .4, 0), (3.5, .4, 12)])[section]
|
||||
if bar in BREAKS:
|
||||
rhythm = [r for r in rhythm if r[0] < 2] + [(2, 1.9, 0)]
|
||||
for x, d, octave in rhythm:
|
||||
mix.add("bass", bass(chord_at(base + x)[0] + octave, d * 0.625, 0.8 if octave else 1.0), base + x)
|
||||
|
||||
kicks.append(84)
|
||||
mix.add("kick", kick(1.0), 84, room=0.05)
|
||||
mix.add("bass", bass(29, 5.0, 1.0, decay=1.8), 84)
|
||||
strengths = {3: (0.6, 0.6), 7: (0.55, 0.45), 11: (0.75, 0.7), 17: (1.0, 1.0), 22: (0.9, 1.0)}
|
||||
for bar in LIFTS:
|
||||
beat = (bar - 1) * 4
|
||||
rise, hit = strengths[bar]
|
||||
mix.add("fx", riser(rise, chord_at(beat)[1]), beat - 2, hall=0.3)
|
||||
mix.add("fx", impact(hit, 4.0 if bar == 22 else 2.4), beat, hall=0.45)
|
||||
return np.array(kicks)
|
||||
|
||||
|
||||
def duck(kicks, depth):
|
||||
g = np.ones(N + TAIL)
|
||||
shape = np.minimum(1, secs(int(0.5 * SR)) / 0.004) * np.exp(-secs(int(0.5 * SR)) / 0.13)
|
||||
for k in kicks:
|
||||
i = sample(k)
|
||||
n = min(len(shape), len(g) - i)
|
||||
g[i:i + n] = np.minimum(g[i:i + n], 1 - depth * shape[:n])
|
||||
return g[:, None]
|
||||
|
||||
|
||||
def run_board(board, x):
|
||||
return board(x.T.astype(np.float32), SR).T.astype(np.float64)
|
||||
|
||||
|
||||
def true_peak(x):
|
||||
return np.abs(signal.resample_poly(x, 4, 1, axis=0)).max()
|
||||
|
||||
|
||||
def limit(x, ceiling_db):
|
||||
"""Look-ahead limiter on 4x-oversampled peaks, release 120 ms."""
|
||||
c = 10 ** (ceiling_db / 20)
|
||||
peak = np.abs(signal.resample_poly(x, 4, 1, axis=0)).max(1)[:len(x) * 4].reshape(-1, 4).max(1)
|
||||
need = np.minimum(1, c / np.maximum(peak, 1e-9))
|
||||
look = 96
|
||||
red = 1 - minimum_filter1d(need, 2 * look + 1)
|
||||
r, a = np.empty_like(red), np.exp(-1 / (0.12 * SR))
|
||||
acc = 0.0
|
||||
for i, v in enumerate(red):
|
||||
acc = v if v > acc else acc * a
|
||||
r[i] = acc
|
||||
return x * uniform_filter1d(1 - r, look)[:, None]
|
||||
|
||||
|
||||
def master(mix, kicks):
|
||||
s = mix.stems
|
||||
gains = GAINS
|
||||
pad_lp = curve([(0, 220), (4.9, 1700), (5, 1500), (14.9, 1700), (15, 1900), (24.9, 2200),
|
||||
(25, 2300), (39.9, 2700), (40, 3000), (52.4, 3100), (52.5, 2600), (59, 450), (70, 450)], True)
|
||||
pad_bus = sweep(s["pad"] + s["strings"] * gains["strings"] / gains["pad"], pad_lp, "low", 4)
|
||||
pad_bus = run_board(pb.Pedalboard([pb.Chorus(rate_hz=0.22, depth=0.3, centre_delay_ms=9, mix=0.45)]), pad_bus)
|
||||
piano = peaking(filt(s["piano"], "high", 90), 2800, -2.5, 0.9)
|
||||
dry = (piano * gains["piano"] + pad_bus * gains["pad"] * duck(kicks, 0.4)
|
||||
+ s["arp"] * gains["arp"] * duck(kicks, 0.3) + s["bell"] * gains["bell"]
|
||||
+ s["bass"] * gains["bass"] * duck(kicks, 0.55) + s["kick"] * gains["kick"]
|
||||
+ s["snare"] * gains["snare"] + s["hats"] * gains["hats"] + s["fx"] * gains["fx"])
|
||||
sends = mix.sends
|
||||
echo = pingpong(sends["echo"] * 0.2)
|
||||
hall = reverb((sends["hall"] + echo * 0.5) * 0.4, impulse(3.6, (3.4, 2.6, 1.3), 7))
|
||||
room = reverb(sends["room"] * 0.25, impulse(0.9, (0.6, 0.5, 0.3), 11))
|
||||
wet = filt(hall, "high", 160) * duck(kicks, 0.25) + filt(room, "high", 200) + echo * 0.6
|
||||
ride = curve([(0, -10), (4.97, -4.5), (5.0, -3.2), (14.97, -3.2), (15, -2.2), (24.97, -2.2),
|
||||
(25, -1.1), (39.97, -1.1), (40, 0.8), (52.47, 0.8), (52.5, 0.4), (70, 0.4)])
|
||||
x = filt(dry + wet, "high", 28) * 10 ** (ride(secs(N + TAIL)) / 20)[:, None]
|
||||
x = peaking(x, 2600, -2.0, 0.8)
|
||||
x = x + 0.25 * filt(x, "high", 8000)
|
||||
x = run_board(pb.Pedalboard([pb.Compressor(threshold_db=-20, ratio=1.8, attack_ms=25, release_ms=250)]), x)
|
||||
x = x[:N]
|
||||
t = secs(N)
|
||||
x *= np.clip(np.cos(np.clip((t - 57.0) / 2.3, 0, 1) * np.pi / 2), 0, 1)[:, None] ** 2
|
||||
x = edges(x, 0.002, 0.01)
|
||||
meter = pyln.Meter(SR)
|
||||
for _ in range(3):
|
||||
x *= 10 ** ((TARGET_LUFS - meter.integrated_loudness(x)) / 20)
|
||||
x = np.tanh(x * 1.1) / 1.1
|
||||
x = limit(x, CEILING_DB)
|
||||
stems = {k: 20 * np.log10(np.sqrt((v[:N] ** 2).mean()) * gains.get(k, 1) + 1e-12) for k, v in s.items()}
|
||||
return x, meter.integrated_loudness(x), stems
|
||||
|
||||
|
||||
def write(path, x):
|
||||
x = np.atleast_2d(x.T).T
|
||||
q = np.round(np.clip(x, -1, 1 - 2 ** -23) * 2 ** 23).astype("<i4")
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with wave.open(str(path), "wb") as w:
|
||||
w.setnchannels(x.shape[1])
|
||||
w.setsampwidth(3)
|
||||
w.setframerate(SR)
|
||||
w.writeframes(q.view(np.uint8).reshape(-1, 4)[:, :3].tobytes())
|
||||
@@ -0,0 +1,43 @@
|
||||
import numpy as np
|
||||
|
||||
from compose import OUT, SR, edges, filt, impact, impulse, noise, place, reverb, secs, sweep, write
|
||||
|
||||
|
||||
def ui(x, peak_db=-6.0):
|
||||
x = x if x.ndim == 2 else place(x, 0) / np.sqrt(2)
|
||||
x = edges(x, 0.0008, 0.006)
|
||||
return x * 10 ** (peak_db / 20) / np.abs(x).max()
|
||||
|
||||
|
||||
def sfx():
|
||||
def env(n, decay):
|
||||
return np.exp(-secs(n) / decay)
|
||||
n = int(0.06 * SR)
|
||||
t = secs(n)
|
||||
click = (np.sin(2 * np.pi * 1150 * t) * env(n, 0.005) * 0.5 + np.sin(2 * np.pi * 380 * t) * env(n, 0.012) * 0.7
|
||||
+ filt(noise(n), "band", [2000, 6000]) * env(n, 0.0012) * 0.4)
|
||||
n = int(0.12 * SR)
|
||||
t = secs(n)
|
||||
f = 560 + 420 * (1 - np.exp(-t / 0.012))
|
||||
ph = 2 * np.pi * np.cumsum(f) / SR
|
||||
menu = (np.sin(ph) + 0.12 * np.sin(2 * ph)) * np.minimum(1, t / 0.0015) * env(n, 0.03)
|
||||
menu += filt(noise(n), "low", 3000) * env(n, 0.002) * 0.15
|
||||
n = int(0.05 * SR)
|
||||
t = secs(n)
|
||||
key = np.sin(2 * np.pi * 240 * t) * env(n, 0.008) * 0.7 + filt(noise(n), "band", [900, 4500]) * env(n, 0.0025) * 0.5
|
||||
late = int(0.011 * SR)
|
||||
key[late:] += filt(noise(n - late), "band", [600, 3000]) * env(n - late, 0.003) * 0.25
|
||||
n = int(0.7 * SR)
|
||||
u = secs(n) / 0.7
|
||||
body = 0.7 * noise(n)[:, None] + 0.3 * noise(n, 2)
|
||||
whoosh = sweep(body, lambda s: [c := 300 * 6 ** np.sin(np.pi * s / 0.7), c * 2.2], "band", 1)
|
||||
whoosh = filt(whoosh, "low", 4500) * (np.sin(np.pi * u ** 0.85) ** 2)[:, None]
|
||||
whoosh *= np.stack([np.cos(u * np.pi / 2), np.sin(u * np.pi / 2)], 1) * 1.2 + 0.3
|
||||
hit = impact(1.0, 1.5)
|
||||
hit = hit + filt(reverb(hit, impulse(1.0, (0.9, 0.6, 0.3), 3)), "low", 3000) * 0.25
|
||||
hit *= (np.cos(np.clip((secs(len(hit)) - 0.9) / 0.6, 0, 1) * np.pi / 2) ** 2)[:, None]
|
||||
n = int(0.09 * SR)
|
||||
t = secs(n)
|
||||
tick = (np.sin(2 * np.pi * 1568 * t) + 0.3 * np.sin(2 * np.pi * 2349 * t)) * np.minimum(1, t / 0.001) * env(n, 0.016)
|
||||
for name, x in (("click", click), ("menu", menu), ("key", key), ("whoosh", whoosh), ("impact", hit), ("tick", tick)):
|
||||
write(OUT / "sfx" / f"{name}.wav", ui(x))
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "ely-update-0-1-5",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"studio": "remotion studio src/index.ts",
|
||||
"still": "remotion still src/index.ts",
|
||||
"render": "remotion render src/index.ts Update out/ely-office-0.1.5.mp4",
|
||||
"check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@remotion/cli": "^4.0.535",
|
||||
"flubber": "^0.4.2",
|
||||
"react": "^19.3.1",
|
||||
"react-dom": "^19.3.1",
|
||||
"remotion": "^4.0.535"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"typescript": "^7.0.2"
|
||||
},
|
||||
"allowScripts": {
|
||||
"esbuild@0.28.1": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
https://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256"><defs><filter id="body" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="2.88"/></filter><filter id="fold" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="0.96"/></filter><filter id="part" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="1.28"/></filter></defs><path fill="#F4F4F2" d="M231 128C231 229.764 229.764 231 128 231C26.236 231 25 229.764 25 128C25 26.236 26.236 25 128 25C229.764 25 231 26.236 231 128Z"/><g transform="translate(39.420 43.420) scale(0.9227)"><g transform="translate(0 4)" opacity="0.2" filter="url(#body)"><path d="M40 16H112L160 64V168A8 8 0 0 1 152 176H40A8 8 0 0 1 32 168V24A8 8 0 0 1 40 16Z" fill="#000000"/></g><path d="M40 16H112L160 64V168A8 8 0 0 1 152 176H40A8 8 0 0 1 32 168V24A8 8 0 0 1 40 16Z" fill="#3D7FE5"/><g transform="translate(0 2)" opacity="0.2" filter="url(#fold)"><path d="M112 16V56A8 8 0 0 0 120 64H160Z" fill="#000000"/></g><path d="M112 16V56A8 8 0 0 0 120 64H160Z" fill="#94B9F1"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="56" y="84" width="64" height="12" rx="4" fill="#000000"/></g><rect x="56" y="84" width="64" height="12" rx="4" fill="#FFFFFF"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="56" y="108" width="80" height="8" rx="4" fill="#000000"/></g><rect x="56" y="108" width="80" height="8" rx="4" fill="#FFFFFF"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="56" y="124" width="80" height="8" rx="4" fill="#000000"/></g><rect x="56" y="124" width="80" height="8" rx="4" fill="#FFFFFF"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="56" y="140" width="80" height="8" rx="4" fill="#000000"/></g><rect x="56" y="140" width="80" height="8" rx="4" fill="#FFFFFF"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="56" y="156" width="48" height="8" rx="4" fill="#000000"/></g><rect x="56" y="156" width="48" height="8" rx="4" fill="#A8C5F3"/></g></svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256"><defs><filter id="body" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="2.88"/></filter><filter id="fold" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="0.96"/></filter><filter id="part" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="1.28"/></filter></defs><g transform="scale(1.333333)"><g transform="translate(0 4)" opacity="0.2" filter="url(#body)"><path d="M40 16H112L160 64V168A8 8 0 0 1 152 176H40A8 8 0 0 1 32 168V24A8 8 0 0 1 40 16Z" fill="#000000"/></g><path d="M40 16H112L160 64V168A8 8 0 0 1 152 176H40A8 8 0 0 1 32 168V24A8 8 0 0 1 40 16Z" fill="#3D7FE5"/><g transform="translate(0 2)" opacity="0.2" filter="url(#fold)"><path d="M112 16V56A8 8 0 0 0 120 64H160Z" fill="#000000"/></g><path d="M112 16V56A8 8 0 0 0 120 64H160Z" fill="#94B9F1"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="56" y="84" width="64" height="12" rx="4" fill="#000000"/></g><rect x="56" y="84" width="64" height="12" rx="4" fill="#FFFFFF"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="56" y="108" width="80" height="8" rx="4" fill="#000000"/></g><rect x="56" y="108" width="80" height="8" rx="4" fill="#FFFFFF"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="56" y="124" width="80" height="8" rx="4" fill="#000000"/></g><rect x="56" y="124" width="80" height="8" rx="4" fill="#FFFFFF"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="56" y="140" width="80" height="8" rx="4" fill="#000000"/></g><rect x="56" y="140" width="80" height="8" rx="4" fill="#FFFFFF"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="56" y="156" width="48" height="8" rx="4" fill="#000000"/></g><rect x="56" y="156" width="48" height="8" rx="4" fill="#A8C5F3"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256"><defs><filter id="body" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="2.88"/></filter><filter id="part" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="1.28"/></filter></defs><path fill="#F4F4F2" d="M231 128C231 229.764 229.764 231 128 231C26.236 231 25 229.764 25 128C25 26.236 26.236 25 128 25C229.764 25 231 26.236 231 128Z"/><g transform="translate(39.420 43.420) scale(0.9227)"><g transform="translate(0 4)" opacity="0.2" filter="url(#body)"><rect x="28" y="24" width="136" height="152" rx="10" fill="#000000"/></g><rect x="28" y="24" width="136" height="152" rx="10" fill="#ECECEC"/><path d="M38 24H154A10 10 0 0 1 164 34V52H28V34A10 10 0 0 1 38 24Z" fill="#4F4F4F"/><rect x="46" y="32" width="10" height="14" rx="5" fill="#FFFFFF"/><rect x="70" y="32" width="10" height="14" rx="5" fill="#FFFFFF"/><rect x="94" y="32" width="10" height="14" rx="5" fill="#FFFFFF"/><rect x="118" y="32" width="10" height="14" rx="5" fill="#FFFFFF"/><rect x="142" y="32" width="10" height="14" rx="5" fill="#FFFFFF"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><path d="M44 156V76H66L82 100L98 76H120V156H100V110L82 136L64 110V156Z" fill="#000000"/></g><path d="M44 156V76H66L82 100L98 76H120V156H100V110L82 136L64 110V156Z" fill="#3E4A5C"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><path d="M128 76H148V124H164L138 158L112 124H128Z" fill="#000000"/></g><path d="M128 76H148V124H164L138 158L112 124H128Z" fill="#F2A900"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256"><defs><filter id="body" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="2.88"/></filter><filter id="part" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="1.28"/></filter></defs><g transform="scale(1.333333)"><g transform="translate(0 4)" opacity="0.2" filter="url(#body)"><rect x="28" y="24" width="136" height="152" rx="10" fill="#000000"/></g><rect x="28" y="24" width="136" height="152" rx="10" fill="#ECECEC"/><path d="M38 24H154A10 10 0 0 1 164 34V52H28V34A10 10 0 0 1 38 24Z" fill="#4F4F4F"/><rect x="46" y="32" width="10" height="14" rx="5" fill="#FFFFFF"/><rect x="70" y="32" width="10" height="14" rx="5" fill="#FFFFFF"/><rect x="94" y="32" width="10" height="14" rx="5" fill="#FFFFFF"/><rect x="118" y="32" width="10" height="14" rx="5" fill="#FFFFFF"/><rect x="142" y="32" width="10" height="14" rx="5" fill="#FFFFFF"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><path d="M44 156V76H66L82 100L98 76H120V156H100V110L82 136L64 110V156Z" fill="#000000"/></g><path d="M44 156V76H66L82 100L98 76H120V156H100V110L82 136L64 110V156Z" fill="#3E4A5C"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><path d="M128 76H148V124H164L138 158L112 124H128Z" fill="#000000"/></g><path d="M128 76H148V124H164L138 158L112 124H128Z" fill="#F2A900"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256"><defs><filter id="body" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="2.88"/></filter><filter id="fold" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="0.96"/></filter><filter id="part" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="1.28"/></filter></defs><path fill="#F4F4F2" d="M231 128C231 229.764 229.764 231 128 231C26.236 231 25 229.764 25 128C25 26.236 26.236 25 128 25C229.764 25 231 26.236 231 128Z"/><g transform="translate(39.420 43.420) scale(0.9227)"><g transform="translate(0 4)" opacity="0.2" filter="url(#body)"><path d="M40 16H112L160 64V168A8 8 0 0 1 152 176H40A8 8 0 0 1 32 168V24A8 8 0 0 1 40 16Z" fill="#000000"/></g><path d="M40 16H112L160 64V168A8 8 0 0 1 152 176H40A8 8 0 0 1 32 168V24A8 8 0 0 1 40 16Z" fill="#E0344F"/><g transform="translate(0 2)" opacity="0.2" filter="url(#fold)"><path d="M112 16V56A8 8 0 0 0 120 64H160Z" fill="#000000"/></g><path d="M112 16V56A8 8 0 0 0 120 64H160Z" fill="#EE8F9E"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="52" y="88" width="88" height="60" rx="6" fill="#000000"/></g><rect x="52" y="88" width="88" height="60" rx="6" fill="#FFFFFF"/><path d="M60 140L82 112L98 128L108 118L132 140Z" fill="#E0344F"/><circle cx="112" cy="104" r="7" fill="#EC8595"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="52" y="156" width="56" height="8" rx="4" fill="#000000"/></g><rect x="52" y="156" width="56" height="8" rx="4" fill="#F1A4B0"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256"><defs><filter id="body" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="2.88"/></filter><filter id="fold" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="0.96"/></filter><filter id="part" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="1.28"/></filter></defs><g transform="scale(1.333333)"><g transform="translate(0 4)" opacity="0.2" filter="url(#body)"><path d="M40 16H112L160 64V168A8 8 0 0 1 152 176H40A8 8 0 0 1 32 168V24A8 8 0 0 1 40 16Z" fill="#000000"/></g><path d="M40 16H112L160 64V168A8 8 0 0 1 152 176H40A8 8 0 0 1 32 168V24A8 8 0 0 1 40 16Z" fill="#E0344F"/><g transform="translate(0 2)" opacity="0.2" filter="url(#fold)"><path d="M112 16V56A8 8 0 0 0 120 64H160Z" fill="#000000"/></g><path d="M112 16V56A8 8 0 0 0 120 64H160Z" fill="#EE8F9E"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="52" y="88" width="88" height="60" rx="6" fill="#000000"/></g><rect x="52" y="88" width="88" height="60" rx="6" fill="#FFFFFF"/><path d="M60 140L82 112L98 128L108 118L132 140Z" fill="#E0344F"/><circle cx="112" cy="104" r="7" fill="#EC8595"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="52" y="156" width="56" height="8" rx="4" fill="#000000"/></g><rect x="52" y="156" width="56" height="8" rx="4" fill="#F1A4B0"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256"><defs><filter id="body" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="2.88"/></filter><filter id="part" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="1.28"/></filter></defs><path fill="#F4F4F2" d="M231 128C231 229.764 229.764 231 128 231C26.236 231 25 229.764 25 128C25 26.236 26.236 25 128 25C229.764 25 231 26.236 231 128Z"/><g transform="translate(39.420 43.420) scale(0.9227)"><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><polyline points="96,136 64,176" fill="none" stroke="#000000" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/></g><polyline points="96,136 64,176" fill="none" stroke="#5D5D5D" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><polyline points="96,136 128,176" fill="none" stroke="#000000" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/></g><polyline points="96,136 128,176" fill="none" stroke="#5D5D5D" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/><g transform="translate(0 4)" opacity="0.2" filter="url(#body)"><rect x="16" y="28" width="160" height="112" rx="10" fill="#000000"/></g><rect x="16" y="28" width="160" height="112" rx="10" fill="#F07B2A"/><rect x="16" y="28" width="160" height="16" rx="8" fill="#F4A36A"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="32" y="52" width="128" height="72" rx="4" fill="#000000"/></g><rect x="32" y="52" width="128" height="72" rx="4" fill="#FFFFFF"/><rect x="48" y="96" width="16" height="16" rx="2" fill="#F07B2A"/><rect x="72" y="80" width="16" height="32" rx="2" fill="#F07B2A"/><rect x="96" y="66" width="16" height="46" rx="2" fill="#F07B2A"/><path d="M136 66A16 16 0 1 0 152 82H136Z" fill="#5D7FC9"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256"><defs><filter id="body" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="2.88"/></filter><filter id="part" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="1.28"/></filter></defs><g transform="scale(1.333333)"><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><polyline points="96,136 64,176" fill="none" stroke="#000000" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/></g><polyline points="96,136 64,176" fill="none" stroke="#5D5D5D" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><polyline points="96,136 128,176" fill="none" stroke="#000000" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/></g><polyline points="96,136 128,176" fill="none" stroke="#5D5D5D" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"/><g transform="translate(0 4)" opacity="0.2" filter="url(#body)"><rect x="16" y="28" width="160" height="112" rx="10" fill="#000000"/></g><rect x="16" y="28" width="160" height="112" rx="10" fill="#F07B2A"/><rect x="16" y="28" width="160" height="16" rx="8" fill="#F4A36A"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><rect x="32" y="52" width="128" height="72" rx="4" fill="#000000"/></g><rect x="32" y="52" width="128" height="72" rx="4" fill="#FFFFFF"/><rect x="48" y="96" width="16" height="16" rx="2" fill="#F07B2A"/><rect x="72" y="80" width="16" height="32" rx="2" fill="#F07B2A"/><rect x="96" y="66" width="16" height="46" rx="2" fill="#F07B2A"/><path d="M136 66A16 16 0 1 0 152 82H136Z" fill="#5D7FC9"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256"><defs><filter id="body" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="2.88"/></filter><filter id="fold" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="0.96"/></filter><filter id="part" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="1.28"/></filter></defs><path fill="#F4F4F2" d="M231 128C231 229.764 229.764 231 128 231C26.236 231 25 229.764 25 128C25 26.236 26.236 25 128 25C229.764 25 231 26.236 231 128Z"/><g transform="translate(39.420 43.420) scale(0.9227)"><g transform="translate(0 4)" opacity="0.2" filter="url(#body)"><path d="M40 16H112L160 64V168A8 8 0 0 1 152 176H40A8 8 0 0 1 32 168V24A8 8 0 0 1 40 16Z" fill="#000000"/></g><path d="M40 16H112L160 64V168A8 8 0 0 1 152 176H40A8 8 0 0 1 32 168V24A8 8 0 0 1 40 16Z" fill="#2E9E5B"/><g transform="translate(0 2)" opacity="0.2" filter="url(#fold)"><path d="M112 16V56A8 8 0 0 0 120 64H160Z" fill="#000000"/></g><path d="M112 16V56A8 8 0 0 0 120 64H160Z" fill="#8CCAA5"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><path fill-rule="evenodd" d="M52 92H140V156H52ZM60 108H92V120H60ZM100 108H132V120H100ZM60 128H92V140H60ZM100 128H132V140H100Z" fill="#000000"/></g><path fill-rule="evenodd" d="M52 92H140V156H52ZM60 108H92V120H60ZM100 108H132V120H100ZM60 128H92V140H60ZM100 128H132V140H100Z" fill="#FFFFFF"/><rect x="100" y="128" width="32" height="12" rx="0" fill="#FFD54F"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256"><defs><filter id="body" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="2.88"/></filter><filter id="fold" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="0.96"/></filter><filter id="part" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="1.28"/></filter></defs><g transform="scale(1.333333)"><g transform="translate(0 4)" opacity="0.2" filter="url(#body)"><path d="M40 16H112L160 64V168A8 8 0 0 1 152 176H40A8 8 0 0 1 32 168V24A8 8 0 0 1 40 16Z" fill="#000000"/></g><path d="M40 16H112L160 64V168A8 8 0 0 1 152 176H40A8 8 0 0 1 32 168V24A8 8 0 0 1 40 16Z" fill="#2E9E5B"/><g transform="translate(0 2)" opacity="0.2" filter="url(#fold)"><path d="M112 16V56A8 8 0 0 0 120 64H160Z" fill="#000000"/></g><path d="M112 16V56A8 8 0 0 0 120 64H160Z" fill="#8CCAA5"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><path fill-rule="evenodd" d="M52 92H140V156H52ZM60 108H92V120H60ZM100 108H132V120H100ZM60 128H92V140H60ZM100 128H132V140H100Z" fill="#000000"/></g><path fill-rule="evenodd" d="M52 92H140V156H52ZM60 108H92V120H60ZM100 108H132V120H100ZM60 128H92V140H60ZM100 128H132V140H100Z" fill="#FFFFFF"/><rect x="100" y="128" width="32" height="12" rx="0" fill="#FFD54F"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256"><defs><filter id="part" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="1.28"/></filter></defs><path fill="#F4F4F2" d="M231 128C231 229.764 229.764 231 128 231C26.236 231 25 229.764 25 128C25 26.236 26.236 25 128 25C229.764 25 231 26.236 231 128Z"/><g transform="translate(39.420 43.420) scale(0.9227)"><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><polyline points="64,44 64,148" fill="none" stroke="#000000" stroke-width="20" stroke-linecap="round" stroke-linejoin="round"/></g><polyline points="64,44 64,148" fill="none" stroke="#7E57C2" stroke-width="20" stroke-linecap="round" stroke-linejoin="round"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><path d="M64 128C64 92 128 104 128 72" fill="none" stroke="#000000" stroke-width="20" stroke-linecap="round"/></g><path d="M64 128C64 92 128 104 128 72" fill="none" stroke="#7E57C2" stroke-width="20" stroke-linecap="round"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><circle cx="64" cy="40" r="24" fill="#000000"/></g><circle cx="64" cy="40" r="24" fill="#7E57C2"/><circle cx="64" cy="40" r="11" fill="#FFFFFF"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><circle cx="128" cy="64" r="24" fill="#000000"/></g><circle cx="128" cy="64" r="24" fill="#7E57C2"/><circle cx="128" cy="64" r="11" fill="#FFFFFF"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><circle cx="64" cy="152" r="24" fill="#000000"/></g><circle cx="64" cy="152" r="24" fill="#F2A900"/><circle cx="64" cy="152" r="11" fill="#FFFFFF"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256"><defs><filter id="part" x="-0.2" y="-0.2" width="1.4" height="1.4"><feGaussianBlur stdDeviation="1.28"/></filter></defs><g transform="scale(1.333333)"><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><polyline points="64,44 64,148" fill="none" stroke="#000000" stroke-width="20" stroke-linecap="round" stroke-linejoin="round"/></g><polyline points="64,44 64,148" fill="none" stroke="#7E57C2" stroke-width="20" stroke-linecap="round" stroke-linejoin="round"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><path d="M64 128C64 92 128 104 128 72" fill="none" stroke="#000000" stroke-width="20" stroke-linecap="round"/></g><path d="M64 128C64 92 128 104 128 72" fill="none" stroke="#7E57C2" stroke-width="20" stroke-linecap="round"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><circle cx="64" cy="40" r="24" fill="#000000"/></g><circle cx="64" cy="40" r="24" fill="#7E57C2"/><circle cx="64" cy="40" r="11" fill="#FFFFFF"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><circle cx="128" cy="64" r="24" fill="#000000"/></g><circle cx="128" cy="64" r="24" fill="#7E57C2"/><circle cx="128" cy="64" r="11" fill="#FFFFFF"/><g transform="translate(0 2)" opacity="0.2" filter="url(#part)"><circle cx="64" cy="152" r="24" fill="#000000"/></g><circle cx="64" cy="152" r="24" fill="#F2A900"/><circle cx="64" cy="152" r="11" fill="#FFFFFF"/></g></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,306 @@
|
||||
"""Real input, window placement and capture for the video."""
|
||||
import ctypes
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import time
|
||||
import tkinter
|
||||
from contextlib import contextmanager
|
||||
from ctypes import wintypes
|
||||
from pathlib import Path
|
||||
|
||||
from PIL import ImageGrab
|
||||
|
||||
user32 = ctypes.windll.user32
|
||||
user32.SetProcessDpiAwarenessContext(ctypes.c_void_p(-4))
|
||||
user32.SetWindowPos.argtypes = [wintypes.HWND, wintypes.HWND, ctypes.c_int, ctypes.c_int, ctypes.c_int,
|
||||
ctypes.c_int, wintypes.UINT]
|
||||
ctypes.windll.winmm.timeBeginPeriod(1)
|
||||
|
||||
# The captured region, in physical pixels.
|
||||
X0, Y0, W, H = 1536, 504, 2048, 1152
|
||||
APPS = Path(os.environ["LOCALAPPDATA"]) / "Programs" / "Ely Office"
|
||||
DATA = Path(os.environ["LOCALAPPDATA"]) / "ElyOffice"
|
||||
KEEP = DATA.with_name("ElyOffice.video-keep")
|
||||
FFMPEG = shutil.which("ffmpeg")
|
||||
|
||||
|
||||
class MOUSEINPUT(ctypes.Structure):
|
||||
_fields_ = [("dx", wintypes.LONG), ("dy", wintypes.LONG), ("mouseData", wintypes.DWORD),
|
||||
("dwFlags", wintypes.DWORD), ("time", wintypes.DWORD), ("dwExtraInfo", ctypes.c_size_t)]
|
||||
|
||||
|
||||
class KEYBDINPUT(ctypes.Structure):
|
||||
_fields_ = [("wVk", wintypes.WORD), ("wScan", wintypes.WORD), ("dwFlags", wintypes.DWORD),
|
||||
("time", wintypes.DWORD), ("dwExtraInfo", ctypes.c_size_t)]
|
||||
|
||||
|
||||
class _U(ctypes.Union):
|
||||
_fields_ = [("mi", MOUSEINPUT), ("ki", KEYBDINPUT), ("pad", ctypes.c_byte * 32)]
|
||||
|
||||
|
||||
class INPUT(ctypes.Structure):
|
||||
_fields_ = [("type", wintypes.DWORD), ("u", _U)]
|
||||
|
||||
|
||||
def _send(*inputs):
|
||||
arr = (INPUT * len(inputs))(*inputs)
|
||||
if user32.SendInput(len(inputs), arr, ctypes.sizeof(INPUT)) != len(inputs):
|
||||
raise OSError("SendInput was blocked")
|
||||
|
||||
|
||||
def _mouse(flags, data=0):
|
||||
i = INPUT(type=0)
|
||||
i.u.mi = MOUSEINPUT(0, 0, data, flags, 0, 0)
|
||||
return i
|
||||
|
||||
|
||||
def _key(vk=0, scan=0, flags=0):
|
||||
i = INPUT(type=1)
|
||||
i.u.ki = KEYBDINPUT(vk, scan, flags, 0, 0)
|
||||
return i
|
||||
|
||||
|
||||
VK = {"ctrl": 0x11, "shift": 0x10, "alt": 0x12, "enter": 0x0D, "esc": 0x1B, "tab": 0x09,
|
||||
"up": 0x26, "down": 0x28, "left": 0x25, "right": 0x27, "back": 0x08, "space": 0x20,
|
||||
"home": 0x24, "end": 0x23, "delete": 0x2E, "=": 0xBB, "-": 0xBD}
|
||||
EXTENDED = {0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x2D, 0x2E}
|
||||
|
||||
|
||||
class Take:
|
||||
"""One recorded clip: the capture and its input log."""
|
||||
|
||||
def __init__(self, name, out: Path):
|
||||
self.name, self.out = name, out
|
||||
self.events = []
|
||||
self.zero = None
|
||||
self.proc = None
|
||||
|
||||
# Positions are region pixels; the log keeps them so.
|
||||
def log(self, kind, **fields):
|
||||
self.events.append({"t": round(time.perf_counter() - self.zero, 4), "kind": kind, **fields})
|
||||
|
||||
def start(self):
|
||||
path = self.out / f"{self.name}.mp4"
|
||||
grab = (f"ddagrab=output_idx=0:framerate=60:offset_x={X0}:offset_y={Y0}:"
|
||||
f"video_size={W}x{H}:draw_mouse=0,hwdownload,format=bgra")
|
||||
self.proc = subprocess.Popen(
|
||||
[FFMPEG, "-hide_banner", "-loglevel", "error", "-y", "-f", "lavfi", "-i", grab,
|
||||
"-c:v", "h264_nvenc", "-preset", "p7", "-tune", "hq", "-rc", "vbr", "-cq", "14",
|
||||
"-pix_fmt", "yuv420p", str(path)], stdin=subprocess.PIPE)
|
||||
self.zero = time.perf_counter()
|
||||
time.sleep(1.5)
|
||||
if self.proc.poll() is not None:
|
||||
raise RuntimeError("the capture stopped at once")
|
||||
# A corner square flashes; a frame diff finds it.
|
||||
front = user32.GetForegroundWindow()
|
||||
flash = tkinter.Tk()
|
||||
flash.overrideredirect(True)
|
||||
flash.attributes("-topmost", True)
|
||||
flash.configure(bg="#ff00ff")
|
||||
flash.geometry(f"60x60+{X0 + W - 90}+{Y0 + H - 90}")
|
||||
flash.update()
|
||||
self.log("sync", x=W - 60, y=H - 60)
|
||||
time.sleep(0.3)
|
||||
flash.destroy()
|
||||
_send(_key(0x12), _key(0x12, 0, 2))
|
||||
user32.SetForegroundWindow(front)
|
||||
time.sleep(0.5)
|
||||
if user32.GetForegroundWindow() != front:
|
||||
raise RuntimeError("the app lost the foreground to the sync flash")
|
||||
|
||||
def stop(self):
|
||||
time.sleep(0.8)
|
||||
self.proc.communicate(b"q")
|
||||
if self.proc.returncode != 0:
|
||||
raise RuntimeError(f"the capture failed: {self.proc.returncode}")
|
||||
(self.out / f"{self.name}.json").write_text(json.dumps(self.events, ensure_ascii=False, indent=1),
|
||||
encoding="utf-8")
|
||||
|
||||
|
||||
TAKE: Take | None = None
|
||||
|
||||
|
||||
def _log(kind, **fields):
|
||||
if TAKE is not None and TAKE.zero is not None:
|
||||
TAKE.log(kind, **fields)
|
||||
|
||||
|
||||
def where():
|
||||
p = wintypes.POINT()
|
||||
user32.GetCursorPos(ctypes.byref(p))
|
||||
return p.x - X0, p.y - Y0
|
||||
|
||||
|
||||
def _ease(t):
|
||||
return 0.5 - 0.5 * math.cos(math.pi * t)
|
||||
|
||||
|
||||
def move_to(x, y, dur=0.6, path=None):
|
||||
"""Moves the pointer to region (x, y); `path` bends the line."""
|
||||
sx, sy = where()
|
||||
steps = max(1, int(dur * 240))
|
||||
start = time.perf_counter()
|
||||
for i in range(1, steps + 1):
|
||||
f = _ease(i / steps)
|
||||
px, py = (path(f) if path else (sx + (x - sx) * f, sy + (y - sy) * f))
|
||||
user32.SetCursorPos(int(round(X0 + px)), int(round(Y0 + py)))
|
||||
_log("move", x=round(px, 1), y=round(py, 1))
|
||||
target = start + i * dur / steps
|
||||
while time.perf_counter() < target:
|
||||
time.sleep(0.0005)
|
||||
user32.SetCursorPos(X0 + int(x), Y0 + int(y))
|
||||
|
||||
|
||||
def press(right=False):
|
||||
x, y = where()
|
||||
down, up = (0x8, 0x10) if right else (0x2, 0x4)
|
||||
_send(_mouse(down))
|
||||
_log("down", x=x, y=y, right=right)
|
||||
time.sleep(0.07)
|
||||
_send(_mouse(up))
|
||||
_log("up", x=x, y=y, right=right)
|
||||
|
||||
|
||||
def click(x, y, dur=0.6, right=False, settle=0.12):
|
||||
move_to(x, y, dur)
|
||||
time.sleep(settle)
|
||||
press(right)
|
||||
|
||||
|
||||
def wheel(notches, gap=0.09):
|
||||
"""Scrolls `notches` (negative is down), one notch at a time."""
|
||||
step = -120 if notches < 0 else 120
|
||||
for _ in range(abs(notches)):
|
||||
_send(_mouse(0x0800, step & 0xFFFFFFFF))
|
||||
x, y = where()
|
||||
_log("wheel", x=x, y=y, down=notches < 0)
|
||||
time.sleep(gap)
|
||||
|
||||
|
||||
def drag(x, y, dur=1.0):
|
||||
sx, sy = where()
|
||||
_send(_mouse(0x2))
|
||||
_log("down", x=sx, y=sy, right=False)
|
||||
time.sleep(0.15)
|
||||
move_to(x, y, dur)
|
||||
time.sleep(0.15)
|
||||
_send(_mouse(0x4))
|
||||
_log("up", x=x, y=y, right=False)
|
||||
|
||||
|
||||
def key(chord, label=None):
|
||||
codes = [VK[k] if k in VK else ord(k.upper()) for k in chord.split("+")]
|
||||
downs = [_key(c, 0, 1 if c in EXTENDED else 0) for c in codes]
|
||||
ups = [_key(c, 0, (1 if c in EXTENDED else 0) | 2) for c in reversed(codes)]
|
||||
_send(*downs)
|
||||
_log("key", key=label or chord)
|
||||
time.sleep(0.05)
|
||||
_send(*ups)
|
||||
|
||||
|
||||
def type_text(text, cps=9.0):
|
||||
"""Types `text` as Unicode characters at a human pace."""
|
||||
for ch in text:
|
||||
if ch == "\n":
|
||||
key("enter")
|
||||
else:
|
||||
code = ord(ch)
|
||||
_send(_key(0, code, 4), _key(0, code, 4 | 2))
|
||||
_log("char", ch=ch)
|
||||
time.sleep(1 / cps)
|
||||
|
||||
|
||||
def window_of(pid, timeout=60):
|
||||
found = []
|
||||
|
||||
@ctypes.WINFUNCTYPE(wintypes.BOOL, wintypes.HWND, wintypes.LPARAM)
|
||||
def each(h, _):
|
||||
owner = wintypes.DWORD()
|
||||
user32.GetWindowThreadProcessId(h, ctypes.byref(owner))
|
||||
if owner.value == pid and user32.IsWindowVisible(h) and not user32.GetWindow(h, 4):
|
||||
found.append(h)
|
||||
return True
|
||||
|
||||
deadline = time.time() + timeout
|
||||
while time.time() < deadline:
|
||||
found.clear()
|
||||
user32.EnumWindows(each, 0)
|
||||
if found:
|
||||
return found[0]
|
||||
time.sleep(0.2)
|
||||
raise RuntimeError(f"process {pid} showed no window")
|
||||
|
||||
|
||||
def place(h):
|
||||
user32.ShowWindow(h, 9)
|
||||
if not user32.SetWindowPos(h, -1, X0, Y0, W, H, 0x40):
|
||||
raise ctypes.WinError()
|
||||
# The visible frame, without DWM's invisible border, fills the region.
|
||||
seen, outer = wintypes.RECT(), wintypes.RECT()
|
||||
ctypes.windll.dwmapi.DwmGetWindowAttribute(h, 9, ctypes.byref(seen), ctypes.sizeof(seen))
|
||||
user32.GetWindowRect(h, ctypes.byref(outer))
|
||||
left, top = seen.left - outer.left, seen.top - outer.top
|
||||
right, bottom = outer.right - seen.right, outer.bottom - seen.bottom
|
||||
user32.SetWindowPos(h, -1, X0 - left, Y0 - top, W + left + right, H + top + bottom, 0x40)
|
||||
# Alt lets this process take the foreground.
|
||||
_send(_key(0x12), _key(0x12, 0, 2))
|
||||
user32.SetForegroundWindow(h)
|
||||
time.sleep(0.4)
|
||||
if user32.GetForegroundWindow() != h:
|
||||
raise RuntimeError("the app is not in front; no input sent")
|
||||
|
||||
|
||||
def shot(path, scale=0.5):
|
||||
img = ImageGrab.grab(bbox=(X0, Y0, X0 + W, Y0 + H), all_screens=True)
|
||||
img.resize((int(W * scale), int(H * scale))).save(path)
|
||||
|
||||
|
||||
def launch(app, exe, *files, wait=6.0):
|
||||
env = dict(os.environ, ELY_LOCALE="zh-CN", ELY_APPEARANCE="dark", ELY_LOG="info", ELY_NO_DIALOG="1")
|
||||
proc = subprocess.Popen([str(APPS / app / exe), *map(str, files)], env=env)
|
||||
h = window_of(proc.pid)
|
||||
place(h)
|
||||
time.sleep(wait)
|
||||
place(h)
|
||||
return proc, h
|
||||
|
||||
|
||||
def quit_all():
|
||||
for exe in ("ely-doc", "ely-table", "ely-show", "ely-mark", "ely-pdf", "ely-tree"):
|
||||
subprocess.run(["taskkill", "/F", "/IM", f"{exe}.exe"], capture_output=True)
|
||||
for exe in ("ely-lok-worker", "ely-pdf-worker"):
|
||||
subprocess.run(["taskkill", "/F", "/IM", f"{exe}.exe"], capture_output=True)
|
||||
time.sleep(1.5)
|
||||
|
||||
|
||||
@contextmanager
|
||||
def fresh_data():
|
||||
"""The user's ElyOffice data waits aside; recordings start clean."""
|
||||
if KEEP.exists():
|
||||
raise RuntimeError(f"{KEEP} exists: restore it by hand first")
|
||||
quit_all()
|
||||
if DATA.exists():
|
||||
DATA.rename(KEEP)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
quit_all()
|
||||
if DATA.exists():
|
||||
shutil.rmtree(DATA)
|
||||
if KEEP.exists():
|
||||
KEEP.rename(DATA)
|
||||
|
||||
|
||||
@contextmanager
|
||||
def take(name, out: Path):
|
||||
global TAKE
|
||||
TAKE = Take(name, out)
|
||||
TAKE.start()
|
||||
try:
|
||||
yield TAKE
|
||||
finally:
|
||||
TAKE.stop()
|
||||
TAKE = None
|
||||
@@ -0,0 +1,15 @@
|
||||
# Usage: explore.py <app> <exe> <file|-> <out.png> [python actions]
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from drive import * # noqa: F403
|
||||
|
||||
app, exe, file, out = sys.argv[1:5]
|
||||
actions = sys.argv[5] if len(sys.argv) > 5 else ""
|
||||
with fresh_data():
|
||||
files = [] if file == "-" else [Path(file).resolve()]
|
||||
proc, h = launch(app, exe, *files)
|
||||
exec(actions)
|
||||
time.sleep(0.6)
|
||||
shot(out)
|
||||
@@ -0,0 +1,27 @@
|
||||
"""Copies synced takes into public/footage: prep.py <takes dir>"""
|
||||
import json
|
||||
import shutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
TAKES = ["menus", "cells", "doc", "table", "show", "more"]
|
||||
# Recorded submenu panels (x0, y0, x1, y1) for the triangle.
|
||||
SUBMENUS = {
|
||||
"menus": {"parent": [1100, 610, 1396, 652], "panel": [1394, 576, 1784, 1144]},
|
||||
"doc": {"parent": [1072, 702, 1370, 742], "panel": [1364, 698, 1660, 874]},
|
||||
"show": {"parent": [1182, 598, 1478, 638], "panel": [1474, 594, 1770, 774]},
|
||||
}
|
||||
|
||||
root = Path(sys.argv[1])
|
||||
out = Path(__file__).resolve().parent.parent / "public" / "footage"
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
for name in TAKES:
|
||||
offset = json.loads((root / f"{name}.sync.json").read_text())["offset"]
|
||||
events = json.loads((root / f"{name}.json").read_text(encoding="utf-8"))
|
||||
for event in events:
|
||||
event["t"] = round(event["t"] + offset, 4)
|
||||
shutil.copyfile(root / f"{name}.60.mp4", out / f"{name}.mp4")
|
||||
data = {"fps": 60, "size": [2048, 1152], "events": events, "menus": SUBMENUS.get(name)}
|
||||
(out / f"{name}.json").write_text(json.dumps(data, ensure_ascii=False), encoding="utf-8")
|
||||
actions = [e for e in events if e["kind"] not in ("move", "sync")]
|
||||
print(name, " ".join(f"{e['kind']}@{e['t']:.2f}" for e in actions))
|
||||
@@ -0,0 +1,100 @@
|
||||
# Writes the sample files the recordings open. Usage: samples.py <dir>
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import docx
|
||||
import openpyxl
|
||||
from docx.oxml.ns import qn
|
||||
from docx.shared import Pt
|
||||
from openpyxl.styles import Font
|
||||
from pptx import Presentation
|
||||
from pptx.util import Inches, Pt as PPt
|
||||
|
||||
out = Path(sys.argv[1])
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
ROWS = [
|
||||
("模块", "负责人", "状态", "进度"),
|
||||
("编辑器", "林夏", "已完成", "100%"),
|
||||
("表格", "周沐", "进行中", "72%"),
|
||||
("演示", "陈一", "进行中", "58%"),
|
||||
("发布", "许言", "未开始", "0%"),
|
||||
]
|
||||
|
||||
mark = """# 0.1.5 发布计划
|
||||
|
||||
这一版的重点是**更顺手**:菜单、表格与右键都照常用的软件来。
|
||||
|
||||
| 模块 | 负责人 | 状态 | 进度 |
|
||||
| --- | --- | --- | --- |
|
||||
| 编辑器 | 林夏 | **已完成** | 100% |
|
||||
| 表格 | 周沐 | 进行中 | 72% |
|
||||
| 演示 | 陈一 | 进行中 | 58% |
|
||||
| 发布 | 许言 | 未开始 | 0% |
|
||||
|
||||
> [!TIP]
|
||||
> 点任意一格即可在格内编辑,Tab 到下一格。
|
||||
|
||||
## 下一步
|
||||
|
||||
- 收集反馈 :rocket:
|
||||
- 整理文档
|
||||
"""
|
||||
(out / "发布计划.md").write_text(mark, encoding="utf-8")
|
||||
(out / "会议记录.md").write_text("# 会议记录\n\n- 确认发布时间\n", encoding="utf-8")
|
||||
(out / "读书笔记.md").write_text("# 读书笔记\n\n摘录与想法。\n", encoding="utf-8")
|
||||
|
||||
d = docx.Document()
|
||||
d.styles["Normal"].font.size = Pt(12)
|
||||
# One installed face for every script: no missing-font banner.
|
||||
FACE = "微软雅黑"
|
||||
defaults = d.styles.element.find(qn("w:docDefaults"))
|
||||
for fonts in [*defaults.iter(qn("w:rFonts")), *(style.element.get_or_add_rPr().get_or_add_rFonts()
|
||||
for style in d.styles if style.type == 1)]:
|
||||
for name in list(fonts.attrib):
|
||||
if name.endswith("Theme"):
|
||||
del fonts.attrib[name]
|
||||
for attr in ("w:ascii", "w:hAnsi", "w:eastAsia", "w:cs"):
|
||||
fonts.set(qn(attr), FACE)
|
||||
d.add_heading("第三季度工作汇报", 1)
|
||||
d.add_paragraph("本季度完成了编辑器与表格两大模块,演示模块进入收尾阶段。下表列出各模块的负责人与进度。")
|
||||
t = d.add_table(rows=len(ROWS), cols=4)
|
||||
t.style = "Table Grid"
|
||||
for r, row in enumerate(ROWS):
|
||||
for c, value in enumerate(row):
|
||||
t.cell(r, c).text = value
|
||||
d.add_paragraph("下季度计划:完善导出与打印,补齐快捷键。")
|
||||
d.save(out / "工作汇报.docx")
|
||||
|
||||
wb = openpyxl.Workbook()
|
||||
ws = wb.active
|
||||
ws.title = "销售"
|
||||
ws.append(["地区", "一月", "二月", "三月", "合计"])
|
||||
data = [("华东", 128, 142, 160), ("华南", 96, 104, 121), ("华北", 88, 97, 110), ("西南", 64, 71, 83)]
|
||||
for i, (name, *months) in enumerate(data, start=2):
|
||||
ws.append([name, *months, f"=SUM(B{i}:D{i})"])
|
||||
ws.append(["合计", "=SUM(B2:B5)", "=SUM(C2:C5)", "=SUM(D2:D5)", "=SUM(E2:E5)"])
|
||||
for cell in ws[1]:
|
||||
cell.font = Font(bold=True)
|
||||
for col in "ABCDE":
|
||||
ws.column_dimensions[col].width = 12
|
||||
wb.save(out / "季度销售.xlsx")
|
||||
|
||||
p = Presentation()
|
||||
p.slide_width, p.slide_height = Inches(13.333), Inches(7.5)
|
||||
s = p.slides.add_slide(p.slide_layouts[0])
|
||||
s.shapes.title.text = "Ely Office 0.1.5"
|
||||
s.placeholders[1].text = "更顺手的一次更新"
|
||||
s = p.slides.add_slide(p.slide_layouts[5])
|
||||
s.shapes.title.text = "模块进度"
|
||||
table = s.shapes.add_table(len(ROWS), 4, Inches(1.2), Inches(2), Inches(10.9), Inches(3.6)).table
|
||||
for r, row in enumerate(ROWS):
|
||||
for c, value in enumerate(row):
|
||||
table.cell(r, c).text = value
|
||||
table.cell(r, c).text_frame.paragraphs[0].runs[0].font.size = PPt(20)
|
||||
for title in ("用户反馈", "编辑器", "表格", "演示", "文档", "快捷键", "右键菜单", "跨平台", "发布节奏", "下一步"):
|
||||
s = p.slides.add_slide(p.slide_layouts[1])
|
||||
s.shapes.title.text = title
|
||||
s.placeholders[1].text = "要点一\n要点二"
|
||||
p.save(out / "季度汇报.pptx")
|
||||
print("samples in", out)
|
||||
@@ -0,0 +1,42 @@
|
||||
"""Syncs takes to their logs: sync.py <takes dir> <name> ..."""
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import av
|
||||
import numpy as np
|
||||
|
||||
|
||||
def first_change(video: Path, x: int, y: int, after: float, until: float):
|
||||
"""The first frame time when the patch at (x, y) changes."""
|
||||
with av.open(str(video)) as box:
|
||||
stream = box.streams.video[0]
|
||||
start = float(stream.start_time * stream.time_base) if stream.start_time else 0.0
|
||||
base = None
|
||||
for frame in box.decode(stream):
|
||||
t = float(frame.pts * stream.time_base) - start
|
||||
if t < after:
|
||||
continue
|
||||
if t > until:
|
||||
break
|
||||
patch = frame.to_ndarray(format="gray")[y - 24:y + 24, x - 24:x + 24].astype(np.int16)
|
||||
if base is None:
|
||||
base = patch
|
||||
continue
|
||||
if np.abs(patch - base).mean() > 6:
|
||||
return t, start
|
||||
raise RuntimeError(f"{video.name}: no sync jump between {after} and {until} s")
|
||||
|
||||
|
||||
root = Path(sys.argv[1])
|
||||
for name in sys.argv[2:]:
|
||||
events = json.loads((root / f"{name}.json").read_text(encoding="utf-8"))
|
||||
sync = next(e for e in events if e["kind"] == "sync")
|
||||
seen, start = first_change(root / f"{name}.mp4", sync["x"], sync["y"], sync["t"] - 0.5, sync["t"] + 1.5)
|
||||
offset = round(seen - sync["t"], 4)
|
||||
(root / f"{name}.sync.json").write_text(json.dumps({"offset": offset, "start": start}), encoding="utf-8")
|
||||
subprocess.run(["ffmpeg", "-hide_banner", "-loglevel", "error", "-y", "-i", str(root / f"{name}.mp4"),
|
||||
"-vf", "fps=60", "-c:v", "h264_nvenc", "-preset", "p7", "-rc", "vbr", "-cq", "14",
|
||||
"-g", "30", "-pix_fmt", "yuv420p", str(root / f"{name}.60.mp4")], check=True)
|
||||
print(f"{name}: jump seen at {seen:.3f} s, logged at {sync['t']:.3f} s, offset {offset:+.3f} s")
|
||||
@@ -0,0 +1,156 @@
|
||||
"""Records the takes: takes.py <out> <samples> [take ...]"""
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from drive import * # noqa: F403
|
||||
from drive import _log
|
||||
|
||||
|
||||
def menus(files):
|
||||
"""ElyMark: right-click › 表格 ▸, a diagonal over 插入 into the submenu."""
|
||||
proc, h = launch("ElyMark", "ely-mark.exe", files / "发布计划.md")
|
||||
with take("menus", OUT):
|
||||
move_to(900, 520, 0.8)
|
||||
time.sleep(0.4)
|
||||
click(1100, 394, 0.8, right=True)
|
||||
time.sleep(0.9)
|
||||
move_to(1200, 632, 0.7)
|
||||
time.sleep(1.1)
|
||||
# Across 插入, which has its own submenu, to 下移该行.
|
||||
move_to(1490, 824, 0.95)
|
||||
time.sleep(0.8)
|
||||
press()
|
||||
time.sleep(1.6)
|
||||
move_to(1000, 900, 0.9)
|
||||
time.sleep(0.8)
|
||||
|
||||
|
||||
def cells(files):
|
||||
"""ElyMark: a cell opens alone, shows its source, Tab and arrows move."""
|
||||
proc, h = launch("ElyMark", "ely-mark.exe", files / "发布计划.md")
|
||||
with take("cells", OUT):
|
||||
move_to(1000, 480, 0.8)
|
||||
time.sleep(0.3)
|
||||
click(1236, 344, 0.8)
|
||||
time.sleep(1.4)
|
||||
key("tab", "Tab")
|
||||
time.sleep(1.1)
|
||||
key("down", "↓")
|
||||
time.sleep(1.0)
|
||||
key("end", "End")
|
||||
time.sleep(0.3)
|
||||
for _ in range(3):
|
||||
key("back", "⌫")
|
||||
time.sleep(0.16)
|
||||
time.sleep(0.3)
|
||||
type_text("85%", cps=5)
|
||||
time.sleep(0.8)
|
||||
key("enter", "Enter")
|
||||
time.sleep(1.4)
|
||||
move_to(1100, 760, 0.8)
|
||||
time.sleep(0.8)
|
||||
|
||||
|
||||
def doc(files):
|
||||
"""ElyDoc: Word-style table menu, insert a row, drag a column border."""
|
||||
proc, h = launch("ElyDoc", "ely-doc.exe", files / "工作汇报.docx", wait=8)
|
||||
with take("doc", OUT):
|
||||
move_to(1000, 760, 0.8)
|
||||
time.sleep(0.3)
|
||||
click(1070, 634, 0.7)
|
||||
time.sleep(0.4)
|
||||
click(1070, 634, 0.2, right=True)
|
||||
time.sleep(0.9)
|
||||
move_to(1140, 722, 0.6)
|
||||
time.sleep(0.9)
|
||||
# Across 删除, which has its own submenu.
|
||||
move_to(1468, 848, 0.9)
|
||||
time.sleep(0.7)
|
||||
press()
|
||||
time.sleep(1.4)
|
||||
# The border between 负责人 and 状态.
|
||||
move_to(962, 560, 0.8)
|
||||
time.sleep(0.7)
|
||||
drag(1040, 560, 1.1)
|
||||
time.sleep(1.4)
|
||||
|
||||
|
||||
def table(files):
|
||||
"""ElyTable: Excel-style column header menu, insert a column."""
|
||||
proc, h = launch("ElyTable", "ely-table.exe", files / "季度销售.xlsx", wait=8)
|
||||
with take("table", OUT):
|
||||
move_to(600, 500, 0.8)
|
||||
time.sleep(0.3)
|
||||
click(406, 208, 0.8, right=True)
|
||||
time.sleep(1.1)
|
||||
move_to(510, 294, 0.6)
|
||||
time.sleep(0.6)
|
||||
press()
|
||||
time.sleep(1.6)
|
||||
move_to(700, 520, 0.8)
|
||||
time.sleep(0.6)
|
||||
|
||||
|
||||
def show(files):
|
||||
"""ElyShow: the slide strip scrolls; PowerPoint-style table menu."""
|
||||
proc, h = launch("ElyShow", "ely-show.exe", files / "季度汇报.pptx", wait=8)
|
||||
with take("show", OUT):
|
||||
move_to(180, 640, 0.9)
|
||||
time.sleep(0.3)
|
||||
wheel(-9, 0.11)
|
||||
time.sleep(0.6)
|
||||
wheel(9, 0.11)
|
||||
time.sleep(0.5)
|
||||
click(180, 380, 0.6)
|
||||
time.sleep(1.4)
|
||||
click(1180, 530, 0.8)
|
||||
time.sleep(0.4)
|
||||
click(1180, 530, 0.2, right=True)
|
||||
time.sleep(0.9)
|
||||
move_to(1250, 618, 0.6)
|
||||
time.sleep(0.8)
|
||||
move_to(1578, 662, 0.8)
|
||||
time.sleep(0.6)
|
||||
press()
|
||||
time.sleep(1.6)
|
||||
|
||||
|
||||
def more(files):
|
||||
"""ElyMark: a second launch hands its file over; the recent list clears."""
|
||||
proc, h = launch("ElyMark", "ely-mark.exe", files / "发布计划.md", files / "读书笔记.md")
|
||||
with take("more", OUT):
|
||||
move_to(900, 600, 0.8)
|
||||
time.sleep(0.6)
|
||||
env = dict(os.environ, ELY_LOCALE="zh-CN", ELY_APPEARANCE="dark")
|
||||
subprocess.Popen([str(APPS / "ElyMark" / "ely-mark.exe"), str(files / "会议记录.md")], env=env)
|
||||
_log("launch", file="会议记录.md")
|
||||
time.sleep(2.6)
|
||||
click(166, 1082, 1.0)
|
||||
time.sleep(1.8)
|
||||
move_to(700, 700, 0.8)
|
||||
time.sleep(0.6)
|
||||
|
||||
|
||||
OUT = Path(sys.argv[1])
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
SAMPLES = Path(sys.argv[2])
|
||||
ALL = {"menus": menus, "cells": cells, "doc": doc, "table": table, "show": show, "more": more}
|
||||
names = sys.argv[3:] or list(ALL)
|
||||
with fresh_data():
|
||||
for name in names:
|
||||
# Each take opens untouched copies under the same names.
|
||||
with tempfile.TemporaryDirectory(prefix="ely-video-") as tmp:
|
||||
files = Path(tmp) / "样例"
|
||||
shutil.copytree(SAMPLES, files)
|
||||
try:
|
||||
ALL[name](files)
|
||||
finally:
|
||||
quit_all()
|
||||
# The next take starts without this one's session.
|
||||
if DATA.exists():
|
||||
shutil.rmtree(DATA)
|
||||
print("recorded", name, flush=True)
|
||||
@@ -0,0 +1,7 @@
|
||||
import { Composition } from 'remotion';
|
||||
import { FPS, HEIGHT, TOTAL, WIDTH } from './theme';
|
||||
import { Video } from './Video';
|
||||
|
||||
export const Root: React.FC = () => (
|
||||
<Composition id="Update" component={Video} durationInFrames={TOTAL} fps={FPS} width={WIDTH} height={HEIGHT} />
|
||||
);
|
||||
@@ -0,0 +1,53 @@
|
||||
import { AbsoluteFill, Audio, Sequence, getStaticFiles, staticFile } from 'remotion';
|
||||
import './design/fonts';
|
||||
import { Background } from './design/Background';
|
||||
import { Intro } from './scenes/Intro';
|
||||
import { Outro } from './scenes/Outro';
|
||||
import { Menus } from './scenes/Menus';
|
||||
import { Cells } from './scenes/Cells';
|
||||
import { RightClick } from './scenes/RightClick';
|
||||
import { More } from './scenes/More';
|
||||
import { SECTION } from './theme';
|
||||
|
||||
// Set false to render without the score.
|
||||
const MUSIC = true;
|
||||
const MUSIC_FILE = 'audio/music.wav';
|
||||
const hasMusic = () => getStaticFiles().some((file) => file.name.split('\\').join('/') === MUSIC_FILE);
|
||||
|
||||
// Whooshes at each morph, impact on the outro downbeat.
|
||||
const MORPHS = [300, 840, 1440, 2340, 3090];
|
||||
|
||||
const at = (section: { from: number; duration: number }) => ({ from: section.from, durationInFrames: section.duration });
|
||||
|
||||
export const Video: React.FC = () => (
|
||||
<AbsoluteFill>
|
||||
<Background />
|
||||
<Sequence {...at(SECTION.intro)} name="Intro">
|
||||
<Intro />
|
||||
</Sequence>
|
||||
<Sequence {...at(SECTION.menus)} name="Menus">
|
||||
<Menus />
|
||||
</Sequence>
|
||||
<Sequence {...at(SECTION.cells)} name="Cells">
|
||||
<Cells />
|
||||
</Sequence>
|
||||
<Sequence {...at(SECTION.rightClick)} name="RightClick">
|
||||
<RightClick />
|
||||
</Sequence>
|
||||
<Sequence {...at(SECTION.more)} name="More">
|
||||
<More />
|
||||
</Sequence>
|
||||
<Sequence {...at(SECTION.outro)} name="Outro">
|
||||
<Outro />
|
||||
</Sequence>
|
||||
{MORPHS.map((frame) => (
|
||||
<Sequence key={frame} from={frame} durationInFrames={45} name="whoosh">
|
||||
<Audio src={staticFile('audio/sfx/whoosh.wav')} volume={0.35} />
|
||||
</Sequence>
|
||||
))}
|
||||
<Sequence from={3150} durationInFrames={90} name="impact">
|
||||
<Audio src={staticFile('audio/sfx/impact.wav')} volume={0.4} />
|
||||
</Sequence>
|
||||
{MUSIC && hasMusic() ? <Audio src={staticFile(MUSIC_FILE)} /> : null}
|
||||
</AbsoluteFill>
|
||||
);
|
||||
@@ -0,0 +1,24 @@
|
||||
import { AbsoluteFill, useCurrentFrame } from 'remotion';
|
||||
import { COLOR, HEIGHT, WIDTH } from '../theme';
|
||||
|
||||
// Near-black field with a faint lift at the centre and fine film grain. The grain
|
||||
// changes every other frame (30 Hz) from a seed fixed by the frame number.
|
||||
export const Background: React.FC = () => {
|
||||
const frame = useCurrentFrame();
|
||||
const seed = Math.floor(frame / 2) % 997;
|
||||
return (
|
||||
<AbsoluteFill style={{ background: COLOR.bgOuter }}>
|
||||
<AbsoluteFill
|
||||
style={{ background: `radial-gradient(ellipse 72% 66% at 50% 47%, ${COLOR.bgInner} 0%, ${COLOR.bgOuter} 100%)` }}
|
||||
/>
|
||||
<AbsoluteFill style={{ background: 'radial-gradient(ellipse 90% 90% at 50% 50%, rgba(0,0,0,0) 60%, rgba(0,0,0,0.28) 100%)' }} />
|
||||
<svg width={WIDTH} height={HEIGHT} style={{ position: 'absolute', inset: 0, opacity: 0.055, mixBlendMode: 'screen' }}>
|
||||
<filter id="grain" x="0" y="0" width="100%" height="100%">
|
||||
<feTurbulence type="fractalNoise" baseFrequency="0.85" numOctaves="2" seed={seed} stitchTiles="stitch" />
|
||||
<feColorMatrix type="saturate" values="0" />
|
||||
</filter>
|
||||
<rect width="100%" height="100%" filter="url(#grain)" />
|
||||
</svg>
|
||||
</AbsoluteFill>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
import { interpolate, useCurrentFrame } from 'remotion';
|
||||
import { COLOR, EASE, FONT, STAGE } from '../theme';
|
||||
|
||||
export type CaptionProps = {
|
||||
text: string;
|
||||
// Section-local frames: starts entering at `from`, gone by `to`.
|
||||
from: number;
|
||||
to: number;
|
||||
// Centre of the pill in composition pixels (default: bottom centre of the stage).
|
||||
x?: number;
|
||||
y?: number;
|
||||
};
|
||||
|
||||
const clamp = { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' } as const;
|
||||
|
||||
// A glass pill with one line of explanation, over the stage.
|
||||
export const Caption: React.FC<CaptionProps> = ({ text, from, to, x = STAGE.x + STAGE.w / 2, y = STAGE.y + STAGE.h - 64 }) => {
|
||||
const frame = useCurrentFrame();
|
||||
if (frame < from || frame >= to) return null;
|
||||
const p = interpolate(frame, [from, from + 22], [0, 1], { ...clamp, easing: EASE.out });
|
||||
const q = interpolate(frame, [to - 16, to], [0, 1], { ...clamp, easing: EASE.in });
|
||||
const blur = (1 - p) * 6 + q * 5;
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: x,
|
||||
top: y,
|
||||
transform: `translate(-50%, -50%) translateY(${((1 - p) * 14 - q * 8).toFixed(2)}px) scale(${(0.98 + 0.02 * p).toFixed(4)})`,
|
||||
opacity: p * (1 - q),
|
||||
filter: blur > 0.05 ? `blur(${blur.toFixed(2)}px)` : undefined,
|
||||
padding: '13px 26px 14px',
|
||||
borderRadius: 16,
|
||||
background: 'rgba(22,22,24,0.66)',
|
||||
backdropFilter: 'blur(18px) saturate(1.2)',
|
||||
border: '1px solid rgba(255,255,255,0.09)',
|
||||
boxShadow: '0 12px 40px rgba(0,0,0,0.42)',
|
||||
fontFamily: FONT.sans,
|
||||
fontWeight: 500,
|
||||
fontSize: 26,
|
||||
lineHeight: '34px',
|
||||
letterSpacing: '0.03em',
|
||||
color: COLOR.ink,
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
{text}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,203 @@
|
||||
import { Img, interpolate, staticFile, useCurrentFrame } from 'remotion';
|
||||
import { mix } from './Shape';
|
||||
import { type AppId, COLOR, EASE, FONT, HEADING, STAGE, appOf } from '../theme';
|
||||
|
||||
export type HeadingSpec = {
|
||||
title: string;
|
||||
sub?: string;
|
||||
// App chip at the right edge, above the stage.
|
||||
app?: AppId;
|
||||
// Section-local frame the title starts to enter (default: beat 1).
|
||||
at?: number;
|
||||
// Section-local frame it starts to leave (default: the next heading's
|
||||
// entrance, or HEADING.out frames before the section ends).
|
||||
until?: number;
|
||||
};
|
||||
|
||||
const ENTER = 28;
|
||||
const LEAVE = 22;
|
||||
|
||||
const clamp = { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' } as const;
|
||||
|
||||
// Per-character rise, unblur and fade; leaving drifts on up and dissolves.
|
||||
// The first `keepIn` characters are already on screen (shared with the previous
|
||||
// heading); the first `keepOut` stay for the next one until `handoff`.
|
||||
const Kinetic: React.FC<{
|
||||
text: string;
|
||||
local: number;
|
||||
leave: number;
|
||||
stagger: number;
|
||||
rise: number;
|
||||
keepIn?: number;
|
||||
keepOut?: number;
|
||||
handoff?: number;
|
||||
}> = ({ text, local, leave, stagger, rise, keepIn = 0, keepOut = 0, handoff = Infinity }) => {
|
||||
const chars = Array.from(text);
|
||||
return (
|
||||
<>
|
||||
{chars.map((char, i) => {
|
||||
const kept = i < keepOut;
|
||||
if (kept && local >= handoff) return <span key={i} style={{ display: 'inline-block', whiteSpace: 'pre', opacity: 0 }}>{char}</span>;
|
||||
const order = i - keepIn;
|
||||
const p = i < keepIn ? 1 : interpolate(local - order * stagger, [0, ENTER], [0, 1], { ...clamp, easing: EASE.out });
|
||||
const q = kept ? 0 : interpolate(local - leave - (i - keepOut) * stagger * 0.55, [0, LEAVE], [0, 1], { ...clamp, easing: EASE.in });
|
||||
const y = (1 - p) * rise - q * rise * 0.6;
|
||||
const blur = (1 - p) * 9 + q * 7;
|
||||
return (
|
||||
<span
|
||||
key={i}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
whiteSpace: 'pre',
|
||||
opacity: p * (1 - q),
|
||||
transform: `translateY(${y.toFixed(2)}px)`,
|
||||
filter: blur > 0.05 ? `blur(${blur.toFixed(2)}px)` : undefined,
|
||||
}}
|
||||
>
|
||||
{char}
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
// One section title above the stage's left edge, with an optional app chip.
|
||||
export type HeadingTiming = {
|
||||
spec: HeadingSpec;
|
||||
enter: number;
|
||||
leave: number;
|
||||
// Characters shared with the previous / next heading of the section.
|
||||
keepIn: number;
|
||||
keepOut: number;
|
||||
// Section-local frame the next heading takes over (null for the last).
|
||||
handoff: number | null;
|
||||
// Rule colour of the previous heading, which this one eases from.
|
||||
fromColor: string | null;
|
||||
};
|
||||
|
||||
export const Heading: React.FC<{ timing: HeadingTiming; color: string }> = ({ timing, color }) => {
|
||||
const { spec, enter, leave, keepIn, keepOut, handoff, fromColor } = timing;
|
||||
const frame = useCurrentFrame();
|
||||
const local = frame - enter;
|
||||
const until = handoff ?? leave + LEAVE + 40;
|
||||
if (local < 0 || frame >= until) return null;
|
||||
const stay = leave - enter;
|
||||
const subAt = HEADING.sub;
|
||||
const rule = fromColor === null ? interpolate(local, [-6, 22], [0, 1], { ...clamp, easing: EASE.out }) : 1;
|
||||
const ruleOut = handoff === null ? interpolate(local - stay - 8, [0, 18], [0, 1], { ...clamp, easing: EASE.inOut }) : 0;
|
||||
const ruleColor = fromColor === null ? color : mix(fromColor, color, interpolate(local, [0, 24], [0, 1], { ...clamp, easing: EASE.inOut }));
|
||||
const chip = interpolate(local - 10, [0, 30], [0, 1], { ...clamp, easing: EASE.out });
|
||||
const chipOut = interpolate(local - stay, [0, LEAVE], [0, 1], { ...clamp, easing: EASE.in });
|
||||
const app = spec.app ? appOf(spec.app) : null;
|
||||
return (
|
||||
<div style={{ position: 'absolute', left: STAGE.x, top: 28, width: STAGE.w, height: 76 }}>
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 6,
|
||||
width: 4,
|
||||
height: 64,
|
||||
borderRadius: 2,
|
||||
background: ruleColor,
|
||||
transformOrigin: '50% 0%',
|
||||
transform: `scaleY(${(rule * (1 - ruleOut)).toFixed(4)})`,
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: 22,
|
||||
top: 0,
|
||||
fontFamily: FONT.sans,
|
||||
fontWeight: 600,
|
||||
fontSize: 42,
|
||||
lineHeight: '48px',
|
||||
letterSpacing: '0.02em',
|
||||
color: COLOR.ink,
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
<Kinetic
|
||||
text={spec.title}
|
||||
local={local}
|
||||
leave={stay}
|
||||
stagger={1.8}
|
||||
rise={24}
|
||||
keepIn={keepIn}
|
||||
keepOut={keepOut}
|
||||
handoff={handoff === null ? Infinity : handoff - enter}
|
||||
/>
|
||||
</div>
|
||||
{spec.sub ? (
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: 23,
|
||||
top: 52,
|
||||
fontFamily: FONT.sans,
|
||||
fontWeight: 400,
|
||||
fontSize: 19,
|
||||
lineHeight: '24px',
|
||||
letterSpacing: '0.04em',
|
||||
color: COLOR.muted,
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
<Kinetic text={spec.sub} local={local - subAt} leave={stay - subAt - 6} stagger={0.55} rise={12} />
|
||||
</div>
|
||||
) : null}
|
||||
{app ? (
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
right: 0,
|
||||
top: 18,
|
||||
height: 40,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 12,
|
||||
opacity: chip * (1 - chipOut),
|
||||
transform: `translateX(${((1 - chip) * 18 - chipOut * 10).toFixed(2)}px)`,
|
||||
filter: chip < 1 || chipOut > 0 ? `blur(${((1 - chip) * 6 + chipOut * 5).toFixed(2)}px)` : undefined,
|
||||
}}
|
||||
>
|
||||
<Img src={staticFile(`icons/${app.id}.svg`)} style={{ width: 40, height: 40 }} />
|
||||
<span style={{ fontFamily: FONT.latin, fontWeight: 500, fontSize: 21, letterSpacing: '0.01em', color: COLOR.muted }}>
|
||||
{app.name}
|
||||
</span>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const shared = (a: string, b: string) => {
|
||||
const x = Array.from(a);
|
||||
const y = Array.from(b);
|
||||
let n = 0;
|
||||
while (n < x.length && n < y.length && x[n] === y[n]) n++;
|
||||
// Keep whole words only: stop after the last space of the shared run.
|
||||
const cut = x.slice(0, n).lastIndexOf(' ');
|
||||
return n === x.length || n === y.length ? n : cut + 1;
|
||||
};
|
||||
|
||||
// Resolve each heading's frames within a section; `accent` colours the rule.
|
||||
export const headingTimes = (specs: HeadingSpec[], duration: number, accent: (spec: HeadingSpec) => string): HeadingTiming[] =>
|
||||
specs.map((spec, i) => {
|
||||
const enter = spec.at ?? HEADING.in;
|
||||
const prev = specs[i - 1];
|
||||
const next = specs[i + 1];
|
||||
const nextAt = next ? (next.at ?? HEADING.in) : null;
|
||||
const leave = spec.until ?? (nextAt !== null ? nextAt - LEAVE - 6 : duration - HEADING.out);
|
||||
return {
|
||||
spec,
|
||||
enter,
|
||||
leave,
|
||||
keepIn: prev ? shared(prev.title, spec.title) : 0,
|
||||
keepOut: next ? shared(spec.title, next.title) : 0,
|
||||
handoff: nextAt,
|
||||
fromColor: prev ? accent(prev) : null,
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,108 @@
|
||||
import { Fragment } from 'react';
|
||||
import { interpolate, spring, useCurrentFrame, useVideoConfig } from 'remotion';
|
||||
import { COLOR, EASE, FONT, SPRING, STAGE } from '../theme';
|
||||
|
||||
export type KeyCapProps = {
|
||||
// Keys of one chord, e.g. ['Ctrl', '1'], ['Tab'], ['右键'].
|
||||
keys: string[];
|
||||
// Section-local frames: pops in at `from`, gone by `to`.
|
||||
from: number;
|
||||
to: number;
|
||||
// Section-local frames at which the chord is pressed.
|
||||
press?: number[];
|
||||
// Centre in composition pixels; default: bottom-right corner of the stage.
|
||||
x?: number;
|
||||
y?: number;
|
||||
};
|
||||
|
||||
const MOUSE: Record<string, 'left' | 'right' | 'wheel'> = { 右键: 'right', 左键: 'left', 点击: 'left', 滚轮: 'wheel' };
|
||||
|
||||
const clamp = { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' } as const;
|
||||
|
||||
const Mouse: React.FC<{ part: 'left' | 'right' | 'wheel'; lit: number }> = ({ part, lit }) => {
|
||||
const on = `rgba(61,127,229,${(0.55 + 0.45 * lit).toFixed(3)})`;
|
||||
return (
|
||||
<svg width="18" height="26" viewBox="0 0 18 26">
|
||||
<rect x="1" y="1" width="16" height="24" rx="8" fill="none" stroke={COLOR.ink} strokeOpacity="0.85" strokeWidth="1.6" />
|
||||
{part === 'left' ? <path d="M9 1.8A7.2 7.2 0 0 0 1.8 9V11H9Z" fill={on} /> : null}
|
||||
{part === 'right' ? <path d="M9 1.8A7.2 7.2 0 0 1 16.2 9V11H9Z" fill={on} /> : null}
|
||||
<path d="M9 1.8V11M1.8 11H16.2" stroke={COLOR.ink} strokeOpacity="0.5" strokeWidth="1.2" />
|
||||
<rect x="7.4" y="4.6" width="3.2" height="5" rx="1.6" fill={part === 'wheel' ? on : COLOR.ink} fillOpacity={part === 'wheel' ? 1 : 0.6} />
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
|
||||
// A keyboard chord or mouse button that pops in, presses on cue, and leaves.
|
||||
export const KeyCap: React.FC<KeyCapProps> = ({ keys, from, to, press = [], x, y }) => {
|
||||
const frame = useCurrentFrame();
|
||||
const { fps } = useVideoConfig();
|
||||
if (frame < from || frame >= to) return null;
|
||||
const pop = spring({ frame: frame - from, fps, config: SPRING, durationInFrames: 24 });
|
||||
const out = interpolate(frame, [to - 14, to], [0, 1], { ...clamp, easing: EASE.in });
|
||||
// Down in 4 frames, back up over 12.
|
||||
const down = press.reduce((acc, at) => {
|
||||
const t = frame - at;
|
||||
const v = t < 0 ? 0 : t < 4 ? EASE.out(t / 4) : 1 - EASE.inOut(Math.min(1, (t - 4) / 12));
|
||||
return Math.max(acc, v);
|
||||
}, 0);
|
||||
const anchored = x === undefined || y === undefined;
|
||||
const blur = (1 - pop) * 5 + out * 4;
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: x ?? STAGE.x + STAGE.w - 36,
|
||||
top: y ?? STAGE.y + STAGE.h - 36,
|
||||
transform: `translate(${anchored ? '-100%, -100%' : '-50%, -50%'}) translateY(${((1 - pop) * 12 + out * 6).toFixed(2)}px) scale(${(0.88 + 0.12 * pop - 0.04 * out).toFixed(4)})`,
|
||||
transformOrigin: anchored ? '100% 100%' : '50% 50%',
|
||||
opacity: Math.min(1, pop * 1.4) * (1 - out),
|
||||
filter: blur > 0.05 ? `blur(${blur.toFixed(2)}px)` : undefined,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 10,
|
||||
}}
|
||||
>
|
||||
{keys.map((key, i) => {
|
||||
const mouse = MOUSE[key];
|
||||
return (
|
||||
<Fragment key={`${key}-${i}`}>
|
||||
{i > 0 ? (
|
||||
<span style={{ fontFamily: FONT.latin, fontSize: 22, fontWeight: 400, color: COLOR.faint }}>+</span>
|
||||
) : null}
|
||||
<div
|
||||
style={{
|
||||
height: 58,
|
||||
minWidth: 58,
|
||||
padding: '0 18px',
|
||||
boxSizing: 'border-box',
|
||||
borderRadius: 13,
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
gap: 10,
|
||||
transform: `translateY(${(down * 3).toFixed(2)}px)`,
|
||||
background: 'linear-gradient(180deg, #3b3b3e 0%, #2d2d30 100%)',
|
||||
border: '1px solid rgba(255,255,255,0.12)',
|
||||
boxShadow: [
|
||||
`0 ${(4 - down * 3).toFixed(2)}px 0 #161618`,
|
||||
`0 ${(12 - down * 6).toFixed(2)}px 28px rgba(0,0,0,0.5)`,
|
||||
'inset 0 1px 0 rgba(255,255,255,0.10)',
|
||||
`0 0 0 ${(down * 2).toFixed(2)}px rgba(61,127,229,${(down * 0.7).toFixed(3)})`,
|
||||
].join(', '),
|
||||
fontFamily: FONT.latin,
|
||||
fontWeight: 600,
|
||||
fontSize: 23,
|
||||
letterSpacing: '0.01em',
|
||||
color: COLOR.ink,
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
>
|
||||
{mouse ? <Mouse part={mouse} lit={down} /> : null}
|
||||
<span style={{ fontFamily: mouse ? FONT.sans : FONT.latin, fontWeight: mouse ? 500 : 600 }}>{key}</span>
|
||||
</div>
|
||||
</Fragment>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,185 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { AbsoluteFill, Img, staticFile } from 'remotion';
|
||||
import { ICON, STAGE, STAGE_CENTER } from '../theme';
|
||||
import type { ShapeId } from './morph';
|
||||
|
||||
const lerp = (a: number, b: number, t: number) => a + (b - a) * t;
|
||||
|
||||
export const rgba = (hex: string, alpha: number) => {
|
||||
const n = parseInt(hex.slice(1), 16);
|
||||
return `rgba(${(n >> 16) & 255},${(n >> 8) & 255},${n & 255},${alpha.toFixed(4)})`;
|
||||
};
|
||||
|
||||
export const mix = (a: string, b: string, t: number) => {
|
||||
const x = parseInt(a.slice(1), 16);
|
||||
const y = parseInt(b.slice(1), 16);
|
||||
const c = (shift: number) => Math.round(lerp((x >> shift) & 255, (y >> shift) & 255, t));
|
||||
return `#${((c(16) << 16) | (c(8) << 8) | c(0)).toString(16).padStart(6, '0')}`;
|
||||
};
|
||||
|
||||
// The highlighted table cell that the cell-editing section grows out of.
|
||||
const CellArt: React.FC = () => (
|
||||
<svg viewBox="0 0 192 192" width="100%" height="100%">
|
||||
<rect x="16" y="51" width="160" height="90" rx="8" fill="#3E4A5C" />
|
||||
<path d="M24 51H168A8 8 0 0 1 176 59V69H16V59A8 8 0 0 1 24 51Z" fill="#4E5B70" />
|
||||
<g stroke="#FFFFFF" strokeOpacity="0.16" strokeWidth="1.2">
|
||||
<path d="M69.3 51V141M122.7 51V141M16 69H176M16 93H176M16 117H176" />
|
||||
</g>
|
||||
<g fill="#FFFFFF" fillOpacity="0.55">
|
||||
<rect x="24" y="57" width="26" height="6" rx="3" />
|
||||
<rect x="77" y="57" width="30" height="6" rx="3" />
|
||||
<rect x="130" y="57" width="22" height="6" rx="3" />
|
||||
<rect x="24" y="78" width="32" height="6" rx="3" />
|
||||
<rect x="130" y="78" width="28" height="6" rx="3" />
|
||||
<rect x="24" y="102" width="22" height="6" rx="3" />
|
||||
<rect x="130" y="102" width="34" height="6" rx="3" />
|
||||
<rect x="24" y="126" width="30" height="6" rx="3" />
|
||||
<rect x="77" y="126" width="24" height="6" rx="3" />
|
||||
<rect x="130" y="126" width="26" height="6" rx="3" />
|
||||
</g>
|
||||
<rect x="77" y="78" width="26" height="6" rx="3" fill="#FFFFFF" fillOpacity="0.55" />
|
||||
<rect x="68.5" y="92.5" width="55" height="25" rx="2.5" fill="#F2A900" />
|
||||
<rect x="76" y="102" width="28" height="6" rx="3" fill="#FFFFFF" />
|
||||
<rect x="107" y="99" width="2.4" height="12" rx="1.2" fill="#FFFFFF" />
|
||||
</svg>
|
||||
);
|
||||
|
||||
export type Details = { shape: ShapeId; opacity: number };
|
||||
|
||||
const Artwork: React.FC<{ details: Details; size: number; cx: number; cy: number }> = ({ details, size, cx, cy }) => {
|
||||
if (details.shape === 'dot' || details.opacity <= 0.001) return null;
|
||||
const style: React.CSSProperties = {
|
||||
position: 'absolute',
|
||||
left: cx - size / 2,
|
||||
top: cy - size / 2,
|
||||
width: size,
|
||||
height: size,
|
||||
opacity: details.opacity,
|
||||
};
|
||||
if (details.shape === 'cell') {
|
||||
return (
|
||||
<div style={style}>
|
||||
<CellArt />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return <Img src={staticFile(`icons/${details.shape}.svg`)} style={style} />;
|
||||
};
|
||||
|
||||
export type ShapeViewProps = {
|
||||
d: string;
|
||||
color: string;
|
||||
// Ambient glow colour (default: `color`).
|
||||
glowColor?: string;
|
||||
cx: number;
|
||||
cy: number;
|
||||
k: number;
|
||||
// App-colour wash over the content.
|
||||
fill: number;
|
||||
lift: number;
|
||||
border?: number;
|
||||
sweep?: number | null;
|
||||
details?: Details[];
|
||||
// Multiplier on shadow and glow, for shapes stacked on one another.
|
||||
presence?: number;
|
||||
content?: {
|
||||
node: ReactNode;
|
||||
opacity: number;
|
||||
scale: number;
|
||||
blur: number;
|
||||
background: string;
|
||||
};
|
||||
};
|
||||
|
||||
// One morphing shape: glow, shadow, clipped content, colour wash, artwork, edge.
|
||||
export const ShapeView: React.FC<ShapeViewProps> = ({
|
||||
d,
|
||||
color,
|
||||
glowColor = color,
|
||||
cx,
|
||||
cy,
|
||||
k,
|
||||
fill,
|
||||
lift,
|
||||
border = 0,
|
||||
sweep = null,
|
||||
details = [],
|
||||
presence = 1,
|
||||
content,
|
||||
}) => {
|
||||
const glowW = 400 * k;
|
||||
const glowH = glowW * lerp(1, 0.62, lift);
|
||||
const glowAlpha = lerp(0.3, 0.09, lift) * presence;
|
||||
const shadow = `drop-shadow(0 ${lerp(6, 34, lift).toFixed(2)}px ${lerp(10, 90, lift).toFixed(2)}px rgba(0,0,0,${(lerp(0.42, 0.6, lift) * presence).toFixed(3)}))`;
|
||||
const size = 192 * ICON.unit * k;
|
||||
const sweepX = sweep === null ? 0 : STAGE.x - 500 + sweep * (STAGE.w + 1000);
|
||||
return (
|
||||
<AbsoluteFill style={{ pointerEvents: 'none' }}>
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: cx - glowW / 2,
|
||||
top: cy - glowH / 2 + 24 * lift,
|
||||
width: glowW,
|
||||
height: glowH,
|
||||
background: `radial-gradient(closest-side, ${rgba(glowColor, glowAlpha)}, ${rgba(glowColor, 0)})`,
|
||||
}}
|
||||
/>
|
||||
<AbsoluteFill style={{ filter: shadow }}>
|
||||
<AbsoluteFill style={{ clipPath: `path('${d}')` }}>
|
||||
{content && content.opacity > 0.001 ? (
|
||||
<AbsoluteFill
|
||||
style={{
|
||||
opacity: content.opacity,
|
||||
transform: `scale(${content.scale})`,
|
||||
transformOrigin: `${STAGE_CENTER.x}px ${STAGE_CENTER.y}px`,
|
||||
filter: content.blur > 0.05 ? `blur(${content.blur.toFixed(2)}px)` : undefined,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: STAGE.x,
|
||||
top: STAGE.y,
|
||||
width: STAGE.w,
|
||||
height: STAGE.h,
|
||||
background: content.background,
|
||||
overflow: 'hidden',
|
||||
}}
|
||||
>
|
||||
{content.node}
|
||||
</div>
|
||||
</AbsoluteFill>
|
||||
) : null}
|
||||
{fill > 0.001 ? (
|
||||
<AbsoluteFill
|
||||
style={{
|
||||
// A soft top light that scales with the shape gives the flat colour depth.
|
||||
background: `radial-gradient(circle at ${cx.toFixed(1)}px ${(cy - 80 * k).toFixed(1)}px, rgba(255,255,255,0.09), rgba(255,255,255,0) ${(230 * k).toFixed(1)}px), ${color}`,
|
||||
opacity: fill,
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
</AbsoluteFill>
|
||||
</AbsoluteFill>
|
||||
{details.map((detail, i) => (
|
||||
<Artwork key={`${detail.shape}-${i}`} details={detail} size={size} cx={cx} cy={cy} />
|
||||
))}
|
||||
{border > 0.001 || sweep !== null ? (
|
||||
<svg width={1920} height={1080} style={{ position: 'absolute', inset: 0 }}>
|
||||
<defs>
|
||||
<linearGradient id="edge-sweep" gradientUnits="userSpaceOnUse" x1={sweepX - 260} y1={0} x2={sweepX + 260} y2={0}>
|
||||
<stop offset="0" stopColor="#FFFFFF" stopOpacity="0" />
|
||||
<stop offset="0.5" stopColor="#FFFFFF" stopOpacity="1" />
|
||||
<stop offset="1" stopColor="#FFFFFF" stopOpacity="0" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path d={d} fill="none" stroke={`rgba(255,255,255,${(0.08 * border).toFixed(4)})`} strokeWidth={1} />
|
||||
{sweep !== null ? (
|
||||
<path d={d} fill="none" stroke="url(#edge-sweep)" strokeWidth={1.25} opacity={0.42 * Math.sin(Math.PI * sweep)} />
|
||||
) : null}
|
||||
</svg>
|
||||
) : null}
|
||||
</AbsoluteFill>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,75 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { AbsoluteFill, useCurrentFrame, useVideoConfig } from 'remotion';
|
||||
import { COLOR, ENTER_END, EXIT_LEN, STAGE, STAGE_CENTER } from '../theme';
|
||||
import { roundedRectPath } from './geometry';
|
||||
import { Heading, type HeadingSpec, headingTimes } from './Heading';
|
||||
import { type MorphState, SHAPES, STAGE_ZOOM, type ShapeId, enterState, exitState, shapePath } from './morph';
|
||||
import { ShapeView, mix } from './Shape';
|
||||
|
||||
export type StageProps = {
|
||||
// Icon the stage blooms out of on the section's downbeat.
|
||||
enter?: { from: ShapeId };
|
||||
// Icon the stage collapses into on the next section's downbeat.
|
||||
exit?: { to: ShapeId };
|
||||
heading?: HeadingSpec | HeadingSpec[];
|
||||
// Panel colour behind the recording.
|
||||
background?: string;
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
const OPEN: MorphState = {
|
||||
s: 1,
|
||||
k: STAGE_ZOOM,
|
||||
cx: STAGE_CENTER.x,
|
||||
cy: STAGE_CENTER.y,
|
||||
details: 0,
|
||||
fill: 0,
|
||||
content: 1,
|
||||
contentScale: 1,
|
||||
blur: 0,
|
||||
lift: 1,
|
||||
border: 1,
|
||||
sweep: null,
|
||||
};
|
||||
|
||||
const OPEN_PATH = roundedRectPath(STAGE.x, STAGE.y, STAGE.w, STAGE.h, STAGE.r);
|
||||
|
||||
// The framed screen of a footage section. Children are laid out in stage
|
||||
// coordinates (0..STAGE.w, 0..STAGE.h) and clipped to the stage's shape.
|
||||
export const Stage: React.FC<StageProps> = ({ enter, exit, heading, background = COLOR.panel, children }) => {
|
||||
const frame = useCurrentFrame();
|
||||
const { durationInFrames } = useVideoConfig();
|
||||
const entering = enter && frame < ENTER_END;
|
||||
const exiting = exit && frame >= durationInFrames - EXIT_LEN;
|
||||
const icon: ShapeId | null = entering ? enter.from : exiting ? exit.to : null;
|
||||
const state = entering ? enterState(frame) : exiting ? exitState(frame, durationInFrames) : OPEN;
|
||||
const d = icon === null ? OPEN_PATH : shapePath(icon, 'stage', state.s, state.k, state.cx, state.cy);
|
||||
const openColor = SHAPES[enter?.from ?? exit?.to ?? 'dot'].color;
|
||||
const color = icon === null ? openColor : SHAPES[icon].color;
|
||||
// The open stage glows in its own app's colour; closing hands over gradually.
|
||||
const glowColor = exiting ? mix(openColor, color, 1 - state.lift) : color;
|
||||
const sectionAccent = SHAPES[enter?.from ?? exit?.to ?? 'dot'].accent;
|
||||
const accent = (spec: HeadingSpec) => (spec.app ? SHAPES[spec.app].accent : sectionAccent);
|
||||
const headings = heading === undefined ? [] : headingTimes(Array.isArray(heading) ? heading : [heading], durationInFrames, accent);
|
||||
return (
|
||||
<AbsoluteFill>
|
||||
<ShapeView
|
||||
d={d}
|
||||
color={color}
|
||||
glowColor={glowColor}
|
||||
cx={state.cx}
|
||||
cy={state.cy}
|
||||
k={state.k}
|
||||
fill={state.fill}
|
||||
lift={state.lift}
|
||||
border={state.border}
|
||||
sweep={state.sweep}
|
||||
details={icon === null ? [] : [{ shape: icon, opacity: state.details }]}
|
||||
content={{ node: children, opacity: state.content, scale: state.contentScale, blur: state.blur, background }}
|
||||
/>
|
||||
{headings.map((timing) => (
|
||||
<Heading key={`${timing.spec.title}-${timing.enter}`} timing={timing} color={accent(timing.spec)} />
|
||||
))}
|
||||
</AbsoluteFill>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
import { cancelRender, continueRender, delayRender, staticFile } from 'remotion';
|
||||
|
||||
const FACES = [
|
||||
{ family: 'Noto Sans SC', file: 'fonts/NotoSansSC.ttf', weight: '100 900' },
|
||||
{ family: 'Inter', file: 'fonts/Inter.ttf', weight: '100 900' },
|
||||
{ family: 'JetBrains Mono', file: 'fonts/JetBrainsMono.ttf', weight: '100 800' },
|
||||
];
|
||||
|
||||
const handle = delayRender('Loading fonts', { timeoutInMilliseconds: 120000 });
|
||||
|
||||
Promise.all(
|
||||
FACES.map(async ({ family, file, weight }) => {
|
||||
const face = new FontFace(family, `url(${staticFile(file)}) format("truetype")`, { weight });
|
||||
await face.load();
|
||||
document.fonts.add(face);
|
||||
}),
|
||||
).then(
|
||||
() => continueRender(handle),
|
||||
(error: unknown) => cancelRender(error),
|
||||
);
|
||||
@@ -0,0 +1,186 @@
|
||||
export type Point = [number, number];
|
||||
|
||||
const TAU = Math.PI * 2;
|
||||
|
||||
// Quarter (or any) arc sampled in y-down screen space; angles increase clockwise.
|
||||
export const arc = (cx: number, cy: number, r: number, from: number, to: number, steps: number): Point[] => {
|
||||
const out: Point[] = [];
|
||||
for (let i = 0; i <= steps; i++) {
|
||||
const a = from + ((to - from) * i) / steps;
|
||||
out.push([cx + r * Math.cos(a), cy + r * Math.sin(a)]);
|
||||
}
|
||||
return out;
|
||||
};
|
||||
|
||||
export const roundedRect = (x: number, y: number, w: number, h: number, r: number, steps = 10): Point[] => [
|
||||
...arc(x + w - r, y + r, r, -TAU / 4, 0, steps),
|
||||
...arc(x + w - r, y + h - r, r, 0, TAU / 4, steps),
|
||||
...arc(x + r, y + h - r, r, TAU / 4, TAU / 2, steps),
|
||||
...arc(x + r, y + r, r, TAU / 2, (TAU * 3) / 4, steps),
|
||||
];
|
||||
|
||||
export const circle = (r: number, steps = 96): Point[] =>
|
||||
Array.from({ length: steps }, (_, i): Point => [r * Math.cos((TAU * i) / steps - TAU / 4), r * Math.sin((TAU * i) / steps - TAU / 4)]);
|
||||
|
||||
// Exact rounded rectangle as an SVG path (arcs), for the open stage.
|
||||
export const roundedRectPath = (x: number, y: number, w: number, h: number, r: number) =>
|
||||
`M${x + r} ${y}H${x + w - r}A${r} ${r} 0 0 1 ${x + w} ${y + r}V${y + h - r}A${r} ${r} 0 0 1 ${x + w - r} ${y + h}` +
|
||||
`H${x + r}A${r} ${r} 0 0 1 ${x} ${y + h - r}V${y + r}A${r} ${r} 0 0 1 ${x + r} ${y}Z`;
|
||||
|
||||
export const toPath = (points: Point[], scale: number, cx: number, cy: number) => {
|
||||
let d = '';
|
||||
for (let i = 0; i < points.length; i++) {
|
||||
const [x, y] = points[i];
|
||||
d += `${i === 0 ? 'M' : 'L'}${(cx + x * scale).toFixed(2)} ${(cy + y * scale).toFixed(2)}`;
|
||||
}
|
||||
return `${d}Z`;
|
||||
};
|
||||
|
||||
// ---- Signed-distance silhouettes ------------------------------------------
|
||||
|
||||
export type Sdf = (x: number, y: number) => number;
|
||||
|
||||
export const sdfCircle = (cx: number, cy: number, r: number): Sdf => (x, y) => Math.hypot(x - cx, y - cy) - r;
|
||||
|
||||
export const sdfCapsule = (ax: number, ay: number, bx: number, by: number, r: number): Sdf => {
|
||||
const dx = bx - ax;
|
||||
const dy = by - ay;
|
||||
const len2 = dx * dx + dy * dy;
|
||||
return (x, y) => {
|
||||
const t = Math.max(0, Math.min(1, ((x - ax) * dx + (y - ay) * dy) / len2));
|
||||
return Math.hypot(x - ax - t * dx, y - ay - t * dy) - r;
|
||||
};
|
||||
};
|
||||
|
||||
export const sdfRoundedBox = (x: number, y: number, w: number, h: number, r: number): Sdf => {
|
||||
const cx = x + w / 2;
|
||||
const cy = y + h / 2;
|
||||
return (px, py) => {
|
||||
const qx = Math.abs(px - cx) - w / 2 + r;
|
||||
const qy = Math.abs(py - cy) - h / 2 + r;
|
||||
return Math.hypot(Math.max(qx, 0), Math.max(qy, 0)) + Math.min(Math.max(qx, qy), 0) - r;
|
||||
};
|
||||
};
|
||||
|
||||
// A cubic Bézier stroke as a chain of capsules.
|
||||
export const sdfCubicStroke = (p: [Point, Point, Point, Point], r: number, segments = 32): Sdf => {
|
||||
const at = (t: number): Point => {
|
||||
const u = 1 - t;
|
||||
return [
|
||||
u * u * u * p[0][0] + 3 * u * u * t * p[1][0] + 3 * u * t * t * p[2][0] + t * t * t * p[3][0],
|
||||
u * u * u * p[0][1] + 3 * u * u * t * p[1][1] + 3 * u * t * t * p[2][1] + t * t * t * p[3][1],
|
||||
];
|
||||
};
|
||||
const parts: Sdf[] = [];
|
||||
for (let i = 0; i < segments; i++) {
|
||||
const a = at(i / segments);
|
||||
const b = at((i + 1) / segments);
|
||||
parts.push(sdfCapsule(a[0], a[1], b[0], b[1], r));
|
||||
}
|
||||
return union(parts);
|
||||
};
|
||||
|
||||
export const union = (parts: Sdf[]): Sdf => (x, y) => {
|
||||
let d = Infinity;
|
||||
for (const part of parts) d = Math.min(d, part(x, y));
|
||||
return d;
|
||||
};
|
||||
|
||||
// Marching squares on the zero level set; returns the longest closed loop.
|
||||
export const contour = (sdf: Sdf, x0: number, y0: number, x1: number, y1: number, step: number): Point[] => {
|
||||
const nx = Math.ceil((x1 - x0) / step) + 1;
|
||||
const ny = Math.ceil((y1 - y0) / step) + 1;
|
||||
const v = new Float64Array(nx * ny);
|
||||
for (let j = 0; j < ny; j++) for (let i = 0; i < nx; i++) v[j * nx + i] = sdf(x0 + i * step, y0 + j * step);
|
||||
const at = (i: number, j: number) => v[j * nx + i];
|
||||
|
||||
const points = new Map<string, Point>();
|
||||
const links = new Map<string, string[]>();
|
||||
const edgePoint = (key: string, ax: number, ay: number, bx: number, by: number, va: number, vb: number) => {
|
||||
if (!points.has(key)) {
|
||||
const t = va / (va - vb);
|
||||
points.set(key, [x0 + (ax + (bx - ax) * t) * step, y0 + (ay + (by - ay) * t) * step]);
|
||||
}
|
||||
return key;
|
||||
};
|
||||
const link = (a: string, b: string) => {
|
||||
links.set(a, [...(links.get(a) ?? []), b]);
|
||||
links.set(b, [...(links.get(b) ?? []), a]);
|
||||
};
|
||||
|
||||
for (let j = 0; j < ny - 1; j++) {
|
||||
for (let i = 0; i < nx - 1; i++) {
|
||||
const a = at(i, j);
|
||||
const b = at(i + 1, j);
|
||||
const c = at(i + 1, j + 1);
|
||||
const d = at(i, j + 1);
|
||||
const top = a < 0 !== b < 0 ? edgePoint(`h${i},${j}`, i, j, i + 1, j, a, b) : null;
|
||||
const right = b < 0 !== c < 0 ? edgePoint(`v${i + 1},${j}`, i + 1, j, i + 1, j + 1, b, c) : null;
|
||||
const bottom = d < 0 !== c < 0 ? edgePoint(`h${i},${j + 1}`, i, j + 1, i + 1, j + 1, d, c) : null;
|
||||
const left = a < 0 !== d < 0 ? edgePoint(`v${i},${j}`, i, j, i, j + 1, a, d) : null;
|
||||
const crossed = [top, right, bottom, left].filter((e): e is string => e !== null);
|
||||
if (crossed.length === 2) link(crossed[0], crossed[1]);
|
||||
else if (crossed.length === 4) {
|
||||
const centreInside = (a + b + c + d) / 4 < 0;
|
||||
const aInside = a < 0;
|
||||
if (aInside === centreInside) {
|
||||
link(top!, right!);
|
||||
link(bottom!, left!);
|
||||
} else {
|
||||
link(top!, left!);
|
||||
link(right!, bottom!);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const seen = new Set<string>();
|
||||
let best: Point[] = [];
|
||||
for (const start of links.keys()) {
|
||||
if (seen.has(start)) continue;
|
||||
const loop: Point[] = [];
|
||||
let prev = '';
|
||||
let cur = start;
|
||||
while (!seen.has(cur)) {
|
||||
seen.add(cur);
|
||||
loop.push(points.get(cur)!);
|
||||
const next = links.get(cur)!.find((n) => n !== prev && !seen.has(n));
|
||||
if (!next) break;
|
||||
prev = cur;
|
||||
cur = next;
|
||||
}
|
||||
if (loop.length > best.length) best = loop;
|
||||
}
|
||||
return simplify(best, step * 0.12);
|
||||
};
|
||||
|
||||
// Ramer–Douglas–Peucker on a closed ring.
|
||||
const simplify = (ring: Point[], tolerance: number): Point[] => {
|
||||
const keep = new Uint8Array(ring.length);
|
||||
const walk = (a: number, b: number) => {
|
||||
let worst = -1;
|
||||
let dist = tolerance;
|
||||
const [ax, ay] = ring[a];
|
||||
const [bx, by] = ring[b];
|
||||
const len = Math.hypot(bx - ax, by - ay) || 1;
|
||||
for (let i = a + 1; i < b; i++) {
|
||||
const d = Math.abs((bx - ax) * (ay - ring[i][1]) - (ax - ring[i][0]) * (by - ay)) / len;
|
||||
if (d > dist) {
|
||||
dist = d;
|
||||
worst = i;
|
||||
}
|
||||
}
|
||||
if (worst >= 0) {
|
||||
keep[worst] = 1;
|
||||
walk(a, worst);
|
||||
walk(worst, b);
|
||||
}
|
||||
};
|
||||
const half = Math.floor(ring.length / 2);
|
||||
keep[0] = 1;
|
||||
keep[half] = 1;
|
||||
walk(0, half);
|
||||
walk(half, ring.length - 1);
|
||||
keep[ring.length - 1] = 1;
|
||||
return ring.filter((_, i) => keep[i] === 1);
|
||||
};
|
||||
@@ -0,0 +1,259 @@
|
||||
import { interpolate as flubber } from 'flubber';
|
||||
import { interpolate } from 'remotion';
|
||||
import { type AppId, EASE, ICON, MORPH, STAGE, STAGE_CENTER } from '../theme';
|
||||
import {
|
||||
type Point,
|
||||
circle,
|
||||
contour,
|
||||
roundedRect,
|
||||
sdfCapsule,
|
||||
sdfCircle,
|
||||
sdfCubicStroke,
|
||||
sdfRoundedBox,
|
||||
toPath,
|
||||
union,
|
||||
arc,
|
||||
} from './geometry';
|
||||
|
||||
export type ShapeId = AppId | 'dot' | 'cell';
|
||||
|
||||
// Silhouettes in Papirus grid units, centred on the grid centre (96, 96).
|
||||
const centre = (points: Point[]): Point[] => points.map(([x, y]) => [x - 96, y - 96]);
|
||||
const Q = Math.PI / 2;
|
||||
|
||||
const page = centre([
|
||||
[40, 16],
|
||||
[112, 16],
|
||||
[160, 64],
|
||||
...arc(152, 168, 8, 0, Q, 8),
|
||||
...arc(40, 168, 8, Q, 2 * Q, 8),
|
||||
...arc(40, 24, 8, 2 * Q, 3 * Q, 8),
|
||||
]);
|
||||
|
||||
const board = centre(
|
||||
contour(
|
||||
union([sdfRoundedBox(16, 28, 160, 112, 10), sdfCapsule(96, 136, 64, 176, 6), sdfCapsule(96, 136, 128, 176, 6)]),
|
||||
0,
|
||||
0,
|
||||
192,
|
||||
192,
|
||||
0.5,
|
||||
),
|
||||
);
|
||||
|
||||
const branch = centre(
|
||||
contour(
|
||||
union([
|
||||
sdfCapsule(64, 44, 64, 148, 10),
|
||||
sdfCubicStroke(
|
||||
[
|
||||
[64, 128],
|
||||
[64, 92],
|
||||
[128, 104],
|
||||
[128, 72],
|
||||
],
|
||||
10,
|
||||
),
|
||||
sdfCircle(64, 40, 24),
|
||||
sdfCircle(128, 64, 24),
|
||||
sdfCircle(64, 152, 24),
|
||||
]),
|
||||
0,
|
||||
0,
|
||||
192,
|
||||
192,
|
||||
0.5,
|
||||
),
|
||||
);
|
||||
|
||||
// `color` fills the silhouette; `accent` marks the section heading.
|
||||
export const SHAPES: Record<ShapeId, { points: Point[]; color: string; accent: string }> = {
|
||||
'ely-doc': { points: page, color: '#3D7FE5', accent: '#3D7FE5' },
|
||||
'ely-table': { points: page, color: '#2E9E5B', accent: '#2E9E5B' },
|
||||
'ely-pdf': { points: page, color: '#E0344F', accent: '#E0344F' },
|
||||
'ely-show': { points: board, color: '#F07B2A', accent: '#F07B2A' },
|
||||
'ely-tree': { points: branch, color: '#7E57C2', accent: '#7E57C2' },
|
||||
'ely-mark': { points: centre(roundedRect(28, 24, 136, 152, 10)), color: '#3E4A5C', accent: '#F2A900' },
|
||||
cell: { points: centre(roundedRect(16, 51, 160, 90, 8)), color: '#3E4A5C', accent: '#F2A900' },
|
||||
dot: { points: circle(15), color: '#3D7FE5', accent: '#3D7FE5' },
|
||||
};
|
||||
|
||||
// The open stage, shrunk to icon size so shape and size can morph separately.
|
||||
const PROXY_W = 168;
|
||||
const PROXY_H = (PROXY_W * STAGE.h) / STAGE.w;
|
||||
const PROXY_R = (STAGE.r * PROXY_W) / STAGE.w;
|
||||
const proxy = roundedRect(-PROXY_W / 2, -PROXY_H / 2, PROXY_W, PROXY_H, PROXY_R, 10);
|
||||
// Zoom at which the proxy is exactly the stage.
|
||||
export const STAGE_ZOOM = STAGE.w / (PROXY_W * ICON.unit);
|
||||
|
||||
// Rings are resampled into four runs between corresponding anchors (the
|
||||
// shape's outer corners), so corners travel to corners and nothing shears.
|
||||
const RUN = 128;
|
||||
const ANCHORS: Partial<Record<ShapeId, Point[]>> = {
|
||||
// The board's corners, not the stand's feet.
|
||||
'ely-show': centre([
|
||||
[16, 28],
|
||||
[176, 28],
|
||||
[176, 140],
|
||||
[16, 140],
|
||||
]),
|
||||
};
|
||||
|
||||
const resample = (line: Point[], count: number): Point[] => {
|
||||
const lengths = [0];
|
||||
for (let i = 1; i < line.length; i++) lengths.push(lengths[i - 1] + Math.hypot(line[i][0] - line[i - 1][0], line[i][1] - line[i - 1][1]));
|
||||
const total = lengths[lengths.length - 1];
|
||||
const out: Point[] = [];
|
||||
let j = 1;
|
||||
for (let i = 0; i < count; i++) {
|
||||
const at = (total * i) / count;
|
||||
while (j < line.length - 1 && lengths[j] < at) j++;
|
||||
const span = lengths[j] - lengths[j - 1] || 1;
|
||||
const u = (at - lengths[j - 1]) / span;
|
||||
out.push([line[j - 1][0] + (line[j][0] - line[j - 1][0]) * u, line[j - 1][1] + (line[j][1] - line[j - 1][1]) * u]);
|
||||
}
|
||||
return out;
|
||||
};
|
||||
|
||||
const prepared = new Map<string, Point[]>();
|
||||
const prepare = (id: ShapeId | 'stage'): Point[] => {
|
||||
const found = prepared.get(id);
|
||||
if (found) return found;
|
||||
let ring = id === 'stage' ? proxy : SHAPES[id].points;
|
||||
let area = 0;
|
||||
for (let i = 0; i < ring.length; i++) {
|
||||
const [ax, ay] = ring[i];
|
||||
const [bx, by] = ring[(i + 1) % ring.length];
|
||||
area += ax * by - bx * ay;
|
||||
}
|
||||
// Clockwise on screen.
|
||||
if (area < 0) ring = [...ring].reverse();
|
||||
const xs = ring.map((p) => p[0]);
|
||||
const ys = ring.map((p) => p[1]);
|
||||
const [x0, x1, y0, y1] = [Math.min(...xs), Math.max(...xs), Math.min(...ys), Math.max(...ys)];
|
||||
const anchors = (id !== 'stage' && ANCHORS[id]) || [
|
||||
[x0, y0],
|
||||
[x1, y0],
|
||||
[x1, y1],
|
||||
[x0, y1],
|
||||
];
|
||||
const nearest = ([ax, ay]: Point) => ring.reduce((best, p, i) => (Math.hypot(p[0] - ax, p[1] - ay) < Math.hypot(ring[best][0] - ax, ring[best][1] - ay) ? i : best), 0);
|
||||
const first = nearest(anchors[0]);
|
||||
ring = [...ring.slice(first), ...ring.slice(0, first)];
|
||||
const cuts = [0, ...anchors.slice(1).map(nearest), ring.length];
|
||||
if (!cuts.every((c, i) => i === 0 || c > cuts[i - 1])) throw new Error(`Anchors of ${id} are out of order`);
|
||||
const out: Point[] = [];
|
||||
for (let k = 0; k < 4; k++) out.push(...resample([...ring.slice(cuts[k], cuts[k + 1]), ring[cuts[k + 1] % ring.length]], RUN));
|
||||
prepared.set(id, out);
|
||||
return out;
|
||||
};
|
||||
|
||||
type Ring = (t: number) => Point[];
|
||||
const cache = new Map<string, Ring>();
|
||||
|
||||
const ring = (from: ShapeId | 'stage', to: ShapeId | 'stage'): Ring => {
|
||||
const key = `${from}>${to}`;
|
||||
let found = cache.get(key);
|
||||
if (!found) {
|
||||
// Equal, aligned rings: flubber neither bisects nor needs to rotate them.
|
||||
found = flubber(prepare(from), prepare(to), { string: false, maxSegmentLength: 0 });
|
||||
cache.set(key, found);
|
||||
}
|
||||
return found;
|
||||
};
|
||||
|
||||
// Path of `from` turned `t` of the way into `to`, drawn at zoom `k` around (cx, cy).
|
||||
export const shapePath = (from: ShapeId | 'stage', to: ShapeId | 'stage', t: number, k: number, cx: number, cy: number) => {
|
||||
const points = from === to ? prepare(from) : ring(from, to)(t);
|
||||
return toPath(points, ICON.unit * k, cx, cy);
|
||||
};
|
||||
|
||||
// ---- Boundary choreography ------------------------------------------------
|
||||
|
||||
export type MorphState = {
|
||||
// 0: icon silhouette, 1: stage rectangle.
|
||||
s: number;
|
||||
// Zoom of the shape (1 = icon size, STAGE_ZOOM = stage size).
|
||||
k: number;
|
||||
cx: number;
|
||||
cy: number;
|
||||
// Opacity of the full-colour icon artwork over the silhouette.
|
||||
details: number;
|
||||
// Opacity of the app-colour wash over the stage content.
|
||||
fill: number;
|
||||
content: number;
|
||||
contentScale: number;
|
||||
blur: number;
|
||||
// 0: icon shadow, 1: stage shadow.
|
||||
lift: number;
|
||||
border: number;
|
||||
// 0..1 travel of the light sweep along the stage edge; null when idle.
|
||||
sweep: number | null;
|
||||
};
|
||||
|
||||
const clamp = (v: number) => Math.min(1, Math.max(0, v));
|
||||
const smooth = (v: number, a: number, b: number) => {
|
||||
const x = clamp((v - a) / (b - a));
|
||||
return x * x * (3 - 2 * x);
|
||||
};
|
||||
const lerp = (a: number, b: number, t: number) => a + (b - a) * t;
|
||||
|
||||
// The downbeat swell: the icon breathes in on the cut.
|
||||
export const boundaryPulse = (d: number) => 0.04 * Math.exp(-((d / 6.5) ** 2));
|
||||
|
||||
// Icon resting on a cut, `d` frames from it (negative: before it).
|
||||
export const restState = (d: number): MorphState => ({
|
||||
s: 0,
|
||||
k: 1 + boundaryPulse(d),
|
||||
cx: ICON.x,
|
||||
cy: ICON.y,
|
||||
details: 1 - smooth(Math.abs(d), 10, MORPH.hold),
|
||||
fill: 1,
|
||||
content: 0,
|
||||
contentScale: 0.72,
|
||||
blur: 14,
|
||||
lift: 0,
|
||||
border: 0,
|
||||
sweep: null,
|
||||
});
|
||||
|
||||
// `o` is how open the stage is (0 icon, 1 stage), in each direction's own time.
|
||||
const openState = (shape: number, zoom: number, o: number, sweep: number | null): MorphState => ({
|
||||
s: shape,
|
||||
k: Math.exp(Math.log(STAGE_ZOOM) * zoom),
|
||||
cx: lerp(ICON.x, STAGE_CENTER.x, zoom),
|
||||
cy: lerp(ICON.y, STAGE_CENTER.y, zoom),
|
||||
details: 0,
|
||||
fill: 1 - smooth(o, 0.32, 0.82),
|
||||
content: smooth(o, 0.22, 0.7),
|
||||
contentScale: lerp(0.72, 1, EASE.out(o)),
|
||||
blur: 14 * (1 - o) ** 2,
|
||||
lift: o,
|
||||
border: smooth(o, 0.8, 1),
|
||||
sweep,
|
||||
});
|
||||
|
||||
// Section-local frame `f` of an entering stage.
|
||||
export const enterState = (f: number): MorphState => {
|
||||
if (f < MORPH.hold) return restState(f);
|
||||
const o = clamp((f - MORPH.hold) / MORPH.morph);
|
||||
const shape = EASE.inOut(clamp(o / 0.6));
|
||||
const zoom = EASE.bloom(o);
|
||||
const sweep = o > 0.55 ? clamp((o - 0.55) / 0.45) : null;
|
||||
return openState(shape, zoom, zoom, sweep);
|
||||
};
|
||||
|
||||
// Section-local frame `f` of a stage in a section `duration` frames long.
|
||||
export const exitState = (f: number, duration: number): MorphState => {
|
||||
const d = f - duration;
|
||||
if (d >= -MORPH.hold) return restState(d);
|
||||
const q = clamp((d + MORPH.hold + MORPH.morph) / MORPH.morph);
|
||||
const zoom = 1 - EASE.land(q);
|
||||
const shape = 1 - EASE.inOut(clamp((q - 0.22) / 0.78));
|
||||
return openState(shape, zoom, zoom, null);
|
||||
};
|
||||
|
||||
export const isOpen = (state: MorphState) => state.s >= 1 && state.k >= STAGE_ZOOM - 1e-6;
|
||||
|
||||
export const fade = (f: number, from: number, to: number, ease = EASE.out) =>
|
||||
interpolate(f, [from, to], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: ease });
|
||||
@@ -0,0 +1,9 @@
|
||||
declare module 'flubber' {
|
||||
type Point = [number, number];
|
||||
type Shape = string | Point[];
|
||||
interface Options {
|
||||
maxSegmentLength?: number;
|
||||
}
|
||||
export function interpolate(from: Shape, to: Shape, options: Options & { string: false }): (t: number) => Point[];
|
||||
export function interpolate(from: Shape, to: Shape, options?: Options & { string?: true }): (t: number) => string;
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
import React from 'react';
|
||||
import { AbsoluteFill, interpolate, OffthreadVideo, Sequence, staticFile, useCurrentFrame } from 'remotion';
|
||||
import { EASE, FOOTAGE, FPS, STAGE } from '../theme';
|
||||
import { Cursor } from './Cursor';
|
||||
import type { TakeName } from './take';
|
||||
|
||||
/** A stretch of one take: footage seconds `from` to `to`. */
|
||||
export type Cut = { take: TakeName; from: number; to: number; rate?: number; fade?: number };
|
||||
|
||||
/** A camera key at section frame `f`: zoom and the footage point in the middle. */
|
||||
export type Shot = { f: number; z: number; x: number; y: number };
|
||||
|
||||
export type Placed = Cut & { start: number; length: number };
|
||||
|
||||
/** Each cut's section frames; a cut's fade overlaps the one before. */
|
||||
export const lay = (cuts: Cut[], first = 0): Placed[] => {
|
||||
let at = first;
|
||||
return cuts.map((cut, i) => {
|
||||
const length = Math.round(((cut.to - cut.from) * FPS) / (cut.rate ?? 1));
|
||||
const start = i === 0 ? at : at - (cut.fade ?? 0);
|
||||
at = start + length;
|
||||
return { ...cut, start, length };
|
||||
});
|
||||
};
|
||||
|
||||
/** Footage time a placed cut shows at section frame `f`. */
|
||||
export const sourceAt = (cut: Placed, f: number) => cut.from + ((f - cut.start) * (cut.rate ?? 1)) / FPS;
|
||||
|
||||
const camera = (shots: Shot[], f: number) => {
|
||||
if (f <= shots[0].f) return shots[0];
|
||||
const last = shots[shots.length - 1];
|
||||
if (f >= last.f) return last;
|
||||
const i = shots.findIndex((s, k) => k > 0 && s.f > f);
|
||||
const a = shots[i - 1];
|
||||
const b = shots[i];
|
||||
const k = EASE.inOut((f - a.f) / (b.f - a.f));
|
||||
return { f, z: a.z + (b.z - a.z) * k, x: a.x + (b.x - a.x) * k, y: a.y + (b.y - a.y) * k };
|
||||
};
|
||||
|
||||
/** Footage pixels to stage pixels, under the camera at frame `f`. */
|
||||
export const viewOf = (shots: Shot[], f: number) => {
|
||||
const c = camera(shots, f);
|
||||
const k = FOOTAGE.scale * c.z;
|
||||
const vw = FOOTAGE.w / c.z;
|
||||
const vh = FOOTAGE.h / c.z;
|
||||
const left = Math.min(Math.max(c.x - vw / 2, 0), FOOTAGE.w - vw);
|
||||
const top = Math.min(Math.max(c.y - vh / 2, 0), FOOTAGE.h - vh);
|
||||
return { k, left, top, z: c.z };
|
||||
};
|
||||
|
||||
type Props = {
|
||||
cuts: Cut[];
|
||||
shots: Shot[];
|
||||
/** Footage-space overlays for a cut at footage time `t`. */
|
||||
overlay?: (cut: Placed, t: number, f: number) => React.ReactNode;
|
||||
};
|
||||
|
||||
/** Recorded takes on the stage, with the drawn pointer and a directed camera. */
|
||||
export const Clip: React.FC<Props> = ({ cuts, shots, overlay }) => {
|
||||
const f = useCurrentFrame();
|
||||
const view = viewOf(shots, f);
|
||||
const placed = lay(cuts);
|
||||
return (
|
||||
<AbsoluteFill style={{ width: STAGE.w, height: STAGE.h, overflow: 'hidden', background: '#202020' }}>
|
||||
{placed.map((cut, i) => {
|
||||
const fade = i === 0 ? 0 : cut.fade ?? 0;
|
||||
const opacity = fade ? interpolate(f, [cut.start, cut.start + fade], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: EASE.inOut }) : 1;
|
||||
const next = placed[i + 1];
|
||||
const end = next ? next.start + (next.fade ?? 0) : cut.start + cut.length;
|
||||
if (f < cut.start || f >= end) return null;
|
||||
const t = sourceAt(cut, f);
|
||||
return (
|
||||
<AbsoluteFill key={i} style={{ opacity }}>
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
width: FOOTAGE.w,
|
||||
height: FOOTAGE.h,
|
||||
transformOrigin: '0 0',
|
||||
transform: `scale(${view.k}) translate(${-view.left}px, ${-view.top}px)`,
|
||||
}}
|
||||
>
|
||||
<Sequence from={cut.start} durationInFrames={end - cut.start} layout="none">
|
||||
<OffthreadVideo
|
||||
src={staticFile(`footage/${cut.take}.mp4`)}
|
||||
trimBefore={Math.round(cut.from * FPS)}
|
||||
playbackRate={cut.rate ?? 1}
|
||||
muted
|
||||
style={{ width: FOOTAGE.w, height: FOOTAGE.h, display: 'block' }}
|
||||
/>
|
||||
</Sequence>
|
||||
{overlay?.(cut, t, f)}
|
||||
<Cursor take={cut.take} t={t} zoom={view.z} />
|
||||
</div>
|
||||
</AbsoluteFill>
|
||||
);
|
||||
})}
|
||||
</AbsoluteFill>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,70 @@
|
||||
import React from 'react';
|
||||
import { interpolate } from 'remotion';
|
||||
import { COLOR, EASE } from '../theme';
|
||||
import { actions, pointerAt, type TakeName } from './take';
|
||||
|
||||
const RIPPLE = 0.55;
|
||||
const RIGHT = '#F2A900';
|
||||
|
||||
/** The pointer, drawn from the input log; presses ripple. */
|
||||
export const Cursor: React.FC<{ take: TakeName; t: number; zoom: number }> = ({ take, t, zoom }) => {
|
||||
const p = pointerAt(take, t);
|
||||
const downs = actions(take, 'down');
|
||||
const ups = actions(take, 'up');
|
||||
const held = downs.some((d) => {
|
||||
const up = ups.find((u) => u.t >= d.t);
|
||||
return t >= d.t && t <= (up ? up.t : d.t) + 0.06;
|
||||
});
|
||||
// Larger under zoom, but less than the footage grows.
|
||||
const size = 44 / Math.sqrt(zoom);
|
||||
const press = held ? 0.86 : 1;
|
||||
return (
|
||||
<>
|
||||
{downs
|
||||
.filter((d) => t >= d.t && t < d.t + RIPPLE)
|
||||
.map((d) => {
|
||||
const k = (t - d.t) / RIPPLE;
|
||||
const r = interpolate(k, [0, 1], [8, 46], { easing: EASE.out }) / Math.sqrt(zoom);
|
||||
const tint = d.right ? RIGHT : COLOR.accent;
|
||||
return (
|
||||
<div
|
||||
key={d.t}
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: d.x! - r,
|
||||
top: d.y! - r,
|
||||
width: r * 2,
|
||||
height: r * 2,
|
||||
borderRadius: '50%',
|
||||
border: `${3 / Math.sqrt(zoom)}px solid ${tint}`,
|
||||
background: `${tint}22`,
|
||||
opacity: 1 - k,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
<svg
|
||||
width={size}
|
||||
height={size * 1.5}
|
||||
viewBox="0 0 24 36"
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: p.x - size * 0.06,
|
||||
top: p.y - size * 0.04,
|
||||
transformOrigin: '0 0',
|
||||
transform: `scale(${press})`,
|
||||
filter: 'drop-shadow(0 3px 5px rgba(0,0,0,0.45))',
|
||||
overflow: 'visible',
|
||||
}}
|
||||
>
|
||||
<path
|
||||
d="M1.5 1.5 L1.5 27 L7.6 21.4 L11.6 30.6 L15.6 28.9 L11.7 19.9 L19.8 19.9 Z"
|
||||
fill="#fff"
|
||||
stroke="#111"
|
||||
strokeWidth={1.6}
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
import React from 'react';
|
||||
import { Audio, Sequence, staticFile } from 'remotion';
|
||||
import { FPS } from '../theme';
|
||||
import { lay, type Cut } from './Clip';
|
||||
import { TAKES } from './take';
|
||||
|
||||
const SOUND: Record<string, { file: string; volume: number } | undefined> = {
|
||||
down: { file: 'click', volume: 0.55 },
|
||||
right: { file: 'menu', volume: 0.6 },
|
||||
key: { file: 'key', volume: 0.5 },
|
||||
char: { file: 'key', volume: 0.45 },
|
||||
wheel: { file: 'tick', volume: 0.18 },
|
||||
};
|
||||
|
||||
/** UI sounds on the logged presses, keys and scrolls of `cuts`. */
|
||||
export const Sounds: React.FC<{ cuts: Cut[] }> = ({ cuts }) => {
|
||||
const hits: { frame: number; file: string; volume: number }[] = [];
|
||||
for (const cut of lay(cuts)) {
|
||||
for (const e of TAKES[cut.take].events) {
|
||||
if (e.t < cut.from || e.t >= cut.to) continue;
|
||||
const sound = SOUND[e.kind === 'down' && e.right ? 'right' : e.kind];
|
||||
if (!sound) continue;
|
||||
hits.push({ frame: Math.round(cut.start + ((e.t - cut.from) * FPS) / (cut.rate ?? 1)), ...sound });
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
{hits.map((hit, i) => (
|
||||
<Sequence key={i} from={hit.frame} durationInFrames={60} layout="none">
|
||||
<Audio src={staticFile(`audio/sfx/${hit.file}.wav`)} volume={hit.volume} />
|
||||
</Sequence>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
/** Section frame of footage time `t` in `cuts`, for timing overlays. */
|
||||
export const frameOf = (cuts: Cut[], t: number) => {
|
||||
const cut = lay(cuts).find((c) => t >= c.from && t < c.to);
|
||||
if (!cut) throw new Error(`no cut shows footage time ${t}`);
|
||||
return Math.round(cut.start + ((t - cut.from) * FPS) / (cut.rate ?? 1));
|
||||
};
|
||||
@@ -0,0 +1,84 @@
|
||||
import React from 'react';
|
||||
import { interpolate } from 'remotion';
|
||||
import { COLOR, EASE, FONT } from '../theme';
|
||||
import { pointerAt, TAKES, type TakeName } from './take';
|
||||
|
||||
type Props = {
|
||||
take: TakeName;
|
||||
t: number;
|
||||
/** Footage seconds the pointer crosses toward the submenu. */
|
||||
from: number;
|
||||
to: number;
|
||||
/** The row it crosses without opening, as y0..y1, and its note. */
|
||||
passed: [number, number];
|
||||
note: string;
|
||||
};
|
||||
|
||||
const clamp = { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' } as const;
|
||||
|
||||
/** The safe triangle: pointer to the submenu's near corners, live. */
|
||||
export const Triangle: React.FC<Props> = ({ take, t, from, to, passed, note }) => {
|
||||
const menu = TAKES[take].menus;
|
||||
if (!menu) throw new Error(`${take} has no submenu rectangle`);
|
||||
const show = interpolate(t, [from - 0.35, from, to + 0.25, to + 0.7], [0, 1, 1, 0], { ...clamp, easing: EASE.inOut });
|
||||
if (show <= 0) return null;
|
||||
const p = pointerAt(take, Math.min(t, to + 0.25));
|
||||
const [x0, y0, , y1] = menu.panel;
|
||||
const [px0, , px1] = menu.parent;
|
||||
const drawn = interpolate(t, [from - 0.35, from + 0.1], [0, 1], { ...clamp, easing: EASE.out });
|
||||
const near = { x: x0 + 2, top: y0 + 6, bottom: y0 + 6 + (y1 - y0 - 12) * drawn };
|
||||
const row = interpolate(t, [from + 0.15, from + 0.45], [0, 1], { ...clamp, easing: EASE.out });
|
||||
return (
|
||||
<div style={{ position: 'absolute', inset: 0, opacity: show, pointerEvents: 'none' }}>
|
||||
<svg width={2048} height={1152} style={{ position: 'absolute', inset: 0, overflow: 'visible' }}>
|
||||
<defs>
|
||||
<linearGradient id="safe" x1="0" x2="1" y1="0" y2="0">
|
||||
<stop offset="0" stopColor={COLOR.accent} stopOpacity={0.05} />
|
||||
<stop offset="1" stopColor={COLOR.accent} stopOpacity={0.3} />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path
|
||||
d={`M ${p.x} ${p.y} L ${near.x} ${near.top} L ${near.x} ${near.bottom} Z`}
|
||||
fill="url(#safe)"
|
||||
stroke={COLOR.accent}
|
||||
strokeWidth={2.5}
|
||||
strokeLinejoin="round"
|
||||
strokeDasharray="10 7"
|
||||
/>
|
||||
<circle cx={p.x} cy={p.y} r={7} fill={COLOR.accent} />
|
||||
<rect
|
||||
x={px0 + 6}
|
||||
y={passed[0]}
|
||||
width={(px1 - px0 - 12) * row}
|
||||
height={passed[1] - passed[0]}
|
||||
rx={8}
|
||||
fill="none"
|
||||
stroke="#F2A900"
|
||||
strokeWidth={2.5}
|
||||
opacity={0.9}
|
||||
/>
|
||||
</svg>
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
right: 2048 - px0 + 22,
|
||||
top: (passed[0] + passed[1]) / 2 - 24,
|
||||
opacity: row,
|
||||
transform: `translateX(${(1 - row) * 16}px)`,
|
||||
padding: '8px 16px',
|
||||
borderRadius: 12,
|
||||
background: 'rgba(28,28,30,0.92)',
|
||||
border: '1.5px solid #F2A90088',
|
||||
color: '#F7E2A6',
|
||||
fontFamily: FONT.sans,
|
||||
fontSize: 26,
|
||||
fontWeight: 500,
|
||||
whiteSpace: 'nowrap',
|
||||
boxShadow: '0 10px 30px rgba(0,0,0,0.45)',
|
||||
}}
|
||||
>
|
||||
{note}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
// Test entry for the footage sections: `remotion still src/footage/preview.tsx <Section> …`.
|
||||
import { AbsoluteFill, Composition, registerRoot } from 'remotion';
|
||||
import '../design/fonts';
|
||||
import { Background } from '../design/Background';
|
||||
import { Cells } from '../scenes/Cells';
|
||||
import { Menus } from '../scenes/Menus';
|
||||
import { More } from '../scenes/More';
|
||||
import { RightClick } from '../scenes/RightClick';
|
||||
import { SECTION } from '../theme';
|
||||
|
||||
const framed = (Section: React.FC) => () => (
|
||||
<AbsoluteFill>
|
||||
<Background />
|
||||
<Section />
|
||||
</AbsoluteFill>
|
||||
);
|
||||
|
||||
const ALL = [
|
||||
['Menus', Menus, SECTION.menus],
|
||||
['Cells', Cells, SECTION.cells],
|
||||
['RightClick', RightClick, SECTION.rightClick],
|
||||
['More', More, SECTION.more],
|
||||
] as const;
|
||||
|
||||
registerRoot(() => (
|
||||
<>
|
||||
{ALL.map(([id, Section, at]) => (
|
||||
<Composition key={id} id={id} component={framed(Section)} width={1920} height={1080} fps={60} durationInFrames={at.duration} />
|
||||
))}
|
||||
</>
|
||||
));
|
||||
@@ -0,0 +1,62 @@
|
||||
import cells from '../../public/footage/cells.json';
|
||||
import doc from '../../public/footage/doc.json';
|
||||
import menus from '../../public/footage/menus.json';
|
||||
import more from '../../public/footage/more.json';
|
||||
import show from '../../public/footage/show.json';
|
||||
import table from '../../public/footage/table.json';
|
||||
|
||||
// Times are footage seconds; positions are footage pixels (2048×1152).
|
||||
export type Event = {
|
||||
t: number;
|
||||
kind: string;
|
||||
x?: number;
|
||||
y?: number;
|
||||
right?: boolean;
|
||||
key?: string;
|
||||
ch?: string;
|
||||
down?: boolean;
|
||||
};
|
||||
|
||||
export type Box = [number, number, number, number];
|
||||
|
||||
export type Take = {
|
||||
fps: number;
|
||||
size: number[];
|
||||
events: Event[];
|
||||
menus: { parent: number[]; panel: number[] } | null;
|
||||
};
|
||||
|
||||
export const TAKES = { menus, cells, doc, table, show, more } as Record<string, Take>;
|
||||
export type TakeName = 'menus' | 'cells' | 'doc' | 'table' | 'show' | 'more';
|
||||
|
||||
const placed = new Map<string, Event[]>();
|
||||
const pointed = (name: TakeName) => {
|
||||
let list = placed.get(name);
|
||||
if (!list) {
|
||||
list = TAKES[name].events.filter((e) => e.x !== undefined && e.kind !== 'sync');
|
||||
placed.set(name, list);
|
||||
}
|
||||
return list;
|
||||
};
|
||||
|
||||
/** Where the pointer was at footage time `t`. */
|
||||
export const pointerAt = (name: TakeName, t: number) => {
|
||||
const list = pointed(name);
|
||||
let lo = 0;
|
||||
let hi = list.length - 1;
|
||||
if (t <= list[0].t) return { x: list[0].x!, y: list[0].y! };
|
||||
if (t >= list[hi].t) return { x: list[hi].x!, y: list[hi].y! };
|
||||
while (hi - lo > 1) {
|
||||
const mid = (lo + hi) >> 1;
|
||||
if (list[mid].t <= t) lo = mid;
|
||||
else hi = mid;
|
||||
}
|
||||
const a = list[lo];
|
||||
const b = list[hi];
|
||||
const f = b.t === a.t ? 1 : (t - a.t) / (b.t - a.t);
|
||||
return { x: a.x! + (b.x! - a.x!) * f, y: a.y! + (b.y! - a.y!) * f };
|
||||
};
|
||||
|
||||
/** Events of `kinds` in the take, in order. */
|
||||
export const actions = (name: TakeName, ...kinds: string[]) =>
|
||||
TAKES[name].events.filter((e) => kinds.includes(e.kind));
|
||||
@@ -0,0 +1,4 @@
|
||||
import { registerRoot } from 'remotion';
|
||||
import { Root } from './Root';
|
||||
|
||||
registerRoot(Root);
|
||||
@@ -0,0 +1,121 @@
|
||||
import { cancelRender, continueRender, delayRender, interpolate, staticFile, useCurrentFrame } from 'remotion';
|
||||
import { COLOR, EASE, FONT } from '../theme';
|
||||
|
||||
// The 'before' card mixes faces, as Windows did.
|
||||
const serif = delayRender('Loading Noto Serif SC', { timeoutInMilliseconds: 120000 });
|
||||
new FontFace('Noto Serif SC', `url(${staticFile('fonts/NotoSerifSC.ttf')}) format("truetype")`, { weight: '200 900' })
|
||||
.load()
|
||||
.then((face) => {
|
||||
document.fonts.add(face);
|
||||
continueRender(serif);
|
||||
}, cancelRender);
|
||||
|
||||
const clamp = { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' } as const;
|
||||
const BEAT = 37.5;
|
||||
|
||||
const Card: React.FC<{ at: number; x: number; title: string; sub: string; children: React.ReactNode }> = ({ at, x, title, sub, children }) => {
|
||||
const f = useCurrentFrame();
|
||||
const p = interpolate(f, [at, at + 34], [0, 1], { ...clamp, easing: EASE.out });
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: x,
|
||||
top: 150,
|
||||
width: 700,
|
||||
height: 640,
|
||||
borderRadius: 28,
|
||||
background: 'linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.02))',
|
||||
border: `1px solid ${COLOR.hairline}`,
|
||||
boxShadow: '0 30px 80px rgba(0,0,0,0.35)',
|
||||
opacity: p,
|
||||
transform: `translateY(${(1 - p) * 40}px) scale(${0.96 + 0.04 * p})`,
|
||||
overflow: 'hidden',
|
||||
}}
|
||||
>
|
||||
<div style={{ position: 'absolute', inset: '0 0 190px 0' }}>{children}</div>
|
||||
<div style={{ position: 'absolute', left: 48, right: 48, bottom: 56 }}>
|
||||
<div style={{ fontFamily: FONT.sans, fontSize: 40, fontWeight: 600, color: COLOR.ink, letterSpacing: '0.02em' }}>{title}</div>
|
||||
<div style={{ fontFamily: FONT.sans, fontSize: 24, fontWeight: 400, color: COLOR.muted, marginTop: 12, lineHeight: 1.5 }}>{sub}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
/** One word in two faces, settling into one. */
|
||||
const Glyphs: React.FC<{ at: number }> = ({ at }) => {
|
||||
const f = useCurrentFrame();
|
||||
const fix = interpolate(f, [at + 2 * BEAT, at + 3.4 * BEAT], [0, 1], { ...clamp, easing: EASE.inOut });
|
||||
const label = (text: string, on: number) => (
|
||||
<span style={{ fontFamily: FONT.sans, fontSize: 22, fontWeight: 500, letterSpacing: '0.2em', color: COLOR.faint, opacity: on }}>{text}</span>
|
||||
);
|
||||
const word = (style: React.CSSProperties, text: string) => <span style={{ display: 'inline-block', ...style }}>{text}</span>;
|
||||
return (
|
||||
<div style={{ position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 26 }}>
|
||||
<div style={{ position: 'relative', height: 30, width: 200, textAlign: 'center' }}>
|
||||
<div style={{ position: 'absolute', inset: 0 }}>{label('之前', 1 - fix)}</div>
|
||||
<div style={{ position: 'absolute', inset: 0 }}>{label('现在', fix)}</div>
|
||||
</div>
|
||||
<div style={{ position: 'relative', fontSize: 120, color: COLOR.ink, lineHeight: 1, height: 130 }}>
|
||||
{word({ fontFamily: FONT.sans, fontVariationSettings: `'wght' ${800 - 300 * fix}`, fontWeight: 800 - 300 * fix }, '打开')}
|
||||
<span style={{ position: 'relative', display: 'inline-block' }}>
|
||||
{word({ fontFamily: '"Noto Serif SC"', fontWeight: 300, opacity: 1 - fix, filter: `blur(${fix * 6}px)` }, '仓库')}
|
||||
{word(
|
||||
{ position: 'absolute', left: 0, top: 0, fontFamily: FONT.sans, fontWeight: 500, opacity: fix, filter: `blur(${(1 - fix) * 6}px)` },
|
||||
'仓库',
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ height: 6, width: 360 * fix, borderRadius: 3, background: COLOR.accent, opacity: 0.9 }} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
/** A shield draws itself, then a check. */
|
||||
const Notarized: React.FC<{ at: number }> = ({ at }) => {
|
||||
const f = useCurrentFrame();
|
||||
const shield = interpolate(f, [at + 10, at + 10 + 2 * BEAT], [0, 1], { ...clamp, easing: EASE.inOut });
|
||||
const check = interpolate(f, [at + 2.4 * BEAT, at + 3.4 * BEAT], [0, 1], { ...clamp, easing: EASE.out });
|
||||
const glow = interpolate(f, [at + 3 * BEAT, at + 4.2 * BEAT], [0, 1], { ...clamp, easing: EASE.out });
|
||||
const SHIELD = 'M120 20 L210 52 V128 C210 186 172 228 120 248 C68 228 30 186 30 128 V52 Z';
|
||||
return (
|
||||
<div style={{ position: 'absolute', inset: 0, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
||||
<svg width={260} height={280} viewBox="0 0 240 270" style={{ overflow: 'visible' }}>
|
||||
<path d={SHIELD} fill={COLOR.accent} opacity={0.14 * glow} />
|
||||
<path
|
||||
d={SHIELD}
|
||||
fill="none"
|
||||
stroke={COLOR.ink}
|
||||
strokeWidth={7}
|
||||
strokeLinejoin="round"
|
||||
pathLength={1}
|
||||
strokeDasharray="1 1"
|
||||
strokeDashoffset={1 - shield}
|
||||
/>
|
||||
<path
|
||||
d="M78 134 L108 164 L166 102"
|
||||
fill="none"
|
||||
stroke={COLOR.accent}
|
||||
strokeWidth={14}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
pathLength={1}
|
||||
strokeDasharray="1 1"
|
||||
strokeDashoffset={1 - check}
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
/** The two cards after the footage, in stage coordinates. */
|
||||
export const Cards: React.FC<{ at: number }> = ({ at }) => (
|
||||
<>
|
||||
<Card at={at} x={100} title="中文显示统一" sub="Windows 上同一个词不再一半粗一半细;界面残留的英文改为中文">
|
||||
<Glyphs at={at} />
|
||||
</Card>
|
||||
<Card at={at + BEAT} x={880} title="macOS 已签名并公证" sub="Developer ID 签名、Apple 公证并钉票,打开时不再提示“无法验证开发者”">
|
||||
<Notarized at={at + BEAT} />
|
||||
</Card>
|
||||
</>
|
||||
);
|
||||
@@ -0,0 +1,50 @@
|
||||
import { AbsoluteFill } from 'remotion';
|
||||
import { Caption } from '../design/Caption';
|
||||
import { KeyCap } from '../design/KeyCap';
|
||||
import { Stage } from '../design/Stage';
|
||||
import { Clip, type Cut, type Shot } from '../footage/Clip';
|
||||
import { frameOf, Sounds } from '../footage/Sounds';
|
||||
|
||||
const CUTS: Cut[] = [{ take: 'cells', from: 3.1, to: 13.1 }];
|
||||
const SHOTS: Shot[] = [
|
||||
{ f: 0, z: 1, x: 1024, y: 576 },
|
||||
{ f: 60, z: 1.25, x: 1190, y: 440 },
|
||||
{ f: 110, z: 1.75, x: 1190, y: 420 },
|
||||
{ f: 470, z: 1.75, x: 1190, y: 420 },
|
||||
{ f: 560, z: 1.2, x: 1200, y: 460 },
|
||||
];
|
||||
|
||||
// One badge per key, held until the next one.
|
||||
const KEYS: { t: number; keys: string[] }[] = [
|
||||
{ t: 4.26, keys: ['点击'] },
|
||||
{ t: 5.73, keys: ['Tab'] },
|
||||
{ t: 6.88, keys: ['↓'] },
|
||||
{ t: 7.94, keys: ['End'] },
|
||||
{ t: 8.29, keys: ['⌫'] },
|
||||
{ t: 10.63, keys: ['Enter'] },
|
||||
];
|
||||
|
||||
export const Cells: React.FC = () => {
|
||||
const at = (t: number) => frameOf(CUTS, t);
|
||||
const backs = [8.29, 8.5, 8.71].map(at);
|
||||
return (
|
||||
<AbsoluteFill>
|
||||
<Stage
|
||||
enter={{ from: 'cell' }}
|
||||
exit={{ to: 'ely-doc' }}
|
||||
heading={{ title: '表格在格内编辑', sub: '点哪格开哪格,Tab 到下一格,回车写回', app: 'ely-mark' }}
|
||||
>
|
||||
<Clip cuts={CUTS} shots={SHOTS} />
|
||||
</Stage>
|
||||
{KEYS.map((k, i) => {
|
||||
const from = at(k.t) - 12;
|
||||
const to = i + 1 < KEYS.length ? at(KEYS[i + 1].t) - 12 : at(k.t) + 70;
|
||||
return <KeyCap key={k.t} keys={k.keys} from={from} to={Math.min(to, from + 110)} press={k.keys[0] === '⌫' ? backs : [at(k.t)]} />;
|
||||
})}
|
||||
<Caption text="格内显示原文:**粗体** 带着记号" from={at(4.5)} to={at(5.6)} />
|
||||
<Caption text="Tab、方向键在格间移动" from={at(5.9)} to={at(7.8)} />
|
||||
<Caption text="回车写回,一步撤销" from={at(10.7)} to={at(12.2)} />
|
||||
<Sounds cuts={CUTS} />
|
||||
</AbsoluteFill>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,175 @@
|
||||
import { AbsoluteFill, interpolate, useCurrentFrame } from 'remotion';
|
||||
import { COLOR, EASE, FONT, ICON, SECTION } from '../theme';
|
||||
import { type ShapeId, SHAPES, boundaryPulse, shapePath } from '../design/morph';
|
||||
import { ShapeView, type Details, mix, rgba } from '../design/Shape';
|
||||
|
||||
// Each icon lands on a beat; the dot breathes for the first two beats.
|
||||
const STEPS: { shape: ShapeId; land: number; dur: number }[] = [
|
||||
{ shape: 'ely-doc', land: 75, dur: 30 },
|
||||
{ shape: 'ely-show', land: 112.5, dur: 24 },
|
||||
{ shape: 'ely-table', land: 150, dur: 24 },
|
||||
{ shape: 'ely-tree', land: 187.5, dur: 24 },
|
||||
{ shape: 'ely-pdf', land: 225, dur: 24 },
|
||||
{ shape: 'ely-mark', land: 262.5, dur: 24 },
|
||||
];
|
||||
|
||||
const END = SECTION.intro.duration;
|
||||
const clamp = { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' } as const;
|
||||
const ramp = (f: number, a: number, b: number, ease = EASE.out) => interpolate(f, [a, b], [0, 1], { ...clamp, easing: ease });
|
||||
|
||||
const iconAt = (f: number) => {
|
||||
// Before the wordmark the icon sits a little higher, at the frame's centre.
|
||||
const cy = ICON.y - 40 * (1 - ramp(f, 150, 240, EASE.inOut));
|
||||
const pulse = boundaryPulse(f - END);
|
||||
const index = STEPS.findLastIndex((s) => f >= s.land - s.dur);
|
||||
if (index < 0) {
|
||||
const appear = ramp(f, 4, 38);
|
||||
const breath = 0.16 * Math.exp(-(((f - 37.5) / 8) ** 2));
|
||||
const k = Math.max(0.001, appear * (1 + breath));
|
||||
return { d: shapePath('dot', 'stage', 0, k, ICON.x, cy), color: SHAPES.dot.color, k, cy, details: [] as Details[] };
|
||||
}
|
||||
const step = STEPS[index];
|
||||
const from: ShapeId = index === 0 ? 'dot' : STEPS[index - 1].shape;
|
||||
const start = step.land - step.dur;
|
||||
const t = EASE.inOut(Math.min(1, (f - start) / step.dur));
|
||||
const swell = STEPS.slice(0, -1).reduce((sum, s) => sum + 0.03 * Math.exp(-(((f - s.land) / 6) ** 2)), 0);
|
||||
const k = (1 - 0.07 * Math.sin(Math.PI * t)) * (1 + swell + pulse);
|
||||
const d = t >= 1 ? shapePath(step.shape, 'stage', 0, k, ICON.x, cy) : shapePath(from, step.shape, t, k, ICON.x, cy);
|
||||
const details: Details[] = [
|
||||
{ shape: from, opacity: 1 - ramp(f, start, start + 6, EASE.inOut) },
|
||||
{ shape: step.shape, opacity: ramp(f, step.land - 3, step.land + 7, EASE.inOut) },
|
||||
];
|
||||
return { d, color: mix(SHAPES[from].color, SHAPES[step.shape].color, t), k, cy, details };
|
||||
};
|
||||
|
||||
const Letters: React.FC<{ text: string; start: number; stagger: number; rise: number; blur: number }> = ({ text, start, stagger, rise, blur }) => {
|
||||
const f = useCurrentFrame();
|
||||
return (
|
||||
<>
|
||||
{Array.from(text).map((char, i) => {
|
||||
const p = ramp(f, start + i * stagger, start + i * stagger + 32);
|
||||
const b = (1 - p) * blur;
|
||||
return (
|
||||
<span
|
||||
key={i}
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
whiteSpace: 'pre',
|
||||
opacity: p,
|
||||
transform: `translateY(${((1 - p) * rise).toFixed(2)}px)`,
|
||||
filter: b > 0.05 ? `blur(${b.toFixed(2)}px)` : undefined,
|
||||
}}
|
||||
>
|
||||
{char}
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const WORD: React.CSSProperties = {
|
||||
fontFamily: FONT.latin,
|
||||
fontSize: 92,
|
||||
lineHeight: '100px',
|
||||
whiteSpace: 'nowrap',
|
||||
display: 'flex',
|
||||
alignItems: 'baseline',
|
||||
gap: 30,
|
||||
};
|
||||
|
||||
const Wordmark: React.FC<{ reveal: boolean; color?: string }> = ({ reveal, color }) => {
|
||||
const word = (text: string, start: number) =>
|
||||
reveal ? <Letters text={text} start={start} stagger={2.2} rise={30} blur={10} /> : text.split('').map((c, i) => <span key={i} style={{ display: 'inline-block', whiteSpace: 'pre' }}>{c}</span>);
|
||||
return (
|
||||
<div style={WORD}>
|
||||
<span style={{ fontWeight: 600, letterSpacing: '-0.025em', color: color ?? '#ECEAE6' }}>{word('Ely Office', 150)}</span>
|
||||
<span style={{ fontWeight: 300, letterSpacing: '0.01em', color: color ?? COLOR.muted }}>{word('0.1.5', 172)}</span>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const Intro: React.FC = () => {
|
||||
const f = useCurrentFrame();
|
||||
const icon = iconAt(f);
|
||||
const dawn = 1 - ramp(f, 0, 50, EASE.inOut);
|
||||
const ripple = ramp(f, 37.5, 37.5 + 50);
|
||||
const leaveWord = ramp(f, 272, 294, EASE.in);
|
||||
const leaveLine = ramp(f, 264, 286, EASE.in);
|
||||
const rule = ramp(f, 182, 210) * (1 - ramp(f, 258, 278, EASE.inOut));
|
||||
const sweep = ramp(f, 216, 262, EASE.inOut);
|
||||
return (
|
||||
<AbsoluteFill>
|
||||
{f < 92 ? (
|
||||
<svg width={1920} height={1080} style={{ position: 'absolute', inset: 0 }}>
|
||||
<circle
|
||||
cx={ICON.x}
|
||||
cy={icon.cy}
|
||||
r={20 + 150 * ripple}
|
||||
fill="none"
|
||||
stroke={rgba(SHAPES.dot.color, 0.5 * (1 - ripple) * Math.min(1, ripple * 8))}
|
||||
strokeWidth={1.5}
|
||||
/>
|
||||
</svg>
|
||||
) : null}
|
||||
<ShapeView d={icon.d} color={icon.color} cx={ICON.x} cy={icon.cy} k={icon.k} fill={1} lift={0} details={icon.details} />
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
width: 1920,
|
||||
top: 232,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
opacity: 1 - leaveWord,
|
||||
transform: `translateY(${(-20 * leaveWord).toFixed(2)}px)`,
|
||||
filter: leaveWord > 0.01 ? `blur(${(8 * leaveWord).toFixed(2)}px)` : undefined,
|
||||
}}
|
||||
>
|
||||
<div style={{ position: 'relative' }}>
|
||||
<Wordmark reveal />
|
||||
{sweep > 0 && sweep < 1 ? (
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
inset: 0,
|
||||
opacity: 0.9,
|
||||
maskImage: 'linear-gradient(100deg, transparent 0%, transparent 44%, black 50%, transparent 56%, transparent 100%)',
|
||||
maskSize: '320% 100%',
|
||||
maskRepeat: 'no-repeat',
|
||||
maskPosition: `${(100 - sweep * 100).toFixed(2)}% 0%`,
|
||||
}}
|
||||
>
|
||||
<Wordmark reveal={false} color="#FFFFFF" />
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ position: 'absolute', left: 960 - 28, top: 354, width: 56, height: 2, borderRadius: 1, background: COLOR.accent, transform: `scaleX(${rule.toFixed(4)})` }} />
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
width: 1920,
|
||||
top: 372,
|
||||
textAlign: 'center',
|
||||
fontFamily: FONT.sans,
|
||||
fontWeight: 300,
|
||||
fontSize: 31,
|
||||
lineHeight: '40px',
|
||||
letterSpacing: '0.34em',
|
||||
paddingLeft: '0.34em',
|
||||
boxSizing: 'border-box',
|
||||
color: '#BDBAB5',
|
||||
opacity: 1 - leaveLine,
|
||||
transform: `translateY(${(-12 * leaveLine).toFixed(2)}px)`,
|
||||
filter: leaveLine > 0.01 ? `blur(${(6 * leaveLine).toFixed(2)}px)` : undefined,
|
||||
}}
|
||||
>
|
||||
<Letters text="更顺手的一次更新" start={192} stagger={3} rise={14} blur={8} />
|
||||
</div>
|
||||
{dawn > 0.001 ? <AbsoluteFill style={{ background: '#09090a', opacity: dawn }} /> : null}
|
||||
</AbsoluteFill>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
import { AbsoluteFill } from 'remotion';
|
||||
import { Caption } from '../design/Caption';
|
||||
import { KeyCap } from '../design/KeyCap';
|
||||
import { Stage } from '../design/Stage';
|
||||
import { Clip, type Cut, type Shot } from '../footage/Clip';
|
||||
import { frameOf, Sounds } from '../footage/Sounds';
|
||||
import { Triangle } from '../footage/Triangle';
|
||||
|
||||
// The crossing over 插入 plays at half speed.
|
||||
const CROSS = { from: 7.09, to: 8.04 };
|
||||
const CUTS: Cut[] = [
|
||||
{ take: 'menus', from: 3.6, to: 7.0 },
|
||||
{ take: 'menus', from: 7.0, to: 8.15, rate: 0.5 },
|
||||
{ take: 'menus', from: 8.15, to: 12.45 },
|
||||
];
|
||||
const SHOTS: Shot[] = [
|
||||
{ f: 0, z: 1, x: 1024, y: 576 },
|
||||
{ f: 40, z: 1.15, x: 1120, y: 560 },
|
||||
{ f: 115, z: 1.45, x: 1380, y: 720 },
|
||||
{ f: 355, z: 1.45, x: 1380, y: 720 },
|
||||
{ f: 420, z: 1.25, x: 1150, y: 600 },
|
||||
{ f: 560, z: 1, x: 1024, y: 576 },
|
||||
];
|
||||
|
||||
export const Menus: React.FC = () => {
|
||||
const right = frameOf(CUTS, 4.43);
|
||||
const cross = frameOf(CUTS, CROSS.from);
|
||||
return (
|
||||
<AbsoluteFill>
|
||||
<Stage
|
||||
enter={{ from: 'ely-mark' }}
|
||||
exit={{ to: 'cell' }}
|
||||
heading={{ title: '二级菜单更好选', sub: '斜着移向子菜单,路过的项不再抢先弹出', app: 'ely-mark' }}
|
||||
>
|
||||
<Clip
|
||||
cuts={CUTS}
|
||||
shots={SHOTS}
|
||||
overlay={(_, t) => <Triangle take="menus" t={t} {...CROSS} passed={[654, 696]} note="路过「插入」,不抢走" />}
|
||||
/>
|
||||
</Stage>
|
||||
<KeyCap keys={['右键']} from={right - 20} to={right + 75} press={[right]} />
|
||||
<Caption text="0.5× · 安全三角:朝子菜单走,三角内的项不切换" from={cross - 30} to={frameOf(CUTS, 8.6)} />
|
||||
<Sounds cuts={CUTS} />
|
||||
</AbsoluteFill>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
import { AbsoluteFill, interpolate, useCurrentFrame } from 'remotion';
|
||||
import { Caption } from '../design/Caption';
|
||||
import { KeyCap } from '../design/KeyCap';
|
||||
import { Stage } from '../design/Stage';
|
||||
import { Clip, type Cut, type Shot } from '../footage/Clip';
|
||||
import { frameOf, Sounds } from '../footage/Sounds';
|
||||
import { EASE } from '../theme';
|
||||
import { Cards } from './Cards';
|
||||
|
||||
const CUTS: Cut[] = [{ take: 'more', from: 2.6, to: 9.0 }];
|
||||
const SHOTS: Shot[] = [
|
||||
{ f: 0, z: 1, x: 1024, y: 576 },
|
||||
{ f: 40, z: 1.4, x: 731, y: 360 },
|
||||
{ f: 190, z: 1.4, x: 731, y: 360 },
|
||||
{ f: 240, z: 1.5, x: 683, y: 780 },
|
||||
{ f: 296, z: 1.5, x: 683, y: 780 },
|
||||
{ f: 336, z: 1.5, x: 683, y: 384 },
|
||||
];
|
||||
// The cards replace the footage from here.
|
||||
const CARDS = 372;
|
||||
|
||||
export const More: React.FC = () => {
|
||||
const f = useCurrentFrame();
|
||||
const clear = frameOf(CUTS, 7.38);
|
||||
const away = interpolate(f, [CARDS - 20, CARDS + 10], [1, 0], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: EASE.inOut });
|
||||
return (
|
||||
<AbsoluteFill>
|
||||
<Stage
|
||||
enter={{ from: 'ely-show' }}
|
||||
exit={{ to: 'dot' }}
|
||||
heading={[
|
||||
{ title: '再开文件,进同一个窗口', sub: '应用已开着时,文件直接开成新标签;侧栏可清除最近文件', app: 'ely-mark' },
|
||||
{ title: '还有', sub: '中文显示统一 · macOS 安装包已公证', at: CARDS },
|
||||
]}
|
||||
>
|
||||
{f < CARDS + 10 ? (
|
||||
<AbsoluteFill style={{ opacity: away, transform: `scale(${0.97 + 0.03 * away})` }}>
|
||||
<Clip cuts={CUTS} shots={SHOTS} />
|
||||
</AbsoluteFill>
|
||||
) : null}
|
||||
{f >= CARDS - 20 ? <Cards at={CARDS} /> : null}
|
||||
</Stage>
|
||||
<Caption text="第二次打开:交给已开着的那份,开成新标签" from={frameOf(CUTS, 3.4)} to={frameOf(CUTS, 6.7)} />
|
||||
<KeyCap keys={['点击']} from={clear - 20} to={clear + 60} press={[clear]} />
|
||||
<Caption text="清除最近文件,重启后仍是空的" from={clear + 10} to={CARDS - 10} />
|
||||
<Sounds cuts={CUTS} />
|
||||
</AbsoluteFill>
|
||||
);
|
||||
};
|
||||