@allons-y/course-kit 0.6.0 → 0.8.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
@@ -58,6 +58,7 @@ You need [Node.js](https://nodejs.org) 24 or newer, and a terminal.
58
58
  | See what is decided but not done | [Backlog](docs/backlog.md) |
59
59
  | Fix an error message | [Troubleshooting](docs/troubleshooting.md) |
60
60
  | Pin a version, or cut a release | [Releasing](docs/releasing.md) |
61
+ | Keep the course template in sync | [Releasing](docs/releasing.md#keeping-the-template-current), [`AGENTS.md`](AGENTS.md) |
61
62
 
62
63
  ## Words used here
63
64
 
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="720" height="720" viewBox="0 0 720 720" role="presentation">
3
+ <g fill="none" stroke="#6B6F80" stroke-opacity="0.2" stroke-width="1">
4
+ <path d="M239.2 246.0Q241.9 250.0 241.7 255.0Q241.5 260.0 236.0 262.6Q230.5 265.2 225.3 266.4Q220.2 267.7 214.7 268.8Q209.2 269.9 203.6 268.3Q198.0 266.6 193.8 263.1Q189.7 259.5 189.8 254.7Q189.9 250.0 192.3 246.2Q194.7 242.4 196.4 237.9Q198.1 233.5 203.4 230.8Q208.6 228.1 214.7 229.2Q220.8 230.3 225.6 232.6Q230.4 234.9 233.5 238.4Q236.6 241.9 239.2 246.0Z"/>
5
+ <path d="M271.9 240.4Q277.6 250.0 276.7 261.4Q275.7 272.8 263.0 278.7Q250.3 284.5 238.6 287.5Q226.8 290.5 214.0 293.7Q201.2 297.0 188.3 292.9Q175.3 288.9 166.7 280.1Q158.1 271.4 157.8 260.7Q157.6 250.0 162.6 241.1Q167.6 232.2 171.5 221.8Q175.5 211.3 187.8 205.3Q200.1 199.2 214.0 202.5Q227.9 205.8 239.0 210.7Q250.1 215.7 258.1 223.2Q266.2 230.8 271.9 240.4Z"/>
6
+ <path d="M305.7 234.5Q313.9 250.0 311.3 267.6Q308.7 285.2 289.1 294.3Q269.6 303.4 251.6 308.3Q233.5 313.2 213.2 319.3Q193.0 325.3 172.6 318.4Q152.2 311.5 140.2 297.0Q128.2 282.6 127.0 266.3Q125.9 250.0 132.6 235.8Q139.3 221.6 145.8 205.2Q152.4 188.8 172.0 179.5Q191.7 170.3 213.2 176.3Q234.8 182.4 252.1 189.6Q269.4 196.8 283.5 207.9Q297.6 219.0 305.7 234.5Z"/>
7
+ <path d="M340.6 228.2Q350.3 250.0 345.2 273.5Q340.0 297.0 314.4 309.5Q288.7 322.1 264.5 329.3Q240.3 336.4 212.3 345.5Q184.4 354.6 156.6 344.4Q128.9 334.2 114.6 313.6Q100.3 293.1 97.3 271.5Q94.3 250.0 101.9 230.2Q109.4 210.3 119.3 188.2Q129.1 166.0 156.2 153.9Q183.3 141.7 212.3 150.9Q241.3 160.0 264.9 169.0Q288.5 178.1 309.7 192.3Q331.0 206.4 340.6 228.2Z"/>
8
+ <path d="M376.4 221.6Q386.7 250.0 378.1 279.0Q369.5 308.0 338.7 324.4Q307.9 340.8 277.6 350.6Q247.3 360.4 211.5 372.5Q175.6 384.6 140.7 370.7Q105.8 356.8 90.0 329.9Q74.2 302.9 68.4 276.4Q62.7 250.0 70.1 224.2Q77.6 198.4 91.7 170.8Q105.9 143.3 140.5 128.7Q175.2 114.1 211.5 126.1Q247.7 138.2 277.8 148.7Q307.8 159.2 337.0 176.2Q366.1 193.2 376.4 221.6Z"/>
9
+ <path d="M412.7 214.7Q422.7 250.0 409.8 284.2Q396.9 318.3 362.1 339.1Q327.3 359.8 291.0 372.8Q254.7 385.7 210.7 400.2Q166.8 414.8 124.9 396.9Q83.0 379.1 66.3 345.6Q49.6 312.1 40.1 281.1Q30.7 250.0 37.2 217.8Q43.7 185.7 63.3 153.2Q82.9 120.8 125.2 104.2Q167.5 87.6 210.7 102.1Q254.0 116.7 290.7 128.3Q327.4 140.0 365.1 159.7Q402.8 179.5 412.7 214.7Z"/>
10
+ <path d="M449.3 207.6Q458.0 250.0 440.1 288.9Q422.3 327.9 384.8 353.6Q347.2 379.3 304.9 395.9Q262.5 412.4 210.3 428.5Q158.0 444.7 109.4 422.7Q60.9 400.8 43.5 360.9Q26.1 321.0 12.0 285.5Q-2.0 250.0 2.9 211.1Q7.8 172.2 34.1 135.5Q60.4 98.8 110.3 80.7Q160.2 62.6 210.3 78.7Q260.4 94.9 304.0 107.6Q347.7 120.2 394.1 142.8Q440.5 165.3 449.3 207.6Z"/>
11
+ <path d="M546.6 500.1Q547.3 505.0 545.1 509.3Q542.9 513.6 538.9 516.6Q535.0 519.7 530.3 521.7Q525.5 523.7 519.5 525.4Q513.5 527.1 508.1 524.5Q502.7 521.9 500.9 517.4Q499.1 512.9 497.2 508.9Q495.3 505.0 495.7 500.5Q496.0 496.0 499.3 492.0Q502.6 488.0 508.3 486.1Q513.9 484.2 519.5 485.8Q525.1 487.5 530.1 488.9Q535.1 490.2 540.5 492.7Q545.9 495.3 546.6 500.1Z"/>
12
+ <path d="M585.8 492.8Q586.8 505.0 580.7 515.3Q574.6 525.5 566.0 533.6Q557.4 541.6 545.6 546.9Q533.8 552.2 519.0 555.7Q504.1 559.2 491.0 552.7Q477.8 546.2 473.6 535.1Q469.4 524.0 464.1 514.5Q458.8 505.0 459.0 493.6Q459.3 482.2 468.4 472.9Q477.6 463.5 491.5 459.2Q505.3 454.8 519.0 458.3Q532.6 461.9 545.1 465.0Q557.7 468.2 571.2 474.4Q584.7 480.7 585.8 492.8Z"/>
13
+ <path d="M624.8 485.4Q625.5 505.0 615.0 520.9Q604.6 536.8 592.5 550.4Q580.4 564.1 561.5 573.1Q542.6 582.1 518.7 586.5Q494.9 590.8 474.3 580.3Q453.7 569.8 447.0 552.4Q440.3 534.9 430.9 520.0Q421.5 505.0 421.1 486.4Q420.8 467.7 437.0 453.7Q453.3 439.7 475.2 433.4Q497.2 427.0 518.7 431.3Q540.3 435.6 560.6 440.5Q580.9 445.4 602.5 455.7Q624.1 465.9 624.8 485.4Z"/>
14
+ <path d="M663.3 478.1Q663.1 505.0 648.2 526.3Q633.3 547.6 618.8 567.5Q604.3 587.4 578.0 600.5Q551.8 613.6 518.9 617.5Q485.9 621.4 458.2 607.0Q430.4 592.6 420.8 569.2Q411.2 545.9 397.1 525.4Q383.1 505.0 382.1 478.9Q381.0 452.8 405.4 434.7Q429.7 416.7 459.6 408.7Q489.5 400.6 518.9 404.5Q548.3 408.4 576.6 415.2Q605.0 421.9 634.2 436.5Q663.4 451.1 663.3 478.1Z"/>
15
+ <path d="M700.8 470.8Q699.7 505.0 680.5 531.5Q661.2 558.0 645.1 584.9Q629.1 611.7 595.2 629.0Q561.4 646.3 519.4 648.5Q477.4 650.6 442.7 632.6Q408.0 614.5 394.6 585.8Q381.2 557.1 362.5 531.1Q343.7 505.0 342.1 471.3Q340.5 437.6 373.8 416.1Q407.1 394.6 444.6 385.1Q482.1 375.6 519.4 377.8Q556.6 379.9 593.3 388.7Q630.0 397.4 666.0 417.0Q702.0 436.6 700.8 470.8Z"/>
16
+ <path d="M737.2 463.9Q735.2 505.0 712.2 536.8Q689.1 568.5 671.9 602.6Q654.7 636.8 613.0 658.5Q571.3 680.2 520.3 679.2Q469.3 678.3 427.9 656.9Q386.6 635.5 368.2 602.2Q349.9 568.9 326.6 537.0Q303.2 505.0 301.5 463.7Q299.8 422.3 342.6 397.8Q385.4 373.3 430.3 362.5Q475.1 351.7 520.3 350.7Q565.4 349.8 610.7 360.9Q655.9 372.1 697.5 397.4Q739.1 422.7 737.2 463.9Z"/>
17
+ <path d="M655.2 320.1Q669.6 360.0 664.9 402.6Q660.2 445.2 626.5 478.8Q592.8 512.4 545.9 530.1Q499.0 547.7 454.0 562.2Q409.0 576.7 357.8 586.6Q306.5 596.6 254.2 585.2Q201.8 573.7 162.9 544.1Q124.1 514.4 100.6 477.4Q77.0 440.3 73.3 400.2Q69.6 360.0 83.0 322.6Q96.3 285.1 114.8 248.4Q133.2 211.6 166.1 177.0Q199.0 142.4 251.9 129.1Q304.8 115.8 357.8 125.7Q410.7 135.7 456.3 152.1Q501.8 168.4 542.8 191.0Q583.7 213.6 612.3 246.9Q640.8 280.3 655.2 320.1Z"/>
18
+ <path d="M707.7 312.2Q718.5 360.0 707.0 407.6Q695.5 455.3 659.1 493.6Q622.7 532.0 571.7 554.5Q520.7 577.0 468.9 595.1Q417.2 613.2 357.1 626.1Q296.9 638.9 235.7 624.8Q174.4 610.7 133.9 572.6Q93.3 534.5 70.0 491.7Q46.7 448.9 36.6 404.5Q26.5 360.0 35.9 315.3Q45.3 270.6 68.9 227.8Q92.6 185.0 133.6 147.3Q174.7 109.6 235.9 95.6Q297.1 81.6 357.1 94.5Q417.1 107.4 468.8 125.3Q520.4 143.2 571.9 165.4Q623.4 187.6 660.2 226.0Q697.0 264.3 707.7 312.2Z"/>
19
+ <path d="M758.7 304.2Q764.2 360.0 744.7 411.8Q725.2 463.7 688.4 507.3Q651.7 550.9 598.8 581.0Q545.9 611.1 486.2 632.6Q426.5 654.1 357.2 666.7Q287.8 679.2 218.8 661.6Q149.8 644.0 107.1 598.7Q64.4 553.5 40.5 505.5Q16.6 457.5 -1.6 408.8Q-19.8 360.0 -15.7 307.3Q-11.6 254.5 19.8 206.2Q51.1 157.9 102.5 119.7Q153.9 81.5 222.1 66.7Q290.3 51.9 357.2 64.4Q424.0 77.0 482.9 95.7Q541.8 114.4 603.4 137.4Q665.0 160.4 709.1 204.4Q753.3 248.3 758.7 304.2Z"/>
20
+ </g>
21
+ </svg>
@@ -312,6 +312,29 @@ function tallyText(found) {
312
312
  return parts.join(t("common", "sep"));
313
313
  }
314
314
 
315
+ /** Replace the panel's "By topic" list: each section's correct count, linked to the section. */
316
+ function topicSummary(root, panel, before) {
317
+ panel.querySelector("[data-topic-summary]")?.remove();
318
+ const rows = [...root.querySelectorAll(".practice-section")].map((section) => {
319
+ const graded = [...section.querySelectorAll(".question")].filter(isGradable);
320
+ const row = document.createElement("p");
321
+ const link = document.createElement("a");
322
+ link.href = `#${section.id}`;
323
+ link.textContent = section.querySelector("h2 span:last-child")?.textContent ?? section.id;
324
+ const right = graded.filter((question) => question.dataset.state === "right").length;
325
+ row.append(link, " ", t("worksheet", "topicScore", { right, total: graded.length }));
326
+ return row;
327
+ });
328
+ if (rows.length < 2) return;
329
+ const wrap = document.createElement("div");
330
+ wrap.dataset.topicSummary = "";
331
+ wrap.className = "topic-summary";
332
+ const heading = document.createElement("h3");
333
+ heading.textContent = t("worksheet", "resultsByTopic");
334
+ wrap.append(heading, ...rows);
335
+ before.before(wrap);
336
+ }
337
+
315
338
  /** Fill and show the results panel with every question. */
316
339
  function summarize(root, found, questions) {
317
340
  const panel = root.querySelector("[data-summary]");
@@ -320,6 +343,7 @@ function summarize(root, found, questions) {
320
343
  panel.querySelector("[data-score-of]").textContent = t("worksheet", "scoreOf", { total: found.total });
321
344
  const list = panel.querySelector("[data-summary-list]");
322
345
  list.replaceChildren();
346
+ topicSummary(root, panel, list);
323
347
  for (const question of questions) {
324
348
  const status = isGradable(question) ? (question.dataset.state ?? "unattempted") : "self";
325
349
  const item = document.createElement("li");
@@ -351,6 +375,11 @@ document.addEventListener("click", (event) => {
351
375
  if (checkButton) {
352
376
  const root = rootOf(checkButton);
353
377
  const scope = checkButton.dataset.check;
378
+ const resultsPanel = root.querySelector("[data-summary]");
379
+ if (scope === "#worksheet" && resultsPanel && !resultsPanel.hidden) {
380
+ resultsPanel.hidden = true;
381
+ return;
382
+ }
354
383
  const questions = questionsIn(root, scope);
355
384
  for (const question of questions) {
356
385
  check(question);
@@ -518,6 +547,116 @@ function applyDrop(row, dropped) {
518
547
  return true;
519
548
  }
520
549
 
550
+ /**
551
+ * While the results panel shows, See results reads Hide results and hides it. The panel is watched rather than the click, so Clear my answers and Try missed questions restore the label too.
552
+ * @param {HTMLElement} root a `[data-worksheet]` element
553
+ */
554
+ function initResultsToggle(root) {
555
+ const button = root.querySelector('[data-check="#worksheet"]');
556
+ const panel = root.querySelector("[data-summary]");
557
+ if (!button || !panel) return;
558
+ const showLabel = button.textContent;
559
+ const sync = () => {
560
+ button.textContent = panel.hidden ? showLabel : t("worksheet", "hideResults");
561
+ button.setAttribute("aria-expanded", String(!panel.hidden));
562
+ };
563
+ new MutationObserver(sync).observe(panel, { attributes: true, attributeFilter: ["hidden"] });
564
+ sync();
565
+ }
566
+
567
+ /**
568
+ * A term's definition also opens on hover. Browsers with interest invokers do it natively (the button's `interestfor` and the `interest-delay` in practice-terms.webc). Elsewhere this does the same with a beat before opening, so a pointer sweeping across the bank opens nothing, and a grace before closing, so the pointer can reach the slide link. Only a fine hovering pointer; click, tap, keyboard and Escape keep working through the popover, and a definition opened by click stays until dismissed.
569
+ */
570
+ function initTerms() {
571
+ if (Object.hasOwn(HTMLButtonElement.prototype, "interestForElement")) return;
572
+ const OPEN_DELAY = 400;
573
+ const CLOSE_DELAY = 250;
574
+ const hovering = matchMedia("(hover: hover) and (pointer: fine)");
575
+ document.querySelectorAll("[data-worksheet] .term-bank li").forEach((item, index) => {
576
+ const term = item.querySelector("button.term");
577
+ const definition = item.querySelector("[popover]");
578
+ if (!term || !definition) return;
579
+ // showPopover() has no invoker to anchor to, so the anchor is named.
580
+ term.style.anchorName = `--term-${index}`;
581
+ definition.style.positionAnchor = `--term-${index}`;
582
+ let opening;
583
+ let closing;
584
+ let pinned = false;
585
+ const isOpen = () => definition.matches(":popover-open");
586
+ const arm = () => {
587
+ clearTimeout(closing);
588
+ if (!hovering.matches || isOpen()) return;
589
+ clearTimeout(opening);
590
+ opening = setTimeout(() => definition.showPopover(), OPEN_DELAY);
591
+ };
592
+ const leave = () => {
593
+ clearTimeout(opening);
594
+ if (pinned || !isOpen()) return;
595
+ clearTimeout(closing);
596
+ closing = setTimeout(() => definition.hidePopover(), CLOSE_DELAY);
597
+ };
598
+ term.addEventListener("pointerenter", arm);
599
+ term.addEventListener("pointerleave", leave);
600
+ definition.addEventListener("pointerenter", () => clearTimeout(closing));
601
+ definition.addEventListener("pointerleave", leave);
602
+ // The click's own toggle runs after this handler: an open definition is about to close, a closed one to open.
603
+ term.addEventListener("click", () => {
604
+ clearTimeout(opening);
605
+ pinned = !isOpen();
606
+ });
607
+ definition.addEventListener("toggle", (event) => {
608
+ if (event.newState === "closed") pinned = false;
609
+ });
610
+ });
611
+ }
612
+
613
+ /**
614
+ * Download this page as one self-contained HTML file. The build already inlines the styles, fonts and scripts, so this drops the site chrome and the scripts that load from the site, and makes the remaining links absolute.
615
+ */
616
+ async function downloadPage() {
617
+ const doc = new DOMParser().parseFromString(await (await fetch(location.pathname)).text(), "text/html");
618
+ doc.querySelectorAll("#to-content, body > header, body > footer, script[src]").forEach((element) => element.remove());
619
+ for (const element of doc.querySelectorAll("[href], [src]")) {
620
+ for (const name of ["href", "src"]) {
621
+ const value = element.getAttribute(name);
622
+ if (value && !/^(?:#|[a-z][a-z0-9+.-]*:)/i.test(value)) element.setAttribute(name, new URL(value, location.href).href);
623
+ }
624
+ }
625
+ const link = document.createElement("a");
626
+ link.href = URL.createObjectURL(new Blob([`<!doctype html>\n${doc.documentElement.outerHTML}`], { type: "text/html" }));
627
+ link.download = `${location.pathname.split("/").filter(Boolean).pop()}.html`;
628
+ link.click();
629
+ URL.revokeObjectURL(link.href);
630
+ }
631
+
632
+ /**
633
+ * `?embed` shows the worksheet without the site chrome (the stylesheet hides it) and adds a button that downloads the page as one file for an LMS. The file is made in the browser, so there is no build step.
634
+ */
635
+ function initEmbed() {
636
+ if (!new URLSearchParams(location.search).has("embed")) return;
637
+ document.documentElement.dataset.embed = "";
638
+ const bar = document.createElement("p");
639
+ bar.className = "embed-bar";
640
+ const button = document.createElement("button");
641
+ button.type = "button";
642
+ const label = t("worksheet", "embedDownload");
643
+ button.textContent = label;
644
+ button.addEventListener("click", async () => {
645
+ button.disabled = true;
646
+ button.textContent = t("worksheet", "embedPreparing");
647
+ try {
648
+ await downloadPage();
649
+ button.textContent = label;
650
+ } catch {
651
+ button.textContent = t("worksheet", "embedFailed");
652
+ setTimeout(() => (button.textContent = label), 4000);
653
+ }
654
+ button.disabled = false;
655
+ });
656
+ bar.append(button, ` ${t("worksheet", "embedHint")}`);
657
+ document.querySelector("#main-content")?.prepend(bar);
658
+ }
659
+
521
660
  /** What a kind's script gets to use: the grader's tools and the shared drag and drop. */
522
661
  const helpers = { mark, checkedValue, normalize, markUsedWords, dragDrop };
523
662
 
@@ -538,7 +677,10 @@ function init() {
538
677
  note.hidden = false;
539
678
  }
540
679
  syncNav(root);
680
+ initResultsToggle(root);
541
681
  }
682
+ initTerms();
683
+ initEmbed();
542
684
  }
543
685
 
544
686
  if (document.readyState === "loading" || document.readyState === "interactive") document.addEventListener("DOMContentLoaded", init, { once: true });
@@ -6,12 +6,9 @@
6
6
 
7
7
  /* ---- Typography ---- */
8
8
  --sans-font: "Instrument Sans", "Instrument Sans Fallback", system-ui, "Helvetica Neue", helvetica, arial, sans-serif;
9
- --signature-font: cursive;
10
9
  --dense-font: "Instrument Sans", "Instrument Sans Fallback", system-ui, sans-serif;
11
10
  --mono-font: "PT Mono", monospace;
12
- /* Headings: a book face every system already has (Charter on Mac, iOS and
13
- Linux, Sitka on Windows, Cambria as the fallback), so there is nothing
14
- to download. */
11
+ /* Headings: a system book face, nothing to download. */
15
12
  --display-font: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Iowan Old Style", Georgia, serif;
16
13
 
17
14
  --base-font-size: 14px;
@@ -53,8 +50,6 @@
53
50
  /* ---- Shape ---- */
54
51
  --hairline-border-radius: 0.1em;
55
52
  --standard-border-radius: 0.2em;
56
- --squircle-border-radius: 40px;
57
- --pill-border-radius: 9999px;
58
53
  --circle-border-radius: 50%;
59
54
 
60
55
  --thin-border-width: 1px;
@@ -86,7 +81,7 @@
86
81
  }
87
82
  }
88
83
 
89
- /* ---- Baseline reset (formerly simple.css) ---- */
84
+ /* ---- Baseline reset ---- */
90
85
  :where(*, *::before, *::after) {
91
86
  box-sizing: border-box;
92
87
  }
@@ -101,29 +96,19 @@
101
96
  }
102
97
  }
103
98
 
104
- /* Kept at plain tag specificity, not :where(): `:where(section:last-child)`
105
- below must keep losing to this rule's `margin-block: 0`, exactly as it
106
- already does in production — moving to :where() here would tie their
107
- specificity and let source order (not intent) decide which wins. */
99
+ /* Tag specificity, so `:where(section:last-child)` below keeps losing. */
108
100
  section {
109
101
  border-block: none;
110
102
  padding: 0;
111
103
  margin-block: 0;
112
104
  }
113
105
 
114
- /* Kept as a separate :where()-wrapped rule, not nested as `&:last-child`
115
- inside the block above: nesting a bare pseudo-class after `&` does not
116
- stay at zero specificity the way wrapping the whole compound in :where()
117
- does (`&` expands to `:is(:where(section))`, which is zero, but the
118
- trailing `:last-child` outside that :is() still counts). */
106
+ /* Separate rule: nesting `&:last-child` would add specificity. */
119
107
  :where(section:last-child) {
120
108
  margin-block-end: 80px;
121
109
  }
122
110
 
123
- /* Consolidate box styling; more specific rules below (like
124
- `article.content-column` and base.css's own later `details {}`
125
- on background-color) win by specificity now that this is zero, not just
126
- by coming later in the cascade. */
111
+ /* Shared box styling at zero specificity. */
127
112
  :where(aside, details, pre, progress) {
128
113
  background-color: var(--color-surface-accent);
129
114
  border: var(--border-width) solid var(--color-border);
@@ -339,7 +324,7 @@ a {
339
324
  font-weight: var(--font-weight);
340
325
  color: var(--color-link);
341
326
 
342
- :where(p, li, dd, blockquote, figcaption) &[href]:not(.cta-link, .header-anchor, .listing-item-more) {
327
+ :where(p, li, dd, blockquote, figcaption) &[href]:not(.header-anchor) {
343
328
  text-decoration: underline;
344
329
  text-decoration-color: color-mix(in oklch, currentColor 45%, transparent);
345
330
  text-decoration-thickness: 1px;
@@ -390,8 +375,7 @@ a {
390
375
  }
391
376
  }
392
377
 
393
- :where(p, li, blockquote) a:not(.cta-button, .cta-link, .navigation-link, :has(img, svg)),
394
- .header-summary a:not(.cta-button, .cta-link, .navigation-link, :has(img, svg)) {
378
+ :where(p, li, blockquote) a:not(.cta-button, :has(img, svg)) {
395
379
  text-decoration: underline;
396
380
  text-decoration-color: color-mix(in sRGB, currentColor 45%, transparent);
397
381
  text-underline-offset: .2ex;
@@ -783,23 +767,6 @@ main {
783
767
  }
784
768
  }
785
769
 
786
- .headline {
787
- font-size: max(calc(var(--headline--FontSize, 10px) + 2.5cqi + 1cqb), var(--font-size-5));
788
- font-weight: var(--font-weight);
789
-
790
- text-wrap: balance;
791
-
792
- .band:not(.hero) &:not(.company-name) {
793
- text-decoration: underline;
794
- text-decoration-thickness: calc(var(--border-width) * 4);
795
- text-decoration-color: var(--color-accent);
796
- }
797
-
798
- @media (prefers-color-scheme: dark) {
799
- font-weight: var(--font-weight);
800
- }
801
- }
802
-
803
770
  .lede {
804
771
  text-wrap: balance;
805
772
  font-family: var(--sans-font);
@@ -815,37 +782,12 @@ main {
815
782
  --lede--FontSize: .8em;
816
783
  }
817
784
 
818
- @container box (width <= 500px) {
819
- font-weight: var(--font-weight);
820
- }
821
-
822
785
  &.accent {
823
786
  --lede--FontSize: 1.6em;
824
787
  line-height: var(--font-height--dense);
825
788
  }
826
789
  }
827
790
 
828
- .signature {
829
- font-family: var(--signature-font);
830
- font-size: 1.2em;
831
- font-weight: var(--font-weight--medium);
832
- line-height: var(--font-height--dense);
833
-
834
- :is(b, strong) {
835
- font-weight: var(--font-weight--bold);
836
- }
837
- }
838
-
839
- @container style(--context: brand) {
840
- .signature {
841
- font-size: 2em;
842
- }
843
-
844
- .signature .dash {
845
- color: var(--color-accent);
846
- }
847
- }
848
-
849
791
  .metadata {
850
792
  font-weight: var(--font-weight--light);
851
793
  color: var(--color-text-muted);
@@ -1246,7 +1188,7 @@ body:has(.doc-layout[data-contents="true"], .lesson-layout) {
1246
1188
  background-color: var(--color-surface-subtle);
1247
1189
  }
1248
1190
 
1249
- /* ---- Table baseline (formerly simple.css) ---- */
1191
+ /* ---- Table baseline ---- */
1250
1192
  /* Tables read like a printed table: a heavy rule above and below, a light
1251
1193
  rule under the header and between rows, and no boxes. */
1252
1194
  :where(table) {
@@ -1601,7 +1543,7 @@ blockquote {
1601
1543
  }
1602
1544
  }
1603
1545
 
1604
- /* ---- Misc baseline elements (formerly simple.css) ---- */
1546
+ /* ---- Misc baseline elements ---- */
1605
1547
  :where(p, h1, h2, h3, h4, h5, h6) {
1606
1548
  overflow-wrap: break-word;
1607
1549
  }
@@ -1823,7 +1765,7 @@ blockquote {
1823
1765
  inset-block-start: 0.3em;
1824
1766
  }
1825
1767
 
1826
- /* ---- Form controls (formerly simple.css) ---- */
1768
+ /* ---- Form controls ---- */
1827
1769
  :where(textarea, select, input, button),
1828
1770
  .button {
1829
1771
  font-size: inherit;
@@ -33,18 +33,33 @@
33
33
  border-radius: var(--radius-pill);
34
34
  font-weight: var(--font-weight--semi-bold);
35
35
  cursor: pointer;
36
+
37
+ @media (prefers-reduced-motion: no-preference) {
38
+ transition:
39
+ background-color 150ms ease-out,
40
+ border-color 150ms ease-out;
41
+ }
36
42
  }
37
43
 
38
44
  [data-check] {
39
45
  border: var(--border-width) solid var(--color-accent);
40
46
  background-color: var(--color-accent);
41
47
  color: var(--color-on-accent);
48
+
49
+ &:hover {
50
+ border-color: var(--color-accent-fill-hover);
51
+ background-color: var(--color-accent-fill-hover);
52
+ }
42
53
  }
43
54
 
44
55
  [data-reset] {
45
56
  border: var(--border-width) solid var(--color-border-strong);
46
57
  background-color: transparent;
47
58
  color: var(--color-text);
59
+
60
+ &:hover {
61
+ background-color: var(--color-surface-accent);
62
+ }
48
63
  }
49
64
  }
50
65
  </style>
@@ -12,7 +12,8 @@
12
12
  :@label="`${$data.worksheet.copy.citeLabel} ${q.id}`"></cite-panel>
13
13
  </div>
14
14
 
15
- <pre webc:if="q.code && q.kind !== 'tree'" class="snippet"><code @raw="q.codeHtml"></code></pre>
15
+ <pre webc:if="q.code && q.kind !== 'tree'" class="snippet" tabindex="0" role="region"
16
+ :aria-label="fill($data.worksheet.copy.codeForQuestion, { id: q.id })"><code @raw="q.codeHtml"></code></pre>
16
17
  <practice-figure webc:if="q.figure" :@q="q"></practice-figure>
17
18
 
18
19
  <choice-list webc:if="q.kind === 'choice'" :@choices="q.choices"
@@ -47,25 +48,35 @@
47
48
  color: var(--color-success);
48
49
 
49
50
  &::before {
50
- content: "✓ ";
51
+ content: "✓ " / "";
51
52
  }
52
53
  }
53
54
  }
54
55
 
55
- &:is([data-state="wrong"], [data-state="partial"]) {
56
+ &[data-state="wrong"] {
56
57
  border-inline-start-color: var(--color-error);
57
58
 
58
59
  .feedback {
59
60
  color: var(--color-error);
60
61
 
61
62
  &::before {
62
- content: "✕ ";
63
+ content: "✕ " / "";
63
64
  }
64
65
  }
65
66
  }
66
67
 
68
+ /* Partial: blanks left, nothing wrong. */
67
69
  &[data-state="partial"] {
70
+ border-inline-start-color: var(--color-warning-edge);
68
71
  border-inline-start-style: dashed;
72
+
73
+ .feedback {
74
+ color: var(--color-warning-edge);
75
+
76
+ &::before {
77
+ content: "– " / "";
78
+ }
79
+ }
69
80
  }
70
81
  }
71
82
 
@@ -120,6 +131,14 @@
120
131
  color: var(--color-text);
121
132
  font-weight: var(--font-weight--semi-bold);
122
133
  cursor: pointer;
134
+
135
+ @media (prefers-reduced-motion: no-preference) {
136
+ transition: background-color 150ms ease-out;
137
+ }
138
+
139
+ &:hover {
140
+ background-color: var(--color-surface-accent);
141
+ }
123
142
  }
124
143
 
125
144
  .feedback {
@@ -10,7 +10,7 @@
10
10
  <p class="drag-hint" webc:if="hint" @text="hint"></p>
11
11
  <ul class="term-bank">
12
12
  <li webc:for="entry of terms">
13
- <button type="button" class="term" :popovertarget="entry.id" @text="entry.term"></button>
13
+ <button type="button" class="term" :popovertarget="entry.id" :interestfor="entry.id" @text="entry.term"></button>
14
14
  <div class="term-def" :id="entry.id" popover>
15
15
  <p class="term-name" @text="entry.term"></p>
16
16
  <p @text="entry.definition"></p>
@@ -45,11 +45,18 @@
45
45
  button {
46
46
  background: var(--color-surface);
47
47
  border: var(--thin-border-width) solid transparent;
48
- border-radius: var(--pill-border-radius);
48
+ border-radius: var(--radius-pill);
49
49
  color: inherit;
50
50
  cursor: pointer;
51
51
  font: inherit;
52
52
  padding: 0.25em 0.8em;
53
+ /* Hover opens the definition after a beat, and closes it after a longer one so the pointer can reach its link. */
54
+ interest-delay: 400ms 250ms;
55
+
56
+ /* Touch screens: a term is a full-size tap target. */
57
+ @media (pointer: coarse) {
58
+ min-block-size: var(--target-min);
59
+ }
53
60
 
54
61
  &:is(:hover, :focus-visible) {
55
62
  border-color: var(--color-accent);
@@ -5,7 +5,8 @@
5
5
  */
6
6
  </script>
7
7
  <div class="tree-question">
8
- <pre class="snippet"><code @text="q.code"></code></pre>
8
+ <pre class="snippet" tabindex="0" role="region"
9
+ :aria-label="fill($data.worksheet.copy.codeForQuestion, { id: q.id })"><code @text="q.code"></code></pre>
9
10
  <ul class="dom-tree">
10
11
  <li webc:for="node of q.nodes" :style="`--depth: ${node.depth}`">
11
12
  <span class="node" webc:if="node.label" @text="node.label"></span>
@@ -31,19 +31,6 @@
31
31
  <button type="button" data-retry="#worksheet" hidden @text="$data.worksheet.copy.retryMissed"></button>
32
32
  </section>
33
33
 
34
- <nav class="question-nav" aria-labelledby="question-nav-heading" data-question-nav>
35
- <h2 id="question-nav-heading" @text="$data.worksheet.copy.navHeading"></h2>
36
- <ol role="list">
37
- <template webc:nokeep webc:for="section of $data.worksheet.sections">
38
- <li webc:for="question of section.questions" :data-nav-for="question.id" data-state="unattempted">
39
- <a :href="`#q-${question.id}`">
40
- <span class="nav-badge" @text="question.id"></span>
41
- <span class="nav-status" @text="$data.worksheet.copy.statusUnattempted"></span>
42
- </a>
43
- </li>
44
- </template>
45
- </ol>
46
- </nav>
47
34
  </header>
48
35
 
49
36
  <section webc:for="section of $data.worksheet.sections" :id="`section-${section.n}`" class="practice-section">
@@ -63,6 +50,20 @@
63
50
  :@reset="$data.worksheet.copy.resetSection" :@confirm="$data.worksheet.copy.confirmClearSection"></check-controls>
64
51
  </section>
65
52
 
53
+ <nav class="question-nav" aria-labelledby="question-nav-heading" data-question-nav>
54
+ <h2 id="question-nav-heading" @text="$data.worksheet.copy.navHeading"></h2>
55
+ <ol role="list">
56
+ <template webc:nokeep webc:for="section of $data.worksheet.sections">
57
+ <li webc:for="question of section.questions" :data-nav-for="question.id" data-state="unattempted">
58
+ <a :href="`#q-${question.id}`">
59
+ <span class="nav-badge" @text="question.id"></span>
60
+ <span class="nav-status" @text="$data.worksheet.copy.statusUnattempted"></span>
61
+ </a>
62
+ </li>
63
+ </template>
64
+ </ol>
65
+ </nav>
66
+
66
67
  <footer class="practice-foot" webc:if="$data.worksheet.footer?.length || $data.worksheet.links?.length">
67
68
  <p webc:for="paragraph of $data.worksheet.footer" @text="paragraph"></p>
68
69
  <ul class="foot-links" webc:if="$data.worksheet.links?.length">
@@ -121,7 +122,7 @@
121
122
  margin-block: 0;
122
123
  padding: 0.1em 0.75em;
123
124
  border: var(--thin-border-width) solid var(--color-border);
124
- border-radius: 999px;
125
+ border-radius: var(--radius-pill);
125
126
  color: var(--color-text-muted);
126
127
  font-size: max(var(--base-font-size), 0.875em);
127
128
  }
@@ -174,7 +175,7 @@
174
175
  min-inline-size: 2em;
175
176
  block-size: 2em;
176
177
  padding-inline: 0.3em;
177
- border-radius: 999px;
178
+ border-radius: var(--radius-pill);
178
179
  background: var(--color-surface);
179
180
  font-family: var(--mono-font);
180
181
  font-size: 0.875em;
@@ -194,7 +195,7 @@
194
195
  }
195
196
 
196
197
  .nav-status::before {
197
- content: "✓ ";
198
+ content: "✓ " / "";
198
199
  }
199
200
  }
200
201
 
@@ -206,16 +207,20 @@
206
207
  }
207
208
 
208
209
  .nav-status::before {
209
- content: "✕ ";
210
+ content: "✕ " / "";
210
211
  }
211
212
  }
212
213
 
213
214
  [data-state="partial"] a {
214
- border-color: var(--color-border-strong);
215
+ border-color: var(--color-warning-edge);
215
216
  border-style: dashed;
216
217
 
218
+ .nav-badge {
219
+ background: color-mix(in oklab, var(--color-warning-edge) 14%, var(--color-page));
220
+ }
221
+
217
222
  .nav-status::before {
218
- content: "✕ ";
223
+ content: "– " / "";
219
224
  }
220
225
  }
221
226
 
@@ -228,19 +233,15 @@
228
233
  .practice-summary {
229
234
  .score {
230
235
  display: inline-flex;
231
- flex-direction: column;
232
- align-items: center;
233
- justify-content: center;
234
- inline-size: 5.5rem;
235
- block-size: 5.5rem;
236
- box-sizing: border-box;
236
+ align-items: baseline;
237
+ gap: 0.3em;
237
238
  margin: 0;
238
- border: 0.4rem solid var(--color-accent-secondary);
239
- border-radius: 50%;
240
- line-height: var(--font-height--dense);
239
+ padding: 0.1em 0.8em;
240
+ border: 0.15rem solid var(--color-accent-secondary);
241
+ border-radius: var(--radius-pill);
241
242
 
242
243
  strong {
243
- font-size: var(--font-size-3);
244
+ font-size: inherit;
244
245
  }
245
246
 
246
247
  span {
@@ -250,11 +251,30 @@
250
251
  }
251
252
 
252
253
  h2 {
253
- flex: 1 1 12rem;
254
+ flex: 0 0 auto;
254
255
  margin: 0;
255
256
  font-size: var(--font-size-4);
256
257
  }
257
258
 
259
+ .topic-summary {
260
+ flex-basis: 100%;
261
+
262
+ h3 {
263
+ margin-block: 0 0.25rem;
264
+ font-size: 1rem;
265
+ }
266
+
267
+ p {
268
+ margin-block: 0.1rem;
269
+ font-size: 1rem;
270
+ }
271
+
272
+ a {
273
+ margin-inline-end: 0.5em;
274
+ font-weight: var(--font-weight--semi-bold);
275
+ }
276
+ }
277
+
258
278
  flex-basis: 100%;
259
279
  display: flex;
260
280
 
@@ -264,8 +284,8 @@
264
284
 
265
285
  flex-wrap: wrap;
266
286
  align-items: center;
267
- gap: var(--content-space);
268
- padding: 0.8em 1em;
287
+ gap: 0.6rem 1rem;
288
+ padding: 0.5em 1em 0.7em;
269
289
  border: var(--thin-border-width) solid var(--color-border);
270
290
  border-radius: var(--standard-border-radius);
271
291
  background-color: var(--color-surface);
@@ -306,7 +326,8 @@
306
326
 
307
327
  [data-status="partial"] {
308
328
  border-style: dashed;
309
- border-color: var(--color-border-strong);
329
+ border-color: var(--color-warning-edge);
330
+ color: var(--color-warning-edge);
310
331
  }
311
332
 
312
333
  [data-status="unattempted"] {
@@ -324,6 +345,17 @@
324
345
  color: var(--color-on-accent);
325
346
  font-weight: var(--font-weight--semi-bold);
326
347
  cursor: pointer;
348
+
349
+ @media (prefers-reduced-motion: no-preference) {
350
+ transition:
351
+ background-color 150ms ease-out,
352
+ border-color 150ms ease-out;
353
+ }
354
+
355
+ &:hover {
356
+ border-color: var(--color-accent-fill-hover);
357
+ background-color: var(--color-accent-fill-hover);
358
+ }
327
359
  }
328
360
  }
329
361
 
@@ -336,6 +368,11 @@
336
368
  }
337
369
  }
338
370
 
371
+ /* Reading text is at least 16px: the 14px base is for code and chrome. */
372
+ :is(.drag-hint, .word-bank-label, .answer-key, .nav-badge, .nav-status, .question-nav h2, .not-graded, button.term, .term-def a, th, legend) {
373
+ font-size: max(var(--base-font-size), 1rem);
374
+ }
375
+
339
376
  .practice-foot {
340
377
  border-block-start: var(--thin-border-width) solid var(--color-border);
341
378
  margin-block-start: var(--section-space);
@@ -27,8 +27,10 @@
27
27
  JSON.stringify({ meetings: flatMeetings(weeks), deadlines: courseDeadlines(weeks, schedule, copy) }).replaceAll("<", "\\u003c");
28
28
  /** Every class date in a week, for the progress track. */
29
29
  const datesOf = (week) => (week?.meetings ?? []).map((meeting) => meeting.iso).filter(Boolean).join(" ");
30
+ /** The site's path prefix ("/", or the project-site path): the script's links are built from JSON, which the build does not prefix. */
31
+ const pathPrefix = url("/");
30
32
  </script>
31
- <section webc:root="override" class="course-now screen-only" aria-labelledby="course-now-heading" data-course-now webc:if="(weeks ?? defaultWeeks)?.length" hidden>
33
+ <section webc:root="override" class="course-now screen-only" aria-labelledby="course-now-heading" data-course-now :data-path-prefix="pathPrefix" webc:if="(weeks ?? defaultWeeks)?.length" hidden>
32
34
  <h2 id="course-now-heading" class="sr-only" @text="$data.copy.home.heading"></h2>
33
35
  <div class="now-card on-accent" data-now-card hidden>
34
36
  <p class="label" data-now-label></p>
@@ -76,6 +78,8 @@
76
78
  const { t } = window.ckCopy;
77
79
  const today = campusToday();
78
80
  const { meetings, deadlines } = JSON.parse(root.querySelector("[data-course-now-data]").textContent);
81
+ /** Prefixes a root-relative path (not a protocol-relative one) with the site's path prefix. */
82
+ const withPrefix = (path) => (/^\/(?!\/)/.test(path ?? "") ? root.dataset.pathPrefix + path.slice(1) : path);
79
83
  const DAY_MS = 86_400_000;
80
84
  const day = (iso) => Date.parse(`${iso}T00:00:00Z`);
81
85
  const inDays = (iso) => Math.round((day(iso) - day(today)) / DAY_MS);
@@ -119,7 +123,7 @@
119
123
  soon.textContent = relative;
120
124
  when.append(date, t("common", "sep"), soon);
121
125
  const name = document.createElement(item.href ? "a" : "span");
122
- if (item.href) name.href = item.href;
126
+ if (item.href) name.href = withPrefix(item.href);
123
127
  name.className = "what";
124
128
  name.textContent = item.title;
125
129
  row.append(when, " ", name);
@@ -158,7 +158,7 @@
158
158
  align-items: center;
159
159
  gap: var(--count-gap);
160
160
  padding: 0.3em 0.8em;
161
- border-radius: var(--pill-border-radius);
161
+ border-radius: var(--radius-pill);
162
162
 
163
163
  .t {
164
164
  display: inline-flex;
@@ -1,7 +1,7 @@
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`. A page other pages name as their `eleventyNavigation.parent` is a group: its link, then theirs.
4
+ * The menu is Syllabus, which is the home page, 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
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.
6
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
7
7
  */
@@ -19,7 +19,7 @@
19
19
  const items = eleventyNavigation($data.collections.all);
20
20
  const home = items.find((item) => item.url === "/");
21
21
  const rest = items.filter((item) => item.url !== "/");
22
- return [...(home ? [home] : []), { url: "/#syllabus", title: $data.copy.nav.syllabus }, ...rest.filter((item) => item.menu !== false).map(inMenu)];
22
+ return [{ ...(home ?? { url: "/" }), title: $data.copy.nav.syllabus }, ...rest.filter((item) => item.menu !== false).map(inMenu)];
23
23
  })();
24
24
  /** Every link the menu shows, a group's children included. */
25
25
  const linkCount = navItems.reduce((count, item) => count + 1 + (item.children?.length ?? 0), 0);
@@ -32,8 +32,6 @@
32
32
  links point at the landing page's policy disclosures (each carries a
33
33
  `policy-<key>` id) except where a policy has its own page on this site. */
34
34
  :host {
35
- --context: footer;
36
-
37
35
  text-align: start;
38
36
  display: grid;
39
37
  grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr));
@@ -207,7 +207,7 @@
207
207
  #coursework ~ .course-item .weight {
208
208
  flex: none;
209
209
  padding: 0.1em 0.6em;
210
- border-radius: var(--pill-border-radius);
210
+ border-radius: var(--radius-pill);
211
211
  background-color: var(--color-surface-accent);
212
212
  color: var(--color-accent-text);
213
213
  font-size: var(--font-size-6);
@@ -13,7 +13,7 @@
13
13
  <li webc:for="item of items">
14
14
  <a :href="item.page.url" webc:if="item.page.url" :aria-labelledby="slugify(item.data.name)"></a>
15
15
  <slot :@item="item">
16
- <eyebrow @text="item.data.code"></eyebrow>
16
+ <eyebrow webc:if="item.data.code" @text="item.data.code"></eyebrow>
17
17
  <h3 @text="item.data.name" :id="slugify(item.data.name)"></h3>
18
18
  <p @text="item.data.description" webc:if="item.data.description"></p>
19
19
  </slot>
@@ -38,7 +38,7 @@
38
38
  font-size: 1em;
39
39
  position: relative;
40
40
  background-color: var(--color-surface);
41
- border: var(--thick-border-width) solid transparent;
41
+ border: var(--thin-border-width) solid var(--color-border);
42
42
  border-radius: var(--standard-border-radius);
43
43
  padding-block: calc(var(--content-space) * 1.5);
44
44
  padding-inline: calc(var(--content-space) * 1);
@@ -47,55 +47,33 @@
47
47
  display: block;
48
48
  position: absolute;
49
49
  pointer-events: all;
50
- inset: calc(-1 * var(--thick-border-width));
50
+ inset: calc(-1 * var(--thin-border-width));
51
51
  z-index: 1;
52
+ border-radius: inherit;
52
53
  text-decoration: none;
53
54
  color: inherit;
54
55
  background-color: transparent;
55
56
  border: none;
56
57
  padding: 0;
57
- }
58
58
 
59
- &::before {
60
- content: "";
61
- position: absolute;
62
- inset: calc(-1 * var(--thick-border-width));
63
- border-radius: inherit;
64
- padding: var(--thick-border-width);
65
- background: linear-gradient(to bottom right, var(--gradient-stops));
66
- background-size: 200% 200%;
67
- -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
68
- -webkit-mask-composite: xor;
69
- mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
70
- pointer-events: none;
59
+ &:focus-visible {
60
+ outline: none;
61
+ }
71
62
  }
72
63
 
73
- &:has(a) {
74
- @media (prefers-reduced-motion: reduce) {
75
- &:is(:hover, :focus, :focus-within) {
76
- background-color: color-mix(in sRGB, var(--color-surface-overlay) 90%, transparent);
77
- }
78
-
79
- &:is(:hover,:focus,:focus-within)::before {
80
- background-position: 0% 0%;
81
- }
82
-
83
- }
64
+ &:has(a:hover) {
65
+ border-color: var(--color-accent);
66
+ background-color: color-mix(in sRGB, var(--color-surface-overlay) 92%, transparent);
67
+ }
84
68
 
85
- @media not (prefers-reduced-motion: reduce) {
86
- &:is(:hover,:focus,:focus-within)::before {
87
- animation: gradient-drift 2s ease-in-out infinite alternate;
88
- }
89
- }
69
+ &:has(a:focus-visible) {
70
+ border-color: var(--color-accent);
71
+ outline: var(--focus-ring-width) solid var(--color-focus-ring);
72
+ outline-offset: var(--focus-ring-offset);
90
73
  }
91
74
 
92
75
  @media print {
93
76
  background-color: transparent;
94
- border-color: var(--color-border);
95
-
96
- &::before {
97
- display: none;
98
- }
99
77
  }
100
78
  }
101
79
 
@@ -111,14 +89,4 @@
111
89
  }
112
90
  }
113
91
  }
114
-
115
- @keyframes gradient-drift {
116
- from {
117
- background-position: 0% 0%;
118
- }
119
-
120
- to {
121
- background-position: 100% 100%;
122
- }
123
- }
124
92
  </style>
@@ -25,7 +25,7 @@
25
25
  min-block-size: var(--target-min);
26
26
  padding: 0.6em 1.4em;
27
27
  border: var(--thin-border-width) solid var(--color-border);
28
- border-radius: var(--pill-border-radius);
28
+ border-radius: var(--radius-pill);
29
29
  color: var(--color-text);
30
30
  font-size: 0.8em;
31
31
  font-weight: var(--font-weight--semi-bold);
@@ -34,7 +34,7 @@
34
34
  &:hover,
35
35
  &:focus-visible {
36
36
  border-color: var(--color-accent);
37
- background-color: var(--accent-bg);
37
+ background-color: var(--color-surface-accent);
38
38
  color: var(--color-accent-text);
39
39
  }
40
40
 
@@ -0,0 +1,10 @@
1
+ /** Data for the virtual 404 page, published as `/404.html`: the file most hosts serve for a missing address. */
2
+ export default {
3
+ layout: "base",
4
+ permalink: "/404.html",
5
+ indexed: false,
6
+ eleventyComputed: {
7
+ title: (data) => data.copy.notFound.pageNotFound,
8
+ description: (data) => data.copy.notFound.description,
9
+ },
10
+ };
@@ -0,0 +1,14 @@
1
+ ---
2
+ ---
3
+ <script webc:setup>
4
+ const copy = $data.copy.notFound;
5
+ </script>
6
+ <div class="content-column error-page">
7
+ <header>
8
+ <eyebrow @text="copy.error404"></eyebrow>
9
+ <h1 @text="copy.pageNotFound"></h1>
10
+ <p class="lede" @text="copy.thePageYouRequested"></p>
11
+ </header>
12
+ <p @text="copy.theAddressMayHaveA"></p>
13
+ <nav-links stacked :aria-label="$data.copy.notFound.suggestedPages" :@navigation="eleventyNavigation($data.collections.all).filter((item) => item.url !== '/' && item.menu !== false)"></nav-links>
14
+ </div>
@@ -19,11 +19,31 @@
19
19
  <template webc:nokeep @raw="bundleFile('css', 'content/styles/base.css', $data, 'site')"></template>
20
20
  <style webc:keep @raw="getBundle('css', 'site')"></style>
21
21
  <style webc:keep @raw="getBundle('css')"></style>
22
+ <style>
23
+ /* ?embed: the worksheet alone, with the button that downloads it as one file. */
24
+ :root[data-embed] #to-content,
25
+ :root[data-embed] body > header,
26
+ :root[data-embed] body > footer {
27
+ display: none;
28
+ }
29
+
30
+ .embed-bar {
31
+ margin-block: 0 1rem;
32
+ }
33
+ </style>
22
34
  </head>
23
35
 
24
36
  <body>
37
+ <a href="#main-content" id="to-content" class="sr-only" @text="$data.copy.base.skipToContent"></a>
38
+
39
+ <masthead></masthead>
40
+
25
41
  <main id="main-content" tabindex="-1" @raw="content"></main>
26
42
 
43
+ <footer>
44
+ <site-footer></site-footer>
45
+ </footer>
46
+
27
47
  <script>
28
48
  // Print every disclosure expanded, then restore the reader's own state
29
49
  // (tracked per element — bundle scripts share one module scope).
@@ -45,6 +65,7 @@
45
65
  <script type="application/json" id="copy-data" webc:keep @raw="copyJson($data)"></script>
46
66
  <script webc:keep @raw="copyReader()"></script>
47
67
  <script type="module" webc:keep @raw="getBundle('js')"></script>
68
+ <script type="module" src="/js/email.js" webc:keep></script>
48
69
  <theme-panel webc:if="$data.themePanel" context="site"></theme-panel>
49
70
  <script type="module" src="/js/theme-panel.js" webc:keep webc:if="$data.themePanel"></script>
50
71
  </body>
package/lib/assets.js CHANGED
@@ -26,7 +26,7 @@ const list = (dir) => (fs.existsSync(dir) ? fs.readdirSync(dir).filter((file) =>
26
26
 
27
27
  /**
28
28
  * Publish the package's stylesheets and scripts as virtual templates and its
29
- * fonts as passthrough copies. Files the course repo also has are skipped.
29
+ * fonts and images as passthrough copies. Files the course repo also has are skipped.
30
30
  * @param {import('@11ty/eleventy').UserConfig} config
31
31
  * @param {{ inputDir?: string, exclude?: string[] }} [options] `exclude` lists assets to skip, e.g. ["styles/semantics.css"]
32
32
  */
@@ -39,4 +39,6 @@ export function registerAssets(config, { inputDir = "content", exclude = [] } =
39
39
  }
40
40
  const fonts = list(path.join(root, "fonts")).filter((file) => !fs.existsSync(path.join(inputDir, "fonts", file)));
41
41
  config.addPassthroughCopy(Object.fromEntries(fonts.map((file) => [path.join(root, "fonts", file), `/${config.directoryAssignments.fonts}/${file}`])));
42
+ const images = list(path.join(root, "images")).filter((file) => !fs.existsSync(path.join(inputDir, "assets", "images", file)));
43
+ config.addPassthroughCopy(Object.fromEntries(images.map((file) => [path.join(root, "images", file), `/${config.directoryAssignments.images}/${file}`])));
42
44
  }
package/lib/copy.js CHANGED
@@ -215,6 +215,14 @@ export const COPY_DEFAULTS = {
215
215
  thisDocumentOmitsTheWeekbyweek: "This document omits the week-by-week schedule, which may be adjusted during the term{live}.",
216
216
  theLiveScheduleIsPublished: "; the live schedule is published at {url}",
217
217
  },
218
+ notFound: {
219
+ description: "Error 404: the page you requested has wandered off the map.",
220
+ error404: "Error 404",
221
+ pageNotFound: "Page not found",
222
+ thePageYouRequested: "The page you requested has wandered off the map.",
223
+ theAddressMayHaveA: "The address may have a typo, or the page may have moved. Try one of these instead:",
224
+ suggestedPages: "Suggested pages",
225
+ },
218
226
  worksheet: {
219
227
  notice: "Nothing here is recorded or submitted.",
220
228
  noticeBody: "Your answers are saved in this browser only and go nowhere else. Checking an answer shows you the reasoning and the source it came from.",
@@ -263,6 +271,14 @@ export const COPY_DEFAULTS = {
263
271
  confirmClearSection: "Clear every answer in this section? This can't be undone.",
264
272
  checkOne: "Check answer",
265
273
  restored: "Restored your answers from {when}.",
274
+ hideResults: "Hide results",
275
+ resultsByTopic: "By topic",
276
+ topicScore: "{right} of {total} correct",
277
+ codeForQuestion: "Code for question {id}",
278
+ embedDownload: "Download for your LMS",
279
+ embedHint: "One HTML file: upload it as is.",
280
+ embedPreparing: "Preparing…",
281
+ embedFailed: "Could not prepare the file",
266
282
  },
267
283
  siteFooter: {
268
284
  pages: "Pages",
package/lib/glue.js CHANGED
@@ -4,12 +4,13 @@ import path from "node:path";
4
4
  import deckNotes from "../glue/deck-notes.data.js";
5
5
  import lessonDay from "../glue/lesson-day.data.js";
6
6
  import lessonPlans from "../glue/lesson-plans.data.js";
7
+ import notFound from "../glue/not-found.data.js";
7
8
  import { packageRoot } from "./paths.js";
8
9
 
9
10
  const root = path.join(packageRoot, "glue");
10
11
 
11
12
  /** Data for each glue page, by name. */
12
- const DATA = { "deck-notes": deckNotes, "lesson-day": lessonDay, "lesson-plans": lessonPlans };
13
+ const DATA = { "deck-notes": deckNotes, "lesson-day": lessonDay, "lesson-plans": lessonPlans, "not-found": notFound };
13
14
 
14
15
  /**
15
16
  * Publish glue pages (pagination and permalink templates) as virtual
package/lib/plugin.js CHANGED
@@ -130,7 +130,7 @@ export default function courseKit(config, options = {}) {
130
130
  inputDir,
131
131
  exclude: [...(runtime === "none" || runtime === "pyscript" ? ["styles/semantics.css"] : []), ...(isProduction ? ["scripts/theme-panel.js"] : [])],
132
132
  });
133
- registerGlue(config, { inputDir, pages: { "lesson-day": "lessons/lesson-day.webc", "deck-notes": "lessons/deck-notes.webc", "lesson-plans": "lessons/lesson-plans.webc" } });
133
+ registerGlue(config, { inputDir, pages: { "lesson-day": "lessons/lesson-day.webc", "deck-notes": "lessons/deck-notes.webc", "lesson-plans": "lessons/lesson-plans.webc", "not-found": "utilities/404.webc" } });
134
134
  if (pdf !== false) registerSyllabusPdf(config, { isProduction, outputDir, dataDir, timezone: institution.timezone || "UTC", ...pdf });
135
135
  registerSlideFitCheck(config, { outputDir, decksDir });
136
136
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allons-y/course-kit",
3
- "version": "0.6.0",
3
+ "version": "0.8.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)",