@altnovatrail/canvas 0.3.41 → 0.3.43

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.
@@ -4,6 +4,7 @@ import { type DemoState, type WorkedExample } from "../core/example.js";
4
4
  import { type HistoryEvent } from "../core/history.js";
5
5
  import { type Manifest } from "../core/manifest.js";
6
6
  import { type Marks } from "../core/marks.js";
7
+ import { type PenSettings } from "../core/style.js";
7
8
  import { type Task, type Tool } from "../core/task.js";
8
9
  /**
9
10
  * The types of the contract of canvas and app are spec's: the element as
@@ -13,13 +14,13 @@ import { type Task, type Tool } from "../core/task.js";
13
14
  * media and the tutor's marks too. The crop and a task with its temporary tools are the element's
14
15
  * own.
15
16
  */
16
- export type { Box, CanvasElement, CanvasEventMap, DemoChangeEvent, ExportedCell, ExportedPaper, ExportedSheet, ExportedWork, ExportedWorkbook, GridChange, GridChangeEvent, HistoryChange, HistoryChangeEvent, Media, PaperGrid, PaperTask, ToolChange, ToolChangeEvent, TracingChangeEvent, TracingReadEvent, TracingReading, TracingState, } from "@altnovatrail/spec/canvas";
17
+ export type { Box, CanvasElement, CanvasEventMap, DemoChangeEvent, EraserMode, ExportedCell, ExportedPaper, ExportedSheet, ExportedWork, ExportedWorkbook, GridChange, GridChangeEvent, HistoryChange, HistoryChangeEvent, Media, PaperGrid, PaperTask, PenChangeEvent, PenKind, PenSettings, StrokeStyle, ToolChange, ToolChangeEvent, TracingChangeEvent, TracingReadEvent, TracingReading, TracingState, } from "@altnovatrail/spec/canvas";
17
18
  export type { Filled, Filling } from "../core/boxes.js";
18
19
  export type { Crop, Frame } from "../core/crop.js";
19
20
  export type { DemoState, WorkedExample } from "../core/example.js";
20
21
  export type { GridKind } from "../core/grid.js";
21
22
  export type { Group } from "../core/groups.js";
22
- export type { HistoryEvent } from "../core/history.js";
23
+ export type { HistoryEvent, Piece } from "../core/history.js";
23
24
  export type { InkPoint, Stroke } from "../core/ink.js";
24
25
  export type { Manifest } from "../core/manifest.js";
25
26
  export type { Anchor, CellPlace, CropNumbers, Mark, Marks, PaperSubmission, SheetSubmission, Submission, WorkbookSubmission, } from "../core/marks.js";
@@ -33,8 +34,23 @@ export declare const TAG = "novatrail-canvas";
33
34
  export declare class NovatrailCanvas extends HTMLElement implements CanvasElement {
34
35
  #private;
35
36
  constructor();
36
- /** The element follows its own `lang`: its buttons are labelled in it. */
37
+ /**
38
+ * The element follows its own `lang`, its buttons labelled in it, `tools-hidden`, and
39
+ * `unstyled`, under which the strokes take no style.
40
+ */
37
41
  static readonly observedAttributes: string[];
42
+ /**
43
+ * The settings of the pen and the eraser, frozen: canvas's as the element comes — a pen, black
44
+ * and three units wide, a blue liner, a yellow marker, and an eraser of strokes whole, 16 units
45
+ * across. The learner changes them in the popovers of the pen and the eraser, which a `penchange`
46
+ * tells; the consumer keeps them and gives them back to the next element, which tells nothing.
47
+ * The next stroke takes the style of the kind in use, and the eraser its mode and its size: a
48
+ * stroke written keeps its own. Settings not of `PenSettings` are a TypeError that names the
49
+ * field, and leave the settings as they were; `undefined` changes nothing. Under the attribute
50
+ * `unstyled` they are kept and given all the same, and the strokes take none of them.
51
+ */
52
+ get pens(): PenSettings;
53
+ set pens(settings: PenSettings | undefined);
38
54
  /**
39
55
  * What a press of the primary button does: "pen" writes, as the element starts, "eraser" erases,
40
56
  * and "hand" moves the sheet, under any pointer. The learner switches it with the
@@ -224,7 +240,9 @@ export declare class NovatrailCanvas extends HTMLElement implements CanvasElemen
224
240
  * `tools-hidden` did: while the element has it, the bar is out of sight and of the accessibility
225
241
  * tree, as `app` hides it on a phone under its tutor's sheet. An attribute the
226
242
  * element had before it was defined comes here just after the constructor, which reads no
227
- * attribute.
243
+ * attribute. Or `unstyled` did: while the element has it, a stroke takes no style, 3 units wide
244
+ * in the theme's ink, no popover opens, and the eraser takes whole strokes as near as it
245
+ * always took them — the samples page writes so, while its texts say nothing of a style.
228
246
  */
229
247
  attributeChangedCallback(name: string): void;
230
248
  /**
@@ -259,17 +277,21 @@ export declare class NovatrailCanvas extends HTMLElement implements CanvasElemen
259
277
  * The picture of the work, for the `picture` of a stored work that app puts on the server, a
260
278
  * method of the agreement with app: the PNG of the strokes the surface shows,
261
279
  * with no condition — the sheet's page, or the workbook's whole page with its draft, and the ink
262
- * past the page, right and down, with the tracing paper where it lies: one pixel a unit,
263
- * 1000 × 1400 for the page alone, and scaled down past the page to hold no more pixels than it,
264
- * its size in its PNG's header —, whatever is filled and whether the work was sent to be checked
265
- * or not; an empty surface, and a worked example's, is white. The strokes are those
266
- * `exportWork()` takes, as the history has them: not the stroke under way, but those under an
267
- * eraser not yet lifted. Each is the outline the screen fills, black on white with no theme and
268
- * no template — on a task from paper the strokes of both layers, the tracing paper's where it
269
- * lies, hidden or not, with the crop's picture laid in grey and multiplied —, and the pixels go
270
- * through the crop's encoder, grey a byte each: so the picture looks as the sheet does, and holds
271
- * at most 1,576,640 bytes, for the encoder spends at most 9 bits on a byte of a row, under the 4
272
- * MiB of a stored work.
280
+ * past the page, right and down, with the tracing paper where it lies —, whatever is filled and
281
+ * whether the work was sent to be checked or not; an empty surface, and a worked example's, is
282
+ * white. The strokes are those `exportWork()` takes, as the history has them: not the stroke
283
+ * under way, but those under an eraser not yet lifted. Each is the outline the screen fills, on
284
+ * white with no theme and no template, in its style — its own colour, the palette's black too,
285
+ * at its opacity, a marker multiplied —, and a stroke without one black; on a task from paper
286
+ * the strokes of both layers, the tracing paper's where it lies, hidden or not, with the crop's
287
+ * picture laid in grey and multiplied. While every stroke is grey — black, and the palette's
288
+ * black, a hair off grey, among them —, the pixels
289
+ * are grey, a byte each, one pixel a unit, 1000 × 1400 for the page alone, and scaled down past
290
+ * the page to hold no more pixels than it; with a colour among them they are RGB, three bytes
291
+ * each, and scaled down to hold no more bytes. Its size is in its PNG's header. The pixels go
292
+ * through the crop's encoder: so the picture looks as the sheet does, and holds at most
293
+ * 1,576,640 bytes, for the encoder spends at most 9 bits on a byte of a row, under the 4 MiB of a
294
+ * stored work.
273
295
  */
274
296
  exportPicture(): Promise<Blob>;
275
297
  disconnectedCallback(): void;