diff options
| author | Josh Kingsley <josh@joshkingsley.me> | 2025-10-29 01:54:37 +0200 |
|---|---|---|
| committer | Josh Kingsley <josh@joshkingsley.me> | 2025-10-29 01:54:37 +0200 |
| commit | 986e65f9ab7122995ae1d647df23d817cecf6816 (patch) | |
| tree | 39d4f77c6a6565b59522a5a77e2f550334472713 /web/src/defaultDoc.ts | |
| parent | 95069f13d908bfd3c0f3b33f8fad7d8464fd192e (diff) | |
refactor(web): improve state management
Diffstat (limited to 'web/src/defaultDoc.ts')
| -rw-r--r-- | web/src/defaultDoc.ts | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/web/src/defaultDoc.ts b/web/src/defaultDoc.ts new file mode 100644 index 0000000..7409c1a --- /dev/null +++ b/web/src/defaultDoc.ts @@ -0,0 +1,42 @@ +import Ratio from "./math/Ratio"; +import { Cell, Doc } from "./types"; + +export default function defaultDoc(): Doc { + const defaultCells: Cell[] = Array.from({ length: 16 }, () => ({ + widthRatio: new Ratio(1, 16), + })); + + return { + grids: [ + { + id: window.crypto.randomUUID(), + baseCellSize: 42, + baseCellWidthRatio: new Ratio(1, 16), + parts: [ + { + rows: Array.from({ length: 4 }, () => ({ + cells: [...defaultCells], + })), + }, + ], + }, + { + id: window.crypto.randomUUID(), + baseCellSize: 42, + baseCellWidthRatio: new Ratio(1, 16), + parts: [ + { + rows: Array.from({ length: 2 }, () => ({ + cells: [...defaultCells], + })), + }, + { + rows: Array.from({ length: 2 }, () => ({ + cells: [...defaultCells], + })), + }, + ], + }, + ], + }; +} |
