Skip to content

Commit fbc538e

Browse files
authored
docs: expand project documentation (#63)
Co-authored-by: Sia <me@siamand.cc>
1 parent 1ddca54 commit fbc538e

6 files changed

Lines changed: 144 additions & 17 deletions

File tree

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ OpenWebSheet is an open-source, web-based spreadsheet application. It runs in th
1010

1111
1. Open the hosted app: <https://code-by-sia.github.io/OpenWebSheet/>
1212
2. Install the PWA using the install icon in the browser address bar.
13-
3. Download the sample file: <https://code-by-sia.github.io/OpenWebSheet/demo/DEMO.ows>
13+
3. Download the sample file: <https://code-by-sia.github.io/OpenWebSheet/DEMO.ows>
1414
4. Use the folder/load icon in the app to open the sample `.ows` file.
1515

1616
## Features
1717

18+
- React application shell with shadcn-style controls
1819
- Canvas-based spreadsheet rendering
1920
- Basic cell content editing
2021
- Borders
@@ -76,15 +77,17 @@ Additional documentation is available in the [`docs/`](docs/) directory:
7677

7778
- [Development guide](docs/development.md)
7879
- [Architecture overview](docs/architecture.md)
80+
- [UI structure](docs/ui-structure.md)
7981
- [User guide](docs/user-guide.md)
8082
- [Supported formats](docs/supported-formats.md)
83+
- [Troubleshooting](docs/troubleshooting.md)
8184

8285
## Contributing
8386

8487
1. Create an issue or choose an existing one.
8588
2. Create a focused branch for the change.
8689
3. Keep changes small and reviewable.
87-
4. Run linting and tests before opening a pull request.
90+
4. Run tests, type checking, and the production build before opening a pull request.
8891
5. Update documentation when behavior, setup, or architecture changes.
8992

9093
## License

docs/architecture.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,32 @@
22

33
## High-Level Components
44

5-
- UI Layer (React-based)
6-
- Spreadsheet core logic
7-
- Canvas renderer
8-
- Formula evaluation
9-
- Import/export subsystem
10-
- PWA integration
5+
- React UI layer under `src/app`, `src/features`, and `src/shared`.
6+
- Spreadsheet core logic under `src/lib/core`.
7+
- Canvas rendering under `src/lib/rendering`.
8+
- UI-to-core adapter logic under `src/lib/UI.ts` and `src/features/sheet`.
9+
- Formula evaluation under `src/lib/core/formula`.
10+
- Native `.ows` document import/export helpers under `src/features/document-io`.
11+
- PWA integration through `src/registerServiceWorker.ts` and generated static assets.
1112

1213
## Design Principles
1314

1415
- Keep spreadsheet logic independent from UI frameworks.
1516
- Minimize coupling between rendering and business logic.
1617
- Allow future UI migrations without rewriting the spreadsheet engine.
18+
- Keep React components small and composed by feature area.
19+
- Keep reusable UI primitives in `src/shared/ui`.
20+
- Keep Tailwind class composition in `src/app/styles.css`.
21+
22+
## Runtime Flow
23+
24+
1. `src/main.ts` mounts the React app.
25+
2. `src/app/App.tsx` owns top-level UI state for file mode, selection, formula bar value, and active appearance.
26+
3. `SpreadsheetSurface` creates the existing `UI` adapter with a DOM element.
27+
4. `UI` creates the canvas renderer and a `UIHandlerController`.
28+
5. Ribbon and formula bar actions call `UI.execCmd`, which forwards commands to the spreadsheet core.
29+
6. The core document emits changes back through `UI.addOnChangeEventListener`, and React updates the ribbon/formula state.
1730

1831
## Future Direction
1932

20-
A future React migration should focus on the UI layer only while preserving the existing spreadsheet core.
33+
Advanced formula support, OpenDocument import/export, and richer spreadsheet interactions should extend the core APIs first, then expose those capabilities through the React features.

docs/development.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,66 @@
11
# Development Guide
22

3+
## Prerequisites
4+
5+
- Node.js 18 or newer
6+
- npm
7+
38
## Setup
49

510
```bash
611
npm install
712
npm run dev
813
```
914

15+
The development app is served from the Vite base path:
16+
17+
```text
18+
http://127.0.0.1:5173/OpenWebSheet/
19+
```
20+
1021
## Build
1122

1223
```bash
1324
npm run build
1425
```
1526

27+
The production build writes static assets to `docs/` so GitHub Pages can serve the app.
28+
1629
## Testing
1730

1831
```bash
1932
npm test
2033
```
2134

35+
Use watch mode while working on UI behavior:
36+
37+
```bash
38+
npm run test:watch
39+
```
40+
2241
## Type Checking
2342

2443
```bash
2544
npm run typecheck
2645
```
2746

47+
## Useful Scripts
48+
49+
- `npm run dev`: start the local Vite server.
50+
- `npm run build`: create the production build in `docs/`.
51+
- `npm run preview`: preview the production build locally.
52+
- `npm test`: run Vitest once.
53+
- `npm run typecheck`: run TypeScript without emitting files.
54+
2855
## Contribution Workflow
2956

3057
1. Create an issue.
3158
2. Create a branch.
3259
3. Implement changes.
3360
4. Run tests and type checking.
34-
5. Open a pull request.
61+
5. Run the production build when changing UI, assets, or configuration.
62+
6. Open a pull request with a summary and verification notes.
63+
64+
## Build Warning
65+
66+
The production build currently reports a direct `eval` warning from `src/lib/core/formula/Evaluator.ts`. The warning is known, and the build still succeeds. Changes to the formula engine should address that warning deliberately instead of hiding it in unrelated work.

docs/supported-formats.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
# Supported Formats
22

3-
## Current
3+
## Current Format
44

5-
- .ows (OpenWebSheet native format)
5+
### `.ows`
6+
7+
OpenWebSheet's native format stores workbook data as JSON. It is the only supported import/export format today.
8+
9+
Supported data includes:
10+
11+
- Sheets and cells
12+
- Cell values
13+
- Basic formulas
14+
- Merged cells
15+
- Cell appearance used by the current renderer
616

717
## Planned
818

9-
- OpenDocument Spreadsheet (.ods)
19+
- OpenDocument Spreadsheet (`.ods`)
1020

1121
## Notes
1222

13-
Compatibility and import/export behavior should be documented as support expands.
23+
- `.ows` is intended for OpenWebSheet interoperability, not compatibility with other spreadsheet applications.
24+
- `.ods` support is tracked separately and should include fixtures and interoperability tests when implemented.
25+
- Unsupported features should fail gracefully and be documented as format support expands.

docs/troubleshooting.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Troubleshooting
2+
3+
## The Dev Server Opens A Blank Page
4+
5+
Open the app at the Vite base path:
6+
7+
```text
8+
http://127.0.0.1:5173/OpenWebSheet/
9+
```
10+
11+
Opening `http://127.0.0.1:5173/` directly may not load the app because the project is configured for GitHub Pages under `/OpenWebSheet/`.
12+
13+
## Dependencies Fail To Install
14+
15+
Use a current Node.js 18+ runtime, then reinstall dependencies:
16+
17+
```bash
18+
rm -rf node_modules package-lock.json
19+
npm install
20+
```
21+
22+
Only remove `package-lock.json` when intentionally refreshing dependency resolution.
23+
24+
## Production Build Shows An Eval Warning
25+
26+
`npm run build` currently warns about direct `eval` in `src/lib/core/formula/Evaluator.ts`. This is known formula-engine behavior and does not fail the build.
27+
28+
## Tests Cannot Find DOM APIs
29+
30+
Vitest is configured with `jsdom` in `vite.config.ts`. If DOM APIs are missing, confirm tests are running through `npm test` and not through a bare TypeScript or Node command.
31+
32+
## GitHub Pages Assets Look Stale
33+
34+
Run a production build before publishing:
35+
36+
```bash
37+
npm run build
38+
```
39+
40+
The generated files in `docs/` are part of the static GitHub Pages deployment.

docs/user-guide.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,44 @@
11
# User Guide
22

3+
## Opening The App
4+
5+
Open the hosted app at <https://code-by-sia.github.io/OpenWebSheet/> or run it locally with `npm run dev`.
6+
37
## Opening Files
48

5-
Open the application and load an OWS spreadsheet file.
9+
Use the folder button in the Home ribbon to load an `.ows` file. A sample file is available at <https://code-by-sia.github.io/OpenWebSheet/DEMO.ows>.
10+
11+
## Saving Files
12+
13+
Use the save button in the Home ribbon to download the current workbook as an `.ows` file.
14+
15+
## Local Storage Mode
16+
17+
The Home ribbon includes a local storage mode. In local mode, document changes are saved in the browser's local storage. Return to file mode before using download/upload workflows.
618

719
## Editing
820

9-
Select cells and modify their content.
21+
Select a cell on the sheet and edit its value through the formula bar. The formula bar shows the selected cell name and the current value.
1022

1123
## Formatting
1224

13-
Borders, merge and split operations are supported.
25+
The Home ribbon supports:
26+
27+
- Font family and size
28+
- Bold, italic, and underline
29+
- Text and fill color
30+
- Horizontal alignment
31+
- Merge and split cells
32+
- Border color and border presets
1433

1534
## Formulas
1635

1736
Basic formula support is available. Advanced formula capabilities are tracked as a separate roadmap item.
37+
38+
## View Layout
39+
40+
The View ribbon includes layout controls for normal/page-oriented views and display toggles. These controls establish the UI surface for layout features; deeper renderer behavior will expand over time.
41+
42+
## PWA Installation
43+
44+
Modern browsers can install OpenWebSheet as a Progressive Web App. Use the install control in the address bar or browser menu while visiting the hosted app.

0 commit comments

Comments
 (0)