@allons-y/course-kit 0.2.0 → 0.4.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/README.md +1 -1
- package/assets/scripts/deck.js +3 -34
- package/assets/styles/base.css +135 -2
- package/assets/styles/print.css +8 -1
- package/components/practice/practice-worksheet.webc +1 -5
- package/components/site/book-appointment.webc +26 -0
- package/components/site/course-now.webc +7 -0
- package/components/site/glossary.webc +0 -5
- package/components/site/instructor.webc +3 -3
- package/components/site/masthead.webc +11 -1
- package/components/site/nav-links.webc +16 -0
- package/components/site/schedule-overview.webc +204 -17
- package/components/site/schedule-weeks.webc +24 -51
- package/components/site/site-footer.webc +16 -2
- package/components/ui/codepen-embed.webc +2 -5
- package/components/ui/download-button.webc +3 -3
- package/components/ui/table-rubric.webc +2 -1
- package/examples/starter/_data/schedule.json +1 -1
- package/layouts/deck.webc +0 -4
- package/layouts/document.webc +2 -1
- package/layouts/lesson.webc +8 -12
- package/lib/check.js +23 -1
- package/lib/copy.js +1 -3
- package/lib/data/glossary.js +2 -3
- package/lib/data/site.js +2 -1
- package/lib/filters.js +64 -27
- package/lib/lesson-materials.js +3 -2
- package/lib/pdf.js +7 -1
- package/lib/plugin.js +3 -1
- package/lib/postcss.js +3 -1
- package/package.json +2 -1
- package/schemas/course.schema.json +5 -0
- package/schemas/instructor.schema.json +20 -0
- package/schemas/worksheet.schema.json +6 -1
- package/assets/scripts/theme-restore.js +0 -17
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
<script webc:setup>
|
|
2
2
|
/**
|
|
3
|
-
* The schedule page's header: the meeting line, the key dates, and a
|
|
4
|
-
* of jump
|
|
5
|
-
*
|
|
3
|
+
* The schedule page's header: the meeting line, the key dates, and a sticky
|
|
4
|
+
* row of one jump link per month, with the Hide past weeks toggle at its
|
|
5
|
+
* end. The month on screen is marked as the page scrolls. The row is
|
|
6
|
+
* sticky from 40em wide and static below it, where it would take too much
|
|
7
|
+
* of a phone's height. Props are read in the template, since a setup script
|
|
8
|
+
* cannot see them.
|
|
6
9
|
* @prop {{ title: string, items: object[] }[]} [groups] `scheduleKeyDates`
|
|
7
10
|
* output; built from the page's lessons, project and exam slot when left out
|
|
8
11
|
* @prop {object[]} [weeks] `scheduleWeeks` output, for the month links;
|
|
9
12
|
* built from the page when left out
|
|
13
|
+
* @prop {'short' | 'full'} [dateStyle] how the key dates write a project
|
|
14
|
+
* milestone's and the final exam's date: `full` (the default, "Friday,
|
|
15
|
+
* October 23, 2026, 12:00PM") or `short` ("Fri, Oct 23, 12:00PM"). Written
|
|
16
|
+
* `@date-style`
|
|
10
17
|
*/
|
|
11
18
|
const defaultGroups = scheduleKeyDates($data.lessons, $data.project, $data.schedule?.finalExam, $data.copy);
|
|
19
|
+
/** The key dates for a date style; the setup script cannot see props, so the template calls this with its own. */
|
|
20
|
+
const groupsFor = (style) => (style === "short" ? scheduleKeyDates($data.lessons, $data.project, $data.schedule?.finalExam, $data.copy, "short") : defaultGroups);
|
|
12
21
|
const defaultWeeks = scheduleWeeks($data.lessons, $data.schedule?.weeks, $data.collections?.deck, $data.demos);
|
|
13
22
|
</script>
|
|
14
23
|
<header webc:root="override" class="schedule-overview">
|
|
15
24
|
<today-marker></today-marker>
|
|
16
|
-
<eyebrow class="separators">
|
|
17
|
-
<span @text="$data.term.label"></span>
|
|
18
|
-
<span @text="$data.course.code"></span>
|
|
19
|
-
</eyebrow>
|
|
20
25
|
<h1 @text="$data.copy.scheduleOverview.schedule"></h1>
|
|
21
26
|
<p class="meets" webc:if="$data.schedule?.meetings?.days?.length">
|
|
22
27
|
<span @text="$data.schedule.meetings.days.length > 1 ? `${$data.schedule.meetings.days.slice(0, -1).join(', ')} & ${$data.schedule.meetings.days.at(-1)}` : $data.schedule.meetings.days[0]"></span>
|
|
@@ -24,9 +29,9 @@
|
|
|
24
29
|
<span webc:if="$data.instructor?.office" @text="$data.instructor.office"></span>
|
|
25
30
|
</p>
|
|
26
31
|
|
|
27
|
-
<section class="key-dates" aria-labelledby="schedule-key-dates" webc:if="(groups ??
|
|
32
|
+
<section class="key-dates" aria-labelledby="schedule-key-dates" webc:if="(groups ?? groupsFor(typeof dateStyle === 'undefined' ? undefined : dateStyle))?.length">
|
|
28
33
|
<h2 id="schedule-key-dates" @text="$data.copy.scheduleOverview.keyDates"></h2>
|
|
29
|
-
<div class="group" webc:for="group of (groups ??
|
|
34
|
+
<div class="group" webc:for="group of (groups ?? groupsFor(typeof dateStyle === 'undefined' ? undefined : dateStyle))">
|
|
30
35
|
<h3 @text="group.title"></h3>
|
|
31
36
|
<ul role="list">
|
|
32
37
|
<li webc:for="item of group.items">
|
|
@@ -38,13 +43,18 @@
|
|
|
38
43
|
</div>
|
|
39
44
|
</section>
|
|
40
45
|
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
<div class="schedule-bar" data-schedule-bar webc:if="scheduleMonths(weeks ?? defaultWeeks).length">
|
|
47
|
+
<nav class="schedule-jump" :aria-label="$data.copy.scheduleOverview.jumpTo">
|
|
48
|
+
<h2 @text="$data.copy.scheduleOverview.jumpTo"></h2>
|
|
49
|
+
<ul role="list">
|
|
50
|
+
<li webc:for="entry of scheduleMonths(weeks ?? defaultWeeks)"><a :href="`#week-${entry.week}`" :data-first-week="entry.week" :data-last-week="entry.last" @text="entry.name"></a></li>
|
|
51
|
+
</ul>
|
|
52
|
+
</nav>
|
|
53
|
+
<div class="schedule-toggle" data-schedule-tools hidden>
|
|
54
|
+
<p class="schedule-status" data-schedule-status role="status"></p>
|
|
55
|
+
<button type="button" class="hide-past" data-hide-past aria-pressed="false" @text="$data.copy.schedule.hidePast"></button>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
48
58
|
</header>
|
|
49
59
|
|
|
50
60
|
<style webc:scoped>
|
|
@@ -108,7 +118,56 @@
|
|
|
108
118
|
}
|
|
109
119
|
}
|
|
110
120
|
|
|
121
|
+
/* The row of month links and the toggle. From 40em it is sticky, pinned to the top of the page through the weeks: the header's own box is
|
|
122
|
+
dropped (`display: contents`) so the row's containing block is the whole page column, and the page's scroll-padding follows the row's height
|
|
123
|
+
(set by the script) so an anchor or a focused control is never under it. Below 40em it is a plain row, because on a phone it would take a
|
|
124
|
+
quarter of the screen. */
|
|
125
|
+
.schedule-bar {
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-wrap: wrap;
|
|
128
|
+
align-items: center;
|
|
129
|
+
justify-content: space-between;
|
|
130
|
+
gap: 0.25rem var(--content-space);
|
|
131
|
+
margin-block: var(--content-space);
|
|
132
|
+
|
|
133
|
+
@media screen and (width >= 40em) {
|
|
134
|
+
position: sticky;
|
|
135
|
+
inset-block-start: 0;
|
|
136
|
+
z-index: 10;
|
|
137
|
+
margin-block: 0;
|
|
138
|
+
padding-block: 0.4rem;
|
|
139
|
+
background-color: var(--color-page);
|
|
140
|
+
border-block-end: var(--thin-border-width) solid var(--color-border-strong);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@media screen and (width >= 40em) {
|
|
145
|
+
:host {
|
|
146
|
+
display: contents;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
:host > .schedule-bar + * {
|
|
150
|
+
margin-block-start: var(--content-space);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
111
154
|
.schedule-jump {
|
|
155
|
+
display: flex;
|
|
156
|
+
flex-wrap: wrap;
|
|
157
|
+
align-items: center;
|
|
158
|
+
gap: 0 var(--content-space);
|
|
159
|
+
min-inline-size: 0;
|
|
160
|
+
|
|
161
|
+
h2 {
|
|
162
|
+
margin: 0;
|
|
163
|
+
font-family: var(--sans-font);
|
|
164
|
+
font-size: var(--font-size-6);
|
|
165
|
+
font-weight: var(--font-weight--semi-bold);
|
|
166
|
+
letter-spacing: 0.08em;
|
|
167
|
+
text-transform: uppercase;
|
|
168
|
+
color: var(--color-text-muted);
|
|
169
|
+
}
|
|
170
|
+
|
|
112
171
|
ul {
|
|
113
172
|
display: flex;
|
|
114
173
|
flex-wrap: wrap;
|
|
@@ -134,12 +193,140 @@
|
|
|
134
193
|
background-color: var(--color-surface);
|
|
135
194
|
border-color: var(--color-accent);
|
|
136
195
|
}
|
|
196
|
+
|
|
197
|
+
/* The month on screen, set by the script as the page scrolls: a thick underline in the location accent. A shape, not a color alone, and
|
|
198
|
+
it changes no size, so nothing moves when the mark does. */
|
|
199
|
+
&[aria-current] {
|
|
200
|
+
text-decoration: underline;
|
|
201
|
+
text-decoration-color: var(--color-accent-secondary);
|
|
202
|
+
text-decoration-thickness: 0.2em;
|
|
203
|
+
text-underline-offset: 0.3em;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.schedule-toggle {
|
|
209
|
+
display: flex;
|
|
210
|
+
flex-wrap: wrap;
|
|
211
|
+
align-items: center;
|
|
212
|
+
gap: 0.25rem var(--content-space);
|
|
213
|
+
|
|
214
|
+
&[hidden] {
|
|
215
|
+
display: none;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* The count beside the button when there is room; below 48em it is hidden from sight and still announced (role="status"). */
|
|
220
|
+
.schedule-status {
|
|
221
|
+
margin: 0;
|
|
222
|
+
color: var(--color-text-muted);
|
|
223
|
+
|
|
224
|
+
@media screen and (width < 48em) {
|
|
225
|
+
position: absolute;
|
|
226
|
+
inline-size: 1px;
|
|
227
|
+
block-size: 1px;
|
|
228
|
+
overflow: hidden;
|
|
229
|
+
clip-path: inset(50%);
|
|
230
|
+
white-space: nowrap;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.hide-past {
|
|
235
|
+
min-block-size: var(--target-min);
|
|
236
|
+
min-inline-size: var(--target-min);
|
|
237
|
+
padding-inline: 1.1em;
|
|
238
|
+
border: var(--thin-border-width) solid var(--color-border-strong);
|
|
239
|
+
border-radius: var(--radius-pill);
|
|
240
|
+
background: transparent;
|
|
241
|
+
color: var(--color-text);
|
|
242
|
+
font: inherit;
|
|
243
|
+
font-weight: var(--font-weight--semi-bold);
|
|
244
|
+
cursor: pointer;
|
|
245
|
+
|
|
246
|
+
&[aria-pressed="true"] {
|
|
247
|
+
border-color: var(--color-accent-secondary);
|
|
248
|
+
background-color: var(--color-accent-secondary);
|
|
249
|
+
color: var(--color-on-accent-secondary);
|
|
250
|
+
--color-focus-ring: var(--color-on-accent-secondary);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
@media (forced-colors: active) {
|
|
255
|
+
.schedule-bar {
|
|
256
|
+
border-block-end-color: CanvasText;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.schedule-jump a[aria-current] {
|
|
260
|
+
text-decoration-color: Highlight;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.hide-past[aria-pressed="true"] {
|
|
264
|
+
forced-color-adjust: none;
|
|
265
|
+
background: SelectedItem;
|
|
266
|
+
border-color: SelectedItem;
|
|
267
|
+
color: SelectedItemText;
|
|
137
268
|
}
|
|
138
269
|
}
|
|
139
270
|
|
|
140
271
|
@media print {
|
|
141
|
-
.schedule-
|
|
272
|
+
.schedule-bar {
|
|
142
273
|
display: none;
|
|
143
274
|
}
|
|
144
275
|
}
|
|
145
276
|
</style>
|
|
277
|
+
|
|
278
|
+
<style>
|
|
279
|
+
/* The page scrolls under the sticky row: anchors and focused controls stop below it (WCAG 2.4.11, 2.4.12). The script sets the height. */
|
|
280
|
+
html:has(.schedule-bar) {
|
|
281
|
+
scroll-padding-block-start: calc(var(--schedule-bar-height, 0px) + 1rem);
|
|
282
|
+
}
|
|
283
|
+
</style>
|
|
284
|
+
|
|
285
|
+
<script>
|
|
286
|
+
/**
|
|
287
|
+
* Marks the month on screen in the row with `aria-current="location"`: the month of the week block that crosses a line just below the
|
|
288
|
+
* row (or, in the gap between two weeks, the next one); before the first week reaches it the first month, after the last week the last month. Sets `--schedule-bar-height`
|
|
289
|
+
* for the page's scroll-padding while the row is sticky. It changes no size and runs no animation.
|
|
290
|
+
*/
|
|
291
|
+
(() => {
|
|
292
|
+
const bar = document.querySelector("[data-schedule-bar]");
|
|
293
|
+
if (!bar || !bar.getClientRects().length) return;
|
|
294
|
+
const links = [...bar.querySelectorAll("a[data-first-week]")];
|
|
295
|
+
const weeks = [...document.querySelectorAll(".schedule-weeks .week[id^='week-']")];
|
|
296
|
+
if (!links.length || !weeks.length) return;
|
|
297
|
+
const range = links.map((link) => ({ link, first: Number(link.dataset.firstWeek), last: Number(link.dataset.lastWeek) }));
|
|
298
|
+
/** The month of a week: the latest month whose range holds it, so a week spanning two months reads as the second, where its link points. */
|
|
299
|
+
const monthOf = (number) => range.findLast(({ first, last }) => number >= first && number <= last) ?? range.at(-1);
|
|
300
|
+
const mark = () => {
|
|
301
|
+
const line = Math.max(0, bar.getBoundingClientRect().bottom) + 8;
|
|
302
|
+
const shown = weeks.filter((week) => !week.hidden);
|
|
303
|
+
if (!shown.length) return;
|
|
304
|
+
// The first week that is not wholly above the line: the one crossing it, or the next one when the line is in the gap between two,
|
|
305
|
+
// and the first week while the header is still on screen. After the last week, the last month.
|
|
306
|
+
const week = shown.find((candidate) => candidate.getBoundingClientRect().bottom > line);
|
|
307
|
+
// A page scrolled to its foot can leave the last week below the line: then the last month is the one on screen.
|
|
308
|
+
const bottomed = window.scrollY > 0 && window.scrollY + window.innerHeight >= document.documentElement.scrollHeight - 2;
|
|
309
|
+
const current = week && !bottomed ? monthOf(Number(week.id.slice(5))) : range.at(-1);
|
|
310
|
+
for (const { link } of range) {
|
|
311
|
+
if (link === current.link) link.setAttribute("aria-current", "location");
|
|
312
|
+
else link.removeAttribute("aria-current");
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
const measure = () => document.documentElement.style.setProperty("--schedule-bar-height", getComputedStyle(bar).position === "sticky" ? `${Math.ceil(bar.getBoundingClientRect().height)}px` : "0px");
|
|
316
|
+
let queued = false;
|
|
317
|
+
addEventListener("scroll", () => {
|
|
318
|
+
if (queued) return;
|
|
319
|
+
queued = true;
|
|
320
|
+
requestAnimationFrame(() => {
|
|
321
|
+
queued = false;
|
|
322
|
+
mark();
|
|
323
|
+
});
|
|
324
|
+
}, { passive: true });
|
|
325
|
+
new ResizeObserver(() => {
|
|
326
|
+
measure();
|
|
327
|
+
mark();
|
|
328
|
+
}).observe(bar);
|
|
329
|
+
measure();
|
|
330
|
+
mark();
|
|
331
|
+
})();
|
|
332
|
+
</script>
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Every week of the term as a bordered block: one row per class meeting
|
|
4
4
|
* (when, topics, and what that class needs: reading, due items, materials)
|
|
5
|
-
* and a footer for the week's own resources. A "This week" card
|
|
6
|
-
*
|
|
5
|
+
* and a footer for the week's own resources. A "This week" card and the
|
|
6
|
+
* Now and Done flags are added by the script, which also works the
|
|
7
|
+
* hide-past toggle that <schedule-overview> puts in its sticky row.
|
|
7
8
|
* Deadlines carry a chip for their `kind`; the key above the weeks lists
|
|
8
9
|
* the kinds in use. Wording comes from `copy.schedule`.
|
|
9
10
|
* @prop {object[]} [weeks] `scheduleWeeks` output; built from the page's
|
|
@@ -18,10 +19,6 @@
|
|
|
18
19
|
</script>
|
|
19
20
|
<div webc:root="override" class="schedule-weeks" data-today-host="meetings" webc:if="(weeks ?? defaultWeeks)?.length">
|
|
20
21
|
<today-marker></today-marker>
|
|
21
|
-
<div class="schedule-tools screen-only" data-schedule-tools hidden>
|
|
22
|
-
<p class="schedule-status" data-schedule-status role="status"></p>
|
|
23
|
-
<button type="button" class="hide-past" data-hide-past aria-pressed="false" @text="copy.hidePast"></button>
|
|
24
|
-
</div>
|
|
25
22
|
<section class="this-week screen-only" data-this-week aria-labelledby="this-week-heading" hidden>
|
|
26
23
|
<header class="this-head">
|
|
27
24
|
<p class="label" data-this-label @text="copy.thisWeek"></p>
|
|
@@ -40,7 +37,7 @@
|
|
|
40
37
|
</div>
|
|
41
38
|
</section>
|
|
42
39
|
<ul class="due-key" :aria-label="copy.dueKeyLabel" role="list" webc:if="dueKeyItems(weeks ?? defaultWeeks, $data.copy).length">
|
|
43
|
-
<li webc:for="entry of dueKeyItems(weeks ?? defaultWeeks, $data.copy)"><span class="due-chip" :data-kind="entry.kind" @text="entry.label"></span> <span @text="entry.
|
|
40
|
+
<li webc:for="entry of dueKeyItems(weeks ?? defaultWeeks, $data.copy)"><span class="due-chip" :data-kind="entry.kind" @text="entry.label"></span><template webc:nokeep webc:if="entry.note"> <span @text="entry.note"></span></template></li>
|
|
44
41
|
</ul>
|
|
45
42
|
<section class="week" webc:for="week of (weeks ?? defaultWeeks)" :id="`week-${week.week}`" :aria-labelledby="`week-${week.week}-heading`" :data-week-dates="weekDates(week)">
|
|
46
43
|
<header class="week-head">
|
|
@@ -128,8 +125,9 @@
|
|
|
128
125
|
const campusToday = () => new Date().toLocaleDateString("en-CA", { timeZone: document.documentElement.dataset.timezone });
|
|
129
126
|
const { t } = window.ckCopy;
|
|
130
127
|
const root = document.querySelector(".schedule-weeks");
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
if (!root) return;
|
|
129
|
+
// The hide-past toggle is in <schedule-overview>'s row, above the weeks; with no overview there is no toggle.
|
|
130
|
+
const tools = document.querySelector("[data-schedule-tools]");
|
|
133
131
|
const today = campusToday();
|
|
134
132
|
const weeks = [...root.querySelectorAll(".week[data-week-dates]")]
|
|
135
133
|
.map((el) => ({ el, dates: el.dataset.weekDates.split(/\s+/).filter(Boolean).sort() }))
|
|
@@ -208,15 +206,15 @@
|
|
|
208
206
|
}
|
|
209
207
|
|
|
210
208
|
// One label, "Hide past weeks"; the state is aria-pressed. Not saved: every visit starts with all weeks shown.
|
|
211
|
-
const button = tools
|
|
212
|
-
const status = tools
|
|
209
|
+
const button = tools?.querySelector("[data-hide-past]");
|
|
210
|
+
const status = tools?.querySelector("[data-schedule-status]");
|
|
213
211
|
const past = weeks.filter(({ el }) => el.hasAttribute("data-past"));
|
|
214
212
|
const apply = (hide) => {
|
|
215
213
|
button.setAttribute("aria-pressed", String(hide));
|
|
216
214
|
for (const { el } of past) el.hidden = hide;
|
|
217
215
|
status.textContent = hide ? t("schedule", "pastHidden", { count: past.length }) : t("schedule", "weeksDone", { done: past.length, total: weeks.length });
|
|
218
216
|
};
|
|
219
|
-
if (past.length) {
|
|
217
|
+
if (button && status && past.length) {
|
|
220
218
|
apply(false);
|
|
221
219
|
button.addEventListener("click", () => apply(button.getAttribute("aria-pressed") !== "true"));
|
|
222
220
|
tools.hidden = false;
|
|
@@ -424,44 +422,6 @@
|
|
|
424
422
|
}
|
|
425
423
|
}
|
|
426
424
|
|
|
427
|
-
/* The toolbar over the weeks: the count and the hide-past toggle. */
|
|
428
|
-
.schedule-tools {
|
|
429
|
-
display: flex;
|
|
430
|
-
flex-wrap: wrap;
|
|
431
|
-
align-items: center;
|
|
432
|
-
justify-content: space-between;
|
|
433
|
-
gap: calc(var(--gutter) * 2) var(--content-space);
|
|
434
|
-
|
|
435
|
-
&[hidden] {
|
|
436
|
-
display: none;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
.schedule-status {
|
|
441
|
-
margin: 0;
|
|
442
|
-
color: var(--color-text-muted);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
.hide-past {
|
|
446
|
-
min-block-size: var(--target-min);
|
|
447
|
-
min-inline-size: var(--target-min);
|
|
448
|
-
padding-inline: 1.1em;
|
|
449
|
-
border: var(--thin-border-width) solid var(--color-border-strong);
|
|
450
|
-
border-radius: var(--radius-pill);
|
|
451
|
-
background: transparent;
|
|
452
|
-
color: var(--color-text);
|
|
453
|
-
font: inherit;
|
|
454
|
-
font-weight: var(--font-weight--semi-bold);
|
|
455
|
-
cursor: pointer;
|
|
456
|
-
|
|
457
|
-
&[aria-pressed="true"] {
|
|
458
|
-
border-color: var(--color-accent-secondary);
|
|
459
|
-
background-color: var(--color-accent-secondary);
|
|
460
|
-
color: var(--color-on-accent-secondary);
|
|
461
|
-
--color-focus-ring: var(--color-on-accent-secondary);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
425
|
/* "This week": the current week's classes side by side, then what to
|
|
466
426
|
read and what is due. Filled and revealed by the script. */
|
|
467
427
|
.this-week {
|
|
@@ -488,6 +448,13 @@
|
|
|
488
448
|
.week-of {
|
|
489
449
|
font-weight: var(--font-weight);
|
|
490
450
|
}
|
|
451
|
+
|
|
452
|
+
/* The week's own link is an operable target: 44px tall (WCAG 2.5.5). */
|
|
453
|
+
h3 a {
|
|
454
|
+
display: inline-flex;
|
|
455
|
+
align-items: center;
|
|
456
|
+
min-block-size: var(--target-min);
|
|
457
|
+
}
|
|
491
458
|
}
|
|
492
459
|
|
|
493
460
|
.this-days {
|
|
@@ -551,6 +518,13 @@
|
|
|
551
518
|
li + li {
|
|
552
519
|
margin-block-start: 0.4em;
|
|
553
520
|
}
|
|
521
|
+
|
|
522
|
+
/* A link that heads its item is a 44px target; the chip and the check line sit beside it. */
|
|
523
|
+
li > a {
|
|
524
|
+
display: inline-flex;
|
|
525
|
+
align-items: center;
|
|
526
|
+
min-block-size: var(--target-min);
|
|
527
|
+
}
|
|
554
528
|
}
|
|
555
529
|
|
|
556
530
|
.week[data-current] {
|
|
@@ -581,7 +555,6 @@
|
|
|
581
555
|
/* Print: the weeks as a plain list, without the card, tools or heads. */
|
|
582
556
|
@media print {
|
|
583
557
|
.this-week,
|
|
584
|
-
.schedule-tools,
|
|
585
558
|
.week-cols {
|
|
586
559
|
display: none;
|
|
587
560
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script webc:setup>
|
|
2
2
|
/**
|
|
3
|
-
* The page footer: course, institution, term, copyright and the links. Reads `course`, `site` and `term`.
|
|
3
|
+
* The page footer: course, institution, term, copyright and the links. Reads `course`, `site` and `term`. With `institution.sourceUrl` set it also links to the course's source.
|
|
4
4
|
*/
|
|
5
5
|
</script>
|
|
6
6
|
<div webc:root="override">
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
<span @text="$data.term.label"></span>
|
|
12
12
|
</p>
|
|
13
13
|
<copyright></copyright>
|
|
14
|
+
<p class="source" webc:if="$data.site.sourceUrl"><a :href="$data.site.sourceUrl" rel="noopener" @text="$data.copy.nav.openSource"></a></p>
|
|
14
15
|
</div>
|
|
15
16
|
<div class="group">
|
|
16
17
|
<p class="label" id="footer-pages" @text="$data.copy.siteFooter.pages"></p>
|
|
@@ -102,8 +103,21 @@
|
|
|
102
103
|
font-size: 1em;
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
|
|
106
|
+
.source {
|
|
107
|
+
margin: 0;
|
|
108
|
+
max-inline-size: none;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* The course name is one run of text, "CS101: Introduction…": inline-flex would make each span a flex item and drop the spaces between them. */
|
|
106
112
|
.course a {
|
|
113
|
+
display: inline-block;
|
|
114
|
+
/* 44px tall (WCAG 2.5.5) with the text centered, however many lines it wraps to. */
|
|
115
|
+
padding-block: max(0px, calc((var(--target-min) - 1lh) / 2));
|
|
116
|
+
font-size: max(var(--base-font-size), 1em);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
nav.group a,
|
|
120
|
+
.source a {
|
|
107
121
|
display: inline-flex;
|
|
108
122
|
align-items: center;
|
|
109
123
|
min-block-size: var(--target-min);
|
|
@@ -32,13 +32,10 @@
|
|
|
32
32
|
</div>
|
|
33
33
|
|
|
34
34
|
<script webc:keep>
|
|
35
|
-
/* Set the editor theme before ei.js builds the iframe. */
|
|
35
|
+
/* Set the editor theme before ei.js builds the iframe: it follows the system. */
|
|
36
36
|
(function () {
|
|
37
37
|
try {
|
|
38
|
-
var
|
|
39
|
-
var dark =
|
|
40
|
-
forced === "dark" ||
|
|
41
|
-
(forced !== "light" && matchMedia("(prefers-color-scheme: dark)").matches);
|
|
38
|
+
var dark = matchMedia("(prefers-color-scheme: dark)").matches;
|
|
42
39
|
document.querySelectorAll(".codepen[data-prefill]").forEach(function (embed) {
|
|
43
40
|
embed.dataset.themeId = dark ? "dark" : "light";
|
|
44
41
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script webc:setup>
|
|
2
2
|
/**
|
|
3
|
-
* A download link with an icon. The label is the slot.
|
|
4
|
-
* @prop {string} url the file to download
|
|
3
|
+
* A download link with an icon. The label is the slot. With no file there is no link: a download button that points nowhere is not shown.
|
|
4
|
+
* @prop {string} url the file to download. Only a string counts: a prop that is not given can resolve to Eleventy's `url` filter, which would print as the function's source
|
|
5
5
|
*/
|
|
6
6
|
</script>
|
|
7
|
-
<a webc:root="override" :href="url" download>
|
|
7
|
+
<a webc:root="override" :href="typeof url === 'string' && url ? url : undefined" webc:if="typeof url === 'string' && url" download>
|
|
8
8
|
<svg aria-hidden="true" width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" class="download-icon">
|
|
9
9
|
<path d="M8 2v8" />
|
|
10
10
|
<path d="M4.5 7 8 10.5 11.5 7" />
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @prop {string[]} [levels] level names across the top
|
|
6
6
|
* @prop {string} [caption] a screen-reader caption
|
|
7
7
|
* @prop {number} [total] the points the rubric adds up to, shown in the footer
|
|
8
|
+
* @prop {'short' | 'full'} [dateStyle] how a milestone's due date is written in the narrow Due column: `short` (the default, "Fri, Oct 23, 12:00PM") or `full` ("Friday, October 23, 2026, 12:00PM"). Written `@date-style`
|
|
8
9
|
* @prop {Record<string, string>} copy the table's wording: `copy.tableRubric` (`criteria`, `points`, `pointsEach`, `totalPointsPossible`, `milestone`, `due`, `whatIsGraded`)
|
|
9
10
|
*/
|
|
10
11
|
</script>
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
<span class="id" webc:if="criterion.id" @text="criterion.id"></span>
|
|
48
49
|
<span @text="criterion.title"></span>
|
|
49
50
|
</th>
|
|
50
|
-
<td role="cell" class="due"><span class="cell-label" aria-hidden="true" @text="copy.due"></span><span @text="criterion.due ?
|
|
51
|
+
<td role="cell" class="due"><span class="cell-label" aria-hidden="true" @text="copy.due"></span><span @text="criterion.due ? dateIn(criterion.due, typeof dateStyle === 'undefined' ? 'short' : dateStyle) + (criterion.dueTime ? `, ${timeOfDay(criterion.dueTime)}` : '') : ''"></span></td>
|
|
51
52
|
<td role="cell" class="num"><span class="cell-label" aria-hidden="true" @text="copy.points"></span><span @text="criterion.points"></span></td>
|
|
52
53
|
<td role="cell"><span class="cell-label" aria-hidden="true" @text="copy.whatIsGraded"></span><span @text="criterion.description"></span></td>
|
|
53
54
|
</tr>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"topics": ["Writing HTML", "Headings, lists and links"],
|
|
12
|
-
"readings": [{ "title": "MDN: HTML basics", "href": "https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/HTML_basics", "check": "3 questions, due by the next class" }],
|
|
12
|
+
"readings": [{ "title": "MDN: HTML basics", "href": "https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/HTML_basics", "check": "3 questions, due by the next class", "due": "2026-09-03" }],
|
|
13
13
|
"resources": []
|
|
14
14
|
},
|
|
15
15
|
{
|
package/layouts/deck.webc
CHANGED
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
|
|
12
12
|
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
|
13
13
|
|
|
14
|
-
<template webc:nokeep @raw="bundleFile('js', 'content/scripts/theme-restore.js', $data, 'head')"></template>
|
|
15
|
-
<script webc:keep @raw="getBundle('js', 'head')"></script>
|
|
16
|
-
|
|
17
14
|
<template webc:nokeep @raw="bundleFile('css', 'content/styles/deck.css', $data)"></template>
|
|
18
15
|
<style webc:keep @raw="getBundle('css')"></style>
|
|
19
16
|
</head>
|
|
@@ -30,7 +27,6 @@
|
|
|
30
27
|
<button type="button" data-prev :aria-label="$data.copy.deck.previousSlide">←</button>
|
|
31
28
|
<span data-count aria-live="polite">1 / 1</span>
|
|
32
29
|
<button type="button" data-next :aria-label="$data.copy.deck.nextSlide">→</button>
|
|
33
|
-
<button type="button" data-toggle-theme :aria-label="$data.copy.deck.cycleColorTheme">◑</button>
|
|
34
30
|
<button type="button" data-toggle-fullscreen aria-pressed="false" :aria-label="$data.copy.deck.toggleFullscreen" hidden>⛶</button>
|
|
35
31
|
</div>
|
|
36
32
|
|
package/layouts/document.webc
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
layout: "base"
|
|
3
3
|
---
|
|
4
4
|
<div class="doc-layout" :data-contents="toc(content) ? 'true' : 'false'">
|
|
5
|
+
<!-- The page comes first in the source, so its h1 is the first thing a screen reader reaches; the contents rail is placed beside it, or after it on a phone, by the grid. -->
|
|
6
|
+
<article class="content-column" @raw="content"></article>
|
|
5
7
|
<div class="doc-contents" webc:if="toc(content)">
|
|
6
8
|
<p class="rail-label" id="doc-contents-label" @text="$data.copy.document.contents"></p>
|
|
7
9
|
<template webc:nokeep @raw="toc(content).replaceAll('"># ', '">').replace('<nav ', '<nav aria-labelledby="doc-contents-label" ')"></template>
|
|
8
10
|
</div>
|
|
9
|
-
<article class="content-column" @raw="content"></article>
|
|
10
11
|
</div>
|
package/layouts/lesson.webc
CHANGED
|
@@ -7,10 +7,6 @@ layout: "base"
|
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<section class="lesson-list content-column wide">
|
|
10
|
-
<eyebrow class="separators">
|
|
11
|
-
<span @text="$data.term.label"></span>
|
|
12
|
-
<span @text="$data.code"></span>
|
|
13
|
-
</eyebrow>
|
|
14
10
|
<h1 @text="copy.lessonPlans"></h1>
|
|
15
11
|
<p @text="fill(copy.onePlanPerClass, { time: timeOfDay($data.schedule?.meetings?.time) })"></p>
|
|
16
12
|
<p webc:if="$data.collections.deck?.length" @raw="fill(copy.everyDeckInMeeting, { link: link('/slides/', copy.slideIndex) })"></p>
|
|
@@ -48,14 +44,14 @@ layout: "base"
|
|
|
48
44
|
<td webc:if="lesson.noClass" colspan="2" class="muted no-class" @text="fill(copy.noClass, { reason: lesson.noClass })"></td>
|
|
49
45
|
<template webc:else webc:nokeep>
|
|
50
46
|
<td>
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
</
|
|
47
|
+
<ul class="lesson-links" role="list">
|
|
48
|
+
<li><a :href="`/lessons/week-${lesson.week}/day-${lesson.day}/`" @text="copy.lessonPlan"></a></li>
|
|
49
|
+
<template webc:nokeep webc:for="deck of ($data.collections.deck ?? []).filter((d) => d.data.week === lesson.week && d.data.day === lesson.day)">
|
|
50
|
+
<li><a :href="deck.url" @text="deck.data.addendum ? copy.addendum : copy.slides"></a></li>
|
|
51
|
+
<li><a :href="deckNotesUrl(deck.data.week, deck.data.day, deck.data.addendum === true)" @text="deck.data.addendum ? copy.addendumNotes : copy.notes"></a></li>
|
|
52
|
+
</template>
|
|
53
|
+
<li webc:for="assignment of assignmentsDue($data.collections.assignment, lesson, $data.lessons)"><span @text="copy.due"></span> <a :href="assignment.url" @text="assignment.title"></a> (<span @text="assignment.dueLabel"></span>)</li>
|
|
54
|
+
</ul>
|
|
59
55
|
</td>
|
|
60
56
|
<td>
|
|
61
57
|
<span webc:for="(topic, index) of lesson.topics" webc:nokeep>
|
package/lib/check.js
CHANGED
|
@@ -7,7 +7,7 @@ const OPTIONS = {
|
|
|
7
7
|
theme: null,
|
|
8
8
|
copy: null,
|
|
9
9
|
clientCopy: null,
|
|
10
|
-
institution: ["name", "timezone", "lms"],
|
|
10
|
+
institution: ["name", "timezone", "lms", "sourceUrl"],
|
|
11
11
|
site: ["description", "keywords", "language"],
|
|
12
12
|
lessons: ["segments", "defaultDays"],
|
|
13
13
|
demos: ["runtime", "dir"],
|
|
@@ -15,6 +15,7 @@ const OPTIONS = {
|
|
|
15
15
|
pdf: ["course", "term", "dataDir"],
|
|
16
16
|
prism: ["theme", "plugins"],
|
|
17
17
|
worksheets: ["checkMode"],
|
|
18
|
+
dateFormats: ["locale", "full", "short"],
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
const RUNTIMES = ["none", "codepen", "pyscript"];
|
|
@@ -77,10 +78,31 @@ export function checkOptions(options = {}) {
|
|
|
77
78
|
throw new Error(`courseKit: \`institution.timezone\` is "${timeZone}", which is not a time zone name. Use one like "America/New_York".`);
|
|
78
79
|
}
|
|
79
80
|
}
|
|
81
|
+
const sourceUrl = options.institution?.sourceUrl;
|
|
82
|
+
if (sourceUrl !== undefined && !/^https?:\/\/[^\s/]+\.[^\s]+$/.test(String(sourceUrl))) {
|
|
83
|
+
throw new Error(`courseKit: \`institution.sourceUrl\` is ${JSON.stringify(sourceUrl)}, but it must be a web address such as "https://github.com/your-org/your-course".`);
|
|
84
|
+
}
|
|
80
85
|
const checkMode = options.worksheets?.checkMode;
|
|
81
86
|
if (checkMode !== undefined && !["question", "end"].includes(checkMode)) {
|
|
82
87
|
throw new Error(`courseKit: \`worksheets.checkMode\` is "${checkMode}", but it must be "question" or "end".`);
|
|
83
88
|
}
|
|
89
|
+
const { locale, full, short } = options.dateFormats ?? {};
|
|
90
|
+
if (locale !== undefined) {
|
|
91
|
+
try {
|
|
92
|
+
new Intl.DateTimeFormat(locale);
|
|
93
|
+
} catch {
|
|
94
|
+
throw new Error(`courseKit: \`dateFormats.locale\` is ${JSON.stringify(locale)}, which is not a language tag. Use one like "en-US" or "fr-CA".`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
for (const [name, format] of [["full", full], ["short", short]]) {
|
|
98
|
+
if (format === undefined) continue;
|
|
99
|
+
try {
|
|
100
|
+
if (format === null || typeof format !== "object" || Array.isArray(format)) throw new TypeError("not an object");
|
|
101
|
+
new Intl.DateTimeFormat(locale ?? "en-US", { timeZone: "UTC", ...format });
|
|
102
|
+
} catch {
|
|
103
|
+
throw new Error(`courseKit: \`dateFormats.${name}\` must be Intl.DateTimeFormat options, such as { weekday: "short", month: "short", day: "numeric" }.`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
84
106
|
if (options.components !== undefined && !Array.isArray(options.components)) {
|
|
85
107
|
throw new Error("courseKit: `components` must be a list of file patterns, such as [\"components/*.webc\"].");
|
|
86
108
|
}
|