@altnovatrail/canvas 0.3.42 → 0.3.44
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/lib/core/crop.d.ts +17 -2
- package/lib/core/crop.js +45 -17
- package/lib/core/cut.d.ts +46 -0
- package/lib/core/cut.js +297 -0
- package/lib/core/eraser.d.ts +27 -9
- package/lib/core/eraser.js +32 -10
- package/lib/core/history.d.ts +21 -15
- package/lib/core/history.js +234 -28
- package/lib/core/index.d.ts +2 -1
- package/lib/core/index.js +3 -2
- package/lib/core/outline.d.ts +13 -3
- package/lib/core/outline.js +110 -11
- package/lib/core/png.d.ts +4 -3
- package/lib/core/png.js +15 -10
- package/lib/core/raster.d.ts +20 -9
- package/lib/core/raster.js +121 -35
- package/lib/core/recorder.d.ts +13 -2
- package/lib/core/recorder.js +20 -4
- package/lib/core/sheet.d.ts +3 -2
- package/lib/core/sheet.js +6 -4
- package/lib/core/style.d.ts +54 -0
- package/lib/core/style.js +146 -0
- package/lib/core/submission.js +4 -3
- package/lib/core/tracing.d.ts +6 -4
- package/lib/core/tracing.js +15 -7
- package/lib/core/work.d.ts +40 -11
- package/lib/core/work.js +106 -15
- package/lib/element/index.d.ts +37 -15
- package/lib/element/index.js +412 -70
- package/lib/element/labels.d.ts +42 -0
- package/lib/element/labels.js +73 -3
- package/lib/element/pens.d.ts +55 -0
- package/lib/element/pens.js +676 -0
- package/lib/element/tools.d.ts +9 -0
- package/lib/element/tools.js +77 -9
- package/package.json +3 -3
package/lib/element/labels.d.ts
CHANGED
|
@@ -70,6 +70,48 @@ export interface Labels {
|
|
|
70
70
|
readonly valued: string;
|
|
71
71
|
/** The part of a demo the element tells of, {n}, of so many, {total}. */
|
|
72
72
|
readonly part: string;
|
|
73
|
+
/** What the pen and the eraser on the bar say of a second press, while chosen. */
|
|
74
|
+
readonly settingsHint: string;
|
|
75
|
+
/** The popovers of the pen and of the eraser. */
|
|
76
|
+
readonly penSettings: string;
|
|
77
|
+
readonly eraserSettings: string;
|
|
78
|
+
/** The kinds of pen, and their group. */
|
|
79
|
+
readonly kindPen: string;
|
|
80
|
+
readonly kindLiner: string;
|
|
81
|
+
readonly kindMarker: string;
|
|
82
|
+
readonly penKind: string;
|
|
83
|
+
/** The widths of the pen, their group and each, {n} of so many, {total}. */
|
|
84
|
+
readonly widths: string;
|
|
85
|
+
readonly widthAt: string;
|
|
86
|
+
/** The opacity's slider, and its value, {percent}. */
|
|
87
|
+
readonly opacity: string;
|
|
88
|
+
readonly percent: string;
|
|
89
|
+
/** The colours, their group, the palette's five and the disclosure of the others. */
|
|
90
|
+
readonly colour: string;
|
|
91
|
+
readonly black: string;
|
|
92
|
+
readonly blue: string;
|
|
93
|
+
readonly green: string;
|
|
94
|
+
readonly yellow: string;
|
|
95
|
+
readonly red: string;
|
|
96
|
+
readonly otherColours: string;
|
|
97
|
+
readonly grey: string;
|
|
98
|
+
readonly purple: string;
|
|
99
|
+
readonly orange: string;
|
|
100
|
+
readonly teal: string;
|
|
101
|
+
readonly pink: string;
|
|
102
|
+
readonly brown: string;
|
|
103
|
+
readonly skyBlue: string;
|
|
104
|
+
readonly lightGreen: string;
|
|
105
|
+
readonly amber: string;
|
|
106
|
+
readonly violet: string;
|
|
107
|
+
readonly scarlet: string;
|
|
108
|
+
readonly white: string;
|
|
109
|
+
/** The eraser's modes and their heading, and its sizes, their heading and each. */
|
|
110
|
+
readonly wholeStroke: string;
|
|
111
|
+
readonly partly: string;
|
|
112
|
+
readonly whatToErase: string;
|
|
113
|
+
readonly size: string;
|
|
114
|
+
readonly sizeAt: string;
|
|
73
115
|
}
|
|
74
116
|
/** Every language the table has, by its tag: the tests hold each to English's places. */
|
|
75
117
|
export declare const LANGUAGES: readonly string[];
|
package/lib/element/labels.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// The labels of the element's own buttons, of
|
|
2
|
-
//
|
|
3
|
-
// rules of the packages' translations:
|
|
1
|
+
// The labels of the element's own buttons, of the popovers of the pen and the eraser, of a
|
|
2
|
+
// workbook's boxes and of the parts of a worked example's demo, in the languages of the
|
|
3
|
+
// interface, English and Russian, by the shared rules of the packages' translations:
|
|
4
4
|
// - the language is the element's own `lang`, looked up as RFC 4647 does it, and English stands for
|
|
5
5
|
// any other, under a `lang` of its own;
|
|
6
6
|
// - a label with a number or a word in it is one string with named places, «Часть {n} из {total}.»,
|
|
@@ -53,6 +53,41 @@ const ENGLISH = Object.freeze({
|
|
|
53
53
|
filled: "{name}, filled",
|
|
54
54
|
valued: "{name}: {value}",
|
|
55
55
|
part: "Part {n} of {total}.",
|
|
56
|
+
settingsHint: "Press again for settings",
|
|
57
|
+
penSettings: "Pen settings",
|
|
58
|
+
eraserSettings: "Eraser settings",
|
|
59
|
+
kindPen: "Pen",
|
|
60
|
+
kindLiner: "Liner",
|
|
61
|
+
kindMarker: "Marker",
|
|
62
|
+
penKind: "Kind of pen",
|
|
63
|
+
widths: "Width",
|
|
64
|
+
widthAt: "Width {n} of {total}",
|
|
65
|
+
opacity: "Opacity",
|
|
66
|
+
percent: "{percent}%",
|
|
67
|
+
colour: "Colour",
|
|
68
|
+
black: "Black",
|
|
69
|
+
blue: "Blue",
|
|
70
|
+
green: "Green",
|
|
71
|
+
yellow: "Yellow",
|
|
72
|
+
red: "Red",
|
|
73
|
+
otherColours: "Other colours",
|
|
74
|
+
grey: "Grey",
|
|
75
|
+
purple: "Purple",
|
|
76
|
+
orange: "Orange",
|
|
77
|
+
teal: "Teal",
|
|
78
|
+
pink: "Pink",
|
|
79
|
+
brown: "Brown",
|
|
80
|
+
skyBlue: "Sky blue",
|
|
81
|
+
lightGreen: "Light green",
|
|
82
|
+
amber: "Amber",
|
|
83
|
+
violet: "Violet",
|
|
84
|
+
scarlet: "Scarlet",
|
|
85
|
+
white: "White",
|
|
86
|
+
wholeStroke: "Whole stroke",
|
|
87
|
+
partly: "Partly",
|
|
88
|
+
whatToErase: "What to erase",
|
|
89
|
+
size: "Size",
|
|
90
|
+
sizeAt: "Size {n} of {total}",
|
|
56
91
|
});
|
|
57
92
|
/**
|
|
58
93
|
* The labels by language, each a language tag in lower case. A map, not an object: a tag such as
|
|
@@ -103,6 +138,41 @@ const LABELS = new Map([
|
|
|
103
138
|
filled: "{name}, заполнено",
|
|
104
139
|
valued: "{name}: {value}",
|
|
105
140
|
part: "Часть {n} из {total}.",
|
|
141
|
+
settingsHint: "Нажмите ещё раз — настройки",
|
|
142
|
+
penSettings: "Настройки пера",
|
|
143
|
+
eraserSettings: "Настройки ластика",
|
|
144
|
+
kindPen: "Ручка",
|
|
145
|
+
kindLiner: "Линер",
|
|
146
|
+
kindMarker: "Маркер",
|
|
147
|
+
penKind: "Вид пера",
|
|
148
|
+
widths: "Толщина",
|
|
149
|
+
widthAt: "Толщина {n} из {total}",
|
|
150
|
+
opacity: "Непрозрачность",
|
|
151
|
+
percent: "{percent} %",
|
|
152
|
+
colour: "Цвет",
|
|
153
|
+
black: "Чёрный",
|
|
154
|
+
blue: "Синий",
|
|
155
|
+
green: "Зелёный",
|
|
156
|
+
yellow: "Жёлтый",
|
|
157
|
+
red: "Красный",
|
|
158
|
+
otherColours: "Другие цвета",
|
|
159
|
+
grey: "Серый",
|
|
160
|
+
purple: "Фиолетовый",
|
|
161
|
+
orange: "Оранжевый",
|
|
162
|
+
teal: "Бирюзовый",
|
|
163
|
+
pink: "Розовый",
|
|
164
|
+
brown: "Коричневый",
|
|
165
|
+
skyBlue: "Голубой",
|
|
166
|
+
lightGreen: "Салатовый",
|
|
167
|
+
amber: "Янтарный",
|
|
168
|
+
violet: "Сиреневый",
|
|
169
|
+
scarlet: "Алый",
|
|
170
|
+
white: "Белый",
|
|
171
|
+
wholeStroke: "Штрих целиком",
|
|
172
|
+
partly: "Частично",
|
|
173
|
+
whatToErase: "Что стирать",
|
|
174
|
+
size: "Размер",
|
|
175
|
+
sizeAt: "Размер {n} из {total}",
|
|
106
176
|
}),
|
|
107
177
|
],
|
|
108
178
|
]);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type PenKind, type PenSettings, type StrokeStyle } from "../core/style.js";
|
|
2
|
+
/** The tools whose popovers these are. */
|
|
3
|
+
export type Opener = "pen" | "eraser";
|
|
4
|
+
/** The IDs in the shadow root of the hint the chosen pen and eraser are described by, and of the
|
|
5
|
+
* other colours, which the colour wheel shows and hides. */
|
|
6
|
+
export declare const HINT_ID = "pens-hint";
|
|
7
|
+
/** How narrow an element is, in CSS pixels, below which a popover is docked along its bottom. */
|
|
8
|
+
export declare const NARROW_PX = 600;
|
|
9
|
+
/** The widths a kind offers: the marker's four times the pen's. */
|
|
10
|
+
export declare function widthsOf(kind: PenKind): readonly number[];
|
|
11
|
+
/** Whether two settings say the same, field by field. */
|
|
12
|
+
export declare function samePens(a: PenSettings, b: PenSettings): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The colour a stroke of a style is drawn in on the screen: its own, but for the palette's black,
|
|
15
|
+
* which is the theme's ink, so that a dark theme keeps it in sight, and none at all in forced
|
|
16
|
+
* colours, where every stroke is the ink. `ink` is the ink's colour as the theme gives it.
|
|
17
|
+
*/
|
|
18
|
+
export declare function screenColourOf(style: StrokeStyle | undefined, ink: string, forced: boolean): string;
|
|
19
|
+
/** The popovers' style, of the element's one sheet, in its colours unless the theme gives its own. */
|
|
20
|
+
export declare function pensStyle(ink: string, paper: string, accent: string): string;
|
|
21
|
+
/** What a popover's choice asks of the element: the settings as the learner made them. */
|
|
22
|
+
export type PenChoice = (settings: PenSettings) => void;
|
|
23
|
+
/**
|
|
24
|
+
* The popovers of the pen and of the eraser, as the bar shows them: at most one open at a time,
|
|
25
|
+
* by its tool's button, and every choice in it a change of the settings the element decides on.
|
|
26
|
+
*/
|
|
27
|
+
export declare class Pens {
|
|
28
|
+
#private;
|
|
29
|
+
readonly pen: HTMLDivElement;
|
|
30
|
+
readonly eraser: HTMLDivElement;
|
|
31
|
+
/** What the chosen pen and eraser say of a second press, which a screen reader reads. */
|
|
32
|
+
readonly hint: HTMLSpanElement;
|
|
33
|
+
constructor(choose: PenChoice, toggled: () => void);
|
|
34
|
+
/** The tool whose popover is open, if one is. */
|
|
35
|
+
get opened(): Opener | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* A tool's popover opens by its button, and the other's closes. From the keyboard the focus goes
|
|
38
|
+
* to its first choice: the kind of pen in use, or the eraser's mode.
|
|
39
|
+
*/
|
|
40
|
+
open(which: Opener, opener: HTMLElement, focus: boolean): void;
|
|
41
|
+
/** The popover open closes, the focus back on its button if asked, or if the popover held it. */
|
|
42
|
+
close(refocus?: boolean): void;
|
|
43
|
+
/** The popovers as the settings are: only what has changed is written. */
|
|
44
|
+
show(settings: PenSettings): void;
|
|
45
|
+
/** The popovers' words in the language of a tag, the element's `lang`, and their `lang` theirs. */
|
|
46
|
+
label(tag: string | null): void;
|
|
47
|
+
/**
|
|
48
|
+
* The popover open stands to the right of the bar, level with the middle of its button as far as
|
|
49
|
+
* the element lets it, its arrow at the button; in an element narrower than `NARROW_PX`, along
|
|
50
|
+
* the element's bottom, `EDGE_PX` off its sides and above the consumer's bar at its bottom. It is
|
|
51
|
+
* kept within the part of the element in sight, and scrolls in itself when taller than that.
|
|
52
|
+
* Read from the layout, which a page's transform may scale: the places are the rail's own.
|
|
53
|
+
*/
|
|
54
|
+
place(): void;
|
|
55
|
+
}
|