@allons-y/course-kit 0.1.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 CHANGED
@@ -15,7 +15,7 @@ You get:
15
15
 
16
16
  ## Start here
17
17
 
18
- You need [Node.js](https://nodejs.org) 22 or newer, and a terminal.
18
+ You need [Node.js](https://nodejs.org) 24 or newer, and a terminal.
19
19
 
20
20
  1. Copy the [`examples/starter`](examples/starter) folder to a new folder for your course.
21
21
  2. In that folder, add a `package.json`:
@@ -31,7 +31,7 @@ You need [Node.js](https://nodejs.org) 22 or newer, and a terminal.
31
31
  },
32
32
  "dependencies": {
33
33
  "@11ty/eleventy": "^3.1.0",
34
- "@allons-y/course-kit": "github:allonsy-studio/course-kit"
34
+ "@allons-y/course-kit": "0.1.1"
35
35
  }
36
36
  }
37
37
  ```
@@ -1,11 +1,12 @@
1
1
  /*
2
- * Slide deck controller: which slide is showing, and the theme. Speaker
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, T theme, F fullscreen.
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));
@@ -4,11 +4,13 @@ for (const anchor of document.querySelectorAll("a[data-email]")) {
4
4
  try {
5
5
  const address = atob(anchor.dataset.email);
6
6
  anchor.href = `mailto:${address}`;
7
- if (!anchor.textContent.trim()) {
7
+ // An icon link keeps its svg and writes the address into its own text slot.
8
+ const target = anchor.querySelector("[data-email-text]") ?? anchor;
9
+ if (!target.textContent.trim()) {
8
10
  // Break opportunities before "@" and after each ".": a narrow screen wraps the address there, not mid-word.
9
11
  address.split(/(?=@)|(?<=\.)/).forEach((part, index) => {
10
- if (index) anchor.append(document.createElement("wbr"));
11
- anchor.append(part);
12
+ if (index) target.append(document.createElement("wbr"));
13
+ target.append(part);
12
14
  });
13
15
  }
14
16
  } catch {
@@ -982,9 +982,10 @@ eyebrow + :where(h1, h2, h3, h4, h5, h6) {
982
982
  }
983
983
 
984
984
  /* ---- Side columns ----
985
- A contents column beside a document, and an outline and a tools rail beside
986
- a lesson plan. Nothing is sticky, and each falls to one column on a narrow
987
- screen, the side columns first. */
985
+ A contents column beside a document (and beside the syllabus, whose own
986
+ component sets where it sits), and an outline and a tools rail beside
987
+ a lesson plan. Only the syllabus's list is sticky, and each falls to one
988
+ column on a narrow screen, the side columns first. */
988
989
  .rail-label {
989
990
  margin: 0 0 0.5em;
990
991
  color: var(--color-text-muted);
@@ -1012,9 +1013,26 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
1012
1013
 
1013
1014
  .doc-layout[data-contents="true"] {
1014
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";
1015
1018
 
1016
1019
  @media screen and (width <= 900px) {
1017
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;
1018
1036
  }
1019
1037
  }
1020
1038
 
@@ -1049,7 +1067,7 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
1049
1067
  }
1050
1068
  }
1051
1069
 
1052
- :is(.doc-contents nav, .lesson-outline, .lesson-rail nav) > :is(ol, ul) {
1070
+ :is(.doc-contents nav, .lesson-outline, .lesson-rail nav, .syllabus-contents) > :is(ol, ul) {
1053
1071
  margin: 0;
1054
1072
  padding: 0;
1055
1073
  list-style: none;
@@ -1062,7 +1080,10 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
1062
1080
  }
1063
1081
 
1064
1082
  li a[href] {
1065
- display: block;
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);
1066
1087
  margin-inline-start: calc(var(--border-width) * -1);
1067
1088
  padding: 0.35em 0.9em;
1068
1089
  border-inline-start: var(--border-width) solid transparent;
@@ -1098,6 +1119,19 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
1098
1119
  }
1099
1120
 
1100
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
+
1101
1135
  .lesson-nav {
1102
1136
  display: flex;
1103
1137
  gap: calc(var(--content-space) * 2);
@@ -1108,6 +1142,12 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
1108
1142
  margin: 0;
1109
1143
  }
1110
1144
 
1145
+ a {
1146
+ display: inline-flex;
1147
+ align-items: center;
1148
+ min-block-size: var(--target-min);
1149
+ }
1150
+
1111
1151
  @media print {
1112
1152
  display: none;
1113
1153
  }
@@ -1209,6 +1249,13 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
1209
1249
  td {
1210
1250
  border-inline: none;
1211
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
+ }
1212
1259
  }
1213
1260
 
1214
1261
  figure > :where(table) {
@@ -1455,6 +1502,13 @@ blockquote {
1455
1502
  max-inline-size: 80ch;
1456
1503
  }
1457
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
+
1458
1512
  details {
1459
1513
  margin-block: 0;
1460
1514
  padding: 0;
@@ -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 class="separators">
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,10 +2,14 @@
2
2
  /**
3
3
  * The instructor's details: photo, office, contact and hours. Reads `instructor`.
4
4
  * @prop {'card'} [variant] a compact card instead of the full section
5
+ * @prop {'icons'} [contactLinks] show the email, the message link and the blog as icon links in the corner of the panel instead of rows in the fact list; the same as `contactLinks: "icons"` in `instructor.json`, and wins over it
5
6
  */
7
+ /** The prop wins over the data; either one set to "icons" turns the icon links on. */
8
+ const iconsOn = (data, prop) => (prop ?? data.instructor?.contactLinks) === "icons";
9
+ const host = (url) => url.replace(/^https?:\/\//, "").replace(/\/$/, "");
6
10
  </script>
7
11
  <section id="instructor" aria-labelledby="instructor-heading" webc:root="override" webc:if="$data.instructor">
8
- <template webc:nokeep webc:if="variant !== 'card'">
12
+ <template webc:nokeep webc:for="icons of [iconsOn($data, typeof contactLinks === 'undefined' ? undefined : contactLinks)]" webc:if="variant !== 'card'">
9
13
  <div class="who">
10
14
  <img class="photo screen-only" webc:if="$data.instructor.photo" :src="$data.instructor.photo" :alt="$data.instructor.name" width="160" height="160">
11
15
  <div class="facts-column">
@@ -28,20 +32,36 @@
28
32
  </ul>
29
33
  </dd>
30
34
  </div>
31
- <div webc:if="$data.instructor.email" :class="$data.instructor.contact ? 'print-only' : ''">
35
+ <div webc:if="!icons && $data.instructor.email" :class="$data.instructor.contact ? 'print-only' : ''">
32
36
  <dt @text="$data.copy.instructor.email"></dt>
33
37
  <dd><a :data-email="encodeEmail($data.instructor.email)"></a></dd>
34
38
  </div>
35
- <div webc:if="$data.instructor.contact" :class="$data.instructor.email ? 'screen-only' : ''">
39
+ <div webc:if="!icons && $data.instructor.contact" :class="$data.instructor.email ? 'screen-only' : ''">
36
40
  <dt @text="$data.copy.instructor.message"></dt>
37
41
  <dd><a :href="$data.instructor.contact" @text="$data.copy.instructor.sendMeAMessage"></a></dd>
38
42
  </div>
39
- <div webc:if="$data.instructor.blog">
43
+ <div webc:if="!icons && $data.instructor.blog">
40
44
  <dt @text="$data.copy.instructor.blog"></dt>
41
45
  <dd><a :href="$data.instructor.blog" @text="$data.instructor.blog.replace(/^https?:\/\//, '').replace(/\/$/, '')"></a></dd>
42
46
  </div>
43
47
  </dl>
44
- <p class="muted note" webc:if="$data.instructor.note" @text="$data.instructor.note"></p>
48
+ <p class="muted note" webc:if="$data.instructor.note" @text="$data.instructor.note"></p><ul class="links" role="list" :aria-label="$data.copy.instructor.contact" webc:if="icons && ($data.instructor.email || $data.instructor.contact || $data.instructor.blog)">
49
+ <li webc:if="$data.instructor.email">
50
+ <a class="icon-link" :data-email="encodeEmail($data.instructor.email)" :aria-label="$data.copy.instructor.email" :title="$data.copy.instructor.email"><svg
51
+ 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"><rect x="3" y="5" width="18" height="14" rx="2"></rect><path d="m3 7 9 6 9-6"></path></svg><span
52
+ class="link-text" data-email-text></span></a>
53
+ </li>
54
+ <li webc:if="$data.instructor.contact" :class="$data.instructor.email ? 'screen-only' : ''">
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
57
+ class="link-text" @text="$data.copy.instructor.sendMeAMessage"></span></a>
58
+ </li>
59
+ <li webc:if="$data.instructor.blog">
60
+ <a class="icon-link" :href="$data.instructor.blog" :aria-label="$data.copy.instructor.blog" :title="fill($data.copy.instructor.blogUrl, { url: host($data.instructor.blog) })"><svg
61
+ 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"><circle cx="12" cy="12" r="9"></circle><path d="M3 12h18"></path><path d="M12 3a14 14 0 0 1 0 18a14 14 0 0 1 0-18"></path></svg><span
62
+ class="link-text" @text="host($data.instructor.blog)"></span></a>
63
+ </li>
64
+ </ul>
45
65
  </div>
46
66
  </div>
47
67
  </template>
@@ -255,15 +275,158 @@
255
275
  }
256
276
  </style>
257
277
 
278
+ <style>
279
+ /* Icon links (`contactLinks: "icons"`): the email, the message link and the
280
+ blog as 44px circles beside the "Your instructor" heading, at the top
281
+ right of the panel. They follow the facts in the source, so print, which
282
+ drops the photo and runs the facts into one line, reads facts first and
283
+ then the address and the host in place of the icons. Plain selectors,
284
+ not the scoped block above: that block is what every other site renders. */
285
+ /* The heading and the icons share the first line; when the column is too
286
+ narrow for both, the icons wrap onto a line of their own, still at the
287
+ right. The facts and the note take full lines. `order` puts the icons
288
+ after the heading on screen while they follow the facts in the source. */
289
+ #instructor .facts-column:has(> .links) {
290
+ display: flex;
291
+ flex-wrap: wrap;
292
+ align-items: center;
293
+ column-gap: var(--content-space);
294
+
295
+ @media print {
296
+ display: block;
297
+ }
298
+ }
299
+
300
+ #instructor .facts-column:has(> .links) > h2 {
301
+ flex: 1 1 auto;
302
+ margin-block: 0;
303
+ }
304
+
305
+ #instructor .facts-column:has(> .links) > .facts {
306
+ flex: 1 1 100%;
307
+ order: 2;
308
+ margin-block-start: 0.35em;
309
+ }
310
+
311
+ #instructor .facts-column:has(> .links) > .note {
312
+ flex: 1 1 100%;
313
+ order: 3;
314
+ }
315
+
316
+ #instructor .links {
317
+ flex: none;
318
+ order: 1;
319
+ margin: 0 0 0 auto;
320
+ padding: 0;
321
+ display: flex;
322
+ gap: 0.5em;
323
+ list-style: none;
324
+
325
+ @media print {
326
+ display: inline;
327
+ }
328
+ }
329
+
330
+ #instructor .links > li {
331
+ margin: 0;
332
+ padding: 0;
333
+
334
+ @media print {
335
+ display: inline;
336
+
337
+ &::before {
338
+ content: " · ";
339
+ }
340
+
341
+ /* The message link stands in for the address on screen only. */
342
+ &.screen-only {
343
+ display: none;
344
+ }
345
+ }
346
+ }
347
+
348
+ #instructor .icon-link {
349
+ position: relative;
350
+ display: inline-flex;
351
+ align-items: center;
352
+ justify-content: center;
353
+ box-sizing: border-box;
354
+ /* An operable target: 44px each way (WCAG 2.5.5), the icon 24px inside it. */
355
+ inline-size: var(--target-min);
356
+ block-size: var(--target-min);
357
+ aspect-ratio: auto;
358
+ border: var(--thin-border-width) solid var(--color-border-strong);
359
+ border-radius: var(--circle-border-radius);
360
+ color: var(--color-link);
361
+ text-decoration: none;
362
+
363
+ &:is(:hover, :focus-visible) {
364
+ border-color: var(--color-link);
365
+ background-color: var(--color-surface-accent);
366
+ text-decoration: none;
367
+ }
368
+
369
+ /* base.css gives an svg without a size a full-width, 2.5em-tall box and a currentColor fill. These carry a width, a height and fill="none"; say so
370
+ again for any rule that is looser. */
371
+ svg {
372
+ flex: none;
373
+ inline-size: 24px;
374
+ block-size: 24px;
375
+ min-block-size: 0;
376
+ fill: none;
377
+ }
378
+
379
+ @media print {
380
+ display: inline;
381
+ inline-size: auto;
382
+ block-size: auto;
383
+ border: none;
384
+ border-radius: 0;
385
+ color: inherit;
386
+ text-decoration: underline;
387
+
388
+ svg {
389
+ display: none;
390
+ }
391
+ }
392
+ }
393
+
394
+ /* The address, the message label or the host behind each icon: clipped on
395
+ screen, where the aria-label names the link, and printed in place of
396
+ the icon. It stays in the text, so find-in-page and copy reach it. */
397
+ @media screen {
398
+ #instructor .link-text {
399
+ position: absolute;
400
+ inline-size: 1px;
401
+ block-size: 1px;
402
+ overflow: hidden;
403
+ clip-path: inset(50%);
404
+ white-space: nowrap;
405
+ }
406
+ }
407
+
408
+ @media (forced-colors: active) {
409
+ #instructor .icon-link {
410
+ border-color: LinkText;
411
+ }
412
+
413
+ #instructor .icon-link:is(:hover, :focus-visible) {
414
+ border-color: Highlight;
415
+ }
416
+ }
417
+ </style>
418
+
258
419
  <script>
259
420
  for (const link of document.querySelectorAll("a[data-email]")) {
260
421
  const email = atob(link.dataset.email);
261
422
  link.href = `mailto:${email}`;
423
+ // An icon link keeps its svg and writes the address into its own text slot.
424
+ const target = link.querySelector("[data-email-text]") ?? link;
425
+ if (target.textContent.trim()) continue;
262
426
  // Break opportunities before "@" and after each ".": a narrow screen wraps the address there, not mid-word.
263
- link.textContent = "";
264
427
  email.split(/(?=@)|(?<=\.)/).forEach((part, index) => {
265
- if (index) link.append(document.createElement("wbr"));
266
- link.append(part);
428
+ if (index) target.append(document.createElement("wbr"));
429
+ target.append(part);
267
430
  });
268
431
  }
269
432
  </script>
@@ -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 {