@altnovatrail/canvas 0.3.39 → 0.3.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/lib/core/boxes.d.ts +7 -7
  2. package/lib/core/boxes.js +10 -10
  3. package/lib/core/clock.d.ts +5 -5
  4. package/lib/core/clock.js +5 -5
  5. package/lib/core/crop.d.ts +13 -13
  6. package/lib/core/crop.js +10 -10
  7. package/lib/core/eraser.d.ts +6 -6
  8. package/lib/core/eraser.js +6 -6
  9. package/lib/core/example.d.ts +6 -6
  10. package/lib/core/example.js +9 -9
  11. package/lib/core/fields.d.ts +1 -1
  12. package/lib/core/fields.js +1 -1
  13. package/lib/core/geometry.d.ts +6 -5
  14. package/lib/core/geometry.js +8 -6
  15. package/lib/core/grid.d.ts +3 -3
  16. package/lib/core/grid.js +3 -3
  17. package/lib/core/groups.d.ts +14 -14
  18. package/lib/core/groups.js +6 -6
  19. package/lib/core/hands.d.ts +19 -18
  20. package/lib/core/hands.js +16 -15
  21. package/lib/core/history.d.ts +9 -9
  22. package/lib/core/history.js +6 -6
  23. package/lib/core/index.js +8 -9
  24. package/lib/core/ink.js +3 -3
  25. package/lib/core/manifest.d.ts +3 -3
  26. package/lib/core/manifest.js +6 -6
  27. package/lib/core/marks.d.ts +39 -39
  28. package/lib/core/marks.js +34 -34
  29. package/lib/core/notation.d.ts +5 -5
  30. package/lib/core/outline.d.ts +3 -3
  31. package/lib/core/outline.js +6 -6
  32. package/lib/core/page.d.ts +7 -7
  33. package/lib/core/page.js +10 -10
  34. package/lib/core/png.d.ts +3 -3
  35. package/lib/core/png.js +3 -3
  36. package/lib/core/raster.d.ts +3 -3
  37. package/lib/core/raster.js +3 -3
  38. package/lib/core/recorder.d.ts +7 -7
  39. package/lib/core/recorder.js +7 -7
  40. package/lib/core/screen.d.ts +2 -2
  41. package/lib/core/screen.js +1 -1
  42. package/lib/core/sets.d.ts +1 -1
  43. package/lib/core/sets.js +1 -1
  44. package/lib/core/sheet.d.ts +3 -3
  45. package/lib/core/sheet.js +3 -3
  46. package/lib/core/submission.d.ts +24 -24
  47. package/lib/core/submission.js +21 -21
  48. package/lib/core/task.d.ts +17 -16
  49. package/lib/core/task.js +14 -13
  50. package/lib/core/tracing.d.ts +20 -20
  51. package/lib/core/tracing.js +20 -20
  52. package/lib/core/widths.d.ts +2 -2
  53. package/lib/core/widths.js +5 -5
  54. package/lib/core/work.d.ts +18 -18
  55. package/lib/core/work.js +21 -21
  56. package/lib/core/zoom.d.ts +4 -4
  57. package/lib/core/zoom.js +4 -4
  58. package/lib/element/index.d.ts +87 -87
  59. package/lib/element/index.js +284 -281
  60. package/lib/element/labels.d.ts +17 -17
  61. package/lib/element/labels.js +7 -8
  62. package/lib/element/notation.js +1 -1
  63. package/lib/element/parts.d.ts +2 -2
  64. package/lib/element/parts.js +6 -6
  65. package/lib/element/pictures.js +1 -1
  66. package/lib/element/probe.d.ts +2 -2
  67. package/lib/element/probe.js +3 -3
  68. package/lib/element/session.js +2 -2
  69. package/lib/element/statement.d.ts +2 -2
  70. package/lib/element/statement.js +6 -6
  71. package/lib/element/tools.d.ts +17 -18
  72. package/lib/element/tools.js +30 -29
  73. package/lib/element/tracing.js +8 -8
  74. package/package.json +3 -3
package/lib/core/sheet.js CHANGED
@@ -8,11 +8,11 @@ export const SHEET = Object.freeze({ width: 1000, height: 1400 });
8
8
  /**
9
9
  * How far the sheet goes from its origin, in units: ten pages across and ten down. The learner
10
10
  * writes past the page, to the right of it and below it, and a point beyond this is no point of a
11
- * history: the bound keeps the rules' whole numbers small and a history's numbers sane (R06).
11
+ * history: the bound keeps the rules' whole numbers small and a history's numbers sane.
12
12
  */
13
13
  export const REACH = Object.freeze({ width: 10000, height: 14000 });
14
14
  /**
15
- * The sheet as large as it is laid out (R06): the page, and past it and past the furthest ink a
15
+ * The sheet as large as it is laid out: the page, and past it and past the furthest ink a
16
16
  * `room` more — the part of the sheet in sight, so that there is always somewhere to move it to and
17
17
  * write —, within `REACH`. `ink` is the right and the bottom of the furthest strokes, none for an
18
18
  * empty sheet.
@@ -31,7 +31,7 @@ export function extentOf(ink, room) {
31
31
  */
32
32
  export const PICTURE_BYTES = (SHEET.width + 1) * SHEET.height;
33
33
  /**
34
- * The picture of a work (R83): the page, and the ink past it, right and down, with no room past the
34
+ * The picture of a work: the page, and the ink past it, right and down, with no room past the
35
35
  * ink, at a pixel a unit while its rows hold no more than `PICTURE_BYTES`, and scaled down to hold
36
36
  * them otherwise. `scale` is pixels a unit.
37
37
  */
@@ -3,27 +3,27 @@ import { type Box } from "./geometry.js";
3
3
  import type { Stroke } from "./ink.js";
4
4
  import { type Paper, type PaperSubmission, type SheetSubmission, type WorkbookSubmission } from "./marks.js";
5
5
  import { type Gray, type TracingState } from "./tracing.js";
6
- /** The work of a sheet for checking (R27): the PNG of its crop, and the context of the submission. */
6
+ /** The work of a sheet for checking: the PNG of its crop, and the context of the submission. */
7
7
  export interface WorkForCheck {
8
8
  readonly png: Uint8Array<ArrayBuffer>;
9
9
  readonly submission: SheetSubmission;
10
10
  }
11
11
  /**
12
- * The work of a task from paper for checking (R87): the PNG of the crop of its work, and the
12
+ * The work of a task from paper for checking: the PNG of the crop of its work, and the
13
13
  * context of the submission.
14
14
  */
15
15
  export interface PaperForCheck {
16
16
  readonly png: Uint8Array<ArrayBuffer>;
17
17
  readonly submission: PaperSubmission;
18
18
  }
19
- /** The crop of one filled box of a workbook (R38): its item and its slot, from 1, and its PNG. */
19
+ /** The crop of one filled box of a workbook: its item and its slot, from 1, and its PNG (R38). */
20
20
  export interface CellForCheck {
21
21
  readonly item: number;
22
22
  readonly slot: number;
23
23
  readonly png: Uint8Array<ArrayBuffer>;
24
24
  }
25
25
  /**
26
- * The work of a workbook for checking (R34, R38): the crop of each filled box, in the task's order,
26
+ * The work of a workbook for checking: the crop of each filled box, in the task's order,
27
27
  * and the context of the submission.
28
28
  */
29
29
  export interface CellsForCheck {
@@ -31,33 +31,33 @@ export interface CellsForCheck {
31
31
  readonly submission: WorkbookSubmission;
32
32
  }
33
33
  /**
34
- * The work of a sheet for checking, as `exportWork()` gives it (R07, R27): of the strokes the sheet
35
- * shows, their groups by the sheet's rule (R24), their crop with its digits `digit` px high and its
36
- * PNG (R25), and the context of the submission — the crop's numbers that place the tutor's marks,
37
- * the groups, the table «label → stroke IDs», and their digest (R26, R27) — frozen through. A sheet
34
+ * The work of a sheet for checking, as `exportWork()` gives it: of the strokes the sheet
35
+ * shows, their groups by the sheet's rule, their crop with its digits `digit` px high and its
36
+ * PNG, and the context of the submission — the crop's numbers that place the tutor's marks,
37
+ * the groups, the table «label → stroke IDs», and their digest — frozen through. A sheet
38
38
  * without strokes has no work to check, and gives null (H3).
39
39
  */
40
40
  export declare function workForCheck(strokes: readonly Stroke[], digit: number): WorkForCheck | null;
41
41
  /**
42
- * The work of a workbook for checking, as `exportWork()` gives it (R34, R38): of the strokes the
43
- * page shows, the table of the boxes they fill by the rule of boxes (R37), and the crop of each
44
- * filled box by R25 — the box's strokes alone, one group of them, its digits `digit` px high —
45
- * with its item and its slot, in the task's order, and the context of the submission: the table and
46
- * its digest. The draft goes nowhere. A page with no box filled has no work to check, and gives
47
- * null, though it holds draft. The crops are frozen, not their bytes, which no freezing holds; the
48
- * context is frozen through. One crop of every box's strokes, which spec may choose, is
49
- * `croppedOf` of the table's strokes with the table's rows for groups (R38).
42
+ * The work of a workbook for checking, as `exportWork()` gives it: of the strokes the
43
+ * page shows, the table of the boxes they fill by the rule of boxes, and the crop of each
44
+ * filled box by the crop's rule — the box's strokes alone, one group of them, its digits `digit` px
45
+ * high — with its item and its slot, in the task's order, and the context of the submission: the
46
+ * table and its digest. The draft goes nowhere. A page with no box filled has no work to check, and
47
+ * gives null, though it holds draft. The crops are frozen, not their bytes, which no freezing
48
+ * holds; the context is frozen through. One crop of every box's strokes, which spec may choose, is
49
+ * `croppedOf` of the table's strokes with the table's rows for groups.
50
50
  */
51
51
  export declare function cellsForCheck(strokes: readonly Stroke[], cells: readonly Cell[], digit: number): CellsForCheck | null;
52
52
  /**
53
- * The work of a task from paper for checking, as `exportWork()` gives it with the task's crop
54
- * (R87): of the strokes the sheet and the tracing paper hold, where they lie on the sheet, their
55
- * groups by the sheet's rule (R24), and their crop by R25 with its digits `digit` px high, taking
56
- * in the tracing paper's rectangle `rect`, in units, at the same scale — the crop's picture,
53
+ * The work of a task from paper for checking, as `exportWork()` gives it with the task's crop:
54
+ * of the strokes the sheet and the tracing paper hold, where they lie on the sheet, their
55
+ * groups by the sheet's rule, and their crop by the crop's rule with its digits `digit` px high,
56
+ * taking in the tracing paper's rectangle `rect`, in units, at the same scale — the crop's picture,
57
57
  * `picture`, laid over it there as the screen lays it — and the context: the crop's numbers, the
58
- * groups, where the tracing paper lay, `tracing`, and the digest of it all, which holds the
59
- * strokes written on the tracing paper, `paper`. Hidden or shown, the tracing paper is in the
60
- * crop. No stroke on either is no work to check: null (H3). The picture not read yet, or not at
61
- * all, `null`, leaves the paper white.
58
+ * groups, where the tracing paper lay, `tracing`, and the digest of it all, which holds the strokes
59
+ * written on the tracing paper, `paper`. Hidden or shown, the tracing paper is in the crop. No
60
+ * stroke on either is no work to check: null (H3). The picture not read yet, or not at all, `null`,
61
+ * leaves the paper white.
62
62
  */
63
63
  export declare function paperWorkForCheck(strokes: readonly Stroke[], paper: Paper, tracing: TracingState, rect: Box, picture: Gray | null, digit: number): PaperForCheck | null;
@@ -7,10 +7,10 @@ import { encodePNG } from "./png.js";
7
7
  import { pictureOf, rasterOf } from "./raster.js";
8
8
  import { layOver, tenthsOf } from "./tracing.js";
9
9
  /**
10
- * The work of a sheet for checking, as `exportWork()` gives it (R07, R27): of the strokes the sheet
11
- * shows, their groups by the sheet's rule (R24), their crop with its digits `digit` px high and its
12
- * PNG (R25), and the context of the submission — the crop's numbers that place the tutor's marks,
13
- * the groups, the table «label → stroke IDs», and their digest (R26, R27) — frozen through. A sheet
10
+ * The work of a sheet for checking, as `exportWork()` gives it: of the strokes the sheet
11
+ * shows, their groups by the sheet's rule, their crop with its digits `digit` px high and its
12
+ * PNG, and the context of the submission — the crop's numbers that place the tutor's marks,
13
+ * the groups, the table «label → stroke IDs», and their digest — frozen through. A sheet
14
14
  * without strokes has no work to check, and gives null (H3).
15
15
  */
16
16
  export function workForCheck(strokes, digit) {
@@ -24,14 +24,14 @@ export function workForCheck(strokes, digit) {
24
24
  return Object.freeze({ png: cropped.png, submission: frozen(submission) });
25
25
  }
26
26
  /**
27
- * The work of a workbook for checking, as `exportWork()` gives it (R34, R38): of the strokes the
28
- * page shows, the table of the boxes they fill by the rule of boxes (R37), and the crop of each
29
- * filled box by R25 — the box's strokes alone, one group of them, its digits `digit` px high —
30
- * with its item and its slot, in the task's order, and the context of the submission: the table and
31
- * its digest. The draft goes nowhere. A page with no box filled has no work to check, and gives
32
- * null, though it holds draft. The crops are frozen, not their bytes, which no freezing holds; the
33
- * context is frozen through. One crop of every box's strokes, which spec may choose, is
34
- * `croppedOf` of the table's strokes with the table's rows for groups (R38).
27
+ * The work of a workbook for checking, as `exportWork()` gives it: of the strokes the
28
+ * page shows, the table of the boxes they fill by the rule of boxes, and the crop of each
29
+ * filled box by the crop's rule — the box's strokes alone, one group of them, its digits `digit` px
30
+ * high — with its item and its slot, in the task's order, and the context of the submission: the
31
+ * table and its digest. The draft goes nowhere. A page with no box filled has no work to check, and
32
+ * gives null, though it holds draft. The crops are frozen, not their bytes, which no freezing
33
+ * holds; the context is frozen through. One crop of every box's strokes, which spec may choose, is
34
+ * `croppedOf` of the table's strokes with the table's rows for groups.
35
35
  */
36
36
  export function cellsForCheck(strokes, cells, digit) {
37
37
  const boxes = tableOf(strokes, cells);
@@ -51,15 +51,15 @@ export function cellsForCheck(strokes, cells, digit) {
51
51
  return Object.freeze({ cells: Object.freeze(crops), submission: frozen(submission) });
52
52
  }
53
53
  /**
54
- * The work of a task from paper for checking, as `exportWork()` gives it with the task's crop
55
- * (R87): of the strokes the sheet and the tracing paper hold, where they lie on the sheet, their
56
- * groups by the sheet's rule (R24), and their crop by R25 with its digits `digit` px high, taking
57
- * in the tracing paper's rectangle `rect`, in units, at the same scale — the crop's picture,
54
+ * The work of a task from paper for checking, as `exportWork()` gives it with the task's crop:
55
+ * of the strokes the sheet and the tracing paper hold, where they lie on the sheet, their
56
+ * groups by the sheet's rule, and their crop by the crop's rule with its digits `digit` px high,
57
+ * taking in the tracing paper's rectangle `rect`, in units, at the same scale — the crop's picture,
58
58
  * `picture`, laid over it there as the screen lays it — and the context: the crop's numbers, the
59
- * groups, where the tracing paper lay, `tracing`, and the digest of it all, which holds the
60
- * strokes written on the tracing paper, `paper`. Hidden or shown, the tracing paper is in the
61
- * crop. No stroke on either is no work to check: null (H3). The picture not read yet, or not at
62
- * all, `null`, leaves the paper white.
59
+ * groups, where the tracing paper lay, `tracing`, and the digest of it all, which holds the strokes
60
+ * written on the tracing paper, `paper`. Hidden or shown, the tracing paper is in the crop. No
61
+ * stroke on either is no work to check: null (H3). The picture not read yet, or not at all, `null`,
62
+ * leaves the paper white.
63
63
  */
64
64
  export function paperWorkForCheck(strokes, paper, tracing, rect, picture, digit) {
65
65
  const groups = groupsOf(strokes);
@@ -99,7 +99,7 @@ function pixelsOf(rect, crop) {
99
99
  bottom: down(rect.maxY),
100
100
  };
101
101
  }
102
- /** The crop of strokes in their groups, its digits `digit` px high, and its PNG (R25). */
102
+ /** The crop of strokes in their groups, its digits `digit` px high, and its PNG. */
103
103
  function croppedOf(strokes, groups, digit) {
104
104
  const crop = cropOf(strokes, groups, digit);
105
105
  return crop === null ? null : { crop, png: pictureOf(strokes, crop) };
@@ -6,9 +6,9 @@ import { type Page } from "./page.js";
6
6
  export declare const SHEET_KIND = "handwriting_sheet";
7
7
  export declare const WORKBOOK_KIND = "workbook";
8
8
  /**
9
- * What a press of the primary button does on the sheet: the pen writes, the eraser erases (R22),
10
- * the hand moves the sheet (R84). A pen's eraser erases whatever the tool, if the task allows the
11
- * eraser (R28). spec's type (R74 spec).
9
+ * What a press of the primary button does on the sheet: the pen writes, the eraser erases,
10
+ * the hand moves the sheet. A pen's eraser erases whatever the tool, if the task allows the
11
+ * eraser. spec's type.
12
12
  */
13
13
  export type { Tool };
14
14
  /**
@@ -16,7 +16,7 @@ export type { Tool };
16
16
  * eraser. The hand is no tool of the format: every sheet the learner writes on has it.
17
17
  */
18
18
  export declare const TOOLS: readonly Tool[];
19
- /** The tool that moves the sheet and writes nothing (R84). */
19
+ /** The tool that moves the sheet and writes nothing. */
20
20
  export declare const HAND: Tool;
21
21
  export declare function isTool(value: unknown): value is Tool;
22
22
  /** A paragraph of a task's statement, or a piece of text of a workbook's line. */
@@ -79,7 +79,7 @@ export interface SheetCanvas {
79
79
  /** The grid's step in sheet units, a whole number from 20 to 500: 50 unless given. */
80
80
  readonly grid_step?: number;
81
81
  /**
82
- * The tools the task allows (R28), the element's own field until the format has one: the canvas
82
+ * The tools the task allows, the element's own field until the format has one: the canvas
83
83
  * takes "pen" and "eraser", and passes over the names it does not know — a ruler, a calculator —
84
84
  * which are app's to show or come with new versions of the canvas. The pen and the eraser unless
85
85
  * given; a list without the pen is a TypeError, for the canvas writes with it.
@@ -92,15 +92,15 @@ export interface WorkbookCanvas {
92
92
  readonly tools?: readonly string[];
93
93
  }
94
94
  /**
95
- * The canvas of a task as a consumer gives it: spec's, and the tools the task allows (R28), the
95
+ * The canvas of a task as a consumer gives it: spec's, and the tools the task allows, the
96
96
  * element's own field until the format has one.
97
97
  */
98
98
  export interface Canvas extends open.Canvas {
99
99
  readonly tools?: readonly string[];
100
100
  }
101
101
  /**
102
- * The open view of a task as a consumer gives it, what the learner's app receives: spec's type
103
- * (R73 spec), its canvas with the element's own tools. A type gives the shape and nothing more: the
102
+ * The open view of a task as a consumer gives it, what the learner's app receives: spec's type,
103
+ * its canvas with the element's own tools. A type gives the shape and nothing more: the
104
104
  * element checks the value itself.
105
105
  */
106
106
  export interface Task extends open.Task {
@@ -114,7 +114,7 @@ interface CheckedFields {
114
114
  readonly statement: readonly StatementPart[];
115
115
  /**
116
116
  * What the statement gives, short texts all different, and what the task asks to find: the chips
117
- * the learner ticks at a solving step, which app shows, not the element (R57 spec).
117
+ * the learner ticks at a solving step, which app shows, not the element.
118
118
  */
119
119
  readonly givens?: readonly string[];
120
120
  readonly unknown?: string;
@@ -132,8 +132,8 @@ export interface WorkbookTask extends CheckedFields {
132
132
  /**
133
133
  * A task as the element checked it, of either canvas kind: its ID, its statement, what the
134
134
  * statement gives and asks, its canvas and its items — no key, solution or trap, nor its skills,
135
- * band, difficulty and age categories, nor the task template it may be an instance of (R05 spec;
136
- * R51 spec; R60 spec). It is a Task too, which task.check.ts holds to.
135
+ * band, difficulty and age categories, nor the task template it may be an instance of. It is a Task
136
+ * too, which task.check.ts holds to.
137
137
  */
138
138
  export type CheckedTask = SheetTask | WorkbookTask;
139
139
  /**
@@ -146,7 +146,7 @@ export interface SheetTemplate {
146
146
  readonly tools: readonly Tool[];
147
147
  }
148
148
  /**
149
- * What the workbook makes of a task: the layout of its lines on the page (R35), the statement above
149
+ * What the workbook makes of a task: the layout of its lines on the page, the statement above
150
150
  * it and the tools it allows.
151
151
  */
152
152
  export interface WorkbookTemplate {
@@ -169,14 +169,15 @@ export declare function taskOf(value: unknown): CheckedTask;
169
169
  export declare function isSheet(task: CheckedTask): task is SheetTask;
170
170
  /**
171
171
  * Whether a task's one answer slot is anywhere on the sheet or the whole sheet, which the strokes
172
- * on the sheet fill (R42): not a sheet of choices, whose options app marks, nor a workbook.
172
+ * on the sheet fill: not a sheet of choices, whose options app marks, nor a workbook.
173
173
  */
174
174
  export declare function wholeSheet(task: CheckedTask | undefined): boolean;
175
175
  /**
176
176
  * The template of a task `taskOf` gave, or of no task for `undefined`. A workbook's lines are laid
177
- * out on its page, and a task whose lines do not fit is a TypeError at the first item that does not
178
- * (R34, R35). A zone on the sheet is a TypeError until an epic of its own; a choice the sheet passes
179
- * over, and an item's text too: app shows them (R32).
177
+ * out on its page, and a task whose lines do not fit is a TypeError at the first item that does
178
+ * not.
179
+ * A zone on the sheet is a TypeError until an epic of its own; a choice the sheet passes
180
+ * over, and an item's text too: app shows them.
180
181
  */
181
182
  export declare function templateOf(task: CheckedTask | undefined): Template;
182
183
  /** Whether a template is a workbook's. */
package/lib/core/task.js CHANGED
@@ -1,8 +1,8 @@
1
- // The open view of a task of the module format 0.4 (R51 spec). What a consumer gives is of spec's
2
- // type, from its npm package at the version of the spec/ submodule (R73 spec; R41), with one field
3
- // of the element's own, `canvas.tools`, until the format has one (R28). The element checks a task as
1
+ // The open view of a task of the module format 0.4. What a consumer gives is of spec's
2
+ // type, from its npm package at the version of the spec/ submodule, with one field
3
+ // of the element's own, `canvas.tools`, until the format has one. The element checks a task as
4
4
  // the schema does, every object closed: a field the open view has not — an old name, a closed field
5
- // — is a TypeError (R32). What the check gives is the element's own shape of the same task, its
5
+ // — is a TypeError. What the check gives is the element's own shape of the same task, its
6
6
  // canvas kinds apart, which the rest of the element reads.
7
7
  import { closed, listOf, sameItems, shown, text, whole } from "./fields.js";
8
8
  import { DEFAULT_GRID, GRID_KINDS, GRID_STEP, GRID_STEP_MAX, GRID_STEP_MIN, } from "./grid.js";
@@ -15,7 +15,7 @@ export const WORKBOOK_KIND = "workbook";
15
15
  * eraser. The hand is no tool of the format: every sheet the learner writes on has it.
16
16
  */
17
17
  export const TOOLS = Object.freeze(["pen", "eraser"]);
18
- /** The tool that moves the sheet and writes nothing (R84). */
18
+ /** The tool that moves the sheet and writes nothing. */
19
19
  export const HAND = "hand";
20
20
  export function isTool(value) {
21
21
  return value === HAND || TOOLS.includes(value);
@@ -26,7 +26,7 @@ export const NO_TASK = Object.freeze({
26
26
  statement: Object.freeze([]),
27
27
  tools: TOOLS,
28
28
  });
29
- /** The fields of a task's open view (R57 spec): the rest of a task is closed. */
29
+ /** The fields of a task's open view: the rest of a task is closed. */
30
30
  const OPEN = ["id", "statement", "givens", "unknown", "canvas", "items"];
31
31
  /**
32
32
  * A task's open view, checked as the format's schema checks it, and a copy of it with the fields
@@ -48,7 +48,7 @@ export function taskOf(value) {
48
48
  }
49
49
  /**
50
50
  * What the statement gives and what the task asks to find, as the task has them: the element checks
51
- * them and shows neither, for the chips are app's to show (R57 spec).
51
+ * them and shows neither, for the chips are app's to show.
52
52
  */
53
53
  function askedOf({ givens, unknown, }) {
54
54
  return {
@@ -66,7 +66,7 @@ export function isSheet(task) {
66
66
  }
67
67
  /**
68
68
  * Whether a task's one answer slot is anywhere on the sheet or the whole sheet, which the strokes
69
- * on the sheet fill (R42): not a sheet of choices, whose options app marks, nor a workbook.
69
+ * on the sheet fill: not a sheet of choices, whose options app marks, nor a workbook.
70
70
  */
71
71
  export function wholeSheet(task) {
72
72
  return (task !== undefined &&
@@ -79,9 +79,10 @@ function isWhole({ binding }) {
79
79
  }
80
80
  /**
81
81
  * The template of a task `taskOf` gave, or of no task for `undefined`. A workbook's lines are laid
82
- * out on its page, and a task whose lines do not fit is a TypeError at the first item that does not
83
- * (R34, R35). A zone on the sheet is a TypeError until an epic of its own; a choice the sheet passes
84
- * over, and an item's text too: app shows them (R32).
82
+ * out on its page, and a task whose lines do not fit is a TypeError at the first item that does
83
+ * not.
84
+ * A zone on the sheet is a TypeError until an epic of its own; a choice the sheet passes
85
+ * over, and an item's text too: app shows them.
85
86
  */
86
87
  export function templateOf(task) {
87
88
  if (task === undefined)
@@ -106,7 +107,7 @@ export function templateOf(task) {
106
107
  export function isWorkbook(template) {
107
108
  return "page" in template;
108
109
  }
109
- /** The tools a task allows, of those the canvas has, in the order of TOOLS (R28). */
110
+ /** The tools a task allows, of those the canvas has, in the order of TOOLS. */
110
111
  function allowedOf({ tools }) {
111
112
  return tools === undefined ? TOOLS : TOOLS.filter((tool) => tools.includes(tool));
112
113
  }
@@ -235,7 +236,7 @@ export function gridOf(canvas, path) {
235
236
  return grid;
236
237
  }
237
238
  /**
238
- * The names of the tools a task allows (R28): strings, the pen among them. A name the canvas does
239
+ * The names of the tools a task allows: strings, the pen among them. A name the canvas does
239
240
  * not know it passes over when it makes its template.
240
241
  */
241
242
  function toolsOf(value, path) {
@@ -4,12 +4,12 @@ import type { Grid } from "./grid.js";
4
4
  import type { Stroke } from "./ink.js";
5
5
  import type { Point } from "./screen.js";
6
6
  /**
7
- * Where the tracing paper of a task from paper lies on the sheet, and whether it is hidden (R87):
8
- * spec's type, of the contract of canvas and app (R74 spec).
7
+ * Where the tracing paper of a task from paper lies on the sheet, and whether it is hidden:
8
+ * spec's type, of the contract of canvas and app (R87).
9
9
  */
10
10
  export type { TracingState };
11
11
  /**
12
- * The tracing paper's rule (R87), in sheet units: the crop is drawn as large as fits within
12
+ * The tracing paper's rule, in sheet units: the crop is drawn as large as fits within
13
13
  * `width` × `height`, in its own proportions; it starts at `at`, right of the bar of buttons, which
14
14
  * stands over the sheet's left edge; the keyboard moves it by `step`, or by `leap` with Shift. The
15
15
  * dots of its sheet stand `dots` apart.
@@ -23,9 +23,9 @@ export declare const TRACING: Readonly<{
23
23
  dots: 25;
24
24
  }>;
25
25
  /**
26
- * The tracing paper's scale (R89): from `min` to `max` times its own size, as the mockup's
26
+ * The tracing paper's scale: from `min` to `max` times its own size, as the mockup's
27
27
  * `Zadacha-masshtab` has it; a button's press multiplies it by `button`, a notch of the wheel by
28
- * `wheel`, and a scale is kept in hundredths, as the percentage shows it.
28
+ * `wheel`, and a scale is kept in hundredths, as the percentage shows it (R89).
29
29
  */
30
30
  export declare const SCALE: Readonly<{
31
31
  min: 0.4;
@@ -33,22 +33,22 @@ export declare const SCALE: Readonly<{
33
33
  button: 1.2;
34
34
  wheel: 1.08;
35
35
  }>;
36
- /** A scale kept to the rule's bounds, in hundredths (R89). */
36
+ /** A scale kept to the rule's bounds, in hundredths. */
37
37
  export declare function scaleOf(scale: number): number;
38
- /** The scale of a tracing state: 1 where it has none (R89). */
38
+ /** The scale of a tracing state: 1 where it has none. */
39
39
  export declare function scaleIn(state: TracingState): number;
40
40
  /** A size as large as `scale` makes it. */
41
41
  export declare function scaled(size: Size, scale: number): Size;
42
42
  /**
43
43
  * The grids of a task from paper's sheet in the order its button turns them, round, the first as
44
- * the task comes (R88).
44
+ * the task comes.
45
45
  */
46
46
  export declare const PAPER_GRIDS: readonly PaperGrid[];
47
47
  /** Whether a value is a grid of a task from paper's sheet. */
48
48
  export declare function isPaperGrid(value: unknown): value is PaperGrid;
49
- /** The rulings of a task from paper's grid, or none for a blank sheet (R88). */
49
+ /** The rulings of a task from paper's grid, or none for a blank sheet. */
50
50
  export declare function rulingsOf(grid: PaperGrid): Grid | undefined;
51
- /** The grid the button turns a task from paper's grid to: the next, round (R88). */
51
+ /** The grid the button turns a task from paper's grid to: the next, round. */
52
52
  export declare function nextGrid(grid: PaperGrid): PaperGrid;
53
53
  /** The tracing paper's size on the sheet, in units. */
54
54
  export interface Size {
@@ -58,14 +58,14 @@ export interface Size {
58
58
  /** The size before the crop's picture is read: the largest the tracing paper may be. */
59
59
  export declare const LARGEST: Size;
60
60
  /**
61
- * The tracing paper's size for a crop `width` × `height` px (R87): as large as fits within the
61
+ * The tracing paper's size for a crop `width` × `height` px: as large as fits within the
62
62
  * rule's box, in the crop's proportions. A picture of no size has the largest.
63
63
  */
64
64
  export declare function sizeOf(width: number, height: number): Size;
65
65
  /** Where a task from paper starts its tracing paper: at the rule's place, shown. */
66
66
  export declare const TRACING_START: TracingState;
67
67
  /**
68
- * A tracing state a consumer gives (R74 spec), checked and frozen: an object of `at`, [x, y] in
68
+ * A tracing state a consumer gives, checked and frozen: an object of `at`, [x, y] in
69
69
  * units, finite numbers, `hidden`, true or false, and `scale`, if any, from 0.4 to 4; other fields
70
70
  * are passed over. A state that puts the tracing paper of `size` at its scale wholly off the sheet
71
71
  * is a TypeError, as is anything else that is not such a state.
@@ -81,7 +81,7 @@ export declare function tracingFieldsOf(value: unknown, path: string): TracingSt
81
81
  /** Whether the tracing paper of `size` at `at` lies wholly off the sheet, touching it at most. */
82
82
  export declare function whollyOff(at: readonly [number, number], size: Size): boolean;
83
83
  /**
84
- * A reading of the statement a consumer gives (R89), checked and frozen: `state` "ready" or
84
+ * A reading of the statement a consumer gives, checked and frozen: `state` "ready" or
85
85
  * "busy", or "done" with `statements`, from none to 20 strings; other fields are passed over.
86
86
  * Anything else is a TypeError.
87
87
  */
@@ -92,20 +92,20 @@ export declare function sameTracing(a: TracingState, b: TracingState): boolean;
92
92
  export declare function rectOf(at: readonly [number, number], size: Size): Box;
93
93
  /**
94
94
  * The place nearest `at` where the tracing paper of `size` lies wholly on the sheet: where the
95
- * learner's grip and keys leave it (R87).
95
+ * learner's grip and keys leave it.
96
96
  */
97
97
  export declare function keptOn(at: readonly [number, number], size: Size): readonly [number, number];
98
98
  /** Whether a point of the sheet lies on the tracing paper, its edges too. */
99
99
  export declare function onTracing(point: Point, at: readonly [number, number], size: Size): boolean;
100
100
  /**
101
101
  * A point of the sheet as a stroke on the tracing paper of `size` at `scale` holds it: from the
102
- * paper's top left corner, in its own units, kept to the paper (R74 spec; R89).
102
+ * paper's top left corner, in its own units, kept to the paper.
103
103
  */
104
104
  export declare function toTracing(point: Point, at: readonly [number, number], size: Size, scale?: number): Point;
105
105
  /**
106
106
  * A stroke of the tracing paper where it lies on the sheet: its points scaled by `scale` and moved
107
- * by `at`, and kept to the sheet, should the paper lie in part beyond it — the rules of the groups and the crop hold on
108
- * the sheet alone (R24, R25). The same ID, kind and times.
107
+ * by `at`, and kept to the sheet, should the paper lie in part beyond it — the rules of the groups
108
+ * and the crop hold on the sheet alone. The same ID, kind and times.
109
109
  */
110
110
  export declare function onSheet(stroke: Stroke, at: readonly [number, number], scale?: number): Stroke;
111
111
  /**
@@ -115,7 +115,7 @@ export declare function onSheet(stroke: Stroke, at: readonly [number, number], s
115
115
  */
116
116
  export declare function boxOnSheet(box: Box, at: readonly [number, number], scale?: number): Box;
117
117
  /**
118
- * The tracing paper's rectangle on the sheet in whole tenths of a unit, as the crop counts (R25),
118
+ * The tracing paper's rectangle on the sheet in whole tenths of a unit, as the crop counts,
119
119
  * kept to the sheet: the part of it a crop of the work takes in.
120
120
  */
121
121
  export declare function tenthsOf(rect: Box): Box;
@@ -127,11 +127,11 @@ export interface Gray {
127
127
  }
128
128
  /**
129
129
  * The grey of a picture's pixels, four bytes each — red, green, blue and alpha — as a canvas reads
130
- * them: the luma of BT.601 in whole numbers, over white where a pixel is transparent (R87).
130
+ * them: the luma of BT.601 in whole numbers, over white where a pixel is transparent.
131
131
  */
132
132
  export declare function grayOf(rgba: Uint8ClampedArray | Uint8Array, width: number, height: number): Gray;
133
133
  /**
134
- * The crop's picture laid into the pixels of a crop of the work (R87), multiplied, as the screen
134
+ * The crop's picture laid into the pixels of a crop of the work, multiplied, as the screen
135
135
  * lays the tracing paper over the sheet: `ink` the crop's pixels, `width` px wide, and `rect`
136
136
  * where the tracing paper lies on them, in px, which may reach beyond them. Each pixel of the crop
137
137
  * under the paper takes the mean of the picture's pixels whose centres fall within it, or the one
@@ -2,7 +2,7 @@ import { record, shown } from "./fields.js";
2
2
  import { tenths } from "./geometry.js";
3
3
  import { REACH } from "./sheet.js";
4
4
  /**
5
- * The tracing paper's rule (R87), in sheet units: the crop is drawn as large as fits within
5
+ * The tracing paper's rule, in sheet units: the crop is drawn as large as fits within
6
6
  * `width` × `height`, in its own proportions; it starts at `at`, right of the bar of buttons, which
7
7
  * stands over the sheet's left edge; the keyboard moves it by `step`, or by `leap` with Shift. The
8
8
  * dots of its sheet stand `dots` apart.
@@ -16,16 +16,16 @@ export const TRACING = Object.freeze({
16
16
  dots: 25,
17
17
  });
18
18
  /**
19
- * The tracing paper's scale (R89): from `min` to `max` times its own size, as the mockup's
19
+ * The tracing paper's scale: from `min` to `max` times its own size, as the mockup's
20
20
  * `Zadacha-masshtab` has it; a button's press multiplies it by `button`, a notch of the wheel by
21
- * `wheel`, and a scale is kept in hundredths, as the percentage shows it.
21
+ * `wheel`, and a scale is kept in hundredths, as the percentage shows it (R89).
22
22
  */
23
23
  export const SCALE = Object.freeze({ min: 0.4, max: 4, button: 1.2, wheel: 1.08 });
24
- /** A scale kept to the rule's bounds, in hundredths (R89). */
24
+ /** A scale kept to the rule's bounds, in hundredths. */
25
25
  export function scaleOf(scale) {
26
26
  return Math.round(clamp(scale, SCALE.min, SCALE.max) * 100) / 100;
27
27
  }
28
- /** The scale of a tracing state: 1 where it has none (R89). */
28
+ /** The scale of a tracing state: 1 where it has none. */
29
29
  export function scaleIn(state) {
30
30
  return state.scale ?? 1;
31
31
  }
@@ -35,7 +35,7 @@ export function scaled(size, scale) {
35
35
  }
36
36
  /**
37
37
  * The grids of a task from paper's sheet in the order its button turns them, round, the first as
38
- * the task comes (R88).
38
+ * the task comes.
39
39
  */
40
40
  export const PAPER_GRIDS = Object.freeze([
41
41
  "dots",
@@ -43,7 +43,7 @@ export const PAPER_GRIDS = Object.freeze([
43
43
  "blank",
44
44
  "squares",
45
45
  ]);
46
- /** Each grid's rulings, in sheet units, as the mockup draws them: a blank sheet has none (R88). */
46
+ /** Each grid's rulings, in sheet units, as the mockup draws them: a blank sheet has none. */
47
47
  const RULINGS = Object.freeze({
48
48
  dots: Object.freeze({ kind: "dots", step: TRACING.dots }),
49
49
  lines: Object.freeze({ kind: "lines", step: 40 }),
@@ -54,18 +54,18 @@ const RULINGS = Object.freeze({
54
54
  export function isPaperGrid(value) {
55
55
  return typeof value === "string" && PAPER_GRIDS.includes(value);
56
56
  }
57
- /** The rulings of a task from paper's grid, or none for a blank sheet (R88). */
57
+ /** The rulings of a task from paper's grid, or none for a blank sheet. */
58
58
  export function rulingsOf(grid) {
59
59
  return RULINGS[grid];
60
60
  }
61
- /** The grid the button turns a task from paper's grid to: the next, round (R88). */
61
+ /** The grid the button turns a task from paper's grid to: the next, round. */
62
62
  export function nextGrid(grid) {
63
63
  return PAPER_GRIDS[(PAPER_GRIDS.indexOf(grid) + 1) % PAPER_GRIDS.length];
64
64
  }
65
65
  /** The size before the crop's picture is read: the largest the tracing paper may be. */
66
66
  export const LARGEST = Object.freeze({ width: TRACING.width, height: TRACING.height });
67
67
  /**
68
- * The tracing paper's size for a crop `width` × `height` px (R87): as large as fits within the
68
+ * The tracing paper's size for a crop `width` × `height` px: as large as fits within the
69
69
  * rule's box, in the crop's proportions. A picture of no size has the largest.
70
70
  */
71
71
  export function sizeOf(width, height) {
@@ -81,7 +81,7 @@ export const TRACING_START = Object.freeze({
81
81
  scale: 1,
82
82
  });
83
83
  /**
84
- * A tracing state a consumer gives (R74 spec), checked and frozen: an object of `at`, [x, y] in
84
+ * A tracing state a consumer gives, checked and frozen: an object of `at`, [x, y] in
85
85
  * units, finite numbers, `hidden`, true or false, and `scale`, if any, from 0.4 to 4; other fields
86
86
  * are passed over. A state that puts the tracing paper of `size` at its scale wholly off the sheet
87
87
  * is a TypeError, as is anything else that is not such a state.
@@ -125,10 +125,10 @@ export function whollyOff(at, size) {
125
125
  const [x, y] = at;
126
126
  return x >= REACH.width || y >= REACH.height || x + size.width <= 0 || y + size.height <= 0;
127
127
  }
128
- /** The most statements a reading holds, as the attempt's tasks are (R162 spec). */
128
+ /** The most statements a reading holds, as the attempt's tasks are. */
129
129
  const STATEMENTS = 20;
130
130
  /**
131
- * A reading of the statement a consumer gives (R89), checked and frozen: `state` "ready" or
131
+ * A reading of the statement a consumer gives, checked and frozen: `state` "ready" or
132
132
  * "busy", or "done" with `statements`, from none to 20 strings; other fields are passed over.
133
133
  * Anything else is a TypeError.
134
134
  */
@@ -158,7 +158,7 @@ export function rectOf(at, size) {
158
158
  }
159
159
  /**
160
160
  * The place nearest `at` where the tracing paper of `size` lies wholly on the sheet: where the
161
- * learner's grip and keys leave it (R87).
161
+ * learner's grip and keys leave it.
162
162
  */
163
163
  export function keptOn(at, size) {
164
164
  return Object.freeze([
@@ -173,7 +173,7 @@ export function onTracing(point, at, size) {
173
173
  }
174
174
  /**
175
175
  * A point of the sheet as a stroke on the tracing paper of `size` at `scale` holds it: from the
176
- * paper's top left corner, in its own units, kept to the paper (R74 spec; R89).
176
+ * paper's top left corner, in its own units, kept to the paper.
177
177
  */
178
178
  export function toTracing(point, at, size, scale = 1) {
179
179
  return {
@@ -183,8 +183,8 @@ export function toTracing(point, at, size, scale = 1) {
183
183
  }
184
184
  /**
185
185
  * A stroke of the tracing paper where it lies on the sheet: its points scaled by `scale` and moved
186
- * by `at`, and kept to the sheet, should the paper lie in part beyond it — the rules of the groups and the crop hold on
187
- * the sheet alone (R24, R25). The same ID, kind and times.
186
+ * by `at`, and kept to the sheet, should the paper lie in part beyond it — the rules of the groups
187
+ * and the crop hold on the sheet alone. The same ID, kind and times.
188
188
  */
189
189
  export function onSheet(stroke, at, scale = 1) {
190
190
  return Object.freeze({
@@ -212,7 +212,7 @@ export function boxOnSheet(box, at, scale = 1) {
212
212
  };
213
213
  }
214
214
  /**
215
- * The tracing paper's rectangle on the sheet in whole tenths of a unit, as the crop counts (R25),
215
+ * The tracing paper's rectangle on the sheet in whole tenths of a unit, as the crop counts,
216
216
  * kept to the sheet: the part of it a crop of the work takes in.
217
217
  */
218
218
  export function tenthsOf(rect) {
@@ -225,7 +225,7 @@ export function tenthsOf(rect) {
225
225
  }
226
226
  /**
227
227
  * The grey of a picture's pixels, four bytes each — red, green, blue and alpha — as a canvas reads
228
- * them: the luma of BT.601 in whole numbers, over white where a pixel is transparent (R87).
228
+ * them: the luma of BT.601 in whole numbers, over white where a pixel is transparent.
229
229
  */
230
230
  export function grayOf(rgba, width, height) {
231
231
  if (rgba.length !== 4 * width * height) {
@@ -243,7 +243,7 @@ export function grayOf(rgba, width, height) {
243
243
  return { gray, width, height };
244
244
  }
245
245
  /**
246
- * The crop's picture laid into the pixels of a crop of the work (R87), multiplied, as the screen
246
+ * The crop's picture laid into the pixels of a crop of the work, multiplied, as the screen
247
247
  * lays the tracing paper over the sheet: `ink` the crop's pixels, `width` px wide, and `rect`
248
248
  * where the tracing paper lies on them, in px, which may reach beyond them. Each pixel of the crop
249
249
  * under the paper takes the mean of the picture's pixels whose centres fall within it, or the one
@@ -1,8 +1,8 @@
1
- /** A digit: they are all as wide, and the page asks for figures of one width (R35). */
1
+ /** A digit: they are all as wide, and the page asks for figures of one width. */
2
2
  export declare const DIGIT = 53;
3
3
  /** A sign of an operation or a comparison: one width for all of them, the mean of theirs. */
4
4
  export declare const SIGN = 56;
5
- /** The signs of operations and comparisons, one width for all (R35). */
5
+ /** The signs of operations and comparisons, one width for all. */
6
6
  export declare const SIGNS = "+\u2212\u00D7\u00F7=<>\u2264\u2265\u2260\u00B1\u2248";
7
7
  /** The space between two words, which the layout sets itself. */
8
8
  export declare const SPACE = 26;