@altnovatrail/spec 0.19.7 → 0.19.9

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.
package/canvas/index.d.ts CHANGED
@@ -8,8 +8,9 @@
8
8
  * tells what the learner did by events. In place of a task it may show a lesson's worked example,
9
9
  * whose demo the learner opens part by part with its buttons, and how far they have gone is a
10
10
  * property and an event too. In place of either it may show a task from the learner's paper: the
11
- * task's crop over a dotted sheet as tracing paper, which the learner moves, hides and writes on,
12
- * and where the tracing paper lies is a property and an event as well (R162). The types of the
11
+ * task's crop over a sheet as tracing paper, which the learner moves, hides and writes on, and where
12
+ * the tracing paper lies and the grid the learner chose for the sheet are properties and events as
13
+ * well (R162). The types of the
13
14
  * task, of the worked example and of the manifest are the module format's open views,
14
15
  * formatv0/open.
15
16
  *
@@ -27,10 +28,10 @@
27
28
  import type * as open from "../formatv0/open/index.js";
28
29
 
29
30
  /**
30
- * What a press of the primary button does on the sheet: the pen writes, the eraser erases. A task
31
- * without the eraser has the pen alone.
31
+ * What a press of the primary button does on the sheet: the pen writes, the eraser erases, the hand
32
+ * moves the sheet and writes nothing. A task without the eraser has the pen and the hand.
32
33
  */
33
- export type Tool = "pen" | "eraser";
34
+ export type Tool = "pen" | "eraser" | "hand";
34
35
 
35
36
  /** What a `toolchange` tells: the tool the learner chose with the element's own buttons. */
36
37
  export interface ToolChange {
@@ -66,10 +67,10 @@ export type DemoChangeEvent = CustomEvent<DemoState>;
66
67
 
67
68
  /**
68
69
  * A task from the learner's paper (concepts 8; R162): the task's crop, which app cut on the device
69
- * from the photo of the page by its task frame. The element lays it over a sheet in dots — the
70
- * sheet of a task from paper has no other grid and no choice of one — as tracing paper, in place of
71
- * a task's statement and template. It has no answer slot of the format: its one slot is the whole
72
- * work, at the place 1, 1. The tools are the pen and the eraser.
70
+ * from the photo of the page by its task frame. The element lays it over a sheet as tracing paper,
71
+ * in place of a task's statement and template; the sheet's grid is the learner's, `PaperGrid`. It
72
+ * has no answer slot of the format: its one slot is the whole work, at the place 1, 1. The tools
73
+ * are the pen, the eraser and the hand.
73
74
  */
74
75
  export interface PaperTask {
75
76
  /** The task's crop, a JPEG or a PNG, as app cut it, without the learner's strokes. */
@@ -77,12 +78,37 @@ export interface PaperTask {
77
78
  }
78
79
 
79
80
  /**
80
- * Where the tracing paper of a task from paper lies on the sheet, and whether it is hidden. A new
81
- * task from paper starts at the element's own place for it, shown.
81
+ * The grid of a task from paper's sheet, the learner's choice: dots, lines, none or squares, of the
82
+ * step of the module format's default. A new task from paper starts in dots; the element's button
83
+ * of the grid turns it to the next of them, round, in this order.
84
+ */
85
+ export type PaperGrid = "dots" | "lines" | "blank" | "squares";
86
+
87
+ /** What a `gridchange` tells: the grid the learner chose with the element's button. */
88
+ export interface GridChange {
89
+ readonly grid: PaperGrid;
90
+ }
91
+
92
+ /**
93
+ * The event the element sends from its host, bubbling and composed, when the learner turns the
94
+ * grid of a task from paper's sheet by its button — not when the consumer sets `grid`. Its detail is
95
+ * frozen.
96
+ */
97
+ export type GridChangeEvent = CustomEvent<GridChange>;
98
+
99
+ /**
100
+ * Where the tracing paper of a task from paper lies on the sheet, how large, and whether it is
101
+ * hidden. A new task from paper starts at the element's own place for it, shown, at its own size.
82
102
  */
83
103
  export interface TracingState {
84
104
  /** Its top left corner on the sheet, in the sheet's units: [x, y]. */
85
105
  readonly at: readonly [x: number, y: number];
106
+ /**
107
+ * How many times its own size it is drawn, from 0.4 to 4, the crop and the strokes on it alike,
108
+ * from its top left corner: the strokes keep their points on it, so the work for checking is the
109
+ * same at any scale. Absent is 1; the element gives it always (R169).
110
+ */
111
+ readonly scale?: number;
86
112
  /**
87
113
  * Whether the tracing paper is hidden, with the strokes on it: they stay in the history and in
88
114
  * the work for checking, out of sight.
@@ -92,19 +118,43 @@ export interface TracingState {
92
118
 
93
119
  /**
94
120
  * The event the element sends from its host, bubbling and composed, when the learner moves the
95
- * tracing paper by its grip "Move the task", or hides or shows it by its button atop the tools —
96
- * not when the consumer sets `tracing`. Its detail is the new state, frozen.
121
+ * tracing paper by its grip "Move the task", scales it by its corners, its buttons or Ctrl/⌘ with
122
+ * the wheel, fits it to the window, or hides or shows it by its button atop the tools — not when
123
+ * the consumer sets `tracing`. Its detail is the new state, frozen.
97
124
  */
98
125
  export type TracingChangeEvent = CustomEvent<TracingState>;
99
126
 
127
+ /**
128
+ * The statement of a task from paper read in clean print, which the consumer gets on the learner's
129
+ * "Recognise" (R169): `"ready"`, the button offered; `"busy"`, while the reading comes; and
130
+ * `"done"`, the statement of each task the crop holds, as the page prints it, "□" for each box an
131
+ * answer goes in, a fraction with a bar LaTeX's `\frac{3}{17}`, nested as printed, and a raised
132
+ * power `^{2}`, which the element draws built up in place of the crop until the learner goes back
133
+ * to the photo by "Original".
134
+ */
135
+ export type TracingReading =
136
+ | { readonly state: "ready" }
137
+ | { readonly state: "busy" }
138
+ | { readonly state: "done"; readonly statements: readonly string[] };
139
+
140
+ /**
141
+ * The event the element sends from its host, bubbling and composed, when the learner presses
142
+ * "Recognise" while `reading` is `"ready"`: the consumer reads the statement and gives
143
+ * `reading` `"busy"`, then `"done"`, or `"ready"` again when no reading came. Its detail is null.
144
+ */
145
+ export type TracingReadEvent = CustomEvent<null>;
146
+
100
147
  /**
101
148
  * A point of a stroke: where it lies on the sheet, in its logical units, when it was written and
102
149
  * how hard the pointer pressed.
103
150
  */
104
151
  export interface InkPoint {
105
- /** Across the sheet: 0 at its left edge, its width, 1000, at its right. */
152
+ /**
153
+ * Across the sheet: 0 at its left edge, at most 10000. The task's page is its first 1000, and the
154
+ * sheet goes on to the right of it as far as the learner writes and moves it (R06 canvas).
155
+ */
106
156
  readonly x: number;
107
- /** Down the sheet: 0 at its top edge, its height, 1400, at its bottom. */
157
+ /** Down the sheet: 0 at its top edge, at most 14000; the task's page is its first 1400. */
108
158
  readonly y: number;
109
159
  /** Milliseconds since the sheet's first event: the time of a sample has no date. */
110
160
  readonly t: number;
@@ -430,6 +480,8 @@ export interface CanvasEventMap {
430
480
  toolchange: ToolChangeEvent;
431
481
  demochange: DemoChangeEvent;
432
482
  tracingchange: TracingChangeEvent;
483
+ tracingread: TracingReadEvent;
484
+ gridchange: GridChangeEvent;
433
485
  }
434
486
 
435
487
  /**
@@ -445,10 +497,13 @@ export type Media = (ref: string) => Promise<Blob>;
445
497
  * on a worked example its row, with the slot `actions` — is out of sight and out of the
446
498
  * accessibility tree: app sets it on a phone while its tutor's sheet is open. While it has the boolean
447
499
  * attribute `statement-hidden`, it draws no task statement, and app draws the statement as its card
448
- * above the element (R161). Among the style properties `--novatrail-canvas-*` that app sets, `--novatrail-canvas-accent`
449
- * is the accent of the tool in use and of the focus ring, `--novatrail-canvas-glass` the fill of the
450
- * bar's glass, and `--novatrail-canvas-top` the offset of the band in whose middle the bar stands. On
451
- * a worked example, app puts its own "Continue" into the element's named slot `actions`, a child
500
+ * above the element (R161). Among the style properties `--novatrail-canvas-*` that app sets,
501
+ * `--novatrail-canvas-accent` is the accent of the tool in use and of the focus ring,
502
+ * `--novatrail-canvas-glass` the fill of the bar's glass, `--novatrail-canvas-top` the offset of the
503
+ * band in whose middle the bar stands, and `--novatrail-canvas-pad-top` and
504
+ * `--novatrail-canvas-pad-bottom` how far app's own bars float over the element's top and bottom:
505
+ * the statement starts below the first, the sheet scrolls up past the second, and the bar's band
506
+ * ends above the second. On a worked example, app puts its own "Continue" into the element's named slot `actions`, a child
452
507
  * `<button slot="actions">`, in one row after the element's Next and Demo (R36).
453
508
  */
454
509
  export interface CanvasElement extends HTMLElement {
@@ -480,6 +535,22 @@ export interface CanvasElement extends HTMLElement {
480
535
  */
481
536
  get tracing(): TracingState | undefined;
482
537
  set tracing(state: TracingState | undefined);
538
+ /**
539
+ * The reading of the task from paper's statement: `undefined`, as a task from paper comes, offers
540
+ * no "Recognise"; the consumer gives it while it can read the statement, and the element shows
541
+ * the button, its wait and the statements by it, frozen. Given without a task from paper, or not
542
+ * of `TracingReading`, it is a TypeError.
543
+ */
544
+ get reading(): TracingReading | undefined;
545
+ set reading(reading: TracingReading | undefined);
546
+ /**
547
+ * The grid of the task from paper's sheet: `undefined` without a task from paper, and "dots" as
548
+ * one comes. The learner turns it by the element's button, which a `gridchange` tells; the
549
+ * consumer keeps it and gives it back, which tells nothing. A grid given before the task from
550
+ * paper is a TypeError, and so is one not of `PaperGrid`; `undefined` changes nothing.
551
+ */
552
+ get grid(): PaperGrid | undefined;
553
+ set grid(grid: PaperGrid | undefined);
483
554
  /**
484
555
  * The open view of a lesson's worked example, its segment `worked_example`, in place of a task;
485
556
  * its module's manifest is `manifest`, as a task's is. The element shows the example's statement
@@ -557,10 +628,10 @@ export interface CanvasElement extends HTMLElement {
557
628
  exportWork(): Promise<ExportedWork | null>;
558
629
  /**
559
630
  * The picture of the work, which app puts as the stored work's `picture` (contracts/README.md,
560
- * section 15): always a Blob of a PNG, with no condition, of the strokes of the whole surface — the
561
- * sheet, with the tracing paper of a task from paper, or the workbook's page — as it is when it is
562
- * called, within the limit of a stored work
563
- * there. Its size and its colours are canvas's (R83 canvas).
631
+ * section 15): always a Blob of a PNG, with no condition, of the strokes the surface shows as it is
632
+ * when it is called — the page, a sheet's or a workbook's, and the ink past it, right and down, with
633
+ * the tracing paper of a task from paper where it lies —, within the limit of a stored work there.
634
+ * Its size, in its PNG's header, and its colours are canvas's (R83 canvas).
564
635
  */
565
636
  exportPicture(): Promise<Blob>;
566
637
  }
@@ -554,8 +554,8 @@ export interface Task {
554
554
  */
555
555
  readonly history: unknown;
556
556
  /**
557
- * Where the tracing paper lay at the end and whether it was hidden, as the canvas gave it: at [x,
558
- * y] and hidden.
557
+ * Where the tracing paper lay at the end, whether it was hidden and its scale, as the canvas gave
558
+ * it: at [x, y], hidden and scale, absent meaning 1.
559
559
  */
560
560
  readonly tracing: unknown;
561
561
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altnovatrail/spec",
3
- "version": "0.19.7",
3
+ "version": "0.19.9",
4
4
  "description": "The types of NovaTrail's module format for TypeScript, generated from its schemas: the parts of a module and their open views, the canonical view, the inventory, the module index and the test vectors. And the types of the element <novatrail-canvas>, the contract of the canvas and the app. And the types of the admission table, which says which AI provider may serve which age category. And the numbers and widths of the workbook's page and its test vectors, as JSON, by which a canvas lays the page out. And the types of the deployment configuration, the file /deployment.json that the app reads at its start. And the types of the legal texts' passport, which names each text, its versions and the sets of texts of the samples page. And the types of the table of the age of digital consent, which gives each country's age with the law that sets it. And the types of the files of an export, the file the owner of an account gets of a profile or of the account.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {