@altnovatrail/canvas 0.3.24 → 0.3.26
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 +1 -1
- package/lib/core/hands.d.ts +11 -7
- package/lib/core/hands.js +30 -8
- package/lib/element/icons.d.ts +0 -36
- package/lib/element/icons.js +0 -44
- package/lib/element/index.d.ts +19 -4
- package/lib/element/index.js +222 -243
- package/lib/element/labels.d.ts +0 -6
- package/lib/element/labels.js +3 -10
- package/lib/element/tools.d.ts +35 -36
- package/lib/element/tools.js +277 -111
- package/package.json +1 -1
package/lib/element/labels.d.ts
CHANGED
|
@@ -21,15 +21,9 @@ export interface Labels {
|
|
|
21
21
|
readonly eraser: string;
|
|
22
22
|
readonly undo: string;
|
|
23
23
|
readonly clear: string;
|
|
24
|
-
/** The buttons that scroll the sheet back up and on down, with a single pointer (R33). */
|
|
25
|
-
readonly up: string;
|
|
26
|
-
readonly down: string;
|
|
27
24
|
/** The buttons of the page's zoom, a step larger and a step smaller (T94). */
|
|
28
25
|
readonly zoomIn: string;
|
|
29
26
|
readonly zoomOut: string;
|
|
30
|
-
/** The buttons that scroll a zoomed sheet left and right, with a single pointer (T94). */
|
|
31
|
-
readonly left: string;
|
|
32
|
-
readonly right: string;
|
|
33
27
|
/** The button that lets a finger write again, in pen mode (R29). */
|
|
34
28
|
readonly finger: string;
|
|
35
29
|
/** A box of a workbook's line, alone in it (R36). */
|
package/lib/element/labels.js
CHANGED
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
// - no label counts a thing, so none has forms of number yet. The first that does takes CLDR's
|
|
9
9
|
// categories, `other` always among them, chosen by `Intl.PluralRules` of the label's language;
|
|
10
10
|
// - no label tells the learner's gender (R70 spec) or speaks as the AI in the first person (П-15);
|
|
11
|
-
// - the buttons' words are those of the table of words of architecture 6 spec, the
|
|
12
|
-
// page's zoom
|
|
11
|
+
// - the buttons' words are those of the table of words of architecture 6 spec, the two of the
|
|
12
|
+
// page's zoom among them since spec took them by В76 (T94; Д219 spec); the four that scrolled the
|
|
13
|
+
// sheet left the row with their buttons (R84).
|
|
13
14
|
// This module is no entry point of the package.
|
|
14
15
|
/** The labels in English, the code's own language: those of any language the table has not. */
|
|
15
16
|
const ENGLISH = Object.freeze({
|
|
@@ -26,12 +27,8 @@ const ENGLISH = Object.freeze({
|
|
|
26
27
|
eraser: "Eraser",
|
|
27
28
|
undo: "Undo",
|
|
28
29
|
clear: "Clear",
|
|
29
|
-
up: "Up",
|
|
30
|
-
down: "Down",
|
|
31
30
|
zoomIn: "Zoom in",
|
|
32
31
|
zoomOut: "Zoom out",
|
|
33
|
-
left: "Left",
|
|
34
|
-
right: "Right",
|
|
35
32
|
finger: "Draw with finger",
|
|
36
33
|
box: "Box",
|
|
37
34
|
boxAt: "Box {slot}",
|
|
@@ -62,12 +59,8 @@ const LABELS = new Map([
|
|
|
62
59
|
eraser: "Ластик",
|
|
63
60
|
undo: "Отменить",
|
|
64
61
|
clear: "Очистить",
|
|
65
|
-
up: "Выше",
|
|
66
|
-
down: "Ниже",
|
|
67
62
|
zoomIn: "Крупнее",
|
|
68
63
|
zoomOut: "Мельче",
|
|
69
|
-
left: "Левее",
|
|
70
|
-
right: "Правее",
|
|
71
64
|
finger: "Рисовать пальцем",
|
|
72
65
|
box: "Окошко",
|
|
73
66
|
boxAt: "Окошко {slot}",
|
package/lib/element/tools.d.ts
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import type { Tool } from "../core/task.js";
|
|
2
2
|
/**
|
|
3
|
-
* What the
|
|
4
|
-
* clearing, a
|
|
5
|
-
*
|
|
6
|
-
* out of pen mode, and on a worked example the next part of its demo, or the whole demo hidden or
|
|
7
|
-
* shown (R42).
|
|
3
|
+
* What the bar asks of the element: a tool the learner chose — perhaps the one in use — an undo, a
|
|
4
|
+
* clearing, a step of the zoom, larger or smaller, the finger to write again, out of pen mode, and
|
|
5
|
+
* on a worked example the next part of its demo, or the whole demo hidden or shown (R42).
|
|
8
6
|
*/
|
|
9
7
|
export interface ToolActions {
|
|
10
8
|
readonly choose: (tool: Tool) => void;
|
|
11
9
|
readonly undo: () => void;
|
|
12
10
|
readonly clear: () => void;
|
|
13
|
-
readonly upOrDown: (onward: boolean) => void;
|
|
14
11
|
readonly zoom: (larger: boolean) => void;
|
|
15
|
-
readonly leftOrRight: (onward: boolean) => void;
|
|
16
12
|
readonly fingers: () => void;
|
|
17
13
|
readonly next: () => void;
|
|
18
14
|
readonly toggle: () => void;
|
|
@@ -24,13 +20,13 @@ export interface DemoControls {
|
|
|
24
20
|
/** The list of the open parts, which Demo hides and shows. */
|
|
25
21
|
readonly parts: string;
|
|
26
22
|
}
|
|
27
|
-
/** What the
|
|
23
|
+
/** What the bar is of, and is named by: a sheet, a workbook or a worked example (R36, R42). */
|
|
28
24
|
export type RowKind = "sheet" | "workbook" | "example";
|
|
29
25
|
/**
|
|
30
|
-
* What the
|
|
31
|
-
* clearing have anything to do, whether the zoom has a larger step and a smaller one,
|
|
32
|
-
*
|
|
33
|
-
*
|
|
26
|
+
* What the bar shows: what it is of, the tools the task allows, the one in use, whether undo and
|
|
27
|
+
* clearing have anything to do, whether the zoom has a larger step and a smaller one, whether the
|
|
28
|
+
* finger may be asked to write again, and on a worked example whether Next has a part to open and
|
|
29
|
+
* whether the demo is shown (R42).
|
|
34
30
|
*/
|
|
35
31
|
export interface ToolState {
|
|
36
32
|
readonly kind: RowKind;
|
|
@@ -44,38 +40,41 @@ export interface ToolState {
|
|
|
44
40
|
readonly opens: boolean;
|
|
45
41
|
readonly expanded: boolean;
|
|
46
42
|
}
|
|
47
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* How long a tooltip stays after the pointer leaves its button, in milliseconds: long enough for
|
|
45
|
+
* the pointer to cross the bar's edge and the gap onto the tooltip, which keeps it (WCAG 1.4.13).
|
|
46
|
+
*/
|
|
47
|
+
export declare const TIP_GRACE_MS = 200;
|
|
48
|
+
/** The element's own buttons, as the element shows them. */
|
|
48
49
|
export declare class Tools {
|
|
49
50
|
#private;
|
|
50
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* What the element puts beside its scroll container: the band the bar stands in the middle of,
|
|
53
|
+
* as wide as nothing, so that only the bar and its tooltip, which stand out of it, take a pointer,
|
|
54
|
+
* and as the element does: a consumer's pointer-events: none stops them too (R20, R28).
|
|
55
|
+
*/
|
|
56
|
+
readonly rail: HTMLDivElement;
|
|
57
|
+
/** The bar: a toolbar, named in the element's language. */
|
|
51
58
|
readonly element: HTMLDivElement;
|
|
59
|
+
/** A worked example's row: Next, Demo and the consumer's buttons in the slot `actions` (R84). */
|
|
60
|
+
readonly row: HTMLDivElement;
|
|
61
|
+
/** The tooltip of the button the pointer is over, or the keyboard's focus is on. */
|
|
62
|
+
readonly tip: HTMLDivElement;
|
|
52
63
|
constructor(actions: ToolActions, controls: DemoControls);
|
|
53
64
|
/**
|
|
54
|
-
* The
|
|
55
|
-
*
|
|
56
|
-
* Next, unavailable while the demo is hidden or open whole, and Demo, expanded while the demo
|
|
57
|
-
* shown (R42). Zoom in and Zoom out stand unavailable at their ends
|
|
58
|
-
*
|
|
59
|
-
*
|
|
65
|
+
* The bar as the sheet now is. Only what has changed is written. A worked example's has no tools
|
|
66
|
+
* of writing, no undo and no clearing, for the learner does not write on its sheet, and its row
|
|
67
|
+
* has Next, unavailable while the demo is hidden or open whole, and Demo, expanded while the demo
|
|
68
|
+
* is shown (R42). Zoom in and Zoom out stand unavailable at their ends (T94). The tool in use
|
|
69
|
+
* shows its icon filled, and Demo's icon points down while the demo is shown, and along the row
|
|
70
|
+
* while it is hidden (R46).
|
|
60
71
|
*/
|
|
61
72
|
show(state: ToolState): void;
|
|
62
73
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* changed is written.
|
|
66
|
-
*/
|
|
67
|
-
edges(above: boolean, below: boolean, before: boolean, after: boolean): void;
|
|
68
|
-
/**
|
|
69
|
-
* Whether the row sticks over what scrolls the element (R28): in a low window it stands in its
|
|
70
|
-
* place instead, above the statement, and scrolls away with it. The same state writes nothing:
|
|
71
|
-
* a token forced to what it is already changes no attribute.
|
|
72
|
-
*/
|
|
73
|
-
stick(sticks: boolean): void;
|
|
74
|
-
/** Whether the row sticks, or stands in its place in a low window. */
|
|
75
|
-
get sticks(): boolean;
|
|
76
|
-
/**
|
|
77
|
-
* The labels in the language of a tag — the element's `lang` — and the row's own `lang` theirs,
|
|
78
|
-
* so that a screen reader reads them in the language they are in.
|
|
74
|
+
* The labels in the language of a tag — the element's `lang` — and the bar's own `lang` theirs,
|
|
75
|
+
* so that a screen reader reads them in the language they are in, and the tooltip too.
|
|
79
76
|
*/
|
|
80
77
|
label(tag: string | null): void;
|
|
78
|
+
/** The element left the page: a tooltip goes with it, and Escape is no longer heard. */
|
|
79
|
+
disconnect(): void;
|
|
81
80
|
}
|