From 95eb1d265f4abb404278373ba8cd0a296a4fb246 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Sat, 2 May 2026 00:23:11 +0200 Subject: [PATCH] docs: update README and memory notes --- .memory/note.md | 3 +++ .memory/project.md | 6 ++++++ .memory/state.md | 7 +++++++ .memory/todo.md | 4 ++++ README.md | 12 +++++++++--- 5 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 .memory/note.md create mode 100644 .memory/project.md create mode 100644 .memory/state.md create mode 100644 .memory/todo.md diff --git a/.memory/note.md b/.memory/note.md new file mode 100644 index 0000000..2795844 --- /dev/null +++ b/.memory/note.md @@ -0,0 +1,3 @@ +- README is more detailed than memory files; keep memory compact. +- Use `state.md` for evolving engine/demo/API details. +- `project.md` should stay as a short pointer file. \ No newline at end of file diff --git a/.memory/project.md b/.memory/project.md new file mode 100644 index 0000000..0632608 --- /dev/null +++ b/.memory/project.md @@ -0,0 +1,6 @@ +# Project memory + +- RPN calculator JS project. +- Read `.memory/state.md` for current state. +- Keep names and commands in English. +- Update memory files based on events: engine, demo, API, commands, exports, docs, or tasks. diff --git a/.memory/state.md b/.memory/state.md new file mode 100644 index 0000000..e95da20 --- /dev/null +++ b/.memory/state.md @@ -0,0 +1,7 @@ +# State +- Core engine: `src/rpn-calculator.js` +- Active demo: `samples/dev/` (HP48-style UI) +- Public API: `push`, `pop`, `clear`, `swap`, `remove`, `edit`, `isValidIndex`, `input`, `command`, `getOperationsByCategory`, `getConstants` +- Config: `maxSize`, `base`, `angleMode`, `enabledCommands` +- Commands: arithmetic, stack, trigonometry, constants `pi` and `e` +- Exports: browser `window.RpnCalculator`, CommonJS `module.exports` diff --git a/.memory/todo.md b/.memory/todo.md new file mode 100644 index 0000000..def5dff --- /dev/null +++ b/.memory/todo.md @@ -0,0 +1,4 @@ +- Keep `.memory/project.md` short. +- Update `.memory/state.md` after project changes. +- Reconcile README and demo docs if behavior changes. +- Track future work around keyboard UX, stack selection, and command docs. \ No newline at end of file diff --git a/README.md b/README.md index 253b3c9..703033d 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,10 @@ The main class is `RpnCalculator`. - `samples/calc-01/index.html`: active browser demo entry point - `samples/calc-01/index.css`: demo styles - `samples/calc-01/index.js`: demo UI and keyboard logic -- `samples/calc-XX/index.html`: active browser demo entry point -- `samples/calc-XX/index.css`: demo styles -- `samples/calc-XX/index.js`: demo UI and keyboard logic +- `samples/calc-01/index.html`: alternate browser demo entry point +- `samples/calc-01/index.css`: alternate demo styles +- `samples/calc-01/index.js`: alternate demo UI and keyboard logic +- `samples/calc-XX/`: placeholder name for future demo variants ## Public API @@ -129,6 +130,9 @@ calc.command('e'); - `mod` is a percentage operator: - `a b % => (a * b) / 100` +- `pow` accepts aliases `^` and `y^x` +- `sqrt` accepts alias `sqrt(x)` +- `recip` accepts alias `1/x` - `div` and `recip` throw `Division by zero` when needed - `sqrt` throws `Invalid input for sqrt` for negative values - `asin` and `acos` throw explicit domain errors outside `[-1, 1]` @@ -138,6 +142,7 @@ calc.command('e'); - `ln` uses `Math.log` - direct trigonometric functions convert input using `toRadians(...)` - inverse trigonometric functions convert results back using the current angle mode +- `angleMode` supports `deg`, `rad`, and `grad` - formatted numeric values are rounded to 12 decimal places - `-0` is normalized to `0` - `inputValue` remains a string to preserve future non-decimal input support @@ -261,6 +266,7 @@ The current demo supports: - `x`, `y`, `z`, `t` The demo also implements stack selection and stack-item move mode in its UI layer using the public calculator methods. +It keeps the calculator screen focused and updates the visible stack window as the selection moves. ## Exports