@astl/editor 0.2.2 → 0.3.0
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 +39 -0
- package/dist/authoring.d.ts +50 -14
- package/dist/authoring.d.ts.map +1 -1
- package/dist/authoring.js +208 -18
- package/dist/authoring.js.map +1 -1
- package/dist/elements/help-form.d.ts.map +1 -1
- package/dist/elements/help-form.js +6 -3
- package/dist/elements/help-form.js.map +1 -1
- package/dist/elements/insert-menu.d.ts +8 -1
- package/dist/elements/insert-menu.d.ts.map +1 -1
- package/dist/elements/insert-menu.js +25 -3
- package/dist/elements/insert-menu.js.map +1 -1
- package/dist/elements/inspector.d.ts.map +1 -1
- package/dist/elements/inspector.js +67 -6
- package/dist/elements/inspector.js.map +1 -1
- package/dist/elements/picture-field.d.ts.map +1 -1
- package/dist/elements/picture-field.js +7 -3
- package/dist/elements/picture-field.js.map +1 -1
- package/dist/elements/styles.d.ts +10 -5
- package/dist/elements/styles.d.ts.map +1 -1
- package/dist/elements/styles.js +35 -8
- package/dist/elements/styles.js.map +1 -1
- package/dist/elements/toolbar.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +33 -3
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +2 -2
- package/dist/inspect.js.map +1 -1
- package/dist/messages/en.json +18 -0
- package/dist/messages/pl.json +18 -0
- package/package.json +5 -5
- package/src/authoring.ts +281 -30
- package/src/elements/help-form.ts +6 -3
- package/src/elements/insert-menu.ts +34 -3
- package/src/elements/inspector.ts +71 -7
- package/src/elements/picture-field.ts +7 -3
- package/src/elements/styles.ts +36 -8
- package/src/elements/toolbar.ts +1 -1
- package/src/index.ts +4 -1
- package/src/inspect.ts +33 -3
- package/src/messages/en.json +18 -0
- package/src/messages/pl.json +18 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { CHECK_TAG, type EditorBlockPlace, type EditorStyleTargetKind } from '@astl/core';
|
|
2
2
|
import {
|
|
3
3
|
type CSSResultGroup,
|
|
4
4
|
css,
|
|
@@ -14,6 +14,7 @@ import { refusalOf } from '../authoring.js';
|
|
|
14
14
|
import type { InspectorChange } from '../edit.js';
|
|
15
15
|
import type {
|
|
16
16
|
CheckboxFieldModel,
|
|
17
|
+
CheckTargetsFieldModel,
|
|
17
18
|
ChildChoiceFieldModel,
|
|
18
19
|
ChildFlagFieldModel,
|
|
19
20
|
ChildTableFieldModel,
|
|
@@ -30,7 +31,7 @@ import { GLYPHS, TYPE_GLYPHS } from './insert-menu.js';
|
|
|
30
31
|
import { SEVERITY_ICONS, sortIssues } from './issue-list.js';
|
|
31
32
|
import type { FieldChange } from './picture-field.js';
|
|
32
33
|
import { type HelpPart, loadHelpForm, loadStyleElements, STYLE_OPEN, type StyleOpen } from './style-load.js';
|
|
33
|
-
import { compactButtons, inheritTokens, kitStyles } from './styles.js';
|
|
34
|
+
import { addIcon, compactButtons, inheritTokens, kitStyles } from './styles.js';
|
|
34
35
|
|
|
35
36
|
/** A control to focus after the next render (text list rows come and go). */
|
|
36
37
|
interface PendingFocus {
|
|
@@ -175,6 +176,20 @@ export class AstlInspector extends AuthoringElement {
|
|
|
175
176
|
font-size: var(--astl-size-small);
|
|
176
177
|
}
|
|
177
178
|
`,
|
|
179
|
+
// A question another Check element has: its name after the question's, muted. The line under a question's head that
|
|
180
|
+
// names the Check element checking it, a button that selects it.
|
|
181
|
+
css`
|
|
182
|
+
.check .other {
|
|
183
|
+
color: var(--astl-ink-muted);
|
|
184
|
+
font-size: var(--astl-size-small);
|
|
185
|
+
}
|
|
186
|
+
.checked-by {
|
|
187
|
+
align-self: flex-start;
|
|
188
|
+
}
|
|
189
|
+
.checked-by .glyph {
|
|
190
|
+
flex: none;
|
|
191
|
+
}
|
|
192
|
+
`,
|
|
178
193
|
// One row of a child-table field: its text, then its controls side by side while they fit, and Remove.
|
|
179
194
|
css`
|
|
180
195
|
.row {
|
|
@@ -192,15 +207,21 @@ export class AstlInspector extends AuthoringElement {
|
|
|
192
207
|
flex-wrap: wrap;
|
|
193
208
|
align-items: flex-end;
|
|
194
209
|
gap: var(--astl-space-2);
|
|
210
|
+
overflow-wrap: break-word;
|
|
195
211
|
}
|
|
196
212
|
.cell {
|
|
197
213
|
flex: 1 1 5rem;
|
|
198
214
|
display: flex;
|
|
199
215
|
flex-direction: column;
|
|
200
216
|
gap: var(--astl-space-1);
|
|
201
|
-
min-inline-size: 0;
|
|
202
217
|
font-weight: 400;
|
|
203
218
|
}
|
|
219
|
+
.cell:has(> input[type='number']) {
|
|
220
|
+
flex-basis: 3.5rem;
|
|
221
|
+
}
|
|
222
|
+
.cell:has(> select) {
|
|
223
|
+
flex-basis: auto;
|
|
224
|
+
}
|
|
204
225
|
.cell > input,
|
|
205
226
|
.cell > select {
|
|
206
227
|
inline-size: 100%;
|
|
@@ -553,7 +574,7 @@ export class AstlInspector extends AuthoringElement {
|
|
|
553
574
|
})}
|
|
554
575
|
</ul>`
|
|
555
576
|
}
|
|
556
|
-
<button type="button" data-field=${i} data-add ?disabled=${full} @click=${add}>${this.t('inspector.add')}</button>
|
|
577
|
+
<button type="button" data-field=${i} data-add ?disabled=${full} @click=${add}>${addIcon}${this.t('inspector.add')}</button>
|
|
557
578
|
</fieldset>`;
|
|
558
579
|
}
|
|
559
580
|
|
|
@@ -733,11 +754,51 @@ export class AstlInspector extends AuthoringElement {
|
|
|
733
754
|
</fieldset>`,
|
|
734
755
|
)}
|
|
735
756
|
<button type="button" data-field=${i} data-add ?disabled=${field.max !== null && rows.length >= field.max} @click=${add}>
|
|
736
|
-
${this.t('inspector.add')}
|
|
757
|
+
${addIcon}${this.t('inspector.add')}
|
|
737
758
|
</button>
|
|
738
759
|
</fieldset>`;
|
|
739
760
|
}
|
|
740
761
|
|
|
762
|
+
/**
|
|
763
|
+
* A checkbox per graded question of the check's page, named as authors know it ("Gap 2"); one another Check element
|
|
764
|
+
* has is unavailable and says which. A change writes `for` with the ticked ones in the page's order, empty for none.
|
|
765
|
+
*/
|
|
766
|
+
#checkTargets(field: CheckTargetsFieldModel, i: number): TemplateResult {
|
|
767
|
+
const write = (id: string, on: boolean) => {
|
|
768
|
+
const ids = field.targets.filter((target) => (target.id === id ? on : target.checked));
|
|
769
|
+
this.#apply({ kind: 'attribute', name: field.name, value: ids.map((target) => target.id).join(' ') });
|
|
770
|
+
};
|
|
771
|
+
return html`<fieldset data-name=${field.name} part="field check-targets" aria-describedby=${ifDefined(this.#describedBy(field, i))}>
|
|
772
|
+
<legend part="label">${field.label}</legend>
|
|
773
|
+
${this.#help(field, i)}
|
|
774
|
+
${field.targets.length === 0 ? html`<p class="note">${this.t('check.noQuestions')}</p>` : nothing}
|
|
775
|
+
${field.targets.map(
|
|
776
|
+
(target) => html`<label class="check">
|
|
777
|
+
<input
|
|
778
|
+
type="checkbox"
|
|
779
|
+
data-id=${target.id}
|
|
780
|
+
.checked=${live(target.checked)}
|
|
781
|
+
?disabled=${target.other !== null}
|
|
782
|
+
@change=${(event: Event) => write(target.id, checkedOf(event))}
|
|
783
|
+
/>
|
|
784
|
+
<span dir="auto">${target.label}</span>
|
|
785
|
+
${target.other === null ? nothing : html`<span class="other">${this.t('check.checkedBy', { check: target.other })}</span>`}
|
|
786
|
+
</label>`,
|
|
787
|
+
)}
|
|
788
|
+
</fieldset>`;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/** Under a question's head, the Check element that checks it ("Checked by Check button 1"): a press selects it. */
|
|
792
|
+
#checkedBy(model: InspectorModel): TemplateResult | typeof nothing {
|
|
793
|
+
const by = model.checkedBy ?? null;
|
|
794
|
+
if (by === null || this.adapter === null) return nothing;
|
|
795
|
+
return html`<button type="button" class="checked-by" part="checked-by" data-check=${by.id}
|
|
796
|
+
@click=${() => this.adapter?.select(by.id)}>
|
|
797
|
+
<svg class="icon glyph" viewBox="0 0 20 20" aria-hidden="true" focusable="false">${TYPE_GLYPHS.get('check')}</svg>
|
|
798
|
+
<span>${this.t('check.checkedBy', { check: by.name })}</span>
|
|
799
|
+
</button>`;
|
|
800
|
+
}
|
|
801
|
+
|
|
741
802
|
#field(field: InspectorFieldModel, i: number): TemplateResult {
|
|
742
803
|
switch (field.kind) {
|
|
743
804
|
case 'picture-regions':
|
|
@@ -758,6 +819,8 @@ export class AstlInspector extends AuthoringElement {
|
|
|
758
819
|
return this.#childChoices(field, i);
|
|
759
820
|
case 'child-table':
|
|
760
821
|
return this.#childTable(field, i);
|
|
822
|
+
case 'check-targets':
|
|
823
|
+
return this.#checkTargets(field, i);
|
|
761
824
|
case 'attribute':
|
|
762
825
|
switch (field.control) {
|
|
763
826
|
case 'text':
|
|
@@ -781,7 +844,8 @@ export class AstlInspector extends AuthoringElement {
|
|
|
781
844
|
const { authoring, adapter } = this;
|
|
782
845
|
const place: EditorBlockPlace | null = adapter?.getCursor?.() ?? null;
|
|
783
846
|
if (authoring === null || adapter === null || place === null) return nothing;
|
|
784
|
-
|
|
847
|
+
// A block component, or a Check element: a block of its own.
|
|
848
|
+
if (tag !== CHECK_TAG && authoring.descriptor(tag)?.manifest.display !== 'block') return nothing;
|
|
785
849
|
const page = authoring.outline(adapter.getSource()).pages.find((p) => p.id === place.page);
|
|
786
850
|
const button = (name: keyof typeof ACTION_ICONS, off: boolean, run: () => void) =>
|
|
787
851
|
html`<button type="button" class=${name} data-action=${name} aria-label=${this.t(`inspector.${name}`)}
|
|
@@ -945,7 +1009,7 @@ export class AstlInspector extends AuthoringElement {
|
|
|
945
1009
|
// A graded element's help for students heads the card, before its fields: a form of its own, loaded on first use.
|
|
946
1010
|
const manifest = authoring.descriptor(model.tag)?.manifest;
|
|
947
1011
|
if (manifest?.graded === true) void loadHelpForm().catch(() => {});
|
|
948
|
-
body = html`${this.#head(model)}${this.#issues(model)}
|
|
1012
|
+
body = html`${this.#head(model)}${this.#issues(model)}${this.#checkedBy(model)}
|
|
949
1013
|
${
|
|
950
1014
|
manifest?.graded === true
|
|
951
1015
|
? html`<astl-help-form .authoring=${authoring} .adapter=${adapter} .element=${this.#shown}
|
|
@@ -21,7 +21,7 @@ import type {
|
|
|
21
21
|
PictureRegionsFieldModel,
|
|
22
22
|
} from '../inspect.js';
|
|
23
23
|
import { EDITOR_NAMESPACE } from '../messages.js';
|
|
24
|
-
import { compactButtons, kitStyles } from './styles.js';
|
|
24
|
+
import { addIcon, 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';
|
|
@@ -112,6 +112,9 @@ export class AstlPictureField extends LitElement {
|
|
|
112
112
|
kitStyles,
|
|
113
113
|
compactButtons,
|
|
114
114
|
css`
|
|
115
|
+
fieldset > button {
|
|
116
|
+
align-self: flex-start;
|
|
117
|
+
}
|
|
115
118
|
fieldset {
|
|
116
119
|
display: flex;
|
|
117
120
|
flex-direction: column;
|
|
@@ -651,13 +654,14 @@ export class AstlPictureField extends LitElement {
|
|
|
651
654
|
${this.#more(points.length)}
|
|
652
655
|
<button
|
|
653
656
|
type="button"
|
|
657
|
+
class="add"
|
|
654
658
|
?disabled=${points.length >= MAX_LISTED}
|
|
655
659
|
@click=${() => {
|
|
656
660
|
const [lx, ly] = points[points.length - 1] ?? [50, 50];
|
|
657
661
|
setPoints([...points, [round(lx + 5), round(ly + 5)]]);
|
|
658
662
|
}}
|
|
659
663
|
>
|
|
660
|
-
${this.#t('field.vertex.add')}
|
|
664
|
+
${addIcon}${this.#t('field.vertex.add')}
|
|
661
665
|
</button>`
|
|
662
666
|
: nothing
|
|
663
667
|
}
|
|
@@ -764,7 +768,7 @@ export class AstlPictureField extends LitElement {
|
|
|
764
768
|
</ol>
|
|
765
769
|
${this.#more(regions ? field.regions.length : field.points.length)}
|
|
766
770
|
<button type="button" data-add @click=${() => this.#add(field)}>
|
|
767
|
-
${this.#t(regions ? 'field.region.add' : 'field.point.add')}
|
|
771
|
+
${addIcon}${this.#t(regions ? 'field.region.add' : 'field.point.add')}
|
|
768
772
|
</button>
|
|
769
773
|
</fieldset>`;
|
|
770
774
|
}
|
package/src/elements/styles.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { visuallyHidden } from '@astl/player';
|
|
2
2
|
import { nativeSelectCss, tokens, tokensCss } from '@astl/tokens';
|
|
3
|
-
import { type CSSResult, type CSSResultGroup, css, unsafeCSS } from 'lit';
|
|
3
|
+
import { type CSSResult, type CSSResultGroup, css, html, type TemplateResult, unsafeCSS } from 'lit';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Every token as `inherit` on `selector`, for elements that redeclare the tokens on their own `:host` (the player): a
|
|
@@ -17,6 +17,8 @@ export const kitStyles: CSSResultGroup = [
|
|
|
17
17
|
// Tokens sit on :host so host pages can override any --astl-* property on the element itself.
|
|
18
18
|
unsafeCSS(tokensCss(':host')),
|
|
19
19
|
visuallyHidden,
|
|
20
|
+
// The focus ring is the editor's (2px, 1px out by default): it never reaches a field 4px away, where the player's 3px
|
|
21
|
+
// ring 2px out did.
|
|
20
22
|
css`
|
|
21
23
|
:host {
|
|
22
24
|
display: block;
|
|
@@ -131,8 +133,8 @@ export const kitStyles: CSSResultGroup = [
|
|
|
131
133
|
accent-color: var(--astl-accent);
|
|
132
134
|
}
|
|
133
135
|
:focus-visible {
|
|
134
|
-
outline: var(--astl-focus-width) solid var(--astl-focus);
|
|
135
|
-
outline-offset: var(--astl-focus-offset);
|
|
136
|
+
outline: var(--astl-editor-focus-width, 2px) solid var(--astl-focus);
|
|
137
|
+
outline-offset: var(--astl-editor-focus-offset, 1px);
|
|
136
138
|
}
|
|
137
139
|
.icon {
|
|
138
140
|
flex: none;
|
|
@@ -163,12 +165,20 @@ export const kitStyles: CSSResultGroup = [
|
|
|
163
165
|
`,
|
|
164
166
|
];
|
|
165
167
|
|
|
168
|
+
/** The plus of an add action (`button[data-add]`; `button.add` in an item), as the surface's "Add option" draws it. */
|
|
169
|
+
export const addIcon: TemplateResult = html`<svg class="plus" viewBox="0 0 20 20" aria-hidden="true" focusable="false">
|
|
170
|
+
<path d="M10 4v12M4 10h12" />
|
|
171
|
+
</svg>`;
|
|
172
|
+
|
|
166
173
|
/**
|
|
167
174
|
* The card's buttons (the inspector's, the help form's, a picture field's) as compact as the surface's authoring
|
|
168
|
-
* controls
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
175
|
+
* controls, and each recognisable as a button at rest: a text button has a hairline in the outline colour (3:1 at
|
|
176
|
+
* least), an add action (`data-add`, `.add`) a plus and the accent colour, an icon alone (`.icon`, `data-action`) only
|
|
177
|
+
* its icon; a subtle fill on hover, the kit's focus ring; an unavailable one keeps its dashed line, a destructive one
|
|
178
|
+
* its colour.
|
|
179
|
+
* Their height, text and icons follow `--astl-editor-control-size` (1.75rem), `--astl-editor-control-font-size`
|
|
180
|
+
* (0.8125rem) and `--astl-editor-control-icon-size` (0.875rem), which `<astl-editor>` passes down; a target stays at
|
|
181
|
+
* least 24px (WCAG 2.5.8). Form fields keep their size.
|
|
172
182
|
*/
|
|
173
183
|
export const compactButtons: CSSResult = css`
|
|
174
184
|
button {
|
|
@@ -177,13 +187,23 @@ export const compactButtons: CSSResult = css`
|
|
|
177
187
|
min-inline-size: max(24px, var(--astl-editor-control-size, 1.75rem));
|
|
178
188
|
padding-block: 0;
|
|
179
189
|
padding-inline: var(--astl-space-2);
|
|
180
|
-
border-
|
|
190
|
+
border-width: 1px;
|
|
191
|
+
border-color: var(--astl-outline);
|
|
192
|
+
border-radius: var(--astl-radius-s);
|
|
181
193
|
background: transparent;
|
|
182
194
|
color: var(--astl-ink-muted);
|
|
183
195
|
font-size: var(--astl-editor-control-font-size, 0.8125rem);
|
|
184
196
|
font-weight: 600;
|
|
185
197
|
line-height: 1.2;
|
|
186
198
|
}
|
|
199
|
+
button:is(.icon, [data-action]):not(:disabled, [aria-disabled='true']) {
|
|
200
|
+
border-color: transparent;
|
|
201
|
+
}
|
|
202
|
+
button:is([data-add], .add):not(:disabled, [aria-disabled='true']) {
|
|
203
|
+
padding-inline-start: var(--astl-space-1);
|
|
204
|
+
border-color: transparent;
|
|
205
|
+
color: var(--astl-accent);
|
|
206
|
+
}
|
|
187
207
|
button:hover:not(:disabled, [aria-disabled='true']) {
|
|
188
208
|
background: var(--astl-accent-soft);
|
|
189
209
|
color: var(--astl-ink);
|
|
@@ -192,4 +212,12 @@ export const compactButtons: CSSResult = css`
|
|
|
192
212
|
inline-size: var(--astl-editor-control-icon-size, 0.875rem);
|
|
193
213
|
block-size: var(--astl-editor-control-icon-size, 0.875rem);
|
|
194
214
|
}
|
|
215
|
+
svg.plus {
|
|
216
|
+
flex: none;
|
|
217
|
+
fill: none;
|
|
218
|
+
stroke: currentColor;
|
|
219
|
+
stroke-width: 1.8;
|
|
220
|
+
stroke-linecap: round;
|
|
221
|
+
stroke-linejoin: round;
|
|
222
|
+
}
|
|
195
223
|
`;
|
package/src/elements/toolbar.ts
CHANGED
|
@@ -204,7 +204,7 @@ const barStyles: CSSResult = css`
|
|
|
204
204
|
padding-inline-start: 0;
|
|
205
205
|
}
|
|
206
206
|
.formats {
|
|
207
|
-
--ring: calc(var(--astl-focus-width) + var(--astl-focus-offset));
|
|
207
|
+
--ring: calc(var(--astl-editor-focus-width, 2px) + var(--astl-editor-focus-offset, 1px));
|
|
208
208
|
gap: var(--astl-space-1) calc(2 * var(--astl-space-2) + var(--astl-outline-width));
|
|
209
209
|
overflow-x: auto;
|
|
210
210
|
scrollbar-width: thin;
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type {
|
|
|
4
4
|
DescribeOptions,
|
|
5
5
|
Outline,
|
|
6
6
|
OutlineBlock,
|
|
7
|
+
OutlineCheck,
|
|
7
8
|
OutlineComponent,
|
|
8
9
|
OutlinePage,
|
|
9
10
|
PickPicture,
|
|
@@ -13,7 +14,7 @@ export type {
|
|
|
13
14
|
UploadAsset,
|
|
14
15
|
UploadedAsset,
|
|
15
16
|
} from './authoring.js';
|
|
16
|
-
export { createAuthoring, pictureHtml, pictureSize, UploadRefused } from './authoring.js';
|
|
17
|
+
export { createAuthoring, insertCheck, pictureHtml, pictureSize, UploadRefused } from './authoring.js';
|
|
17
18
|
export { defineAuthoringElements } from './define.js';
|
|
18
19
|
export type { InspectorChange } from './edit.js';
|
|
19
20
|
export type { AstlHelpForm, HelpKind } from './elements/help-form.js';
|
|
@@ -35,6 +36,8 @@ export type { InsertMenu, ToolbarView } from './elements/toolbar.js';
|
|
|
35
36
|
export { AstlToolbar, FEATURED_ITEMS, VIEW_PICKED } from './elements/toolbar.js';
|
|
36
37
|
export type {
|
|
37
38
|
CheckboxFieldModel,
|
|
39
|
+
CheckTargetModel,
|
|
40
|
+
CheckTargetsFieldModel,
|
|
38
41
|
ChildChoiceFieldModel,
|
|
39
42
|
ChildChoiceModel,
|
|
40
43
|
ChildFlagFieldModel,
|
package/src/inspect.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Inspector models: what an inspector shows for one component element. Fields come from the EditorDescriptor, or
|
|
3
3
|
* are derived from the manifest; controls follow the AttributeSpec types. Every component also gets `variant` (when
|
|
4
|
-
* its manifest has variants) and `style-template` (when templates are offered for it), after those fields.
|
|
5
|
-
* data, so any UI can render them.
|
|
4
|
+
* its manifest has variants) and `style-template` (when templates are offered for it), after those fields. A Check
|
|
5
|
+
* element (`astl-check`) has a model of its own (`Authoring.inspect`). Plain data, so any UI can render them.
|
|
6
6
|
*/
|
|
7
7
|
import {
|
|
8
8
|
type AttributeSpec,
|
|
@@ -235,6 +235,30 @@ export interface PicturePointsFieldModel extends PictureFieldBase {
|
|
|
235
235
|
readonly points: readonly PicturePointModel[];
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
/** A question a Check element can check, in its `check-targets` field. */
|
|
239
|
+
export interface CheckTargetModel {
|
|
240
|
+
/** Its source id. */
|
|
241
|
+
readonly id: string;
|
|
242
|
+
/** How authors know it on its page: its type and number ("Gap 2"). */
|
|
243
|
+
readonly label: string;
|
|
244
|
+
/** Whether this Check element checks it. */
|
|
245
|
+
readonly checked: boolean;
|
|
246
|
+
/** The name of another Check element of the page that checks it ("Check button 2"), or null. */
|
|
247
|
+
readonly other: string | null;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* The questions a Check element checks (`for`): the graded questions of its page in order, each ticked when it checks
|
|
252
|
+
* it; one another Check element has says which. A change writes `for` with the ticked ones in this order (empty for
|
|
253
|
+
* none: it then checks nothing).
|
|
254
|
+
*/
|
|
255
|
+
export interface CheckTargetsFieldModel extends FieldTexts {
|
|
256
|
+
readonly kind: 'check-targets';
|
|
257
|
+
/** The attribute it writes: `for`. */
|
|
258
|
+
readonly name: string;
|
|
259
|
+
readonly targets: readonly CheckTargetModel[];
|
|
260
|
+
}
|
|
261
|
+
|
|
238
262
|
export type InspectorFieldModel =
|
|
239
263
|
| TextFieldModel
|
|
240
264
|
| NumberFieldModel
|
|
@@ -246,7 +270,8 @@ export type InspectorFieldModel =
|
|
|
246
270
|
| ChildChoiceFieldModel
|
|
247
271
|
| ChildTableFieldModel
|
|
248
272
|
| PictureRegionsFieldModel
|
|
249
|
-
| PicturePointsFieldModel
|
|
273
|
+
| PicturePointsFieldModel
|
|
274
|
+
| CheckTargetsFieldModel;
|
|
250
275
|
|
|
251
276
|
export interface InspectorModel {
|
|
252
277
|
readonly tag: string;
|
|
@@ -256,6 +281,11 @@ export interface InspectorModel {
|
|
|
256
281
|
/** Icon name from the descriptor. */
|
|
257
282
|
readonly icon: string | null;
|
|
258
283
|
readonly fields: readonly InspectorFieldModel[];
|
|
284
|
+
/**
|
|
285
|
+
* The Check element that checks this question (`OutlineComponent.check`): its source id and its name ("Check button
|
|
286
|
+
* 1"); absent or null when none does, or without the document (`Authoring.inspect` without `source`).
|
|
287
|
+
*/
|
|
288
|
+
readonly checkedBy?: { readonly id: string; readonly name: string } | null;
|
|
259
289
|
}
|
|
260
290
|
|
|
261
291
|
/** Texts the model needs: messages of the manifest namespace (with a fallback) and kit strings. */
|
package/src/messages/en.json
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
"insert.explanation.description": "Why the answer is right, shown once it is checked",
|
|
14
14
|
"insert.feedback": "Feedback",
|
|
15
15
|
"insert.feedback.description": "A text by the verdict, shown once the answer is checked",
|
|
16
|
+
"insert.check": "Check button",
|
|
17
|
+
"insert.check.description": "One Check for the questions in the text above it",
|
|
16
18
|
"insert.text": "Text",
|
|
17
19
|
"insert.text.description": "A paragraph after this block",
|
|
18
20
|
"insert.noMatch": "Nothing matches “{query}”.",
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
"toolbar.search": "Search",
|
|
41
43
|
"block.text": "Text",
|
|
42
44
|
"block.gap": "Gap",
|
|
45
|
+
"block.check": "Check button",
|
|
43
46
|
"issue.onPage": "{n} on page {page}",
|
|
44
47
|
"picture.title": "Add a picture",
|
|
45
48
|
"picture.editTitle": "Edit the picture",
|
|
@@ -117,6 +120,21 @@
|
|
|
117
120
|
"inspector.uploaded": "Uploaded.",
|
|
118
121
|
"inspector.uploadFailed": "The upload failed. Try again, or type its address.",
|
|
119
122
|
"inspector.uploadBlocked": "The upload gave an address the URL policy does not allow.",
|
|
123
|
+
"check.labelField": "Button text",
|
|
124
|
+
"check.labelHelp": "Empty: “Check”.",
|
|
125
|
+
"check.targets": "Questions it checks",
|
|
126
|
+
"check.targetsHelp": "The questions on this page. Those ticked have no Check of their own.",
|
|
127
|
+
"check.noQuestions": "This page has no questions yet.",
|
|
128
|
+
"check.target": "{type} {n}",
|
|
129
|
+
"check.name": "Check button {n}",
|
|
130
|
+
"check.named": "“{label}”",
|
|
131
|
+
"check.checkedBy": "Checked by {check}",
|
|
132
|
+
"check.count": "{n, plural, one {# question} other {# questions}}",
|
|
133
|
+
"check.button": "Check",
|
|
134
|
+
"check.none": "No questions",
|
|
135
|
+
"check.auto": "automatic · {n, plural, one {# question} other {# questions}}",
|
|
136
|
+
"check.make": "Make it a button",
|
|
137
|
+
"check.makeHelp": "Where practice checks one question at a time, these questions share this Check. As a button you can pick them and set its text.",
|
|
120
138
|
"issues.title": "Problems",
|
|
121
139
|
"issues.errors": "{count, plural, one {# error} other {# errors}}",
|
|
122
140
|
"issues.warnings": "{count, plural, one {# warning} other {# warnings}}",
|
package/src/messages/pl.json
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
"insert.explanation.description": "Dlaczego odpowiedź jest dobra, widoczne po sprawdzeniu",
|
|
14
14
|
"insert.feedback": "Informacja zwrotna",
|
|
15
15
|
"insert.feedback.description": "Tekst zależny od wyniku, widoczny po sprawdzeniu",
|
|
16
|
+
"insert.check": "Przycisk Sprawdź",
|
|
17
|
+
"insert.check.description": "Jeden przycisk Sprawdź dla pytań z tekstu nad nim",
|
|
16
18
|
"insert.text": "Tekst",
|
|
17
19
|
"insert.text.description": "Akapit po tym bloku",
|
|
18
20
|
"insert.noMatch": "Nic nie pasuje do „{query}”.",
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
"toolbar.search": "Szukaj",
|
|
41
43
|
"block.text": "Tekst",
|
|
42
44
|
"block.gap": "Luka",
|
|
45
|
+
"block.check": "Przycisk Sprawdź",
|
|
43
46
|
"issue.onPage": "{n} na stronie {page}",
|
|
44
47
|
"picture.title": "Dodaj obrazek",
|
|
45
48
|
"picture.editTitle": "Edytuj obrazek",
|
|
@@ -117,6 +120,21 @@
|
|
|
117
120
|
"inspector.uploaded": "Wgrano.",
|
|
118
121
|
"inspector.uploadFailed": "Nie udało się wgrać pliku. Spróbuj ponownie albo wpisz jego adres.",
|
|
119
122
|
"inspector.uploadBlocked": "Wgrywanie zwróciło adres, na który nie pozwala polityka adresów.",
|
|
123
|
+
"check.labelField": "Tekst przycisku",
|
|
124
|
+
"check.labelHelp": "Puste: „Sprawdź”.",
|
|
125
|
+
"check.targets": "Pytania, które sprawdza",
|
|
126
|
+
"check.targetsHelp": "Pytania z tej strony. Zaznaczone nie mają własnego przycisku Sprawdź.",
|
|
127
|
+
"check.noQuestions": "Na tej stronie nie ma jeszcze pytań.",
|
|
128
|
+
"check.target": "{type} {n}",
|
|
129
|
+
"check.name": "przycisk Sprawdź {n}",
|
|
130
|
+
"check.named": "„{label}”",
|
|
131
|
+
"check.checkedBy": "Sprawdzane przez {check}",
|
|
132
|
+
"check.count": "{n, plural, one {# pytanie} few {# pytania} many {# pytań} other {# pytania}}",
|
|
133
|
+
"check.button": "Sprawdź",
|
|
134
|
+
"check.none": "Brak pytań",
|
|
135
|
+
"check.auto": "automatyczny · {n, plural, one {# pytanie} few {# pytania} many {# pytań} other {# pytania}}",
|
|
136
|
+
"check.make": "Zrób z niego przycisk",
|
|
137
|
+
"check.makeHelp": "Gdy ćwiczenie sprawdza po jednym pytaniu, te pytania mają wspólny przycisk Sprawdź. Jako przycisk możesz wybrać pytania i ustawić jego tekst.",
|
|
120
138
|
"issues.title": "Problemy",
|
|
121
139
|
"issues.errors": "{count, plural, one {# błąd} few {# błędy} many {# błędów} other {# błędu}}",
|
|
122
140
|
"issues.warnings": "{count, plural, one {# ostrzeżenie} few {# ostrzeżenia} many {# ostrzeżeń} other {# ostrzeżenia}}",
|