@allons-y/course-kit 0.2.0 → 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/README.md +1 -1
- package/assets/scripts/deck.js +3 -34
- package/assets/styles/base.css +54 -1
- package/assets/styles/print.css +8 -1
- package/components/practice/practice-worksheet.webc +1 -5
- package/components/site/course-now.webc +7 -0
- package/components/site/glossary.webc +0 -5
- package/components/site/masthead.webc +11 -1
- package/components/site/nav-links.webc +16 -0
- package/components/site/schedule-overview.webc +196 -15
- 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/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 +5 -1
- package/lib/copy.js +0 -3
- package/lib/data/site.js +2 -1
- package/lib/filters.js +11 -8
- package/lib/lesson-materials.js +3 -2
- package/lib/pdf.js +7 -1
- package/lib/postcss.js +3 -1
- package/package.json +2 -1
- package/schemas/course.schema.json +5 -0
- package/schemas/worksheet.schema.json +6 -1
- package/assets/scripts/theme-restore.js +0 -17
package/README.md
CHANGED
package/assets/scripts/deck.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Slide deck controller: which slide is showing
|
|
2
|
+
* Slide deck controller: which slide is showing. The deck's colors follow the
|
|
3
|
+
* system light/dark setting, like the rest of the site. Speaker
|
|
3
4
|
* notes never reach a deck; they live on the instructor notes sheet.
|
|
4
5
|
* Loaded only by _layouts/deck.webc, a standalone document with none of the
|
|
5
6
|
* site chrome (masthead, base.css).
|
|
6
7
|
*
|
|
7
8
|
* Keys: → ↓ Space PageDown next, ← ↑ PageUp previous, Home/End ends,
|
|
8
|
-
* Enter reveal,
|
|
9
|
+
* Enter reveal, F fullscreen.
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
const deck = document.querySelector(".deck");
|
|
@@ -14,32 +15,6 @@ const counter = document.querySelector("[data-count]");
|
|
|
14
15
|
const fullscreenToggle = document.querySelector("[data-toggle-fullscreen]");
|
|
15
16
|
const root = document.documentElement;
|
|
16
17
|
|
|
17
|
-
/* The deck's own light/dark/system choice, kept for the next time it opens.
|
|
18
|
-
The site has no switcher and always follows the system. */
|
|
19
|
-
const THEME_KEY = "theme";
|
|
20
|
-
const THEMES = ["system", "light", "dark"];
|
|
21
|
-
|
|
22
|
-
const readTheme = () => {
|
|
23
|
-
try {
|
|
24
|
-
const stored = localStorage.getItem(THEME_KEY);
|
|
25
|
-
return THEMES.includes(stored) ? stored : "system";
|
|
26
|
-
} catch {
|
|
27
|
-
return "system";
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const applyTheme = (theme) => {
|
|
32
|
-
root.style.colorScheme = theme === "system" ? "light dark" : theme;
|
|
33
|
-
root.dataset.theme = theme;
|
|
34
|
-
try {
|
|
35
|
-
localStorage.setItem(THEME_KEY, theme);
|
|
36
|
-
} catch {
|
|
37
|
-
/* Private browsing: the deck still themes, it just won't be remembered. */
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const cycleTheme = () => applyTheme(THEMES[(THEMES.indexOf(readTheme()) + 1) % THEMES.length]);
|
|
42
|
-
|
|
43
18
|
/* lock() needs fullscreen and is Android-only; iOS has neither. Every step
|
|
44
19
|
is feature-detected and fails quietly. */
|
|
45
20
|
const toggleFullscreen = async () => {
|
|
@@ -131,9 +106,6 @@ document.addEventListener("keydown", (event) => {
|
|
|
131
106
|
return go(0);
|
|
132
107
|
case "End":
|
|
133
108
|
return go(slides.length - 1);
|
|
134
|
-
case "t":
|
|
135
|
-
case "T":
|
|
136
|
-
return cycleTheme();
|
|
137
109
|
case "f":
|
|
138
110
|
case "F":
|
|
139
111
|
event.preventDefault();
|
|
@@ -151,11 +123,8 @@ if (fullscreenToggle && document.fullscreenEnabled) {
|
|
|
151
123
|
fullscreenToggle.hidden = false;
|
|
152
124
|
fullscreenToggle.addEventListener("click", toggleFullscreen);
|
|
153
125
|
}
|
|
154
|
-
document.querySelector("[data-toggle-theme]").addEventListener("click", cycleTheme);
|
|
155
126
|
document.querySelector("[data-prev]").addEventListener("click", () => setIndex(index - 1));
|
|
156
127
|
document.querySelector("[data-next]").addEventListener("click", next);
|
|
157
128
|
|
|
158
|
-
applyTheme(readTheme());
|
|
159
|
-
|
|
160
129
|
const fromHash = Number.parseInt(location.hash.replace("#s", ""), 10);
|
|
161
130
|
setIndex(Number.isFinite(fromHash) ? fromHash - 1 : 0, Number.isFinite(fromHash));
|
package/assets/styles/base.css
CHANGED
|
@@ -1013,9 +1013,26 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
|
|
|
1013
1013
|
|
|
1014
1014
|
.doc-layout[data-contents="true"] {
|
|
1015
1015
|
grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
|
|
1016
|
+
/* The page is first in the source; the grid puts the contents beside it, or above it on a narrow screen. */
|
|
1017
|
+
grid-template-areas: "contents page";
|
|
1016
1018
|
|
|
1017
1019
|
@media screen and (width <= 900px) {
|
|
1018
1020
|
grid-template-columns: minmax(0, 1fr);
|
|
1021
|
+
grid-template-areas:
|
|
1022
|
+
"contents"
|
|
1023
|
+
"page";
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
@media print {
|
|
1027
|
+
grid-template-areas: none;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
> .doc-contents {
|
|
1031
|
+
grid-area: contents;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
> .content-column {
|
|
1035
|
+
grid-area: page;
|
|
1019
1036
|
}
|
|
1020
1037
|
}
|
|
1021
1038
|
|
|
@@ -1063,7 +1080,10 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
|
|
|
1063
1080
|
}
|
|
1064
1081
|
|
|
1065
1082
|
li a[href] {
|
|
1066
|
-
display:
|
|
1083
|
+
display: flex;
|
|
1084
|
+
align-items: center;
|
|
1085
|
+
/* An operable target: 44px tall (WCAG 2.5.5); print sets --target-min to 0. */
|
|
1086
|
+
min-block-size: var(--target-min);
|
|
1067
1087
|
margin-inline-start: calc(var(--border-width) * -1);
|
|
1068
1088
|
padding: 0.35em 0.9em;
|
|
1069
1089
|
border-inline-start: var(--border-width) solid transparent;
|
|
@@ -1099,6 +1119,19 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
|
|
|
1099
1119
|
}
|
|
1100
1120
|
|
|
1101
1121
|
/* ---- Lesson plans (instructor) ---- */
|
|
1122
|
+
/* A list of links in a table cell: each whole-item link is a 44px target, a link inside a sentence keeps its line. */
|
|
1123
|
+
.lesson-links {
|
|
1124
|
+
margin: 0;
|
|
1125
|
+
padding: 0;
|
|
1126
|
+
list-style: none;
|
|
1127
|
+
|
|
1128
|
+
li > a:only-child {
|
|
1129
|
+
display: inline-flex;
|
|
1130
|
+
align-items: center;
|
|
1131
|
+
min-block-size: var(--target-min);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1102
1135
|
.lesson-nav {
|
|
1103
1136
|
display: flex;
|
|
1104
1137
|
gap: calc(var(--content-space) * 2);
|
|
@@ -1109,6 +1142,12 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
|
|
|
1109
1142
|
margin: 0;
|
|
1110
1143
|
}
|
|
1111
1144
|
|
|
1145
|
+
a {
|
|
1146
|
+
display: inline-flex;
|
|
1147
|
+
align-items: center;
|
|
1148
|
+
min-block-size: var(--target-min);
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1112
1151
|
@media print {
|
|
1113
1152
|
display: none;
|
|
1114
1153
|
}
|
|
@@ -1210,6 +1249,13 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
|
|
|
1210
1249
|
td {
|
|
1211
1250
|
border-inline: none;
|
|
1212
1251
|
}
|
|
1252
|
+
|
|
1253
|
+
/* A link that is the whole cell is an operable target: 44px tall (WCAG 2.5.5); print sets --target-min to 0. */
|
|
1254
|
+
:where(td, th) > a:only-child {
|
|
1255
|
+
display: inline-flex;
|
|
1256
|
+
align-items: center;
|
|
1257
|
+
min-block-size: var(--target-min);
|
|
1258
|
+
}
|
|
1213
1259
|
}
|
|
1214
1260
|
|
|
1215
1261
|
figure > :where(table) {
|
|
@@ -1456,6 +1502,13 @@ blockquote {
|
|
|
1456
1502
|
max-inline-size: 80ch;
|
|
1457
1503
|
}
|
|
1458
1504
|
|
|
1505
|
+
/* A link that is the whole paragraph (a policy's "full text") is a 44px target; a link inside a sentence keeps the line. */
|
|
1506
|
+
p > a:only-child {
|
|
1507
|
+
display: inline-flex;
|
|
1508
|
+
align-items: center;
|
|
1509
|
+
min-block-size: var(--target-min);
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1459
1512
|
details {
|
|
1460
1513
|
margin-block: 0;
|
|
1461
1514
|
padding: 0;
|
package/assets/styles/print.css
CHANGED
|
@@ -3,13 +3,20 @@
|
|
|
3
3
|
Odd layouts are Chromium print-fragmentation workarounds. */
|
|
4
4
|
|
|
5
5
|
@media print {
|
|
6
|
+
/* The margins the syllabus PDF is generated with (lib/pdf.js). An @page margin outranks the margin option of the PDF call, so a zero here
|
|
7
|
+
printed the text to the paper's edge and put the page footer, which sits in the bottom margin, over the last line. */
|
|
6
8
|
@page {
|
|
7
9
|
size: letter;
|
|
8
|
-
margin: 0;
|
|
10
|
+
margin: 0.4in 0.5in 0.45in;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
/* Grayscale — neutralize every token. */
|
|
12
14
|
:root {
|
|
15
|
+
/* Paper is the measure: the on-screen reading cap of base.css (68ch) would narrow every paragraph, list item and definition. */
|
|
16
|
+
--measure: none;
|
|
17
|
+
/* The display face is a system serif stack that is not hosted, so a PDF built on another machine prints in whatever serif it has (Caladea on a Linux runner).
|
|
18
|
+
Print headings and run-in labels in the hosted text face, so the PDF is the same everywhere. */
|
|
19
|
+
--display-font: var(--sans-font);
|
|
13
20
|
/* A printed page has no pointer: links and summaries keep their text height. */
|
|
14
21
|
--target-min: 0px;
|
|
15
22
|
--color-text: #000;
|
|
@@ -6,11 +6,7 @@
|
|
|
6
6
|
<article class="content-column practice" id="worksheet" data-worksheet webc:if="$data.worksheet"
|
|
7
7
|
:data-storage-id="`${$data.course.code.toLowerCase()}/${$data.page.fileSlug}`">
|
|
8
8
|
<header class="practice-head">
|
|
9
|
-
<eyebrow
|
|
10
|
-
<span @text="$data.term.label"></span>
|
|
11
|
-
<span @text="$data.course.code"></span>
|
|
12
|
-
<span @text="$data.worksheet.eyebrow"></span>
|
|
13
|
-
</eyebrow>
|
|
9
|
+
<eyebrow webc:if="$data.worksheet.eyebrow" @text="$data.worksheet.eyebrow"></eyebrow>
|
|
14
10
|
<h1 @text="$data.worksheet.heading"></h1>
|
|
15
11
|
<p class="not-graded" @text="$data.worksheet.copy.notGraded"></p>
|
|
16
12
|
<p class="lede" @text="$data.worksheet.lede"></p>
|
|
@@ -288,6 +288,13 @@
|
|
|
288
288
|
font-weight: var(--font-weight--semi-bold);
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
+
/* A link is an operable target: 44px tall (WCAG 2.5.5). */
|
|
292
|
+
a.what {
|
|
293
|
+
display: inline-flex;
|
|
294
|
+
align-items: center;
|
|
295
|
+
min-block-size: var(--target-min);
|
|
296
|
+
}
|
|
297
|
+
|
|
291
298
|
.due {
|
|
292
299
|
flex-basis: 100%;
|
|
293
300
|
color: var(--color-text-muted);
|
|
@@ -8,11 +8,6 @@
|
|
|
8
8
|
</script>
|
|
9
9
|
<article class="content-column glossary" id="glossary" webc:if="$data.glossary?.terms?.length">
|
|
10
10
|
<header>
|
|
11
|
-
<eyebrow class="separators">
|
|
12
|
-
<span @text="$data.term.label"></span>
|
|
13
|
-
<span @text="$data.course.code"></span>
|
|
14
|
-
<span @text="$data.copy.glossary.glossary"></span>
|
|
15
|
-
</eyebrow>
|
|
16
11
|
<h1 @text="$data.copy.glossary.courseGlossary"></h1>
|
|
17
12
|
<p class="intro">
|
|
18
13
|
<strong @text="$data.glossary.terms.length"></strong>
|
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* The page header: institution, term, course title and the navigation. Reads `site`, `term` and `course`.
|
|
4
4
|
* The menu is Home, Syllabus, then every page of the site menu that has not set `menu: false`.
|
|
5
|
+
* @prop {'auto' | 1 | 2} [navColumns] how many columns the menu is set in: `auto` (the default) sets it in two columns when it has more than 3 links, so a long menu keeps the header short, and in one stack otherwise; `1` and `2` fix it either way. The same as `"navColumns"` in `course.json`, and wins over it
|
|
5
6
|
*/
|
|
7
|
+
/** Links shown in the hero menu before which the menu stays a single stack. */
|
|
8
|
+
const MAX_STACKED = 3;
|
|
9
|
+
/** The prop wins over the course's `navColumns`; `auto`, or nothing, counts the links the hero shows (the instructor's contact link is one of them). */
|
|
10
|
+
const twoColumns = (data, prop, linkCount) => {
|
|
11
|
+
const wanted = prop ?? data.course?.navColumns;
|
|
12
|
+
if (wanted === undefined || wanted === "auto") return linkCount + (data.instructor?.contact ? 1 : 0) > MAX_STACKED;
|
|
13
|
+
return Number(wanted) === 2;
|
|
14
|
+
};
|
|
6
15
|
const navItems = (() => {
|
|
7
16
|
const items = eleventyNavigation($data.collections.all);
|
|
8
17
|
const home = items.find((item) => item.url === "/");
|
|
@@ -30,7 +39,8 @@
|
|
|
30
39
|
</p>
|
|
31
40
|
</div>
|
|
32
41
|
<div class="links">
|
|
33
|
-
<nav-links column :aria-label="$data.copy.nav.site" @context="hero" :@navigation="navItems"></nav-links>
|
|
42
|
+
<nav-links column two-column webc:if="twoColumns($data, typeof navColumns === 'undefined' ? undefined : navColumns, navItems.length)" :aria-label="$data.copy.nav.site" @context="hero" :@navigation="navItems"></nav-links>
|
|
43
|
+
<nav-links column webc:else :aria-label="$data.copy.nav.site" @context="hero" :@navigation="navItems"></nav-links>
|
|
34
44
|
</div>
|
|
35
45
|
</div>
|
|
36
46
|
</header>
|
|
@@ -123,6 +123,22 @@
|
|
|
123
123
|
display: block;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
/* Two columns (`two-column`, used by the hero): the same stack split into two
|
|
127
|
+
newspaper columns, read top to bottom then across, so a long list stays
|
|
128
|
+
short. Narrow screens keep the column variant's wrapped row. */
|
|
129
|
+
@media screen and (width > 768px) {
|
|
130
|
+
:host([column][two-column]) ul {
|
|
131
|
+
display: block;
|
|
132
|
+
columns: 2;
|
|
133
|
+
column-gap: calc(var(--content-space) * 2);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
:host([column][two-column]) li {
|
|
137
|
+
break-inside: avoid;
|
|
138
|
+
margin-block-end: calc(var(--content-space) * 0.35);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
126
142
|
/* A stack of plain links, not pills — no border, no background. */
|
|
127
143
|
:host([column]) a,
|
|
128
144
|
:host([column]) a:visited {
|
|
@@ -1,8 +1,11 @@
|
|
|
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;
|
|
@@ -13,10 +16,6 @@
|
|
|
13
16
|
</script>
|
|
14
17
|
<header webc:root="override" class="schedule-overview">
|
|
15
18
|
<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
19
|
<h1 @text="$data.copy.scheduleOverview.schedule"></h1>
|
|
21
20
|
<p class="meets" webc:if="$data.schedule?.meetings?.days?.length">
|
|
22
21
|
<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>
|
|
@@ -38,13 +37,18 @@
|
|
|
38
37
|
</div>
|
|
39
38
|
</section>
|
|
40
39
|
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
<div class="schedule-bar" data-schedule-bar webc:if="scheduleMonths(weeks ?? defaultWeeks).length">
|
|
41
|
+
<nav class="schedule-jump" :aria-label="$data.copy.scheduleOverview.jumpTo">
|
|
42
|
+
<h2 @text="$data.copy.scheduleOverview.jumpTo"></h2>
|
|
43
|
+
<ul role="list">
|
|
44
|
+
<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>
|
|
45
|
+
</ul>
|
|
46
|
+
</nav>
|
|
47
|
+
<div class="schedule-toggle" data-schedule-tools hidden>
|
|
48
|
+
<p class="schedule-status" data-schedule-status role="status"></p>
|
|
49
|
+
<button type="button" class="hide-past" data-hide-past aria-pressed="false" @text="$data.copy.schedule.hidePast"></button>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
48
52
|
</header>
|
|
49
53
|
|
|
50
54
|
<style webc:scoped>
|
|
@@ -108,7 +112,56 @@
|
|
|
108
112
|
}
|
|
109
113
|
}
|
|
110
114
|
|
|
115
|
+
/* 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
|
|
116
|
+
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
|
|
117
|
+
(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
|
|
118
|
+
quarter of the screen. */
|
|
119
|
+
.schedule-bar {
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-wrap: wrap;
|
|
122
|
+
align-items: center;
|
|
123
|
+
justify-content: space-between;
|
|
124
|
+
gap: 0.25rem var(--content-space);
|
|
125
|
+
margin-block: var(--content-space);
|
|
126
|
+
|
|
127
|
+
@media screen and (width >= 40em) {
|
|
128
|
+
position: sticky;
|
|
129
|
+
inset-block-start: 0;
|
|
130
|
+
z-index: 10;
|
|
131
|
+
margin-block: 0;
|
|
132
|
+
padding-block: 0.4rem;
|
|
133
|
+
background-color: var(--color-page);
|
|
134
|
+
border-block-end: var(--thin-border-width) solid var(--color-border-strong);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@media screen and (width >= 40em) {
|
|
139
|
+
:host {
|
|
140
|
+
display: contents;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
:host > .schedule-bar + * {
|
|
144
|
+
margin-block-start: var(--content-space);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
111
148
|
.schedule-jump {
|
|
149
|
+
display: flex;
|
|
150
|
+
flex-wrap: wrap;
|
|
151
|
+
align-items: center;
|
|
152
|
+
gap: 0 var(--content-space);
|
|
153
|
+
min-inline-size: 0;
|
|
154
|
+
|
|
155
|
+
h2 {
|
|
156
|
+
margin: 0;
|
|
157
|
+
font-family: var(--sans-font);
|
|
158
|
+
font-size: var(--font-size-6);
|
|
159
|
+
font-weight: var(--font-weight--semi-bold);
|
|
160
|
+
letter-spacing: 0.08em;
|
|
161
|
+
text-transform: uppercase;
|
|
162
|
+
color: var(--color-text-muted);
|
|
163
|
+
}
|
|
164
|
+
|
|
112
165
|
ul {
|
|
113
166
|
display: flex;
|
|
114
167
|
flex-wrap: wrap;
|
|
@@ -134,12 +187,140 @@
|
|
|
134
187
|
background-color: var(--color-surface);
|
|
135
188
|
border-color: var(--color-accent);
|
|
136
189
|
}
|
|
190
|
+
|
|
191
|
+
/* 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
|
|
192
|
+
it changes no size, so nothing moves when the mark does. */
|
|
193
|
+
&[aria-current] {
|
|
194
|
+
text-decoration: underline;
|
|
195
|
+
text-decoration-color: var(--color-accent-secondary);
|
|
196
|
+
text-decoration-thickness: 0.2em;
|
|
197
|
+
text-underline-offset: 0.3em;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.schedule-toggle {
|
|
203
|
+
display: flex;
|
|
204
|
+
flex-wrap: wrap;
|
|
205
|
+
align-items: center;
|
|
206
|
+
gap: 0.25rem var(--content-space);
|
|
207
|
+
|
|
208
|
+
&[hidden] {
|
|
209
|
+
display: none;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* The count beside the button when there is room; below 48em it is hidden from sight and still announced (role="status"). */
|
|
214
|
+
.schedule-status {
|
|
215
|
+
margin: 0;
|
|
216
|
+
color: var(--color-text-muted);
|
|
217
|
+
|
|
218
|
+
@media screen and (width < 48em) {
|
|
219
|
+
position: absolute;
|
|
220
|
+
inline-size: 1px;
|
|
221
|
+
block-size: 1px;
|
|
222
|
+
overflow: hidden;
|
|
223
|
+
clip-path: inset(50%);
|
|
224
|
+
white-space: nowrap;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.hide-past {
|
|
229
|
+
min-block-size: var(--target-min);
|
|
230
|
+
min-inline-size: var(--target-min);
|
|
231
|
+
padding-inline: 1.1em;
|
|
232
|
+
border: var(--thin-border-width) solid var(--color-border-strong);
|
|
233
|
+
border-radius: var(--radius-pill);
|
|
234
|
+
background: transparent;
|
|
235
|
+
color: var(--color-text);
|
|
236
|
+
font: inherit;
|
|
237
|
+
font-weight: var(--font-weight--semi-bold);
|
|
238
|
+
cursor: pointer;
|
|
239
|
+
|
|
240
|
+
&[aria-pressed="true"] {
|
|
241
|
+
border-color: var(--color-accent-secondary);
|
|
242
|
+
background-color: var(--color-accent-secondary);
|
|
243
|
+
color: var(--color-on-accent-secondary);
|
|
244
|
+
--color-focus-ring: var(--color-on-accent-secondary);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
@media (forced-colors: active) {
|
|
249
|
+
.schedule-bar {
|
|
250
|
+
border-block-end-color: CanvasText;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.schedule-jump a[aria-current] {
|
|
254
|
+
text-decoration-color: Highlight;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.hide-past[aria-pressed="true"] {
|
|
258
|
+
forced-color-adjust: none;
|
|
259
|
+
background: SelectedItem;
|
|
260
|
+
border-color: SelectedItem;
|
|
261
|
+
color: SelectedItemText;
|
|
137
262
|
}
|
|
138
263
|
}
|
|
139
264
|
|
|
140
265
|
@media print {
|
|
141
|
-
.schedule-
|
|
266
|
+
.schedule-bar {
|
|
142
267
|
display: none;
|
|
143
268
|
}
|
|
144
269
|
}
|
|
145
270
|
</style>
|
|
271
|
+
|
|
272
|
+
<style>
|
|
273
|
+
/* 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. */
|
|
274
|
+
html:has(.schedule-bar) {
|
|
275
|
+
scroll-padding-block-start: calc(var(--schedule-bar-height, 0px) + 1rem);
|
|
276
|
+
}
|
|
277
|
+
</style>
|
|
278
|
+
|
|
279
|
+
<script>
|
|
280
|
+
/**
|
|
281
|
+
* 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
|
|
282
|
+
* 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`
|
|
283
|
+
* for the page's scroll-padding while the row is sticky. It changes no size and runs no animation.
|
|
284
|
+
*/
|
|
285
|
+
(() => {
|
|
286
|
+
const bar = document.querySelector("[data-schedule-bar]");
|
|
287
|
+
if (!bar || !bar.getClientRects().length) return;
|
|
288
|
+
const links = [...bar.querySelectorAll("a[data-first-week]")];
|
|
289
|
+
const weeks = [...document.querySelectorAll(".schedule-weeks .week[id^='week-']")];
|
|
290
|
+
if (!links.length || !weeks.length) return;
|
|
291
|
+
const range = links.map((link) => ({ link, first: Number(link.dataset.firstWeek), last: Number(link.dataset.lastWeek) }));
|
|
292
|
+
/** 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. */
|
|
293
|
+
const monthOf = (number) => range.findLast(({ first, last }) => number >= first && number <= last) ?? range.at(-1);
|
|
294
|
+
const mark = () => {
|
|
295
|
+
const line = Math.max(0, bar.getBoundingClientRect().bottom) + 8;
|
|
296
|
+
const shown = weeks.filter((week) => !week.hidden);
|
|
297
|
+
if (!shown.length) return;
|
|
298
|
+
// 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,
|
|
299
|
+
// and the first week while the header is still on screen. After the last week, the last month.
|
|
300
|
+
const week = shown.find((candidate) => candidate.getBoundingClientRect().bottom > line);
|
|
301
|
+
// A page scrolled to its foot can leave the last week below the line: then the last month is the one on screen.
|
|
302
|
+
const bottomed = window.scrollY > 0 && window.scrollY + window.innerHeight >= document.documentElement.scrollHeight - 2;
|
|
303
|
+
const current = week && !bottomed ? monthOf(Number(week.id.slice(5))) : range.at(-1);
|
|
304
|
+
for (const { link } of range) {
|
|
305
|
+
if (link === current.link) link.setAttribute("aria-current", "location");
|
|
306
|
+
else link.removeAttribute("aria-current");
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
const measure = () => document.documentElement.style.setProperty("--schedule-bar-height", getComputedStyle(bar).position === "sticky" ? `${Math.ceil(bar.getBoundingClientRect().height)}px` : "0px");
|
|
310
|
+
let queued = false;
|
|
311
|
+
addEventListener("scroll", () => {
|
|
312
|
+
if (queued) return;
|
|
313
|
+
queued = true;
|
|
314
|
+
requestAnimationFrame(() => {
|
|
315
|
+
queued = false;
|
|
316
|
+
mark();
|
|
317
|
+
});
|
|
318
|
+
}, { passive: true });
|
|
319
|
+
new ResizeObserver(() => {
|
|
320
|
+
measure();
|
|
321
|
+
mark();
|
|
322
|
+
}).observe(bar);
|
|
323
|
+
measure();
|
|
324
|
+
mark();
|
|
325
|
+
})();
|
|
326
|
+
</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" />
|
|
@@ -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 or above it 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"],
|
|
@@ -77,6 +77,10 @@ export function checkOptions(options = {}) {
|
|
|
77
77
|
throw new Error(`courseKit: \`institution.timezone\` is "${timeZone}", which is not a time zone name. Use one like "America/New_York".`);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
+
const sourceUrl = options.institution?.sourceUrl;
|
|
81
|
+
if (sourceUrl !== undefined && !/^https?:\/\/[^\s/]+\.[^\s]+$/.test(String(sourceUrl))) {
|
|
82
|
+
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".`);
|
|
83
|
+
}
|
|
80
84
|
const checkMode = options.worksheets?.checkMode;
|
|
81
85
|
if (checkMode !== undefined && !["question", "end"].includes(checkMode)) {
|
|
82
86
|
throw new Error(`courseKit: \`worksheets.checkMode\` is "${checkMode}", but it must be "question" or "end".`);
|
package/lib/copy.js
CHANGED
|
@@ -105,7 +105,6 @@ export const COPY_DEFAULTS = {
|
|
|
105
105
|
noClass: "No class — {reason}",
|
|
106
106
|
substitution: "Runs a {weekday} schedule",
|
|
107
107
|
dueKeyLabel: "Key to due items",
|
|
108
|
-
graded: "graded",
|
|
109
108
|
notGraded: "not graded",
|
|
110
109
|
dueKindTest: "Test",
|
|
111
110
|
dueKindGraded: "Graded",
|
|
@@ -158,7 +157,6 @@ export const COPY_DEFAULTS = {
|
|
|
158
157
|
hint: "Space reveals · arrows move",
|
|
159
158
|
defShown: "Definition shown for {term}",
|
|
160
159
|
symbols: "Symbols",
|
|
161
|
-
glossary: "Glossary",
|
|
162
160
|
courseGlossary: "Course glossary",
|
|
163
161
|
slidesOnly: "Slides only",
|
|
164
162
|
finalExam: "Final exam",
|
|
@@ -354,7 +352,6 @@ export const COPY_DEFAULTS = {
|
|
|
354
352
|
slides: "Slides",
|
|
355
353
|
previousSlide: "Previous slide",
|
|
356
354
|
nextSlide: "Next slide",
|
|
357
|
-
cycleColorTheme: "Cycle color theme",
|
|
358
355
|
toggleFullscreen: "Toggle fullscreen",
|
|
359
356
|
},
|
|
360
357
|
document: {
|
package/lib/data/site.js
CHANGED
|
@@ -35,7 +35,7 @@ const originSlug = () => {
|
|
|
35
35
|
/**
|
|
36
36
|
* Site-wide metadata, the global `site`. URL resolution reads the CONTEXT, URL
|
|
37
37
|
* and DEPLOY_PRIME_URL variables; see the README.
|
|
38
|
-
* @param {{ course: object, pkg?: object, institution?: { name?: string, timezone?: string, lms?: string }, site?: { description?: string, keywords?: string, language?: string }, env?: NodeJS.ProcessEnv }} data
|
|
38
|
+
* @param {{ course: object, pkg?: object, institution?: { name?: string, timezone?: string, lms?: string, sourceUrl?: string }, site?: { description?: string, keywords?: string, language?: string }, env?: NodeJS.ProcessEnv }} data
|
|
39
39
|
* @returns {object}
|
|
40
40
|
*/
|
|
41
41
|
export function resolveSite({ course, pkg = {}, institution = {}, site = {}, env = process.env }) {
|
|
@@ -59,6 +59,7 @@ export function resolveSite({ course, pkg = {}, institution = {}, site = {}, env
|
|
|
59
59
|
institution: name,
|
|
60
60
|
timezone: institution.timezone || "UTC",
|
|
61
61
|
lms: institution.lms ?? "Brightspace",
|
|
62
|
+
sourceUrl: institution.sourceUrl ?? "",
|
|
62
63
|
keywords: site.keywords ?? [name, course.code, course.name, "syllabus", "course schedule", "class resources"].filter(Boolean).join(", "),
|
|
63
64
|
url,
|
|
64
65
|
hostname,
|
package/lib/filters.js
CHANGED
|
@@ -96,10 +96,10 @@ const kindKey = (kind) => `dueKind${kind.charAt(0).toUpperCase()}${kind.slice(1)
|
|
|
96
96
|
export const dueKindLabel = (kind, copy = COPY_DEFAULTS) => copy.schedule[kindKey(kind)] ?? "";
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* The key above the schedule: one entry per kind in use, in a fixed order, with its label and
|
|
99
|
+
* The key above the schedule: one entry per kind in use, in a fixed order, with its label and, for a kind that is not graded, the words that say so.
|
|
100
100
|
* @param {object[]} weeks `scheduleWeeks` output
|
|
101
101
|
* @param {typeof COPY_DEFAULTS} [copy]
|
|
102
|
-
* @returns {{ kind: string, label: string,
|
|
102
|
+
* @returns {{ kind: string, label: string, note: string }[]}
|
|
103
103
|
*/
|
|
104
104
|
export const dueKeyItems = (weeks, copy = COPY_DEFAULTS) => {
|
|
105
105
|
const present = new Set();
|
|
@@ -112,7 +112,7 @@ export const dueKeyItems = (weeks, copy = COPY_DEFAULTS) => {
|
|
|
112
112
|
}
|
|
113
113
|
return Object.entries(DUE_KINDS)
|
|
114
114
|
.filter(([kind]) => present.has(kind))
|
|
115
|
-
.map(([kind, { graded }]) => ({ kind, label: dueKindLabel(kind, copy),
|
|
115
|
+
.map(([kind, { graded }]) => ({ kind, label: dueKindLabel(kind, copy), note: graded ? "" : copy.schedule.notGraded }));
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
/**
|
|
@@ -384,18 +384,21 @@ export const courseDeadlines = (weeks, schedule, copy = COPY_DEFAULTS) => {
|
|
|
384
384
|
|
|
385
385
|
/**
|
|
386
386
|
* The schedule page's month links: one per calendar month that has a class
|
|
387
|
-
* meeting, in calendar order
|
|
388
|
-
*
|
|
389
|
-
*
|
|
387
|
+
* meeting, in calendar order. `week` is the first week holding a meeting of
|
|
388
|
+
* the month, where the link points, and `last` the last one; a week that
|
|
389
|
+
* spans two months is in both ranges. Dates are ISO strings, so the month is
|
|
390
|
+
* read in UTC and never shifts with the build machine's zone.
|
|
390
391
|
* @param {object[]} weeks `scheduleWeeks` output
|
|
391
|
-
* @returns {{name: string, week: number}[]}
|
|
392
|
+
* @returns {{name: string, week: number, last: number}[]}
|
|
392
393
|
*/
|
|
393
394
|
export const scheduleMonths = (weeks) => {
|
|
394
395
|
const months = new Map();
|
|
395
396
|
for (const { week, meetings } of weeks ?? []) {
|
|
396
397
|
for (const { iso } of meetings.filter((meeting) => !meeting.noClass)) {
|
|
397
398
|
const month = iso.slice(0, 7);
|
|
398
|
-
|
|
399
|
+
const entry = months.get(month);
|
|
400
|
+
if (!entry) months.set(month, { name: dateFormat(iso, { month: "long" }), week, last: week });
|
|
401
|
+
else entry.last = Math.max(entry.last, week);
|
|
399
402
|
}
|
|
400
403
|
}
|
|
401
404
|
return [...months.values()];
|
package/lib/lesson-materials.js
CHANGED
|
@@ -20,7 +20,7 @@ export const lessonDecks = (data) => decksFor(data.collections?.deck, data.lesso
|
|
|
20
20
|
* The "Materials & links" sections of a lesson-day page, in order, each ready
|
|
21
21
|
* for `<link-section>`. A section with nothing to list is left out, except
|
|
22
22
|
* the resources one, which says so.
|
|
23
|
-
* @param {object} data a lesson-day page's data: `lesson`, `lessons`, `lessonDemos`, `collections`
|
|
23
|
+
* @param {object} data a lesson-day page's data: `lesson`, `lessons`, `lessonDemos` (a list of `{ title, slug, description }`, which a course supplies; anything but a list is no demos), `collections`
|
|
24
24
|
* @returns {{ title: string, items: LinkItem[], empty?: string }[]}
|
|
25
25
|
*/
|
|
26
26
|
export function lessonMaterials(data) {
|
|
@@ -34,7 +34,8 @@ export function lessonMaterials(data) {
|
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
title: copy.demosFromThisMeeting,
|
|
37
|
-
|
|
37
|
+
// Eleventy hands a computed key the string "" while it scans the page's dependencies, so only a list counts.
|
|
38
|
+
items: (Array.isArray(data.lessonDemos) ? data.lessonDemos : []).map((demo) => ({ title: demo.title, href: `/demo/${demo.slug}/`, note: demo.description })),
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
41
|
title: copy.exercisesDue,
|
package/lib/pdf.js
CHANGED
|
@@ -23,6 +23,12 @@ const loadFooterData = ({ course, term, dataDir }) => {
|
|
|
23
23
|
return { course: course ?? data.course, term: term ?? resolveTerm(data) };
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* The page margins of the syllabus PDF. `print.css` sets the same margins in its `@page` rule: an @page margin outranks this option, and a
|
|
28
|
+
* smaller one put the text over the page footer, which prints in the bottom margin.
|
|
29
|
+
*/
|
|
30
|
+
export const PDF_MARGIN = { top: "0.4in", bottom: "0.45in", left: "0.5in", right: "0.5in" };
|
|
31
|
+
|
|
26
32
|
const MIME = {
|
|
27
33
|
".css": "text/css",
|
|
28
34
|
".html": "text/html; charset=utf-8",
|
|
@@ -122,7 +128,7 @@ export default function registerSyllabusPdf(config, { isProduction, timezone, ou
|
|
|
122
128
|
displayHeaderFooter: true,
|
|
123
129
|
headerTemplate: "<span></span>",
|
|
124
130
|
footerTemplate: `<div style="width: 100%; font-size: 7px; text-align: center; color: #666;">${fill(resolveCopy({ dataDir }).pdf.footer, { course: footerData.course.code, name: footerData.course.name, term: footerData.term.label, generated, version, page: '<span class="pageNumber"></span>', pages: '<span class="totalPages"></span>' })}</div>`,
|
|
125
|
-
margin:
|
|
131
|
+
margin: PDF_MARGIN,
|
|
126
132
|
});
|
|
127
133
|
await page.close();
|
|
128
134
|
process.stdout.write(`[syllabus-pdf] wrote ${outputPath.replace(root, "")}\n`);
|
package/lib/postcss.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
3
|
|
|
4
|
+
import advancedPreset from "cssnano-preset-advanced";
|
|
4
5
|
import postcss from "postcss";
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -25,8 +26,9 @@ export default function postcssConfig({ env = process.env.ELEVENTY_ENV ?? "devel
|
|
|
25
26
|
stage: 3,
|
|
26
27
|
},
|
|
27
28
|
cssnano: {
|
|
29
|
+
// The preset as an imported function, not its name: cssnano resolves a name against the installed package and warns (CSSNANO_INSTALLED_PRESET) that it is not using its built-in preset.
|
|
28
30
|
preset: [
|
|
29
|
-
|
|
31
|
+
advancedPreset,
|
|
30
32
|
{
|
|
31
33
|
reduceIdents: false,
|
|
32
34
|
// Font families live in custom properties discardUnused cannot see.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allons-y/course-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Shared layouts, components, styles and build helpers for Eleventy course sites.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"author": "Cassondra Roberts <castastrophe@users.noreply.github.com> (https://allons-y.studio)",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"test": "node --test",
|
|
38
38
|
"schema": "node scripts/theme-schema.js && node scripts/theme-docs.js",
|
|
39
39
|
"docs": "node scripts/component-docs.js && node scripts/copy-docs.js",
|
|
40
|
+
"check:pdf": "node scripts/check-pdf.js",
|
|
40
41
|
"preview": "node scripts/site.js start",
|
|
41
42
|
"preview:build": "node scripts/site.js build",
|
|
42
43
|
"docs:build": "node scripts/site.js build",
|
|
@@ -89,6 +89,11 @@
|
|
|
89
89
|
"default": true,
|
|
90
90
|
"description": "Whether the `<syllabus>` shows its contents list (a row of links above the syllabus, and from 1100px a sticky column beside it). `false` leaves it out. The tag's `contents=\"false\"` attribute does the same for one place and wins over this."
|
|
91
91
|
},
|
|
92
|
+
"navColumns": {
|
|
93
|
+
"enum": ["auto", 1, 2],
|
|
94
|
+
"default": "auto",
|
|
95
|
+
"description": "How many columns the menu in the page header is set in. `auto` (the default) uses two columns when the menu has more than 3 links, which keeps the header short, and one stack otherwise; `1` and `2` fix it either way. The `<masthead>` tag's `nav-columns` attribute does the same for one place and wins over this."
|
|
96
|
+
},
|
|
92
97
|
"textbook": {
|
|
93
98
|
"type": "object",
|
|
94
99
|
"description": "Required text and how to get it — the textbook/materials element Meredith requires. Omit the whole key ONLY when the course has no text: the `<syllabus>` component then renders \"No text is required.\", which is still an explicit materials statement. Never leave the key present but empty.",
|
|
@@ -26,9 +26,14 @@
|
|
|
26
26
|
"default": true,
|
|
27
27
|
"description": "Set false to keep the page out of the sitemap and search results. Does NOT gate publishing — the page is still served to anyone with the URL."
|
|
28
28
|
},
|
|
29
|
+
"order": {
|
|
30
|
+
"type": "integer",
|
|
31
|
+
"minimum": 0,
|
|
32
|
+
"description": "Where the worksheet sits in the Practice page's list (`<practice-index>`): lower numbers first, then by address. A worksheet with no order comes after those that have one."
|
|
33
|
+
},
|
|
29
34
|
"eyebrow": {
|
|
30
35
|
"type": "string",
|
|
31
|
-
"description": "Small-caps label above the heading,
|
|
36
|
+
"description": "Small-caps label above the heading, such as the kind of page (\"Practice\"). The masthead already gives the term and course code, so the page does not repeat them."
|
|
32
37
|
},
|
|
33
38
|
"heading": {
|
|
34
39
|
"type": "string",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The deck's saved light/dark choice, applied before first paint so a deck
|
|
3
|
-
* never flashes the wrong scheme. Only the deck layout inlines this, through
|
|
4
|
-
* the `head` bundle bucket; the site and worksheets follow the system.
|
|
5
|
-
*/
|
|
6
|
-
try {
|
|
7
|
-
const theme = localStorage.getItem("theme");
|
|
8
|
-
if (theme === "light" || theme === "dark") {
|
|
9
|
-
document.documentElement.style.colorScheme = theme;
|
|
10
|
-
document.documentElement.dataset.theme = theme;
|
|
11
|
-
for (const link of document.querySelectorAll("link[data-prism-theme]")) {
|
|
12
|
-
link.media = link.dataset.prismTheme === theme ? "all" : "not all";
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
} catch {
|
|
16
|
-
// Storage can be unavailable (private mode, blocked cookies); follow system.
|
|
17
|
-
}
|