summaryrefslogtreecommitdiff
path: root/web/src/defaultDoc.ts
blob: 7409c1a5e66a8082ccdd221567c96c81db4cc4ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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],
            })),
          },
        ],
      },
    ],
  };
}