@altnovatrail/spec 0.6.3 → 0.6.4
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 +2 -1
- package/canvas/index.d.ts +25 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,8 @@ function show(task: open.Task, manifest: open.Manifest) {
|
|
|
29
29
|
A field the object always holds is required, and any other is optional. That includes each field that only some branches of a schema give.
|
|
30
30
|
- **`@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.
|
|
31
31
|
- **`@altnovatrail/spec/canvas`** holds the types of `<novatrail-canvas>`:
|
|
32
|
-
- `CanvasElement`, which describes the element's properties `tool`, `task`, `workedExample`, `demoState`, `manifest`, `history` and `filled` and its method `exportWork()`;
|
|
32
|
+
- `CanvasElement`, which describes the element's properties `tool`, `task`, `workedExample`, `demoState`, `manifest`, `media`, `history` and `filled` and its method `exportWork()`;
|
|
33
|
+
- `Media`, the function by which the consumer gives the files of the pictures: the canvas goes to no network;
|
|
33
34
|
- the events `toolchange`, `historychange` and `demochange`, with `CanvasEventMap` naming them;
|
|
34
35
|
- the state of a worked example's demo, `DemoState`;
|
|
35
36
|
- the history of writing;
|
package/canvas/index.d.ts
CHANGED
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The types of the element `<novatrail-canvas>`: the contract of canvas and app (R36). The element
|
|
6
|
-
* takes a task and its module's manifest, and the learner's history of
|
|
7
|
-
* gives the work for checking by a method, and tells what the learner did
|
|
8
|
-
* task it may show a lesson's worked example, whose demo the learner opens
|
|
9
|
-
* buttons, and how far they have gone is a property and an event too. The
|
|
10
|
-
* the worked example and of the manifest are the module format's open views,
|
|
6
|
+
* takes a task and its module's manifest, the files of its pictures and the learner's history of
|
|
7
|
+
* writing, by properties; it gives the work for checking by a method, and tells what the learner did
|
|
8
|
+
* by events. In place of a task it may show a lesson's worked example, whose demo the learner opens
|
|
9
|
+
* part by part with its buttons, and how far they have gone is a property and an event too. The
|
|
10
|
+
* types of the task, of the worked example and of the manifest are the module format's open views,
|
|
11
|
+
* formatv0/open.
|
|
11
12
|
*
|
|
12
13
|
* The tutor's marks — the property `marks` and the types of a mark — wait for the contract of epic
|
|
13
|
-
* E3, and are canvas's own until then. The element's members beyond this contract
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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
|
|
17
|
+
* types: Blob, CustomEvent and HTMLElement.
|
|
16
18
|
*
|
|
17
19
|
* @packageDocumentation
|
|
18
20
|
*/
|
|
@@ -271,6 +273,13 @@ export interface CanvasEventMap {
|
|
|
271
273
|
demochange: DemoChangeEvent;
|
|
272
274
|
}
|
|
273
275
|
|
|
276
|
+
/**
|
|
277
|
+
* What gives the file of a picture by its reference, the picture's path from the module's media/
|
|
278
|
+
* folder: the consumer's, for the canvas goes to no network. app takes the files from the device
|
|
279
|
+
* part of the module's package, which api serves.
|
|
280
|
+
*/
|
|
281
|
+
export type Media = (ref: string) => Promise<Blob>;
|
|
282
|
+
|
|
274
283
|
/**
|
|
275
284
|
* The element `<novatrail-canvas>` as its contract with app has it. The language of its buttons is
|
|
276
285
|
* its own attribute `lang`.
|
|
@@ -314,6 +323,14 @@ export interface CanvasElement extends HTMLElement {
|
|
|
314
323
|
* TypeError.
|
|
315
324
|
*/
|
|
316
325
|
manifest: open.Manifest | undefined;
|
|
326
|
+
/**
|
|
327
|
+
* What gives the files of the pictures of the task or of the worked example — its statement's,
|
|
328
|
+
* and every part's of its demo — by their references. A reference is asked for once, however many
|
|
329
|
+
* pictures show it. Until a picture's file comes, or if it never does, its frame shows what it
|
|
330
|
+
* shows in words. A new function serves the references that have no file yet. Anything but a
|
|
331
|
+
* function or `undefined` is a TypeError.
|
|
332
|
+
*/
|
|
333
|
+
media: Media | undefined;
|
|
317
334
|
/**
|
|
318
335
|
* The history of writing: every stroke, erasing, clearing and undo on the sheet, frozen. The
|
|
319
336
|
* consumer keeps it, adding what `historychange` tells, and gives it back to open the sheet as it
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altnovatrail/spec",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
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.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|