summarum/README.md
Horizontal42 f55266f70b v1.1.0: bug fixes, atomic writes, safe quit, .sum files, CI
Engine: fix BigInt crash on NaN, KM/KG case-insensitive units, space-grouped
and comma-decimal number parsing, variable-vs-unit shadowing, small value
display (1 mm in km), DST-safe date arithmetic, month-end clamp, log mustTouch,
avg counted, 50% of 50%, 100 USD + 20 after conversion, percent power.

Rust: atomic writes (temp+rename) for documents.json, safe quit (app-quit event
+ 2s watchdog so tray-quit doesn't lose edits), .sum file association + open,
migration safety (canonicalize + all_copied guard), opener API for backups and
extensions folders.

UI: decimal separator setting, hotkey rollback on failure, corrupted JSON guard,
ru welcome sheet, orange cursor visibility.

CI: windows-latest workflow (tsc + vitest + cargo clippy).
2026-06-11 12:57:39 +03:00

138 lines
5 KiB
Markdown

# Summarum
**A calculator that works like a notepad.** Type what you're thinking — every line
gets a live answer in the right column. No buttons, no formula syntax, just text.
```
# Trip to Lisbon
flights $420
hotel $95 * 4 nights
food 30€ a day * 4 days and museums 25€
total → $1,066.97
5 inches in cm → 12.7 cm
100 km/h in mph → 62.14 mph
$2000 in rubles → 144,060 ₽
20% off 1500 → 1,200
today + 6 weeks → 22 July 2026
time in Tokyo → 14:25
```
Works in **English and Russian** at the same time: `5 метров в см`, `20$ в евро`,
`сумма` — no language switching.
## Install
Grab the latest `Summarum_*_x64-setup.exe` from [Releases](../../releases),
run it, done. The whole app is about 2 MB.
Requirements:
- **Windows 10 (1803+) or Windows 11**, 64-bit.
- **[WebView2 Runtime](https://developer.microsoft.com/en-us/microsoft-edge/webview2/)** —
already part of Windows 11 and most updated Windows 10 systems; if it's
missing, the installer downloads it automatically.
- Internet connection is only needed for live currency rates — everything
else works offline (rates fall back to a cached/bundled snapshot).
## What it understands
**Plain math** — `2 + 2`, `8 / (45 - 20%)`, parentheses, `^`, `sqrt`, `sin`,
factorials. Decimal-exact: `0.1 + 0.2` is `0.3`, not `0.30000000000000004`.
**Words as operators** — `12 plus 4`, `20 divided by 4`, `5 и 3`. Text around
the math is ignored, so `spent 20 on pizza and 5 on coffee` just gives 25.
**Units** — length, weight, volume, area, temperature, time, angles, data
(`1 GiB in MB`), CSS px/em, speed, pressure, energy, power, frequency, fuel:
```
6 feet in meters 1 atm in mmHg 8 л/100км in mpg
2 hours 30 min in min 150 hp in kW 32 px in em
```
**Money** — ~150 currencies and the top-20 crypto with live rates
(refreshed hourly, cached for offline). `$100 + 20%`, `5 eth in USD`,
`9800 рублей в долларах`.
**Percents the human way** — `20% of 80`, `20% off 1500`, `5 as a % of 25`,
`20% of what is 30`.
**Dates and time** — `today + 2 weeks`, `tomorrow - today`, `time in New York`,
`now in unix`, `1750000000 as date`.
**Programmer stuff** — `0xFF & 0x0F`, `1 << 4`, `255 in hex`, `in binary`,
plus `in fraction` (0.75 → 3/4) and `in roman` (2026 → MMXXVI).
**Sheets that calculate** — variables (`rent = $500`), running totals
(`sum`, `avg`, `prev`), `#` headers, `//` comments. The status bar always shows
the sheet total; select a few lines to see just their sum.
## Handy things
- **Ctrl+Alt+N** (configurable — the settings field records keys you press)
shows/hides the window from anywhere. Closing hides to tray.
- **Click a result** to copy it. Copying a line copies it *with* the answer
(`rent * 3 = $1,500`). **Ctrl+Shift+C** copies the whole sheet with answers.
- **Drag the divider** to resize the results column.
- **Drop a `.numi`, `.sum`, `.txt` or `.md` file** into the window to open it
as a sheet.
- **Backups are automatic**: a daily snapshot of all sheets (last 14 kept), and
deleted sheets sit in a bin for 14 days (configurable) — restore one by
dragging the file back in. Settings → Backups opens the folder.
- **Data folder is configurable** — point it at OneDrive/Dropbox and your
sheets follow you between machines.
- Light/dark theme, en/ru interface, configurable precision and separators.
## Extensions
Drop a `.js` file into the extensions folder (Settings → Extensions folder)
and restart. The API is compatible with Numi extensions:
```js
numi.setVariable("vat", { double: 20 });
numi.addUnit({ id: "floor", phrases: "floor,floors", baseUnitId: "meter",
format: "fl", ratio: 3 });
numi.addFunction({ id: "hyp", phrases: "hyp" },
(v) => ({ double: Math.hypot(v[0].double, v[1].double) }));
```
Then `5 floors in meters` → `15 m` and `hyp(3; 4)` → `5`.
## Bugs and ideas
Open an [issue](../../issues). A line of text and what you expected is enough.
## For developers
Engine internals, project layout and how to add units/currencies:
see [ARCHITECTURE.md](ARCHITECTURE.md).
```bash
npm install
npm test # engine tests
npm run tauri dev # run the app
npm run tauri build # build the installer
```
To build from source you need:
- [Node.js](https://nodejs.org/) 22.6 or newer (`npm run icons` relies on
Node's built-in TypeScript support)
- [Rust](https://rustup.rs/) (stable, MSVC toolchain)
- [Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/)
with the "Desktop development with C++" workload (the MSVC linker)
- See the [Tauri prerequisites](https://tauri.app/start/prerequisites/) page
if anything refuses to compile
Stack: [Tauri 2](https://tauri.app) + TypeScript + CodeMirror 6.
## Credits
Inspired by the excellent [Numi](https://numi.app) by Dmitry Nikolaev —
if you're on macOS, buy it. Summarum is an independent project, built from
scratch for Windows.
## License
[MIT](LICENSE)