@allons-y/course-kit 0.4.2 → 0.5.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.
@@ -52,12 +52,14 @@ const setIndex = (i, scroll = true) => {
52
52
  if (location.hash !== `#s${index + 1}`) history.replaceState(null, "", `#s${index + 1}`);
53
53
  };
54
54
 
55
- /* Uncovers this slide's `::: answer` blocks one at a time before advancing;
56
- Enter reveals without advancing. Going back leaves them revealed. */
55
+ /* Uncovers this slide's `::: answer` blocks and its figures' `<g class="step">`
56
+ groups one at a time, in source order, before advancing; Enter reveals
57
+ without advancing. Going back leaves them revealed. `step` is SVG-only, so
58
+ a `::: step` block stays an ordinary block. */
57
59
  const reveal = () => {
58
- const answer = slides[index].querySelector(".answer:not(.is-revealed)");
59
- if (!answer) return false;
60
- answer.classList.add("is-revealed");
60
+ const hidden = slides[index].querySelector(".answer:not(.is-revealed), svg .step:not(.is-revealed)");
61
+ if (!hidden) return false;
62
+ hidden.classList.add("is-revealed");
61
63
  return true;
62
64
  };
63
65
 
@@ -285,9 +285,9 @@ main {
285
285
  scroll-margin-block-start: 1.5rlh;
286
286
  }
287
287
 
288
+ /* A wash of the accent, strong enough to see on the page, a surface and a filled card. */
288
289
  ::selection {
289
- background: color-mix(in hsl, var(--color-surface) 80%, transparent);
290
- border-radius: 0.25em;
290
+ background: color-mix(in sRGB, var(--color-accent) 30%, var(--color-page));
291
291
  color: var(--color-text);
292
292
  }
293
293
 
@@ -675,14 +675,9 @@ a {
675
675
  }
676
676
 
677
677
  main {
678
- /* A section opens with a rule and a short accent bar, not an underline:
679
- an underlined heading reads as a link. */
678
+ /* A section opens with space alone: no rule and no accent bar. */
680
679
  :where(h2:not([class])) {
681
680
  margin-block-start: calc(var(--content-space) * 2.5);
682
- padding-block-start: calc(var(--content-space) * 0.75);
683
- border-block-start: var(--thin-border-width) solid var(--color-border);
684
- background: linear-gradient(var(--color-accent-secondary), var(--color-accent-secondary)) top left / 2.75rem var(--border-width) no-repeat;
685
- background-origin: border-box;
686
681
  }
687
682
 
688
683
  :where(h3:not([class])) {
@@ -1177,10 +1172,16 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
1177
1172
  flex-wrap: wrap;
1178
1173
  gap: calc(var(--gutter) * 2);
1179
1174
 
1175
+ /* A CSS dot, not a character: never an emoji, never read aloud. A border, so forced colors keeps it. */
1180
1176
  > *:not(:last-child)::after {
1181
- content: "⏺";
1182
- padding-inline-start: calc(var(--gutter) * 2);
1183
- font-size: 50%;
1177
+ content: "";
1178
+ display: inline-block;
1179
+ box-sizing: border-box;
1180
+ inline-size: 0.3em;
1181
+ block-size: 0.3em;
1182
+ margin-inline-start: calc(var(--gutter) * 2);
1183
+ border: 0.15em solid currentColor;
1184
+ border-radius: 50%;
1184
1185
  vertical-align: middle;
1185
1186
  }
1186
1187
  }
@@ -1625,6 +1626,7 @@ blockquote {
1625
1626
  selecting or copying never takes them. */
1626
1627
  .code-block {
1627
1628
  --code-edge: var(--color-code-edge-neutral);
1629
+ --code-line-height: 1.2;
1628
1630
 
1629
1631
  position: relative;
1630
1632
  margin-block: 0 1rem;
@@ -1693,12 +1695,21 @@ blockquote {
1693
1695
  @media print { display: none; }
1694
1696
  }
1695
1697
 
1698
+ pre,
1699
+ code {
1700
+ line-height: var(--code-line-height);
1701
+ }
1702
+
1703
+ /* The block sets its own padding and scrolling: a page whose reset clears
1704
+ the base `pre` rule (the kit's own landing page) still gets them. */
1696
1705
  pre {
1697
1706
  margin: 0;
1698
1707
  border: 0;
1699
1708
  border-radius: 0;
1700
1709
  background: none;
1710
+ padding-block: 0.75rem;
1701
1711
  padding-inline: 0;
1712
+ overflow-x: auto;
1702
1713
  }
1703
1714
 
1704
1715
  code {
@@ -1709,18 +1720,21 @@ blockquote {
1709
1720
 
1710
1721
  br { display: none; }
1711
1722
 
1723
+ /* The text starts where the title bar's label does (1rem in from the border, the 3px edge counted), numbered or not. */
1712
1724
  .highlight-line {
1713
1725
  display: block;
1714
- padding-inline: 1.25rem;
1726
+ padding-inline: calc(1rem - 3px) 1rem;
1715
1727
  border-inline-start: 3px solid transparent;
1716
1728
  }
1717
1729
 
1730
+ /* The number column is as wide as the last line's number (`--line-digits`, set by lib/markdown.js), so the
1731
+ numbers start at the same edge as an unnumbered block's text and the gap after them is the same on every line. */
1718
1732
  &[data-line-numbers] .highlight-line::before {
1719
1733
  counter-increment: line;
1720
1734
  content: counter(line);
1721
1735
  display: inline-block;
1722
- inline-size: 2.5em;
1723
- margin-inline: -0.5rem 1.25em;
1736
+ inline-size: calc(var(--line-digits, 2) * 1ch);
1737
+ margin-inline: 0 1rem;
1724
1738
  text-align: end;
1725
1739
  color: var(--color-code-comment);
1726
1740
  user-select: none;
@@ -2209,6 +2223,7 @@ legend.switch-label {
2209
2223
  pre[class*="language-"],
2210
2224
  code[class*="language-"] {
2211
2225
  color: var(--color-code-text);
2226
+ line-height: var(--code-line-height, 1);
2212
2227
  text-shadow: none;
2213
2228
  }
2214
2229
 
@@ -148,10 +148,16 @@ base.css/masthead. The class names below are the deck dialect's vocabulary
148
148
  flex-wrap: wrap;
149
149
  gap: 0.8em;
150
150
 
151
+ /* A CSS dot, as in base.css: never an emoji, never read aloud, visible in forced colors. */
151
152
  > *:not(:last-child)::after {
152
- content: "⏺";
153
- padding-inline-start: 0.8em;
154
- font-size: 50%;
153
+ content: "";
154
+ display: inline-block;
155
+ box-sizing: border-box;
156
+ inline-size: 0.3em;
157
+ block-size: 0.3em;
158
+ margin-inline-start: 0.8em;
159
+ border: 0.15em solid currentColor;
160
+ border-radius: 50%;
155
161
  vertical-align: middle;
156
162
  }
157
163
  }
@@ -537,46 +543,66 @@ base.css/masthead. The class names below are the deck dialect's vocabulary
537
543
  }
538
544
  }
539
545
 
540
- /* `::: answer` — hidden but space-reserved, so revealing never reflows
541
- the slide. Revealed by deck.js; print shows every answer. */
546
+ /* `::: answer`: the box an answer sits in. */
542
547
  .answer {
543
548
  background: var(--color-surface-accent);
544
549
  border-inline-start: 5px solid var(--color-accent-strong);
545
550
  border-radius: 0 12px 12px 0;
546
551
  padding: min(1.4cqi, 1.1rem) min(2cqi, 1.5rem);
552
+ }
553
+
554
+ /* Hidden but space-reserved, so revealing never reflows the slide: a
555
+ `::: answer` block, and each `<g class="step">` of an inline SVG figure
556
+ (`<g class="answer">` is the older name for a step). deck.js reveals
557
+ them one at a time, in source order; print shows them all. */
558
+ .answer, svg .step {
547
559
  visibility: hidden;
548
560
  opacity: 0;
549
- transition: opacity 180ms ease-out;
550
561
 
551
562
  &.is-revealed {
552
563
  visibility: visible;
553
564
  opacity: 1;
554
565
  }
555
-
556
- @media (prefers-reduced-motion: reduce) { transition: none; }
557
566
  }
558
567
 
559
- /* An SVG figure reveals in place: a `<g class="answer">` fades in with the
560
- same keys, and anything inside it marked `.pop` lands with a short scale
561
- so the eye goes to it. */
562
- svg .answer .pop {
568
+ /* Inside a revealed step, `.pop` lands with a short scale so the eye goes
569
+ to it, and a `.draw` stroke draws on from its start. */
570
+ svg :is(.answer, .step) .pop {
563
571
  transform-box: fill-box;
564
572
  transform-origin: center;
565
573
  }
566
574
 
567
- svg .answer.is-revealed .pop {
568
- animation: pop-in 380ms ease-out;
575
+ @media (prefers-reduced-motion: no-preference) {
576
+ .answer, svg .step { transition: opacity 180ms ease-out; }
569
577
 
570
- @media (prefers-reduced-motion: reduce) { animation: none; }
578
+ svg :is(.answer, .step).is-revealed .pop { animation: pop-in 380ms ease-out; }
579
+
580
+ svg :is(.answer, .step).is-revealed .draw[pathLength="1"] { animation: draw-on 600ms ease-in-out; }
571
581
  }
572
582
 
573
583
  @keyframes pop-in {
574
584
  from {
575
- transform: scale(1.14);
585
+ scale: 1.14;
586
+ }
587
+ }
588
+
589
+ /* With `pathLength="1"` on the stroke, one dash is the whole line. The
590
+ dashes live only in the keyframes: with no motion the stroke is
591
+ untouched. An arrowhead waits for the line to arrive. */
592
+ @keyframes draw-on {
593
+ from {
594
+ stroke-dasharray: 1;
595
+ stroke-dashoffset: 1;
596
+ marker: none;
597
+ }
598
+
599
+ 99% {
600
+ marker: none;
576
601
  }
577
602
 
578
603
  to {
579
- transform: scale(1);
604
+ stroke-dasharray: 1;
605
+ stroke-dashoffset: 0;
580
606
  }
581
607
  }
582
608
 
@@ -960,7 +986,7 @@ base.css/masthead. The class names below are the deck dialect's vocabulary
960
986
 
961
987
  .card, pre { break-inside: avoid; }
962
988
 
963
- .answer {
989
+ .answer, svg .step {
964
990
  visibility: visible;
965
991
  opacity: 1;
966
992
  }
@@ -1,7 +1,7 @@
1
1
  <script webc:setup>
2
2
  /**
3
- * The home page's opening band: the next class, what is due soon and the
4
- * week-by-week progress. Hidden until its script has judged "today" in the
3
+ * The home page's opening band: this week's topics, the next class, what
4
+ * is due soon (date first) and the week-by-week progress, side by side as space allows. Hidden until its script has judged "today" in the
5
5
  * campus zone. Wording comes from `copy.home` and `copy.schedule`.
6
6
  * @prop {object[]} [weeks] `scheduleWeeks` output; built from the page's lessons, schedule, decks and demos when left out
7
7
  * @prop {string} [scheduleUrl] where the schedule lives, default `/schedule/`
@@ -23,21 +23,34 @@
23
23
  slides: meeting.slides ?? "",
24
24
  })),
25
25
  );
26
- /** The script's data: meetings and deadlines, safe inside a <script> element. */
26
+ /** Each week that holds class: its number, its topics as plain text, and its first and last class day. */
27
+ const weekSummaries = (weeks) =>
28
+ (weeks ?? []).flatMap((week) => {
29
+ const held = (week.meetings ?? []).filter((meeting) => !meeting.noClass && meeting.iso);
30
+ if (!held.length) return [];
31
+ const topics = [...new Set(held.flatMap((meeting) => meeting.topics ?? []).map((topic) => String(topic).replace(/<[^>]+>/g, "").trim()))].filter(Boolean);
32
+ return [{ week: week.week, topics, from: held[0].iso, to: held.at(-1).iso, fromDate: held[0].date, toDate: held.at(-1).date }];
33
+ });
34
+ /** The script's data: meetings, weeks and deadlines, safe inside a <script> element. */
27
35
  const nowData = (weeks, schedule, copy) =>
28
- JSON.stringify({ meetings: flatMeetings(weeks), deadlines: courseDeadlines(weeks, schedule, copy) }).replaceAll("<", "\\u003c");
36
+ JSON.stringify({ meetings: flatMeetings(weeks), weeks: weekSummaries(weeks), deadlines: courseDeadlines(weeks, schedule, copy) }).replaceAll("<", "\\u003c");
29
37
  /** Every class date in a week, for the progress track. */
30
38
  const datesOf = (week) => (week?.meetings ?? []).map((meeting) => meeting.iso).filter(Boolean).join(" ");
31
39
  </script>
32
40
  <section webc:root="override" class="course-now screen-only" aria-labelledby="course-now-heading" data-course-now webc:if="(weeks ?? defaultWeeks)?.length" hidden>
33
41
  <h2 id="course-now-heading" class="sr-only" @text="$data.copy.home.heading"></h2>
42
+ <div class="this-week" data-this-week hidden>
43
+ <h2 data-week-label></h2>
44
+ <p class="when" data-week-when></p>
45
+ <ul role="list" data-week-topics></ul>
46
+ <p><a data-week-link><span @text="$data.copy.home.seeWeek"></span> <span aria-hidden="true">→</span></a></p>
47
+ </div>
34
48
  <div class="now-card on-accent" data-now-card hidden>
35
49
  <p class="label" data-now-label></p>
36
50
  <p class="when" data-now-when></p>
37
51
  <p class="topic" data-now-title></p>
38
52
  <p class="actions">
39
53
  <a class="primary" data-now-slides hidden><span @text="$data.copy.home.openSlides"></span> <span aria-hidden="true">→</span></a>
40
- <a class="secondary" data-now-week @text="$data.copy.home.seeWeek"></a>
41
54
  </p>
42
55
  </div>
43
56
  <div class="coming-up" data-coming-up>
@@ -54,7 +67,7 @@
54
67
  <a :href="`/schedule/#week-${week.week}`">
55
68
  <span class="bar" aria-hidden="true"></span>
56
69
  <span class="name" @text="fill($data.copy.home.week, { week: week.week })"></span>
57
- <span class="state" data-state></span>
70
+ <span class="state sr-only" data-state></span>
58
71
  </a>
59
72
  </li>
60
73
  </ol>
@@ -77,7 +90,7 @@
77
90
  const campusToday = () => new Date().toLocaleDateString("en-CA", { timeZone: document.documentElement.dataset.timezone });
78
91
  const { t } = window.ckCopy;
79
92
  const today = campusToday();
80
- const { meetings, deadlines } = JSON.parse(root.querySelector("[data-course-now-data]").textContent);
93
+ const { meetings, weeks: weekList, deadlines } = JSON.parse(root.querySelector("[data-course-now-data]").textContent);
81
94
  const DAY_MS = 86_400_000;
82
95
  const day = (iso) => Date.parse(`${iso}T00:00:00Z`);
83
96
  const inDays = (iso) => Math.round((day(iso) - day(today)) / DAY_MS);
@@ -90,7 +103,6 @@
90
103
  root.querySelector("[data-now-label]").textContent = t("home", label);
91
104
  root.querySelector("[data-now-when]").textContent = t("home", "when", { week: next.week, weekday: next.weekday, date: next.date });
92
105
  root.querySelector("[data-now-title]").textContent = next.title;
93
- root.querySelector("[data-now-week]").href = `/schedule/#week-${next.week}`;
94
106
  const slides = root.querySelector("[data-now-slides]");
95
107
  if (next.slides) {
96
108
  slides.href = next.slides;
@@ -99,6 +111,25 @@
99
111
  card.hidden = false;
100
112
  }
101
113
 
114
+ // This week: the week whose classes are not over yet. It is "this week" from the
115
+ // Monday of its first class, "next week" before that, and the first week before the term.
116
+ const current = weekList.find((week) => week.to >= today);
117
+ if (current) {
118
+ const monday = day(current.from) - ((new Date(day(current.from)).getUTCDay() + 6) % 7) * DAY_MS;
119
+ const label = day(today) >= monday ? "weekThis" : weekList[0] === current ? "weekFirst" : "weekNext";
120
+ root.querySelector("[data-week-label]").textContent = t("home", label);
121
+ root.querySelector("[data-week-when]").textContent =
122
+ current.from === current.to ? t("home", "weekWhenDay", { week: current.week, date: current.fromDate }) : t("home", "weekWhen", { week: current.week, from: current.fromDate, to: current.toDate });
123
+ const topics = root.querySelector("[data-week-topics]");
124
+ for (const topic of current.topics) {
125
+ const row = document.createElement("li");
126
+ row.textContent = topic;
127
+ topics.append(row);
128
+ }
129
+ root.querySelector("[data-week-link]").href = `/schedule/#week-${current.week}`;
130
+ root.querySelector("[data-this-week]").hidden = false;
131
+ }
132
+
102
133
  // Coming up: a week ahead, at least three, and always the next test.
103
134
  const up = deadlines.filter((item) => item.iso >= today);
104
135
  let shown = up.filter((item) => inDays(item.iso) <= 7);
@@ -110,27 +141,30 @@
110
141
  }
111
142
  const list = root.querySelector("[data-coming-list]");
112
143
  for (const item of shown) {
144
+ // The date leads: it is what the card is for. The title follows, and there is no kind chip.
113
145
  const row = document.createElement("li");
114
146
  row.dataset.kind = item.kind;
115
- const chip = document.createElement("span");
116
- chip.className = "due-chip";
117
- chip.dataset.kind = item.kind;
118
- chip.textContent = t("schedule", `dueKind${item.kind.charAt(0).toUpperCase()}${item.kind.slice(1)}`);
119
- const name = document.createElement(item.href ? "a" : "span");
120
- if (item.href) name.href = item.href;
121
- name.className = "what";
122
- name.textContent = item.title;
123
147
  const days = inDays(item.iso);
124
148
  const relative = days <= 0 ? t("home", "dueToday") : days === 1 ? t("home", "dueTomorrow") : t("home", "dueInDays", { count: days });
125
149
  const when = document.createElement("span");
126
150
  when.className = "due";
127
- when.textContent = `${item.label}${t("common", "sep")}${relative}`;
128
- row.append(chip, " ", name, " ", when);
151
+ const date = document.createElement("strong");
152
+ date.textContent = item.label;
153
+ const soon = document.createElement("span");
154
+ soon.className = "relative";
155
+ soon.textContent = relative;
156
+ when.append(date, t("common", "sep"), soon);
157
+ const name = document.createElement(item.href ? "a" : "span");
158
+ if (item.href) name.href = item.href;
159
+ name.className = "what";
160
+ name.textContent = item.title;
161
+ row.append(when, " ", name);
129
162
  list.append(row);
130
163
  }
131
164
  root.querySelector("[data-coming-empty]").hidden = shown.length > 0;
132
165
 
133
- // Progress: one bar per week, from each week's class dates.
166
+ // Progress: one bar per week, from each week's class dates. The state is in the bar's
167
+ // look, and in text for a screen reader only.
134
168
  const weeks = [...root.querySelectorAll("[data-progress] li")];
135
169
  let done = 0;
136
170
  for (const week of weeks) {
@@ -166,22 +200,68 @@
166
200
  display: none;
167
201
  }
168
202
 
203
+ /* This week, the next class and what is coming up share a row while they
204
+ fit, and wrap one at a time as the page narrows; a panel alone on a
205
+ row fills it. The progress track always has a row of its own. */
169
206
  :host {
170
- display: grid;
171
- grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr);
207
+ display: flex;
208
+ flex-wrap: wrap;
172
209
  gap: var(--content-space);
173
210
  margin-block-end: var(--section-space);
174
211
 
175
- @media (width <= 768px) {
176
- grid-template-columns: minmax(0, 1fr);
177
- }
178
-
179
212
  h2:not(.sr-only) {
180
213
  margin: 0;
181
214
  font-size: var(--font-size-4);
182
215
  }
183
216
  }
184
217
 
218
+ .this-week,
219
+ .coming-up {
220
+ flex: 1 1 16rem;
221
+ }
222
+
223
+ .now-card {
224
+ flex: 1.5 1 20rem;
225
+ }
226
+
227
+ .this-week {
228
+ display: grid;
229
+ gap: calc(var(--gutter) * 3);
230
+ align-content: start;
231
+ padding: calc(var(--content-space) * 1.4);
232
+ border: var(--thin-border-width) solid var(--color-border);
233
+ border-radius: calc(var(--standard-border-radius) * 4);
234
+
235
+ &[hidden] {
236
+ display: none;
237
+ }
238
+
239
+ p {
240
+ margin: 0;
241
+ }
242
+
243
+ .when {
244
+ color: var(--color-text-muted);
245
+ font-size: max(var(--base-font-size), 0.875em);
246
+ }
247
+
248
+ ul {
249
+ display: grid;
250
+ gap: calc(var(--gutter) * 2);
251
+ margin: 0;
252
+ padding: 0;
253
+ list-style: none;
254
+ font-weight: var(--font-weight--semi-bold);
255
+ }
256
+
257
+ p > a {
258
+ display: inline-flex;
259
+ align-items: center;
260
+ min-block-size: var(--target-min);
261
+ font-weight: var(--font-weight--semi-bold);
262
+ }
263
+ }
264
+
185
265
  .now-card {
186
266
  display: flex;
187
267
  flex-direction: column;
@@ -276,16 +356,21 @@
276
356
  list-style: none;
277
357
  }
278
358
 
359
+ /* The date is the line that is read first; the title sits under it. */
279
360
  li {
280
- display: flex;
281
- flex-wrap: wrap;
282
- align-items: baseline;
283
- gap: 0.25em 0.6em;
284
- padding: 0.6em 0.8em;
361
+ display: grid;
362
+ justify-items: start;
285
363
  }
286
364
 
287
- .what {
288
- font-weight: var(--font-weight--semi-bold);
365
+ .due {
366
+ color: var(--color-text-muted);
367
+ font-size: max(var(--base-font-size), 0.875em);
368
+
369
+ strong {
370
+ color: var(--color-text);
371
+ font-size: var(--font-size-4);
372
+ font-weight: var(--font-weight--semi-bold);
373
+ }
289
374
  }
290
375
 
291
376
  /* A link is an operable target: 44px tall (WCAG 2.5.5). */
@@ -295,12 +380,6 @@
295
380
  min-block-size: var(--target-min);
296
381
  }
297
382
 
298
- .due {
299
- flex-basis: 100%;
300
- color: var(--color-text-muted);
301
- font-size: max(var(--base-font-size), 0.875em);
302
- }
303
-
304
383
  p {
305
384
  margin: 0;
306
385
  font-weight: var(--font-weight--semi-bold);
@@ -318,7 +397,7 @@
318
397
 
319
398
  .progress {
320
399
  display: grid;
321
- grid-column: 1 / -1;
400
+ flex: 1 1 100%;
322
401
  grid-template-columns: 1fr auto;
323
402
  gap: calc(var(--gutter) * 3) var(--content-space);
324
403
  align-items: baseline;
@@ -346,9 +425,12 @@
346
425
  flex: 1 0 5.5rem;
347
426
  }
348
427
 
428
+ /* A 44px target (WCAG 2.5.5), now that the state is not a visible third line. */
349
429
  a {
350
430
  display: grid;
431
+ align-content: start;
351
432
  gap: 0.35em;
433
+ min-block-size: var(--target-min);
352
434
  padding-block: 0.25em;
353
435
  color: var(--color-text);
354
436
  font-size: max(var(--base-font-size), 0.875em);
@@ -365,11 +447,6 @@
365
447
  font-weight: var(--font-weight--semi-bold);
366
448
  }
367
449
 
368
- .state {
369
- min-block-size: 1.5em;
370
- color: var(--color-text-muted);
371
- }
372
-
373
450
  [data-state="done"] .bar {
374
451
  background-color: var(--color-text);
375
452
  }
@@ -53,7 +53,7 @@
53
53
  </li>
54
54
  <li webc:if="$data.instructor.contact" :class="$data.instructor.email ? 'screen-only' : ''">
55
55
  <a class="icon-link" :href="$data.instructor.contact" :aria-label="$data.copy.instructor.sendMeAMessage" :title="$data.copy.instructor.sendMeAMessage"><svg
56
- aria-hidden="true" focusable="false" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z"></path></svg><span
56
+ aria-hidden="true" focusable="false" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 4h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-7l-5 4v-4H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"></path></svg><span
57
57
  class="link-text" @text="$data.copy.instructor.sendMeAMessage"></span></a>
58
58
  </li>
59
59
  <li webc:if="$data.instructor.blog">
@@ -1,7 +1,8 @@
1
1
  <script webc:setup>
2
2
  /**
3
3
  * The page header: institution, term, course title and the navigation. Reads `site`, `term` and `course`.
4
- * The menu is Home, Syllabus, then every page of the site menu that has not set `menu: false`.
4
+ * The menu is Home, Syllabus, then every page of the site menu that has not set `menu: false`. A page other pages name as their `eleventyNavigation.parent` is a group: its link, then theirs.
5
+ * When the instructor has a `booking` link, it is shown under the meeting line on every page, and the menu leaves Contact to the footer.
5
6
  * @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
6
7
  */
7
8
  /** Links shown in the hero menu before which the menu stays a single stack. */
@@ -9,15 +10,19 @@
9
10
  /** 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
11
  const twoColumns = (data, prop, linkCount) => {
11
12
  const wanted = prop ?? data.course?.navColumns;
12
- if (wanted === undefined || wanted === "auto") return linkCount + (data.instructor?.contact ? 1 : 0) > MAX_STACKED;
13
+ if (wanted === undefined || wanted === "auto") return linkCount + (data.instructor?.contact && !data.instructor?.booking?.url ? 1 : 0) > MAX_STACKED;
13
14
  return Number(wanted) === 2;
14
15
  };
16
+ /** A page's children that have not left the menu. */
17
+ const inMenu = (item) => ({ ...item, children: (item.children ?? []).filter((child) => child.menu !== false) });
15
18
  const navItems = (() => {
16
19
  const items = eleventyNavigation($data.collections.all);
17
20
  const home = items.find((item) => item.url === "/");
18
21
  const rest = items.filter((item) => item.url !== "/");
19
- return [...(home ? [home] : []), { url: "/#syllabus", title: $data.copy.nav.syllabus }, ...rest.filter((item) => item.menu !== false)];
22
+ return [...(home ? [home] : []), { url: "/#syllabus", title: $data.copy.nav.syllabus }, ...rest.filter((item) => item.menu !== false).map(inMenu)];
20
23
  })();
24
+ /** Every link the menu shows, a group's children included. */
25
+ const linkCount = navItems.reduce((count, item) => count + 1 + (item.children?.length ?? 0), 0);
21
26
  </script>
22
27
  <header webc:root="override" id="header">
23
28
  <div class="container">
@@ -37,9 +42,12 @@
37
42
  <span webc:if="$data.schedule.meetings.time" @text="$data.schedule.meetings.time"></span>
38
43
  <span webc:if="$data.instructor?.office" @text="$data.instructor.office"></span>
39
44
  </p>
45
+ <p class="booking" webc:if="$data.instructor?.booking?.url">
46
+ <a :href="$data.instructor.booking.url" @text="$data.instructor.booking.label || $data.copy.instructor.bookAnAppointment"></a>
47
+ </p>
40
48
  </div>
41
49
  <div class="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>
50
+ <nav-links column two-column webc:if="twoColumns($data, typeof navColumns === 'undefined' ? undefined : navColumns, linkCount)" :aria-label="$data.copy.nav.site" @context="hero" :@navigation="navItems"></nav-links>
43
51
  <nav-links column webc:else :aria-label="$data.copy.nav.site" @context="hero" :@navigation="navItems"></nav-links>
44
52
  </div>
45
53
  </div>
@@ -137,6 +145,25 @@
137
145
  font-size: max(var(--base-font-size), 0.95em);
138
146
  }
139
147
 
148
+ /* The booking link: an outlined pill, a 44px target, on every page. */
149
+ .booking a {
150
+ display: inline-flex;
151
+ align-items: center;
152
+ min-block-size: var(--target-min);
153
+ padding-inline: 1.25em;
154
+ border: var(--border-width) solid var(--color-accent-text);
155
+ border-radius: var(--radius-pill);
156
+ color: var(--color-accent-text);
157
+ font-weight: var(--font-weight--semi-bold);
158
+ text-decoration: none;
159
+
160
+ &:is(:hover, :focus-visible) {
161
+ background-color: var(--color-accent);
162
+ border-color: var(--color-accent);
163
+ color: var(--color-on-accent);
164
+ }
165
+ }
166
+
140
167
  .links {
141
168
  display: flex;
142
169
  align-items: start;
@@ -2,16 +2,22 @@
2
2
  /**
3
3
  * The site navigation as a list of links, marking the current page. Give it the `navigation` array, or write the links in the default slot
4
4
  * as a `<ul>` of `<li><a>`; the array wins when it has items, and when it is missing or empty the slot is rendered instead.
5
- * @prop {{ url: string, title: string }[]} navigation pages from `eleventyNavigation`
6
- * @prop {'footer' | 'hero'} [context] adds the instructor's contact link in the footer and the hero
5
+ * A page with `children` (pages whose `eleventyNavigation.parent` is its key) is a group: its own link, then its children in a nested list.
6
+ * @prop {{ url: string, title: string, children?: { url: string, title: string }[] }[]} navigation pages from `eleventyNavigation`
7
+ * @prop {'footer' | 'hero'} [context] adds the instructor's contact link in the footer, and in the hero unless the header shows the booking link
7
8
  */
8
9
  </script>
9
10
  <nav webc:root="override" :data-context="context">
10
11
  <ul role="list" webc:if="navigation?.length">
11
- <li webc:for="item of navigation">
12
+ <li webc:for="item of navigation" @attributes="({ class: item?.children?.length ? 'group' : undefined })">
12
13
  <a :href="item?.url" @attributes="({ 'aria-current': item?.url === $data?.page?.url ? 'page' : undefined })" @text="item?.title"></a>
14
+ <ul role="list" webc:if="item?.children?.length">
15
+ <li webc:for="child of item.children">
16
+ <a :href="child?.url" @attributes="({ 'aria-current': child?.url === $data?.page?.url ? 'page' : undefined })" @text="child?.title"></a>
17
+ </li>
18
+ </ul>
13
19
  </li>
14
- <li webc:if="$data.instructor?.contact && (context === 'footer' || context === 'hero')"><a :href="$data.instructor.contact" @text="$data.copy.nav.contact"></a></li>
20
+ <li webc:if="$data.instructor?.contact && (context === 'footer' || (context === 'hero' && !$data.instructor?.booking?.url))"><a :href="$data.instructor.contact" @text="$data.copy.nav.contact"></a></li>
15
21
  </ul>
16
22
  <slot webc:if="!navigation?.length"></slot>
17
23
  </nav>
@@ -139,6 +145,49 @@
139
145
  }
140
146
  }
141
147
 
148
+ /* A group: the parent page's link as a small label, its children under it.
149
+ In the two-column hero it takes the second column to itself. */
150
+ :host li.group > a[href] {
151
+ font-size: max(var(--base-font-size), 0.875em);
152
+ font-weight: var(--font-weight--semi-bold);
153
+ letter-spacing: 0.08em;
154
+ text-transform: uppercase;
155
+ color: var(--color-text-muted);
156
+ }
157
+
158
+ :host([column]) li.group > ul {
159
+ margin-block-start: calc(var(--content-space) * 0.35);
160
+ }
161
+
162
+ @media screen and (width > 768px) {
163
+ :host([column][two-column]) li.group {
164
+ break-before: column;
165
+ }
166
+
167
+ /* The children are spaced by their own margins, as the first column's links are. */
168
+ :host([column][two-column]) li.group > ul {
169
+ display: block;
170
+ columns: auto;
171
+ margin-block-start: calc(var(--content-space) * 0.35);
172
+ }
173
+ }
174
+
175
+ /* On a narrow screen the menu is a wrapped row: a group takes a row of its own, label first. */
176
+ @media screen and (width <= 768px) {
177
+ :host([column]) li.group {
178
+ display: flex;
179
+ flex-wrap: wrap;
180
+ flex-basis: 100%;
181
+ align-items: baseline;
182
+ column-gap: calc(var(--content-space) * 1.25);
183
+ }
184
+
185
+ :host([column]) li.group > ul {
186
+ inline-size: auto;
187
+ margin-block-start: 0;
188
+ }
189
+ }
190
+
142
191
  /* A stack of plain links, not pills — no border, no background. */
143
192
  :host([column]) a,
144
193
  :host([column]) a:visited {
@@ -151,11 +151,12 @@
151
151
  }
152
152
  }
153
153
 
154
+ /* Space between the label and the month links, beside them or, when the row wraps, above them. */
154
155
  .schedule-jump {
155
156
  display: flex;
156
157
  flex-wrap: wrap;
157
158
  align-items: center;
158
- gap: 0 var(--content-space);
159
+ gap: 0.5rem calc(var(--content-space) * 1.5);
159
160
  min-inline-size: 0;
160
161
 
161
162
  h2 {
@@ -231,23 +232,54 @@
231
232
  }
232
233
  }
233
234
 
235
+ /* A switch, not a button: a quiet label after a small track whose knob and fill say on or off, so it reads as a setting beside the month
236
+ links rather than outranking them. The state is aria-pressed; the whole row is the 44px target. The track's edge holds 3:1. */
234
237
  .hide-past {
238
+ display: inline-flex;
239
+ align-items: center;
240
+ gap: 0.6em;
235
241
  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);
242
+ padding-inline: 0.25em;
243
+ border: 0;
244
+ border-radius: var(--standard-border-radius);
240
245
  background: transparent;
241
- color: var(--color-text);
246
+ color: var(--color-text-muted);
242
247
  font: inherit;
243
- font-weight: var(--font-weight--semi-bold);
248
+ font-size: max(var(--base-font-size), 0.95em);
244
249
  cursor: pointer;
245
250
 
251
+ &::before {
252
+ content: "";
253
+ flex: none;
254
+ inline-size: 2.25em;
255
+ block-size: 1.25em;
256
+ box-sizing: border-box;
257
+ border: var(--thin-border-width) solid var(--color-border-strong);
258
+ border-radius: var(--radius-pill);
259
+ background:
260
+ radial-gradient(circle closest-side, var(--color-text-muted) 70%, transparent 76%) left 0.15em center / 0.95em 0.95em no-repeat,
261
+ var(--color-page);
262
+ }
263
+
264
+ &:is(:hover, :focus-visible) {
265
+ color: var(--color-text);
266
+ }
267
+
246
268
  &[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);
269
+ color: var(--color-text);
270
+
271
+ &::before {
272
+ border-color: var(--color-accent-secondary);
273
+ background:
274
+ radial-gradient(circle closest-side, var(--color-on-accent-secondary) 70%, transparent 76%) right 0.15em center / 0.95em 0.95em no-repeat,
275
+ var(--color-accent-secondary);
276
+ }
277
+ }
278
+
279
+ @media (prefers-reduced-motion: no-preference) {
280
+ &::before {
281
+ transition: background-position 150ms ease-out, background-color 150ms ease-out;
282
+ }
251
283
  }
252
284
  }
253
285
 
@@ -260,11 +292,15 @@
260
292
  text-decoration-color: Highlight;
261
293
  }
262
294
 
263
- .hide-past[aria-pressed="true"] {
295
+ .hide-past::before {
264
296
  forced-color-adjust: none;
265
- background: SelectedItem;
266
- border-color: SelectedItem;
267
- color: SelectedItemText;
297
+ border-color: ButtonText;
298
+ background: radial-gradient(circle closest-side, ButtonText 70%, transparent 76%) left 0.15em center / 0.95em 0.95em no-repeat, Canvas;
299
+ }
300
+
301
+ .hide-past[aria-pressed="true"]::before {
302
+ border-color: Highlight;
303
+ background: radial-gradient(circle closest-side, HighlightText 70%, transparent 76%) right 0.15em center / 0.95em 0.95em no-repeat, Highlight;
268
304
  }
269
305
  }
270
306
 
@@ -22,7 +22,10 @@
22
22
  <section class="this-week screen-only" data-this-week aria-labelledby="this-week-heading" hidden>
23
23
  <header class="this-head">
24
24
  <p class="label" data-this-label @text="copy.thisWeek"></p>
25
- <h3 id="this-week-heading"><a href="#" data-this-link></a> <span class="week-of" data-this-dates></span></h3>
25
+ <div class="this-title">
26
+ <h3 id="this-week-heading"><a href="#" data-this-link></a></h3>
27
+ <p class="week-of" data-this-dates></p>
28
+ </div>
26
29
  </header>
27
30
  <ol class="this-days" role="list" data-this-days></ol>
28
31
  <div class="this-groups" data-this-groups hidden>
@@ -67,8 +70,8 @@
67
70
  <p class="label" @text="copy.readBefore"></p>
68
71
  <ul role="list">
69
72
  <li webc:for="reading of meeting.readings" @attributes="reading.kind ? { class: 'due-item', 'data-kind': reading.kind } : {}">
70
- <span class="due-chip" webc:if="reading.kind" :data-kind="reading.kind" @text="dueKindLabel(reading.kind, $data.copy)"></span>
71
73
  <a :href="reading.href" @text="reading.title"></a>
74
+ <span class="due-chip" webc:if="reading.kind" :data-kind="reading.kind" @text="dueKindLabel(reading.kind, $data.copy)"></span>
72
75
  <span class="check" webc:if="detail(reading)" @text="detail(reading)"></span>
73
76
  </li>
74
77
  </ul>
@@ -77,9 +80,9 @@
77
80
  <p class="label" @text="copy.due"></p>
78
81
  <ul role="list">
79
82
  <li webc:for="item of meeting.due" class="due-item" :data-kind="item.kind">
80
- <span class="due-chip" :data-kind="item.kind" @text="dueKindLabel(item.kind, $data.copy)"></span>
81
83
  <a webc:if="item.href" :href="item.href" @text="item.title"></a>
82
84
  <span webc:if="!item.href" @text="item.title"></span>
85
+ <span class="due-chip" :data-kind="item.kind" @text="dueKindLabel(item.kind, $data.copy)"></span>
83
86
  <span class="check" @text="item.dueLabel"></span>
84
87
  </li>
85
88
  </ul>
@@ -96,11 +99,11 @@
96
99
  </li>
97
100
  </ol>
98
101
  <footer class="week-resources" webc:if="week.readings?.length || week.resources?.length">
99
- <p class="label" @text="copy.weekResources"></p>
102
+ <p class="label" @text="copy.resources"></p>
100
103
  <ul role="list">
101
104
  <li data-reading webc:for="reading of (week.readings ?? [])" @attributes="reading.kind ? { class: 'due-item', 'data-kind': reading.kind } : {}">
102
- <span class="due-chip" webc:if="reading.kind" :data-kind="reading.kind" @text="dueKindLabel(reading.kind, $data.copy)"></span>
103
105
  <a :href="reading.href" @text="reading.title"></a>
106
+ <span class="due-chip" webc:if="reading.kind" :data-kind="reading.kind" @text="dueKindLabel(reading.kind, $data.copy)"></span>
104
107
  <span class="check" webc:if="detail(reading)" @text="detail(reading)"></span>
105
108
  </li>
106
109
  <li webc:for="resource of (week.resources ?? [])">
@@ -141,9 +144,10 @@
141
144
  const flag = (el, text, kind) => el.querySelector(".week-head h3")?.after(make("span", `week-flag ${kind}`, text));
142
145
  const current = weeks.find(({ dates }) => dates.at(-1) >= today);
143
146
  for (const week of weeks) {
147
+ // A past week is muted (`.week[data-past]`); "Done" is there for a screen reader only.
144
148
  if (week.dates.at(-1) < today) {
145
149
  week.el.dataset.past = "";
146
- flag(week.el, t("schedule", "stateDone"), "done");
150
+ flag(week.el, t("schedule", "stateDone"), "done sr-only");
147
151
  }
148
152
  }
149
153
  const started = Boolean(current && current.dates[0] <= today);
@@ -233,6 +237,8 @@
233
237
  sideways. */
234
238
  :host {
235
239
  --week-grid: 8.5em minmax(0, 7fr) minmax(0, 5fr);
240
+ /* The "for this class" column's inset after its rule, shared by the column and its head (rem: the two are set in different sizes). */
241
+ --for-class-inset: 1.5rem;
236
242
  display: grid;
237
243
  gap: var(--content-space);
238
244
  }
@@ -283,7 +289,13 @@
283
289
  font-size: max(var(--base-font-size), 0.9em);
284
290
  }
285
291
 
286
- /* The column heads, once per week: a booktabs header over the rows. */
292
+ /* In a week's header the dates sit at the end of the row, after the heading and its Now flag. */
293
+ .week-head .week-of {
294
+ margin-inline-start: auto;
295
+ }
296
+
297
+ /* The column heads, once per week: a booktabs header over the rows. The grid, the gap and the padding are the rows' own, at the rows'
298
+ font size, so each head starts where its column's content does; only the words are set small. */
287
299
  .week-cols {
288
300
  display: grid;
289
301
  grid-template-columns: var(--week-grid);
@@ -291,10 +303,18 @@
291
303
  padding: 0.5em 1em 0.4em;
292
304
  border-block-end: var(--thin-border-width) solid var(--color-text);
293
305
  color: var(--color-text-muted);
294
- font-size: var(--font-size-6);
295
- font-weight: var(--font-weight--medium);
296
- letter-spacing: 0.08em;
297
- text-transform: uppercase;
306
+
307
+ > span {
308
+ font-size: var(--font-size-6);
309
+ font-weight: var(--font-weight--medium);
310
+ letter-spacing: 0.08em;
311
+ text-transform: uppercase;
312
+ }
313
+
314
+ /* The "for this class" column is inset by its rule and padding (below). */
315
+ > span:nth-child(3) {
316
+ padding-inline-start: calc(var(--for-class-inset) + var(--thin-border-width));
317
+ }
298
318
 
299
319
  @media (width <= 860px) {
300
320
  display: none;
@@ -375,7 +395,7 @@
375
395
  font-size: max(var(--base-font-size), 0.94em);
376
396
 
377
397
  @media (860px < width) {
378
- padding-inline-start: 1.5em;
398
+ padding-inline-start: var(--for-class-inset);
379
399
  border-inline-start: var(--thin-border-width) solid var(--color-border);
380
400
  }
381
401
 
@@ -391,6 +411,31 @@
391
411
  display: block;
392
412
  }
393
413
 
414
+ /* An item with a kind: the title first, its badge at the end of the row, and the due line under both. The badge follows the title in the
415
+ source too, so a screen reader hears the title first. In the week's resources the item takes the whole row, so the badge lines up. */
416
+ .due-item {
417
+ display: grid;
418
+ grid-template-columns: minmax(0, 1fr) auto;
419
+ align-items: center;
420
+ column-gap: 0.75em;
421
+ flex-basis: 100%;
422
+
423
+ > .due-chip {
424
+ grid-column: 2;
425
+ grid-row: 1;
426
+ justify-self: end;
427
+ }
428
+
429
+ > :not(.due-chip, .check) {
430
+ grid-column: 1;
431
+ grid-row: 1;
432
+ }
433
+
434
+ > .check {
435
+ grid-column: 1 / -1;
436
+ }
437
+ }
438
+
394
439
  .arrow {
395
440
  color: var(--color-accent-text);
396
441
  text-decoration: none;
@@ -436,17 +481,18 @@
436
481
  display: none;
437
482
  }
438
483
 
439
- h3 {
484
+ /* The week's heading, then its dates at the end of the row, as in each week's own header. */
485
+ .this-title {
440
486
  display: flex;
441
487
  flex-wrap: wrap;
442
488
  align-items: baseline;
443
- gap: 0.2em 0.6em;
444
- margin: 0;
445
- font-size: var(--font-size-3);
489
+ justify-content: space-between;
490
+ gap: 0.2em 1em;
446
491
  }
447
492
 
448
- .week-of {
449
- font-weight: var(--font-weight);
493
+ h3 {
494
+ margin: 0;
495
+ font-size: var(--font-size-3);
450
496
  }
451
497
 
452
498
  /* The week's own link is an operable target: 44px tall (WCAG 2.5.5). */
@@ -495,6 +541,7 @@
495
541
  }
496
542
 
497
543
  .day-flag {
544
+ margin-inline-start: auto;
498
545
  padding: 0.05em 0.65em;
499
546
  border-radius: var(--radius-pill);
500
547
  background-color: var(--color-accent-secondary);
@@ -532,6 +579,21 @@
532
579
  box-shadow: inset var(--border-width) 0 0 var(--color-accent-secondary);
533
580
  }
534
581
 
582
+ /* A past week steps back: muted text (still 7:1), no surface behind the heading and no accent rule under it. Color is not the only cue:
583
+ past weeks come before the one marked Now, and the hide-past toggle names them. */
584
+ .week[data-past] {
585
+ color: var(--color-text-muted);
586
+
587
+ .week-head {
588
+ background-color: transparent;
589
+ border-block-end-color: var(--color-border);
590
+
591
+ h3 {
592
+ color: var(--color-text-muted);
593
+ }
594
+ }
595
+ }
596
+
535
597
  .week-flag {
536
598
  padding: 0.1em 0.65em;
537
599
  border-radius: var(--radius-pill);
@@ -542,14 +604,6 @@
542
604
  background-color: var(--color-accent-secondary);
543
605
  color: var(--color-on-accent-secondary);
544
606
  }
545
-
546
- &.done {
547
- color: var(--color-text-muted);
548
- }
549
-
550
- &.done::before {
551
- content: "✓ " / "";
552
- }
553
607
  }
554
608
 
555
609
  /* Print: the weeks as a plain list, without the card, tools or heads. */
@@ -15,7 +15,7 @@
15
15
  </div>
16
16
  <div class="group">
17
17
  <p class="label" id="footer-pages" @text="$data.copy.siteFooter.pages"></p>
18
- <nav-links column aria-labelledby="footer-pages" @context="footer" :@navigation="eleventyNavigation($data.collections.all)"></nav-links>
18
+ <nav-links column aria-labelledby="footer-pages" @context="footer" :@navigation="eleventyNavigation($data.collections.all).flatMap((item) => [{ ...item, children: [] }, ...(item.children ?? [])])"></nav-links>
19
19
  </div>
20
20
  <nav class="group" aria-labelledby="footer-policies" webc:if="$data.policies">
21
21
  <p class="label" id="footer-policies" @text="$data.copy.siteFooter.policies"></p>
@@ -2,12 +2,12 @@
2
2
  /**
3
3
  * A labelled list of readings or deadlines. Renders nothing when empty.
4
4
  * Give it the `items` array, or write the list as a `<dl>` in the default slot: each `<dt>` holds the title or its link (give it `data-kind` and,
5
- * before the title, `<span class="due-chip" data-kind="test">Test</span>` for a chip), each `<dd>` only the check or due detail. The array wins when
5
+ * after the title, `<span class="due-chip" data-kind="test">Test</span>` for a chip, shown at the end of the row), each `<dd>` only the check or due detail. The array wins when
6
6
  * it has items; when it is missing or empty the slot is rendered instead, so the list still shows if the data does not load.
7
7
  * @prop {string} label the heading above the list
8
8
  * @prop {{ title: string, href?: string, check?: string, dueLabel?: string, kind?: string }[]} items the readings or deadlines to list
9
9
  * @prop {string} [dueOn] how a due date reads after the check, with `{when}`: `copy.schedule.dueOn` ("due {when}"); without it the date stands alone
10
- * @prop {boolean} [chips] put a `.due-chip` for the item's `kind` before its title; a bare `@chips` turns them on
10
+ * @prop {boolean} [chips] put a `.due-chip` for the item's `kind` after its title, at the end of the row; a bare `@chips` turns them on
11
11
  * @prop {Record<string, string>} [kinds] the chip words by kind, from `copy.schedule.dueKind*`; needed with `chips`
12
12
  */
13
13
 
@@ -22,9 +22,9 @@
22
22
  <slot webc:if="!items?.length"></slot>
23
23
  <ul role="list" webc:if="items?.length">
24
24
  <li webc:for="item of items" @attributes="on(chips) && item.kind ? { class: 'due-item', 'data-kind': item.kind } : {}">
25
- <span class="due-chip" webc:if="on(chips) && item.kind" :data-kind="item.kind" @text="kinds?.[item.kind]"></span>
26
25
  <a webc:if="item.href" :href="item.href" @text="item.title"></a>
27
26
  <span webc:if="!item.href" @text="item.title"></span>
27
+ <span class="due-chip" webc:if="on(chips) && item.kind" :data-kind="item.kind" @text="kinds?.[item.kind]"></span>
28
28
  <span class="check" webc:if="detail(item, dueOn)" @text="detail(item, dueOn)"></span>
29
29
  </li>
30
30
  </ul>
@@ -48,13 +48,33 @@
48
48
  padding: 0;
49
49
  }
50
50
 
51
- /* A chip and its title share a row that wraps, so a long title never runs under the chip. */
51
+ /*
52
+ * The title, then its chip at the end of the row, then the detail under both. A long title wraps beside the chip, never under it.
53
+ * The title row is a target tall whether or not the title is a link, so every item is spaced alike. The chip is placed by column,
54
+ * so a slot's `<dt>` shows it at the end in either source order.
55
+ */
52
56
  li,
53
57
  dt {
54
- display: flex;
55
- flex-wrap: wrap;
58
+ display: grid;
59
+ grid-template-columns: minmax(0, 1fr) auto;
60
+ grid-template-rows: minmax(var(--target-min), auto);
56
61
  align-items: center;
57
- gap: 0 0.5em;
62
+ column-gap: 0.75em;
63
+
64
+ > .due-chip {
65
+ grid-column: 2;
66
+ grid-row: 1;
67
+ justify-self: end;
68
+ }
69
+
70
+ > :not(.due-chip, .check) {
71
+ grid-column: 1;
72
+ grid-row: 1;
73
+ }
74
+
75
+ > .check {
76
+ grid-column: 1 / -1;
77
+ }
58
78
  }
59
79
 
60
80
  /* A link is an operable target: 44px tall (WCAG 2.5.5). */
@@ -93,7 +113,6 @@
93
113
  }
94
114
 
95
115
  .check {
96
- flex-basis: 100%;
97
116
  line-height: var(--font-height);
98
117
  color: var(--color-text-muted);
99
118
  font-size: max(var(--base-font-size), 0.9em);
@@ -38,3 +38,40 @@ What we will do
38
38
  :::
39
39
 
40
40
  >>>
41
+ >>> slide
42
+
43
+ ::: eyebrow
44
+ How the web works
45
+ :::
46
+
47
+ ## From a file to a reader
48
+
49
+ <svg viewBox="0 0 720 190" role="img" aria-label="A page file is put on a web server, and the server sends it to a browser.">
50
+ <defs><marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto"><path class="accent" d="M0 0 L10 5 L0 10 z"/></marker></defs>
51
+ <rect class="tint" x="20" y="30" width="180" height="80" rx="12"/>
52
+ <text class="mono" x="110" y="78" text-anchor="middle" font-size="22">index.html</text>
53
+ <g class="step">
54
+ <path class="stroke-accent draw" pathLength="1" d="M208 70 H262" stroke-width="3" marker-end="url(#arrow)"/>
55
+ <g class="pop">
56
+ <rect class="tint" x="270" y="30" width="180" height="80" rx="12"/>
57
+ <text x="360" y="78" text-anchor="middle" font-size="22">Web server</text>
58
+ </g>
59
+ </g>
60
+ <g class="step">
61
+ <path class="stroke-accent draw" pathLength="1" d="M458 70 H512" stroke-width="3" marker-end="url(#arrow)"/>
62
+ <g class="pop">
63
+ <rect class="tint" x="520" y="30" width="180" height="80" rx="12"/>
64
+ <text x="610" y="78" text-anchor="middle" font-size="22">Browser</text>
65
+ </g>
66
+ </g>
67
+ <g class="step">
68
+ <text class="accent" x="360" y="160" text-anchor="middle" font-size="20">The address names the server and the file.</text>
69
+ </g>
70
+ </svg>
71
+
72
+ ::: notes How a page travels (0:20–0:30)
73
+ - Press the next-slide key once for each part of the figure.
74
+ - Ask where the file lives at each step.
75
+ :::
76
+
77
+ >>>
package/lib/copy.js CHANGED
@@ -64,6 +64,11 @@ export const COPY_DEFAULTS = {
64
64
  firstLabel: "First class",
65
65
  when: "Week {week} · {weekday}, {date}",
66
66
  openSlides: "Open the slides",
67
+ weekThis: "This week",
68
+ weekNext: "Next week",
69
+ weekFirst: "First week",
70
+ weekWhen: "Week {week} · {from} to {to}",
71
+ weekWhenDay: "Week {week} · {date}",
67
72
  seeWeek: "See the week",
68
73
  comingUp: "Coming up",
69
74
  fullSchedule: "Full schedule",
@@ -101,7 +106,7 @@ export const COPY_DEFAULTS = {
101
106
  materials: "Materials",
102
107
  slides: "Slides",
103
108
  addendum: "Addendum",
104
- weekResources: "This week’s resources",
109
+ resources: "Resources",
105
110
  noClass: "No class — {reason}",
106
111
  substitution: "Runs a {weekday} schedule",
107
112
  dueKeyLabel: "Key to due items",
package/lib/markdown.js CHANGED
@@ -550,7 +550,7 @@ const codeBlock = (tokens, idx, options, env, self) => {
550
550
  const copy = resolveCopy().code;
551
551
  const label = copy.languages[language] ?? (language ? language.toUpperCase() : copy.plain);
552
552
  const file = title ? `<span class="code-block-file">${esc(title)}</span>` : "";
553
- return `<figure class="code-block" data-edge="${edge}"${numbered ? " data-line-numbers" : ""}>\n<figcaption class="code-block-head"><span class="code-block-lang">${esc(label)}</span>${file}</figcaption>\n${pre}</figure>\n`;
553
+ return `<figure class="code-block" data-edge="${edge}"${numbered ? ` data-line-numbers style="--line-digits: ${String(lines).length}"` : ""}>\n<figcaption class="code-block-head"><span class="code-block-lang">${esc(label)}</span>${file}</figcaption>\n${pre}</figure>\n`;
554
554
  };
555
555
 
556
556
  markdown.renderer.rules.fence = (tokens, idx, options, env, self) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allons-y/course-kit",
3
- "version": "0.4.2",
3
+ "version": "0.5.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)",
@@ -42,7 +42,7 @@
42
42
  "preview:build": "node scripts/site.js build",
43
43
  "docs:build": "node scripts/site.js build",
44
44
  "docs:start": "node scripts/site.js start",
45
- "docs:test": "cypress run --project website",
45
+ "docs:test": "node scripts/browser-run.js",
46
46
  "pages:build": "node scripts/site.js build",
47
47
  "format": "opx lint --fix",
48
48
  "lint": "opx lint",
@@ -108,7 +108,7 @@
108
108
  "ajv": "^8.20.0",
109
109
  "ajv-formats": "^3.0.1",
110
110
  "axe-core": "^4.14.0",
111
- "cypress": "^15.21.1",
111
+ "cypress": "^15.21.2",
112
112
  "cypress-axe": "^1.7.0"
113
113
  },
114
114
  "oss-docs": {