@altnovatrail/canvas 0.3.38 → 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 (79) 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 +24 -16
  20. package/lib/core/hands.js +66 -14
  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 +29 -0
  30. package/lib/core/notation.js +180 -0
  31. package/lib/core/outline.d.ts +3 -3
  32. package/lib/core/outline.js +6 -6
  33. package/lib/core/page.d.ts +7 -7
  34. package/lib/core/page.js +10 -10
  35. package/lib/core/png.d.ts +3 -3
  36. package/lib/core/png.js +3 -3
  37. package/lib/core/raster.d.ts +3 -3
  38. package/lib/core/raster.js +3 -3
  39. package/lib/core/recorder.d.ts +7 -7
  40. package/lib/core/recorder.js +7 -7
  41. package/lib/core/screen.d.ts +2 -2
  42. package/lib/core/screen.js +1 -1
  43. package/lib/core/sets.d.ts +1 -1
  44. package/lib/core/sets.js +1 -1
  45. package/lib/core/sheet.d.ts +3 -3
  46. package/lib/core/sheet.js +3 -3
  47. package/lib/core/submission.d.ts +24 -24
  48. package/lib/core/submission.js +21 -21
  49. package/lib/core/task.d.ts +17 -16
  50. package/lib/core/task.js +14 -13
  51. package/lib/core/tracing.d.ts +20 -20
  52. package/lib/core/tracing.js +20 -20
  53. package/lib/core/widths.d.ts +2 -2
  54. package/lib/core/widths.js +5 -5
  55. package/lib/core/work.d.ts +18 -18
  56. package/lib/core/work.js +21 -21
  57. package/lib/core/zoom.d.ts +34 -0
  58. package/lib/core/zoom.js +64 -0
  59. package/lib/element/icons.d.ts +19 -1
  60. package/lib/element/icons.js +24 -2
  61. package/lib/element/index.d.ts +87 -87
  62. package/lib/element/index.js +397 -295
  63. package/lib/element/labels.d.ts +21 -18
  64. package/lib/element/labels.js +15 -12
  65. package/lib/element/notation.d.ts +2 -0
  66. package/lib/element/notation.js +94 -0
  67. package/lib/element/parts.d.ts +2 -2
  68. package/lib/element/parts.js +6 -6
  69. package/lib/element/pictures.js +1 -1
  70. package/lib/element/probe.d.ts +2 -2
  71. package/lib/element/probe.js +3 -3
  72. package/lib/element/session.d.ts +3 -0
  73. package/lib/element/session.js +8 -4
  74. package/lib/element/statement.d.ts +2 -2
  75. package/lib/element/statement.js +6 -6
  76. package/lib/element/tools.d.ts +21 -18
  77. package/lib/element/tools.js +46 -30
  78. package/lib/element/tracing.js +58 -31
  79. package/package.json +3 -3
@@ -1,10 +1,10 @@
1
1
  import { getStroke } from "perfect-freehand";
2
2
  /**
3
3
  * The width of the line, in sheet units: 3, as the check board of tutor draws with a `lineWidth`
4
- * of 3 px on its sheet 1000 wide (R19 tutor; R18).
4
+ * of 3 px on its sheet 1000 wide.
5
5
  */
6
6
  export const INK_WIDTH = 3;
7
- /** How much a pen's pressure changes the width: from half of it to one and a half (R05, R18). */
7
+ /** How much a pen's pressure changes the width: from half of it to one and a half. */
8
8
  const PEN_THINNING = 0.5;
9
9
  /**
10
10
  * How far the ink reaches from a stroke's points, in sheet units, at most: half the widest line, a
@@ -13,8 +13,8 @@ const PEN_THINNING = 0.5;
13
13
  */
14
14
  export const INK_REACH = INK_WIDTH * (0.5 + PEN_THINNING / 2);
15
15
  /**
16
- * Every option of perfect-freehand 1.2.3 is given: its code's defaults are not its README's
17
- * (R18). The pressure is the pointer's own, the third number of each point, never simulated, and
16
+ * Every option of perfect-freehand 1.2.3 is given: its code's defaults are not its README's.
17
+ * The pressure is the pointer's own, the third number of each point, never simulated, and
18
18
  * the ends are round, without a taper.
19
19
  */
20
20
  const OPTIONS = {
@@ -26,14 +26,14 @@ const OPTIONS = {
26
26
  start: { cap: true, taper: false },
27
27
  end: { cap: true, taper: false },
28
28
  };
29
- /** Whether a stroke's line widens with its pressure on the screen: only a pen's does (R05, R18). */
29
+ /** Whether a stroke's line widens with its pressure on the screen: only a pen's does. */
30
30
  export function followsPressure(stroke) {
31
31
  return stroke.kind === "pen";
32
32
  }
33
33
  /**
34
34
  * The outline of a stroke on the screen, as perfect-freehand draws it: a closed polygon around the
35
35
  * stroke's points, in sheet units, to be filled. A pen's line widens with its pressure; a mouse's
36
- * or a finger's is as wide all along (R18). `complete` says the stroke has ended: its last point is
36
+ * or a finger's is as wide all along. `complete` says the stroke has ended: its last point is
37
37
  * then taken as it is, rather than eased toward.
38
38
  */
39
39
  export function outline(stroke, complete) {
@@ -1,9 +1,9 @@
1
1
  import type { WorkbookItem } from "./task.js";
2
- /** The numbers of the layout (R35), in page units, the type size among them. */
2
+ /** The numbers of the layout, in page units, the type size among them. */
3
3
  export interface Layout {
4
4
  /** The type size of the line's text. */
5
5
  readonly size: number;
6
- /** A box, the same for the whole task (R34). */
6
+ /** A box, the same for the whole task. */
7
7
  readonly boxWidth: number;
8
8
  readonly boxHeight: number;
9
9
  /** The height of a line of text without a box. */
@@ -21,9 +21,9 @@ export interface Layout {
21
21
  /** The margin of the page on its sides, its top and its bottom. */
22
22
  readonly margin: number;
23
23
  }
24
- /** The layout the workbook has: a sweep chose it around the box the author chose (R35). */
24
+ /** The layout the workbook has: a sweep chose it around the box the author chose. */
25
25
  export declare const LAYOUT: Layout;
26
- /** A piece of a line's text, or its part on one line of the page: one `<text>` (R34, R35). */
26
+ /** A piece of a line's text, or its part on one line of the page: one `<text>`. */
27
27
  export interface PageText {
28
28
  readonly text: string;
29
29
  /** Where it starts, and its alphabetic baseline, in page units. */
@@ -66,12 +66,12 @@ export interface Page {
66
66
  export declare function isBox(part: PageText | PageBox): part is PageBox;
67
67
  /**
68
68
  * The width of a text as one piece on one line, in whole units: its words and the spaces between
69
- * them, as the layout measures a fragment of a piece (R35). A worked example's value is held to its
70
- * box's width by it (the format's rule lesson.workbook-page; R60), and drawn at it.
69
+ * them, as the layout measures a fragment of a piece. A worked example's value is held to its
70
+ * box's width by it (the format's rule lesson.workbook-page), and drawn at it.
71
71
  */
72
72
  export declare function pieceWidth(text: string, layout?: Layout): number;
73
73
  /**
74
- * The page of a workbook's items (R35): a function of the items alone, in whole units, frozen. A
74
+ * The page of a workbook's items: a function of the items alone, in whole units, frozen. A
75
75
  * row that does not fit is a TypeError at the first item of it, `task.items[i]`.
76
76
  */
77
77
  export declare function pageOf(items: readonly WorkbookItem[], layout?: Layout): Page;
package/lib/core/page.js CHANGED
@@ -1,16 +1,16 @@
1
- // The layout of a workbook's page (R34, R35): where the template puts each item's number, the
2
- // pieces of its line and its boxes, in whole page units, from the task's items alone. The page is
3
- // the sheet's, 1000 × 1400 units (R06), and the boxes stay where the layout puts them on any
1
+ // The layout of a workbook's page: where the template puts each item's number, the
2
+ // pieces of its line and its boxes, in whole page units, from the task's items alone (R35). The
3
+ // page is the sheet's, 1000 × 1400 units, and the boxes stay where the layout puts them on any
4
4
  // device: the widths of the text come from the canvas's own table (widths.ts), and SVG fits the
5
5
  // text to them. Short lines stand two to a row, in the task's order; a long line takes the page's
6
6
  // width and wraps. A task whose lines do not fit is a TypeError: nothing shrinks. The numbers and
7
7
  // the rule are the module format's, its page.yaml and its test vectors, which the npm package
8
- // @altnovatrail/spec carries and the tests hold the layout to (R60; R51 spec): they change only
9
- // with the format, for histories know neither the task nor the layout (R34). The core's entry
10
- // point does not give the layout.
8
+ // @altnovatrail/spec carries and the tests hold the layout to: they change only with the format,
9
+ // for histories know neither the task nor the layout. The core's entry point does not give the
10
+ // layout.
11
11
  import { SHEET } from "./sheet.js";
12
12
  import { clustersOf, clusterWidth, SPACE, wordsOf, wordWidth } from "./widths.js";
13
- /** The layout the workbook has: a sweep chose it around the box the author chose (R35). */
13
+ /** The layout the workbook has: a sweep chose it around the box the author chose. */
14
14
  export const LAYOUT = Object.freeze({
15
15
  size: 30,
16
16
  boxWidth: 100,
@@ -50,8 +50,8 @@ function measuresOf(layout) {
50
50
  }
51
51
  /**
52
52
  * The width of a text as one piece on one line, in whole units: its words and the spaces between
53
- * them, as the layout measures a fragment of a piece (R35). A worked example's value is held to its
54
- * box's width by it (the format's rule lesson.workbook-page; R60), and drawn at it.
53
+ * them, as the layout measures a fragment of a piece. A worked example's value is held to its
54
+ * box's width by it (the format's rule lesson.workbook-page), and drawn at it.
55
55
  */
56
56
  export function pieceWidth(text, layout = LAYOUT) {
57
57
  const words = wordsOf(text);
@@ -66,7 +66,7 @@ function textWidth(layout, hundredths) {
66
66
  return (product - (product % 100)) / 100 + (product % 100 > 0 ? 1 : 0);
67
67
  }
68
68
  /**
69
- * The page of a workbook's items (R35): a function of the items alone, in whole units, frozen. A
69
+ * The page of a workbook's items: a function of the items alone, in whole units, frozen. A
70
70
  * row that does not fit is a TypeError at the first item of it, `task.items[i]`.
71
71
  */
72
72
  export function pageOf(items, layout = LAYOUT) {
package/lib/core/png.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * The PNG of a grey image, a byte to a pixel, row by row from the top (R25): own code, so that the
3
- * same pixels give the same bytes in every browser and in Node, as no browser's canvas promises
4
- * (R05). The file is the least PNG holds: its signature, the header, one chunk of data and the end,
2
+ * The PNG of a grey image, a byte to a pixel, row by row from the top: own code, so that the
3
+ * same pixels give the same bytes in every browser and in Node, as no browser's canvas promises.
4
+ * The file is the least PNG holds: its signature, the header, one chunk of data and the end,
5
5
  * no ancillary chunk, for a decoder may ignore them (PNG Third Edition, 11.3). The data is a zlib
6
6
  * stream of one deflate block with the fixed Huffman codes (RFC 1950, RFC 1951): every row
7
7
  * unfiltered, and a repeat looked for in two places only — the byte before, which takes the runs of
package/lib/core/png.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * The PNG of a grey image, a byte to a pixel, row by row from the top (R25): own code, so that the
3
- * same pixels give the same bytes in every browser and in Node, as no browser's canvas promises
4
- * (R05). The file is the least PNG holds: its signature, the header, one chunk of data and the end,
2
+ * The PNG of a grey image, a byte to a pixel, row by row from the top: own code, so that the
3
+ * same pixels give the same bytes in every browser and in Node, as no browser's canvas promises.
4
+ * The file is the least PNG holds: its signature, the header, one chunk of data and the end,
5
5
  * no ancillary chunk, for a decoder may ignore them (PNG Third Edition, 11.3). The data is a zlib
6
6
  * stream of one deflate block with the fixed Huffman codes (RFC 1950, RFC 1951): every row
7
7
  * unfiltered, and a repeat looked for in two places only — the byte before, which takes the runs of
@@ -1,14 +1,14 @@
1
1
  import type { Crop } from "./crop.js";
2
2
  import type { Stroke } from "./ink.js";
3
3
  /**
4
- * The pixels of a crop (R25): grey, a byte each, row by row from the top, white 255 and the ink 0,
4
+ * The pixels of a crop: grey, a byte each, row by row from the top, white 255 and the ink 0,
5
5
  * of the strokes the crop was made of. Every segment of a stroke is a line as wide all along, with
6
6
  * round ends, and a stroke of one point a dot as wide as the line: a pixel takes the share of it
7
7
  * that the line covers, along a ramp a pixel wide at the line's edge, and the darkest of what
8
8
  * covers it. The places are the crop's own whole numbers, from the points in tenths of a unit, as
9
- * a sample keeps them (R09). Only adding, subtracting, multiplying, dividing and Math.sqrt go into
9
+ * a sample keeps them. Only adding, subtracting, multiplying, dividing and Math.sqrt go into
10
10
  * a pixel, which ECMAScript rounds alike in every engine, so the bytes are the same in each.
11
11
  */
12
12
  export declare function rasterOf(strokes: readonly Stroke[], crop: Crop): Uint8Array<ArrayBuffer>;
13
- /** The PNG of a crop: its pixels, encoded (R25). */
13
+ /** The PNG of a crop: its pixels, encoded. */
14
14
  export declare function pictureOf(strokes: readonly Stroke[], crop: Crop): Uint8Array<ArrayBuffer>;
@@ -1,12 +1,12 @@
1
1
  import { tenths } from "./geometry.js";
2
2
  import { encodePNG } from "./png.js";
3
3
  /**
4
- * The pixels of a crop (R25): grey, a byte each, row by row from the top, white 255 and the ink 0,
4
+ * The pixels of a crop: grey, a byte each, row by row from the top, white 255 and the ink 0,
5
5
  * of the strokes the crop was made of. Every segment of a stroke is a line as wide all along, with
6
6
  * round ends, and a stroke of one point a dot as wide as the line: a pixel takes the share of it
7
7
  * that the line covers, along a ramp a pixel wide at the line's edge, and the darkest of what
8
8
  * covers it. The places are the crop's own whole numbers, from the points in tenths of a unit, as
9
- * a sample keeps them (R09). Only adding, subtracting, multiplying, dividing and Math.sqrt go into
9
+ * a sample keeps them. Only adding, subtracting, multiplying, dividing and Math.sqrt go into
10
10
  * a pixel, which ECMAScript rounds alike in every engine, so the bytes are the same in each.
11
11
  */
12
12
  export function rasterOf(strokes, crop) {
@@ -33,7 +33,7 @@ export function rasterOf(strokes, crop) {
33
33
  }
34
34
  return gray;
35
35
  }
36
- /** The PNG of a crop: its pixels, encoded (R25). */
36
+ /** The PNG of a crop: its pixels, encoded. */
37
37
  export function pictureOf(strokes, crop) {
38
38
  return encodePNG(rasterOf(strokes, crop), crop.width, crop.height);
39
39
  }
@@ -2,7 +2,7 @@ import { Clock } from "./clock.js";
2
2
  import type { Stroke } from "./ink.js";
3
3
  /**
4
4
  * What the recorder takes of a pointer event, and of each event coalesced into it. The DOM-free
5
- * part sees no DOM (R12), so the element hands it this much, the place already in sheet units.
5
+ * part sees no DOM, so the element hands it this much, the place already in sheet units.
6
6
  */
7
7
  export interface PointerSample {
8
8
  /** The event's `pointerId`. */
@@ -23,7 +23,7 @@ export interface PointerSample {
23
23
  }
24
24
  /**
25
25
  * How close two recorded points of a stroke may come, in sheet units: 0.1, the precision of a
26
- * sample file (R09). A point nearer than that to the last one recorded adds nothing the file would
26
+ * sample file. A point nearer than that to the last one recorded adds nothing the file would
27
27
  * keep (R18).
28
28
  */
29
29
  export declare const MIN_STEP = 0.1;
@@ -32,11 +32,11 @@ export declare const PRIMARY = 0;
32
32
  /** The primary button's bit in `buttons`. */
33
33
  export declare const PRIMARY_HELD = 1;
34
34
  /**
35
- * The strokes of one sheet, from the pointer's samples (R18). One pointer writes at a time, with
35
+ * The strokes of one sheet, from the pointer's samples. One pointer writes at a time, with
36
36
  * its primary button: a second pointer, and any other button, write nothing while a stroke is
37
37
  * under way. A finished stroke goes to the handler the recorder is made with — onto the work on
38
- * the sheet (R19). Its points take their time from the sheet's clock, which the sheet's other
39
- * actions keep too (R22).
38
+ * the sheet. Its points take their time from the sheet's clock, which the sheet's other
39
+ * actions keep too.
40
40
  */
41
41
  export declare class Recorder {
42
42
  #private;
@@ -58,7 +58,7 @@ export declare class Recorder {
58
58
  * is 0 by definition, the buttons no longer pressed, rather than measured.
59
59
  */
60
60
  up(sample: PointerSample): boolean;
61
- /** `pointercancel`: the device took the touch for an accident, and the stroke goes (R05). */
61
+ /** `pointercancel`: the device took the touch for an accident, and the stroke goes. */
62
62
  cancel(pointerId: number): boolean;
63
63
  /**
64
64
  * The stroke ends where the pointer last was, its `pointerup` never to come: the pointer's
@@ -66,7 +66,7 @@ export declare class Recorder {
66
66
  */
67
67
  end(pointerId?: number): boolean;
68
68
  /**
69
- * The sheet has taken another history of writing (R27): the stroke under way goes, as on
69
+ * The sheet has taken another history of writing: the stroke under way goes, as on
70
70
  * `pointercancel` — its ID and its times are the last sheet's — and the next stroke is `nextId`.
71
71
  */
72
72
  restart(nextId: number): void;
@@ -1,7 +1,7 @@
1
1
  import { Clock } from "./clock.js";
2
2
  /**
3
3
  * How close two recorded points of a stroke may come, in sheet units: 0.1, the precision of a
4
- * sample file (R09). A point nearer than that to the last one recorded adds nothing the file would
4
+ * sample file. A point nearer than that to the last one recorded adds nothing the file would
5
5
  * keep (R18).
6
6
  */
7
7
  export const MIN_STEP = 0.1;
@@ -10,11 +10,11 @@ export const PRIMARY = 0;
10
10
  /** The primary button's bit in `buttons`. */
11
11
  export const PRIMARY_HELD = 1;
12
12
  /**
13
- * The strokes of one sheet, from the pointer's samples (R18). One pointer writes at a time, with
13
+ * The strokes of one sheet, from the pointer's samples. One pointer writes at a time, with
14
14
  * its primary button: a second pointer, and any other button, write nothing while a stroke is
15
15
  * under way. A finished stroke goes to the handler the recorder is made with — onto the work on
16
- * the sheet (R19). Its points take their time from the sheet's clock, which the sheet's other
17
- * actions keep too (R22).
16
+ * the sheet. Its points take their time from the sheet's clock, which the sheet's other
17
+ * actions keep too.
18
18
  */
19
19
  export class Recorder {
20
20
  #finished;
@@ -78,7 +78,7 @@ export class Recorder {
78
78
  live.latest = this.#point(sample, live.latest.p);
79
79
  return this.#finish();
80
80
  }
81
- /** `pointercancel`: the device took the touch for an accident, and the stroke goes (R05). */
81
+ /** `pointercancel`: the device took the touch for an accident, and the stroke goes. */
82
82
  cancel(pointerId) {
83
83
  if (this.#live?.pointerId !== pointerId)
84
84
  return false;
@@ -97,7 +97,7 @@ export class Recorder {
97
97
  return this.#finish();
98
98
  }
99
99
  /**
100
- * The sheet has taken another history of writing (R27): the stroke under way goes, as on
100
+ * The sheet has taken another history of writing: the stroke under way goes, as on
101
101
  * `pointercancel` — its ID and its times are the last sheet's — and the next stroke is `nextId`.
102
102
  */
103
103
  restart(nextId) {
@@ -118,7 +118,7 @@ export class Recorder {
118
118
  /**
119
119
  * A point of the sample, its time the sheet's and never going back. Its pressure is kept to 0–1,
120
120
  * the range Pointer Events gives it: an event a script makes may say more, and the sheet would
121
- * write a history it does not take back (R27).
121
+ * write a history it does not take back.
122
122
  */
123
123
  #point(sample, pressure) {
124
124
  const p = Math.min(Math.max(pressure, 0), 1);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Where the sheet is on the screen, one view for every layer (R06): `k` CSS pixels to a logical
2
+ * Where the sheet is on the screen, one view for every layer: `k` CSS pixels to a logical
3
3
  * unit, for the page fits the width of its area, and `vx` and `vy`, the left and the top of the
4
4
  * sheet's visible part, in units.
5
5
  */
@@ -15,7 +15,7 @@ export interface Point {
15
15
  }
16
16
  /**
17
17
  * The most CSS pixels to a unit: on a wide screen the page is 1000 CSS pixels wide, a pixel to a
18
- * unit as on the picture of the work, at the sheet's left, and the sheet goes on past it (R23).
18
+ * unit as on the picture of the work, at the sheet's left, and the sheet goes on past it.
19
19
  */
20
20
  export declare const K_MAX = 1;
21
21
  /** `k` of a sheet `width` CSS pixels wide as it is on the screen, `across` units wide: k = A / W. */
@@ -1,7 +1,7 @@
1
1
  import { REACH, SHEET } from "./sheet.js";
2
2
  /**
3
3
  * The most CSS pixels to a unit: on a wide screen the page is 1000 CSS pixels wide, a pixel to a
4
- * unit as on the picture of the work, at the sheet's left, and the sheet goes on past it (R23).
4
+ * unit as on the picture of the work, at the sheet's left, and the sheet goes on past it.
5
5
  */
6
6
  export const K_MAX = 1;
7
7
  /** `k` of a sheet `width` CSS pixels wide as it is on the screen, `across` units wide: k = A / W. */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The sets that strokes join into, pair by pair: union-find, each set known by its root, which is
3
- * its smallest member. The groups grow in them (R24), and the crop's bundles (R25).
3
+ * its smallest member. The groups grow in them, and the crop's bundles.
4
4
  */
5
5
  export declare class Sets {
6
6
  #private;
package/lib/core/sets.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The sets that strokes join into, pair by pair: union-find, each set known by its root, which is
3
- * its smallest member. The groups grow in them (R24), and the crop's bundles (R25).
3
+ * its smallest member. The groups grow in them, and the crop's bundles.
4
4
  */
5
5
  export class Sets {
6
6
  #parent;
@@ -11,7 +11,7 @@ export declare const SHEET: Readonly<{
11
11
  /**
12
12
  * How far the sheet goes from its origin, in units: ten pages across and ten down. The learner
13
13
  * writes past the page, to the right of it and below it, and a point beyond this is no point of a
14
- * history: the bound keeps the rules' whole numbers small and a history's numbers sane (R06).
14
+ * history: the bound keeps the rules' whole numbers small and a history's numbers sane.
15
15
  */
16
16
  export declare const REACH: Readonly<{
17
17
  readonly width: 10000;
@@ -23,7 +23,7 @@ export interface Size {
23
23
  readonly height: number;
24
24
  }
25
25
  /**
26
- * The sheet as large as it is laid out (R06): the page, and past it and past the furthest ink a
26
+ * The sheet as large as it is laid out: the page, and past it and past the furthest ink a
27
27
  * `room` more — the part of the sheet in sight, so that there is always somewhere to move it to and
28
28
  * write —, within `REACH`. `ink` is the right and the bottom of the furthest strokes, none for an
29
29
  * empty sheet.
@@ -38,7 +38,7 @@ export declare function extentOf(ink: {
38
38
  */
39
39
  export declare const PICTURE_BYTES: number;
40
40
  /**
41
- * The picture of a work (R83): the page, and the ink past it, right and down, with no room past the
41
+ * The picture of a work: the page, and the ink past it, right and down, with no room past the
42
42
  * ink, at a pixel a unit while its rows hold no more than `PICTURE_BYTES`, and scaled down to hold
43
43
  * them otherwise. `scale` is pixels a unit.
44
44
  */
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) };