@astl/editor 0.2.0 → 0.2.2
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/CHANGELOG.md +28 -0
- package/dist/elements/help-form.d.ts +22 -7
- package/dist/elements/help-form.d.ts.map +1 -1
- package/dist/elements/help-form.js +276 -95
- package/dist/elements/help-form.js.map +1 -1
- package/dist/elements/inspector.d.ts +7 -0
- package/dist/elements/inspector.d.ts.map +1 -1
- package/dist/elements/inspector.js +20 -2
- package/dist/elements/inspector.js.map +1 -1
- package/dist/elements/picture-field.d.ts.map +1 -1
- package/dist/elements/picture-field.js +2 -1
- package/dist/elements/picture-field.js.map +1 -1
- package/dist/elements/style-load.d.ts +14 -0
- package/dist/elements/style-load.d.ts.map +1 -1
- package/dist/elements/style-load.js +7 -0
- package/dist/elements/style-load.js.map +1 -1
- package/dist/elements/styles.d.ts +8 -0
- package/dist/elements/styles.d.ts.map +1 -1
- package/dist/elements/styles.js +30 -0
- package/dist/elements/styles.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/messages/en.json +4 -1
- package/dist/messages/help/en.json +3 -2
- package/dist/messages/help/pl.json +3 -2
- package/dist/messages/pl.json +4 -1
- package/package.json +5 -5
- package/src/elements/help-form.ts +304 -104
- package/src/elements/inspector.ts +21 -3
- package/src/elements/picture-field.ts +2 -1
- package/src/elements/style-load.ts +17 -0
- package/src/elements/styles.ts +31 -0
- package/src/index.ts +2 -2
- package/src/messages/en.json +4 -1
- package/src/messages/help/en.json +3 -2
- package/src/messages/help/pl.json +3 -2
- package/src/messages/pl.json +4 -1
|
@@ -21,7 +21,7 @@ import type {
|
|
|
21
21
|
PictureRegionsFieldModel,
|
|
22
22
|
} from '../inspect.js';
|
|
23
23
|
import { EDITOR_NAMESPACE } from '../messages.js';
|
|
24
|
-
import { kitStyles } from './styles.js';
|
|
24
|
+
import { compactButtons, kitStyles } from './styles.js';
|
|
25
25
|
|
|
26
26
|
/** Fired with a FieldChange for the inspector to apply. */
|
|
27
27
|
export const FIELD_CHANGE = 'astl-field-change';
|
|
@@ -110,6 +110,7 @@ export class AstlPictureField extends LitElement {
|
|
|
110
110
|
|
|
111
111
|
static override styles: CSSResultGroup = [
|
|
112
112
|
kitStyles,
|
|
113
|
+
compactButtons,
|
|
113
114
|
css`
|
|
114
115
|
fieldset {
|
|
115
116
|
display: flex;
|
|
@@ -12,6 +12,23 @@ export interface StyleOpen {
|
|
|
12
12
|
readonly target: EditorStyleTargetKind | 'rules';
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* The event of a request for a graded element's help for students (`detail`: the element's id and a part), from a tag
|
|
17
|
+
* on its frame on the surface; the cursor is in the element by then. It bubbles, is composed and can be cancelled: a
|
|
18
|
+
* host that shows its own inspector calls `preventDefault`, shows it and calls its `openHelp(part)`. Otherwise
|
|
19
|
+
* `<astl-editor>` opens it in its own inspector.
|
|
20
|
+
*/
|
|
21
|
+
export const HELP_OPEN = 'astl-help-open';
|
|
22
|
+
|
|
23
|
+
/** A part of a graded element's help for students: its hints, its explanation, its feedback texts. */
|
|
24
|
+
export type HelpPart = 'hints' | 'explanation' | 'feedback';
|
|
25
|
+
|
|
26
|
+
/** What `astl-help-open` asks for. */
|
|
27
|
+
export interface HelpOpen {
|
|
28
|
+
readonly element: string;
|
|
29
|
+
readonly part: HelpPart;
|
|
30
|
+
}
|
|
31
|
+
|
|
15
32
|
let registry: CustomElementRegistry | null = null;
|
|
16
33
|
let loading: Promise<void> | null = null;
|
|
17
34
|
|
package/src/elements/styles.ts
CHANGED
|
@@ -162,3 +162,34 @@ export const kitStyles: CSSResultGroup = [
|
|
|
162
162
|
}
|
|
163
163
|
`,
|
|
164
164
|
];
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The card's buttons (the inspector's, the help form's, a picture field's) as compact as the surface's authoring
|
|
168
|
+
* controls: ghost at rest (no fill, no line, muted ink), a subtle fill on hover, the kit's focus ring; an unavailable one
|
|
169
|
+
* keeps its dashed line, a destructive one its colour. Their height, text and icons follow `--astl-editor-control-size`
|
|
170
|
+
* (1.75rem), `--astl-editor-control-font-size` (0.8125rem) and `--astl-editor-control-icon-size` (0.875rem), which
|
|
171
|
+
* `<astl-editor>` passes down; a target stays at least 24px (WCAG 2.5.8). Form fields keep their size.
|
|
172
|
+
*/
|
|
173
|
+
export const compactButtons: CSSResult = css`
|
|
174
|
+
button {
|
|
175
|
+
gap: 0.25rem;
|
|
176
|
+
min-block-size: max(24px, var(--astl-editor-control-size, 1.75rem));
|
|
177
|
+
min-inline-size: max(24px, var(--astl-editor-control-size, 1.75rem));
|
|
178
|
+
padding-block: 0;
|
|
179
|
+
padding-inline: var(--astl-space-2);
|
|
180
|
+
border-color: transparent;
|
|
181
|
+
background: transparent;
|
|
182
|
+
color: var(--astl-ink-muted);
|
|
183
|
+
font-size: var(--astl-editor-control-font-size, 0.8125rem);
|
|
184
|
+
font-weight: 600;
|
|
185
|
+
line-height: 1.2;
|
|
186
|
+
}
|
|
187
|
+
button:hover:not(:disabled, [aria-disabled='true']) {
|
|
188
|
+
background: var(--astl-accent-soft);
|
|
189
|
+
color: var(--astl-ink);
|
|
190
|
+
}
|
|
191
|
+
button :is(svg, .icon) {
|
|
192
|
+
inline-size: var(--astl-editor-control-icon-size, 0.875rem);
|
|
193
|
+
block-size: var(--astl-editor-control-icon-size, 0.875rem);
|
|
194
|
+
}
|
|
195
|
+
`;
|
package/src/index.ts
CHANGED
|
@@ -28,8 +28,8 @@ export type { FieldChange } from './elements/picture-field.js';
|
|
|
28
28
|
export { AstlPictureField, FIELD_CHANGE } from './elements/picture-field.js';
|
|
29
29
|
export { AstlPreview } from './elements/preview.js';
|
|
30
30
|
export type { AstlStyleForm } from './elements/style-form.js';
|
|
31
|
-
export type { StyleOpen } from './elements/style-load.js';
|
|
32
|
-
export { loadHelpForm, loadStyleElements, STYLE_OPEN } from './elements/style-load.js';
|
|
31
|
+
export type { HelpOpen, HelpPart, StyleOpen } from './elements/style-load.js';
|
|
32
|
+
export { HELP_OPEN, loadHelpForm, loadStyleElements, STYLE_OPEN } from './elements/style-load.js';
|
|
33
33
|
export type { AstlStyleRules } from './elements/style-rules.js';
|
|
34
34
|
export type { InsertMenu, ToolbarView } from './elements/toolbar.js';
|
|
35
35
|
export { AstlToolbar, FEATURED_ITEMS, VIEW_PICKED } from './elements/toolbar.js';
|
package/src/messages/en.json
CHANGED
|
@@ -152,6 +152,7 @@
|
|
|
152
152
|
"surface.blockRemoved": "Block {n} deleted",
|
|
153
153
|
"surface.addOption": "Add option",
|
|
154
154
|
"surface.addPrompt": "Add prompt",
|
|
155
|
+
"surface.newWord": "word",
|
|
155
156
|
"surface.chip.empty": "No answer",
|
|
156
157
|
"surface.chip.more": "+{n}",
|
|
157
158
|
"surface.picture.alt": "Picture: {alt}",
|
|
@@ -245,7 +246,6 @@
|
|
|
245
246
|
"surface.picture.place": "Position and size: {position}, {width}",
|
|
246
247
|
"surface.picture.placeAuto": "Position and size: {position}",
|
|
247
248
|
"style.target.more": "{target}…",
|
|
248
|
-
"help.cost": "costs {percent}%",
|
|
249
249
|
"help.when.correct": "Correct",
|
|
250
250
|
"help.when.incorrect": "Wrong",
|
|
251
251
|
"help.when.partial": "Partly correct",
|
|
@@ -253,6 +253,9 @@
|
|
|
253
253
|
"help.costLabel": "Cost of the hint",
|
|
254
254
|
"help.whenLabel": "For the result",
|
|
255
255
|
"surface.helpRemove": "{kind, select, hint {Remove the hint} explanation {Remove the explanation} other {Remove the feedback}}",
|
|
256
|
+
"surface.helpHints": "{n, plural, one {# hint} other {# hints}}",
|
|
257
|
+
"surface.helpOpen": "Open in the card",
|
|
258
|
+
"surface.helpPlaceholder": "{kind, select, hint {Write the hint...} explanation {Write the explanation...} other {Write the feedback...}}",
|
|
256
259
|
"surface.pageCheck": "Check this page",
|
|
257
260
|
"surface.pageCheckOn": "Page {page} has a Check of its own now.",
|
|
258
261
|
"surface.pageCheckOff": "Page {page} has no Check of its own now.",
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"help.title": "Help for students",
|
|
3
|
+
"help.summaryNone": "none",
|
|
4
|
+
"help.summaryExplanation": "explanation",
|
|
5
|
+
"help.summaryFeedback": "feedback",
|
|
3
6
|
"help.hints": "Hints",
|
|
4
7
|
"help.hintsNote": "Students ask for them one at a time, in this order. A cost is the share of the question's points a student loses for using that hint.",
|
|
5
8
|
"help.hintN": "Hint {n}",
|
|
@@ -8,8 +11,6 @@
|
|
|
8
11
|
"help.costShare": "-{percent}% of this question's points",
|
|
9
12
|
"help.costPoints": "-{percent}%: -{points} of {max, plural, one {# point} other {# points}}",
|
|
10
13
|
"help.addHint": "Add a hint",
|
|
11
|
-
"help.up": "Up",
|
|
12
|
-
"help.down": "Down",
|
|
13
14
|
"help.upN": "Move hint {n} up",
|
|
14
15
|
"help.downN": "Move hint {n} down",
|
|
15
16
|
"help.removeN": "Remove hint {n}",
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"help.title": "Pomoc dla ucznia",
|
|
3
|
+
"help.summaryNone": "brak",
|
|
4
|
+
"help.summaryExplanation": "wyjaśnienie",
|
|
5
|
+
"help.summaryFeedback": "informacja zwrotna",
|
|
3
6
|
"help.hints": "Podpowiedzi",
|
|
4
7
|
"help.hintsNote": "Uczeń prosi o nie po kolei, w tej kolejności. Koszt to część punktów za to pytanie, którą uczeń traci, gdy użyje podpowiedzi.",
|
|
5
8
|
"help.hintN": "Podpowiedź {n}",
|
|
@@ -8,8 +11,6 @@
|
|
|
8
11
|
"help.costShare": "-{percent}% punktów za to pytanie",
|
|
9
12
|
"help.costPoints": "-{percent}%: -{points} z {max, plural, one {# punktu} few {# punktów} many {# punktów} other {# punktu}}",
|
|
10
13
|
"help.addHint": "Dodaj podpowiedź",
|
|
11
|
-
"help.up": "W górę",
|
|
12
|
-
"help.down": "W dół",
|
|
13
14
|
"help.upN": "Przenieś podpowiedź {n} w górę",
|
|
14
15
|
"help.downN": "Przenieś podpowiedź {n} w dół",
|
|
15
16
|
"help.removeN": "Usuń podpowiedź {n}",
|
package/src/messages/pl.json
CHANGED
|
@@ -152,6 +152,7 @@
|
|
|
152
152
|
"surface.blockRemoved": "Usunięto blok {n}",
|
|
153
153
|
"surface.addOption": "Dodaj odpowiedź",
|
|
154
154
|
"surface.addPrompt": "Dodaj polecenie",
|
|
155
|
+
"surface.newWord": "słowo",
|
|
155
156
|
"surface.chip.empty": "Brak odpowiedzi",
|
|
156
157
|
"surface.chip.more": "+{n}",
|
|
157
158
|
"surface.picture.alt": "Obrazek: {alt}",
|
|
@@ -245,7 +246,6 @@
|
|
|
245
246
|
"surface.picture.place": "Położenie i rozmiar: {position}, {width}",
|
|
246
247
|
"surface.picture.placeAuto": "Położenie i rozmiar: {position}",
|
|
247
248
|
"style.target.more": "{target}…",
|
|
248
|
-
"help.cost": "koszt {percent}%",
|
|
249
249
|
"help.when.correct": "Dobrze",
|
|
250
250
|
"help.when.incorrect": "Źle",
|
|
251
251
|
"help.when.partial": "Częściowo dobrze",
|
|
@@ -253,6 +253,9 @@
|
|
|
253
253
|
"help.costLabel": "Koszt podpowiedzi",
|
|
254
254
|
"help.whenLabel": "Dla wyniku",
|
|
255
255
|
"surface.helpRemove": "{kind, select, hint {Usuń podpowiedź} explanation {Usuń wyjaśnienie} other {Usuń informację zwrotną}}",
|
|
256
|
+
"surface.helpHints": "{n, plural, one {# podpowiedź} few {# podpowiedzi} many {# podpowiedzi} other {# podpowiedzi}}",
|
|
257
|
+
"surface.helpOpen": "Otwórz w karcie",
|
|
258
|
+
"surface.helpPlaceholder": "{kind, select, hint {Napisz podpowiedź...} explanation {Napisz wyjaśnienie...} other {Napisz informację zwrotną...}}",
|
|
256
259
|
"surface.pageCheck": "Sprawdź tę stronę",
|
|
257
260
|
"surface.pageCheckOn": "Strona {page} ma teraz własne sprawdzanie.",
|
|
258
261
|
"surface.pageCheckOff": "Strona {page} nie ma już własnego sprawdzania.",
|