diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..fc0a95d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[{build,node_modules}/**] +indent_style = ignore +trim_trailing_whitespace = false +insert_final_newline = ignore diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..f5085d0 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +ko_fi: phones24 diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..5e15abc --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,10 @@ +# EP133 Tool Agent Guidelines + +- never comment the code, except biome or linter comments +- leave MY comments as is +- if you detect the changes in the code you've just made - accept it +- don't use responsive tailwind selector until I say so +- when adding a new library always check the official docs for the installed version +- always use brackets for IF statement, even for one line expression +- don't rebuild the project after updating the code, check for correct typing +- never commit any changes to git diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0ad25db --- /dev/null +++ b/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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. + + + Copyright (C) + + 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 . + +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 +. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3167bd9 --- /dev/null +++ b/README.md @@ -0,0 +1,99 @@ +**This project is not affiliated with or officially authorized by Teenage Engineering** + +# EP-133: Export To DAW + +This tool allows you to export your EP-133/EP-1320/EP-40 project into a DAW (Digital Audio Workstation). + +Try it out on https://ep133-to-daw.cc/ + +Check the project blog here: https://ko-fi.com/phones24 + +![EP-133 To Daw](./public/ep133-to-daw.png) + +

+ + + +

+ +## Features + +- Requires only browser with WebMIDI support +- Export projects directly from EP-133/EP-1320/EP-40 to: + - Ableton Live 11+ (project with samples) + - DAWproject (project + archived samples) + - REAPER (project with samples) + - MIDI (MIDI file + archived samples) +- Ableton Live: + - Minimum version: 11.3.35 + - Supports all sampler features: envelope, trimming points, stretching, playback modes + - Export as arrangements or session clips + - Fader params + - FX send/return + - Track grouping: 4 groups, same as on the device + - Any group can be exported as a Drum Rack track +- DAWproject (universal DAW format created by Bitwig): + - Export as arrangements with clips + - Includes archived samples + - Track grouping: 4 groups, same as on the device +- REAPER + - Export arrangements + - Basic sampler instrument has added to each track + - Includes samples + - Support track grouping +- MIDI: + - Includes archived samples + - Any group can be exported as a Drum Rack track +- Offline mode: Drop a `.pak` or `.ppak` backup file to browse and export projects without connecting your device +- Works offline (Progressive Web App) + + +## Latest news + +- [18/05/2026] Fixed custom scenes name handling + pak/ppak loading +- [20/03/2026] Custom project name + "Export all samples" option +- [05/01/2026] Export individual scenes +- [27/12/2025] Load projects from backup +- [13/11/2025] EP-40 Riddim is partailly supported + themes +- [27/10/2025] ABLETON: support fader params (but without automation for now) +- [16/10/2025] Added REAPER's sampler (just envs, root note, volume) +- [13/10/2025] Added time signature support +- [10/10/2025] REAPER support +- [08/10/2025] Rewrote TE sysex library +- [26/09/2025] Group A merging added for DAWProject and MIDI transformers +- [23/09/2025] ABLETON: FX support! The return track will be added with attached effect and each track(or group) will be sending to this return track +- [19/09/2025] Added feedback functionality with ability to attach your project for research +- [17/09/2025] ABLETON: Export tracks from group A into Drum Rack (with choke group!) +- [16/09/2025] ABLETON: Added play modes support: KEY and ONE +- [16/09/2025] ABLETON: Added sample stretching (both BPM and BAR modes are supported) +- [12/09/2025] ABLETON: Added the ability to group tracks (4 groups, same as EP) + bugfixes +- [09/09/2025] ABLETON: Minumum supported version is now 11.3.35 +- [09/09/2025] App is now working offline (PWA mode) +- [08/09/2025] Added Ableton 12 support + more note duration bugs are fixed +- [03/09/2025] Fixed several bugs, including issues with velocities and note durations +- [29/08/2025] Added MIDI export + + +## Motivation + +If you’ve been producing with the EP-133 (or EP-1320), you already know the frustration: there’s no clear way to export your projects directly into a DAW. +The official EP Sample Tool only lets you manage samples and backups. That’s it. + +Sure, you could record MIDI notes or capture audio track by track, but it’s slow, tedious, and not fun. + +While exploring the backup files generated by EP Sample Tool, I discovered that the device exposes a structured internal filesystem. Projects, notes, settings, +and other device data are stored in files, while the backup process simply packages this filesystem into an archive. + +This opened the possibility of accessing and interpreting the device data directly. Since Teenage Engineering does not publish +the implementation details or source code behind Sample Tool, I began reverse-engineering the file structures and studying +the application behavior. A significant amount of work went into analyzing file formats and reconstructing the underlying +logic (AI-assisted analysis proved particularly useful here). + +Once these pieces were in place, the web application itself became relatively straightforward to build. + + +## Donation + +If you find this project useful, please consider supporting its development with a donation! + +You can find the donation button on the project website, in the top-right corner. diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..309c02d --- /dev/null +++ b/TODO.md @@ -0,0 +1,4 @@ +- ableton: fader params +- ableton: fader tracks +- ableton: legato in sampler +- ableton: add default compressor on the output diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..ebe075a --- /dev/null +++ b/biome.json @@ -0,0 +1,60 @@ +{ + "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", + "vcs": { + "enabled": false, + "clientKind": "git", + "useIgnoreFile": false + }, + "files": { + "ignoreUnknown": false, + "includes": ["**"] + }, + "formatter": { + "enabled": true, + "indentStyle": "space", + "indentWidth": 2, + "lineEnding": "lf", + "lineWidth": 100, + "attributePosition": "auto" + }, + "assist": { "actions": { "source": { "organizeImports": "on" } } }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "a11y": { + "noSvgWithoutTitle": "off", + "useKeyWithClickEvents": "off" + }, + "style": { + "useImportType": "off", + "noNonNullAssertion": "off" + }, + "complexity": { + "noForEach": "off", + "noImportantStyles": "off", + "noBannedTypes": "off" + }, + "suspicious": { + "noArrayIndexKey": "off", + "noAssignInExpressions": "off", + "noExplicitAny": "off", + "noUnknownAtRules": "off", + "noEmptyInterface": "off" + }, + "correctness": { + "noUnusedImports": "error", + "noUnknownProperty": "off", + "useUniqueElementIds": "off" + }, + "security": { + "noDangerouslySetInnerHtml": "off" + } + } + }, + "javascript": { + "formatter": { + "quoteStyle": "single" + } + } +} diff --git a/docs/EP133_FORMATS.md b/docs/EP133_FORMATS.md new file mode 100644 index 0000000..5de48a9 --- /dev/null +++ b/docs/EP133_FORMATS.md @@ -0,0 +1,622 @@ +# EP-133 file formats data + +### PADS + +``` +[ +0 0, +1 0, // INSTRUMENT NUM +2 0, // INSTRUMENT NUM +3 0, // MIDI CHANNEL +4 0, // TRIM LEFT +5 0, // TRIM LEFT +6 0, // TRIM LEFT +7 0, +8 0, // TRIM RIGHT +9 0, // TRIM RIGHT +10 0, // TRIM RIGHT +11 0, +12 0, // TIME STRETCH BPM +13 0, // TIME STRETCH BPM +14 248, // TIME STRETCH BPM +15 66, // TIME STRETCH BPM +16 100, // VOLUME (0-200) +17 0, // PITCH (negative: 254-255, zero: 0, positive: 1-12) +18 0, // PAN (left: 240-255, center: 0, right: 1-16) +19 0, // ATACK (0-255), when in KEY/LEG mode +20 255, // RELEASE (0-255), when in KEY/LEG mode +21 0, // TIME STRETCH: 0 - OFF, 1 - BPM, 2 - BARS, 3 - REV +22 0, // CHOKE GROUP: 0 - true, 1 - false +23 0, // PLAY MODE: ONE - 0, KEY - 1, LEG - 2, +24 60, // PAD ID ? +25 0, // TIME STRETCH BARS: 0 - 1, 1 - 2, 3 - 4, 255 - 1/2, 254 - 1/4 +26 0 // PITCH DECIMAL PART +] +``` + +### PATTERNS +``` +{ + "0": 0, + "1": 2, // bars + "2": 8, // notes count + "3": 0, + + "4": 0, // position LB + "5": 0, // position HB + "6": 80, // N / 8 - pad number + "7": 60, // note + "8": 100, // velocity + "9": 43, // duration LB + "10": 0, // duration HB + "11": 0, + + "12": 96, + "13": 0, + "14": 80, + "15": 60, + "16": 100, + "17": 44, + "18": 0, + "19": 245, + + ... +} +``` + +### FX +``` +{ + "0": 0, + "1": 0, + "2": 0, + "3": 0, + "4": 2, // EFFECT TYPE: 0 - off, 1 - delay, 2 - rever, 3 - distortion, 4 - chorus, 5 - filter, 6 - compressor, + "5": 0, + "6": 0, + "7": 0, + "8": 0, + "9": 0, + "10": 0, + "11": 63, + "12": 0, // DLY - param 1 + "13": 0, // DLY - param 1 + "14": 124, // DLY - param 1 + "15": 62, // DLY - param 1 + "16": 0, // RVB - param 1 + "17": 0, // RVB - param 1 + "18": 0, // RVB - param 1 + "19": 63, // RVB - param 1 + "20": 0, // DST - param 1 + "21": 0, // DST - param 1 + "22": 0, // DST - param 1 + "23": 63, // DST - param 1 + "24": 0, // etc... + "25": 0, + "26": 0, + "27": 63, + "28": 0, + "29": 0, + "30": 0, + "31": 63, + "32": 0, + "33": 0, + "34": 0, + "35": 63, + "36": 0, + "37": 0, + "38": 0, + "39": 63, + "40": 0, + "41": 0, + "42": 0, + "43": 63, + "44": 0, + "45": 0, + "46": 0, + "47": 63, + "48": 0, + "49": 0, + "50": 0, + "51": 63, + "52": 0, + "53": 0, + "54": 0, + "55": 63, + "56": 0, + "57": 0, + "58": 0, + "59": 63, + "60": 0, + "61": 0, + "62": 0, + "63": 63, + "64": 0, + "65": 0, + "66": 0, + "67": 63, + "68": 0, + "69": 0, + "70": 0, + "71": 63, + "72": 0, + "73": 0, + "74": 0, + "75": 63, + "76": 0, // DLY - param 2 + "77": 0, // DLY - param 2 + "78": 204, // DLY - param 2 + "79": 62, // DLY - param 2 + "80": 0, // etc... + "81": 0, + "82": 0, + "83": 63, + "84": 0, + "85": 0, + "86": 0, + "87": 63, + "88": 0, + "89": 0, + "90": 0, + "91": 63, + "92": 0, + "93": 0, + "94": 0, + "95": 63, + "96": 0, + "97": 0, + "98": 0, + "99": 63, + "100": 0, + "101": 0, + "102": 0, + "103": 63, + "104": 0, + "105": 0, + "106": 0, + "107": 63, + "108": 0, + "109": 0, + "110": 0, + "111": 63, + "112": 0, + "113": 0, + "114": 0, + "115": 63, + "116": 0, + "117": 0, + "118": 0, + "119": 63, + "120": 0, + "121": 0, + "122": 0, + "123": 63, + "124": 0, + "125": 0, + "126": 0, + "127": 63, + "128": 0, + "129": 0, + "130": 0, + "131": 63, + "132": 0, + "133": 0, + "134": 0, + "135": 63, + "136": 0, + "137": 0, + "138": 0, + "139": 63, + "140": 0, + "141": 0, + "142": 0, + "143": 63, + "144": 0, + "145": 0, + "146": 0, + "147": 0, + "148": 0, + "149": 0, + "150": 0, + "151": 63, + "152": 0, + "153": 6, + "154": 0, + "155": 128, + "156": 0, + "157": 128, + "158": 0, + "159": 128 +} +``` + + +### SETTINGS +Fader params: + +- PITCH: 0 (-5 semitones) to 1 (+5 semitones) +- TUNE: 0 (-12 semitones) to 1 (+12 semitones) + + +``` +{ + "0": 0, + "1": 0, + "2": 0, + "3": 0, + "4": 0, // BPM + "5": 0, // BPM + "6": 250, // BPM + "7": 66, // BPM + "8": 0, + "9": 0, + "10": 0, + "11": 0, + "12": 0, + "13": 0, + "14": 0, + "15": 0, + "16": 0, + "17": 0, + "18": 0, + "19": 0, + "20": 0, + "21": 0, + "22": 0, + "23": 0, + "24": 0, // GROUP A LVL + "25": 0, // GROUP A LVL + "26": 128, // GROUP A LVL + "27": 191, // GROUP A LVL + "28": 0, // GROUP A PITCH + "29": 0, // GROUP A PITCH + "30": 128, // GROUP A PITCH + "31": 191, // GROUP A PITCH + "32": 0, // GROUP A TIME + "33": 0, // GROUP A TIME + "34": 128, // GROUP A TIME + "35": 191, // GROUP A TIME + "36": 0, + "37": 0, + "38": 128, + "39": 191, + "40": 0, + "41": 0, + "42": 128, + "43": 191, + "44": 205, // GROUP A FX D/W + "45": 88, // GROUP A FX D/W + "46": 132, // GROUP A FX D/W + "47": 62, // GROUP A FX D/W + "48": 0, + "49": 0, + "50": 128, + "51": 191, + "52": 0, + "53": 0, + "54": 128, + "55": 191, + "56": 0, + "57": 0, + "58": 128, + "59": 191, + "60": 0, + "61": 0, + "62": 128, + "63": 191, + "64": 0, + "65": 0, + "66": 128, + "67": 191, + "68": 0, + "69": 0, + "70": 128, + "71": 191, + "72": 0, // GROUP B LVL + "73": 0, // GROUP B LVL + "74": 128, // GROUP B LVL + "75": 191, // GROUP B LVL + "76": 0, + "77": 0, + "78": 128, + "79": 191, + "80": 0, + "81": 0, + "82": 128, + "83": 191, + "84": 0, + "85": 0, + "86": 128, + "87": 191, + "88": 0, + "89": 0, + "90": 128, + "91": 191, + "92": 0, + "93": 0, + "94": 128, + "95": 191, + "96": 0, + "97": 0, + "98": 128, + "99": 191, + "100": 0, + "101": 0, + "102": 128, + "103": 191, + "104": 0, + "105": 0, + "106": 128, + "107": 191, + "108": 0, + "109": 0, + "110": 128, + "111": 191, + "112": 0, + "113": 0, + "114": 128, + "115": 191, + "116": 0, + "117": 0, + "118": 128, + "119": 191, + "120": 0, + "121": 0, + "122": 128, + "123": 191, + "124": 0, + "125": 0, + "126": 128, + "127": 191, + "128": 0, + "129": 0, + "130": 128, + "131": 191, + "132": 0, + "133": 0, + "134": 128, + "135": 191, + "136": 0, + "137": 0, + "138": 128, + "139": 191, + "140": 0, // GROUP C FX D/W + "141": 0, // GROUP C FX D/W + "142": 128, // GROUP C FX D/W + "143": 191, // GROUP C FX D/W + "144": 0, + "145": 0, + "146": 128, + "147": 191, + "148": 0, + "149": 0, + "150": 128, + "151": 191, + "152": 0, + "153": 0, + "154": 128, + "155": 191, + "156": 0, + "157": 0, + "158": 128, + "159": 191, + "160": 0, + "161": 0, + "162": 128, + "163": 191, + "164": 0, + "165": 0, + "166": 128, + "167": 191, + "168": 0, + "169": 0, + "170": 128, + "171": 191, + "172": 0, + "173": 0, + "174": 128, + "175": 191, + "176": 0, + "177": 0, + "178": 128, + "179": 191, + "180": 0, + "181": 0, + "182": 128, + "183": 191, + "184": 0, + "185": 0, + "186": 128, + "187": 191, + "188": 255, // GROUP D FX D/W + "189": 236, // GROUP D FX D/W + "190": 127, // GROUP D FX D/W + "191": 63, // GROUP D FX D/W + "192": 0, + "193": 0, + "194": 128, + "195": 191, + "196": 0, + "197": 0, + "198": 128, + "199": 191, + "200": 0, + "201": 0, + "202": 128, + "203": 191, + "204": 0, + "205": 0, + "206": 128, + "207": 191, + "208": 0, + "209": 0, + "210": 128, + "211": 191, + "212": 0, + "213": 0, + "214": 128, + "215": 191, + "216": 5, // FADER ASSIGN A: 0 - LVL, 1 - PTC, 2 - TIM, 3 - LPF, 4 - HPF, 5 - FX, etc... + "217": 0, // FADER ASSIGN B + "218": 0, // FADER ASSIGN C + "219": 5, // FADER ASSIGN D + "220": 0, + "221": 4, + "222": 12, // SCALE: 0 - 2T, 1 - maj, 2 - min, 3 - dor, 4 - phr, 5 - lyd, 6 - mix, 7 - loc, 8 - ma.p, 9 - mi.p, 10 - BLU, 11 - H.MI, 12 - M.MI + "223": 0 // ROOT NOTE (pitch class: 0 - C, 1 - C#, ... 11 - B) +} + +``` + +### SCENES + +``` +{ + "0": 0, + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 4, + "6": 4, + + // scene 1 + "7": 1, // patterns A (patters from which scene to use for group A) + "8": 1, // patterns B + "9": 1, // patterns C + "10": 1, // patterns D + "11": 4, // numerator / beats in one bar + "12": 4, // denominator/ beat unit / note value + + // scene 2 + "13": 2, + "14": 2, + "15": 2, + "16": 2, + "17": 4, + "18": 4, + + // scene 3 + "19": 3, + "20": 3, + "21": 3, + "22": 3, + "23": 4, + "24": 4, + + ... + + "601": 127, + "602": 2, + "603": 8, + "604": 1, // scenes count + "605": 0, + "606": 0, + "607": 0, + "608": 0, + "609": 0, + "610": 0, + "611": 0, + "612": 1, + "613": 1, + "614": 0, + "615": 0, + "616": 0, + "617": 0, + "618": 0, + "619": 0, + "620": 0, + "621": 0, + "622": 0, + "623": 0, + "624": 0, + "625": 0, + "626": 0, + "627": 0, + "628": 0, + "629": 0, + "630": 0, + "631": 0, + "632": 0, + "633": 0, + "634": 0, + "635": 0, + "636": 0, + "637": 0, + "638": 0, + "639": 0, + "640": 0, + "641": 0, + "642": 0, + "643": 0, + "644": 0, + "645": 0, + "646": 0, + "647": 0, + "648": 0, + "649": 0, + "650": 0, + "651": 0, + "652": 0, + "653": 0, + "654": 0, + "655": 0, + "656": 0, + "657": 0, + "658": 0, + "659": 0, + "660": 0, + "661": 0, + "662": 0, + "663": 0, + "664": 0, + "665": 0, + "666": 0, + "667": 0, + "668": 0, + "669": 0, + "670": 0, + "671": 0, + "672": 0, + "673": 0, + "674": 0, + "675": 0, + "676": 0, + "677": 0, + "678": 0, + "679": 0, + "680": 0, + "681": 0, + "682": 0, + "683": 0, + "684": 0, + "685": 0, + "686": 0, + "687": 0, + "688": 0, + "689": 0, + "690": 0, + "691": 0, + "692": 0, + "693": 0, + "694": 0, + "695": 0, + "696": 0, + "697": 0, + "698": 0, + "699": 0, + "700": 0, + "701": 0, + "702": 0, + "703": 0, + "704": 0, + "705": 0, + "706": 0, + "707": 0, + "708": 0, + "709": 0, + "710": 0, + "711": 0 +} + +``` diff --git a/docs/EP40_FORMATS.md b/docs/EP40_FORMATS.md new file mode 100644 index 0000000..08bb404 --- /dev/null +++ b/docs/EP40_FORMATS.md @@ -0,0 +1,69 @@ + +# PAD +``` +{ + "0": 0, + "1": 198, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 0, + "8": 193, + "9": 39, + "10": 0, + "11": 0, + "12": 0, + "13": 0, + "14": 2, + "15": 67, + "16": 42, + "17": 250, + "18": 0, + "19": 0, + "20": 255, + "21": 0, + "22": 0, + "23": 0, + "24": 60, + "25": 0, + "26": 23, + "27": 8, + "28": 252 +} +``` + +# PATTERN +``` +{ + "0": 1, + "1": 8, // bars + "2": 255, + "3": 255, + "4": 20, + "5": 1, + + // note + "6": 0, + "7": 0, + "8": 48, + "9": 60, + "10": 100, + "11": 40, + "12": 0, + "13": 8, + + // note + "14": 0, + "15": 0, + "16": 64, + "17": 60, + "18": 100, + "19": 29, + "20": 0, + "21": 16, + + ... +} +``` diff --git a/docs/REAPER.md b/docs/REAPER.md new file mode 100644 index 0000000..84e3603 --- /dev/null +++ b/docs/REAPER.md @@ -0,0 +1,539 @@ +Original document found here: https://web.archive.org/web/20250227145458/https://wiki.cockos.com/wiki/index.php/State_Chunk_Definitions + +# State Chunk Definitions + +### From CockosWiki + +This page details what is known about various state chunk definitions such as are returned by API functions `GetSetTrackState()`, `GetSetItemState()` and `GetSetEnvelopeState()`. There are still some question marks (gaps) in the definitions and several plugin formats are completely undocumented so please fill in any gaps you can. Thanks to all who have spent time poking around these things. It's a tedious business. + +*Please note that comments, empty lines and indentation are for illustration only.* + +*For the sake of formatting, the following changes have been made:* + +- *Float values with fourteen decimal places have been condensed to three decimal places.* +- *Float values with ten decimal places have been condensed to two decimal places.* +- *Float values with six decimal places have been condensed to one decimal place.* +- *The shorthand "int (bool)" has been used to denote "0 = False, 1 = True"* + +*TODO:* + +- *Separate item source properties (including other item types) into their own block.* +- *Split this page into separate pages keep this one as the chunk index* +- *Link to this page from GetSetWhateverState() pages and remove chunk definitions from those pages* + +--- + +## Track + +The Track state chunk contains all the settings for a track and all of it's items, envelopes, receives, plugins etc. + +```text + // + FX 1 // FX state, int, 0=bypassed, 1=active + TRACKID {5619EDC5-E743-4BE8-AE9F-3B3469A111B5} // REAPER track id, leave it alone + PERF 0 // Performance options, int (bitwise) + // val & 1 = prevent media buffering + // val & 2 = prevent anticipative fx + + // --- Start of receive data --- + // One for each receive or not present if no receives + AUXRECV 2 1 1.000 0.000 0 0 0 2 0 1.000 80 1 // First receive + // field 1, int, source track index (zero based) + // field 2, int, mode + // 0 = Post Fader (Post Pan) + // 1 = Pre FX + // 3 = Pre Fader (Post FX) + // field 3, float, volume + // field 4, float, pan + // field 5, int (bool), mute + // field 6, int (bool), mono sum + // field 7, int (bool), invert phase + // field 8, int, source audio channels + // -1 = none, 0 = 1+2, 1 = 2+3, 2 = 3+4 etc. + // probably different if non-standard pairs aren't allowed + // field 9, int, dest audio channels (as source but no -1) + // field 10, float, panlaw + // field 11, int, midi channels + // source = val & 0x1F (0=None), dest = floor(val / 32) + // field 12, int, automation mode (-1 = use track mode) + + // --- Start of envelope definitions for the above receive + // One definition block for each non-empty envelope. + // See GetSetEnvelopeState() for full envelope definition. + // End of first receive envelope + // End of second receive envelope + // --- End of envelopes for first receive + + AUXRECV 3 0 1.000 0.000 0 0 0 0 0 -1.000 0 -1 // Second track receive settings (as above but no envelopes) + // --- End of receive data --- + + MIDIOUT -1 // MIDI hardware output settings. int (bitwise) + // device = floor(val / 32) + // index of device (inc. ignored devices) + // -1 for no MIDI hardware output + // channel = val & 0x1F + // channel number or 0 for 'use original' + // val = device * 32 + channel (device 2, ch 4 == 68) + MAINSEND 1 // Master/parent send, int (bool) + + // --- Start of track envelopes --- + // One definition block for each non-empty envelope. + // See GetSetEnvelopeState() for full envelope definition. + // End of first track envelope + // --- End of track envelopes + + // --- Start of FX section ---- + // --- End of FX section + + // --- Start of item definitions --- + // End of first item + // --- End of item definitions + +> // End +``` + +## Audio Item + +```text + // Source details end + > // Source section end + + TAKE SEL // Second take start. SEL only appears if this take is selected + NAME "The second take" // Take name + TAKEVOLPAN 0.0 1.0 -1.0 // Take volume and pan settings + // field 1, float, take pan + // field 2, float, take volume + // field 3, float, take pan law + SOFFS 0.000 // Take slip offset (in seconds) + PLAYRATE 1.000 1 0.000 -1 // see PLAYRATE above + CHANMODE 1 // see CHANMODE above + GUID {4EB7779B-D570-4CCF-8739-161D2D32C154} // Take id. Leave it alone + // Source section end +> // Item section end +``` + +## MIDI Item + +```text +One example is below, but more info can be found in the [[StateChunkAndRppMidiFormat]] page. +
+                                               // SysEx section end
+        E 540 b0 7b 00                                  // unselected msg, offset 540, Control Change , all notes off (cc123)
+        GUID {9DAB52C8-6257-4A4E-9E60-323514C0DB9B}     // Take id
+        IGNTEMPO 0 120.00000000 4 4                     // Ignore project tempo, override with new settings
+                                                        //  field 1, int, ignore on/off
+                                                        //  field 2, float, tempo used to override project tempo
+                                                        //  field 3-4, int, time signature to override project time signature
+        VELLANE 128 97 0                                // Velocity/CC lane settings
+                                                        //  field 1, int, lane type
+                                                        //    -1 = velocity
+                                                        //    0-119 = CC #0 - CC #119
+                                                        //    128 = pitch bend
+                                                        //    129 = program
+                                                        //    130 = channel pressure
+                                                        //    131 = bank/program select
+                                                        //    132 = text events
+                                                        //    133 = sysex
+                                                        //  field 2, int, height of the lane in MIDI editor mode
+                                                        //  field 3, int, height of the lane in inline editor mode
+        BANKPROGRAMFILE "C:\Path\To\GM.reabank"         // Path to ReaBank file used by the current item
+        CFGEDITVIEW 3787.8 0.1 0 48 0 0 0               // Somehow related to H/V zoom levels and scrollbar positions
+        CFGEDIT 1 1 0 1 1 16 1 1 1 1 1 0.06250000 0 0   // MIDI editor window configuration data
+        1024 768 0 2 0 0 0.00000000 0 0                 //  field 1, int, ??
+                                                        //  field 2, int (bool), sync editor transport to project transport
+                                                        //  field 3, int, ??
+                                                        //  field 4, int (bool), show velocity handles
+                                                        //  field 5, int (bool), show note names
+                                                        //  field 6, int, MIDI editor view mode
+                                                        //    0  = piano roll, rectangle
+                                                        //    1  = named notes, rectangle
+                                                        //    5  = event list, rectangle
+                                                        //    8  = piano roll, triangle
+                                                        //    9  = named notes, triangle
+                                                        //    13 = event list, triangle
+                                                        //    16 = piano roll, diamond
+                                                        //    17 = named notes, diamond
+                                                        //    21 = event list, diamond
+                                                        //  field 7, int, ??
+                                                        //  field 8, int (bool), move CCs with notes
+                                                        //  field 9, int, ??
+                                                        //  field 10, int (bool), snap to grid
+                                                        //  field 11, int (bool), show grid
+                                                        //  field 12, float, grid division unit, in beats.ticks
+                                                        //  field 13, field 14, int, X and Y coords of upper left corner of ME window
+                                                        //  field 15, field 16, int, X and Y coords of bottom right corner of ME window
+                                                        //  field 17, int (bool), dock editor window
+                                                        //  field 18, int, note row view modes
+                                                        //    0 = show all rows
+                                                        //    1 = hide unused rows
+                                                        //    2 = hide unused and unnamed rows
+                                                        //  field 19, int, state of Timebase setting
+                                                        //    0 = project beats
+                                                        //    1 = project sync
+                                                        //    2 = project time
+                                                        //    4 = source beats
+                                                        //  field 20, int, state of Color mode setting
+                                                        //    0 = velocity
+                                                        //    1 = channel
+                                                        //    2 = pitch
+                                                        //    4 = source
+                                                        //  field 21, float, length of last drawn note in beats.ticks
+                                                        //  field 22, int, re-use editor window
+                                                        //    0 = off
+                                                        //    1 = re-use MIDI editor window
+                                                        //    2 = re-use MIDI editor window, keeping current item secondary
+                                                        //  field 23, int (bool), show velocity numbers
+        EVTFILTER 0 -1 -1 -1 -1 0 1                     // Event filter settings
+                                                        //  field 1, int (16-bit mask), state of channel checkboxes
+                                                        //    0000000000000000 (0)     - "All" is checked, 1-16 unchecked
+                                                        //    1111111111111111 (65536) - "All" is checked along with 1-16
+                                                        //    1000000000000001 (32769) -  1 (LSB) and 16 (MSB) are selected
+                                                        //    etc.
+                                                        //  field 2, int, Event type
+                                                        //    -1  = 
+                                                        //    144 = Note
+                                                        //    160 = Poly Aftertouch
+                                                        //    176 = Control Change (CC)
+                                                        //    192 = Program Change (PC)
+                                                        //    208 = Channel Aftertouch
+                                                        //    224 = Pitch
+                                                        //    240 = Sysex/Meta
+                                                        //  field 3, int, parameter field (range: 0-127)
+                                                        //  field 4, int, value Low field (range: 0-127)
+                                                        //  field 5, int, value High field (range: 0-127)
+                                                        //  field 6, int, draw events on channel setting (range: 0-15)
+                                                        //  field 7, int (bool), enable filter
+    >                                                   // Source section end
+>                                                       // Item section end
+```
+
+MIDI Event -> field 2 above... This is the number of ticks (it's ok, I'll tell you in a minute) since the last event or (if this is the first MIDI Event) the start of the Item.
+
+Ticks then. A tick is a small slice of a beat, so the number of Ticks per second varies with the BPM (Beats Per Minute) of the music.
+
+1 beat = 2.6041666666666666666666666666667e-4 \times 240 \times 16
+
+1 beat = 2.6041666666666666666666666666667e-4 * 240 * 16
+
+The MIDI format used in REAPER State Chunks and .rpp files is documented here State Chunk And RPP MIDI Format.
+
+
+
+
+## Envelope
+
+Envelopes appear to share most of their characteristics though there may be some differences in how point values are used. Needs more testing
+
+Envelope types include:
+
+- VOLENV - Track (pre FX)/Take volume (0.0 to 2.0)
+- VOLENV2 - Track (post FX) volume (0.0 to 2.0)
+- PANENV - Track (pre FX)/Take pan (-1.0 to 1.0)
+- PANENV2 - Track (post FX) pan (-1.0 to 1.0)
+- MUTEENV - Track mute (0.0 to 1.0)
+- AUXVOLENV - Receive volume (0.0 to 2.0?)
+- AUXPANENV - Receive pan (-1.0 to 1.0)
+- AUXMUTEENV - Receive mute (0.0 to 1.0)
+- PARMENV - Plugin parameter (value range defined by additional parameters after type tag)
+- TEMPOENVEX - Master tempo
+
+
+```text
+```
+
+PARMENV contains extra data denoting which plugin parameter is controlled and what the minimum, maximum and default values are.
+
+```text
+
+```
+
+
+## Track/Take FX
+
+Plugin chains appear to be the same for both tracks and item takes, with the exception that the chunk name is different.
+
+```text
+                                                             //
+    FLOATPOS 0 0 0 0                                          //  Plugin floating window pos, int (top, left, width, height)
+    FXID {1191A7FE-F583-477E-8416-D9F0F58226CD}               //  Plugin id, leave it alone
+
+                                                              //  --- Start of parameter envelopes for this plugin.
+                                                              //      One block for each non-empty envelope.
+                                                             //
+                                                              //  --- End of parameter envelopes
+
+    PARM_TCP 4 2 0                                            //  Params visible on TCP/MCP.
+                                                              //   List of int indexes separated by spaces.
+    WAK 0                                                     //  int, ??
+                                                             //
+
+                                                              // --- Start of second plugin definition
+    BYPASS 0 0 0                                              //  ...
+                                                             //
+    FLOATPOS 0 0 0 0                                          //  ...
+    FXID {BE5D3334-6675-4DAD-AFDD-F4489878D82A}               //  ...
+    WAK 0                                                     //  ...
+                                                             //  ...
+
+    >                                                         // --- End of FX section
+
+```
+
+## VST(i) Plugin
+
+```text
+                                                             //  End of VST plugin data
+```
+
+## Jesusonic Plugin
+
+For the sake of formatting, the plugin data has been truncated.
+
+```text
+                                                             //  End of JS plugin data
+```
+
diff --git a/docs/REASAMPLOMATIC.md b/docs/REASAMPLOMATIC.md
new file mode 100644
index 0000000..f41f540
--- /dev/null
+++ b/docs/REASAMPLOMATIC.md
@@ -0,0 +1,330 @@
+State format of REAPER's ReaSamplOmatic 5000
+I used the verson that bundled with REAPER 7.48
+
+// volume
+000  82
+001  66
+002  51
+003  207
+004  185
+005  9
+006  224
+007  63
+
+//
+008  0
+009  0
+010  0
+011  0
+012  0
+013  0
+014  224
+015  63
+
+// max volume
+016  14
+017  71
+018  84
+019  28
+020  213
+021  115
+022  252
+023  63
+
+//
+024  0
+025  0
+026  0
+027  0
+028  0
+029  0
+030  0
+031  0
+
+//
+032  0
+033  0
+034  0
+035  0
+036  0
+037  0
+038  240
+039  63
+
+// pitch start/root note (note mode), C4 = -60, C3 = -48, C-1 = 0
+040  154
+041  153
+042  153
+043  153
+044  153
+045  153
+046  177
+047  63
+
+//
+048  205
+049  204
+050  204
+051  204
+052  204
+053  204
+054  235
+055  63
+
+//
+056  0
+057  0
+058  0
+059  0
+060  0
+061  0
+062  0
+063  0
+
+//
+064  28
+065  199
+066  113
+067  28
+068  199
+069  113
+070  220
+071  63
+
+// attack
+072  252
+073  169
+074  241
+075  210
+076  77
+077  98
+078  64
+079  63
+
+// release
+080  252
+081  169
+082  241
+083  210
+084  77
+085  98
+086  64
+087  63
+
+// obey note off: 0, 1
+088  0
+089  0
+090  0
+091  0
+092  0
+093  0
+094  0
+095  0
+
+//
+096  0
+097  0
+098  0
+099  0
+100  0
+101  0
+102  0
+103  0
+
+// sample start
+104  0
+105  0
+106  0
+107  0
+108  0
+109  0
+110  0
+111  0
+
+// sample end
+112  0
+113  0
+114  0
+115  0
+116  0
+117  0
+118  240
+119  63
+
+// pitch offset in semitones
+120  0
+121  0
+122  0
+123  0
+124  0
+125  0
+126  224
+127  63
+
+//
+128  1 // mode: 0, 1, 2
+129  0
+130  0
+131  0
+132  0
+133  0
+134  0
+135  0
+136  0
+137  0
+138  0
+139  0
+
+//
+140  0
+141  0
+142  0
+143  0
+144  0
+145  0
+146  240
+147  63
+
+148  64
+149  0
+150  0
+151  0
+
+//
+152  85
+153  85
+154  85
+155  85
+156  85
+157  85
+158  197
+159  63
+
+160  255
+161  255
+162  255
+163  255
+164  8
+165  4
+166  2
+167  129
+168  64
+169  32
+170  128
+171  63
+
+//
+172  0
+173  0
+174  0
+175  0
+176  0
+177  0
+178  240
+179  63
+
+//
+180  0
+181  0
+182  0
+183  0
+184  0
+185  0
+186  240
+187  63
+
+
+188  0
+189  0
+190  0
+191  0
+192  0
+193  0
+194  0
+195  0
+196  0
+197  0
+198  0
+199  0
+200  0
+201  0
+202  0
+203  0
+204  0
+205  0
+206  0
+207  0
+208  0
+209  0
+210  0
+211  0
+212  0
+213  0
+214  0
+215  0
+216  0
+217  0
+218  0
+219  0
+
+//
+220  206
+221  164
+222  33
+223  33
+224  26
+225  101
+226  144
+227  63
+
+//
+228  0
+229  0
+230  0
+231  0
+232  0
+233  0
+234  240
+235  63
+
+//
+236  252
+237  169
+238  241
+239  210
+240  77
+241  98
+242  48
+243  63
+
+
+244  0
+245  0
+246  0
+247  0
+248  0
+249  0
+250  0
+251  0
+252  0
+253  0
+254  0
+255  0
+256  0
+257  0
+258  0
+259  0
+260  0
+261  0
+262  0
+263  0
+264  0
+265  0
+266  0
+267  0
+268  0
+269  0
+270  16
+271  0
+272  0
+273  0
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..18f45cd
--- /dev/null
+++ b/index.html
@@ -0,0 +1,42 @@
+
+
+  
+    
+    
+    
+    
+    
+    EP-133: Export To Daw
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  
+  
+    
+ + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..daa9adf --- /dev/null +++ b/package.json @@ -0,0 +1,57 @@ +{ + "name": "ep133-export-to-daw", + "private": true, + "version": "1.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "typecheck": "tsc --noEmit", + "lint": "biome check --write src", + "format": "biome format --write src" + }, + "dependencies": { + "@hookform/resolvers": "^5.4.0", + "@sentry/react": "^10.53.1", + "@sentry/vite-plugin": "^5.3.0", + "@tanstack/react-query": "^5.100.13", + "@tonejs/midi": "^2.0.28", + "clsx": "^2.1.1", + "events": "^3.3.0", + "jotai": "^2.20.0", + "jstoxml": "^7.1.0", + "jszip": "^3.10.1", + "ky": "^2.0.2", + "lodash": "^4.18.1", + "preact": "^10.29.2", + "react-dnd": "^16.0.1", + "react-dnd-html5-backend": "^16.0.1", + "react-hook-form": "^7.76.1", + "tailwind-merge": "^3.6.0", + "tailwindcss": "^4.3.0", + "workbox-window": "^7.4.1", + "wouter": "^3.10.0", + "wouter-preact": "^3.10.0", + "xml2js": "^0.6.2", + "xmlbuilder2": "^4.0.3", + "zod": "^4.4.3" + }, + "devDependencies": { + "@biomejs/biome": "2.2.0", + "@preact/preset-vite": "^2.10.5", + "@tailwindcss/vite": "^4.3.0", + "@types/jstoxml": "^5.0.0", + "@types/lodash": "^4.17.24", + "@types/node": "^24.12.4", + "@types/react": "^19.2.15", + "@types/react-dom": "^19.2.3", + "@types/xml2js": "^0.4.14", + "tsx": "^4.22.3", + "typescript": "^6.0.3", + "vite": "^8.0.14", + "vite-plugin-minify": "^2.1.0", + "vite-plugin-pwa": "^1.3.0", + "vite-plugin-svgr": "^5.2.0" + }, + "packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748" +} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..3a3e37d --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,3 @@ +onlyBuiltDependencies: + - '@sentry/cli' + - esbuild diff --git a/public/ableton.jpg b/public/ableton.jpg new file mode 100644 index 0000000..bb0bdb9 Binary files /dev/null and b/public/ableton.jpg differ diff --git a/public/android-icon-144x144.png b/public/android-icon-144x144.png new file mode 100644 index 0000000..f197f5c Binary files /dev/null and b/public/android-icon-144x144.png differ diff --git a/public/android-icon-192x192.png b/public/android-icon-192x192.png new file mode 100644 index 0000000..c3477a8 Binary files /dev/null and b/public/android-icon-192x192.png differ diff --git a/public/android-icon-36x36.png b/public/android-icon-36x36.png new file mode 100644 index 0000000..a8bc6bf Binary files /dev/null and b/public/android-icon-36x36.png differ diff --git a/public/android-icon-48x48.png b/public/android-icon-48x48.png new file mode 100644 index 0000000..8efbc1e Binary files /dev/null and b/public/android-icon-48x48.png differ diff --git a/public/android-icon-72x72.png b/public/android-icon-72x72.png new file mode 100644 index 0000000..8d7c1b9 Binary files /dev/null and b/public/android-icon-72x72.png differ diff --git a/public/android-icon-96x96.png b/public/android-icon-96x96.png new file mode 100644 index 0000000..1f0c0d8 Binary files /dev/null and b/public/android-icon-96x96.png differ diff --git a/public/apple-icon-114x114.png b/public/apple-icon-114x114.png new file mode 100644 index 0000000..2197b89 Binary files /dev/null and b/public/apple-icon-114x114.png differ diff --git a/public/apple-icon-120x120.png b/public/apple-icon-120x120.png new file mode 100644 index 0000000..8596aac Binary files /dev/null and b/public/apple-icon-120x120.png differ diff --git a/public/apple-icon-144x144.png b/public/apple-icon-144x144.png new file mode 100644 index 0000000..f197f5c Binary files /dev/null and b/public/apple-icon-144x144.png differ diff --git a/public/apple-icon-152x152.png b/public/apple-icon-152x152.png new file mode 100644 index 0000000..a40659c Binary files /dev/null and b/public/apple-icon-152x152.png differ diff --git a/public/apple-icon-180x180.png b/public/apple-icon-180x180.png new file mode 100644 index 0000000..0eb7609 Binary files /dev/null and b/public/apple-icon-180x180.png differ diff --git a/public/apple-icon-57x57.png b/public/apple-icon-57x57.png new file mode 100644 index 0000000..c539c91 Binary files /dev/null and b/public/apple-icon-57x57.png differ diff --git a/public/apple-icon-60x60.png b/public/apple-icon-60x60.png new file mode 100644 index 0000000..06cfd27 Binary files /dev/null and b/public/apple-icon-60x60.png differ diff --git a/public/apple-icon-72x72.png b/public/apple-icon-72x72.png new file mode 100644 index 0000000..8d7c1b9 Binary files /dev/null and b/public/apple-icon-72x72.png differ diff --git a/public/apple-icon-76x76.png b/public/apple-icon-76x76.png new file mode 100644 index 0000000..ae400b5 Binary files /dev/null and b/public/apple-icon-76x76.png differ diff --git a/public/apple-icon-precomposed.png b/public/apple-icon-precomposed.png new file mode 100644 index 0000000..0f61822 Binary files /dev/null and b/public/apple-icon-precomposed.png differ diff --git a/public/apple-icon.png b/public/apple-icon.png new file mode 100644 index 0000000..0f61822 Binary files /dev/null and b/public/apple-icon.png differ diff --git a/public/bg-ep1320.png b/public/bg-ep1320.png new file mode 100644 index 0000000..812fefa Binary files /dev/null and b/public/bg-ep1320.png differ diff --git a/public/bg-ep133.png b/public/bg-ep133.png new file mode 100644 index 0000000..ed83c2f Binary files /dev/null and b/public/bg-ep133.png differ diff --git a/public/bg-ep40.png b/public/bg-ep40.png new file mode 100644 index 0000000..454d50d Binary files /dev/null and b/public/bg-ep40.png differ diff --git a/public/bitwig.jpg b/public/bitwig.jpg new file mode 100644 index 0000000..7ceadcc Binary files /dev/null and b/public/bitwig.jpg differ diff --git a/public/browserconfig.xml b/public/browserconfig.xml new file mode 100644 index 0000000..c554148 --- /dev/null +++ b/public/browserconfig.xml @@ -0,0 +1,2 @@ + +#ffffff \ No newline at end of file diff --git a/public/ep1320-on.png b/public/ep1320-on.png new file mode 100644 index 0000000..9a874b2 Binary files /dev/null and b/public/ep1320-on.png differ diff --git a/public/ep133-on.png b/public/ep133-on.png new file mode 100644 index 0000000..b4eadee Binary files /dev/null and b/public/ep133-on.png differ diff --git a/public/ep133-to-daw.png b/public/ep133-to-daw.png new file mode 100644 index 0000000..2d3ec23 Binary files /dev/null and b/public/ep133-to-daw.png differ diff --git a/public/ep133.png b/public/ep133.png new file mode 100644 index 0000000..b3f7255 Binary files /dev/null and b/public/ep133.png differ diff --git a/public/ep40-on.png b/public/ep40-on.png new file mode 100644 index 0000000..ba48ae5 Binary files /dev/null and b/public/ep40-on.png differ diff --git a/public/eptoolkit/eptoolkit-1.png b/public/eptoolkit/eptoolkit-1.png new file mode 100644 index 0000000..193ef77 Binary files /dev/null and b/public/eptoolkit/eptoolkit-1.png differ diff --git a/public/eptoolkit/eptoolkit-2.png b/public/eptoolkit/eptoolkit-2.png new file mode 100644 index 0000000..dcae444 Binary files /dev/null and b/public/eptoolkit/eptoolkit-2.png differ diff --git a/public/eptoolkit/eptoolkit-3.png b/public/eptoolkit/eptoolkit-3.png new file mode 100644 index 0000000..b164040 Binary files /dev/null and b/public/eptoolkit/eptoolkit-3.png differ diff --git a/public/eptoolkit/eptoolkit-logo.png b/public/eptoolkit/eptoolkit-logo.png new file mode 100644 index 0000000..cd4f2f8 Binary files /dev/null and b/public/eptoolkit/eptoolkit-logo.png differ diff --git a/public/favicon-16x16.png b/public/favicon-16x16.png new file mode 100644 index 0000000..eeea885 Binary files /dev/null and b/public/favicon-16x16.png differ diff --git a/public/favicon-32x32.png b/public/favicon-32x32.png new file mode 100644 index 0000000..beeb1b4 Binary files /dev/null and b/public/favicon-32x32.png differ diff --git a/public/favicon-96x96.png b/public/favicon-96x96.png new file mode 100644 index 0000000..431f9f8 Binary files /dev/null and b/public/favicon-96x96.png differ diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..4a3f32f Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/ms-icon-144x144.png b/public/ms-icon-144x144.png new file mode 100644 index 0000000..66fad2e Binary files /dev/null and b/public/ms-icon-144x144.png differ diff --git a/public/ms-icon-150x150.png b/public/ms-icon-150x150.png new file mode 100644 index 0000000..1e3b025 Binary files /dev/null and b/public/ms-icon-150x150.png differ diff --git a/public/ms-icon-310x310.png b/public/ms-icon-310x310.png new file mode 100644 index 0000000..20f6cb9 Binary files /dev/null and b/public/ms-icon-310x310.png differ diff --git a/public/ms-icon-70x70.png b/public/ms-icon-70x70.png new file mode 100644 index 0000000..7e80467 Binary files /dev/null and b/public/ms-icon-70x70.png differ diff --git a/public/reaper.jpg b/public/reaper.jpg new file mode 100644 index 0000000..dc79cc4 Binary files /dev/null and b/public/reaper.jpg differ diff --git a/public/riddim.png b/public/riddim.png new file mode 100644 index 0000000..e6fd791 Binary files /dev/null and b/public/riddim.png differ diff --git a/public/track-bg.svg b/public/track-bg.svg new file mode 100644 index 0000000..33d4c12 --- /dev/null +++ b/public/track-bg.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/scripts/reaper_extract_vst_base64.mjs b/scripts/reaper_extract_vst_base64.mjs new file mode 100755 index 0000000..99919e6 --- /dev/null +++ b/scripts/reaper_extract_vst_base64.mjs @@ -0,0 +1,153 @@ +import fs from 'node:fs'; + +function int32ToLEBytes(value) { + const bytes = new Uint8Array(4); + bytes[0] = value & 0xff; + bytes[1] = (value >> 8) & 0xff; + bytes[2] = (value >> 16) & 0xff; + bytes[3] = (value >> 24) & 0xff; + return bytes; +} +function bytesToDouble(bytes) { + if (bytes.length !== 8) { + throw new Error('Expected 8 bytes'); + } + const buffer = new ArrayBuffer(8); + const view = new DataView(buffer); + bytes.forEach((b, i) => view.setUint8(i, b)); + return view.getFloat64(0, true); +} + +function doubleToBytes(num) { + const buffer = new ArrayBuffer(8); + const view = new DataView(buffer); + view.setFloat64(0, num, true); + const bytes = []; + for (let i = 0; i < 8; i++) { + bytes.push(view.getUint8(i)); + } + return bytes; +} + +function paramToBytes(paramValue) { + const normalizedValue = paramValue / 250.0; + + const buffer = new ArrayBuffer(8); + const view = new DataView(buffer); + view.setFloat64(0, normalizedValue, true); + + const bytes = []; + for (let i = 0; i < 8; i++) { + bytes.push(view.getUint8(i)); + } + return bytes; +} + +function dbToBytes(dbValue) { + const linearGain = Math.pow(10, dbValue / 20); + + const buffer = new ArrayBuffer(8); + const view = new DataView(buffer); + view.setFloat64(0, linearGain, true); + + const bytes = []; + for (let i = 0; i < 8; i++) { + bytes.push(view.getUint8(i)); + } + return bytes; +} + +function msToBytes(msValue, sampleLengthMs) { + const normalizedValue = msValue / sampleLengthMs; + + const buffer = new ArrayBuffer(8); + const view = new DataView(buffer); + view.setFloat64(0, normalizedValue, true); + + const bytes = []; + for (let i = 0; i < 8; i++) { + bytes.push(view.getUint8(i)); + } + return bytes; +} + +function bytesToString(bytes) { + return bytes.reduce((acc, byte, index) => { + return `${acc + String(index).padStart(3, '0')} ${byte}\n`; + }, ''); +} + +function midiNoteToBytes(note) { + return doubleToBytes((note - 40) / 160); +} + +const filePath = '/home/yura/Documents/REAPER Media/test1/test1.RPP'; +// const filePath = '/home/yura/dev/MY/ep133-export-to-daw/.tmp/reaper/test2.RPP'; +const txt = fs.readFileSync(filePath, 'utf8'); + +const lines = txt.split(/\r?\n/); +let startIdx = -1; +for (let i = 0; i < lines.length; i++) { + if (lines[i].trim().startsWith(' startIdx && t === '>') break; + section.push(lines[i]); +} + +const joined = section.slice(1).join(''); + +const sections = []; +let buf = ''; +for (let i = 0; i < joined.length; i++) { + buf += joined[i]; + + if ((joined[i] === '=' && joined[i + 1] === ' ') || i === joined.length - 1) { + sections.push(buf.trim().replace(/\s/g, '')); + buf = ''; + } +} + +const bin1 = Buffer.from(sections[0], 'base64'); +const bin2 = Buffer.from(sections[1], 'base64'); + +const idx = bin2.indexOf(0x00) + 1; +// console.log(idx); +// const textData = bin2.slice(0, idx).toString('utf8'); +const cut2 = bin2.slice(idx); +// console.dir(textData); +// console.dir(Array.from(cut2), { maxArrayLength: null, compact: false }); +// console.log(cut.length); +// console.log(bytesToString(cut2)); + +// console.log('Size:', size); +// console.log(int32ToLEBytes(size)); + +// const newHeader = [...VST_HEADER]; +// newHeader.splice(32, 4, ...int32ToLEBytes(347)); + +// console.dir(newHeader, { maxArrayLength: null, compact: false }); + +// console.dir(new Uint8Array(bin2), { maxArrayLength: null, compact: false }); +// console.log(bin2.length); +// console.dir(val.slice(207, 214), { maxArrayLength: null, compact: false }); + +const ofs = 40; +console.dir(cut2.slice(ofs, ofs + 8), { compact: false }); +console.log(bytesToDouble(cut2.slice(ofs, ofs + 8))); +// console.dir(paramToBytes(18.11), { compact: false }); + +// console.log(bytesToFloat32BE([0x40, 0x94, 0x84, 0xf2])); +// console.dir(paramToBytes(10), { compact: false }); +// console.dir(dbToBytes(-10), { compact: false }); + +// console.log(midiNoteToBytes(60)); +// console.log(bytesToDouble(midiNoteToBytes(60))); +// console.log(doubleToBytes(460.59)); +// console.log(int32ToLEBytes(46875)); diff --git a/scripts/reaper_generate_vst_state.mjs b/scripts/reaper_generate_vst_state.mjs new file mode 100755 index 0000000..61cded8 --- /dev/null +++ b/scripts/reaper_generate_vst_state.mjs @@ -0,0 +1,135 @@ +const VST_HEADER = [ + 109, 111, 115, 114, 238, 94, 237, 254, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 90, 1, 0, 0, 1, 0, 0, 0, 0, 0, 16, 0, +]; + +const VST_BODY = [ + 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 224, 63, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, 154, 153, 153, 153, 153, 153, 177, 63, 205, 204, 204, 204, 204, + 204, 235, 63, 0, 0, 0, 0, 0, 0, 0, 0, 28, 199, 113, 28, 199, 113, 220, 63, 252, 169, 241, 210, 77, + 98, 64, 63, 252, 169, 241, 210, 77, 98, 64, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 224, 63, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, 64, 0, 0, 0, 85, 85, 85, 85, 85, 85, 197, 63, 255, 255, + 255, 255, 8, 4, 2, 129, 64, 32, 128, 63, 0, 0, 0, 0, 0, 0, 240, 63, 0, 0, 0, 0, 0, 0, 240, 63, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 206, + 164, 33, 33, 26, 101, 144, 63, 0, 0, 0, 0, 0, 0, 240, 63, 252, 169, 241, 210, 77, 98, 48, 63, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, +]; + +function int32ToLEBytes(value) { + const bytes = new Uint8Array(4); + bytes[0] = value & 0xff; + bytes[1] = (value >> 8) & 0xff; + bytes[2] = (value >> 16) & 0xff; + bytes[3] = (value >> 24) & 0xff; + return bytes; +} +function bytesToDouble(bytes) { + if (bytes.length !== 8) { + throw new Error('Expected 8 bytes'); + } + const buffer = new ArrayBuffer(8); + const view = new DataView(buffer); + bytes.forEach((b, i) => view.setUint8(i, b)); + return view.getFloat64(0, true); +} + +function doubleToBytes(num) { + const buffer = new ArrayBuffer(8); + const view = new DataView(buffer); + view.setFloat64(0, num, true); + const bytes = []; + for (let i = 0; i < 8; i++) { + bytes.push(view.getUint8(i)); + } + return bytes; +} + +function paramToBytes(paramValue) { + const normalizedValue = paramValue / 250.0; + + const buffer = new ArrayBuffer(8); + const view = new DataView(buffer); + view.setFloat64(0, normalizedValue, true); + + const bytes = []; + for (let i = 0; i < 8; i++) { + bytes.push(view.getUint8(i)); + } + return bytes; +} + +function dbToBytes(dbValue) { + const linearGain = Math.pow(10, dbValue / 20); + + const buffer = new ArrayBuffer(8); + const view = new DataView(buffer); + view.setFloat64(0, linearGain, true); + + const bytes = []; + for (let i = 0; i < 8; i++) { + bytes.push(view.getUint8(i)); + } + return bytes; +} + +function msToBytes(msValue, sampleLengthMs) { + const normalizedValue = msValue / sampleLengthMs; + + const buffer = new ArrayBuffer(8); + const view = new DataView(buffer); + view.setFloat64(0, normalizedValue, true); + + const bytes = []; + for (let i = 0; i < 8; i++) { + bytes.push(view.getUint8(i)); + } + return bytes; +} + +function bytesToString(bytes) { + return bytes.reduce((acc, byte, index) => { + return `${acc + String(index).padStart(3, '0')} ${byte}\n`; + }, ''); +} + +function buildVstState({ filePath, volume = -6, attack = 10, release = 10 }) { + const encoder = new TextEncoder(); + const bufferHeader = VST_HEADER; + const bufferBody = [...VST_BODY]; + + // console.log(cut.length); + + // console.dir(bufferHeader, { maxArrayLength: null, compact: false }); + // console.dir(Buffer.from(bufferBody).toString('utf8'), { maxArrayLength: null, compact: fal 6y5a -O0se }); + + // const decoder = new TextDecoder('utf-8'); // Specify the encoding, e.g., 'utf-8' + // console.log(decoder.decode(new Uint8Array(VST_BODY))); + // console.log(decoder.decode(new Uint8Array(cut))); + + bufferBody.splice(0, 8, ...dbToBytes(volume)); + // bufferBody.splice(8, 8, ...dbToBytes(5)); + // bufferBody.splice(16, 8, ...dbToBytes()); // min volume + bufferBody.splice(72, 8, ...msToBytes(attack, 920)); // atack + bufferBody.splice(80, 8, ...msToBytes(release, 920)); // release + + // console.dir(bufferBody, { maxArrayLength: null, compact: false }); + console.log(bytesToString(bufferBody)); + + const fullBody = [...encoder.encode(filePath), 0, ...bufferBody]; + + bufferHeader.splice(32, 4, ...int32ToLEBytes(fullBody.length)); + + return { + header: Buffer.from(bufferHeader).toString('base64'), + body: Buffer.from(fullBody).toString('base64'), + }; +} + +const result = buildVstState({ + filePath: 'Media/BD B 808 Decay C 02.wav', + // filePath: 'Media/600 veh2 percussive .wav', +}); + +console.log(' ' + result.header); +console.log(' ' + result.body); diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..9e94e32 --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,42 @@ +import { QueryClientProvider } from '@tanstack/react-query'; +import { Provider } from 'jotai'; +import { DndProvider } from 'react-dnd/dist/core/DndProvider'; +import { HTML5Backend } from 'react-dnd-html5-backend'; +import { Route, Switch } from 'wouter-preact'; +import Faq from '~/routes/faq/Faq'; +import Home from '~/routes/home/Home'; +import DeviceProvider from './components/DeviceProvider'; +import ErrorBoundary from './components/ErrorBoundary'; +import ErrorFallback from './components/ErrorFallback'; +import Layout from './components/Layout'; +import Page404 from './components/Page404'; +import queryClient from './lib/queryClient'; +import { store } from './lib/store'; + +function App() { + return ( + + + + + + + + + + + + + + + + + + + + + + ); +} + +export default App; diff --git a/src/atoms/deviceSku.ts b/src/atoms/deviceSku.ts new file mode 100644 index 0000000..c1e0028 --- /dev/null +++ b/src/atoms/deviceSku.ts @@ -0,0 +1,4 @@ +import { atom } from 'jotai'; +import { SKU_EP133 } from '~/lib/constants'; + +export const deviceSkuAtom = atom(SKU_EP133); diff --git a/src/atoms/droppedProjectFile.ts b/src/atoms/droppedProjectFile.ts new file mode 100644 index 0000000..9fa8c93 --- /dev/null +++ b/src/atoms/droppedProjectFile.ts @@ -0,0 +1,13 @@ +import { atom } from 'jotai'; +import type JSZip from 'jszip'; + +export type DroppedProjectFile = { + name: string; + data: Uint8Array; +}; + +export const droppedProjectFileAtom = atom(null); +export const droppedBackupFileAtom = atom(null); +export const unzippedBackupAtom = atom(null); +export const backupSkuAtom = atom(null); +export const backupProjectIdsAtom = atom([]); diff --git a/src/atoms/feedbackDialog.ts b/src/atoms/feedbackDialog.ts new file mode 100644 index 0000000..9b8ca20 --- /dev/null +++ b/src/atoms/feedbackDialog.ts @@ -0,0 +1,3 @@ +import { atom } from 'jotai'; + +export const feedbackDialogAtom = atom(false); diff --git a/src/atoms/project.ts b/src/atoms/project.ts new file mode 100644 index 0000000..09b0ed0 --- /dev/null +++ b/src/atoms/project.ts @@ -0,0 +1,4 @@ +import { atom } from 'jotai'; + +export const projectIdAtom = atom(''); +export const customSceneNamesByProjectAtom = atom>({}); diff --git a/src/atoms/swUpdate.ts b/src/atoms/swUpdate.ts new file mode 100644 index 0000000..919b9b5 --- /dev/null +++ b/src/atoms/swUpdate.ts @@ -0,0 +1,3 @@ +import { atom } from 'jotai'; + +export const swUpdateAvailableAtom = atom(false); diff --git a/src/atoms/toast.ts b/src/atoms/toast.ts new file mode 100644 index 0000000..e4f474a --- /dev/null +++ b/src/atoms/toast.ts @@ -0,0 +1,19 @@ +import { atom } from 'jotai'; + +export type ToastSeverity = 'info' | 'error'; + +export interface ToastMessage { + id: string; + message: string; + severity: ToastSeverity; + timestamp: number; +} + +export const toastsAtom = atom([]); + +export const removeToastAtom = atom(null, (get, set, id: string) => { + set( + toastsAtom, + get(toastsAtom).filter((toast) => toast.id !== id), + ); +}); diff --git a/src/components/DeviceContext.tsx b/src/components/DeviceContext.tsx new file mode 100644 index 0000000..e7d314d --- /dev/null +++ b/src/components/DeviceContext.tsx @@ -0,0 +1,12 @@ +import { createContext } from 'preact'; +import { TEDevice } from '../lib/midi/types'; + +const DeviceContext = createContext<{ + device: TEDevice | null; + error: Error | null; +}>({ + device: null, + error: null, +}); + +export default DeviceContext; diff --git a/src/components/DeviceProvider.tsx b/src/components/DeviceProvider.tsx new file mode 100644 index 0000000..443199b --- /dev/null +++ b/src/components/DeviceProvider.tsx @@ -0,0 +1,40 @@ +import { useAtom } from 'jotai'; +import { useEffect, useState } from 'preact/hooks'; +import { deviceSkuAtom } from '~/atoms/deviceSku'; +import { SKU_EP133 } from '~/lib/constants'; +import { initDevice } from '../lib/midi'; +import { TEDevice } from '../lib/midi/types'; +import DeviceContext from './DeviceContext'; + +function DeviceProvider({ children }: { children: preact.ComponentChildren }) { + const [device, setDevice] = useState(null); + const [deviceError, setDeviceError] = useState(null); + const [, setDeviceSku] = useAtom(deviceSkuAtom); + + useEffect(() => { + initDevice({ + onDeviceFound: (deviceInfo) => { + console.log('Device found:', deviceInfo); + setDevice(deviceInfo); + setDeviceSku(deviceInfo.sku); + }, + onDeviceLost: () => { + console.log('Device lost'); + setDevice(null); + setDeviceSku(SKU_EP133); + }, + onNoMidiAccess: (error) => { + console.error('No MIDI access:', error); + setDeviceError(error); + }, + }); + }, []); + + return ( + + {children} + + ); +} + +export default DeviceProvider; diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx new file mode 100644 index 0000000..bc7c9fd --- /dev/null +++ b/src/components/ErrorBoundary.tsx @@ -0,0 +1,41 @@ +import * as Sentry from '@sentry/react'; +import { Component } from 'preact'; + +interface ErrorBoundaryProps { + children: any; + FallbackComponent: any; +} + +interface ErrorBoundaryState { + hasError: boolean; + error?: Error; +} + +class ErrorBoundary extends Component { + state: ErrorBoundaryState; + + constructor(props: ErrorBoundaryProps) { + super(props); + this.state = { hasError: false }; + } + + static getDerivedStateFromError(error: Error): ErrorBoundaryState { + return { hasError: true, error }; + } + + componentDidCatch(error: Error, errorInfo: any) { + console.error('ErrorBoundary caught an error:', error, errorInfo); + Sentry.captureReactException(error, errorInfo); + } + + render() { + if (this.state.hasError && this.state.error) { + const FallbackComponent = this.props.FallbackComponent; + return ; + } + + return this.props.children; + } +} + +export default ErrorBoundary; diff --git a/src/components/ErrorFallback.tsx b/src/components/ErrorFallback.tsx new file mode 100644 index 0000000..c8cf514 --- /dev/null +++ b/src/components/ErrorFallback.tsx @@ -0,0 +1,22 @@ +import Button from './ui/Button'; + +function ErrorFallback() { + return ( +
+
+

Something went wrong

+ +
+ An unexpected error occurred. Please try refreshing the page. If the problem persists, + please submit a bug report. There is a feedback button in the top right corner of the app. +
+ +
+ +
+
+
+ ); +} + +export default ErrorFallback; diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx new file mode 100644 index 0000000..9afbf6f --- /dev/null +++ b/src/components/Layout.tsx @@ -0,0 +1,12 @@ +import useTheme from '~/hooks/useTheme'; + +function Layout({ children }: { children: preact.ComponentChildren }) { + const theme = useTheme(); + return ( +
+ {children} +
+ ); +} + +export default Layout; diff --git a/src/components/OfflineInformer.tsx b/src/components/OfflineInformer.tsx new file mode 100644 index 0000000..c3b0a6c --- /dev/null +++ b/src/components/OfflineInformer.tsx @@ -0,0 +1,34 @@ +import clsx from 'clsx'; +import { useEffect, useState } from 'preact/hooks'; + +function OfflineInformer({ className }: { className?: string }) { + const [isOnline, setIsOnline] = useState(navigator.onLine); + + useEffect(() => { + const handleOnline = () => setIsOnline(true); + const handleOffline = () => setIsOnline(false); + + window.addEventListener('online', handleOnline); + window.addEventListener('offline', handleOffline); + + return () => { + window.removeEventListener('online', handleOnline); + window.removeEventListener('offline', handleOffline); + }; + }, []); + + if (isOnline) return null; + + return ( +
+ You’re currently offline, but the app is still working just fine! +
+ ); +} + +export default OfflineInformer; diff --git a/src/components/Page404.tsx b/src/components/Page404.tsx new file mode 100644 index 0000000..1de0c7a --- /dev/null +++ b/src/components/Page404.tsx @@ -0,0 +1,12 @@ +function Page404() { + return ( +
+
+

404: Not Found

+

The page you are looking for does not exist.

+
+
+ ); +} + +export default Page404; diff --git a/src/components/UpdateNotifier.tsx b/src/components/UpdateNotifier.tsx new file mode 100644 index 0000000..6348179 --- /dev/null +++ b/src/components/UpdateNotifier.tsx @@ -0,0 +1,47 @@ +import clsx from 'clsx'; +import { useAtomValue } from 'jotai'; +import { useEffect, useState } from 'preact/hooks'; +import { swUpdateAvailableAtom } from '~/atoms/swUpdate'; + +const RELOAD_DELAY_SECONDS = 3; + +function UpdateNotifier({ className }: { className?: string }) { + const updateAvailable = useAtomValue(swUpdateAvailableAtom); + const [countdown, setCountdown] = useState(RELOAD_DELAY_SECONDS); + + useEffect(() => { + if (!updateAvailable) { + return; + } + + const interval = setInterval(() => { + setCountdown((prev) => { + if (prev <= 1) { + clearInterval(interval); + window.location.reload(); + return 0; + } + return prev - 1; + }); + }, 1000); + + return () => clearInterval(interval); + }, [updateAvailable]); + + if (!updateAvailable) { + return null; + } + + return ( +
+ A new version is available. Reloading in {countdown} second{countdown !== 1 ? 's' : ''}... +
+ ); +} + +export default UpdateNotifier; diff --git a/src/components/form/CheckboxField.tsx b/src/components/form/CheckboxField.tsx new file mode 100644 index 0000000..80020ea --- /dev/null +++ b/src/components/form/CheckboxField.tsx @@ -0,0 +1,37 @@ +import { Controller, FieldPath, FieldValues, useFormContext } from 'react-hook-form'; +import CheckBox from '../ui/CheckBox'; + +function CheckboxField({ + name, + title, + disabled, + helperText, + className, +}: { + name: FieldPath; + title: string; + disabled?: boolean; + helperText?: string; + className?: string; +}) { + const { control } = useFormContext(); + + return ( + ( + field.onChange(checked)} + title={title} + disabled={disabled ?? false} + helperText={helperText} + className={className} + /> + )} + /> + ); +} + +export default CheckboxField; diff --git a/src/components/form/InputField.tsx b/src/components/form/InputField.tsx new file mode 100644 index 0000000..47f2638 --- /dev/null +++ b/src/components/form/InputField.tsx @@ -0,0 +1,42 @@ +import { Controller, FieldPath, FieldValues, useFormContext } from 'react-hook-form'; +import Input from '../ui/Input'; + +function InputField({ + name, + label, + disabled, + className, + placeholder, + transform, +}: { + name: FieldPath; + label?: string; + disabled?: boolean; + className?: string; + placeholder?: string; + transform?: (value: string) => string; +}) { + const { control } = useFormContext(); + + return ( + ( + { + const raw = (e.currentTarget as HTMLInputElement).value; + field.onChange(transform ? transform(raw) : raw); + }} + disabled={disabled} + className={className} + placeholder={placeholder} + /> + )} + /> + ); +} + +export default InputField; diff --git a/src/components/form/SelectField.tsx b/src/components/form/SelectField.tsx new file mode 100644 index 0000000..86928f8 --- /dev/null +++ b/src/components/form/SelectField.tsx @@ -0,0 +1,39 @@ +import { JSX } from 'preact'; +import { Controller, FieldPath, FieldValues, useFormContext } from 'react-hook-form'; +import Select from '../ui/Select'; + +function SelectField({ + name, + children, + disabled, + className, +}: { + name: FieldPath; + children: any; + disabled?: boolean; + className?: string; +}) { + const { control } = useFormContext(); + + return ( + ( + + )} + /> + ); +} + +export default SelectField; diff --git a/src/components/icons/arrow-dialog.svg b/src/components/icons/arrow-dialog.svg new file mode 100644 index 0000000..5002479 --- /dev/null +++ b/src/components/icons/arrow-dialog.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/components/icons/arrow-left.svg b/src/components/icons/arrow-left.svg new file mode 100644 index 0000000..d1174dd --- /dev/null +++ b/src/components/icons/arrow-left.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/components/icons/check.svg b/src/components/icons/check.svg new file mode 100644 index 0000000..3be3523 --- /dev/null +++ b/src/components/icons/check.svg @@ -0,0 +1 @@ + diff --git a/src/components/icons/close.svg b/src/components/icons/close.svg new file mode 100644 index 0000000..af50392 --- /dev/null +++ b/src/components/icons/close.svg @@ -0,0 +1 @@ + diff --git a/src/components/icons/edit.svg b/src/components/icons/edit.svg new file mode 100644 index 0000000..5af59b6 --- /dev/null +++ b/src/components/icons/edit.svg @@ -0,0 +1 @@ + diff --git a/src/components/icons/file.svg b/src/components/icons/file.svg new file mode 100644 index 0000000..c8ff095 --- /dev/null +++ b/src/components/icons/file.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/components/icons/github.svg b/src/components/icons/github.svg new file mode 100644 index 0000000..8333f09 --- /dev/null +++ b/src/components/icons/github.svg @@ -0,0 +1,8 @@ + + + diff --git a/src/components/icons/info.svg b/src/components/icons/info.svg new file mode 100644 index 0000000..f84ed13 --- /dev/null +++ b/src/components/icons/info.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/components/icons/mail.svg b/src/components/icons/mail.svg new file mode 100644 index 0000000..62ca6f0 --- /dev/null +++ b/src/components/icons/mail.svg @@ -0,0 +1,8 @@ + + + + + diff --git a/src/components/icons/music.svg b/src/components/icons/music.svg new file mode 100644 index 0000000..128efe6 --- /dev/null +++ b/src/components/icons/music.svg @@ -0,0 +1 @@ + diff --git a/src/components/icons/reload.svg b/src/components/icons/reload.svg new file mode 100644 index 0000000..31cbc8d --- /dev/null +++ b/src/components/icons/reload.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/components/icons/reset-settings.svg b/src/components/icons/reset-settings.svg new file mode 100644 index 0000000..2ff96c1 --- /dev/null +++ b/src/components/icons/reset-settings.svg @@ -0,0 +1,10 @@ + + + + + + + diff --git a/src/components/icons/trash.svg b/src/components/icons/trash.svg new file mode 100644 index 0000000..e89b1ba --- /dev/null +++ b/src/components/icons/trash.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/components/ui/Button.tsx b/src/components/ui/Button.tsx new file mode 100644 index 0000000..b0713a1 --- /dev/null +++ b/src/components/ui/Button.tsx @@ -0,0 +1,68 @@ +import clsx from 'clsx'; +import { JSX } from 'preact'; +import { twMerge } from 'tailwind-merge'; +import { Link } from 'wouter'; + +interface ButtonProps extends JSX.HTMLAttributes { + children: any; + size?: 'sm' | 'md' | 'xs'; + disabled?: boolean; + variant?: 'primary' | 'secondary' | 'outlined' | 'tertiary' | 'ghost' | 'icon'; + type?: 'button' | 'submit' | 'reset'; + to?: string; + target?: string; + rel?: string; +} + +function Button({ + children, + className = '', + variant = 'primary', + size = 'md', + type = 'button', + to, + target, + rel, + disabled, + ...props +}: ButtonProps) { + const variantClasses = { + primary: 'bg-face hover:bg-[#d0d2d0] active:bg-[#c5c7c5]', + secondary: 'bg-gray-100 hover:bg-gray-300 active:bg-gray-400', + tertiary: 'bg-[#c6d1d7] hover:bg-gray-100 active:bg-gray-200', + outlined: 'bg-transparent hover:bg-black/10 active:bg-black/20 border-1 border-black', + ghost: 'border-0 bg-transparent hover:bg-black/10 active:bg-black/20', + icon: 'flex-shrink-0 !py-1 !px-1 border-0 !h-auto', + } as const; + + const sizeClasses = { + xs: 'text-xs py-1 px-2 h-[24px]', + sm: 'text-sm py-1 px-2 h-[28px]', + md: 'text-sm py-2 px-4 h-[42px]', + } as const; + + const baseClasses = + 'text-black cursor-pointer border-1 border-black disabled:opacity-80 disabled:cursor-not-allowed disabled:text-gray-400 outline-none transition-colors duration-200'; + + const linkDisabledClasses = disabled ? 'pointer-events-none opacity-80 text-gray-400' : ''; + + const composed = twMerge( + clsx(baseClasses, variantClasses[variant], sizeClasses[size], linkDisabledClasses, className), + ); + + if (to) { + return ( + + {children} + + ); + } + + return ( + + ); +} + +export default Button; diff --git a/src/components/ui/CheckBox.tsx b/src/components/ui/CheckBox.tsx new file mode 100644 index 0000000..73bd3a6 --- /dev/null +++ b/src/components/ui/CheckBox.tsx @@ -0,0 +1,56 @@ +import clsx from 'clsx'; +import { JSX } from 'preact'; +import { useId } from 'preact/hooks'; +import IconInfo from '../icons/info.svg?react'; + +function CheckBox({ + checked, + onChange, + title, + helperText, + disabled, + className, +}: { + checked: boolean; + onChange: (checked: boolean) => void; + title: string; + helperText?: string; + disabled: boolean; + className?: string; +}) { + const _id = useId(); + + return ( + + ); +} + +export default CheckBox; diff --git a/src/components/ui/Dialog.tsx b/src/components/ui/Dialog.tsx new file mode 100644 index 0000000..cd38e0c --- /dev/null +++ b/src/components/ui/Dialog.tsx @@ -0,0 +1,51 @@ +import clsx from 'clsx'; +import { useEffect, useRef } from 'preact/hooks'; + +interface DialogProps { + isOpen: boolean; + onClose: () => void; + children: any; + className?: string; + containerClassName?: string; +} + +function Dialog({ + isOpen, + onClose, + children, + className = '', + containerClassName = '', +}: DialogProps) { + const dialogRef = useRef(null); + + useEffect(() => { + const dialog = dialogRef.current; + + if (!dialog) { + return; + } + + if (isOpen) { + dialog.showModal(); + } else { + dialog.close(); + } + }, [isOpen]); + + return ( + +
+ {children} +
+
+ ); +} + +export default Dialog; diff --git a/src/components/ui/FileInput.tsx b/src/components/ui/FileInput.tsx new file mode 100644 index 0000000..11893b1 --- /dev/null +++ b/src/components/ui/FileInput.tsx @@ -0,0 +1,84 @@ +import { useRef } from 'preact/hooks'; +import IconFile from '../icons/file.svg?react'; +import IconTrash from '../icons/trash.svg?react'; +import Button from './Button'; + +interface FileInputProps { + files: File[]; + onFilesChange: (files: File[]) => void; + maxFiles?: number; + disabled?: boolean; + label?: string; +} + +function FileInput({ + files, + onFilesChange, + maxFiles = 3, + disabled = false, + label = 'Attach files', +}: FileInputProps) { + const fileInputRef = useRef(null); + + const handleFileSelect = (e: Event) => { + const target = e.target as HTMLInputElement; + if (target.files) { + const newFiles = Array.from(target.files); + onFilesChange([...files, ...newFiles].slice(0, maxFiles)); + } + }; + + const removeFile = (index: number) => { + onFilesChange(files.filter((_, i) => i !== index)); + }; + + const openFileDialog = () => { + fileInputRef.current?.click(); + }; + + return ( +
+
+ {label} (optional, max {maxFiles}) +
+
+ {files.map((file, index) => ( +
+ + {file.name} + + {(file.size / 1024).toFixed(2)}KB + + +
+ ))} + {files.length < maxFiles && ( + + )} +
+ +
+ ); +} + +export default FileInput; diff --git a/src/components/ui/Input.tsx b/src/components/ui/Input.tsx new file mode 100644 index 0000000..03bce4a --- /dev/null +++ b/src/components/ui/Input.tsx @@ -0,0 +1,66 @@ +import clsx from 'clsx'; +import { JSX } from 'preact'; +import { forwardRef } from 'preact/compat'; +import { twMerge } from 'tailwind-merge'; + +interface BaseInputProps { + label?: string; + type?: 'text' | 'email' | 'textarea' | 'file'; + error?: string; + className?: string; + value?: string; + disabled?: boolean; + onChange?: (e: Event) => void; + required?: boolean; + multiple?: boolean; + accept?: string; + placeholder?: string; + rows?: number; +} + +type InputProps = BaseInputProps & + (JSX.HTMLAttributes | JSX.HTMLAttributes); + +const Input = forwardRef( + ({ label, type = 'text', className = '', disabled = false, ...props }, ref) => { + const id = props.id || label?.toLowerCase().replace(/\s+/g, '-'); + const inputClasses = twMerge( + clsx( + 'w-full px-3 py-2 border-1 border-black focus:outline-none focus:ring-0 bg-gray-50 placeholder:text-gray-400', + disabled && 'opacity-50', + className, + ), + ); + + return ( +
+ {label && ( + + )} + {type === 'textarea' ? ( +