@altnovatrail/spec 0.8.0 → 0.8.1

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/README.md CHANGED
@@ -32,14 +32,15 @@ function show(task: open.Task, manifest: open.Manifest) {
32
32
  - **`@altnovatrail/spec/formatv0/open`** holds the open view of each part, which is what the learner's app gets ([the format's text](https://github.com/altnovatrail/spec/blob/main/format/README.md#6-open-fields), section 6). Each type keeps its name from `formatv0` and only the fields marked `x-open`, so an open view has no check, no template and no solver.
33
33
  - **`@altnovatrail/spec/admissionv0`** holds the types of the admission table's major version 0: the table, with its providers, deployment facts, rules of capabilities and cells, and the test vectors of the admission function's answers.
34
34
  - **`@altnovatrail/spec/canvas`** holds the types of `<novatrail-canvas>`:
35
- - `CanvasElement`, which describes the element's properties `tool`, `task`, `workedExample`, `demoState`, `manifest`, `media`, `history` and `filled` and its method `exportWork()`;
35
+ - `CanvasElement`, which describes the element's properties `tool`, `task`, `workedExample`, `demoState`, `manifest`, `media`, `history`, `marks` and `filled` and its method `exportWork()`;
36
36
  - `Media`, the function by which the consumer gives the files of the pictures: the canvas goes to no network;
37
37
  - the events `toolchange`, `historychange` and `demochange`, with `CanvasEventMap` naming them;
38
38
  - the state of a worked example's demo, `DemoState`;
39
39
  - the history of writing;
40
- - the work for checking, with the context of its submission.
40
+ - the work for checking, with the context of its submission;
41
+ - the tutor's marks of a submission, `Marks`, `Mark` and `Anchor`: their kind and place come from the contract between the app and the platform's API, the message `Mark` of `novatrail.api.v1` in the npm package `@altnovatrail/contracts`, and their name from the app.
41
42
 
42
- Its unions are exact: an event of the history is told by its `kind`, and the work of a sheet or of a workbook by its key, `png` or `cells`. The declarations need the DOM's types, so the consumer's `lib` must include `dom`. The tutor's marks are not in it yet: their types come with the contract between the app and the platform's API. The package registers nothing. The canvas's own package puts the element in `HTMLElementTagNameMap` and its events in `GlobalEventHandlersEventMap`.
43
+ Its unions are exact: an event of the history is told by its `kind`, and the work of a sheet or of a workbook by its key, `png` or `cells`. The declarations need the DOM's types, so the consumer's `lib` must include `dom`. The package registers nothing. The canvas's own package puts the element in `HTMLElementTagNameMap` and its events in `GlobalEventHandlersEventMap`.
43
44
 
44
45
  A type gives the shape of a value and nothing more: the schemas decide what is valid. Code that reads a value from elsewhere checks it against its schema first.
45
46
 
package/canvas/index.d.ts CHANGED
@@ -10,10 +10,12 @@
10
10
  * types of the task, of the worked example and of the manifest are the module format's open views,
11
11
  * formatv0/open.
12
12
  *
13
- * The tutor's marks — the property `marks` and the types of a mark — wait for the contract of epic
14
- * E3, and are canvas's own until then. The element's members beyond this contract — its commands
15
- * undo() and clear(), which its own buttons call — and its place in the DOM's maps of tags and
16
- * events are canvas's too: its package registers the element. The declarations take the DOM's
13
+ * It takes the tutor's marks of a submission too, by a property, with the submission's context:
14
+ * their kind and their place come from the contract between app and api, novatrail.api.v1, whose
15
+ * message `Mark` these types are checked against, and their names from app (contracts/README.md,
16
+ * section 15; R83). The element's members beyond this contract — its commands undo() and clear(),
17
+ * which its own buttons call — and its place in the DOM's maps of tags and events are canvas's:
18
+ * its package registers the element. The declarations take the DOM's
17
19
  * types: Blob, CustomEvent and HTMLElement.
18
20
  *
19
21
  * @packageDocumentation
@@ -268,6 +270,39 @@ export interface ExportedWorkbook {
268
270
  /** The work for checking, of a sheet or of a workbook: its key, `png` or `cells`, tells which. */
269
271
  export type ExportedWork = ExportedSheet | ExportedWorkbook;
270
272
 
273
+ /**
274
+ * Where a tutor's mark is: a group of strokes by its label, an answer cell by its place, or a box on
275
+ * the crop the model saw, as the contract's mark has its place (contracts/README.md, section 15). On
276
+ * a workbook a mark stands on a cell alone. A group's label comes from api only if the frames of the
277
+ * groups go with the work (repositories 8, Т-31).
278
+ */
279
+ export type Anchor =
280
+ | { readonly group: string }
281
+ | { readonly cell: CellPlace }
282
+ /** [ymin, xmin, ymax, xmax] in whole thousandths of the crop's height and width; min < max. */
283
+ | { readonly box: readonly [number, number, number, number] };
284
+
285
+ /** A mark of the tutor's layer: a frame, so far, with where it is and its name. */
286
+ export interface Mark {
287
+ readonly kind: "frame";
288
+ readonly at: Anchor;
289
+ /**
290
+ * What a screen reader names it, in app's words, in the language of its screen: "Tutor's mark 1
291
+ * of 2". The element words nothing, and a name empty or of white space alone is a TypeError.
292
+ */
293
+ readonly name: string;
294
+ }
295
+
296
+ /**
297
+ * The tutor's marks of one submission, with the context of the submission that the element gave
298
+ * with its work and app kept: a sheet's or a workbook's. The marks are those of one answer of
299
+ * api, in its order.
300
+ */
301
+ export interface Marks {
302
+ readonly submission: Submission;
303
+ readonly marks: readonly Mark[];
304
+ }
305
+
271
306
  /** The events of the element, by their names, for a consumer's map of events. */
272
307
  export interface CanvasEventMap {
273
308
  historychange: HistoryChangeEvent;
@@ -341,6 +376,22 @@ export interface CanvasElement extends HTMLElement {
341
376
  */
342
377
  get history(): readonly HistoryEvent[];
343
378
  set history(history: readonly HistoryEvent[] | undefined);
379
+ /**
380
+ * The tutor's marks of one submission, on the tutor's layer, given after the task and the
381
+ * history they hold on to. A mark holds on to the strokes the model saw at its place and is drawn
382
+ * around those of them the sheet shows, as they are now: a box on the crop takes the strokes by
383
+ * the rule of snapping (contracts/README.md, section 12), and a cell of a workbook is framed with
384
+ * its box — round the box alone when the box was empty. A cell on a sheet, and a box that comes
385
+ * near no stroke, have no frame: the question is asked without one. A submission goes back to the
386
+ * sheet or the page it was made on, as its digest tells: one of other strokes or other boxes is a
387
+ * TypeError, and so are marks given before the task and the history, a mark of another kind, a
388
+ * name empty or of white space alone, a group's label the submission has not, a box that is not
389
+ * whole thousandths with min < max, and on a workbook any place but a cell. A new history puts the
390
+ * marks back on their strokes, or takes them off. `undefined` takes the marks off. A worked
391
+ * example's sheet has nothing to mark: marks are a TypeError there.
392
+ */
393
+ get marks(): Marks | undefined;
394
+ set marks(marks: Marks | undefined);
344
395
  /**
345
396
  * Which answer slots are filled, frozen: a workbook's boxes, and on a sheet the task's one slot
346
397
  * bound `anywhere` or `sheet`. `null` on a sheet whose slots are bound `choice`, whose options app
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altnovatrail/spec",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
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.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {