@allons-y/course-kit 0.0.0-stage → 0.1.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/LICENSE +373 -0
- package/README.md +90 -2
- package/assets/fonts/instrument-sans-italic-var.woff2 +0 -0
- package/assets/fonts/instrument-sans-var.woff2 +0 -0
- package/assets/fonts/pt-mono.woff2 +0 -0
- package/assets/scripts/copy.js +99 -0
- package/assets/scripts/deck.js +161 -0
- package/assets/scripts/email.js +17 -0
- package/assets/scripts/practice.js +545 -0
- package/assets/scripts/theme-panel.js +647 -0
- package/assets/scripts/theme-restore.js +17 -0
- package/assets/styles/base.css +2090 -0
- package/assets/styles/deck.css +968 -0
- package/assets/styles/font.css +36 -0
- package/assets/styles/notes.css +137 -0
- package/assets/styles/print.css +428 -0
- package/assets/styles/semantics.css +101 -0
- package/components/practice/check-controls.webc +50 -0
- package/components/practice/choice-list.webc +86 -0
- package/components/practice/cite-panel.webc +108 -0
- package/components/practice/practice-figure.webc +47 -0
- package/components/practice/practice-fill.webc +154 -0
- package/components/practice/practice-grid.webc +82 -0
- package/components/practice/practice-judge.webc +165 -0
- package/components/practice/practice-match.webc +178 -0
- package/components/practice/practice-question.webc +141 -0
- package/components/practice/practice-selfcheck.webc +40 -0
- package/components/practice/practice-terms.webc +95 -0
- package/components/practice/practice-tree.webc +91 -0
- package/components/practice/practice-worksheet.webc +369 -0
- package/components/site/copyright.webc +13 -0
- package/components/site/course-documents.webc +27 -0
- package/components/site/course-now.webc +393 -0
- package/components/site/course-summary.webc +136 -0
- package/components/site/demo-weeks.webc +91 -0
- package/components/site/glossary-entry.webc +31 -0
- package/components/site/glossary-panel.webc +1482 -0
- package/components/site/glossary.webc +45 -0
- package/components/site/grading.webc +50 -0
- package/components/site/instructor.webc +269 -0
- package/components/site/masthead.webc +147 -0
- package/components/site/nav-links.webc +174 -0
- package/components/site/policies.webc +17 -0
- package/components/site/practice-index.webc +31 -0
- package/components/site/schedule-overview.webc +145 -0
- package/components/site/schedule-weeks.webc +589 -0
- package/components/site/site-footer.webc +119 -0
- package/components/site/slide-timetable.webc +152 -0
- package/components/site/syllabus.webc +217 -0
- package/components/ui/arrow-link.webc +19 -0
- package/components/ui/assigned-list.webc +101 -0
- package/components/ui/callout.webc +11 -0
- package/components/ui/card-list.webc +124 -0
- package/components/ui/codepen-embed.webc +123 -0
- package/components/ui/download-button.webc +49 -0
- package/components/ui/eyebrow.webc +18 -0
- package/components/ui/icons/github.webc +6 -0
- package/components/ui/icons/google.webc +9 -0
- package/components/ui/link-list.webc +130 -0
- package/components/ui/link-section.webc +40 -0
- package/components/ui/meeting-card.webc +73 -0
- package/components/ui/meeting-decks.webc +38 -0
- package/components/ui/table-rubric.webc +251 -0
- package/components/ui/today-link.webc +43 -0
- package/components/ui/today-marker.webc +149 -0
- package/components/ui/week-block.webc +53 -0
- package/examples/starter/_data/course.json +20 -0
- package/examples/starter/_data/dates.json +16 -0
- package/examples/starter/_data/grading.json +6 -0
- package/examples/starter/_data/instructor.json +7 -0
- package/examples/starter/_data/policies.json +9 -0
- package/examples/starter/_data/scale.json +8 -0
- package/examples/starter/_data/schedule.json +22 -0
- package/examples/starter/_data/theme.json +17 -0
- package/examples/starter/content/index.webc +12 -0
- package/examples/starter/content/schedule.webc +12 -0
- package/examples/starter/content/slides/index.11tydata.js +5 -0
- package/examples/starter/content/slides/index.webc +12 -0
- package/examples/starter/content/slides/week-1-day-1.md +40 -0
- package/examples/starter/eleventy.config.js +8 -0
- package/glue/deck-notes.data.js +41 -0
- package/glue/deck-notes.webc +32 -0
- package/glue/lesson-day.data.js +17 -0
- package/glue/lesson-day.webc +0 -0
- package/glue/lesson-plans.data.js +13 -0
- package/glue/lesson-plans.webc +2 -0
- package/index.js +6 -0
- package/layouts/base.webc +79 -0
- package/layouts/deck.webc +46 -0
- package/layouts/demo.webc +16 -0
- package/layouts/document.webc +10 -0
- package/layouts/lesson-detail.webc +109 -0
- package/layouts/lesson.webc +71 -0
- package/layouts/notes.webc +23 -0
- package/layouts/worksheet.webc +52 -0
- package/lib/assets.js +42 -0
- package/lib/bundles.js +79 -0
- package/lib/check.js +110 -0
- package/lib/components.js +19 -0
- package/lib/copy.js +653 -0
- package/lib/data/build.js +22 -0
- package/lib/data/fonts.js +16 -0
- package/lib/data/glossary.js +304 -0
- package/lib/data/index.js +8 -0
- package/lib/data/lessons.js +173 -0
- package/lib/data/project.js +22 -0
- package/lib/data/read.js +46 -0
- package/lib/data/site.js +70 -0
- package/lib/data/term.js +80 -0
- package/lib/extensions.js +70 -0
- package/lib/files.js +14 -0
- package/lib/filters.js +584 -0
- package/lib/fit.js +106 -0
- package/lib/glue.js +26 -0
- package/lib/lesson-materials.js +66 -0
- package/lib/markdown.js +568 -0
- package/lib/minify.js +53 -0
- package/lib/paths.js +5 -0
- package/lib/pdf.js +134 -0
- package/lib/plugin.js +228 -0
- package/lib/plugins.js +34 -0
- package/lib/postcss.js +93 -0
- package/lib/theme-server.js +88 -0
- package/lib/theme.js +185 -0
- package/lib/worksheet-dialect.js +415 -0
- package/lib/worksheets.js +276 -0
- package/package.json +118 -4
- package/schemas/course.schema.json +156 -0
- package/schemas/dates.schema.json +165 -0
- package/schemas/grading.schema.json +59 -0
- package/schemas/instructor.schema.json +68 -0
- package/schemas/policies.schema.json +90 -0
- package/schemas/project.schema.json +209 -0
- package/schemas/scale.schema.json +68 -0
- package/schemas/schedule.schema.json +260 -0
- package/schemas/theme.schema.json +704 -0
- package/schemas/worksheet.schema.json +449 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<script webc:setup>
|
|
2
|
+
/**
|
|
3
|
+
* A match question: a lettered bank and items that each take a letter.
|
|
4
|
+
* @prop {object} q a prepared `match` question
|
|
5
|
+
*/
|
|
6
|
+
</script>
|
|
7
|
+
<div class="matching">
|
|
8
|
+
<p class="drag-hint" webc:if="q.dragHint" @text="q.dragHint"></p>
|
|
9
|
+
<ol class="bank">
|
|
10
|
+
<li webc:for="entry of q.bank" :draggable="entry.draggable" :data-letter="entry.letter">
|
|
11
|
+
<span class="letter" @text="entry.letter"></span>
|
|
12
|
+
<span @text="entry.text"></span>
|
|
13
|
+
</li>
|
|
14
|
+
</ol>
|
|
15
|
+
<ol class="match-items">
|
|
16
|
+
<li webc:for="item of q.items" :data-drop="item.drop">
|
|
17
|
+
<label>
|
|
18
|
+
<span class="match-text" @text="item.text"></span>
|
|
19
|
+
<select :name="item.name" :data-blank="item.index">
|
|
20
|
+
<option value="">—</option>
|
|
21
|
+
<option webc:for="entry of item.bank" :value="entry.letter" @text="entry.letter"></option>
|
|
22
|
+
</select>
|
|
23
|
+
</label>
|
|
24
|
+
<span class="answer-key" hidden :data-answer="item.answer">
|
|
25
|
+
<span @text="`${$data.worksheet.copy.answer} ${item.answer}`"></span>
|
|
26
|
+
<a webc:if="item.source" :href="item.source.href" @text="item.source.label"></a>
|
|
27
|
+
</span>
|
|
28
|
+
</li>
|
|
29
|
+
</ol>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<style webc:scoped>
|
|
33
|
+
:host {
|
|
34
|
+
.drag-hint {
|
|
35
|
+
color: var(--color-text-muted);
|
|
36
|
+
font-size: 0.9em;
|
|
37
|
+
margin-block: 0 0.6em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.answer-key {
|
|
41
|
+
color: var(--color-error);
|
|
42
|
+
font-size: 0.85em;
|
|
43
|
+
|
|
44
|
+
&:not([hidden]) {
|
|
45
|
+
display: block;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
a {
|
|
49
|
+
color: inherit;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.letter {
|
|
54
|
+
background: var(--color-surface);
|
|
55
|
+
border-radius: var(--standard-border-radius);
|
|
56
|
+
display: inline-block;
|
|
57
|
+
font-family: var(--mono-font);
|
|
58
|
+
font-weight: var(--font-weight--semi-bold);
|
|
59
|
+
min-inline-size: 1.7em;
|
|
60
|
+
padding: 0.05em 0.35em;
|
|
61
|
+
text-align: center;
|
|
62
|
+
text-transform: uppercase;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.bank {
|
|
66
|
+
background: var(--color-surface);
|
|
67
|
+
border-radius: var(--standard-border-radius);
|
|
68
|
+
list-style: none;
|
|
69
|
+
padding: 0.6em 0.9em;
|
|
70
|
+
|
|
71
|
+
li {
|
|
72
|
+
display: flex;
|
|
73
|
+
gap: 0.6em;
|
|
74
|
+
margin-block: 0.25em;
|
|
75
|
+
|
|
76
|
+
&[draggable="true"] {
|
|
77
|
+
background: var(--color-page);
|
|
78
|
+
border: var(--thin-border-width) dashed var(--color-border);
|
|
79
|
+
border-radius: var(--standard-border-radius);
|
|
80
|
+
cursor: grab;
|
|
81
|
+
margin-block: 0;
|
|
82
|
+
padding: 0.15em 0.5em;
|
|
83
|
+
|
|
84
|
+
&:active {
|
|
85
|
+
cursor: grabbing;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&[data-dragging] {
|
|
90
|
+
opacity: 0.45;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* With chips to drag, the bank reads better as a wrapped row of
|
|
95
|
+
tokens than as a stacked list. */
|
|
96
|
+
&:has(li[draggable="true"]) {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-wrap: wrap;
|
|
99
|
+
gap: 0.5em;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.match-items {
|
|
104
|
+
padding-inline-start: 1.2em;
|
|
105
|
+
|
|
106
|
+
label {
|
|
107
|
+
align-items: center;
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-wrap: wrap;
|
|
110
|
+
gap: 0.6em;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* The situation gets the room, up to a readable line, with the
|
|
114
|
+
select right after it; on a phone they still share a row. */
|
|
115
|
+
.match-text {
|
|
116
|
+
flex: 1 1 12em;
|
|
117
|
+
max-inline-size: 36em;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
select {
|
|
121
|
+
flex: none;
|
|
122
|
+
inline-size: 5em;
|
|
123
|
+
margin-block: 0.2em;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
li {
|
|
127
|
+
&[data-drop] {
|
|
128
|
+
border: var(--thin-border-width) dashed transparent;
|
|
129
|
+
border-radius: var(--standard-border-radius);
|
|
130
|
+
padding-inline: 0.4em;
|
|
131
|
+
|
|
132
|
+
&[data-over] {
|
|
133
|
+
background: var(--color-drop-target);
|
|
134
|
+
border-color: var(--color-accent);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&[data-dropped] select {
|
|
139
|
+
border-color: var(--color-accent);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&[data-mark="wrong"] .match-text {
|
|
143
|
+
color: var(--color-error);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
</style>
|
|
149
|
+
|
|
150
|
+
<script>
|
|
151
|
+
(() => {
|
|
152
|
+
const registry = (window.ckPractice ??= { kinds: {} });
|
|
153
|
+
registry.kinds.match = {
|
|
154
|
+
/** Mark this kind's controls and report what was found. */
|
|
155
|
+
grade(question, key, _id, { mark }) {
|
|
156
|
+
let right = 0;
|
|
157
|
+
let blank = 0;
|
|
158
|
+
let answered = false;
|
|
159
|
+
for (const [index, expected] of key.items.entries()) {
|
|
160
|
+
const select = question.querySelector(`select[data-blank="${index}"]`);
|
|
161
|
+
if (!select.value) {
|
|
162
|
+
blank += 1;
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
answered = true;
|
|
166
|
+
const correct = select.value === expected;
|
|
167
|
+
if (correct) right += 1;
|
|
168
|
+
mark(select.closest("li"), correct);
|
|
169
|
+
}
|
|
170
|
+
return { answered, right, total: key.items.length, blank };
|
|
171
|
+
},
|
|
172
|
+
/** Drag a bank entry onto a row. */
|
|
173
|
+
enhance(question, { dragDrop }) {
|
|
174
|
+
dragDrop(question);
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
})();
|
|
178
|
+
</script>
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<script webc:setup>
|
|
2
|
+
/**
|
|
3
|
+
* One worksheet question: its prompt, sources, snippet and figure, then the control its kind needs, then the feedback and the reasoning. `practice.js` grades it.
|
|
4
|
+
* @prop {object} q a prepared question; `q.kind` picks the control
|
|
5
|
+
*/
|
|
6
|
+
</script>
|
|
7
|
+
<div class="question" :id="`q-${q.id}`" :data-question="q.id" :data-kind="q.kind"
|
|
8
|
+
:data-answers="JSON.stringify(q.answers)">
|
|
9
|
+
<div class="question-head">
|
|
10
|
+
<p class="question-prompt"><span class="q-number" @text="q.id"></span> <span @text="q.prompt"></span></p>
|
|
11
|
+
<cite-panel :@sources="q.sources" @group="cite" :@heading="$data.worksheet.copy.citeHeading"
|
|
12
|
+
:@label="`${$data.worksheet.copy.citeLabel} ${q.id}`"></cite-panel>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<pre webc:if="q.code && q.kind !== 'tree'" class="snippet"><code @raw="q.codeHtml"></code></pre>
|
|
16
|
+
<practice-figure webc:if="q.figure" :@q="q"></practice-figure>
|
|
17
|
+
|
|
18
|
+
<choice-list webc:if="q.kind === 'choice'" :@choices="q.choices"
|
|
19
|
+
:@legend="$data.worksheet.copy.chooseOne" @legendclass="sr-only"></choice-list>
|
|
20
|
+
<practice-match webc:if="q.kind === 'match'" :@q="q"></practice-match>
|
|
21
|
+
<practice-fill webc:if="q.kind === 'fill'" :@q="q"></practice-fill>
|
|
22
|
+
<practice-tree webc:if="q.kind === 'tree'" :@q="q"></practice-tree>
|
|
23
|
+
<practice-grid webc:if="q.kind === 'grid'" :@q="q"></practice-grid>
|
|
24
|
+
<practice-judge webc:if="q.kind === 'judge'" :@q="q"></practice-judge>
|
|
25
|
+
<practice-selfcheck webc:if="q.kind === 'selfcheck'" :@q="q"></practice-selfcheck>
|
|
26
|
+
|
|
27
|
+
<button type="button" class="check-one" data-check-one webc:if="$data.worksheet.checkMode === 'question' && q.kind !== 'selfcheck'" @text="$data.worksheet.copy.checkOne"></button>
|
|
28
|
+
<p class="feedback" role="status" hidden></p>
|
|
29
|
+
<div class="why" hidden>
|
|
30
|
+
<p @text="q.why"></p>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<style webc:scoped>
|
|
35
|
+
:host {
|
|
36
|
+
.question {
|
|
37
|
+
background: var(--color-surface-subtle);
|
|
38
|
+
border-inline-start: var(--thick-border-width) solid var(--color-border);
|
|
39
|
+
border-radius: var(--standard-border-radius);
|
|
40
|
+
margin-block: var(--practice-gap);
|
|
41
|
+
padding: 0.9em 1em;
|
|
42
|
+
|
|
43
|
+
&[data-state="right"] {
|
|
44
|
+
border-inline-start-color: var(--color-success);
|
|
45
|
+
|
|
46
|
+
.feedback {
|
|
47
|
+
color: var(--color-success);
|
|
48
|
+
|
|
49
|
+
&::before {
|
|
50
|
+
content: "✓ ";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:is([data-state="wrong"], [data-state="partial"]) {
|
|
56
|
+
border-inline-start-color: var(--color-error);
|
|
57
|
+
|
|
58
|
+
.feedback {
|
|
59
|
+
color: var(--color-error);
|
|
60
|
+
|
|
61
|
+
&::before {
|
|
62
|
+
content: "✕ ";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&[data-state="partial"] {
|
|
68
|
+
border-inline-start-style: dashed;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.question-head {
|
|
73
|
+
align-items: start;
|
|
74
|
+
display: flex;
|
|
75
|
+
gap: 0.5em;
|
|
76
|
+
justify-content: space-between;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.question-prompt {
|
|
80
|
+
margin-block: 0 0.6em;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.q-number {
|
|
84
|
+
color: var(--color-accent-text);
|
|
85
|
+
font-variant-numeric: tabular-nums;
|
|
86
|
+
font-weight: var(--font-weight--bold);
|
|
87
|
+
margin-inline-end: 0.3em;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.snippet {
|
|
91
|
+
background: var(--color-code-surface);
|
|
92
|
+
font-size: 0.9em;
|
|
93
|
+
|
|
94
|
+
.token:is(.comment, .prolog, .doctype, .cdata) {
|
|
95
|
+
color: var(--color-code-comment);
|
|
96
|
+
font-style: italic;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.token:is(.keyword, .builtin, .important, .atrule) {
|
|
100
|
+
color: var(--color-code-keyword);
|
|
101
|
+
font-weight: var(--font-weight--semi-bold);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.token:is(.string, .char, .regex, .number, .boolean) {
|
|
105
|
+
color: var(--color-code-string);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.token:is(.punctuation, .operator) {
|
|
109
|
+
color: var(--color-text-muted);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.check-one {
|
|
114
|
+
min-block-size: var(--target-min);
|
|
115
|
+
margin-block-start: 0.8em;
|
|
116
|
+
padding-inline: 1.2em;
|
|
117
|
+
border: var(--thin-border-width) solid var(--color-border-strong);
|
|
118
|
+
border-radius: var(--radius-pill);
|
|
119
|
+
background: transparent;
|
|
120
|
+
color: var(--color-text);
|
|
121
|
+
font-weight: var(--font-weight--semi-bold);
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.feedback {
|
|
126
|
+
font-weight: var(--font-weight--semi-bold);
|
|
127
|
+
margin-block: 0.8em 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.why {
|
|
131
|
+
background: var(--color-surface);
|
|
132
|
+
border-radius: var(--standard-border-radius);
|
|
133
|
+
margin-block-start: 0.5em;
|
|
134
|
+
padding: 0.6em 0.9em;
|
|
135
|
+
|
|
136
|
+
p {
|
|
137
|
+
margin-block: 0;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
</style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script webc:setup>
|
|
2
|
+
/**
|
|
3
|
+
* A self-check question: reveal the answer, then tick what you got.
|
|
4
|
+
* @prop {object} q a prepared `selfcheck` question
|
|
5
|
+
*/
|
|
6
|
+
</script>
|
|
7
|
+
<div class="selfcheck">
|
|
8
|
+
<div class="disclosures">
|
|
9
|
+
<details data-reveal>
|
|
10
|
+
<summary @text="$data.worksheet.copy.showAnswer"></summary>
|
|
11
|
+
<ul class="reveal">
|
|
12
|
+
<li webc:for="line of q.reveal" @text="line"></li>
|
|
13
|
+
</ul>
|
|
14
|
+
<p class="check-title" @text="$data.worksheet.copy.checkYourself"></p>
|
|
15
|
+
<ul class="checklist">
|
|
16
|
+
<li webc:for="line of q.checkYourself" @text="line"></li>
|
|
17
|
+
</ul>
|
|
18
|
+
</details>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<style webc:scoped>
|
|
23
|
+
:host {
|
|
24
|
+
.check-title {
|
|
25
|
+
font-weight: var(--font-weight--semi-bold);
|
|
26
|
+
margin-block-end: 0.2em;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* The disclosure is an operable target: 44px tall (WCAG 2.5.5). */
|
|
30
|
+
summary {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
min-block-size: var(--target-min);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.reveal {
|
|
37
|
+
font-family: var(--mono-font);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script webc:setup>
|
|
2
|
+
/**
|
|
3
|
+
* A bank of terms, each opening its definition in a popover.
|
|
4
|
+
* @prop {{ id: string, term: string, definition: string, source?: object }[]} terms the terms, each with its definition
|
|
5
|
+
* @prop {string} [hint] a line above the bank
|
|
6
|
+
* @prop {string} [sourceprefix] text before each source link's label
|
|
7
|
+
*/
|
|
8
|
+
</script>
|
|
9
|
+
<template webc:nokeep>
|
|
10
|
+
<p class="drag-hint" webc:if="hint" @text="hint"></p>
|
|
11
|
+
<ul class="term-bank">
|
|
12
|
+
<li webc:for="entry of terms">
|
|
13
|
+
<button type="button" class="term" :popovertarget="entry.id" @text="entry.term"></button>
|
|
14
|
+
<div class="term-def" :id="entry.id" popover>
|
|
15
|
+
<p class="term-name" @text="entry.term"></p>
|
|
16
|
+
<p @text="entry.definition"></p>
|
|
17
|
+
<a webc:if="entry.source" :href="entry.source.href"
|
|
18
|
+
@text="`${sourceprefix ?? ''}${entry.source.label}`"></a>
|
|
19
|
+
</div>
|
|
20
|
+
</li>
|
|
21
|
+
</ul>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<style webc:scoped>
|
|
25
|
+
:host {
|
|
26
|
+
.drag-hint {
|
|
27
|
+
color: var(--color-text-muted);
|
|
28
|
+
font-size: 0.9em;
|
|
29
|
+
margin-block: 0 0.6em;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.term-bank {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-wrap: wrap;
|
|
35
|
+
gap: 0.4em;
|
|
36
|
+
list-style: none;
|
|
37
|
+
margin-block: var(--content-space);
|
|
38
|
+
padding-inline-start: 0;
|
|
39
|
+
|
|
40
|
+
li {
|
|
41
|
+
font-size: 0.85em;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
button {
|
|
46
|
+
background: var(--color-surface);
|
|
47
|
+
border: var(--thin-border-width) solid transparent;
|
|
48
|
+
border-radius: var(--pill-border-radius);
|
|
49
|
+
color: inherit;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
font: inherit;
|
|
52
|
+
padding: 0.25em 0.8em;
|
|
53
|
+
|
|
54
|
+
&:is(:hover, :focus-visible) {
|
|
55
|
+
border-color: var(--color-accent);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
[popover] {
|
|
60
|
+
background: var(--color-surface-overlay);
|
|
61
|
+
border: var(--thin-border-width) solid var(--color-border);
|
|
62
|
+
border-radius: var(--standard-border-radius);
|
|
63
|
+
box-shadow: var(--box-shadow);
|
|
64
|
+
color: var(--color-text);
|
|
65
|
+
inline-size: min(32rem, calc(100vw - 2 * var(--container-space)));
|
|
66
|
+
padding: 0.8em 1em;
|
|
67
|
+
|
|
68
|
+
p {
|
|
69
|
+
margin-block: 0 0.5em;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.term-name {
|
|
73
|
+
font-weight: var(--font-weight--semi-bold);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
a {
|
|
77
|
+
font-size: 0.9em;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* A popover opened by a popovertarget button takes that button as its
|
|
82
|
+
implicit anchor, so no anchor-name is needed — position-area alone
|
|
83
|
+
pins the definition under its own term. Engines without anchor
|
|
84
|
+
positioning skip this block and keep the UA's centered popover, which
|
|
85
|
+
still works. Week 2's lesson, applied to the page that teaches it. */
|
|
86
|
+
@supports (position-area: block-end) {
|
|
87
|
+
[popover]:popover-open {
|
|
88
|
+
margin: 0.4em 0 0;
|
|
89
|
+
position: absolute;
|
|
90
|
+
position-area: block-end span-inline-end;
|
|
91
|
+
position-try-fallbacks: block-start span-inline-end, block-end span-inline-start, block-start span-inline-start;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
</style>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<script webc:setup>
|
|
2
|
+
/**
|
|
3
|
+
* A tree question: a snippet and its DOM tree with blanks to fill in.
|
|
4
|
+
* @prop {object} q a prepared `tree` question
|
|
5
|
+
*/
|
|
6
|
+
</script>
|
|
7
|
+
<div class="tree-question">
|
|
8
|
+
<pre class="snippet"><code @text="q.code"></code></pre>
|
|
9
|
+
<ul class="dom-tree">
|
|
10
|
+
<li webc:for="node of q.nodes" :style="`--depth: ${node.depth}`">
|
|
11
|
+
<span class="node" webc:if="node.label" @text="node.label"></span>
|
|
12
|
+
<label class="node node-blank" webc:if="node.label === undefined">
|
|
13
|
+
<span class="sr-only" @text="node.blankLabel"></span>
|
|
14
|
+
<input type="text" autocomplete="off" spellcheck="false" size="8"
|
|
15
|
+
:name="node.name" :data-blank="node.blank">
|
|
16
|
+
</label>
|
|
17
|
+
<span class="answer-key" hidden webc:if="node.label === undefined" :data-answer="node.display"
|
|
18
|
+
@text="`${$data.worksheet.copy.answer} ${node.display}`"></span>
|
|
19
|
+
</li>
|
|
20
|
+
</ul>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<style webc:scoped>
|
|
24
|
+
:host {
|
|
25
|
+
.answer-key {
|
|
26
|
+
color: var(--color-error);
|
|
27
|
+
font-size: 0.85em;
|
|
28
|
+
|
|
29
|
+
&:not([hidden]) {
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.tree-question {
|
|
35
|
+
display: grid;
|
|
36
|
+
gap: var(--content-space);
|
|
37
|
+
grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.dom-tree {
|
|
41
|
+
font-family: var(--mono-font);
|
|
42
|
+
list-style: none;
|
|
43
|
+
margin-block: 0;
|
|
44
|
+
padding-inline-start: 0;
|
|
45
|
+
|
|
46
|
+
input {
|
|
47
|
+
font-family: var(--mono-font);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
li {
|
|
51
|
+
margin-block: 0.25em;
|
|
52
|
+
padding-inline-start: calc(var(--depth, 0) * 1.4em);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.node {
|
|
56
|
+
border: var(--thin-border-width) solid var(--color-border);
|
|
57
|
+
border-radius: var(--standard-border-radius);
|
|
58
|
+
display: inline-block;
|
|
59
|
+
padding: 0.1em 0.6em;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.node-blank {
|
|
63
|
+
border-color: var(--color-accent);
|
|
64
|
+
border-style: dashed;
|
|
65
|
+
padding: 0.1em 0.3em;
|
|
66
|
+
|
|
67
|
+
input {
|
|
68
|
+
background: none;
|
|
69
|
+
border: 0;
|
|
70
|
+
inline-size: 7em;
|
|
71
|
+
padding: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
li[data-mark="wrong"] & {
|
|
75
|
+
border-color: var(--color-error);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
81
|
+
|
|
82
|
+
<script>
|
|
83
|
+
(() => {
|
|
84
|
+
const registry = (window.ckPractice ??= { kinds: {} });
|
|
85
|
+
// A tree is a fill whose blanks are laid out as a diagram: it grades and enhances as a fill does.
|
|
86
|
+
registry.kinds.tree = {
|
|
87
|
+
grade: (...args) => registry.kinds.fill.grade(...args),
|
|
88
|
+
enhance: (...args) => registry.kinds.fill.enhance(...args),
|
|
89
|
+
};
|
|
90
|
+
})();
|
|
91
|
+
</script>
|