mbook-ui
| Package | mbook-ui, the application called mbook; not published to crates.io |
| Installers | GitHub Releases: macOS on arm64 and x86-64, Windows on x86-64, Android on arm64 |
| Source | crates/mbook-ui; the Android shell in crates/mbook-android |
| Builds on | mbook; mbook-converter |
| Minimum Rust | 1.100 |
| Status | A first version; see Status and verification |
mbook-ui is a reading application built on mbook and mbook-converter.
It has three screens:
| Screen | What it does | Built on |
|---|---|---|
| Library | Shows the books the application keeps, as covers | The catalogue; BookReader::open and read_cover |
| Reader | Shows a reflowable chapter with scrolling or pagination | BookReader, read lazily |
| Editor | Changes the metadata, chapters, landmarks and pictures of a book | Book, in memory |
Opening a file that is not yet in the library adds it: an mbook file is
copied, a file in any format that
mbook-converter reads is
converted first. Everything that
reads a file runs on the background executor of GPUI; what decodes, parses,
converts or encodes runs on a pool of rayon with half the threads of the
system, which the executor awaits. The main thread only draws and reacts.
The interface is built with GPUI Kit: on the GPUI Fast engine on the desktop, and on gpui-pre with the platform of gpui-mobile on Android. Window width selects the compact, medium or expanded layout. The application has shells for the desktop and for Android (Android); there is no iOS shell.
A first version exists. What is implemented says what it does, where it differs from these pages, and what has not been tried outside of tests.
cargo run -p mbook-ui
The AVIF decoder needs NASM at build time on x86 and x86-64.
| Page | What it answers |
|---|---|
| Using the application | What do the library, the reader, the editor and the settings do? |
| Architecture | Where does each piece of work run, what is stored where, and how do import, reading, editing and updates work? |
| Appearance and accessibility | Which colours, type and motion does the interface use, and what does it promise to assistive technology? |
| Android | How is the APK built and released, and where does the Android application differ from the desktop? |
| Status and verification | What exists today, where does it fall short, and how was it checked? |
| Design | Which decisions are confirmed, which crates are used, what does the design cost, and why does it look this way? |
The three screens
flowchart LR
file["A file:<br/>mbook, EPUB, FB2,<br/>PDF, CBZ, DOCX, …"] -- "open, drop" --> imp["Import"]
imp -- "copy or convert" --> lib["Library"]
lib -- "open" --> reader["Reader<br/>BookReader, lazy"]
lib -- "edit" --> editor["Editor<br/>Book, in memory"]
reader -- "edit this book" --> editor
editor -- "save" --> lib
The model is Apple Books for the Mac: a quiet library where the covers carry the colour, and a reader whose controls step aside. What is taken from it and what is left out is listed under Prior art.
What it is for
The repository has a format, a library and a converter, and no way to look at
a book. A reader is also the first real consumer of BookReader: the claims
of RFC 0001 (a book opens without being read in full;
only what is on screen is decoded) are only shown to hold by an application
that depends on them.
| Task | Screen |
|---|---|
| Keep books in one place and find one | Library |
| Open an EPUB, FB2 or PDF without thinking about formats | Library, through import |
| Read, and come back to the same place | Reader |
| Correct a title, a cover or a typo after a conversion | Editor |
Goals
| Goal | How the design meets it |
|---|---|
| The interface never waits for a book | No call that touches a file or parses runs on the main thread (Threads). |
| One code base for desktop and mobile | Layout depends on a size class of the window; platform code stays in a thin shell (Layout). |
| The library survives its index | The mbook files hold the metadata; the catalogue can be rebuilt from them (The catalogue). |
| A failed import or save loses nothing | A file enters the library, and replaces a book, only by a rename (Import, Editing). |
| Little own code | Components, the Markdown view, the text editor, dialogs and lists come from GPUI Kit; paths, updates and the store from established crates. |
| What is read is what was edited | The editor's preview and the reader are the same view with the same style. |
| Usable without sight, without a pointer and without fine motor control | Every screen meets WCAG 2.2 at level AA where it applies to an application (Accessibility). |
Non-goals
- A store, an account or synchronisation. The library is a folder on one device.
- Two-page spreads. See Future possibilities.
- Annotations: highlights, notes and bookmarks.
- A streaming editor.
mbookhas none; a book is edited as a wholeBook. - An iOS shell. The design keeps it possible; the application ships for the desktop and for Android.