@altnovatrail/canvas 0.1.7 → 0.2.0

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
@@ -21,7 +21,7 @@ A component of [NovaTrail](https://github.com/altnovatrail/spec/tree/v0.9.8), a
21
21
 
22
22
  ## Status
23
23
 
24
- Code started. The detailing is done — epic E1, archived in [docs/plan/E1.md](docs/plan/E1.md). Epic E2, replanned for the MVP on 2026-10-22, built the handwriting sheet as the element `<novatrail-canvas>`, for tutor's check board to take in place of its own sheet; the board has decided to keep its own. Its last task was the author's try of the sheet by hand on the demo page, which found nothing to fix. E2 is done and archived in [docs/plan/E2.md](docs/plan/E2.md). The text canvas, epic E3, was dropped on 2026-10-25: canvas builds no text canvas. Epic E4, taken the same day, built the sheet for the product: the eraser and the history of writing, the layers and the grid, the groups of strokes and the crop for checking, the tutor's marks tied to the strokes, the package's full interface and the input on tablets. It was done on 2026-10-26 and is archived in [docs/plan/E4.md](docs/plan/E4.md). Epic E6, taken the same day, detailed and built the workbook, the first slice's second canvas kind, for school maths in grade 3, and was done on 2026-10-27; it is archived in [docs/plan/E6.md](docs/plan/E6.md). Epic E7, taken the same day, took what spec v0.2.42 brought: the task's new open fields, the exit condition that every answer slot holds something — `filled` on a sheet too — and the lesson's worked example, shown on a sheet the learner does not write on. On the way canvas moved to spec v0.4.1, whose npm package gives the types of the module format. E7 was done on 2026-11-01 and is archived in [docs/plan/E7.md](docs/plan/E7.md). Epic E8, taken the same day, is the first release of the package, which spec's cross-repository plan asks for before the app's code; the tests' coverage and the release's build come first. Then canvas moved to spec v0.6.2, of spec's 0.6 line, and its CI now checks the signature of each package of `@altnovatrail` in its lock file, as spec's rules ask; then the element took the module format 0.2 and the types of its contract with the app from spec's npm package, and the package came out in its first release, v0.1.0; from the next one on, the release puts it in npm itself. E8 was done on 2026-11-02 and is archived in [docs/plan/E8.md](docs/plan/E8.md). The same day canvas moved to spec v0.6.5, which made the `media` property part of the element's contract with the app and gave the buttons of every NovaTrail interface package one set of icons, and epic E5, the samples page, was taken: first trying a build opened from a file on the devices and building the page. On 2026-11-08 canvas moved to spec v0.9.8, whose eval protocol now holds the sample file, its markup and the rules the sheet shares with tutor's eval runner — the groups of strokes, the crop, the snapping of a model's box and a workbook's boxes: the tests hold the sheet's code to spec's test vectors of those rules, and the types of the tutor's marks are spec's too. The synthetic samples that tutor's CI reads come first now, then the page. So far there is the package, `@altnovatrail/canvas`, with its tools and the sheet's input: the element takes a pen, a finger or a mouse, one pointer at a time, and draws the strokes, and its methods `undo()` and `clear()` undo the last action and clear the sheet. Its eraser, E4's first task, takes strokes off whole along the path of a press: the element's `tool` switches to it, and a pen's eraser erases whatever the tool, if the task allows the eraser. The sheet keeps the history of writing — every stroke, erasing, clearing and undo, at the sheet's time — for the app to keep. The sheet is a stack of layers, in the order of spec's canvas layers: its task, the element's `task` property, rules it in squares, lines or dots, and the task's statement stands above the sheet, its pictures from the consumer's `media`. The task and the module's manifest come in the types of spec's npm package, `@altnovatrail/spec`; the element reads the module format 0.2, which spec v0.6.0 brought — a manifest of another version is a TypeError — and the task is checked as its schema checks it, a field it does not know a TypeError; what the statement gives and asks, the fields `givens` and `unknown`, the element takes and leaves for the app to show; a workbook's task the element shows too: its lines laid out on a page the size of the sheet — numbers, text fitted to the layout's own widths, and boxes, up to ten rows — which a screen reader reads as a list. On a workbook each stroke falls in one box or in none, by a rule in integers on the middle of its points' box; what falls in no box is draft, which stays on the page and goes to no check, and the property `filled` tells which boxes hold writing, and on a sheet whether its one answer anywhere on it, or the whole sheet, does. The module's manifest, the `manifest` property, gives the height of a digit on the crop, 24 px unless it gives another, as without a manifest, and the language of the statement. The sheet is at most 1000 CSS pixels wide, and the consumer themes it by custom properties. The DOM-free part parts the strokes into groups by place and time — two strokes no more than 2 seconds apart whose boxes come within a cell of each other are neighbours, and a chain of neighbours is a group — labels the groups A, B, C… by place and gives each one's rectangle on the sheet, for the crop, the tutor's marks and the samples to come; the rule's test vectors are a proposal for the eval protocol. It also draws the crop for checking, with its own raster and PNG encoder: the ink of the visible strokes, scaled so that the writing comes out at the digit height the module's manifest asks for, within the size every Claude model takes as it is, with the groups' frames in its fractions. Its test vectors go to the eval protocol too. The element takes the tutor's marks of a submission back by its property `marks`, with the context it is to give with the crop: a mark holds on to the learner's strokes — a group's, or those a model's box on the crop takes, two thirds of their points within a quarter of a digit of it — and a frame stands round those of them the sheet shows, over the work, read by its name and fading while the learner writes into it. The history goes out by the property `history` and the event `historychange`, which tells of every action with the events it adds, and comes back by the same property: the same history changes nothing, and another, one the sheet could have written, replaces the sheet, undo and all. The pictures' files come from the consumer's `media`, a function that gives a file's Blob by its reference, the contract's own. `exportWork()` gives the work for checking: the PNG of the crop and the context of its submission, which the app keeps and gives back with the tutor's marks, its digest telling the sheet's own context from another sheet's. On a workbook it gives the crop of each filled box, with its item and slot, and the context of the table of boxes; a tutor's mark there stands on an answer cell by its place and frames the box with its ink. Above the statement and the sheet, outside their scrolling, stands the element's own row of buttons — the pen and the eraser the task allows, undo and clear — a toolbar worked by pointer and by keyboard, labelled in English or Russian by the element's own `lang`, each label after an icon of Material Symbols, Google's set, which the build embeds, so the element asks no network for one and the package's NOTICE names it; a `toolchange` event tells of the learner's choice of tool. On a tablet a pen's touch puts the whole page in pen mode, where a finger writes nothing until the row's Draw with finger lets it write again; a touch wider or taller than 100 CSS pixels is a palm and writes nothing, and two fingers scroll the sheet. The row's Up and Down scroll it the same way with a single pointer, on any device, by four fifths of what is in sight. A lesson's worked example comes by the property `workedExample`, in place of a task: its statement stands above the sheet and its grid on it, but the learner does not write there — a finger or a pen scrolls the sheet as the browser scrolls the statement, and the row, named Worked example, has Next, Demo, Up and Down. Next opens the parts of the author's demo one at a time, into a numbered list above the sheet that a polite region tells a screen reader of, and Demo hides the whole demo and shows it again; the property `demoState` and the event `demochange` tell the app how far the learner has gone, and the app may give it back to a new element after the example — in React's JSX `workedExample` comes before `demoState`, and `ondemochange` listens. The pictures of the demo come from the consumer's `media` with the statement's, one file for each reference, all of them as the example comes, so that a part opened shows its picture at once; a picture on an area of the sheet stands on the sheet itself, stretched over its area, and the sheet scrolls to it as its part opens. The element now waits for the app and the samples page; a test plays the app's part, and `just demo` serves a page to try the element on by hand. A release comes out by itself after CI passes on `main`, when a path it is built from has changed: the package's archive, with its NOTICE, LICENSE and their sums, built, signed and checked by .github's shared release, and the same archive goes to npm: the first version by hand, the later ones by the release's own npm step, through trusted publishing, with no long-lived token. A pull request from a branch of this repository tries the release and publishes nothing.
24
+ Code started. The detailing is done — epic E1, archived in [docs/plan/E1.md](docs/plan/E1.md). Epic E2, replanned for the MVP on 2026-10-22, built the handwriting sheet as the element `<novatrail-canvas>`, for tutor's check board to take in place of its own sheet; the board has decided to keep its own. Its last task was the author's try of the sheet by hand on the demo page, which found nothing to fix. E2 is done and archived in [docs/plan/E2.md](docs/plan/E2.md). The text canvas, epic E3, was dropped on 2026-10-25: canvas builds no text canvas. Epic E4, taken the same day, built the sheet for the product: the eraser and the history of writing, the layers and the grid, the groups of strokes and the crop for checking, the tutor's marks tied to the strokes, the package's full interface and the input on tablets. It was done on 2026-10-26 and is archived in [docs/plan/E4.md](docs/plan/E4.md). Epic E6, taken the same day, detailed and built the workbook, the first slice's second canvas kind, for school maths in grade 3, and was done on 2026-10-27; it is archived in [docs/plan/E6.md](docs/plan/E6.md). Epic E7, taken the same day, took what spec v0.2.42 brought: the task's new open fields, the exit condition that every answer slot holds something — `filled` on a sheet too — and the lesson's worked example, shown on a sheet the learner does not write on. On the way canvas moved to spec v0.4.1, whose npm package gives the types of the module format. E7 was done on 2026-11-01 and is archived in [docs/plan/E7.md](docs/plan/E7.md). Epic E8, taken the same day, is the first release of the package, which spec's cross-repository plan asks for before the app's code; the tests' coverage and the release's build come first. Then canvas moved to spec v0.6.2, of spec's 0.6 line, and its CI now checks the signature of each package of `@altnovatrail` in its lock file, as spec's rules ask; then the element took the module format 0.2 and the types of its contract with the app from spec's npm package, and the package came out in its first release, v0.1.0; from the next one on, the release puts it in npm itself. E8 was done on 2026-11-02 and is archived in [docs/plan/E8.md](docs/plan/E8.md). The same day canvas moved to spec v0.6.5, which made the `media` property part of the element's contract with the app and gave the buttons of every NovaTrail interface package one set of icons, and epic E5, the samples page, was taken: first trying a build opened from a file on the devices and building the page. On 2026-11-08 canvas moved to spec v0.9.8, whose eval protocol now holds the sample file, its markup and the rules the sheet shares with tutor's eval runner — the groups of strokes, the crop, the snapping of a model's box and a workbook's boxes: the tests hold the sheet's code to spec's test vectors of those rules, and the types of the tutor's marks are spec's too. The synthetic samples that tutor's CI reads come first now, then the page. So far there is the package, `@altnovatrail/canvas`, with its tools and the sheet's input: the element takes a pen, a finger or a mouse, one pointer at a time, and draws the strokes, and its methods `undo()` and `clear()` undo the last action and clear the sheet. Its eraser, E4's first task, takes strokes off whole along the path of a press: the element's `tool` switches to it, and a pen's eraser erases whatever the tool, if the task allows the eraser. The sheet keeps the history of writing — every stroke, erasing, clearing and undo, at the sheet's time — for the app to keep. The sheet is a stack of layers, in the order of spec's canvas layers: its task, the element's `task` property, rules it in squares, lines or dots, and the task's statement stands above the sheet, its pictures from the consumer's `media`. The task and the module's manifest come in the types of spec's npm package, `@altnovatrail/spec`; the element reads the module format 0.3, which spec v0.9.0 brought and in which the modules' first release came out — a manifest of another version, 0.2 too, is a TypeError — and the task is checked as its schema checks it, a field it does not know a TypeError; what the statement gives and asks, the fields `givens` and `unknown`, the element takes and leaves for the app to show; a workbook's task the element shows too: its lines laid out on a page the size of the sheet — numbers, text fitted to the layout's own widths, and boxes, up to ten rows — which a screen reader reads as a list. On a workbook each stroke falls in one box or in none, by a rule in integers on the middle of its points' box; what falls in no box is draft, which stays on the page and goes to no check, and the property `filled` tells which boxes hold writing, and on a sheet whether its one answer anywhere on it, or the whole sheet, does. The module's manifest, the `manifest` property, gives the height of a digit on the crop, 24 px unless it gives another, as without a manifest, and the language of the statement. The sheet is at most 1000 CSS pixels wide, and the consumer themes it by custom properties. The DOM-free part parts the strokes into groups by place and time — two strokes no more than 2 seconds apart whose boxes come within a cell of each other are neighbours, and a chain of neighbours is a group — labels the groups A, B, C… by place and gives each one's rectangle on the sheet, for the crop, the tutor's marks and the samples to come; the rule's test vectors are a proposal for the eval protocol. It also draws the crop for checking, with its own raster and PNG encoder: the ink of the visible strokes, scaled so that the writing comes out at the digit height the module's manifest asks for, within the size every Claude model takes as it is, with the groups' frames in its fractions. Its test vectors go to the eval protocol too. The element takes the tutor's marks of a submission back by its property `marks`, with the context it is to give with the crop: a mark holds on to the learner's strokes — a group's, or those a model's box on the crop takes, two thirds of their points within a quarter of a digit of it — and a frame stands round those of them the sheet shows, over the work, read by its name and fading while the learner writes into it. The history goes out by the property `history` and the event `historychange`, which tells of every action with the events it adds, and comes back by the same property: the same history changes nothing, and another, one the sheet could have written, replaces the sheet, undo and all. The pictures' files come from the consumer's `media`, a function that gives a file's Blob by its reference, the contract's own. `exportWork()` gives the work for checking: the PNG of the crop and the context of its submission, which the app keeps and gives back with the tutor's marks, its digest telling the sheet's own context from another sheet's. On a workbook it gives the crop of each filled box, with its item and slot, and the context of the table of boxes; a tutor's mark there stands on an answer cell by its place and frames the box with its ink. Above the statement and the sheet, outside their scrolling, stands the element's own row of buttons — the pen and the eraser the task allows, undo and clear — a toolbar worked by pointer and by keyboard, labelled in English or Russian by the element's own `lang`, each label after an icon of Material Symbols, Google's set, which the build embeds, so the element asks no network for one and the package's NOTICE names it; a `toolchange` event tells of the learner's choice of tool. On a tablet a pen's touch puts the whole page in pen mode, where a finger writes nothing until the row's Draw with finger lets it write again; a touch wider or taller than 100 CSS pixels is a palm and writes nothing, and two fingers scroll the sheet. The row's Up and Down scroll it the same way with a single pointer, on any device, by four fifths of what is in sight. A lesson's worked example comes by the property `workedExample`, in place of a task: its statement stands above the sheet and its grid on it, but the learner does not write there — a finger or a pen scrolls the sheet as the browser scrolls the statement, and the row, named Worked example, has Next, Demo, Up and Down. Next opens the parts of the author's demo one at a time, into a numbered list above the sheet that a polite region tells a screen reader of, and Demo hides the whole demo and shows it again; the property `demoState` and the event `demochange` tell the app how far the learner has gone, and the app may give it back to a new element after the example — in React's JSX `workedExample` comes before `demoState`, and `ondemochange` listens. The pictures of the demo come from the consumer's `media` with the statement's, one file for each reference, all of them as the example comes, so that a part opened shows its picture at once; a picture on an area of the sheet stands on the sheet itself, stretched over its area, and the sheet scrolls to it as its part opens. The element now waits for the app and the samples page; a test plays the app's part, and `just demo` serves a page to try the element on by hand. A release comes out by itself after CI passes on `main`, when a path it is built from has changed: the package's archive, with its NOTICE, LICENSE and their sums, built, signed and checked by .github's shared release, and the same archive goes to npm: the first version by hand, the later ones by the release's own npm step, through trusted publishing, with no long-lived token. A pull request from a branch of this repository tries the release and publishes nothing.
25
25
 
26
26
  ## Install
27
27
 
@@ -1,8 +1,10 @@
1
1
  /**
2
2
  * The version of the module format the element reads: while the format is v0, the platform reads
3
- * its current version alone, and a module of another is refused with the reason (R44 spec).
3
+ * its current version alone, and a module of another — 0.2 too — is refused with the reason (R44
4
+ * spec; README of the format, §2). The format's rules of a module's versions are module-kit's and
5
+ * api's: the element compares none (R32).
4
6
  */
5
- export declare const FORMAT = "0.2";
7
+ export declare const FORMAT = "0.3";
6
8
  /** The open view of a module's manifest, whole: spec's type (R73 spec). */
7
9
  export type { Manifest } from "@altnovatrail/spec/formatv0/open";
8
10
  /**
@@ -10,9 +10,11 @@ import { CROP } from "./crop.js";
10
10
  import { closed, record, shown, whole } from "./fields.js";
11
11
  /**
12
12
  * The version of the module format the element reads: while the format is v0, the platform reads
13
- * its current version alone, and a module of another is refused with the reason (R44 spec).
13
+ * its current version alone, and a module of another — 0.2 too — is refused with the reason (R44
14
+ * spec; README of the format, §2). The format's rules of a module's versions are module-kit's and
15
+ * api's: the element compares none (R32).
14
16
  */
15
- export const FORMAT = "0.2";
17
+ export const FORMAT = "0.3";
16
18
  /** The settings without a manifest: digits of 24 px, and the element's own language. */
17
19
  export const NO_MANIFEST = Object.freeze({ digit: CROP.digit, lang: undefined });
18
20
  /**
package/lib/core/task.js CHANGED
@@ -1,4 +1,4 @@
1
- // The open view of a task of the module format 0.2 (R51 spec). What a consumer gives is of spec's
1
+ // The open view of a task of the module format 0.3 (R51 spec). What a consumer gives is of spec's
2
2
  // type, from its npm package at the version of the spec/ submodule (R73 spec; R41), with one field
3
3
  // of the element's own, `canvas.tools`, until the format has one (R28). 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
@@ -46,7 +46,7 @@ export declare class NovatrailCanvas extends HTMLElement implements CanvasElemen
46
46
  get tool(): Tool;
47
47
  set tool(tool: Tool);
48
48
  /**
49
- * The open view of the task, of the module format 0.2 (R32): its ID, its statement, which the
49
+ * The open view of the task, of the module format 0.3 (R32): its ID, its statement, which the
50
50
  * element shows above the page (R23), what the statement gives and asks, which app shows (R57
51
51
  * spec), its canvas — the kind, the sheet's grid and the tools the task allows (R28) — and its
52
52
  * items. A workbook's items are its lines, which the template shows, laid out on the page (R35,
@@ -63,7 +63,7 @@ export declare class NovatrailCanvas extends HTMLElement implements CanvasElemen
63
63
  set task(task: Task | undefined);
64
64
  /**
65
65
  * A lesson's worked example (R42; R58 spec): the open view of a segment `worked_example` of the
66
- * module format 0.2 — its statement, which the element shows above the sheet as a task's (R23),
66
+ * module format 0.3 — its statement, which the element shows above the sheet as a task's (R23),
67
67
  * the grid of its sheet, and the parts of the author's demo. The type is spec's (R73 spec; R41).
68
68
  * The element shows a task or a worked example, not both: an example while a task is given, while
69
69
  * the sheet has a history of writing, or while a stroke or an erasing is under way, is a
@@ -99,7 +99,7 @@ export declare class NovatrailCanvas extends HTMLElement implements CanvasElemen
99
99
  set demoState(state: DemoState | undefined);
100
100
  /**
101
101
  * The open view of the module's manifest (R32), of which the element reads the version of the
102
- * module format — "0.2", or the manifest is a TypeError (R44 spec) — the height of a digit on the
102
+ * module format — "0.3", or the manifest is a TypeError (R44 spec) — the height of a digit on the
103
103
  * crop for checking, `canvas.digit_height`, 24 px unless given, and the explanation language, the
104
104
  * statement's and a workbook's lines'. Without a manifest the digits are 24 px, and the statement
105
105
  * and the lines are in the element's own `lang`. The rest of it the element passes over, but for
@@ -12,7 +12,7 @@
12
12
  // clearing — labelled in the element's `lang` (T41; R28). On a tablet a pen's touch puts the page
13
13
  // in pen mode, where a finger writes nothing and a button lets it write again, a palm writes
14
14
  // nothing, and two fingers scroll (T35; R29). The task comes in the names of the module format
15
- // 0.2, checked as its schema checks it, and the module's manifest gives the height of a digit and
15
+ // 0.3, checked as its schema checks it, and the module's manifest gives the height of a digit and
16
16
  // the statement's language (T44; R32). Up and Down in the row scroll what two fingers would, with
17
17
  // a single pointer (T45; R33). The workbook's lines, laid out on its page, stand on the template in
18
18
  // place of the grid — numbers, text and boxes, which a screen reader reads in the task's order (T51;
@@ -530,7 +530,7 @@ export class NovatrailCanvas extends HTMLElement {
530
530
  this.#refresh();
531
531
  }
532
532
  /**
533
- * The open view of the task, of the module format 0.2 (R32): its ID, its statement, which the
533
+ * The open view of the task, of the module format 0.3 (R32): its ID, its statement, which the
534
534
  * element shows above the page (R23), what the statement gives and asks, which app shows (R57
535
535
  * spec), its canvas — the kind, the sheet's grid and the tools the task allows (R28) — and its
536
536
  * items. A workbook's items are its lines, which the template shows, laid out on the page (R35,
@@ -560,7 +560,7 @@ export class NovatrailCanvas extends HTMLElement {
560
560
  }
561
561
  /**
562
562
  * A lesson's worked example (R42; R58 spec): the open view of a segment `worked_example` of the
563
- * module format 0.2 — its statement, which the element shows above the sheet as a task's (R23),
563
+ * module format 0.3 — its statement, which the element shows above the sheet as a task's (R23),
564
564
  * the grid of its sheet, and the parts of the author's demo. The type is spec's (R73 spec; R41).
565
565
  * The element shows a task or a worked example, not both: an example while a task is given, while
566
566
  * the sheet has a history of writing, or while a stroke or an erasing is under way, is a
@@ -640,7 +640,7 @@ export class NovatrailCanvas extends HTMLElement {
640
640
  }
641
641
  /**
642
642
  * The open view of the module's manifest (R32), of which the element reads the version of the
643
- * module format — "0.2", or the manifest is a TypeError (R44 spec) — the height of a digit on the
643
+ * module format — "0.3", or the manifest is a TypeError (R44 spec) — the height of a digit on the
644
644
  * crop for checking, `canvas.digit_height`, 24 px unless given, and the explanation language, the
645
645
  * statement's and a workbook's lines'. Without a manifest the digits are 24 px, and the statement
646
646
  * and the lines are in the element's own `lang`. The rest of it the element passes over, but for
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altnovatrail/canvas",
3
- "version": "0.1.7",
3
+ "version": "0.2.0",
4
4
  "description": "NovaTrail's canvases: the workplace of a task, where the learner writes, draws and types.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {