@allons-y/course-kit 0.0.0-stage → 0.1.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.
Files changed (137) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +90 -2
  3. package/assets/fonts/instrument-sans-italic-var.woff2 +0 -0
  4. package/assets/fonts/instrument-sans-var.woff2 +0 -0
  5. package/assets/fonts/pt-mono.woff2 +0 -0
  6. package/assets/scripts/copy.js +99 -0
  7. package/assets/scripts/deck.js +161 -0
  8. package/assets/scripts/email.js +17 -0
  9. package/assets/scripts/practice.js +545 -0
  10. package/assets/scripts/theme-panel.js +647 -0
  11. package/assets/scripts/theme-restore.js +17 -0
  12. package/assets/styles/base.css +2090 -0
  13. package/assets/styles/deck.css +968 -0
  14. package/assets/styles/font.css +36 -0
  15. package/assets/styles/notes.css +137 -0
  16. package/assets/styles/print.css +428 -0
  17. package/assets/styles/semantics.css +101 -0
  18. package/components/practice/check-controls.webc +50 -0
  19. package/components/practice/choice-list.webc +86 -0
  20. package/components/practice/cite-panel.webc +108 -0
  21. package/components/practice/practice-figure.webc +47 -0
  22. package/components/practice/practice-fill.webc +154 -0
  23. package/components/practice/practice-grid.webc +82 -0
  24. package/components/practice/practice-judge.webc +165 -0
  25. package/components/practice/practice-match.webc +178 -0
  26. package/components/practice/practice-question.webc +141 -0
  27. package/components/practice/practice-selfcheck.webc +40 -0
  28. package/components/practice/practice-terms.webc +95 -0
  29. package/components/practice/practice-tree.webc +91 -0
  30. package/components/practice/practice-worksheet.webc +369 -0
  31. package/components/site/copyright.webc +13 -0
  32. package/components/site/course-documents.webc +27 -0
  33. package/components/site/course-now.webc +393 -0
  34. package/components/site/course-summary.webc +136 -0
  35. package/components/site/demo-weeks.webc +91 -0
  36. package/components/site/glossary-entry.webc +31 -0
  37. package/components/site/glossary-panel.webc +1482 -0
  38. package/components/site/glossary.webc +45 -0
  39. package/components/site/grading.webc +50 -0
  40. package/components/site/instructor.webc +269 -0
  41. package/components/site/masthead.webc +147 -0
  42. package/components/site/nav-links.webc +174 -0
  43. package/components/site/policies.webc +17 -0
  44. package/components/site/practice-index.webc +31 -0
  45. package/components/site/schedule-overview.webc +145 -0
  46. package/components/site/schedule-weeks.webc +589 -0
  47. package/components/site/site-footer.webc +119 -0
  48. package/components/site/slide-timetable.webc +152 -0
  49. package/components/site/syllabus.webc +217 -0
  50. package/components/ui/arrow-link.webc +19 -0
  51. package/components/ui/assigned-list.webc +101 -0
  52. package/components/ui/callout.webc +11 -0
  53. package/components/ui/card-list.webc +124 -0
  54. package/components/ui/codepen-embed.webc +123 -0
  55. package/components/ui/download-button.webc +49 -0
  56. package/components/ui/eyebrow.webc +18 -0
  57. package/components/ui/icons/github.webc +6 -0
  58. package/components/ui/icons/google.webc +9 -0
  59. package/components/ui/link-list.webc +130 -0
  60. package/components/ui/link-section.webc +40 -0
  61. package/components/ui/meeting-card.webc +73 -0
  62. package/components/ui/meeting-decks.webc +38 -0
  63. package/components/ui/table-rubric.webc +251 -0
  64. package/components/ui/today-link.webc +43 -0
  65. package/components/ui/today-marker.webc +149 -0
  66. package/components/ui/week-block.webc +53 -0
  67. package/examples/starter/_data/course.json +20 -0
  68. package/examples/starter/_data/dates.json +16 -0
  69. package/examples/starter/_data/grading.json +6 -0
  70. package/examples/starter/_data/instructor.json +7 -0
  71. package/examples/starter/_data/policies.json +9 -0
  72. package/examples/starter/_data/scale.json +8 -0
  73. package/examples/starter/_data/schedule.json +22 -0
  74. package/examples/starter/_data/theme.json +17 -0
  75. package/examples/starter/content/index.webc +12 -0
  76. package/examples/starter/content/schedule.webc +12 -0
  77. package/examples/starter/content/slides/index.11tydata.js +5 -0
  78. package/examples/starter/content/slides/index.webc +12 -0
  79. package/examples/starter/content/slides/week-1-day-1.md +40 -0
  80. package/examples/starter/eleventy.config.js +8 -0
  81. package/glue/deck-notes.data.js +41 -0
  82. package/glue/deck-notes.webc +32 -0
  83. package/glue/lesson-day.data.js +17 -0
  84. package/glue/lesson-day.webc +0 -0
  85. package/glue/lesson-plans.data.js +13 -0
  86. package/glue/lesson-plans.webc +2 -0
  87. package/index.js +6 -0
  88. package/layouts/base.webc +79 -0
  89. package/layouts/deck.webc +46 -0
  90. package/layouts/demo.webc +16 -0
  91. package/layouts/document.webc +10 -0
  92. package/layouts/lesson-detail.webc +109 -0
  93. package/layouts/lesson.webc +71 -0
  94. package/layouts/notes.webc +23 -0
  95. package/layouts/worksheet.webc +52 -0
  96. package/lib/assets.js +42 -0
  97. package/lib/bundles.js +79 -0
  98. package/lib/check.js +110 -0
  99. package/lib/components.js +19 -0
  100. package/lib/copy.js +653 -0
  101. package/lib/data/build.js +22 -0
  102. package/lib/data/fonts.js +16 -0
  103. package/lib/data/glossary.js +304 -0
  104. package/lib/data/index.js +8 -0
  105. package/lib/data/lessons.js +173 -0
  106. package/lib/data/project.js +22 -0
  107. package/lib/data/read.js +46 -0
  108. package/lib/data/site.js +70 -0
  109. package/lib/data/term.js +80 -0
  110. package/lib/extensions.js +70 -0
  111. package/lib/files.js +14 -0
  112. package/lib/filters.js +584 -0
  113. package/lib/fit.js +106 -0
  114. package/lib/glue.js +26 -0
  115. package/lib/lesson-materials.js +66 -0
  116. package/lib/markdown.js +568 -0
  117. package/lib/minify.js +53 -0
  118. package/lib/paths.js +5 -0
  119. package/lib/pdf.js +134 -0
  120. package/lib/plugin.js +228 -0
  121. package/lib/plugins.js +34 -0
  122. package/lib/postcss.js +93 -0
  123. package/lib/theme-server.js +88 -0
  124. package/lib/theme.js +185 -0
  125. package/lib/worksheet-dialect.js +415 -0
  126. package/lib/worksheets.js +276 -0
  127. package/package.json +118 -4
  128. package/schemas/course.schema.json +156 -0
  129. package/schemas/dates.schema.json +165 -0
  130. package/schemas/grading.schema.json +59 -0
  131. package/schemas/instructor.schema.json +68 -0
  132. package/schemas/policies.schema.json +90 -0
  133. package/schemas/project.schema.json +209 -0
  134. package/schemas/scale.schema.json +68 -0
  135. package/schemas/schedule.schema.json +260 -0
  136. package/schemas/theme.schema.json +704 -0
  137. package/schemas/worksheet.schema.json +449 -0
@@ -0,0 +1,40 @@
1
+ ---
2
+ title: Welcome to the course
3
+ week: 1
4
+ day: 1
5
+ ---
6
+
7
+ >>> slide title
8
+ ::: eyebrow
9
+ - Example College
10
+ - Fall 2026
11
+ :::
12
+
13
+ # CS 101<br>Introduction to Web Publishing
14
+
15
+ > Tuesday, August 25
16
+
17
+ **Nothing is due today.**
18
+
19
+ ::: notes Welcome (0:00–0:05)
20
+ - Say hello and put your name and email on the board.
21
+ :::
22
+
23
+ >>>
24
+ >>> slide
25
+
26
+ ::: eyebrow
27
+ What we will do
28
+ :::
29
+
30
+ ## Read, write, publish
31
+
32
+ - Write pages in HTML.
33
+ - Style them with CSS.
34
+ - Put them online.
35
+
36
+ ::: notes Overview (0:05–0:20)
37
+ - Walk through the syllabus and the schedule page.
38
+ :::
39
+
40
+ >>>
@@ -0,0 +1,8 @@
1
+ import courseKit from "@allons-y/course-kit";
2
+
3
+ /** @param {import('@11ty/eleventy').UserConfig} config */
4
+ export default async function (config) {
5
+ courseKit(config, {
6
+ institution: { name: "Example College", timezone: "America/New_York" },
7
+ });
8
+ }
@@ -0,0 +1,41 @@
1
+ import { fill } from "../lib/copy.js";
2
+ import { deckNotesUrl } from "../lib/filters.js";
3
+ import { deckNotes } from "../lib/markdown.js";
4
+
5
+ /**
6
+ * The deck behind a notes sheet, or null while Eleventy scans for dependencies.
7
+ * @param {object} data
8
+ */
9
+ const deckOf = (data) => {
10
+ const deck = data.notesDeck;
11
+ return deck && typeof deck === "object" && typeof deck.data?.week === "number" ? deck : null;
12
+ };
13
+
14
+ /** Data for the virtual speaker-notes page: one sheet per deck. */
15
+ export default {
16
+ layout: "notes",
17
+ indexed: false,
18
+ instructorOnly: true,
19
+ eleventyExcludeFromCollections: true,
20
+ // Only real decks: a page in the deck folder with no week and day (the slides index) gets no sheet.
21
+ pagination: { data: "collections.deck", size: 1, alias: "notesDeck", before: (decks) => decks.filter((deck) => typeof deck.data?.week === "number") },
22
+ eleventyComputed: {
23
+ // Beside the meeting's lesson plan: /lessons/week-N/day-N/notes/, and /addendum/ after it for an addendum.
24
+ permalink: (data) => {
25
+ const deck = deckOf(data);
26
+ return deck ? deckNotesUrl(deck.data.week, deck.data.day, deck.data.addendum === true) : data.permalink;
27
+ },
28
+ title: (data) => (deckOf(data) ? fill(data.copy.deckNotes.speakerNotesTitle, { title: deckOf(data).data.title }) : data.copy.deckNotes.speakerNotes),
29
+ // One entry per slide, numbered to match the deck's `#sN`.
30
+ notesSlides: (data) => {
31
+ const deck = deckOf(data);
32
+ return deck && typeof deck.rawInput === "string" ? deckNotes(deck.rawInput, deck.inputPath) : [];
33
+ },
34
+ // The meeting the deck is taught in, for the date line.
35
+ notesLesson: (data) => {
36
+ const deck = deckOf(data);
37
+ if (!deck || !Array.isArray(data.lessons)) return null;
38
+ return data.lessons.find((lesson) => lesson.week === deck.data.week && lesson.day === deck.data.day) ?? null;
39
+ },
40
+ },
41
+ };
@@ -0,0 +1,32 @@
1
+ <script webc:setup>
2
+ const copy = $data.copy.deckNotes;
3
+ </script>
4
+ <article class="notes-sheet">
5
+ <header>
6
+ <p class="meta">
7
+ <span @text="$data.course.code"></span> ·
8
+ <span @text="fill(copy.weekDay, { week: $data.notesDeck.data.week, day: $data.notesDeck.data.day })"></span><template webc:nokeep webc:if="$data.notesLesson?.display"> · <span @text="$data.notesLesson.display"></span></template>
9
+ </p>
10
+ <h1 @text="$data.notesDeck.data.title"></h1>
11
+ <p @text="copy.speakerNotesInstructorOnly"></p>
12
+ </header>
13
+
14
+ <ol class="notes-sheet-slides" role="list">
15
+ <li webc:for="slide of $data.notesSlides" :class="slide.notes.length ? '' : 'no-notes'">
16
+ <a class="slide-number" :href="`${$data.notesDeck.url}#s${slide.number}`" :aria-label="fill(copy.slideOpenInThe, { number: slide.number })" @text="slide.number"></a>
17
+ <div class="slide-notes">
18
+ <p class="slide-title">
19
+ <span @html="slide.title || copy.untitledSlide"></span>
20
+ <span webc:if="slide.kind" @text="`(${slide.kind})`"></span>
21
+ </p>
22
+ <template webc:nokeep webc:for="note of slide.notes">
23
+ <p class="notes-label" webc:if="note.label || note.timing">
24
+ <span @text="note.label"></span>
25
+ <span class="timing" webc:if="note.timing" @text="note.timing"></span>
26
+ </p>
27
+ <div class="notes-body" @html="note.html"></div>
28
+ </template>
29
+ </div>
30
+ </li>
31
+ </ol>
32
+ </article>
@@ -0,0 +1,17 @@
1
+ import { fill } from "../lib/copy.js";
2
+ import { lessonDecks, lessonMaterials } from "../lib/lesson-materials.js";
3
+
4
+ /** Data for the virtual lesson-day page: one page per entry in `lessons`. */
5
+ export default {
6
+ layout: "lesson-detail",
7
+ indexed: false,
8
+ instructorOnly: true,
9
+ eleventyExcludeFromCollections: true,
10
+ pagination: { data: "lessons", size: 1, alias: "lesson" },
11
+ eleventyComputed: {
12
+ permalink: (data) => `/lessons/week-${data.lesson.week}/day-${data.lesson.day}/`,
13
+ title: (data) => fill(data.copy.lessonDay.weekDayLesson, { week: data.lesson.week, day: data.lesson.day }),
14
+ lessonDecks,
15
+ lessonMaterials,
16
+ },
17
+ };
File without changes
@@ -0,0 +1,13 @@
1
+ /** Data for the virtual lesson-plans index page: every meeting's plan, for the instructor. */
2
+ export default {
3
+ layout: "lesson",
4
+ permalink: "/lessons/index.html",
5
+ indexed: false,
6
+ instructorOnly: true,
7
+ tags: ["lesson-plans"],
8
+ eleventyComputed: {
9
+ title: (data) => data.copy.lessonPlans.lessonPlans,
10
+ // Instructor-only: in the footer, never the top menu.
11
+ eleventyNavigation: (data) => ({ title: data.copy.lessonPlans.navTitle, order: 9, menu: false }),
12
+ },
13
+ };
@@ -0,0 +1,2 @@
1
+ ---
2
+ ---
package/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export { default } from "./lib/plugin.js";
2
+ export { CLIENT_COPY, COPY_DEFAULTS, fill, plural, resolveCopy } from "./lib/copy.js";
3
+ export { componentFiles } from "./lib/components.js";
4
+ export { assetPath, registerAssets } from "./lib/assets.js";
5
+ export { registerGlue } from "./lib/glue.js";
6
+ export { minifyInline } from "./lib/minify.js";
@@ -0,0 +1,79 @@
1
+ <!DOCTYPE html>
2
+ <html :lang="site.language ?? 'en-US'" :data-timezone="site.timezone">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+
8
+ <meta name="color-scheme" :content="$data.colorScheme ?? 'light dark'">
9
+
10
+ <title @text="(page?.url == '/' ? [site?.title, $data.title] : [$data.title, site.title]).filter(Boolean).join(' | ')"></title>
11
+ <meta name="description" :content="$data.description ?? site?.description">
12
+ <meta name="keywords" :content="$data.keywords ?? site?.keywords">
13
+ <meta name="author" :content="site?.author">
14
+ <meta name="generator" :content="eleventy?.generator">
15
+
16
+ <meta name="robots" content="noindex, nofollow" webc:if="indexed == false || draft == true || instructorOnly == true || $data.site.preview">
17
+
18
+ <meta property="og:locale" :content="site.language">
19
+ <meta property="og:title" :content="$data.title ?? site.title">
20
+ <meta property="og:url" :content="`${site.url}${page?.url ?? '/'}`">
21
+ <meta property="og:description" :content="$data.description ?? site.description">
22
+ <meta property="og:site_name" :content="site.title">
23
+ <meta name="fediverse:creator" content="@castastrophe@front-end.social">
24
+ <meta property="og:type" content="website">
25
+
26
+ <link rel="icon" href="/favicon.svg" type="image/svg+xml">
27
+
28
+ <link rel="preload" href="/fonts/instrument-sans-var.woff2" as="font" type="font/woff2" crossorigin>
29
+
30
+ <link rel="stylesheet" webc:keep href="/styles/prism-light.css" media="(prefers-color-scheme: light)" data-prism-theme="light">
31
+ <link rel="stylesheet" webc:keep href="/styles/prism-dark.css" media="(prefers-color-scheme: dark)" data-prism-theme="dark">
32
+
33
+
34
+ <link rel="stylesheet" webc:keep href="/styles/base.css">
35
+ <link rel="stylesheet" media="print" webc:keep webc:if="$data.printStylesheet" :href="$data.printStylesheet">
36
+ <link rel="stylesheet" webc:keep webc:if="$data.pyscript" href="/pyscript/core.css">
37
+ <script type="module" webc:keep webc:if="$data.pyscript" src="/pyscript/core.js"></script>
38
+ <style webc:keep @raw="getBundle('css')"></style>
39
+ </head>
40
+
41
+ <body>
42
+ <a href="#main-content" id="to-content" class="sr-only" @text="$data.copy.base.skipToContent"></a>
43
+
44
+ <masthead></masthead>
45
+
46
+ <main id="main-content" tabindex="-1" @raw="content"></main>
47
+
48
+ <footer>
49
+ <site-footer></site-footer>
50
+
51
+ <script>
52
+ // Print every disclosure expanded, then restore the reader's own
53
+ // state (tracked per element — bundle scripts share one module
54
+ // scope, so no top-level variables).
55
+ window.addEventListener("beforeprint", () => {
56
+ for (const details of document.querySelectorAll("details:not([open])")) {
57
+ details.open = true;
58
+ details.dataset.printOpened = "";
59
+ }
60
+ });
61
+ window.addEventListener("afterprint", () => {
62
+ for (const details of document.querySelectorAll("details[data-print-opened]")) {
63
+ details.open = false;
64
+ delete details.dataset.printOpened;
65
+ }
66
+ });
67
+ </script>
68
+
69
+ <script type="application/json" id="copy-data" webc:keep @raw="copyJson($data)"></script>
70
+ <script webc:keep @raw="copyReader()"></script>
71
+ <script type="module" webc:keep @raw="getBundle('js')"></script>
72
+ </footer>
73
+ <script type="module" src="/js/email.js" webc:keep></script>
74
+ <script type="module" src="/js/copy.js" webc:keep></script>
75
+ <theme-panel webc:if="$data.themePanel" context="site"></theme-panel>
76
+ <script type="module" src="/js/theme-panel.js" webc:keep webc:if="$data.themePanel"></script>
77
+ </body>
78
+
79
+ </html>
@@ -0,0 +1,46 @@
1
+ <!DOCTYPE html>
2
+ <html :lang="site.language ?? 'en-US'" :data-timezone="site.timezone">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <meta name="color-scheme" content="light dark">
8
+
9
+ <title @text="[$data.title, site.title].filter(Boolean).join(' | ')"></title>
10
+ <meta name="robots" content="noindex, nofollow">
11
+
12
+ <link rel="icon" href="/favicon.svg" type="image/svg+xml">
13
+
14
+ <template webc:nokeep @raw="bundleFile('js', 'content/scripts/theme-restore.js', $data, 'head')"></template>
15
+ <script webc:keep @raw="getBundle('js', 'head')"></script>
16
+
17
+ <template webc:nokeep @raw="bundleFile('css', 'content/styles/deck.css', $data)"></template>
18
+ <style webc:keep @raw="getBundle('css')"></style>
19
+ </head>
20
+
21
+ <body>
22
+ <a class="skip" href="#s1" @text="$data.copy.deck.skipToFirstSlide"></a>
23
+ <div class="topbar" role="presentation"></div>
24
+
25
+ <main class="deck" tabindex="0" :aria-label="$data.copy.deck.slides">
26
+ <template webc:nokeep @raw="content"></template>
27
+ </main>
28
+
29
+ <div class="hud">
30
+ <button type="button" data-prev :aria-label="$data.copy.deck.previousSlide">&larr;</button>
31
+ <span data-count aria-live="polite">1 / 1</span>
32
+ <button type="button" data-next :aria-label="$data.copy.deck.nextSlide">&rarr;</button>
33
+ <button type="button" data-toggle-theme :aria-label="$data.copy.deck.cycleColorTheme">&#9681;</button>
34
+ <button type="button" data-toggle-fullscreen aria-pressed="false" :aria-label="$data.copy.deck.toggleFullscreen" hidden>&#x26F6;</button>
35
+ </div>
36
+
37
+ <script type="application/json" id="copy-data" webc:keep @raw="copyJson($data)"></script>
38
+ <script webc:keep @raw="copyReader()"></script>
39
+ <template webc:nokeep @raw="bundleFile('js', 'content/scripts/deck.js', $data)"></template>
40
+ <script type="module" webc:keep @raw="getBundle('js')"></script>
41
+
42
+ <theme-panel webc:if="$data.themePanel" context="deck"></theme-panel>
43
+ <script type="module" src="/js/theme-panel.js" webc:keep webc:if="$data.themePanel"></script>
44
+ </body>
45
+
46
+ </html>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html :lang="site.language ?? 'en-US'">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="robots" content="noindex, nofollow">
7
+ <title @text="$data.title"></title>
8
+
9
+ <template webc:nokeep webc:if="$data.stylesheet" @raw="bundleFile('css', `content${$data.stylesheet}`, $data)"></template>
10
+ <style webc:keep @raw="getBundle('css')"></style>
11
+ <script type="module" webc:keep @raw="getBundle('js')"></script>
12
+ </head>
13
+
14
+ <body @raw="content"></body>
15
+
16
+ </html>
@@ -0,0 +1,10 @@
1
+ ---
2
+ layout: "base"
3
+ ---
4
+ <div class="doc-layout" :data-contents="toc(content) ? 'true' : 'false'">
5
+ <div class="doc-contents" webc:if="toc(content)">
6
+ <p class="rail-label" id="doc-contents-label" @text="$data.copy.document.contents"></p>
7
+ <template webc:nokeep @raw="toc(content).replaceAll('&quot;># ', '&quot;>').replace('<nav ', '<nav aria-labelledby=&quot;doc-contents-label&quot; ')"></template>
8
+ </div>
9
+ <article class="content-column" @raw="content"></article>
10
+ </div>
@@ -0,0 +1,109 @@
1
+ ---
2
+ layout: "base"
3
+ ---
4
+ <script webc:setup>
5
+ const copy = $data.copy.lessonDetail;
6
+ const code = (text) => `<code>${String(text).replace(/&/g, "&amp;").replace(/</g, "&lt;")}</code>`;
7
+ const strong = (text) => `<strong>${String(text).replace(/&/g, "&amp;").replace(/</g, "&lt;")}</strong>`;
8
+ </script>
9
+
10
+ <div class="lesson-layout">
11
+ <nav class="lesson-outline" aria-labelledby="lesson-outline-heading">
12
+ <p class="rail-label" id="lesson-outline-heading" @text="fill(copy.week, { week: $data.lesson.week })"></p>
13
+ <ol role="list">
14
+ <li webc:for="day of ($data.lessons ?? []).filter((item) => item.week === $data.lesson.week)">
15
+ <a :href="`/lessons/week-${day.week}/day-${day.day}/`" @attributes="({ 'aria-current': day.day === $data.lesson.day ? 'page' : undefined })">
16
+ <span @text="day.display"></span>
17
+ <span class="muted" webc:if="day.noClass" @text="copy.noClass"></span>
18
+ </a>
19
+ </li>
20
+ </ol>
21
+ </nav>
22
+ <article class="lesson-plan content-column">
23
+ <header class="stacked">
24
+ <nav class="lesson-nav" :aria-label="copy.lessonNavigation">
25
+ <a href="/lessons/" @text="copy.allLessons"></a>
26
+ <a :href="$data.pagination.href.previous" webc:if="$data.pagination.href.previous" @text="copy.previousDay"></a>
27
+ <a :href="$data.pagination.href.next" webc:if="$data.pagination.href.next" @text="copy.nextDay"></a>
28
+ </nav>
29
+ <eyebrow @text="$data.title"></eyebrow>
30
+ <h1 class="lesson-heading" @text="fill(copy.weekDay, { week: $data.lesson.week, day: $data.lesson.day })"></h1>
31
+ <p class="lesson-when separators">
32
+ <span @text="$data.lesson.display"></span>
33
+ <span @text="timeOfDay($data.lesson.time)"></span>
34
+ <span webc:if="$data.lesson.meeting" @text="fill(copy.classMeetingOfThe, { meeting: $data.lesson.meeting })"></span>
35
+ </p>
36
+ </header>
37
+
38
+ <callout webc:if="$data.lesson.noClass">
39
+ <p @text="fill(copy.noClassOn, { reason: $data.lesson.noClass })"></p>
40
+ </callout>
41
+
42
+ <template webc:nokeep webc:if="!$data.lesson.noClass">
43
+ <p class="focus"><strong @text="copy.focus"></strong> <span @text="$data.lesson.focus"></span></p>
44
+ <callout :type="'warn'" webc:if="$data.lesson.substitution">
45
+ <p @raw="fill(copy.thisMeetingRunsA, { weekday: strong($data.lesson.substitution) })"></p>
46
+ </callout>
47
+ <callout :type="'warn'" webc:if="$data.lesson.testWeek">
48
+ <p @text="copy.aTestIsScheduledThis"></p>
49
+ </callout>
50
+
51
+ <section aria-labelledby="topics-heading">
52
+ <h2 id="topics-heading" @text="copy.thisWeeksTopics"></h2>
53
+ <ul>
54
+ <li webc:for="topic of $data.lesson.topics" @raw="topic"></li>
55
+ </ul>
56
+ </section>
57
+
58
+ <section aria-labelledby="before-heading">
59
+ <h2 id="before-heading" @text="copy.beforeClass"></h2>
60
+ <ul class="checklist" role="list">
61
+ <li webc:if="$data.lesson.readings?.length || $data.lesson.meetingReadings?.length" @text="copy.reviewTheReadingsSee"></li>
62
+ <li @text="copy.prepareupdateSlidesAndLivedemo"></li>
63
+ <li webc:for="deck of $data.lessonDecks" @raw="fill(copy.printOrOpenThe, { link: `<a href='${deck.notesUrl}'>${copy.speakerNotesSheet}</a>` })"></li>
64
+ <li @text="copy.stageStarterFilesOr"></li>
65
+ <li @text="fill(copy.checkForStudentQuestions, { lms: $data.site.lms })"></li>
66
+ </ul>
67
+ </section>
68
+
69
+ <section aria-labelledby="outline-heading">
70
+ <h2 id="outline-heading" @text="fill(copy.lessonOutlineMinutes, { minutes: $data.lesson.minutes })"></h2>
71
+ <table>
72
+ <thead>
73
+ <tr><th scope="col" @text="copy.time"></th><th scope="col" @text="copy.segment"></th></tr>
74
+ </thead>
75
+ <tbody>
76
+ <tr webc:for="row of $data.lesson.outline">
77
+ <td @text="fill(copy.min, { minutes: row.minutes })"></td>
78
+ <td @text="row.segment"></td>
79
+ </tr>
80
+ </tbody>
81
+ </table>
82
+ </section>
83
+
84
+ <section aria-labelledby="after-heading">
85
+ <h2 id="after-heading" @text="copy.afterClass"></h2>
86
+ <ul class="checklist" role="list">
87
+ <li @raw="fill(copy.postHandoutsToAnd, { resources: code('content/resources/'), schedule: code('_data/schedule.json'), list: code('resources[]'), slides: code('content/slides/') })"></li>
88
+ <li @text="copy.noteAnythingNotCovered"></li>
89
+ <li @text="fill(copy.postOrGradeLabhomework, { lms: $data.site.lms })"></li>
90
+ </ul>
91
+ </section>
92
+ </template>
93
+ </article>
94
+ <aside class="lesson-rail" :aria-label="copy.lessonTools" webc:if="!$data.lesson.noClass">
95
+ <nav aria-labelledby="on-this-page-heading">
96
+ <p class="rail-label" id="on-this-page-heading" @text="copy.onThisPage"></p>
97
+ <ul role="list">
98
+ <li><a href="#topics-heading" @text="copy.thisWeeksTopics"></a></li>
99
+ <li><a href="#before-heading" @text="copy.beforeClass"></a></li>
100
+ <li><a href="#outline-heading" @text="copy.lessonOutline"></a></li>
101
+ <li><a href="#after-heading" @text="copy.afterClass"></a></li>
102
+ </ul>
103
+ </nav>
104
+ <section aria-labelledby="materials-heading">
105
+ <h2 class="rail-label" id="materials-heading" @text="copy.materialsLinks"></h2>
106
+ <link-section webc:for="section of $data.lessonMaterials" :@title="section.title" :@items="section.items" :@empty="section.empty"></link-section>
107
+ </section>
108
+ </aside>
109
+ </div>
@@ -0,0 +1,71 @@
1
+ ---
2
+ layout: "base"
3
+ ---
4
+ <script webc:setup>
5
+ const copy = $data.copy.lesson;
6
+ const link = (href, text) => `<a href="${href}">${text}</a>`;
7
+ </script>
8
+
9
+ <section class="lesson-list content-column wide">
10
+ <eyebrow class="separators">
11
+ <span @text="$data.term.label"></span>
12
+ <span @text="$data.code"></span>
13
+ </eyebrow>
14
+ <h1 @text="copy.lessonPlans"></h1>
15
+ <p @text="fill(copy.onePlanPerClass, { time: timeOfDay($data.schedule?.meetings?.time) })"></p>
16
+ <p webc:if="$data.collections.deck?.length" @raw="fill(copy.everyDeckInMeeting, { link: link('/slides/', copy.slideIndex) })"></p>
17
+
18
+ <p webc:if="$data.collections.assignment?.length" @raw="fill(copy.theBriefAndStarter, { link: link('/assignment/', copy.exercises) })"></p>
19
+
20
+ <table class="table-light" webc:if="$data.term.instructorDates?.length">
21
+ <thead>
22
+ <tr>
23
+ <th scope="col" @text="copy.instructorDeadlines"></th>
24
+ <th scope="col" @text="copy.dueDate"></th>
25
+ </tr>
26
+ </thead>
27
+ <tr webc:for="item of $data.term.instructorDates">
28
+ <td @text="item.label"></td>
29
+ <td @text="item.display"></td>
30
+ </tr>
31
+ </table>
32
+
33
+ <table>
34
+ <caption class="sr-only" @text="copy.everyClassMeetingOf"></caption>
35
+ <thead>
36
+ <tr>
37
+ <th scope="col" @text="copy.date"></th>
38
+ <th scope="col" @text="copy.links"></th>
39
+ <th scope="col" @text="copy.topics"></th>
40
+ </tr>
41
+ </thead>
42
+ <tbody>
43
+ <tr webc:for="lesson of $data.lessons" :data-date="lesson.date">
44
+ <td>
45
+ <span @text="lesson.display"></span>
46
+ <span class="muted" webc:if="lesson.substitution"><br/><span @text="fill(copy.runsASchedule, { weekday: lesson.substitution })"></span></span>
47
+ </td>
48
+ <td webc:if="lesson.noClass" colspan="2" class="muted no-class" @text="fill(copy.noClass, { reason: lesson.noClass })"></td>
49
+ <template webc:else webc:nokeep>
50
+ <td>
51
+ <a :href="`/lessons/week-${lesson.week}/day-${lesson.day}/`" @text="copy.lessonPlan"></a>
52
+ <span webc:nokeep webc:for="deck of ($data.collections.deck ?? []).filter((d) => d.data.week === lesson.week && d.data.day === lesson.day)">
53
+ <br/><a :href="deck.url" @text="deck.data.addendum ? copy.addendum : copy.slides"></a>
54
+ <br/><a :href="deckNotesUrl(deck.data.week, deck.data.day, deck.data.addendum === true)" @text="deck.data.addendum ? copy.addendumNotes : copy.notes"></a>
55
+ </span>
56
+ <span webc:nokeep webc:for="assignment of assignmentsDue($data.collections.assignment, lesson, $data.lessons)">
57
+ <br/><span @text="copy.due"></span> <a :href="assignment.url" @text="assignment.title"></a> (<span @text="assignment.dueLabel"></span>)
58
+ </span>
59
+ </td>
60
+ <td>
61
+ <span webc:for="(topic, index) of lesson.topics" webc:nokeep>
62
+ <span @raw="topic"></span><br/>
63
+ </span>
64
+ </td>
65
+ </template>
66
+ </tr>
67
+ </tbody>
68
+ </table>
69
+ </section>
70
+
71
+ <today-marker></today-marker>
@@ -0,0 +1,23 @@
1
+ <!DOCTYPE html>
2
+ <html :lang="site.language ?? 'en-US'" :data-timezone="site.timezone">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <meta name="color-scheme" content="light">
8
+
9
+ <title @text="[$data.title, site.title].filter(Boolean).join(' | ')"></title>
10
+ <meta name="robots" content="noindex, nofollow">
11
+
12
+ <link rel="icon" href="/favicon.svg" type="image/svg+xml">
13
+ <link rel="stylesheet" webc:keep href="/styles/font.css">
14
+ <link rel="stylesheet" webc:keep href="/styles/notes.css">
15
+ </head>
16
+
17
+ <body>
18
+ <main>
19
+ <template webc:nokeep @raw="content"></template>
20
+ </main>
21
+ </body>
22
+
23
+ </html>
@@ -0,0 +1,52 @@
1
+ <!DOCTYPE html>
2
+ <html :lang="site.language ?? 'en-US'" :data-timezone="site.timezone">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <meta name="color-scheme" content="light dark">
8
+
9
+ <title @text="[$data.title, site.title].filter(Boolean).join(' | ')"></title>
10
+ <meta name="description" :content="$data.description ?? site?.description">
11
+ <meta name="author" :content="site?.author">
12
+ <meta name="generator" :content="eleventy?.generator">
13
+ <meta name="robots" content="noindex, nofollow"
14
+ webc:if="$data.indexed == false || $data.draft == true || $data.instructorOnly == true || $data.site.preview">
15
+
16
+ <link rel="icon" href="/favicon.svg" type="image/svg+xml">
17
+
18
+
19
+ <template webc:nokeep @raw="bundleFile('css', 'content/styles/base.css', $data, 'site')"></template>
20
+ <style webc:keep @raw="getBundle('css', 'site')"></style>
21
+ <style webc:keep @raw="getBundle('css')"></style>
22
+ </head>
23
+
24
+ <body>
25
+ <main id="main-content" tabindex="-1" @raw="content"></main>
26
+
27
+ <script>
28
+ // Print every disclosure expanded, then restore the reader's own state
29
+ // (tracked per element — bundle scripts share one module scope).
30
+ window.addEventListener("beforeprint", () => {
31
+ for (const details of document.querySelectorAll("details:not([open])")) {
32
+ details.open = true;
33
+ details.dataset.printOpened = "";
34
+ }
35
+ });
36
+ window.addEventListener("afterprint", () => {
37
+ for (const details of document.querySelectorAll("details[data-print-opened]")) {
38
+ details.open = false;
39
+ delete details.dataset.printOpened;
40
+ }
41
+ });
42
+ </script>
43
+
44
+ <template webc:nokeep @raw="bundleFile('js', 'content/scripts/practice.js', $data)"></template>
45
+ <script type="application/json" id="copy-data" webc:keep @raw="copyJson($data)"></script>
46
+ <script webc:keep @raw="copyReader()"></script>
47
+ <script type="module" webc:keep @raw="getBundle('js')"></script>
48
+ <theme-panel webc:if="$data.themePanel" context="site"></theme-panel>
49
+ <script type="module" src="/js/theme-panel.js" webc:keep webc:if="$data.themePanel"></script>
50
+ </body>
51
+
52
+ </html>
package/lib/assets.js ADDED
@@ -0,0 +1,42 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+
4
+ import { packageRoot } from "./paths.js";
5
+
6
+ const root = path.join(packageRoot, "assets");
7
+
8
+ /**
9
+ * Resolve an asset: the course repo's copy wins, else the package's.
10
+ * @param {string} rel path under the input dir, e.g. "styles/deck.css"
11
+ * @param {string} [inputDir] the course repo's input directory
12
+ * @returns {string | null} absolute path, or null when neither has it
13
+ */
14
+ export function assetPath(rel, inputDir = "content") {
15
+ const local = path.resolve(inputDir, rel);
16
+ if (fs.existsSync(local)) return local;
17
+ const shared = path.join(root, rel);
18
+ return fs.existsSync(shared) ? shared : null;
19
+ }
20
+
21
+ /**
22
+ * @param {string} dir
23
+ * @returns {string[]} file names directly in dir; [] when it is missing
24
+ */
25
+ const list = (dir) => (fs.existsSync(dir) ? fs.readdirSync(dir).filter((file) => fs.statSync(path.join(dir, file)).isFile()) : []);
26
+
27
+ /**
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.
30
+ * @param {import('@11ty/eleventy').UserConfig} config
31
+ * @param {{ inputDir?: string, exclude?: string[] }} [options] `exclude` lists assets to skip, e.g. ["styles/semantics.css"]
32
+ */
33
+ export function registerAssets(config, { inputDir = "content", exclude = [] } = {}) {
34
+ for (const kind of ["styles", "scripts"]) {
35
+ for (const file of list(path.join(root, kind))) {
36
+ if (exclude.includes(`${kind}/${file}`) || fs.existsSync(path.join(inputDir, kind, file))) continue;
37
+ config.addTemplate(`${kind}/${file}`, fs.readFileSync(path.join(root, kind, file), "utf8"));
38
+ }
39
+ }
40
+ const fonts = list(path.join(root, "fonts")).filter((file) => !fs.existsSync(path.join(inputDir, "fonts", file)));
41
+ config.addPassthroughCopy(Object.fromEntries(fonts.map((file) => [path.join(root, "fonts", file), `/${config.directoryAssignments.fonts}/${file}`])));
42
+ }