@allons-y/course-kit 0.0.0-stage → 0.2.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 +19 -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 +2091 -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 +432 -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 +370 -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 +656 -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 +61 -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 +231 -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 +119 -4
  128. package/schemas/course.schema.json +161 -0
  129. package/schemas/dates.schema.json +165 -0
  130. package/schemas/grading.schema.json +59 -0
  131. package/schemas/instructor.schema.json +76 -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
package/lib/copy.js ADDED
@@ -0,0 +1,656 @@
1
+ import { readFileSync, statSync } from "node:fs";
2
+ import { join } from "node:path";
3
+
4
+ /**
5
+ * Every student-facing string, by namespace. A course overrides any of them in
6
+ * `_data/strings.json`, which has this shape and is partial. A key with
7
+ * `_one` / `_other` variants is picked by a count; `{name}` marks a value filled
8
+ * at render time. The same table reaches scripts through the `#copy-data` block.
9
+ * @type {Record<string, Record<string, string | Record<string, string>>>}
10
+ */
11
+ export const COPY_DEFAULTS = {
12
+ common: {
13
+ sep: " · ",
14
+ },
15
+ nav: {
16
+ site: "Site",
17
+ syllabus: "Syllabus",
18
+ contact: "Contact",
19
+ openSource: "Open source",
20
+ },
21
+ code: {
22
+ copy: "Copy code",
23
+ copied: "Copied",
24
+ selected: "Code selected. Press your copy shortcut.",
25
+ plain: "Code",
26
+ languages: {
27
+ bash: "Terminal",
28
+ sh: "Terminal",
29
+ shell: "Terminal",
30
+ zsh: "Terminal",
31
+ console: "Terminal",
32
+ shellsession: "Terminal",
33
+ css: "CSS",
34
+ scss: "SCSS",
35
+ html: "HTML",
36
+ markup: "HTML",
37
+ webc: "WebC",
38
+ njk: "Nunjucks",
39
+ xml: "XML",
40
+ svg: "SVG",
41
+ js: "JavaScript",
42
+ javascript: "JavaScript",
43
+ jsx: "JSX",
44
+ ts: "TypeScript",
45
+ typescript: "TypeScript",
46
+ json: "JSON",
47
+ md: "Markdown",
48
+ markdown: "Markdown",
49
+ php: "PHP",
50
+ py: "Python",
51
+ python: "Python",
52
+ java: "Java",
53
+ sql: "SQL",
54
+ http: "HTTP",
55
+ yaml: "YAML",
56
+ yml: "YAML",
57
+ text: "Text",
58
+ },
59
+ },
60
+ home: {
61
+ heading: "Where the course is",
62
+ todayLabel: "Today's class",
63
+ nextLabel: "Next class",
64
+ firstLabel: "First class",
65
+ when: "Week {week} · {weekday}, {date}",
66
+ openSlides: "Open the slides",
67
+ seeWeek: "See the week",
68
+ comingUp: "Coming up",
69
+ fullSchedule: "Full schedule",
70
+ nothingDue: "Nothing else is due this term.",
71
+ dueToday: "Today",
72
+ dueTomorrow: "Tomorrow",
73
+ dueInDays_one: "In {count} day",
74
+ dueInDays_other: "In {count} days",
75
+ progress: "Progress",
76
+ weeksDone: "{done} of {total} weeks done",
77
+ week: "Week {week}",
78
+ stateDone: "Done",
79
+ stateNow: "Now",
80
+ },
81
+ schedule: {
82
+ thisWeek: "This week",
83
+ upNext: "Up next",
84
+ read: "Read",
85
+ dueThisWeek: "Due this week",
86
+ today: "Today",
87
+ next: "Next",
88
+ stateDone: "Done",
89
+ stateNow: "Now",
90
+ hidePast: "Hide past weeks",
91
+ weeksDone: "{done} of {total} weeks done.",
92
+ pastHidden_one: "{count} finished week hidden.",
93
+ pastHidden_other: "{count} finished weeks hidden.",
94
+ weekHeading: "Week {week}",
95
+ colClass: "Class",
96
+ colTopics: "Topics",
97
+ colFor: "For this class",
98
+ readBefore: "Read before class",
99
+ due: "Due",
100
+ dueOn: "due {when}",
101
+ materials: "Materials",
102
+ slides: "Slides",
103
+ addendum: "Addendum",
104
+ weekResources: "This week’s resources",
105
+ noClass: "No class — {reason}",
106
+ substitution: "Runs a {weekday} schedule",
107
+ dueKeyLabel: "Key to due items",
108
+ graded: "graded",
109
+ notGraded: "not graded",
110
+ dueKindTest: "Test",
111
+ dueKindGraded: "Graded",
112
+ dueKindReading: "Reading check",
113
+ dueKindPractice: "Practice",
114
+ finalExam: "Final exam",
115
+ },
116
+ glossary: {
117
+ groupBy: "Group by",
118
+ byAz: "A to Z",
119
+ byTest: "Test",
120
+ byMeeting: "Class meeting",
121
+ mode: "Mode",
122
+ review: "Review",
123
+ flashcards: "Flashcards",
124
+ search: "Search terms",
125
+ clear: "Clear",
126
+ clearSearch: "Clear search",
127
+ filterSummary: "Filter by test or {reading}",
128
+ filtersOn: "({count} on)",
129
+ count: "{shown} of {total} terms",
130
+ clearFilters: "Clear filters",
131
+ removeFilter: "Remove {kind} filter: {label}",
132
+ meetingChip: "Class meeting: {label}",
133
+ taughtIn: "Taught in",
134
+ slideRef: "Week {week} · {weekday}, slide {slide}",
135
+ example: "Example",
136
+ known: "✓ known",
137
+ noMatch: "No terms match.",
138
+ noMatchHint: "Clear the search or a filter to see more.",
139
+ noMatchStudy: "Clear the search or a filter to study more.",
140
+ terms_one: "{count} term",
141
+ terms_other: "{count} terms",
142
+ card: "Card {n} of {total}",
143
+ toStudy: "{count} to study",
144
+ knownOf: "{known} of {total} known",
145
+ shuffle: "Shuffle",
146
+ defFirst: "Definition first",
147
+ resetKnown: "Reset known",
148
+ knownMeter: "Known terms",
149
+ allKnown: "You know every card in this set.",
150
+ markedKnown: "{known} of {total} marked known.",
151
+ startOver: "Start over with the ones I know",
152
+ showDefinition: "Show definition",
153
+ showTerm: "Show term",
154
+ iKnow: "I know this",
155
+ later: "Show me again later",
156
+ prev: "← Previous",
157
+ next: "Next →",
158
+ hint: "Space reveals · arrows move",
159
+ defShown: "Definition shown for {term}",
160
+ symbols: "Symbols",
161
+ glossary: "Glossary",
162
+ courseGlossary: "Course glossary",
163
+ slidesOnly: "Slides only",
164
+ finalExam: "Final exam",
165
+ reading: "Reading",
166
+ chapter: "Chapter",
167
+ section: "Section",
168
+ unit: "Unit",
169
+ module: "Module",
170
+ lesson: "Lesson",
171
+ termsFromClassEach: "terms from class. Each carries tags for its test, its {reading} and the meeting that taught it. Group by any of them, search, or narrow the list to what you are studying.",
172
+ },
173
+ practice: {
174
+ colSheet: "Practice sheet",
175
+ colFor: "For",
176
+ caption: "Every practice sheet, with what it is for",
177
+ empty: "No practice sheets posted yet.",
178
+ },
179
+ syllabus: {
180
+ due: "Due:",
181
+ projectDue: "{date}, {time}",
182
+ projectPage: "Full requirements, milestone dates, and the grading rubric are on {link}.",
183
+ projectPageLink: "the project page",
184
+ syllabus: "Syllabus",
185
+ learningOutcomes: "Learning outcomes",
186
+ uponCompletingThisCourse: "Upon completing this course students will be able to:",
187
+ additionalOutcomesInThis: "Additional outcomes in this section",
188
+ additionalOutcomes: "Additional outcomes",
189
+ text: "Text",
190
+ noTextIsRequired: "No text is required.",
191
+ required: "Required:",
192
+ technology: "Technology",
193
+ bringALaptopMeeting: "Bring a laptop meeting the minimum specifications specified by {institution} to class every day.",
194
+ theCollege: "the college",
195
+ accessIsRequired: "{lms} access is required.",
196
+ coursework: "Coursework",
197
+ exam: "Exam:",
198
+ points: "{display}, {points} points",
199
+ atTheLastClassMeeting: "at the last class meeting, {lastMeeting}",
200
+ grading: "Grading",
201
+ keyDates: "Key dates",
202
+ thisSectionsFinalExam: "This section's final exam",
203
+ classStart: "{days} at {time}",
204
+ },
205
+ courseSummary: {
206
+ projectDue: "The final project is due {when}; its milestones and rubric are on {link}.",
207
+ projectDueShort: "The final project is due {when}.",
208
+ projectPageLink: "the project page",
209
+ howThisSectionIs: "How this section is taught",
210
+ scheduleClassResources: "Schedule & class resources",
211
+ prerequisites: "Prerequisites:",
212
+ thisIsAProposed: "This is a proposed outline of topics and is subject to change. Any changes will be announced in class.",
213
+ eachWeekListsWhatTo: "Each week lists what to read before its first meeting and the resources posted after class.",
214
+ allAssignmentsWillBe: "All assignments will be posted in {lms}.",
215
+ theFinalExamFalls: "The final exam falls in the exam period ({period}); the exact date and time will be announced in class.",
216
+ thisSectionsFinalExamIs: "This section's final exam is {slot} — see the {link} section.",
217
+ coursework: "Coursework",
218
+ thisDocumentOmitsTheWeekbyweek: "This document omits the week-by-week schedule, which may be adjusted during the term{live}.",
219
+ theLiveScheduleIsPublished: "; the live schedule is published at {url}",
220
+ },
221
+ worksheet: {
222
+ notice: "Nothing here is recorded or submitted.",
223
+ 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.",
224
+ termsHeading: "Terms to know",
225
+ termsHint: "Select a term for its definition, and a link to the source it comes from.",
226
+ termSource: "",
227
+ citeHeading: "Where this comes from",
228
+ citeLabel: "Where this comes from, question",
229
+ chooseOne: "Choose one answer",
230
+ checkAll: "See results",
231
+ resetAll: "Clear my answers",
232
+ checkSection: "Check section",
233
+ resetSection: "Clear section",
234
+ section: "Section",
235
+ wordBank: "Word bank",
236
+ answer: "Answer:",
237
+ showAnswer: "Show the answer",
238
+ checkYourself: "Check yourself",
239
+ verdict: "Verdict",
240
+ judgeLine: "Select the line that causes the problem",
241
+ judgeNoLine: "No line — it is fine as written",
242
+ notGraded: "Not graded",
243
+ navHeading: "Questions",
244
+ resultsHeading: "Results",
245
+ retryMissed: "Try missed questions",
246
+ scoreOf: "of {total}",
247
+ statusRight: "Correct",
248
+ statusWrong: "Try again",
249
+ statusPartial: "Unfinished",
250
+ statusUnattempted: "Unattempted",
251
+ statusAnswered: "Not checked",
252
+ statusSelf: "Check yourself",
253
+ tallyCorrect: "{right} of {total} correct",
254
+ tallyWrong: "{count} to try again",
255
+ tallyPartial: "{count} unfinished",
256
+ tallyUnattempted: "{count} unattempted",
257
+ tallySelf: "{count} to check yourself",
258
+ feedbackRight: "Correct.",
259
+ feedbackRightAll: "Correct: all {total} parts.",
260
+ feedbackParts: "{right} of {total} parts correct",
261
+ feedbackBlank: "{count} left blank",
262
+ feedbackUnattempted: "Unattempted.",
263
+ retryCount_one: "{count} question to try again",
264
+ retryCount_other: "{count} questions to try again",
265
+ confirmClearAll: "Clear every answer on this worksheet? This can't be undone.",
266
+ confirmClearSection: "Clear every answer in this section? This can't be undone.",
267
+ checkOne: "Check answer",
268
+ restored: "Restored your answers from {when}.",
269
+ },
270
+ siteFooter: {
271
+ pages: "Pages",
272
+ policies: "Policies",
273
+ },
274
+ courseDocuments: {
275
+ additionalResources: "Additional resources",
276
+ },
277
+ policies: {
278
+ policies: "Policies",
279
+ readTheFullPolicy: "Read the full policy",
280
+ },
281
+ grading: {
282
+ gradeWeighting: "Grade weighting",
283
+ category: "Category",
284
+ weight: "Weight",
285
+ gradingScale: "Grading scale",
286
+ grade: "Grade",
287
+ weightedAverage: "Weighted average",
288
+ andAbove: "{min} and above",
289
+ below: "below {max}",
290
+ },
291
+ scheduleOverview: {
292
+ schedule: "Schedule",
293
+ keyDates: "Key dates",
294
+ jumpTo: "Jump to",
295
+ tests: "Tests",
296
+ finalProject: "Final project",
297
+ finalExam: "Final exam",
298
+ exam: "Exam",
299
+ noClass: "No class",
300
+ },
301
+ slideTimetable: {
302
+ everySlideDeckFor: "Every slide deck for this section, one row per week and one column per meeting day",
303
+ week: "Week",
304
+ noMeeting: "No meeting",
305
+ noClass: "No class: {reason}",
306
+ noDeck: "No deck",
307
+ draftNotInThe: "Draft, not in the student build",
308
+ speakerNotes: "Speaker notes",
309
+ addendumDraftNotIn: "Addendum draft, not in the student build",
310
+ addendumSpeakerNotes: "Addendum speaker notes",
311
+ },
312
+ tableRubric: {
313
+ criteria: "Criteria",
314
+ points: "Points",
315
+ pointsEach: "{points} points",
316
+ totalPointsPossible: "Total points possible",
317
+ milestone: "Milestone",
318
+ due: "Due",
319
+ whatIsGraded: "What is graded",
320
+ },
321
+ demoWeeks: {
322
+ lessonPlan: "Lesson plan",
323
+ shownAgainFirstUsed: "Shown again, first used {date}",
324
+ downloadTheHtmlFile: "Download the HTML file",
325
+ usedAgain: "Used again {dates}",
326
+ },
327
+ instructor: {
328
+ yourInstructor: "Your instructor",
329
+ name: "Name",
330
+ office: "Office",
331
+ officeHours: "Office hours",
332
+ email: "Email",
333
+ message: "Message",
334
+ sendMeAMessage: "Send me a message",
335
+ blog: "Blog",
336
+ instructor: "Instructor",
337
+ contact: "Contact",
338
+ blogUrl: "Blog: {url}",
339
+ },
340
+ codepenEmbed: {
341
+ theCode: "The code",
342
+ html: "HTML",
343
+ css: "CSS",
344
+ javascript: "JavaScript",
345
+ htmlSource: "HTML source",
346
+ cssSource: "CSS source",
347
+ javascriptSource: "JavaScript source",
348
+ },
349
+ base: {
350
+ skipToContent: "Skip to content",
351
+ },
352
+ deck: {
353
+ skipToFirstSlide: "Skip to first slide",
354
+ slides: "Slides",
355
+ previousSlide: "Previous slide",
356
+ nextSlide: "Next slide",
357
+ cycleColorTheme: "Cycle color theme",
358
+ toggleFullscreen: "Toggle fullscreen",
359
+ },
360
+ document: {
361
+ contents: "Contents",
362
+ },
363
+ lesson: {
364
+ lessonPlans: "Lesson plans",
365
+ onePlanPerClass: "One plan per class meeting ({time}), generated from the course schedule and the academic calendar. Holidays are shown in sequence so the term reads day by day.",
366
+ slideIndex: "Slide index",
367
+ everyDeckInMeeting: "{link} — every deck in meeting order. Speaker notes are on a separate printable sheet per deck, linked as \"Notes\" below.",
368
+ exercises: "Exercises",
369
+ theBriefAndStarter: "{link} — the brief and starter for each. Exercises due on a meeting are linked from its row below.",
370
+ instructorDeadlines: "Instructor deadlines",
371
+ dueDate: "Due date",
372
+ everyClassMeetingOf: "Every class meeting of the term, in order",
373
+ date: "Date",
374
+ links: "Links",
375
+ topics: "Topics",
376
+ runsASchedule: "(runs a {weekday} schedule)",
377
+ noClass: "No class — {reason}",
378
+ lessonPlan: "Lesson\u00a0plan",
379
+ slides: "Slides",
380
+ addendum: "Addendum",
381
+ notes: "Notes",
382
+ addendumNotes: "Addendum notes",
383
+ due: "Due:",
384
+ },
385
+ lessonDay: {
386
+ weekDayLesson: "Week {week}, Day {day} — Lesson Plan",
387
+ },
388
+ lessonDetail: {
389
+ week: "Week {week}",
390
+ weekDay: "Week {week}, Day {day}",
391
+ noClass: "No class",
392
+ lessonNavigation: "Lesson navigation",
393
+ allLessons: "All lessons",
394
+ previousDay: "Previous day",
395
+ nextDay: "Next day",
396
+ classMeetingOfThe: "Class meeting #{meeting} of the term",
397
+ noClassOn: "No class on {reason}. Use this day to prep the next lesson or catch up on grading.",
398
+ focus: "Focus:",
399
+ thisMeetingRunsA: "This meeting runs a {weekday} schedule (college-wide) — plan the substituted day's session, not this weekday's usual rhythm.",
400
+ aTestIsScheduledThis: "A test is scheduled this week — confirm day, reserve class time, and remind students at least one meeting ahead.",
401
+ thisWeeksTopics: "This week's topics",
402
+ beforeClass: "Before class",
403
+ reviewTheReadingsSee: "Review the readings (see materials below)",
404
+ prepareupdateSlidesAndLivedemo: "Prepare/update slides and live-demo code",
405
+ printOrOpenThe: "Print or open the {link}",
406
+ speakerNotesSheet: "speaker notes sheet",
407
+ stageStarterFilesOr: "Stage starter files or lab handout if needed",
408
+ checkForStudentQuestions: "Check {lms} for student questions or submissions",
409
+ lessonOutline: "Lesson outline",
410
+ lessonOutlineMinutes: "Lesson outline ({minutes} minutes)",
411
+ time: "Time",
412
+ segment: "Segment",
413
+ min: "{minutes} min",
414
+ afterClass: "After class",
415
+ postHandoutsToAnd: "Post handouts to {resources} and link them in {schedule}'s {list} for the week; the slide deck publishes itself from {slides}, so it only needs a link there if students should see it from the schedule",
416
+ noteAnythingNotCovered: "Note anything not covered and roll it into the next lesson",
417
+ postOrGradeLabhomework: "Post or grade lab/homework in {lms} as needed",
418
+ lessonTools: "Lesson tools",
419
+ onThisPage: "On this page",
420
+ materialsLinks: "Materials & links",
421
+ },
422
+ lessonMaterials: {
423
+ slidesForThisMeeting: "Slides for this meeting",
424
+ speakerNotes: "speaker notes",
425
+ printable: "(printable)",
426
+ demosFromThisMeeting: "Demos from this meeting",
427
+ exercisesDue: "Exercises due",
428
+ readingForThisMeeting: "Reading for this meeting",
429
+ due: "due {when}",
430
+ deadlinesToAnnounce: "Deadlines to announce",
431
+ assignedBeforeThisWeek: "Assigned before this week",
432
+ postedForTheClass: "Posted for the class",
433
+ nothingPostedForThis: "Nothing posted for this week yet.",
434
+ },
435
+ lessons: {
436
+ welcomeRecapThePrevious: "Welcome, recap the previous class, open questions",
437
+ welcomeIntroductionsHowThe: "Welcome, introductions, how the course runs",
438
+ instructionThisWeeksTopics: "Instruction: this week's topics (see above)",
439
+ guidedPracticeLabWork: "Guided practice / lab work",
440
+ wrapupRecapPreviewNext: "Wrap-up: recap, preview next class, assignment reminders",
441
+ buffer: "Buffer",
442
+ collegeHoliday: "College holiday",
443
+ introduceThisWeeksMaterial: "Introduce this week's material",
444
+ continuePracticeAndLab: "Continue, practice, and lab work",
445
+ tbd: "TBD",
446
+ },
447
+ term: {
448
+ classesBegin: "Classes begin",
449
+ collegeHoliday: "College holiday",
450
+ lastDayOfClasses: "Last day of classes",
451
+ readingDaysNoClasses: "Reading days (no classes or exams)",
452
+ finalExaminationPeriod: "Final examination period",
453
+ preregistrationForTheNext: "Pre-registration for the next term opens",
454
+ },
455
+ deckNotes: {
456
+ speakerNotes: "Speaker notes",
457
+ speakerNotesTitle: "Speaker notes: {title}",
458
+ weekDay: "Week {week}, Day {day}",
459
+ speakerNotesInstructorOnly: "Speaker notes · instructor only",
460
+ slideOpenInThe: "Slide {number}, open in the deck",
461
+ untitledSlide: "Untitled slide",
462
+ },
463
+ lessonPlans: {
464
+ lessonPlans: "Lesson plans",
465
+ navTitle: "Lesson Plans",
466
+ },
467
+ callout: {
468
+ success: "Success",
469
+ warning: "Warning",
470
+ error: "Error",
471
+ },
472
+ markdown: {
473
+ permalinkToThisHeading: "Permalink to this heading",
474
+ },
475
+ pdf: {
476
+ footer: "{course}: {name} — {term} syllabus · Generated {generated} ({version}) · Page {page} of {pages}",
477
+ },
478
+ themePanel: {
479
+ brand: "Brand",
480
+ brandColor: "Brand color",
481
+ brandColorForText: "Brand color for text",
482
+ textOnBrandColor: "Text on brand color",
483
+ wayfindingColor: "Wayfinding color",
484
+ textOnWayfindingColor: "Text on wayfinding color",
485
+ page: "Page",
486
+ pageBackground: "Page background",
487
+ cardsAndPanels: "Cards and panels",
488
+ linesAndBorders: "Lines and borders",
489
+ text: "Text",
490
+ bodyText: "Body text",
491
+ secondaryText: "Secondary text",
492
+ links: "Links",
493
+ theme: "Theme",
494
+ unsavedChanges: "Unsaved changes",
495
+ preview: "Preview",
496
+ light: "Light",
497
+ dark: "Dark",
498
+ everyColor: "Every color",
499
+ allTokens: "All tokens",
500
+ gradient: "Gradient",
501
+ addAColor: "Add a color",
502
+ undo: "Undo",
503
+ reset: "Reset",
504
+ save: "Save",
505
+ download: "Download",
506
+ hideTheThemePanel: "Hide the theme panel",
507
+ notACssColor: "Not a CSS color",
508
+ cssValue: "{name}, CSS value",
509
+ backToTheSaved: "Back to the saved theme.",
510
+ thePage: "the page",
511
+ theBrandColor: "the brand color",
512
+ passes: "passes",
513
+ below: "below {minimum} : 1",
514
+ contrast: "{ratio} : 1 on {ground}, {verdict}",
515
+ color: "Color {n}",
516
+ removeColor: "Remove color {n}",
517
+ saving: "Saving…",
518
+ savedToThe: "Saved to {file}. The site is rebuilding.",
519
+ notSaved: "Not saved: {message}",
520
+ downloadedPutItIn: "Downloaded. Put it in {folder} to keep it.",
521
+ },
522
+ promptCopy: {
523
+ copyThisPrompt: "Copy this prompt",
524
+ promptCopied: "Prompt copied",
525
+ promptCopiedToThe: "Prompt copied to the clipboard.",
526
+ promptSelectedPressYour: "Prompt selected — press your copy shortcut.",
527
+ },
528
+ };
529
+
530
+ let cachedDir = "_data";
531
+ /** The course's own namespaces, remembered like `cachedDir`. */
532
+ let cachedExtra = {};
533
+ /** The last copy built, reused until `strings.json` changes. */
534
+ let resolved = null;
535
+
536
+ const isObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
537
+
538
+ /**
539
+ * Throw on any key `strings.json` names that is not a copy key, or a value that is not a string.
540
+ * @param {object} strings the parsed file
541
+ */
542
+ const checkStrings = (strings, defaults) => {
543
+ for (const [ns, table] of Object.entries(strings)) {
544
+ if (ns === "$schema") continue;
545
+ if (!(ns in defaults) || !isObject(table)) throw new Error(`strings.json: "${ns}${isObject(table) ? `.${Object.keys(table)[0] ?? ""}` : ""}" is not a copy key`);
546
+ for (const [key, value] of Object.entries(table)) {
547
+ if (!(key in defaults[ns])) throw new Error(`strings.json: "${ns}.${key}" is not a copy key`);
548
+ if (ns === "code" && key === "languages") {
549
+ if (!isObject(value) || !Object.values(value).every((label) => typeof label === "string")) throw new Error("strings.json: \"code.languages\" must map language names to strings");
550
+ } else if (typeof value !== "string") {
551
+ throw new Error(`strings.json: "${ns}.${key}" must be a string`);
552
+ }
553
+ }
554
+ }
555
+ };
556
+
557
+ /**
558
+ * The copy: the defaults, then the course's `_data/strings.json` over them.
559
+ * `extra` adds a course's own namespaces (for components only that course has) beside the shared ones; `strings.json` can override those too.
560
+ * A name the shared table already uses is refused, so a course can never change what a kit component reads.
561
+ * Remembers the `dataDir` and `extra` it is given, so a later call without them (a worksheet, the markdown renderer) reads the same copy.
562
+ * @param {{ dataDir?: string, extra?: Record<string, Record<string, string>> }} [options]
563
+ * @returns {typeof COPY_DEFAULTS}
564
+ */
565
+ export function resolveCopy({ dataDir, extra } = {}) {
566
+ if (dataDir) cachedDir = dataDir;
567
+ if (extra && extra !== cachedExtra) {
568
+ for (const ns of Object.keys(extra)) if (ns in COPY_DEFAULTS) throw new Error(`copy: "${ns}" is a shared namespace; give the course's own strings a namespace of their own.`);
569
+ cachedExtra = extra;
570
+ resolved = null;
571
+ }
572
+ const defaults = { ...COPY_DEFAULTS, ...cachedExtra };
573
+ const file = join(cachedDir, "strings.json");
574
+ let stamp = 0;
575
+ try {
576
+ stamp = statSync(file).mtimeMs;
577
+ } catch {
578
+ // No strings.json: the defaults stand.
579
+ }
580
+ if (resolved?.file === file && resolved.stamp === stamp) return resolved.copy;
581
+ let strings = {};
582
+ if (stamp) {
583
+ try {
584
+ strings = JSON.parse(readFileSync(file, "utf8"));
585
+ } catch (error) {
586
+ throw new Error(`strings.json: ${file} is not valid JSON (${error.message})`, { cause: error });
587
+ }
588
+ }
589
+ checkStrings(strings, defaults);
590
+ const copy = {};
591
+ for (const [ns, table] of Object.entries(defaults)) {
592
+ copy[ns] = { ...table, ...strings[ns] };
593
+ if (ns === "code") copy.code.languages = { ...table.languages, ...strings.code?.languages };
594
+ }
595
+ resolved = { file, stamp, copy };
596
+ return copy;
597
+ }
598
+
599
+ /**
600
+ * Replace each `{name}` in a template.
601
+ * @param {string} template
602
+ * @param {Record<string, unknown>} [vars]
603
+ * @returns {string}
604
+ */
605
+ export const fill = (template, vars = {}) => String(template ?? "").replace(/\{(\w+)\}/g, (_, name) => String(vars[name] ?? ""));
606
+
607
+ /**
608
+ * The variant of a key for a count: `<key>_one`, `<key>_other` and so on, by the language's plural rules.
609
+ * @param {Record<string, string>} table
610
+ * @param {string} key
611
+ * @param {number} count
612
+ * @param {string} [lang]
613
+ * @returns {string}
614
+ */
615
+ export const plural = (table, key, count, lang = "en-US") => table[`${key}_${new Intl.PluralRules(lang).select(count)}`] ?? table[`${key}_other`] ?? table[key] ?? "";
616
+
617
+ /**
618
+ * The namespaces the page scripts read. `#copy-data` carries only these, not every string the build uses. A course whose own script reads
619
+ * more (a demo check, say) adds them with the `clientCopy` option of `courseKit()`. A test scans the kit's scripts and fails if a namespace
620
+ * they read is missing here, or one listed here is read by none.
621
+ */
622
+ export const CLIENT_COPY = ["code", "common", "glossary", "home", "promptCopy", "schedule", "themePanel", "worksheet"];
623
+
624
+ /**
625
+ * The JSON the `#copy-data` block carries: the client namespaces of the copy, with the page's worksheet copy in place of the default.
626
+ * Escapes `<` so the block can never close its own script tag.
627
+ * @param {{ copy: object, worksheet?: { copy?: object } }} data
628
+ * @param {string[]} [extra] more namespaces to carry (the course's `clientCopy`)
629
+ * @returns {string}
630
+ */
631
+ export const copyJson = (data, extra = []) => {
632
+ const carried = {};
633
+ for (const ns of [...CLIENT_COPY, ...extra]) if (ns in data.copy) carried[ns] = data.copy[ns];
634
+ return JSON.stringify({ ...carried, worksheet: data.worksheet?.copy ?? data.copy.worksheet }).replaceAll("<", "\\u003c");
635
+ };
636
+
637
+ /**
638
+ * The script that reads `#copy-data` once and gives every other script the same `window.ckCopy = { data, t }`. A layout renders it right after the block, so it is written without `<`, `>` or `&`, which a layout's filter output would escape;
639
+ * a script reads `window.ckCopy` and never parses the block itself.
640
+ * `t("home", "weeksDone", { done: 3, total: 16 })` fills `{name}` placeholders; a key with `_one` / `_other` variants is picked by `count`.
641
+ */
642
+ export const COPY_READER = `window.ckCopy ??= (function () {
643
+ var data = JSON.parse(document.getElementById("copy-data")?.textContent || "{}");
644
+ var rules = new Intl.PluralRules(document.documentElement.lang || "en-US");
645
+ function t(ns, key, vars) {
646
+ vars = vars || {};
647
+ var table = data[ns] || {};
648
+ var text = table[key];
649
+ if ("count" in vars) if (key + "_other" in table) text = table[key + "_" + rules.select(vars.count)] ?? table[key + "_other"];
650
+ return String(text ?? "").replace(/\\{(\\w+)\\}/g, function (match, name) { return String(vars[name] ?? ""); });
651
+ }
652
+ return { data: data, t: t };
653
+ })();`;
654
+
655
+ /** @returns {string} the reader script, for a layout to render after the `#copy-data` block */
656
+ export const copyReader = () => COPY_READER;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @param {NodeJS.ProcessEnv} [env]
3
+ * @returns {boolean} whether this build is a production build
4
+ */
5
+ export const isProduction = (env = process.env) => (env.ELEVENTY_ENV || "development") === "production";
6
+
7
+ /**
8
+ * The build's audience: anything but "student" is instructor.
9
+ * @param {NodeJS.ProcessEnv} [env]
10
+ * @returns {{ value: string, student: boolean, instructor: boolean }}
11
+ */
12
+ export function resolveAudience(env = process.env) {
13
+ const student = (env.AUDIENCE ?? (isProduction(env) ? "student" : "instructor")) === "student";
14
+ return { value: student ? "student" : "instructor", student, instructor: !student };
15
+ }
16
+
17
+ /**
18
+ * Whether this build writes the syllabus PDF, so a dev build never links one it did not write.
19
+ * @param {NodeJS.ProcessEnv} [env]
20
+ * @returns {{ available: boolean }}
21
+ */
22
+ export const resolvePdf = (env = process.env) => ({ available: isProduction(env) || env.BUILD_PDF === "1" });
@@ -0,0 +1,16 @@
1
+ import { readFileSync } from "node:fs";
2
+
3
+ import { assetPath } from "../assets.js";
4
+
5
+ /**
6
+ * `font.css` with every self-hosted face embedded as a data URI.
7
+ * @param {string} [inputDir]
8
+ * @returns {string}
9
+ */
10
+ export function inlineFontFaces(inputDir = "content") {
11
+ const css = readFileSync(assetPath("styles/font.css", inputDir), "utf8");
12
+ return css.replace(/url\("\.\.\/fonts\/([^"]+)"\)/g, (_, file) => {
13
+ const data = readFileSync(assetPath(`fonts/${file}`, inputDir)).toString("base64");
14
+ return `url("data:font/woff2;base64,${data}")`;
15
+ });
16
+ }